backend/drm: Bail if renderer cannot import DMA-BUFs

We create a renderer for the sole purpose of blitting buffers from a
primary renderer that we might not be able to scan-out from. If we end
up with the pixman renderer, it either won't work becuase it cannot
import dmabufs from the primary renderer, or won't have any effect
because the primary renderer already uses dumb buffers.

We test for DMA-BUF capabilities specifically to make it clear what our
interest is, rather than focusing too much on the pixman renderer.
This commit is contained in:
Kenny Levinsen 2024-11-07 22:05:15 +01:00
parent 55f15d1abd
commit 1dd05437bf

View File

@ -20,6 +20,12 @@ bool init_drm_renderer(struct wlr_drm_backend *drm,
wlr_log(WLR_ERROR, "Failed to create renderer");
return false;
}
if (wlr_renderer_get_texture_formats(renderer->wlr_rend, WLR_BUFFER_CAP_DMABUF) == NULL) {
wlr_log(WLR_ERROR, "Renderer did not support importing DMA-BUFs");
wlr_renderer_destroy(renderer->wlr_rend);
renderer->wlr_rend = NULL;
return false;
}
renderer->allocator = wlr_allocator_autocreate(&drm->backend, renderer->wlr_rend);
if (renderer->allocator == NULL) {