xserver: Branch 'master' - 3 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Apr 12 08:54:32 UTC 2023
hw/xwayland/xwayland-glamor-gbm.c | 20 +++++++++++++++++---
hw/xwayland/xwayland-glamor.c | 33 +++++++++++++++++++++++++++------
hw/xwayland/xwayland-glamor.h | 5 +++++
include/meson.build | 2 ++
4 files changed, 51 insertions(+), 9 deletions(-)
New commits:
commit 8f7279ade26961ae790a3345ce11a239c842c773
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Fri Apr 7 11:05:33 2023 +0200
xwayland: Use the new API to set scanout
If the format and modifiers are from a tranche which supports scanout,
we can set the corresponding flag to gbm_bo_create_with_modifiers2() to
benefit from scanout buffers where applicable.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 37633ec96..4086e78ba 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -296,10 +296,14 @@ xwl_glamor_gbm_create_pixmap_internal(struct xwl_screen *xwl_screen,
if (xwl_gbm->dmabuf_capable) {
uint32_t num_modifiers = 0;
uint64_t *modifiers = NULL;
+ Bool supports_scanout = FALSE;
if (drawable) {
- xwl_glamor_get_drawable_modifiers(drawable, format,
- &num_modifiers, &modifiers);
+ xwl_glamor_get_drawable_modifiers_and_scanout(drawable,
+ format,
+ &num_modifiers,
+ &modifiers,
+ &supports_scanout);
}
if (num_modifiers == 0) {
@@ -309,9 +313,12 @@ xwl_glamor_gbm_create_pixmap_internal(struct xwl_screen *xwl_screen,
if (num_modifiers > 0) {
#ifdef GBM_BO_WITH_MODIFIERS2
+ uint32_t usage = GBM_BO_USE_RENDERING;
+ if (supports_scanout)
+ usage |= GBM_BO_USE_SCANOUT;
bo = gbm_bo_create_with_modifiers2(xwl_gbm->gbm, width, height,
format, modifiers, num_modifiers,
- GBM_BO_USE_RENDERING);
+ usage);
#else
bo = gbm_bo_create_with_modifiers(xwl_gbm->gbm, width, height,
format, modifiers, num_modifiers);
commit 967ad0fa1e6b249aef1c21913234c25f97966e98
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Fri Apr 7 11:03:14 2023 +0200
xwayland: Add xwl_glamor_get_drawable_modifiers_and_scanout()
Add a new API similar to xwl_glamor_get_drawable_modifiers() but also
returning whether the format and modifiers are from a tranche which
supports scanout.
This is preparation work for adding scanout support with
gbm_bo_create_with_modifiers2() when supported.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index 792af6144..3c03b2523 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -327,7 +327,8 @@ xwl_get_modifiers_for_format(struct xwl_format *format_array, int num_formats,
static Bool
xwl_get_modifiers_for_device(struct xwl_dmabuf_feedback *feedback, drmDevice *device,
uint32_t format, uint32_t *num_modifiers,
- uint64_t **modifiers)
+ uint64_t **modifiers,
+ Bool *supports_scanout)
{
/* Now try to find a matching set of tranches for the window's device */
for (int i = 0; i < feedback->dev_formats_len; i++) {
@@ -335,8 +336,11 @@ xwl_get_modifiers_for_device(struct xwl_dmabuf_feedback *feedback, drmDevice *de
if (drmDevicesEqual(dev_formats->drm_dev, device) &&
xwl_get_modifiers_for_format(dev_formats->formats, dev_formats->num_formats,
- format, num_modifiers, modifiers))
+ format, num_modifiers, modifiers)) {
+ if (supports_scanout)
+ *supports_scanout = !!dev_formats->supports_scanout;
return TRUE;
+ }
}
return FALSE;
@@ -360,7 +364,8 @@ xwl_glamor_get_modifiers(ScreenPtr screen, uint32_t format,
main_dev = xwl_screen_get_main_dev(xwl_screen);
return xwl_get_modifiers_for_device(&xwl_screen->default_feedback, main_dev,
- format, num_modifiers, modifiers);
+ format, num_modifiers, modifiers,
+ NULL);
} else {
return xwl_get_modifiers_for_format(xwl_screen->formats, xwl_screen->num_formats,
format, num_modifiers, modifiers);
@@ -368,8 +373,11 @@ xwl_glamor_get_modifiers(ScreenPtr screen, uint32_t format,
}
Bool
-xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format,
- uint32_t *num_modifiers, uint64_t **modifiers)
+xwl_glamor_get_drawable_modifiers_and_scanout(DrawablePtr drawable,
+ uint32_t format,
+ uint32_t *num_modifiers,
+ uint64_t **modifiers,
+ Bool *supports_scanout)
{
struct xwl_screen *xwl_screen = xwl_screen_get(drawable->pScreen);
struct xwl_window *xwl_window;
@@ -377,6 +385,8 @@ xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format,
*num_modifiers = 0;
*modifiers = NULL;
+ if (supports_scanout)
+ *supports_scanout = FALSE;
/* We can only return per-drawable modifiers if the compositor supports feedback */
if (xwl_screen->dmabuf_protocol_version < 4)
@@ -394,7 +404,18 @@ xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format,
main_dev = xwl_screen_get_main_dev(xwl_screen);
return xwl_get_modifiers_for_device(&xwl_window->feedback, main_dev,
- format, num_modifiers, modifiers);
+ format, num_modifiers, modifiers,
+ supports_scanout);
+
+}
+
+Bool
+xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format,
+ uint32_t *num_modifiers, uint64_t **modifiers)
+{
+ return xwl_glamor_get_drawable_modifiers_and_scanout(drawable,
+ format, num_modifiers,
+ modifiers, NULL);
}
diff --git a/hw/xwayland/xwayland-glamor.h b/hw/xwayland/xwayland-glamor.h
index c2eed95e9..313d7faf1 100644
--- a/hw/xwayland/xwayland-glamor.h
+++ b/hw/xwayland/xwayland-glamor.h
@@ -142,6 +142,11 @@ Bool xwl_glamor_get_formats(ScreenPtr screen,
CARD32 *num_formats, CARD32 **formats);
Bool xwl_glamor_get_modifiers(ScreenPtr screen, uint32_t format,
uint32_t *num_modifiers, uint64_t **modifiers);
+Bool xwl_glamor_get_drawable_modifiers_and_scanout(DrawablePtr drawable,
+ uint32_t format,
+ uint32_t *num_modifiers,
+ uint64_t **modifiers,
+ Bool *supports_scanout);
Bool xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format,
uint32_t *num_modifiers, uint64_t **modifiers);
Bool xwl_glamor_check_flip(PixmapPtr pixmap);
commit f31ca9238f845a1d9bea5b4410c0597ffe70e8d1
Author: Simon Ser <contact at emersion.fr>
Date: Wed Feb 1 15:50:15 2023 +0100
xwayland: use gbm_bo_create_with_modifiers2()
This allows us to pass flags to the function, avoiding the forced
implicit GBM_BO_USE_SCANOUT which happens with the older version.
Signed-off-by: Simon Ser <contact at emersion.fr>
Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 83318fe62..37633ec96 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -307,9 +307,16 @@ xwl_glamor_gbm_create_pixmap_internal(struct xwl_screen *xwl_screen,
&num_modifiers, &modifiers);
}
- if (num_modifiers > 0)
+ if (num_modifiers > 0) {
+#ifdef GBM_BO_WITH_MODIFIERS2
+ bo = gbm_bo_create_with_modifiers2(xwl_gbm->gbm, width, height,
+ format, modifiers, num_modifiers,
+ GBM_BO_USE_RENDERING);
+#else
bo = gbm_bo_create_with_modifiers(xwl_gbm->gbm, width, height,
format, modifiers, num_modifiers);
+#endif
+ }
free(modifiers);
}
#endif
diff --git a/include/meson.build b/include/meson.build
index f3e160ded..a65bd35b5 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -115,6 +115,8 @@ conf_data.set('GBM_BO_WITH_MODIFIERS',
build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 17.1') ? '1' : false)
conf_data.set('GBM_BO_FD_FOR_PLANE',
build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 21.1') ? '1' : false)
+conf_data.set('GBM_BO_WITH_MODIFIERS2',
+ build_glamor and gbm_dep.found() and gbm_dep.version().version_compare('>= 21.3') ? '1' : false)
conf_data.set_quoted('SERVER_MISC_CONFIG_PATH', serverconfigdir)
conf_data.set_quoted('PROJECTROOT', get_option('prefix'))
More information about the xorg-commit
mailing list