Mesa (master): freedreno: add modifier param to fd_try_shadow_resource()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 11 18:13:18 UTC 2019


Module: Mesa
Branch: master
Commit: 3c9a31eb50ce598c89bc93a8ebb33acb5f3ba53f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c9a31eb50ce598c89bc93a8ebb33acb5f3ba53f

Author: Rob Clark <robdclark at chromium.org>
Date:   Fri Jun  7 09:23:16 2019 -0700

freedreno: add modifier param to fd_try_shadow_resource()

To uncompress UBWC, I want to re-use the shadow path, but we'll need a
way to request that the new buffer is not compressed.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>

---

 src/gallium/drivers/freedreno/freedreno_resource.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index e83143f239c..dc5d1463155 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -138,7 +138,7 @@ do_blit(struct fd_context *ctx, const struct pipe_blit_info *blit, bool fallback
 
 static bool
 fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc,
-		unsigned level, const struct pipe_box *box)
+		unsigned level, const struct pipe_box *box, uint64_t modifier)
 {
 	struct pipe_context *pctx = &ctx->base;
 	struct pipe_resource *prsc = &rsc->base;
@@ -168,7 +168,8 @@ fd_try_shadow_resource(struct fd_context *ctx, struct fd_resource *rsc,
 		return false;
 
 	struct pipe_resource *pshadow =
-		pctx->screen->resource_create(pctx->screen, prsc);
+		pctx->screen->resource_create_with_modifiers(pctx->screen,
+				prsc, &modifier, 1);
 
 	if (!pshadow)
 		return false;
@@ -582,7 +583,8 @@ fd_resource_transfer_map(struct pipe_context *pctx,
 			/* try shadowing only if it avoids a flush, otherwise staging would
 			 * be better:
 			 */
-			if (needs_flush && fd_try_shadow_resource(ctx, rsc, level, box)) {
+			if (needs_flush && fd_try_shadow_resource(ctx, rsc, level,
+							box, DRM_FORMAT_MOD_LINEAR)) {
 				needs_flush = busy = false;
 				rebind_resource(ctx, prsc);
 				ctx->stats.shadow_uploads++;




More information about the mesa-commit mailing list