summaryrefslogtreecommitdiffstats
path: root/recipes-graphics
diff options
context:
space:
mode:
authorAndrey Zhizhikin <andrey.z@gmail.com>2021-08-27 20:49:00 +0000
committerAndrey Zhizhikin <andrey.z@gmail.com>2021-08-27 20:49:00 +0000
commit8cd62ad85fa7c8cf937f080d297af4dad81c4a45 (patch)
treea250eb14f788ae9f84a88972c034d1c374af93c0 /recipes-graphics
parentabd9ea654450bf907b8e3c2adada78b73736e209 (diff)
downloadmeta-freescale-8cd62ad85fa7c8cf937f080d297af4dad81c4a45.tar.gz
mesa: drop patches after upgrade to 21.2.1.
OE-Core mesa has been upgraded to version 21.2.1, which has all patches included. Drop all patches from the layer as they are not applicable anymore and remove them from SRC_URI. Signed-off-by: Andrey Zhizhikin <andrey.z@gmail.com>
Diffstat (limited to 'recipes-graphics')
-rw-r--r--recipes-graphics/mesa/mesa/0001-dri-add-createImageWithModifiers2-interface.patch67
-rw-r--r--recipes-graphics/mesa/mesa/0002-dri-add-loader_dri_create_image-helper.patch336
-rw-r--r--recipes-graphics/mesa/mesa/0003-loader-dri3-convert-to-loader_dri_create_image.patch93
-rw-r--r--recipes-graphics/mesa/mesa/0004-loader-dri-hook-up-createImageWithModifiers2.patch42
-rw-r--r--recipes-graphics/mesa/mesa/0005-gallium-dri-copy-image-use-in-dup_image.patch30
-rw-r--r--recipes-graphics/mesa/mesa/0006-dri-don-t-call-modifier-interfaces-when-modifiers_co.patch36
-rw-r--r--recipes-graphics/mesa/mesa/0007-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch46
-rw-r--r--recipes-graphics/mesa/mesa/0008-etnaviv-remove-double-assigment-of-surface-texture.patch31
-rw-r--r--recipes-graphics/mesa/mesa/0009-etnaviv-flush-used-render-buffers-on-context-flush-w.patch168
-rw-r--r--recipes-graphics/mesa/mesa_%.bbappend13
10 files changed, 0 insertions, 862 deletions
diff --git a/recipes-graphics/mesa/mesa/0001-dri-add-createImageWithModifiers2-interface.patch b/recipes-graphics/mesa/mesa/0001-dri-add-createImageWithModifiers2-interface.patch
deleted file mode 100644
index 261c54cc..00000000
--- a/recipes-graphics/mesa/mesa/0001-dri-add-createImageWithModifiers2-interface.patch
+++ /dev/null
@@ -1,67 +0,0 @@
1From afd8b2f498a417de6ecdbd13045d97c9ecf4391b Mon Sep 17 00:00:00 2001
2From: Simon Ser <contact@emersion.fr>
3Date: Mon, 14 Dec 2020 18:32:47 +0100
4Subject: [PATCH] dri: add createImageWithModifiers2 interface
5
6With the addition of createImageWithModifiers usage flags were
7dropped, as it was believed at the time that modifers will be a
8full replacement for the usage flags. This has turned out to be
9untrue, as modifiers are not able to describe buffer placement.
10
11Add a new version of the interface, that allows to specifiy
12use flags in addition to the modifier.
13
14Signed-off-by: Simon Ser <contact@emersion.fr>
15Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
16Reviewed-by: Daniel Stone <daniels@collabora.com>
17Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8106>
18Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/afd8b2f498a417de6ecdbd13045d97c9ecf4391b]
19---
20 include/GL/internal/dri_interface.h | 24 +++++++++++++++++++++++-
21 1 file changed, 23 insertions(+), 1 deletion(-)
22
23diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
24index 9b85e67ce49..a7d9903f94e 100644
25--- a/include/GL/internal/dri_interface.h
26+++ b/include/GL/internal/dri_interface.h
27@@ -1328,7 +1328,7 @@ struct __DRIdri2ExtensionRec {
28 * extensions.
29 */
30 #define __DRI_IMAGE "DRI_IMAGE"
31-#define __DRI_IMAGE_VERSION 18
32+#define __DRI_IMAGE_VERSION 19
33
34 /**
35 * These formats correspond to the similarly named MESA_FORMAT_*
36@@ -1803,6 +1803,28 @@ struct __DRIimageExtensionRec {
37 uint32_t flags,
38 unsigned *error,
39 void *loaderPrivate);
40+
41+ /**
42+ * Creates an image with implementation's favorite modifiers and the
43+ * provided usage flags.
44+ *
45+ * This acts like createImageWithModifiers except usage is also specified.
46+ *
47+ * The created image should be destroyed with destroyImage().
48+ *
49+ * Returns the new DRIimage. The chosen modifier can be obtained later on
50+ * and passed back to things like the kernel's AddFB2 interface.
51+ *
52+ * \sa __DRIimageRec::createImage
53+ *
54+ * \since 19
55+ */
56+ __DRIimage *(*createImageWithModifiers2)(__DRIscreen *screen,
57+ int width, int height, int format,
58+ const uint64_t *modifiers,
59+ const unsigned int modifier_count,
60+ unsigned int use,
61+ void *loaderPrivate);
62 };
63
64
65--
662.31.1
67
diff --git a/recipes-graphics/mesa/mesa/0002-dri-add-loader_dri_create_image-helper.patch b/recipes-graphics/mesa/mesa/0002-dri-add-loader_dri_create_image-helper.patch
deleted file mode 100644
index 1e5d0f69..00000000
--- a/recipes-graphics/mesa/mesa/0002-dri-add-loader_dri_create_image-helper.patch
+++ /dev/null
@@ -1,336 +0,0 @@
1From cb9ae4273d680ab34fc2ca933c4f960e7f086275 Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Tue, 15 Dec 2020 14:39:32 +0100
4Subject: [PATCH] dri: add loader_dri_create_image helper
5
6The DRI image extension already has two different ways to allocate an
7image (with and without a modifier) and will soon grow a third one.
8Add a helper, which handles calling the appropriate implementation to
9get rid of code duplication in the winsys.
10
11This convert the two obvious call sites (GBM dri and EGL wayland)
12that profit from the code dedup.
13
14Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
15Reviewed-by: Daniel Stone <daniels@collabora.com>
16Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8106>
17Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/cb9ae4273d680ab34fc2ca933c4f960e7f086275]
18---
19 src/egl/drivers/dri2/platform_wayland.c | 60 +++++++---------------
20 src/gbm/backends/dri/gbm_dri.c | 53 +++++--------------
21 src/loader/Makefile.sources | 2 +
22 src/loader/loader_dri_helper.c | 68 +++++++++++++++++++++++++
23 src/loader/loader_dri_helper.h | 33 ++++++++++++
24 src/loader/meson.build | 2 +-
25 6 files changed, 134 insertions(+), 84 deletions(-)
26 create mode 100644 src/loader/loader_dri_helper.c
27 create mode 100644 src/loader/loader_dri_helper.h
28
29diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
30index 26b6711952c..180380b4c4c 100644
31--- a/src/egl/drivers/dri2/platform_wayland.c
32+++ b/src/egl/drivers/dri2/platform_wayland.c
33@@ -40,6 +40,7 @@
34 #include <sys/mman.h>
35
36 #include "egl_dri2.h"
37+#include "loader_dri_helper.h"
38 #include "loader.h"
39 #include "util/u_vector.h"
40 #include "util/anon_file.h"
41@@ -578,28 +579,16 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
42 dri2_surf->back->linear_copy == NULL) {
43 /* The LINEAR modifier should be a perfect alias of the LINEAR use
44 * flag; try the new interface first before the old, then fall back. */
45- if (dri2_dpy->image->base.version >= 15 &&
46- dri2_dpy->image->createImageWithModifiers) {
47- uint64_t linear_mod = DRM_FORMAT_MOD_LINEAR;
48-
49- dri2_surf->back->linear_copy =
50- dri2_dpy->image->createImageWithModifiers(dri2_dpy->dri_screen,
51- dri2_surf->base.Width,
52- dri2_surf->base.Height,
53- linear_dri_image_format,
54- &linear_mod,
55- 1,
56- NULL);
57- } else {
58- dri2_surf->back->linear_copy =
59- dri2_dpy->image->createImage(dri2_dpy->dri_screen,
60- dri2_surf->base.Width,
61- dri2_surf->base.Height,
62- linear_dri_image_format,
63- use_flags |
64- __DRI_IMAGE_USE_LINEAR,
65- NULL);
66- }
67+ uint64_t linear_mod = DRM_FORMAT_MOD_LINEAR;
68+
69+ dri2_surf->back->linear_copy =
70+ loader_dri_create_image(dri2_dpy->dri_screen, dri2_dpy->image,
71+ dri2_surf->base.Width,
72+ dri2_surf->base.Height,
73+ linear_dri_image_format,
74+ use_flags | __DRI_IMAGE_USE_LINEAR,
75+ &linear_mod, 1, NULL);
76+
77 if (dri2_surf->back->linear_copy == NULL)
78 return -1;
79 }
80@@ -609,26 +598,13 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
81 * createImageWithModifiers, then fall back to the old createImage,
82 * and hope it allocates an image which is acceptable to the winsys.
83 */
84- if (num_modifiers && dri2_dpy->image->base.version >= 15 &&
85- dri2_dpy->image->createImageWithModifiers) {
86- dri2_surf->back->dri_image =
87- dri2_dpy->image->createImageWithModifiers(dri2_dpy->dri_screen,
88- dri2_surf->base.Width,
89- dri2_surf->base.Height,
90- dri_image_format,
91- modifiers,
92- num_modifiers,
93- NULL);
94- } else {
95- dri2_surf->back->dri_image =
96- dri2_dpy->image->createImage(dri2_dpy->dri_screen,
97- dri2_surf->base.Width,
98- dri2_surf->base.Height,
99- dri_image_format,
100- dri2_dpy->is_different_gpu ?
101- 0 : use_flags,
102- NULL);
103- }
104+ dri2_surf->back->dri_image =
105+ loader_dri_create_image(dri2_dpy->dri_screen, dri2_dpy->image,
106+ dri2_surf->base.Width,
107+ dri2_surf->base.Height,
108+ dri_image_format,
109+ dri2_dpy->is_different_gpu ? 0 : use_flags,
110+ modifiers, num_modifiers, NULL);
111
112 dri2_surf->back->age = 0;
113 }
114diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
115index 751b2e56497..dff0b3c7ecf 100644
116--- a/src/gbm/backends/dri/gbm_dri.c
117+++ b/src/gbm/backends/dri/gbm_dri.c
118@@ -47,6 +47,7 @@
119 #include "gbm_driint.h"
120
121 #include "gbmint.h"
122+#include "loader_dri_helper.h"
123 #include "loader.h"
124 #include "util/debug.h"
125 #include "util/macros.h"
126@@ -1151,8 +1152,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
127 struct gbm_dri_device *dri = gbm_dri_device(gbm);
128 struct gbm_dri_bo *bo;
129 int dri_format;
130- unsigned dri_use = 0, i;
131- bool has_valid_modifier;
132+ unsigned dri_use = 0;
133
134 /* Callers of this may specify a modifier, or a dri usage, but not both. The
135 * newer modifier interface deprecates the older usage flags.
136@@ -1191,50 +1191,21 @@ gbm_dri_bo_create(struct gbm_device *gbm,
137 /* Gallium drivers requires shared in order to get the handle/stride */
138 dri_use |= __DRI_IMAGE_USE_SHARE;
139
140- if (modifiers) {
141- if (!dri->image || dri->image->base.version < 14 ||
142- !dri->image->createImageWithModifiers) {
143- errno = ENOSYS;
144- goto failed;
145- }
146-
147- /* It's acceptable to create an image with INVALID modifier in the list,
148- * but it cannot be on the only modifier (since it will certainly fail
149- * later). While we could easily catch this after modifier creation, doing
150- * the check here is a convenient debug check likely pointing at whatever
151- * interface the client is using to build its modifier list.
152- */
153- has_valid_modifier = false;
154- for (i = 0; i < count; i++) {
155- if (modifiers[i] != DRM_FORMAT_MOD_INVALID) {
156- has_valid_modifier = true;
157- break;
158- }
159- }
160- if (!has_valid_modifier) {
161- errno = EINVAL;
162- goto failed;
163- }
164-
165- bo->image =
166- dri->image->createImageWithModifiers(dri->screen,
167- width, height,
168- dri_format,
169- modifiers, count,
170- bo);
171-
172- if (bo->image) {
173- /* The client passed in a list of invalid modifiers */
174- assert(gbm_dri_bo_get_modifier(&bo->base) != DRM_FORMAT_MOD_INVALID);
175- }
176- } else {
177- bo->image = dri->image->createImage(dri->screen, width, height,
178- dri_format, dri_use, bo);
179+ if (modifiers && (dri->image->base.version < 14 ||
180+ !dri->image->createImageWithModifiers)) {
181+ errno = ENOSYS;
182+ return NULL;
183 }
184
185+ bo->image = loader_dri_create_image(dri->screen, dri->image, width, height,
186+ dri_format, dri_use, modifiers, count,
187+ bo);
188 if (bo->image == NULL)
189 goto failed;
190
191+ if (modifiers)
192+ assert(gbm_dri_bo_get_modifier(&bo->base) != DRM_FORMAT_MOD_INVALID);
193+
194 dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_HANDLE,
195 &bo->base.handle.s32);
196 dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE,
197diff --git a/src/loader/Makefile.sources b/src/loader/Makefile.sources
198index b61ef1cd943..6627222ac30 100644
199--- a/src/loader/Makefile.sources
200+++ b/src/loader/Makefile.sources
201@@ -1,4 +1,6 @@
202 LOADER_C_FILES := \
203+ loader_dri_helper.c \
204+ loader_dri_helper.h \
205 loader.c \
206 loader.h \
207 pci_id_driver_map.c \
208diff --git a/src/loader/loader_dri_helper.c b/src/loader/loader_dri_helper.c
209new file mode 100644
210index 00000000000..21419f087d6
211--- /dev/null
212+++ b/src/loader/loader_dri_helper.c
213@@ -0,0 +1,68 @@
214+/*
215+ * Permission to use, copy, modify, distribute, and sell this software and its
216+ * documentation for any purpose is hereby granted without fee, provided that
217+ * the above copyright notice appear in all copies and that both that copyright
218+ * notice and this permission notice appear in supporting documentation, and
219+ * that the name of the copyright holders not be used in advertising or
220+ * publicity pertaining to distribution of the software without specific,
221+ * written prior permission. The copyright holders make no representations
222+ * about the suitability of this software for any purpose. It is provided "as
223+ * is" without express or implied warranty.
224+ *
225+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
226+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
227+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
228+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
229+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
230+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
231+ * OF THIS SOFTWARE.
232+ */
233+
234+#include <errno.h>
235+#include <stdbool.h>
236+#include <stdio.h>
237+#include <sys/types.h>
238+
239+#include <GL/gl.h> /* dri_interface needs GL types */
240+#include <GL/internal/dri_interface.h>
241+
242+#include "drm-uapi/drm_fourcc.h"
243+#include "loader_dri_helper.h"
244+
245+__DRIimage *loader_dri_create_image(__DRIscreen *screen,
246+ const __DRIimageExtension *image,
247+ uint32_t width, uint32_t height,
248+ uint32_t dri_format, uint32_t dri_usage,
249+ const uint64_t *modifiers,
250+ unsigned int modifiers_count,
251+ void *loaderPrivate)
252+{
253+ if (modifiers &&
254+ image->base.version > 14 && image->createImageWithModifiers) {
255+ bool has_valid_modifier = false;
256+ int i;
257+
258+ /* It's acceptable to create an image with INVALID modifier in the list,
259+ * but it cannot be on the only modifier (since it will certainly fail
260+ * later). While we could easily catch this after modifier creation, doing
261+ * the check here is a convenient debug check likely pointing at whatever
262+ * interface the client is using to build its modifier list.
263+ */
264+ for (i = 0; i < modifiers_count; i++) {
265+ if (modifiers[i] != DRM_FORMAT_MOD_INVALID) {
266+ has_valid_modifier = true;
267+ break;
268+ }
269+ }
270+ if (!has_valid_modifier)
271+ return NULL;
272+
273+ return image->createImageWithModifiers(screen, width, height,
274+ dri_format, modifiers,
275+ modifiers_count, loaderPrivate);
276+ }
277+
278+ /* No modifier given or fallback to the legacy createImage allowed */
279+ return image->createImage(screen, width, height, dri_format, dri_usage,
280+ loaderPrivate);
281+}
282diff --git a/src/loader/loader_dri_helper.h b/src/loader/loader_dri_helper.h
283new file mode 100644
284index 00000000000..e0aae69477b
285--- /dev/null
286+++ b/src/loader/loader_dri_helper.h
287@@ -0,0 +1,33 @@
288+/*
289+ * Permission to use, copy, modify, distribute, and sell this software and its
290+ * documentation for any purpose is hereby granted without fee, provided that
291+ * the above copyright notice appear in all copies and that both that copyright
292+ * notice and this permission notice appear in supporting documentation, and
293+ * that the name of the copyright holders not be used in advertising or
294+ * publicity pertaining to distribution of the software without specific,
295+ * written prior permission. The copyright holders make no representations
296+ * about the suitability of this software for any purpose. It is provided "as
297+ * is" without express or implied warranty.
298+ *
299+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
300+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
301+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
302+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
303+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
304+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
305+ * OF THIS SOFTWARE.
306+ */
307+
308+#include <stdbool.h>
309+#include <sys/types.h>
310+
311+#include <GL/gl.h> /* dri_interface needs GL types */
312+#include <GL/internal/dri_interface.h>
313+
314+__DRIimage *loader_dri_create_image(__DRIscreen *screen,
315+ const __DRIimageExtension *image,
316+ uint32_t width, uint32_t height,
317+ uint32_t dri_format, uint32_t dri_usage,
318+ const uint64_t *modifiers,
319+ unsigned int modifiers_count,
320+ void *loaderPrivate);
321diff --git a/src/loader/meson.build b/src/loader/meson.build
322index 34a43e33f09..57a93c3aa17 100644
323--- a/src/loader/meson.build
324+++ b/src/loader/meson.build
325@@ -47,7 +47,7 @@ endif
326
327 libloader = static_library(
328 'loader',
329- ['loader.c', 'pci_id_driver_map.c'],
330+ ['loader_dri_helper.c', 'loader.c', 'pci_id_driver_map.c'],
331 c_args : loader_c_args,
332 gnu_symbol_visibility : 'hidden',
333 include_directories : [inc_include, inc_src, inc_util],
334--
3352.31.1
336
diff --git a/recipes-graphics/mesa/mesa/0003-loader-dri3-convert-to-loader_dri_create_image.patch b/recipes-graphics/mesa/mesa/0003-loader-dri3-convert-to-loader_dri_create_image.patch
deleted file mode 100644
index daba1a50..00000000
--- a/recipes-graphics/mesa/mesa/0003-loader-dri3-convert-to-loader_dri_create_image.patch
+++ /dev/null
@@ -1,93 +0,0 @@
1From 8fd5b16efc60ad666b05ec745109d0a482b6157b Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Tue, 15 Dec 2020 14:52:28 +0100
4Subject: [PATCH] loader/dri3: convert to loader_dri_create_image
5
6Get rid of the code duplication and makes it easier to hook in a
7new createImageWithModifiers2, but obscures the code flow a bit.
8
9Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
10Reviewed-by: Daniel Stone <daniels@collabora.com>
11Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8106>
12Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/8fd5b16efc60ad666b05ec745109d0a482b6157b]
13---
14 src/loader/loader_dri3_helper.c | 40 ++++++++++-----------------------
15 1 file changed, 12 insertions(+), 28 deletions(-)
16
17diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
18index 6c4b704ae5b..c5e340e6942 100644
19--- a/src/loader/loader_dri3_helper.c
20+++ b/src/loader/loader_dri3_helper.c
21@@ -34,6 +34,7 @@
22
23 #include <X11/Xlib-xcb.h>
24
25+#include "loader_dri_helper.h"
26 #include "loader_dri3_helper.h"
27 #include "util/macros.h"
28 #include "drm-uapi/drm_fourcc.h"
29@@ -1314,6 +1315,8 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format,
30 struct xshmfence *shm_fence;
31 int buffer_fds[4], fence_fd;
32 int num_planes = 0;
33+ uint64_t *modifiers = NULL;
34+ uint32_t count = 0;
35 int i, mod;
36 int ret;
37
38@@ -1348,8 +1351,6 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format,
39 xcb_dri3_get_supported_modifiers_cookie_t mod_cookie;
40 xcb_dri3_get_supported_modifiers_reply_t *mod_reply;
41 xcb_generic_error_t *error = NULL;
42- uint64_t *modifiers = NULL;
43- uint32_t count = 0;
44
45 mod_cookie = xcb_dri3_get_supported_modifiers(draw->conn,
46 draw->window,
47@@ -1395,34 +1396,17 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format,
48 }
49
50 free(mod_reply);
51-
52- /* don't use createImageWithModifiers() if we have no
53- * modifiers, other things depend on the use flags when
54- * there are no modifiers to know that a buffer can be
55- * shared.
56- */
57- if (modifiers) {
58- buffer->image = draw->ext->image->createImageWithModifiers(draw->dri_screen,
59- width, height,
60- format,
61- modifiers,
62- count,
63- buffer);
64- }
65-
66- free(modifiers);
67 }
68 #endif
69- if (!buffer->image)
70- buffer->image = draw->ext->image->createImage(draw->dri_screen,
71- width, height,
72- format,
73- __DRI_IMAGE_USE_SHARE |
74- __DRI_IMAGE_USE_SCANOUT |
75- __DRI_IMAGE_USE_BACKBUFFER |
76- (draw->is_protected_content ?
77- __DRI_IMAGE_USE_PROTECTED : 0),
78- buffer);
79+ buffer->image = loader_dri_create_image(draw->dri_screen, draw->ext->image,
80+ width, height, format,
81+ __DRI_IMAGE_USE_SHARE |
82+ __DRI_IMAGE_USE_SCANOUT |
83+ __DRI_IMAGE_USE_BACKBUFFER |
84+ (draw->is_protected_content ?
85+ __DRI_IMAGE_USE_PROTECTED : 0),
86+ modifiers, count, buffer);
87+ free(modifiers);
88
89 pixmap_buffer = buffer->image;
90
91--
922.31.1
93
diff --git a/recipes-graphics/mesa/mesa/0004-loader-dri-hook-up-createImageWithModifiers2.patch b/recipes-graphics/mesa/mesa/0004-loader-dri-hook-up-createImageWithModifiers2.patch
deleted file mode 100644
index c80978a7..00000000
--- a/recipes-graphics/mesa/mesa/0004-loader-dri-hook-up-createImageWithModifiers2.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From c03e79d7831f253b16d6f52f2fb959eb02257a8b Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Tue, 15 Dec 2020 14:59:21 +0100
4Subject: [PATCH] loader/dri: hook up createImageWithModifiers2
5
6Call into the new modifiers with usage createImage variant when available
7to provide the DRI implementation with more context about the allocation.
8
9Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
10Reviewed-by: Daniel Stone <daniels@collabora.com>
11Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8106>
12Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/c03e79d7831f253b16d6f52f2fb959eb02257a8b]
13---
14 src/loader/loader_dri_helper.c | 12 +++++++++---
15 1 file changed, 9 insertions(+), 3 deletions(-)
16
17diff --git a/src/loader/loader_dri_helper.c b/src/loader/loader_dri_helper.c
18index 21419f087d6..972ca2da26a 100644
19--- a/src/loader/loader_dri_helper.c
20+++ b/src/loader/loader_dri_helper.c
21@@ -57,9 +57,15 @@ __DRIimage *loader_dri_create_image(__DRIscreen *screen,
22 if (!has_valid_modifier)
23 return NULL;
24
25- return image->createImageWithModifiers(screen, width, height,
26- dri_format, modifiers,
27- modifiers_count, loaderPrivate);
28+ if (image->base.version >= 19 && image->createImageWithModifiers2)
29+ return image->createImageWithModifiers2(screen, width, height,
30+ dri_format, modifiers,
31+ modifiers_count, dri_usage,
32+ loaderPrivate);
33+ else
34+ return image->createImageWithModifiers(screen, width, height,
35+ dri_format, modifiers,
36+ modifiers_count, loaderPrivate);
37 }
38
39 /* No modifier given or fallback to the legacy createImage allowed */
40--
412.31.1
42
diff --git a/recipes-graphics/mesa/mesa/0005-gallium-dri-copy-image-use-in-dup_image.patch b/recipes-graphics/mesa/mesa/0005-gallium-dri-copy-image-use-in-dup_image.patch
deleted file mode 100644
index 57251ed7..00000000
--- a/recipes-graphics/mesa/mesa/0005-gallium-dri-copy-image-use-in-dup_image.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 3701cb9439058e71c1981bd80c5a9e1383815b08 Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Fri, 13 Nov 2020 14:26:23 +0100
4Subject: [PATCH] gallium/dri: copy image use in dup_image
5
6Don't lose the use flags when dup'ing an image.
7
8Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
9Reviewed-by: Daniel Stone <daniels@collabora.com>
10Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8106>
11Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/3701cb9439058e71c1981bd80c5a9e1383815b08]
12---
13 src/gallium/frontends/dri/dri2.c | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
17index 9999b31b022..08a9ed9693c 100644
18--- a/src/gallium/frontends/dri/dri2.c
19+++ b/src/gallium/frontends/dri/dri2.c
20@@ -1326,6 +1326,7 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate)
21 img->dri_format = image->dri_format;
22 /* This should be 0 for sub images, but dup is also used for base images. */
23 img->dri_components = image->dri_components;
24+ img->use = image->use;
25 img->loader_private = loaderPrivate;
26 img->sPriv = image->sPriv;
27
28--
292.31.1
30
diff --git a/recipes-graphics/mesa/mesa/0006-dri-don-t-call-modifier-interfaces-when-modifiers_co.patch b/recipes-graphics/mesa/mesa/0006-dri-don-t-call-modifier-interfaces-when-modifiers_co.patch
deleted file mode 100644
index 765cc0ac..00000000
--- a/recipes-graphics/mesa/mesa/0006-dri-don-t-call-modifier-interfaces-when-modifiers_co.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From 77fcf700826d6637e4e407c73c209f3b1718a26e Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Thu, 20 May 2021 18:07:12 +0200
4Subject: [PATCH] dri: don't call modifier interfaces when modifiers_count is 0
5
6The wayland EGL platform sets the modifier count to 0 in some cases
7to signal that modifiers should not be used, even if a list of modifiers
8is present. The loader_dri_create_image helper didn't handle this case
9properly and called the modifierful driver interface with a 0 modifier
10count, leading to the obvious outcome of the driver being unable to
11allocate an image.
12
13Fixes: cb9ae4273d68 ("dri: add loader_dri_create_image helper")
14Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
15Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10903>
16Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/77fcf700826d6637e4e407c73c209f3b1718a26e]
17---
18 src/loader/loader_dri_helper.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/src/loader/loader_dri_helper.c b/src/loader/loader_dri_helper.c
22index 972ca2da26a..ff6ce35953f 100644
23--- a/src/loader/loader_dri_helper.c
24+++ b/src/loader/loader_dri_helper.c
25@@ -37,7 +37,7 @@ __DRIimage *loader_dri_create_image(__DRIscreen *screen,
26 unsigned int modifiers_count,
27 void *loaderPrivate)
28 {
29- if (modifiers &&
30+ if (modifiers && modifiers_count > 0 &&
31 image->base.version > 14 && image->createImageWithModifiers) {
32 bool has_valid_modifier = false;
33 int i;
34--
352.31.1
36
diff --git a/recipes-graphics/mesa/mesa/0007-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch b/recipes-graphics/mesa/mesa/0007-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch
deleted file mode 100644
index 43bd86bd..00000000
--- a/recipes-graphics/mesa/mesa/0007-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch
+++ /dev/null
@@ -1,46 +0,0 @@
1From 3824429da0e0e68b78534b1e0ab7e386bcb2b2e2 Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Fri, 13 Nov 2020 14:59:52 +0100
4Subject: [PATCH] frontend/dri: add EXPLICIT_FLUSH hint in
5 dri2_resource_get_param
6
7dri2_resource_get_param() is called from two different places right now.
8Only one of them adds the EXPLICIT_FLUSH hint to the handle usage, which
9may disable the optimizations provided by this hint without a reason.
10
11Make sure to always add this hint when appropriate.
12
13Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
14Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603>
15Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/3824429da0e0e68b78534b1e0ab7e386bcb2b2e2]
16---
17 src/gallium/frontends/dri/dri2.c | 6 +++---
18 1 file changed, 3 insertions(+), 3 deletions(-)
19
20diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
21index 0220513368e..8ed47c25825 100644
22--- a/src/gallium/frontends/dri/dri2.c
23+++ b/src/gallium/frontends/dri/dri2.c
24@@ -1252,6 +1252,9 @@ dri2_resource_get_param(__DRIimage *image, enum pipe_resource_param param,
25 if (!pscreen->resource_get_param)
26 return false;
27
28+ if (image->use & __DRI_IMAGE_USE_BACKBUFFER)
29+ handle_usage |= PIPE_HANDLE_USAGE_EXPLICIT_FLUSH;
30+
31 return pscreen->resource_get_param(pscreen, NULL, image->texture,
32 image->plane, 0, 0, param, handle_usage,
33 value);
34@@ -1296,9 +1299,6 @@ dri2_query_image_by_resource_param(__DRIimage *image, int attrib, int *value)
35
36 handle_usage = PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE;
37
38- if (image->use & __DRI_IMAGE_USE_BACKBUFFER)
39- handle_usage |= PIPE_HANDLE_USAGE_EXPLICIT_FLUSH;
40-
41 if (!dri2_resource_get_param(image, param, handle_usage, &res_param))
42 return false;
43
44--
452.31.1
46
diff --git a/recipes-graphics/mesa/mesa/0008-etnaviv-remove-double-assigment-of-surface-texture.patch b/recipes-graphics/mesa/mesa/0008-etnaviv-remove-double-assigment-of-surface-texture.patch
deleted file mode 100644
index 7f43be10..00000000
--- a/recipes-graphics/mesa/mesa/0008-etnaviv-remove-double-assigment-of-surface-texture.patch
+++ /dev/null
@@ -1,31 +0,0 @@
1From 1c539bbb06f318d2bd0f93701b532f77894e391d Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Fri, 13 Nov 2020 15:03:37 +0100
4Subject: [PATCH] etnaviv: remove double assigment of surface->texture
5
6surf->base.texture is already assigned earlier via a proper
7pipe_resource_reference call. Remove the superfluous assignement.
8
9Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
10Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
11Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603>
12Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/1c539bbb06f318d2bd0f93701b532f77894e391d]
13---
14 src/gallium/drivers/etnaviv/etnaviv_surface.c | 1 -
15 1 file changed, 1 deletion(-)
16
17diff --git a/src/gallium/drivers/etnaviv/etnaviv_surface.c b/src/gallium/drivers/etnaviv/etnaviv_surface.c
18index c78973bdb09..52a937652d2 100644
19--- a/src/gallium/drivers/etnaviv/etnaviv_surface.c
20+++ b/src/gallium/drivers/etnaviv/etnaviv_surface.c
21@@ -112,7 +112,6 @@ etna_create_surface(struct pipe_context *pctx, struct pipe_resource *prsc,
22 etna_screen_resource_alloc_ts(pctx->screen, rsc);
23 }
24
25- surf->base.texture = &rsc->base;
26 surf->base.format = templat->format;
27 surf->base.width = rsc->levels[level].width;
28 surf->base.height = rsc->levels[level].height;
29--
302.31.1
31
diff --git a/recipes-graphics/mesa/mesa/0009-etnaviv-flush-used-render-buffers-on-context-flush-w.patch b/recipes-graphics/mesa/mesa/0009-etnaviv-flush-used-render-buffers-on-context-flush-w.patch
deleted file mode 100644
index 4534cd5a..00000000
--- a/recipes-graphics/mesa/mesa/0009-etnaviv-flush-used-render-buffers-on-context-flush-w.patch
+++ /dev/null
@@ -1,168 +0,0 @@
1From 7b9d8d1936d72af6fd1bfd30afed354bb76b4c0c Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Fri, 13 Nov 2020 15:05:55 +0100
4Subject: [PATCH] etnaviv: flush used render buffers on context flush when
5 neccessary
6
7Some resources like backbuffers are explicitly flushed by the frontend
8at the appropriate time, others however won't get flushed explicitly.
9Remember those resources when they get emitted as a render buffer and
10flush them on a context flush to make their content visible to other
11entities sharing the buffer.
12
13We still keep the optimized path for most resources where the frontend
14promises to do the flushing for us and only enable implicit flushing
15when a buffer handle is exported/imported without the
16PIPE_HANDLE_USAGE_EXPLICIT_FLUSH flag set.
17
18Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
19Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
20Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603>
21Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/7b9d8d1936d72af6fd1bfd30afed354bb76b4c0c]
22---
23 src/gallium/drivers/etnaviv/etnaviv_context.c | 16 ++++++++++++++++
24 src/gallium/drivers/etnaviv/etnaviv_context.h | 3 +++
25 src/gallium/drivers/etnaviv/etnaviv_resource.c | 7 +++++++
26 src/gallium/drivers/etnaviv/etnaviv_resource.h | 2 ++
27 src/gallium/drivers/etnaviv/etnaviv_state.c | 18 ++++++++++++++++++
28 5 files changed, 46 insertions(+)
29
30diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
31index 4dd9e427ea1..581edc78d2f 100644
32--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
33+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
34@@ -129,6 +129,9 @@ etna_context_destroy(struct pipe_context *pctx)
35 _mesa_set_destroy(ctx->used_resources_write, NULL);
36
37 }
38+ if (ctx->flush_resources)
39+ _mesa_set_destroy(ctx->flush_resources, NULL);
40+
41 mtx_unlock(&ctx->lock);
42
43 if (ctx->dummy_desc_bo)
44@@ -490,6 +493,14 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
45 list_for_each_entry(struct etna_acc_query, aq, &ctx->active_acc_queries, node)
46 etna_acc_query_suspend(aq, ctx);
47
48+ /* flush all resources that need an implicit flush */
49+ set_foreach(ctx->flush_resources, entry) {
50+ struct pipe_resource *prsc = (struct pipe_resource *)entry->key;
51+
52+ pctx->flush_resource(pctx, prsc);
53+ }
54+ _mesa_set_clear(ctx->flush_resources, NULL);
55+
56 etna_cmd_stream_flush(ctx->stream, ctx->in_fence_fd,
57 (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd : NULL);
58
59@@ -596,6 +607,11 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
60 if (!ctx->used_resources_write)
61 goto fail;
62
63+ ctx->flush_resources = _mesa_set_create(NULL, _mesa_hash_pointer,
64+ _mesa_key_pointer_equal);
65+ if (!ctx->flush_resources)
66+ goto fail;
67+
68 mtx_init(&ctx->lock, mtx_recursive);
69
70 /* context ctxate setup */
71diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h b/src/gallium/drivers/etnaviv/etnaviv_context.h
72index 72000f2122b..21e4d3f33ca 100644
73--- a/src/gallium/drivers/etnaviv/etnaviv_context.h
74+++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
75@@ -206,6 +206,9 @@ struct etna_context {
76 struct set *used_resources_read;
77 struct set *used_resources_write;
78
79+ /* resources that must be flushed implicitly at the context flush time */
80+ struct set *flush_resources;
81+
82 mtx_t lock;
83 };
84
85diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
86index ae4f24b9b44..0c8c28e66aa 100644
87--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
88+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
89@@ -265,6 +265,7 @@ etna_resource_alloc(struct pipe_screen *pscreen, unsigned layout,
90 rsc->base.nr_samples = nr_samples;
91 rsc->layout = layout;
92 rsc->halign = halign;
93+ rsc->explicit_flush = true;
94
95 pipe_reference_init(&rsc->base.reference, 1);
96 util_range_init(&rsc->valid_buffer_range);
97@@ -519,6 +520,9 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
98 rsc->layout = modifier_to_layout(handle->modifier);
99 rsc->halign = TEXTURE_HALIGN_FOUR;
100
101+ if (usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH)
102+ rsc->explicit_flush = true;
103+
104 level->width = tmpl->width0;
105 level->height = tmpl->height0;
106 level->depth = tmpl->depth0;
107@@ -584,6 +588,9 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
108 handle->offset = rsc->levels[0].offset;
109 handle->modifier = layout_to_modifier(rsc->layout);
110
111+ if (!(usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH))
112+ rsc->explicit_flush = false;
113+
114 if (handle->type == WINSYS_HANDLE_TYPE_SHARED) {
115 return etna_bo_get_name(rsc->bo, &handle->handle) == 0;
116 } else if (handle->type == WINSYS_HANDLE_TYPE_KMS) {
117diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.h b/src/gallium/drivers/etnaviv/etnaviv_resource.h
118index cb83e891d34..167cf4ed069 100644
119--- a/src/gallium/drivers/etnaviv/etnaviv_resource.h
120+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.h
121@@ -93,6 +93,8 @@ struct etna_resource {
122 struct pipe_resource *texture;
123 /* for when PE doesn't support the base layout */
124 struct pipe_resource *render;
125+ /* frontend flushes resource via an explicit call to flush_resource */
126+ bool explicit_flush;
127
128 enum etna_resource_status status;
129
130diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c
131index 44b1c4f8fab..1ad839799f2 100644
132--- a/src/gallium/drivers/etnaviv/etnaviv_state.c
133+++ b/src/gallium/drivers/etnaviv/etnaviv_state.c
134@@ -753,6 +753,21 @@ etna_update_zsa(struct etna_context *ctx)
135 return true;
136 }
137
138+static bool
139+etna_record_flush_resources(struct etna_context *ctx)
140+{
141+ struct pipe_framebuffer_state *fb = &ctx->framebuffer_s;
142+
143+ if (fb->nr_cbufs > 0) {
144+ struct etna_surface *surf = etna_surface(fb->cbufs[0]);
145+
146+ if (!etna_resource(surf->prsc)->explicit_flush)
147+ _mesa_set_add(ctx->flush_resources, surf->prsc);
148+ }
149+
150+ return true;
151+}
152+
153 struct etna_state_updater {
154 bool (*update)(struct etna_context *ctx);
155 uint32_t dirty;
156@@ -780,6 +795,9 @@ static const struct etna_state_updater etna_state_updates[] = {
157 },
158 {
159 etna_update_zsa, ETNA_DIRTY_ZSA | ETNA_DIRTY_SHADER,
160+ },
161+ {
162+ etna_record_flush_resources, ETNA_DIRTY_FRAMEBUFFER,
163 }
164 };
165
166--
1672.31.1
168
diff --git a/recipes-graphics/mesa/mesa_%.bbappend b/recipes-graphics/mesa/mesa_%.bbappend
index fedadab2..acddfbc6 100644
--- a/recipes-graphics/mesa/mesa_%.bbappend
+++ b/recipes-graphics/mesa/mesa_%.bbappend
@@ -1,16 +1,3 @@
1FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
2SRC_URI:append:use-mainline-bsp = " \
3 file://0001-dri-add-createImageWithModifiers2-interface.patch \
4 file://0002-dri-add-loader_dri_create_image-helper.patch \
5 file://0003-loader-dri3-convert-to-loader_dri_create_image.patch \
6 file://0004-loader-dri-hook-up-createImageWithModifiers2.patch \
7 file://0005-gallium-dri-copy-image-use-in-dup_image.patch \
8 file://0006-dri-don-t-call-modifier-interfaces-when-modifiers_co.patch \
9 file://0007-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch \
10 file://0008-etnaviv-remove-double-assigment-of-surface-texture.patch \
11 file://0009-etnaviv-flush-used-render-buffers-on-context-flush-w.patch \
12"
13
14PROVIDES:remove:imxgpu = "virtual/egl" 1PROVIDES:remove:imxgpu = "virtual/egl"
15PROVIDES:remove:imxgpu3d = "virtual/libgl virtual/libgles1 virtual/libgles2" 2PROVIDES:remove:imxgpu3d = "virtual/libgl virtual/libgles1 virtual/libgles2"
16 3