summaryrefslogtreecommitdiffstats
path: root/bsp/meta-qcom/recipes-graphics/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'bsp/meta-qcom/recipes-graphics/mesa')
-rw-r--r--bsp/meta-qcom/recipes-graphics/mesa/files/0001-freedreno-add-query-for-dmabuf-modifiers.patch101
-rw-r--r--bsp/meta-qcom/recipes-graphics/mesa/mesa/0001-freedreno-clear-last_fence-after-resource-tracking.patch94
-rw-r--r--bsp/meta-qcom/recipes-graphics/mesa/mesa_%.bbappend17
3 files changed, 105 insertions, 107 deletions
diff --git a/bsp/meta-qcom/recipes-graphics/mesa/files/0001-freedreno-add-query-for-dmabuf-modifiers.patch b/bsp/meta-qcom/recipes-graphics/mesa/files/0001-freedreno-add-query-for-dmabuf-modifiers.patch
deleted file mode 100644
index 57ebd8f9..00000000
--- a/bsp/meta-qcom/recipes-graphics/mesa/files/0001-freedreno-add-query-for-dmabuf-modifiers.patch
+++ /dev/null
@@ -1,101 +0,0 @@
-From c4bee1a1b3fb224002fe8c263bedbce1b705ed49 Mon Sep 17 00:00:00 2001
-From: Peter Griffin <peter.griffin@linaro.org>
-Date: Mon, 13 May 2019 19:18:56 +0100
-Subject: [PATCH] freedreno: add query for dmabuf modifiers
-
-Backport of mesa 7c4b9510d by Fritz Koenig. Tested with Weston
-and weston-simple-dmabuf-drm client.
-
-Upstream-Status: Backport from 19.0
-
-Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
----
- src/gallium/drivers/freedreno/freedreno_screen.c | 43 ++++++++++++++++++++++++
- src/gallium/drivers/freedreno/freedreno_screen.h | 3 ++
- 2 files changed, 46 insertions(+)
-
-diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
-index f338d75..cbb5b8a 100644
---- a/src/gallium/drivers/freedreno/freedreno_screen.c
-+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
-@@ -40,6 +40,7 @@
-
- #include "util/os_time.h"
-
-+#include <drm_fourcc.h>
- #include <errno.h>
- #include <stdio.h>
- #include <stdlib.h>
-@@ -732,6 +733,37 @@ fd_screen_bo_get_handle(struct pipe_screen *pscreen,
- }
- }
-
-+static void
-+fd_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
-+ enum pipe_format format,
-+ int max, uint64_t *modifiers,
-+ unsigned int *external_only,
-+ int *count)
-+{
-+ struct fd_screen *screen = fd_screen(pscreen);
-+ int i, num = 0;
-+
-+ max = MIN2(max, screen->num_supported_modifiers);
-+
-+ if (!max) {
-+ max = screen->num_supported_modifiers;
-+ external_only = NULL;
-+ modifiers = NULL;
-+ }
-+
-+ for (i = 0; i < max; i++) {
-+ if (modifiers)
-+ modifiers[num] = screen->supported_modifiers[i];
-+
-+ if (external_only)
-+ external_only[num] = 0;
-+
-+ num++;
-+ }
-+
-+ *count = num;
-+}
-+
- struct fd_bo *
- fd_screen_bo_from_handle(struct pipe_screen *pscreen,
- struct winsys_handle *whandle)
-@@ -921,6 +953,17 @@ fd_screen_create(struct fd_device *dev)
- pscreen->fence_finish = fd_fence_finish;
- pscreen->fence_get_fd = fd_fence_get_fd;
-
-+ pscreen->query_dmabuf_modifiers = fd_screen_query_dmabuf_modifiers;
-+
-+ if (!screen->supported_modifiers) {
-+ static const uint64_t supported_modifiers[] = {
-+ DRM_FORMAT_MOD_LINEAR,
-+ };
-+
-+ screen->supported_modifiers = supported_modifiers;
-+ screen->num_supported_modifiers = ARRAY_SIZE(supported_modifiers);
-+ }
-+
- slab_create_parent(&screen->transfer_pool, sizeof(struct fd_transfer), 16);
-
- return pscreen;
-diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h
-index 6be739a..5558066 100644
---- a/src/gallium/drivers/freedreno/freedreno_screen.h
-+++ b/src/gallium/drivers/freedreno/freedreno_screen.h
-@@ -89,6 +89,9 @@ struct fd_screen {
- struct fd_batch_cache batch_cache;
-
- bool reorder;
-+
-+ unsigned num_supported_modifiers;
-+ const uint64_t *supported_modifiers;
- };
-
- static inline struct fd_screen *
---
-2.7.4
-
diff --git a/bsp/meta-qcom/recipes-graphics/mesa/mesa/0001-freedreno-clear-last_fence-after-resource-tracking.patch b/bsp/meta-qcom/recipes-graphics/mesa/mesa/0001-freedreno-clear-last_fence-after-resource-tracking.patch
new file mode 100644
index 00000000..2d4aa000
--- /dev/null
+++ b/bsp/meta-qcom/recipes-graphics/mesa/mesa/0001-freedreno-clear-last_fence-after-resource-tracking.patch
@@ -0,0 +1,94 @@
+From 3c4e3006ef3318c1afe65341a1f92cf332ce0d81 Mon Sep 17 00:00:00 2001
+From: Rob Clark <robdclark@chromium.org>
+Date: Sat, 23 May 2020 10:52:52 -0700
+Subject: [PATCH] freedreno: clear last_fence after resource tracking
+
+The resource tracking in the clear/draw_vbo/blit paths could itself
+trigger a flush. Which would update last_fence. So we need to clear
+last_fence *after* all the dependency tracking.
+
+Fixes: ddb7fadaf8b ("freedreno: avoid no-op flushes by re-using last-fence")
+Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2992
+Signed-off-by: Rob Clark <robdclark@chromium.org>
+---
+ src/gallium/drivers/freedreno/a6xx/fd6_blitter.c | 8 ++++++--
+ src/gallium/drivers/freedreno/freedreno_draw.c | 16 ++++++++++++----
+ 2 files changed, 18 insertions(+), 6 deletions(-)
+
+diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
+index f812aab37a6..21900312ae7 100644
+--- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
++++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
+@@ -632,8 +632,6 @@ handle_rgba_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
+ if (!can_do_blit(info))
+ return false;
+
+- fd_fence_ref(&ctx->last_fence, NULL);
+-
+ batch = fd_bc_alloc_batch(&ctx->screen->batch_cache, ctx, true);
+
+ fd6_emit_restore(batch, batch->draw);
+@@ -646,6 +644,12 @@ handle_rgba_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
+
+ mtx_unlock(&ctx->screen->lock);
+
++ /* Clearing last_fence must come after the batch dependency tracking
++ * (resource_read()/resource_write()), as that can trigger a flush,
++ * re-populating last_fence
++ */
++ fd_fence_ref(&ctx->last_fence, NULL);
++
+ emit_setup(batch);
+
+ if ((info->src.resource->target == PIPE_BUFFER) &&
+diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
+index 94e2aae9e68..e2a0a1260fa 100644
+--- a/src/gallium/drivers/freedreno/freedreno_draw.c
++++ b/src/gallium/drivers/freedreno/freedreno_draw.c
+@@ -93,8 +93,6 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
+ return;
+ }
+
+- fd_fence_ref(&ctx->last_fence, NULL);
+-
+ /* Upload a user index buffer. */
+ struct pipe_resource *indexbuf = NULL;
+ unsigned index_offset = 0;
+@@ -282,6 +280,12 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
+ /* and any buffers used, need to be resolved: */
+ batch->resolve |= buffers;
+
++ /* Clearing last_fence must come after the batch dependency tracking
++ * (resource_read()/resource_written()), as that can trigger a flush,
++ * re-populating last_fence
++ */
++ fd_fence_ref(&ctx->last_fence, NULL);
++
+ DBG("%p: %x %ux%u num_draws=%u (%s/%s)", batch, buffers,
+ pfb->width, pfb->height, batch->num_draws,
+ util_format_short_name(pipe_surface_format(pfb->cbufs[0])),
+@@ -318,8 +322,6 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
+ if (!fd_render_condition_check(pctx))
+ return;
+
+- fd_fence_ref(&ctx->last_fence, NULL);
+-
+ if (ctx->in_blit) {
+ fd_batch_reset(batch);
+ fd_context_all_dirty(ctx);
+@@ -366,6 +368,12 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
+
+ mtx_unlock(&ctx->screen->lock);
+
++ /* Clearing last_fence must come after the batch dependency tracking
++ * (resource_read()/resource_written()), as that can trigger a flush,
++ * re-populating last_fence
++ */
++ fd_fence_ref(&ctx->last_fence, NULL);
++
+ DBG("%p: %x %ux%u depth=%f, stencil=%u (%s/%s)", batch, buffers,
+ pfb->width, pfb->height, depth, stencil,
+ util_format_short_name(pipe_surface_format(pfb->cbufs[0])),
+--
+2.27.0.rc0
+
diff --git a/bsp/meta-qcom/recipes-graphics/mesa/mesa_%.bbappend b/bsp/meta-qcom/recipes-graphics/mesa/mesa_%.bbappend
index 7ad44bdc..fd40c398 100644
--- a/bsp/meta-qcom/recipes-graphics/mesa/mesa_%.bbappend
+++ b/bsp/meta-qcom/recipes-graphics/mesa/mesa_%.bbappend
@@ -1,13 +1,13 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
+SRC_URI_append = " \
+ file://0001-freedreno-clear-last_fence-after-resource-tracking.patch \
+"
+
# Enable freedreno driver
GALLIUMDRIVERS_append_apq8064 = ",freedreno"
GALLIUMDRIVERS_append_apq8016 = ",freedreno"
GALLIUMDRIVERS_append_apq8096 = ",freedreno"
-
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-
-SRC_URI_append_apq8064 = " file://0001-freedreno-add-query-for-dmabuf-modifiers.patch"
-SRC_URI_append_apq8016 = " file://0001-freedreno-add-query-for-dmabuf-modifiers.patch"
-SRC_URI_append_apq8096 = " file://0001-freedreno-add-query-for-dmabuf-modifiers.patch"
+GALLIUMDRIVERS_append_sdm845 = ",freedreno"
PACKAGECONFIG_append_apq8064 = " \
gallium \
@@ -23,3 +23,8 @@ PACKAGECONFIG_append_apq8096 = " \
gallium \
${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xa', '', d)} \
"
+
+PACKAGECONFIG_append_sdm845 = " \
+ gallium \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xa', '', d)} \
+"