drm: print try_view_on_plane_failure_reasons bitmask as string

This should help people to debug. Instead of printing an hex value,
print each enum value present in the bitmask as a string (comma
separated).

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2024-10-07 13:39:45 -03:00
parent 4cc489c6af
commit 306033616b

View file

@ -42,6 +42,8 @@
#include "linux-dmabuf.h"
#include "presentation-time-server-protocol.h"
#include "linux-dmabuf-unstable-v1-server-protocol.h"
#include "shared/string-helpers.h"
#include "shared/weston-assert.h"
enum drm_output_propose_state_mode {
DRM_OUTPUT_PROPOSE_STATE_MIXED, /**< mix renderer & planes */
@ -389,6 +391,30 @@ dmabuf_feedback_maybe_update(struct drm_device *device, struct weston_view *ev,
dmabuf_feedback->action_needed = ACTION_NEEDED_NONE;
}
static const char *
failure_reasons_to_str(enum try_view_on_plane_failure_reasons failure_reasons)
{
switch(failure_reasons) {
case FAILURE_REASONS_NONE: return "none";
case FAILURE_REASONS_FORCE_RENDERER: return "force renderer";
case FAILURE_REASONS_FB_FORMAT_INCOMPATIBLE: return "fb format incompatible";
case FAILURE_REASONS_DMABUF_MODIFIER_INVALID: return "dmabuf modifier invalid";
case FAILURE_REASONS_ADD_FB_FAILED: return "add fb failed";
case FAILURE_REASONS_NO_PLANES_AVAILABLE: return "no planes available";
case FAILURE_REASONS_PLANES_REJECTED: return "planes rejected";
case FAILURE_REASONS_INADEQUATE_CONTENT_PROTECTION: return "inadequate content protection";
case FAILURE_REASONS_INCOMPATIBLE_TRANSFORM: return "incompatible transform";
case FAILURE_REASONS_NO_BUFFER: return "no buffer";
case FAILURE_REASONS_BUFFER_TOO_BIG: return "buffer too big";
case FAILURE_REASONS_BUFFER_TYPE: return "buffer type";
case FAILURE_REASONS_GLOBAL_ALPHA: return "global alpha";
case FAILURE_REASONS_NO_GBM: return "no gbm";
case FAILURE_REASONS_GBM_BO_IMPORT_FAILED: return "gbm bo import failed";
case FAILURE_REASONS_GBM_BO_GET_HANDLE_FAILED: return "gbm bo get handle failed";
}
return "???";
}
static struct drm_plane_state *
drm_output_find_plane_for_view(struct drm_output_state *state,
struct weston_paint_node *pnode,
@ -480,11 +506,15 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
FAILURE_REASONS_INCOMPATIBLE_TRANSFORM;
fb = drm_fb_get_from_paint_node(state, pnode);
if (fb)
if (fb) {
possible_plane_mask &= fb->plane_mask;
else
drm_debug(b, "\t\t\t[view] couldn't get FB for view: 0x%lx\n",
(unsigned long) pnode->try_view_on_plane_failure_reasons);
} else {
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[view] couldn't get FB for view: %s\n", fr_str);
free(fr_str);
}
}
view_matches_entire_output =