summaryrefslogtreecommitdiffstats
path: root/recipes-graphics/mesa
diff options
context:
space:
mode:
authorAndreas Müller <schnitzeltony@gmail.com>2021-05-30 23:33:08 +0200
committerOtavio Salvador <otavio@ossystems.com.br>2021-05-31 08:27:10 -0300
commitcb88eb8e833652ef60598927d5ac640b4194260b (patch)
treee9c8aa654f6df3caca843547bad198589bb79b82 /recipes-graphics/mesa
parent733e1683ce8895a960c01a3ee1fce40118d82982 (diff)
downloadmeta-freescale-cb88eb8e833652ef60598927d5ac640b4194260b.tar.gz
mesa: Refresh patches for mesa 21.1.1
* Addresses [1] * all patches were taken from mesa's main branch and applied cleanly * On X11/xfce first tests were performed without any patches: At least we do not see a mouse pointer which is similar behavior as seen when introducing first patch series. * On X11/xfce moving windows is faster now / gtk-based applications still show tiny artifacts / Qt/QML based application run without issues / glmark2-es2 results in 158 which is similar to mesa 21.0.3 * Could not test my weston images (use sddm as dm): All native recipes inheriting cmake_qt5 are broken due to MACHINE_SOCARCH_FILTER - will open an issue for that. [1] https://github.com/Freescale/meta-freescale/issues/795 Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Diffstat (limited to 'recipes-graphics/mesa')
-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/0002-dri-bring-back-use-flags-for-createImageWithModifier.patch119
-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-etnaviv-compact-etna_state_updates.patch52
-rw-r--r--recipes-graphics/mesa/mesa/0005-gallium-dri-copy-image-use-in-dup_image.patch (renamed from recipes-graphics/mesa/mesa/0001-frontend-dri-copy-image-use-in-dup_image.patch)16
-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.patch (renamed from recipes-graphics/mesa/mesa/0003-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch)16
-rw-r--r--recipes-graphics/mesa/mesa/0008-etnaviv-remove-double-assigment-of-surface-texture.patch (renamed from recipes-graphics/mesa/mesa/0004-etnaviv-remove-double-assigment-of-surface-texture.patch)10
-rw-r--r--recipes-graphics/mesa/mesa/0009-etnaviv-flush-used-render-buffers-on-context-flush-w.patch (renamed from recipes-graphics/mesa/mesa/0006-etnaviv-flush-used-render-buffers-on-context-flush-w.patch)38
-rw-r--r--recipes-graphics/mesa/mesa_%.bbappend15
12 files changed, 626 insertions, 214 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
new file mode 100644
index 00000000..261c54cc
--- /dev/null
+++ b/recipes-graphics/mesa/mesa/0001-dri-add-createImageWithModifiers2-interface.patch
@@ -0,0 +1,67 @@
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
new file mode 100644
index 00000000..1e5d0f69
--- /dev/null
+++ b/recipes-graphics/mesa/mesa/0002-dri-add-loader_dri_create_image-helper.patch
@@ -0,0 +1,336 @@
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/0002-dri-bring-back-use-flags-for-createImageWithModifier.patch b/recipes-graphics/mesa/mesa/0002-dri-bring-back-use-flags-for-createImageWithModifier.patch
deleted file mode 100644
index 9eee458e..00000000
--- a/recipes-graphics/mesa/mesa/0002-dri-bring-back-use-flags-for-createImageWithModifier.patch
+++ /dev/null
@@ -1,119 +0,0 @@
1From 00add4be8620175ccc69869e22479962dacdce9d Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Fri, 13 Nov 2020 14:38:41 +0100
4Subject: [PATCH 2/6] dri: bring back use flags for createImageWithModifiers
5
6createImageWithModifiers dropped the use flags that were present with
7the createImage interface as it was believed at the time that all those
8use flags could be expressed as a modifier. This turned out to be untrue,
9as there are some use flags like SCANOUT and the BACKBUFFER hint that
10won't ever get a eqivalent modifier expression.
11
12Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
13
14Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603]
15---
16 include/GL/internal/dri_interface.h | 1 +
17 src/egl/drivers/dri2/platform_wayland.c | 4 ++--
18 src/gallium/frontends/dri/dri2.c | 5 ++---
19 src/gbm/backends/dri/gbm_dri.c | 2 +-
20 src/loader/loader_dri3_helper.c | 3 +++
21 src/mesa/drivers/dri/i965/intel_screen.c | 2 +-
22 6 files changed, 10 insertions(+), 7 deletions(-)
23
24diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
25index 39d5dd07533..222821428d0 100644
26--- a/include/GL/internal/dri_interface.h
27+++ b/include/GL/internal/dri_interface.h
28@@ -1678,6 +1678,7 @@ struct __DRIimageExtensionRec {
29 int width, int height, int format,
30 const uint64_t *modifiers,
31 const unsigned int modifier_count,
32+ unsigned int use,
33 void *loaderPrivate);
34
35 /*
36diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
37index c0b26c4b623..bb508cbe421 100644
38--- a/src/egl/drivers/dri2/platform_wayland.c
39+++ b/src/egl/drivers/dri2/platform_wayland.c
40@@ -595,7 +595,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
41 dri2_surf->base.Height,
42 linear_dri_image_format,
43 &linear_mod,
44- 1,
45+ 1, use_flags,
46 NULL);
47 } else {
48 dri2_surf->back->linear_copy =
49@@ -624,7 +624,7 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
50 dri2_surf->base.Height,
51 dri_image_format,
52 modifiers,
53- num_modifiers,
54+ num_modifiers, use_flags,
55 NULL);
56 } else {
57 dri2_surf->back->dri_image =
58diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
59index 1cd42cd8114..1f1e7a9a65e 100644
60--- a/src/gallium/frontends/dri/dri2.c
61+++ b/src/gallium/frontends/dri/dri2.c
62@@ -1074,12 +1074,11 @@ static __DRIimage *
63 dri2_create_image_with_modifiers(__DRIscreen *dri_screen,
64 int width, int height, int format,
65 const uint64_t *modifiers,
66- const unsigned count,
67+ const unsigned count, unsigned int use,
68 void *loaderPrivate)
69 {
70 return dri2_create_image_common(dri_screen, width, height, format,
71- __DRI_IMAGE_USE_SHARE, modifiers, count,
72- loaderPrivate);
73+ use, modifiers, count, loaderPrivate);
74 }
75
76 static bool
77diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
78index b5634741554..aff3a107e7d 100644
79--- a/src/gbm/backends/dri/gbm_dri.c
80+++ b/src/gbm/backends/dri/gbm_dri.c
81@@ -1173,7 +1173,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
82 width, height,
83 dri_format,
84 modifiers, count,
85- bo);
86+ dri_use, bo);
87
88 if (bo->image) {
89 /* The client passed in a list of invalid modifiers */
90diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
91index ccf8d1795e7..6fc6a2b705a 100644
92--- a/src/loader/loader_dri3_helper.c
93+++ b/src/loader/loader_dri3_helper.c
94@@ -1407,6 +1407,9 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format,
95 format,
96 modifiers,
97 count,
98+ __DRI_IMAGE_USE_SHARE |
99+ __DRI_IMAGE_USE_SCANOUT |
100+ __DRI_IMAGE_USE_BACKBUFFER,
101 buffer);
102 }
103
104diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
105index 4492d43c040..4511b962eef 100644
106--- a/src/mesa/drivers/dri/i965/intel_screen.c
107+++ b/src/mesa/drivers/dri/i965/intel_screen.c
108@@ -893,7 +893,7 @@ static __DRIimage *
109 intel_create_image_with_modifiers(__DRIscreen *dri_screen,
110 int width, int height, int format,
111 const uint64_t *modifiers,
112- const unsigned count,
113+ const unsigned count, unsigned int use,
114 void *loaderPrivate)
115 {
116 return intel_create_image_common(dri_screen, width, height, format, 0,
117--
1182.26.2
119
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
new file mode 100644
index 00000000..daba1a50
--- /dev/null
+++ b/recipes-graphics/mesa/mesa/0003-loader-dri3-convert-to-loader_dri_create_image.patch
@@ -0,0 +1,93 @@
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
new file mode 100644
index 00000000..c80978a7
--- /dev/null
+++ b/recipes-graphics/mesa/mesa/0004-loader-dri-hook-up-createImageWithModifiers2.patch
@@ -0,0 +1,42 @@
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-etnaviv-compact-etna_state_updates.patch b/recipes-graphics/mesa/mesa/0005-etnaviv-compact-etna_state_updates.patch
deleted file mode 100644
index d9cca38f..00000000
--- a/recipes-graphics/mesa/mesa/0005-etnaviv-compact-etna_state_updates.patch
+++ /dev/null
@@ -1,52 +0,0 @@
1From 570908323e02c4558f5a9abc2d82621056cd65ab Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Tue, 17 Nov 2020 12:08:13 +0100
4Subject: [PATCH 5/6] etnaviv: compact etna_state_updates
5
6Just reclaim a bit of screen real estate, purely cosmetic change.
7
8Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
9
10Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603]
11---
12 src/gallium/drivers/etnaviv/etnaviv_state.c | 18 ++++++------------
13 1 file changed, 6 insertions(+), 12 deletions(-)
14
15diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c
16index 1b4a7040b50..84fea58ecb5 100644
17--- a/src/gallium/drivers/etnaviv/etnaviv_state.c
18+++ b/src/gallium/drivers/etnaviv/etnaviv_state.c
19@@ -749,24 +749,18 @@ struct etna_state_updater {
20 static const struct etna_state_updater etna_state_updates[] = {
21 {
22 etna_shader_update_vertex, ETNA_DIRTY_SHADER | ETNA_DIRTY_VERTEX_ELEMENTS,
23- },
24- {
25+ }, {
26 etna_shader_link, ETNA_DIRTY_SHADER,
27- },
28- {
29+ }, {
30 etna_update_blend, ETNA_DIRTY_BLEND | ETNA_DIRTY_FRAMEBUFFER
31- },
32- {
33+ }, {
34 etna_update_blend_color, ETNA_DIRTY_BLEND_COLOR | ETNA_DIRTY_FRAMEBUFFER,
35- },
36- {
37+ }, {
38 etna_update_ts_config, ETNA_DIRTY_DERIVE_TS,
39- },
40- {
41+ }, {
42 etna_update_clipping, ETNA_DIRTY_SCISSOR | ETNA_DIRTY_FRAMEBUFFER |
43 ETNA_DIRTY_RASTERIZER | ETNA_DIRTY_VIEWPORT,
44- },
45- {
46+ }, {
47 etna_update_zsa, ETNA_DIRTY_ZSA | ETNA_DIRTY_SHADER,
48 }
49 };
50--
512.26.2
52
diff --git a/recipes-graphics/mesa/mesa/0001-frontend-dri-copy-image-use-in-dup_image.patch b/recipes-graphics/mesa/mesa/0005-gallium-dri-copy-image-use-in-dup_image.patch
index 9e098310..57251ed7 100644
--- a/recipes-graphics/mesa/mesa/0001-frontend-dri-copy-image-use-in-dup_image.patch
+++ b/recipes-graphics/mesa/mesa/0005-gallium-dri-copy-image-use-in-dup_image.patch
@@ -1,22 +1,23 @@
1From 96106df17897b862b87937d6222a3e6483f45480 Mon Sep 17 00:00:00 2001 1From 3701cb9439058e71c1981bd80c5a9e1383815b08 Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de> 2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Fri, 13 Nov 2020 14:26:23 +0100 3Date: Fri, 13 Nov 2020 14:26:23 +0100
4Subject: [PATCH 1/6] frontend/dri: copy image use in dup_image 4Subject: [PATCH] gallium/dri: copy image use in dup_image
5 5
6Don't lose the use flags when dup'ing an image. 6Don't lose the use flags when dup'ing an image.
7 7
8Signed-off-by: Lucas Stach <l.stach@pengutronix.de> 8Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
9 9Reviewed-by: Daniel Stone <daniels@collabora.com>
10Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603] 10Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8106>
11Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/3701cb9439058e71c1981bd80c5a9e1383815b08]
11--- 12---
12 src/gallium/frontends/dri/dri2.c | 1 + 13 src/gallium/frontends/dri/dri2.c | 1 +
13 1 file changed, 1 insertion(+) 14 1 file changed, 1 insertion(+)
14 15
15diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c 16diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
16index 0c0168497a2..1cd42cd8114 100644 17index 9999b31b022..08a9ed9693c 100644
17--- a/src/gallium/frontends/dri/dri2.c 18--- a/src/gallium/frontends/dri/dri2.c
18+++ b/src/gallium/frontends/dri/dri2.c 19+++ b/src/gallium/frontends/dri/dri2.c
19@@ -1312,6 +1312,7 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate) 20@@ -1326,6 +1326,7 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate)
20 img->dri_format = image->dri_format; 21 img->dri_format = image->dri_format;
21 /* This should be 0 for sub images, but dup is also used for base images. */ 22 /* This should be 0 for sub images, but dup is also used for base images. */
22 img->dri_components = image->dri_components; 23 img->dri_components = image->dri_components;
@@ -24,3 +25,6 @@ index 0c0168497a2..1cd42cd8114 100644
24 img->loader_private = loaderPrivate; 25 img->loader_private = loaderPrivate;
25 img->sPriv = image->sPriv; 26 img->sPriv = image->sPriv;
26 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
new file mode 100644
index 00000000..765cc0ac
--- /dev/null
+++ b/recipes-graphics/mesa/mesa/0006-dri-don-t-call-modifier-interfaces-when-modifiers_co.patch
@@ -0,0 +1,36 @@
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/0003-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
index 544c132b..43bd86bd 100644
--- a/recipes-graphics/mesa/mesa/0003-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
@@ -1,7 +1,7 @@
1From 587aac46dbadf2aca1489aadd4216e592e11e17b Mon Sep 17 00:00:00 2001 1From 3824429da0e0e68b78534b1e0ab7e386bcb2b2e2 Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de> 2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Fri, 13 Nov 2020 14:59:52 +0100 3Date: Fri, 13 Nov 2020 14:59:52 +0100
4Subject: [PATCH 3/6] frontend/dri: add EXPLICIT_FLUSH hint in 4Subject: [PATCH] frontend/dri: add EXPLICIT_FLUSH hint in
5 dri2_resource_get_param 5 dri2_resource_get_param
6 6
7dri2_resource_get_param() is called from two different places right now. 7dri2_resource_get_param() is called from two different places right now.
@@ -11,17 +11,17 @@ may disable the optimizations provided by this hint without a reason.
11Make sure to always add this hint when appropriate. 11Make sure to always add this hint when appropriate.
12 12
13Signed-off-by: Lucas Stach <l.stach@pengutronix.de> 13Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
14 14Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603>
15Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603] 15Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/3824429da0e0e68b78534b1e0ab7e386bcb2b2e2]
16--- 16---
17 src/gallium/frontends/dri/dri2.c | 6 +++--- 17 src/gallium/frontends/dri/dri2.c | 6 +++---
18 1 file changed, 3 insertions(+), 3 deletions(-) 18 1 file changed, 3 insertions(+), 3 deletions(-)
19 19
20diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c 20diff --git a/src/gallium/frontends/dri/dri2.c b/src/gallium/frontends/dri/dri2.c
21index 1f1e7a9a65e..7851ebceb3e 100644 21index 0220513368e..8ed47c25825 100644
22--- a/src/gallium/frontends/dri/dri2.c 22--- a/src/gallium/frontends/dri/dri2.c
23+++ b/src/gallium/frontends/dri/dri2.c 23+++ b/src/gallium/frontends/dri/dri2.c
24@@ -1198,6 +1198,9 @@ dri2_resource_get_param(__DRIimage *image, enum pipe_resource_param param, 24@@ -1252,6 +1252,9 @@ dri2_resource_get_param(__DRIimage *image, enum pipe_resource_param param,
25 if (!pscreen->resource_get_param) 25 if (!pscreen->resource_get_param)
26 return false; 26 return false;
27 27
@@ -31,7 +31,7 @@ index 1f1e7a9a65e..7851ebceb3e 100644
31 return pscreen->resource_get_param(pscreen, NULL, image->texture, 31 return pscreen->resource_get_param(pscreen, NULL, image->texture,
32 image->plane, 0, 0, param, handle_usage, 32 image->plane, 0, 0, param, handle_usage,
33 value); 33 value);
34@@ -1242,9 +1245,6 @@ dri2_query_image_by_resource_param(__DRIimage *image, int attrib, int *value) 34@@ -1296,9 +1299,6 @@ dri2_query_image_by_resource_param(__DRIimage *image, int attrib, int *value)
35 35
36 handle_usage = PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE; 36 handle_usage = PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE;
37 37
@@ -42,5 +42,5 @@ index 1f1e7a9a65e..7851ebceb3e 100644
42 return false; 42 return false;
43 43
44-- 44--
452.26.2 452.31.1
46 46
diff --git a/recipes-graphics/mesa/mesa/0004-etnaviv-remove-double-assigment-of-surface-texture.patch b/recipes-graphics/mesa/mesa/0008-etnaviv-remove-double-assigment-of-surface-texture.patch
index 3865dbc9..7f43be10 100644
--- a/recipes-graphics/mesa/mesa/0004-etnaviv-remove-double-assigment-of-surface-texture.patch
+++ b/recipes-graphics/mesa/mesa/0008-etnaviv-remove-double-assigment-of-surface-texture.patch
@@ -1,15 +1,15 @@
1From 59f74212bbb5e28badd0775929e42856c9a01d35 Mon Sep 17 00:00:00 2001 1From 1c539bbb06f318d2bd0f93701b532f77894e391d Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de> 2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Fri, 13 Nov 2020 15:03:37 +0100 3Date: Fri, 13 Nov 2020 15:03:37 +0100
4Subject: [PATCH 4/6] etnaviv: remove double assigment of surface->texture 4Subject: [PATCH] etnaviv: remove double assigment of surface->texture
5 5
6surf->base.texture is already assigned earlier via a proper 6surf->base.texture is already assigned earlier via a proper
7pipe_resource_reference call. Remove the superfluous assignement. 7pipe_resource_reference call. Remove the superfluous assignement.
8 8
9Signed-off-by: Lucas Stach <l.stach@pengutronix.de> 9Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
10Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> 10Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
11 11Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603>
12Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603] 12Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/1c539bbb06f318d2bd0f93701b532f77894e391d]
13--- 13---
14 src/gallium/drivers/etnaviv/etnaviv_surface.c | 1 - 14 src/gallium/drivers/etnaviv/etnaviv_surface.c | 1 -
15 1 file changed, 1 deletion(-) 15 1 file changed, 1 deletion(-)
@@ -27,5 +27,5 @@ index c78973bdb09..52a937652d2 100644
27 surf->base.width = rsc->levels[level].width; 27 surf->base.width = rsc->levels[level].width;
28 surf->base.height = rsc->levels[level].height; 28 surf->base.height = rsc->levels[level].height;
29-- 29--
302.26.2 302.31.1
31 31
diff --git a/recipes-graphics/mesa/mesa/0006-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
index ea658a03..4534cd5a 100644
--- a/recipes-graphics/mesa/mesa/0006-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
@@ -1,7 +1,7 @@
1From 537c7a6ea3fd2e5a6433e52b406ba39b89f520d9 Mon Sep 17 00:00:00 2001 1From 7b9d8d1936d72af6fd1bfd30afed354bb76b4c0c Mon Sep 17 00:00:00 2001
2From: Lucas Stach <l.stach@pengutronix.de> 2From: Lucas Stach <l.stach@pengutronix.de>
3Date: Fri, 13 Nov 2020 15:05:55 +0100 3Date: Fri, 13 Nov 2020 15:05:55 +0100
4Subject: [PATCH 6/6] etnaviv: flush used render buffers on context flush when 4Subject: [PATCH] etnaviv: flush used render buffers on context flush when
5 neccessary 5 neccessary
6 6
7Some resources like backbuffers are explicitly flushed by the frontend 7Some resources like backbuffers are explicitly flushed by the frontend
@@ -16,21 +16,22 @@ when a buffer handle is exported/imported without the
16PIPE_HANDLE_USAGE_EXPLICIT_FLUSH flag set. 16PIPE_HANDLE_USAGE_EXPLICIT_FLUSH flag set.
17 17
18Signed-off-by: Lucas Stach <l.stach@pengutronix.de> 18Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
19 19Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
20Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603] 20Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7603>
21Upstream-Status: Applied [https://gitlab.freedesktop.org/mesa/mesa/-/commit/7b9d8d1936d72af6fd1bfd30afed354bb76b4c0c]
21--- 22---
22 src/gallium/drivers/etnaviv/etnaviv_context.c | 16 ++++++++++++++++ 23 src/gallium/drivers/etnaviv/etnaviv_context.c | 16 ++++++++++++++++
23 src/gallium/drivers/etnaviv/etnaviv_context.h | 3 +++ 24 src/gallium/drivers/etnaviv/etnaviv_context.h | 3 +++
24 src/gallium/drivers/etnaviv/etnaviv_resource.c | 7 +++++++ 25 src/gallium/drivers/etnaviv/etnaviv_resource.c | 7 +++++++
25 src/gallium/drivers/etnaviv/etnaviv_resource.h | 2 ++ 26 src/gallium/drivers/etnaviv/etnaviv_resource.h | 2 ++
26 src/gallium/drivers/etnaviv/etnaviv_state.c | 17 +++++++++++++++++ 27 src/gallium/drivers/etnaviv/etnaviv_state.c | 18 ++++++++++++++++++
27 5 files changed, 45 insertions(+) 28 5 files changed, 46 insertions(+)
28 29
29diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c 30diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
30index 9c334a450c6..80c5d430419 100644 31index 4dd9e427ea1..581edc78d2f 100644
31--- a/src/gallium/drivers/etnaviv/etnaviv_context.c 32--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
32+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c 33+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
33@@ -128,6 +128,9 @@ etna_context_destroy(struct pipe_context *pctx) 34@@ -129,6 +129,9 @@ etna_context_destroy(struct pipe_context *pctx)
34 _mesa_set_destroy(ctx->used_resources_write, NULL); 35 _mesa_set_destroy(ctx->used_resources_write, NULL);
35 36
36 } 37 }
@@ -40,7 +41,7 @@ index 9c334a450c6..80c5d430419 100644
40 mtx_unlock(&ctx->lock); 41 mtx_unlock(&ctx->lock);
41 42
42 if (ctx->dummy_desc_bo) 43 if (ctx->dummy_desc_bo)
43@@ -475,6 +478,14 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence, 44@@ -490,6 +493,14 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
44 list_for_each_entry(struct etna_acc_query, aq, &ctx->active_acc_queries, node) 45 list_for_each_entry(struct etna_acc_query, aq, &ctx->active_acc_queries, node)
45 etna_acc_query_suspend(aq, ctx); 46 etna_acc_query_suspend(aq, ctx);
46 47
@@ -55,7 +56,7 @@ index 9c334a450c6..80c5d430419 100644
55 etna_cmd_stream_flush(ctx->stream, ctx->in_fence_fd, 56 etna_cmd_stream_flush(ctx->stream, ctx->in_fence_fd,
56 (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd : NULL); 57 (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd : NULL);
57 58
58@@ -581,6 +592,11 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) 59@@ -596,6 +607,11 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
59 if (!ctx->used_resources_write) 60 if (!ctx->used_resources_write)
60 goto fail; 61 goto fail;
61 62
@@ -68,7 +69,7 @@ index 9c334a450c6..80c5d430419 100644
68 69
69 /* context ctxate setup */ 70 /* context ctxate setup */
70diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h b/src/gallium/drivers/etnaviv/etnaviv_context.h 71diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h b/src/gallium/drivers/etnaviv/etnaviv_context.h
71index dd6af3d93e6..112902aac8a 100644 72index 72000f2122b..21e4d3f33ca 100644
72--- a/src/gallium/drivers/etnaviv/etnaviv_context.h 73--- a/src/gallium/drivers/etnaviv/etnaviv_context.h
73+++ b/src/gallium/drivers/etnaviv/etnaviv_context.h 74+++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
74@@ -206,6 +206,9 @@ struct etna_context { 75@@ -206,6 +206,9 @@ struct etna_context {
@@ -127,10 +128,10 @@ index cb83e891d34..167cf4ed069 100644
127 enum etna_resource_status status; 128 enum etna_resource_status status;
128 129
129diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c 130diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c
130index 84fea58ecb5..5848735ab14 100644 131index 44b1c4f8fab..1ad839799f2 100644
131--- a/src/gallium/drivers/etnaviv/etnaviv_state.c 132--- a/src/gallium/drivers/etnaviv/etnaviv_state.c
132+++ b/src/gallium/drivers/etnaviv/etnaviv_state.c 133+++ b/src/gallium/drivers/etnaviv/etnaviv_state.c
133@@ -741,6 +741,21 @@ etna_update_zsa(struct etna_context *ctx) 134@@ -753,6 +753,21 @@ etna_update_zsa(struct etna_context *ctx)
134 return true; 135 return true;
135 } 136 }
136 137
@@ -152,15 +153,16 @@ index 84fea58ecb5..5848735ab14 100644
152 struct etna_state_updater { 153 struct etna_state_updater {
153 bool (*update)(struct etna_context *ctx); 154 bool (*update)(struct etna_context *ctx);
154 uint32_t dirty; 155 uint32_t dirty;
155@@ -762,6 +777,8 @@ static const struct etna_state_updater etna_state_updates[] = { 156@@ -780,6 +795,9 @@ static const struct etna_state_updater etna_state_updates[] = {
156 ETNA_DIRTY_RASTERIZER | ETNA_DIRTY_VIEWPORT, 157 },
157 }, { 158 {
158 etna_update_zsa, ETNA_DIRTY_ZSA | ETNA_DIRTY_SHADER, 159 etna_update_zsa, ETNA_DIRTY_ZSA | ETNA_DIRTY_SHADER,
159+ }, { 160+ },
161+ {
160+ etna_record_flush_resources, ETNA_DIRTY_FRAMEBUFFER, 162+ etna_record_flush_resources, ETNA_DIRTY_FRAMEBUFFER,
161 } 163 }
162 }; 164 };
163 165
164-- 166--
1652.26.2 1672.31.1
166 168
diff --git a/recipes-graphics/mesa/mesa_%.bbappend b/recipes-graphics/mesa/mesa_%.bbappend
index c532e51e..423ee63e 100644
--- a/recipes-graphics/mesa/mesa_%.bbappend
+++ b/recipes-graphics/mesa/mesa_%.bbappend
@@ -1,11 +1,14 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" 1FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
2SRC_URI_append_use-mainline-bsp = " \ 2SRC_URI_append_use-mainline-bsp = " \
3 file://0001-frontend-dri-copy-image-use-in-dup_image.patch \ 3 file://0001-dri-add-createImageWithModifiers2-interface.patch \
4 file://0002-dri-bring-back-use-flags-for-createImageWithModifier.patch \ 4 file://0002-dri-add-loader_dri_create_image-helper.patch \
5 file://0003-frontend-dri-add-EXPLICIT_FLUSH-hint-in-dri2_resourc.patch \ 5 file://0003-loader-dri3-convert-to-loader_dri_create_image.patch \
6 file://0004-etnaviv-remove-double-assigment-of-surface-texture.patch \ 6 file://0004-loader-dri-hook-up-createImageWithModifiers2.patch \
7 file://0005-etnaviv-compact-etna_state_updates.patch \ 7 file://0005-gallium-dri-copy-image-use-in-dup_image.patch \
8 file://0006-etnaviv-flush-used-render-buffers-on-context-flush-w.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 \
9" 12"
10 13
11PROVIDES_remove_imxgpu = "virtual/egl" 14PROVIDES_remove_imxgpu = "virtual/egl"