diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index df704926..f9d21e3b 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -232,12 +232,18 @@ enum wdrm_crtc_property { */ enum try_view_on_plane_failure_reasons { FAILURE_REASONS_NONE = 0, - FAILURE_REASONS_FORCE_RENDERER = (1 << 0), - FAILURE_REASONS_FB_FORMAT_INCOMPATIBLE = (1 << 1), - FAILURE_REASONS_DMABUF_MODIFIER_INVALID = (1 << 2), - FAILURE_REASONS_ADD_FB_FAILED = (1 << 3), - FAILURE_REASONS_NO_PLANES_AVAILABLE = (1 << 4), - FAILURE_REASONS_PLANES_REJECTED = (1 << 5), + FAILURE_REASONS_FORCE_RENDERER = 1 << 0, + FAILURE_REASONS_FB_FORMAT_INCOMPATIBLE = 1 << 1, + FAILURE_REASONS_DMABUF_MODIFIER_INVALID = 1 << 2, + FAILURE_REASONS_ADD_FB_FAILED = 1 << 3, + FAILURE_REASONS_NO_PLANES_AVAILABLE = 1 << 4, + FAILURE_REASONS_PLANES_REJECTED = 1 << 5, + FAILURE_REASONS_INADEQUATE_CONTENT_PROTECTION = 1 << 6, + FAILURE_REASONS_INCOMPATIBLE_TRANSFORM = 1 << 7, + FAILURE_REASONS_NO_BUFFER = 1 << 8, + FAILURE_REASONS_BUFFER_TYPE = 1 << 9, + FAILURE_REASONS_GLOBAL_ALPHA = 1 << 10, + FAILURE_REASONS_NO_GBM = 1 << 11, }; /** diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c index 718095c9..e563b52e 100644 --- a/libweston/backend-drm/fb.c +++ b/libweston/backend-drm/fb.c @@ -525,18 +525,29 @@ drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev, struct drm_fb *fb; struct drm_plane *plane; - if (ev->alpha != 1.0f) + if (ev->alpha != 1.0f) { + *try_view_on_plane_failure_reasons |= + FAILURE_REASONS_GLOBAL_ALPHA; return NULL; + } - if (!drm_view_transform_supported(ev, &output->base)) + if (!drm_view_transform_supported(ev, &output->base)) { + *try_view_on_plane_failure_reasons |= + FAILURE_REASONS_INCOMPATIBLE_TRANSFORM; return NULL; + } if (ev->surface->protection_mode == WESTON_SURFACE_PROTECTION_MODE_ENFORCED && - ev->surface->desired_protection > output->base.current_protection) + ev->surface->desired_protection > output->base.current_protection) { + *try_view_on_plane_failure_reasons |= + FAILURE_REASONS_INADEQUATE_CONTENT_PROTECTION; return NULL; + } - if (!buffer) + if (!buffer) { + *try_view_on_plane_failure_reasons |= FAILURE_REASONS_NO_BUFFER; return NULL; + } if (buffer->backend_private) { buf_fb = buffer->backend_private; @@ -550,8 +561,10 @@ drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev, wl_signal_add(&buffer->destroy_signal, &buf_fb->buffer_destroy_listener); /* GBM is used for dmabuf import as well as from client wl_buffer. */ - if (!b->gbm) + if (!b->gbm) { + *try_view_on_plane_failure_reasons |= FAILURE_REASONS_NO_GBM; goto unsuitable; + } if (buffer->type == WESTON_BUFFER_DMABUF) { fb = drm_fb_get_from_dmabuf(buffer->dmabuf, b, is_opaque, @@ -568,10 +581,13 @@ drm_fb_get_from_view(struct drm_output_state *state, struct weston_view *ev, fb = drm_fb_get_from_bo(bo, b, is_opaque, BUFFER_CLIENT); if (!fb) { + *try_view_on_plane_failure_reasons |= + (1 << FAILURE_REASONS_ADD_FB_FAILED); gbm_bo_destroy(bo); goto unsuitable; } } else { + *try_view_on_plane_failure_reasons |= FAILURE_REASONS_BUFFER_TYPE; goto unsuitable; } diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c index f14631c6..5acaa809 100644 --- a/libweston/backend-drm/state-propose.c +++ b/libweston/backend-drm/state-propose.c @@ -484,8 +484,11 @@ drm_output_find_plane_for_view(struct drm_output_state *state, fb = drm_fb_get_from_view(state, ev, &pnode->try_view_on_plane_failure_reasons); - if (!fb) + if (!fb) { + 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); return NULL; + } possible_plane_mask = fb->plane_mask; }