From 79ab129fdf28c4ef3468f078e46e920120c878b4 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 28 Mar 2023 14:18:36 +0200 Subject: [PATCH] xwayland: Check for scanout support in tranches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The helper function xwl_feedback_is_modifier_supported() walks all the formats of a feeedback tranche and checks for format/modifier support availability. Add scanout support to that so that a caller can easily restrict the tranches to those which support scanout. This is preparation work for the implicit scanout support, no functional change. Signed-off-by: Olivier Fourdan Reviewed-by: Michel Dänzer --- hw/xwayland/xwayland-glamor.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index 1552834a7..db1434ffb 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -124,11 +124,15 @@ xwl_glamor_is_modifier_supported_in_formats(struct xwl_format *formats, int num_ static Bool xwl_feedback_is_modifier_supported(struct xwl_dmabuf_feedback *xwl_feedback, - uint32_t format, uint64_t modifier) + uint32_t format, uint64_t modifier, + int supports_scanout) { for (int i = 0; i < xwl_feedback->dev_formats_len; i++) { struct xwl_device_formats *dev_formats = &xwl_feedback->dev_formats[i]; + if (supports_scanout && !dev_formats->supports_scanout) + continue; + if (xwl_glamor_is_modifier_supported_in_formats(dev_formats->formats, dev_formats->num_formats, format, modifier)) @@ -157,11 +161,11 @@ xwl_glamor_is_modifier_supported(struct xwl_screen *xwl_screen, format, modifier); } - if (xwl_feedback_is_modifier_supported(&xwl_screen->default_feedback, format, modifier)) + if (xwl_feedback_is_modifier_supported(&xwl_screen->default_feedback, format, modifier, FALSE)) return TRUE; xorg_list_for_each_entry(xwl_window, &xwl_screen->window_list, link_window) { - if (xwl_feedback_is_modifier_supported(&xwl_window->feedback, format, modifier)) + if (xwl_feedback_is_modifier_supported(&xwl_window->feedback, format, modifier, FALSE)) return TRUE; }