From b0257e0ffc60fff5914eff8efb96cd1f5883ddc5 Mon Sep 17 00:00:00 2001 From: Marius Vlad Date: Thu, 26 May 2022 19:38:18 +0300 Subject: [PATCH] backend-drm: Add GBM_BO_HANDLE as a failure reason MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And use it to get a feedback event for when adding scanout tranche. With this change, I get back a feedback event for dmabuf-feedback on VC4: ���� tranche: target device /dev/dri/card0, scanout � ���� format ABGR2101010, modifier LINEAR (0x0) � ���� format XBGR2101010, modifier LINEAR (0x0) � ���� format ARGB8888, modifier LINEAR (0x0) � ���� format ABGR8888, modifier LINEAR (0x0) � ���� format XRGB8888, modifier LINEAR (0x0) � ���� format XBGR8888, modifier LINEAR (0x0) � ���� format RGB565, modifier LINEAR (0x0) � ���� format YUV420, modifier LINEAR (0x0) � ���� format YUV422, modifier LINEAR (0x0) � ���� format YVU420, modifier LINEAR (0x0) � ���� format YVU422, modifier LINEAR (0x0) � ���� format NV12, modifier LINEAR (0x0) � ���� format NV12, modifier BROADCOM_SAND128 (0x700000000000004) � ���� format NV16, modifier LINEAR (0x0) � ���� end of tranche Besides that, it can place a fullscreen state of simple-egl on the primary plane, which without this change wasn't possible. Signed-off-by: Marius Vlad --- libweston/backend-drm/drm-internal.h | 1 + libweston/backend-drm/fb.c | 5 ++++- libweston/backend-drm/state-propose.c | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index 1afbaf52..14b5248a 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -246,6 +246,7 @@ enum try_view_on_plane_failure_reasons { FAILURE_REASONS_GLOBAL_ALPHA = 1 << 10, FAILURE_REASONS_NO_GBM = 1 << 11, FAILURE_REASONS_GBM_BO_IMPORT_FAILED = 1 << 12, + FAILURE_REASONS_GBM_BO_GET_HANDLE_FAILED = 1 << 13, }; /** diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c index 71dc1914..eb007340 100644 --- a/libweston/backend-drm/fb.c +++ b/libweston/backend-drm/fb.c @@ -315,8 +315,11 @@ drm_fb_get_from_dmabuf(struct linux_dmabuf_buffer *dmabuf, union gbm_bo_handle handle; handle = gbm_bo_get_handle_for_plane(fb->bo, i); - if (handle.s32 == -1) + if (handle.s32 == -1) { + *try_view_on_plane_failure_reasons |= + FAILURE_REASONS_GBM_BO_GET_HANDLE_FAILED; goto err_free; + } fb->handles[i] = handle.u32; } diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c index 49911d98..82da1f37 100644 --- a/libweston/backend-drm/state-propose.c +++ b/libweston/backend-drm/state-propose.c @@ -341,7 +341,8 @@ dmabuf_feedback_maybe_update(struct drm_backend *b, struct weston_view *ev, (FAILURE_REASONS_ADD_FB_FAILED | FAILURE_REASONS_FB_FORMAT_INCOMPATIBLE | FAILURE_REASONS_DMABUF_MODIFIER_INVALID | - FAILURE_REASONS_GBM_BO_IMPORT_FAILED)) + FAILURE_REASONS_GBM_BO_IMPORT_FAILED | + FAILURE_REASONS_GBM_BO_GET_HANDLE_FAILED)) action_needed |= ACTION_NEEDED_ADD_SCANOUT_TRANCHE; assert(action_needed != (ACTION_NEEDED_REMOVE_SCANOUT_TRANCHE |