diff options
Diffstat (limited to 'src/gallium/drivers/freedreno/a4xx/fd4_emit.c')
-rw-r--r-- | src/gallium/drivers/freedreno/a4xx/fd4_emit.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c index 00e985d27e5..7d602fc6c92 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c @@ -131,16 +131,8 @@ emit_textures(struct fd_context *ctx, struct fd_ringbuffer *ring, [SB_FRAG_TEX] = REG_A4XX_TPL1_TP_FS_BORDER_COLOR_BASE_ADDR, }; struct fd4_context *fd4_ctx = fd4_context(ctx); - unsigned i, off; - void *ptr; - - u_upload_alloc(fd4_ctx->border_color_uploader, - 0, BORDER_COLOR_UPLOAD_SIZE, - BORDER_COLOR_UPLOAD_SIZE, &off, - &fd4_ctx->border_color_buf, - &ptr); - - fd_setup_border_colors(tex, ptr, 0); + bool needs_border = false; + unsigned i; if (tex->num_samplers > 0) { int num_samplers; @@ -166,6 +158,8 @@ emit_textures(struct fd_context *ctx, struct fd_ringbuffer *ring, &dummy_sampler; OUT_RING(ring, sampler->texsamp0); OUT_RING(ring, sampler->texsamp1); + + needs_border |= sampler->needs_border; } for (; i < num_samplers; i++) { @@ -235,10 +229,22 @@ emit_textures(struct fd_context *ctx, struct fd_ringbuffer *ring, debug_assert(v->astc_srgb.count == 0); } - OUT_PKT0(ring, bcolor_reg[sb], 1); - OUT_RELOC(ring, fd_resource(fd4_ctx->border_color_buf)->bo, off, 0, 0); + if (needs_border) { + unsigned off; + void *ptr; - u_upload_unmap(fd4_ctx->border_color_uploader); + u_upload_alloc(fd4_ctx->border_color_uploader, + 0, BORDER_COLOR_UPLOAD_SIZE, + BORDER_COLOR_UPLOAD_SIZE, &off, + &fd4_ctx->border_color_buf, + &ptr); + + fd_setup_border_colors(tex, ptr, 0); + OUT_PKT0(ring, bcolor_reg[sb], 1); + OUT_RELOC(ring, fd_resource(fd4_ctx->border_color_buf)->bo, off, 0, 0); + + u_upload_unmap(fd4_ctx->border_color_uploader); + } } /* emit texture state for mem->gmem restore operation.. eventually it would |