From eabc19bc3b85703b97ea654a7e48f361e65805b0 Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Tue, 8 Oct 2024 11:25:37 -0300 Subject: [PATCH] drm: log more try_view_on_plane_failure_reasons Up to now, we've been logging only the failures that we get from drm_fb_get_from_paint_node(). So let's start logging the other failures we get in drm_output_find_plane_for_view() as well. Signed-off-by: Leandro Ribeiro --- libweston/backend-drm/drm-internal.h | 6 ++++-- libweston/backend-drm/fb.c | 17 +++++++++-------- libweston/backend-drm/state-propose.c | 13 +++++++++---- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index 878f38914..4873529cc 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -802,7 +802,8 @@ wdrm_colorspace_from_output(struct weston_output *output); #ifdef BUILD_DRM_GBM extern struct drm_fb * drm_fb_get_from_paint_node(struct drm_output_state *state, - struct weston_paint_node *pnode); + struct weston_paint_node *pnode, + uint32_t *try_view_on_plane_failure_reasons); extern bool drm_can_scanout_dmabuf(struct weston_backend *backend, @@ -810,7 +811,8 @@ drm_can_scanout_dmabuf(struct weston_backend *backend, #else static inline struct drm_fb * drm_fb_get_from_paint_node(struct drm_output_state *state, - struct weston_paint_node *pnode) + struct weston_paint_node *pnode, + uint32_t *try_view_on_plane_failure_reasons) { return NULL; } diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c index 87685b571..c2ecd62c5 100644 --- a/libweston/backend-drm/fb.c +++ b/libweston/backend-drm/fb.c @@ -674,7 +674,8 @@ drm_fb_handle_buffer_destroy(struct wl_listener *listener, void *data) struct drm_fb * drm_fb_get_from_paint_node(struct drm_output_state *state, - struct weston_paint_node *pnode) + struct weston_paint_node *pnode, + uint32_t *try_view_on_plane_failure_reasons) { struct drm_output *output = state->output; struct drm_backend *b = output->backend; @@ -689,13 +690,13 @@ drm_fb_get_from_paint_node(struct drm_output_state *state, if (ev->surface->protection_mode == WESTON_SURFACE_PROTECTION_MODE_ENFORCED && ev->surface->desired_protection > output->base.current_protection) { - pnode->try_view_on_plane_failure_reasons |= + *try_view_on_plane_failure_reasons |= FAILURE_REASONS_INADEQUATE_CONTENT_PROTECTION; return NULL; } if (!buffer) { - pnode->try_view_on_plane_failure_reasons |= FAILURE_REASONS_NO_BUFFER; + *try_view_on_plane_failure_reasons |= FAILURE_REASONS_NO_BUFFER; return NULL; } @@ -711,7 +712,7 @@ drm_fb_get_from_paint_node(struct drm_output_state *state, wl_list_for_each(buf_fb, &private->buffer_fb_list, link) { if (buf_fb->device == device) { - pnode->try_view_on_plane_failure_reasons |= buf_fb->failure_reasons; + *try_view_on_plane_failure_reasons |= buf_fb->failure_reasons; return buf_fb->fb ? drm_fb_ref(buf_fb->fb) : NULL; } } @@ -722,7 +723,7 @@ drm_fb_get_from_paint_node(struct drm_output_state *state, /* GBM is used for dmabuf import as well as from client wl_buffer. */ if (!b->gbm) { - pnode->try_view_on_plane_failure_reasons |= FAILURE_REASONS_NO_GBM; + *try_view_on_plane_failure_reasons |= FAILURE_REASONS_NO_GBM; goto unsuitable; } @@ -741,13 +742,13 @@ drm_fb_get_from_paint_node(struct drm_output_state *state, fb = drm_fb_get_from_bo(bo, device, is_opaque, BUFFER_CLIENT); if (!fb) { - pnode->try_view_on_plane_failure_reasons |= + *try_view_on_plane_failure_reasons |= FAILURE_REASONS_ADD_FB_FAILED; gbm_bo_destroy(bo); goto unsuitable; } } else { - pnode->try_view_on_plane_failure_reasons |= FAILURE_REASONS_BUFFER_TYPE; + *try_view_on_plane_failure_reasons |= FAILURE_REASONS_BUFFER_TYPE; goto unsuitable; } @@ -776,7 +777,7 @@ drm_fb_get_from_paint_node(struct drm_output_state *state, return fb; unsuitable: - pnode->try_view_on_plane_failure_reasons |= buf_fb->failure_reasons; + *try_view_on_plane_failure_reasons |= buf_fb->failure_reasons; return NULL; } #endif diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c index 500bc95ff..3476601c3 100644 --- a/libweston/backend-drm/state-propose.c +++ b/libweston/backend-drm/state-propose.c @@ -456,6 +456,7 @@ drm_output_find_plane_for_view(struct drm_output_state *state, bool view_matches_entire_output, scanout_has_view_assigned; uint32_t possible_plane_mask = 0; + uint32_t fb_failure_reasons = 0; bool any_candidate_picked = false; pnode->try_view_on_plane_failure_reasons = FAILURE_REASONS_NONE; @@ -521,15 +522,15 @@ drm_output_find_plane_for_view(struct drm_output_state *state, pnode->try_view_on_plane_failure_reasons |= FAILURE_REASONS_INCOMPATIBLE_TRANSFORM; - fb = drm_fb_get_from_paint_node(state, pnode); + fb = drm_fb_get_from_paint_node(state, pnode, &fb_failure_reasons); if (fb) { possible_plane_mask &= fb->plane_mask; } else { - char *fr_str = bits_to_str(pnode->try_view_on_plane_failure_reasons, - failure_reasons_to_str); + char *fr_str = bits_to_str(fb_failure_reasons, failure_reasons_to_str); weston_assert_ptr(b->compositor, fr_str); drm_debug(b, "\t\t\t[view] couldn't get FB for view: %s\n", fr_str); free(fr_str); + pnode->try_view_on_plane_failure_reasons |= fb_failure_reasons; } } @@ -949,8 +950,12 @@ drm_output_propose_state(struct weston_output *output_base, pixman_region32_fini(&clipped_view); goto err_region; } else if (!ps) { + char *fr_str = bits_to_str(pnode->try_view_on_plane_failure_reasons, + failure_reasons_to_str); + weston_assert_ptr(b->compositor, fr_str); drm_debug(b, "\t\t\t\t[view] view %p will be placed " - "on the renderer\n", ev); + "on the renderer: %s\n", ev, fr_str); + free(fr_str); } if (!ps || drm_mixed_mode_check_underlay(mode, scanout_state, ps->zpos)) {