render/pixman: Add dmabuf support

Adds linux-dmabuf support to the pixman renderer.  The main reason is so
clients can use GPU-accelerated rendering even if the compositor is
using the pixman renderer for whatever reason.  This also allows the
pixman renderer to import dmabufs (only RGB/ARGB formats, not YUV for
now).

Since after this change all renderers store a DRM FD, I move the drm_fd
from the individual implementations to the shared wlr_renderer base.
This means that renderer_autocreate() can set pixman's drm_fd for it and
the pixman renderer doesn't have to know about DRM at all.

Originally based on
961edfe44e
This commit is contained in:
David Turner 2024-06-10 17:10:20 +01:00
parent 27bbb91abf
commit e4ccc8e822
10 changed files with 36 additions and 42 deletions

View file

@ -458,7 +458,6 @@ struct wlr_vk_device *vulkan_device_create(struct wlr_vk_instance *ini,
dev->phdev = phdev;
dev->instance = ini;
dev->drm_fd = -1;
// For dmabuf import we require at least the external_memory_fd,
// external_memory_dma_buf, queue_family_foreign,
@ -665,10 +664,6 @@ void vulkan_device_destroy(struct wlr_vk_device *dev) {
vkDestroyDevice(dev->dev, NULL);
}
if (dev->drm_fd > 0) {
close(dev->drm_fd);
}
wlr_drm_format_set_finish(&dev->dmabuf_render_formats);
wlr_drm_format_set_finish(&dev->dmabuf_texture_formats);
wlr_drm_format_set_finish(&dev->shm_texture_formats);