summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2023-03-28 14:12:53 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2023-04-03 11:46:15 +0200
commita4c700231dfbd20a7d48b64ff64e8cc40a6c22bc (patch)
tree72d67075f27438e2d37c33433ce6ea89f7bfb101
parent79ab129fdf28c4ef3468f078e46e920120c878b4 (diff)
downloadxserver-a4c700231dfbd20a7d48b64ff64e8cc40a6c22bc.tar.gz
xwayland: Check for implicit scanout availability
With implicit modifiers, DRM_FORMAT_MOD_INVALID is an allowed modifier, to indicate that the server can support the format. When looking for a scanout capable tranche with implicit modifiers, we ought to check for the availability of a tranche with an invalid modifier for the given format. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
-rw-r--r--hw/xwayland/xwayland-glamor.c8
-rw-r--r--hw/xwayland/xwayland-window.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index db1434ffb..af227bb03 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -747,8 +747,16 @@ xwl_window_dmabuf_feedback_done(void *data,
struct zwp_linux_dmabuf_feedback_v1 *dmabuf_feedback)
{
struct xwl_window *xwl_window = data;
+ uint32_t format = wl_drm_format_for_depth(xwl_window->window->drawable.depth);
xwl_dmabuf_feedback_done(&xwl_window->feedback, dmabuf_feedback);
+
+ xwl_window->has_implicit_scanout_support =
+ xwl_feedback_is_modifier_supported(&xwl_window->feedback, format,
+ DRM_FORMAT_MOD_INVALID, TRUE);
+ DebugF("XWAYLAND: Window 0x%x can%s get implicit scanout support\n",
+ xwl_window->window->drawable.id,
+ xwl_window->has_implicit_scanout_support ? "" : "not");
}
static void
diff --git a/hw/xwayland/xwayland-window.h b/hw/xwayland/xwayland-window.h
index 65dfb69ff..92c700e41 100644
--- a/hw/xwayland/xwayland-window.h
+++ b/hw/xwayland/xwayland-window.h
@@ -119,6 +119,8 @@ struct xwl_window {
#endif
struct xwayland_surface_v1 *xwayland_surface;
struct xwl_dmabuf_feedback feedback;
+ /* If TRUE, the window buffer format supports scanout with implicit modifier */
+ Bool has_implicit_scanout_support;
};
struct xwl_window *xwl_window_get(WindowPtr window);