summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2021-07-27 12:24:43 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-07-28 23:47:00 +0100
commit8dbe3bd652e24822da6754444bd9d071405d490c (patch)
tree9ebeff7b35153b1d0d9020cbd4072de4196cf3dd
parent7668153777fdcec67b4cb5d43e0c2ac3eeaef57a (diff)
downloadpoky-8dbe3bd652e24822da6754444bd9d071405d490c.tar.gz
mesa: Fix v3d & vc4 dmabuf import
Mesa would unnecessarily fail in the v3d and vc4 driver if a dmabuf could not imported for scanout. In particular, this meant the weston-simple-dmabuf-egl test program would fail on a Raspberry Pi. (From OE-Core rev: 6396c42df4609b4515f197926388ff4acb11fe52) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-graphics/mesa/files/0001-v3d-vc4-Fix-dmabuf-import-for-non-scanout-buffers.patch72
-rw-r--r--meta/recipes-graphics/mesa/mesa.inc1
2 files changed, 73 insertions, 0 deletions
diff --git a/meta/recipes-graphics/mesa/files/0001-v3d-vc4-Fix-dmabuf-import-for-non-scanout-buffers.patch b/meta/recipes-graphics/mesa/files/0001-v3d-vc4-Fix-dmabuf-import-for-non-scanout-buffers.patch
new file mode 100644
index 0000000000..1a8771028b
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-v3d-vc4-Fix-dmabuf-import-for-non-scanout-buffers.patch
@@ -0,0 +1,72 @@
1From 303c02a31df4e2b8f6090e75982922a9cba33e4c Mon Sep 17 00:00:00 2001
2From: Joshua Watt <JPEWhacker@gmail.com>
3Date: Tue, 27 Jul 2021 11:41:53 -0500
4Subject: [PATCH] v3d, vc4: Fix dmabuf import for non-scanout buffers
5
6Failure to create a buffer for scanout should not be fatal when
7importing a buffer. Buffers allocated from a render-only device may not
8be able to scanned out directly but can still be used for other
9rendering purposes (e.g. as a texture).
10
11Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
12Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12081]
13---
14 src/gallium/drivers/v3d/v3d_resource.c | 13 +++++--------
15 src/gallium/drivers/vc4/vc4_resource.c | 3 ---
16 2 files changed, 5 insertions(+), 11 deletions(-)
17
18diff --git a/src/gallium/drivers/v3d/v3d_resource.c b/src/gallium/drivers/v3d/v3d_resource.c
19index 602ba6d8447..02dc29ae6a0 100644
20--- a/src/gallium/drivers/v3d/v3d_resource.c
21+++ b/src/gallium/drivers/v3d/v3d_resource.c
22@@ -433,10 +433,11 @@ v3d_resource_get_handle(struct pipe_screen *pscreen,
23 return v3d_bo_flink(bo, &whandle->handle);
24 case WINSYS_HANDLE_TYPE_KMS:
25 if (screen->ro) {
26- assert(rsc->scanout);
27- bool ok = renderonly_get_handle(rsc->scanout, whandle);
28- whandle->stride = rsc->slices[0].stride;
29- return ok;
30+ if (renderonly_get_handle(rsc->scanout, whandle)) {
31+ whandle->stride = rsc->slices[0].stride;
32+ return true;
33+ }
34+ return false;
35 }
36 whandle->handle = bo->handle;
37 return true;
38@@ -929,10 +930,6 @@ v3d_resource_from_handle(struct pipe_screen *pscreen,
39 renderonly_create_gpu_import_for_resource(prsc,
40 screen->ro,
41 NULL);
42- if (!rsc->scanout) {
43- fprintf(stderr, "Failed to create scanout resource.\n");
44- goto fail;
45- }
46 }
47
48 if (rsc->tiled && whandle->stride != slice->stride) {
49diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
50index 61e5fd7e5a6..bf3f7656ff8 100644
51--- a/src/gallium/drivers/vc4/vc4_resource.c
52+++ b/src/gallium/drivers/vc4/vc4_resource.c
53@@ -320,7 +320,6 @@ vc4_resource_get_handle(struct pipe_screen *pscreen,
54 return vc4_bo_flink(rsc->bo, &whandle->handle);
55 case WINSYS_HANDLE_TYPE_KMS:
56 if (screen->ro) {
57- assert(rsc->scanout);
58 return renderonly_get_handle(rsc->scanout, whandle);
59 }
60 whandle->handle = rsc->bo->handle;
61@@ -689,8 +688,6 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
62 renderonly_create_gpu_import_for_resource(prsc,
63 screen->ro,
64 NULL);
65- if (!rsc->scanout)
66- goto fail;
67 }
68
69 if (rsc->tiled && whandle->stride != slice->stride) {
70--
712.32.0
72
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 6a0df4fa2e..85a352f736 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -19,6 +19,7 @@ SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
19 file://0002-meson.build-make-TLS-ELF-optional.patch \ 19 file://0002-meson.build-make-TLS-ELF-optional.patch \
20 file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ 20 file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
21 file://0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch \ 21 file://0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch \
22 file://0001-v3d-vc4-Fix-dmabuf-import-for-non-scanout-buffers.patch \
22 " 23 "
23 24
24SRC_URI[sha256sum] = "022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d" 25SRC_URI[sha256sum] = "022c7293074aeeced2278c872db4fa693147c70f8595b076cf3f1ef81520766d"