Untitled
diff --git a/render/allocator/udmabuf.c b/render/allocator/udmabuf.c index 123abc..456def 100644 --- a/render/allocator/udmabuf.c +++ b/render/allocator/udmabuf.c @@ -89,18 +89,31 @@ struct wlr_buffer *wlr_udmabuf_allocator_create_buffer( struct wlr_drm_format_set *render_formats) { struct wlr_udmabuf_allocator *alloc = udmabuf_allocator_from_alloc(wlr_alloc); + wlr_log(WLR_DEBUG, "Creating buffer with dimensions: %dx%d", width, height); + wlr_log(WLR_DEBUG, "Format: %d, Modifier: %lu", format->format, format->modifiers[0]); + size_t size = width * height * 4; // Assuming 4 bytes per pixel + wlr_log(WLR_DEBUG, "Calculated buffer size: %zu bytes", size); int fd = open("/dev/udmabuf0", O_RDWR | O_CLOEXEC); if (fd < 0) { + wlr_log(WLR_ERROR, "Failed to open udmabuf device: %s", strerror(errno)); return NULL; } + // Print current process UID and file permissions + struct stat st; + if (fstat(fd, &st) == 0) { + wlr_log(WLR_DEBUG, "File permissions: %o, UID: %d, GID: %d", + st.st_mode & 0777, st.st_uid, st.st_gid); + } + void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (data == MAP_FAILED) { - wlr_log(WLR_ERROR, "Failed to mmap udmabuf fd"); + wlr_log(WLR_ERROR, "Failed to mmap udmabuf fd: %s (fd: %d, size: %zu)", + strerror(errno), fd, size); close(fd); return NULL; } + wlr_log(WLR_DEBUG, "Successfully mapped buffer at address: %p", data); struct wlr_dmabuf_buffer *buffer = calloc(1, sizeof(*buffer)); if (buffer == NULL) { @@ -115,6 +128,7 @@ struct wlr_buffer *wlr_udmabuf_allocator_create_buffer( buffer->data = data; buffer->size = size; buffer->fd = fd; + wlr_log(WLR_DEBUG, "Created buffer object with fd: %d", buffer->fd); return &buffer->base; }
Leave a Comment