mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-18 22:54:00 +00:00
84 lines
3.2 KiB
Diff
84 lines
3.2 KiB
Diff
From c71ea55be7c1dbb58d56df9c6cfa69718fdf5d6a Mon Sep 17 00:00:00 2001
|
|
From: Ivan Molodetskikh <yalterz@gmail.com>
|
|
Date: Fri, 27 Sep 2019 00:45:39 +0300
|
|
Subject: [PATCH 1/2] egl: allow INVALID format for linux_dmabuf
|
|
|
|
As per
|
|
https://gitlab.freedesktop.org/wayland/wayland-protocols/commit/fb9b2a87317c77e26283da5f6c9559d709f6fdcd,
|
|
the compositor may advertise DRM_FORMAT_MOD_INVALID as a supported
|
|
modifier. This patch makes mesa recognize this fact and allow
|
|
linux_dmabuf usage with the INVALID modifier in this case.
|
|
|
|
In case the driver doesn't support modifiers, we can still use
|
|
linux-dmabuf protocol instead of the legacy wl_drm interface to create
|
|
wl_buffers. This will help compositors to handle these buffers better.
|
|
|
|
In this commit, the INVALID modifier is allowed to be added to the list
|
|
of supported modifiers, and create_wl_buffer will be able to use
|
|
linux_dmabuf with an INVALID modifier if the compositor advertised it as
|
|
supported.
|
|
|
|
Signed-off-by: Ivan Molodetskikh <yalterz@gmail.com>
|
|
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2147>
|
|
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2147>
|
|
---
|
|
src/egl/drivers/dri2/platform_wayland.c | 29 ++++++++++++++++++++-----
|
|
1 file changed, 24 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
|
|
index 71bcb04a77b..324ac2357da 100644
|
|
--- a/src/egl/drivers/dri2/platform_wayland.c
|
|
+++ b/src/egl/drivers/dri2/platform_wayland.c
|
|
@@ -522,6 +522,13 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
|
|
modifiers = u_vector_tail(&dri2_dpy->wl_modifiers[visual_idx]);
|
|
num_modifiers = u_vector_length(&dri2_dpy->wl_modifiers[visual_idx]);
|
|
|
|
+ if (num_modifiers == 1 && modifiers[0] == DRM_FORMAT_MOD_INVALID) {
|
|
+ /* For the purposes of this function, an INVALID modifier on its own
|
|
+ * means the modifiers aren't supported.
|
|
+ */
|
|
+ num_modifiers = 0;
|
|
+ }
|
|
+
|
|
/* Substitute dri image format if server does not support original format */
|
|
if (!BITSET_TEST(dri2_dpy->formats, visual_idx))
|
|
linear_dri_image_format = dri2_wl_visuals[visual_idx].alt_dri_image_format;
|
|
@@ -917,7 +924,23 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
|
|
}
|
|
}
|
|
|
|
- if (dri2_dpy->wl_dmabuf && modifier != DRM_FORMAT_MOD_INVALID) {
|
|
+ bool supported_modifier = false;
|
|
+ if (modifier != DRM_FORMAT_MOD_INVALID) {
|
|
+ supported_modifier = true;
|
|
+ } else {
|
|
+ int visual_idx = dri2_wl_visual_idx_from_fourcc(fourcc);
|
|
+ assert(visual_idx != -1);
|
|
+
|
|
+ uint64_t *mod;
|
|
+ u_vector_foreach(mod, &dri2_dpy->wl_modifiers[visual_idx]) {
|
|
+ if (*mod == DRM_FORMAT_MOD_INVALID) {
|
|
+ supported_modifier = true;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (dri2_dpy->wl_dmabuf && supported_modifier) {
|
|
struct zwp_linux_buffer_params_v1 *params;
|
|
int i;
|
|
|
|
@@ -1290,10 +1313,6 @@ dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
|
|
if (visual_idx == -1)
|
|
return;
|
|
|
|
- if (modifier_hi == (DRM_FORMAT_MOD_INVALID >> 32) &&
|
|
- modifier_lo == (DRM_FORMAT_MOD_INVALID & 0xffffffff))
|
|
- return;
|
|
-
|
|
BITSET_SET(dri2_dpy->formats, visual_idx);
|
|
|
|
mod = u_vector_add(&dri2_dpy->wl_modifiers[visual_idx]);
|
|
--
|
|
2.26.2
|
|
|