diff --git a/include/render/allocator/drm_dumb.h b/include/render/allocator/drm_dumb.h index 23c150bc3..6356f0305 100644 --- a/include/render/allocator/drm_dumb.h +++ b/include/render/allocator/drm_dumb.h @@ -25,6 +25,7 @@ struct wlr_drm_dumb_allocator { struct wlr_allocator base; struct wl_list buffers; // wlr_drm_dumb_buffer.link int drm_fd; + bool prefer_shadow; }; /** diff --git a/render/allocator/drm_dumb.c b/render/allocator/drm_dumb.c index 6de44f402..a5e270f74 100644 --- a/render/allocator/drm_dumb.c +++ b/render/allocator/drm_dumb.c @@ -97,6 +97,7 @@ static struct wlr_drm_dumb_buffer *create_buffer( .height = buffer->height, .format = format->format, .modifier = DRM_FORMAT_MOD_LINEAR, + .prefer_shadow = alloc->prefer_shadow, .n_planes = 1, .offset[0] = 0, .stride[0] = buffer->stride, @@ -216,6 +217,12 @@ struct wlr_allocator *wlr_drm_dumb_allocator_create(int drm_fd) { return NULL; } + uint64_t prefer_shadow; + if (drmGetCap(drm_fd, DRM_CAP_DUMB_PREFER_SHADOW, &prefer_shadow) < 0) { + wlr_log(WLR_ERROR, "Failed to get DRM capabilities"); + return NULL; + } + struct wlr_drm_dumb_allocator *alloc = calloc(1, sizeof(*alloc)); if (alloc == NULL) { return NULL; @@ -224,6 +231,7 @@ struct wlr_allocator *wlr_drm_dumb_allocator_create(int drm_fd) { WLR_BUFFER_CAP_DATA_PTR | WLR_BUFFER_CAP_DMABUF); alloc->drm_fd = drm_fd; + alloc->prefer_shadow = prefer_shadow; wl_list_init(&alloc->buffers); wlr_log(WLR_DEBUG, "Created DRM dumb allocator");