diff options
author | Simon Ser <contact@emersion.fr> | 2020-12-14 19:57:05 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-12-22 15:53:10 +0100 |
commit | dabd2e7207ca0cf53d2abce32b3b7531badfa0de (patch) | |
tree | 86069ed107568a15ef7e5908f03e2b47c987f060 /backend | |
parent | 83925f04c36c7c189341800d3303b8262a0de9bc (diff) |
backend/drm: grab DMA-BUF from wlr_buffer instead of gbm_bo
Get the DMA-BUF directly out of the wlr_buffer instead of relying on the
gbm_bo. This eliminates a roundtrip through GBM.
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/drm.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 50256abd..9f3ff355 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -626,14 +626,21 @@ static bool drm_connector_export_dmabuf(struct wlr_output *output, } struct wlr_drm_fb *fb = &crtc->primary->queued_fb; - if (fb->bo == NULL) { + if (fb->wlr_buf == NULL) { fb = &crtc->primary->current_fb; } - if (fb->bo == NULL) { + if (fb->wlr_buf == NULL) { return false; } - return export_drm_bo(fb->bo, attribs); + // export_dmabuf gives ownership of the DMA-BUF to the caller, so we need + // to dup it + struct wlr_dmabuf_attributes buf_attribs = {0}; + if (!wlr_buffer_get_dmabuf(fb->wlr_buf, &buf_attribs)) { + return false; + } + + return wlr_dmabuf_attributes_copy(attribs, &buf_attribs); } struct wlr_drm_fb *plane_get_next_fb(struct wlr_drm_plane *plane) { |