diff options
author | Marek Olšák <[email protected]> | 2016-10-26 18:12:07 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2016-11-01 22:33:13 +0100 |
commit | c66a550385b4937b2aaba8484aeaa41cf77399b7 (patch) | |
tree | b19b98f0a8a5bddb04da66fb8ea5bcb6d5c066a5 /src | |
parent | 692f2640ab0c4c923a5ba12ff8526d2d1a3eefb1 (diff) |
gallium/radeon: don't call u_format helpers if we have that info already
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_blit.c | 5 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 46281cbd0e5..364ed4078cd 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -53,8 +53,7 @@ bool r600_prepare_for_dma_blit(struct r600_common_context *rctx, if (!rctx->dma.cs) return false; - if (util_format_get_blocksizebits(rdst->resource.b.b.format) != - util_format_get_blocksizebits(rsrc->resource.b.b.format)) + if (rdst->surface.bpe != rsrc->surface.bpe) return false; /* MSAA: Blits don't exist in the real world. */ @@ -181,12 +180,10 @@ static void r600_copy_from_staging_texture(struct pipe_context *ctx, struct r600 static unsigned r600_texture_get_offset(struct r600_texture *rtex, unsigned level, const struct pipe_box *box) { - enum pipe_format format = rtex->resource.b.b.format; - return rtex->surface.level[level].offset + box->z * rtex->surface.level[level].slice_size + - box->y / util_format_get_blockheight(format) * rtex->surface.level[level].pitch_bytes + - box->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); + box->y / rtex->surface.blk_h * rtex->surface.level[level].pitch_bytes + + box->x / rtex->surface.blk_w * rtex->surface.bpe; } static int r600_init_surface(struct r600_common_screen *rscreen, @@ -2195,7 +2192,7 @@ static void evergreen_set_clear_color(struct r600_texture *rtex, memset(&uc, 0, sizeof(uc)); - if (util_format_get_blocksizebits(surface_format) == 128) { + if (rtex->surface.bpe == 16) { /* DCC fast clear only: * CLEAR_WORD0 = R = G = B * CLEAR_WORD1 = A @@ -2502,7 +2499,7 @@ void evergreen_do_fast_color_clear(struct r600_common_context *rctx, tex->separate_dcc_dirty = true; } else { /* 128-bit formats are unusupported */ - if (util_format_get_blocksizebits(fb->cbufs[i]->format) > 64) { + if (tex->surface.bpe > 8) { continue; } diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c index 0f46d71ddaf..fe17f739242 100644 --- a/src/gallium/drivers/radeonsi/si_blit.c +++ b/src/gallium/drivers/radeonsi/si_blit.c @@ -838,6 +838,7 @@ void si_resource_copy_region(struct pipe_context *ctx, const struct pipe_box *src_box) { struct si_context *sctx = (struct si_context *)ctx; + struct r600_texture *rsrc = (struct r600_texture*)src; struct pipe_surface *dst_view, dst_templ; struct pipe_sampler_view src_templ, *src_view; unsigned dst_width, dst_height, src_width0, src_height0; @@ -867,7 +868,7 @@ void si_resource_copy_region(struct pipe_context *ctx, if (util_format_is_compressed(src->format) || util_format_is_compressed(dst->format)) { - unsigned blocksize = util_format_get_blocksize(src->format); + unsigned blocksize = rsrc->surface.bpe; if (blocksize == 8) src_templ.format = PIPE_FORMAT_R16G16B16A16_UINT; /* 64-bit block */ @@ -909,7 +910,7 @@ void si_resource_copy_region(struct pipe_context *ctx, sbox.width = util_format_get_nblocksx(src->format, src_box->width); src_box = &sbox; } else { - unsigned blocksize = util_format_get_blocksize(src->format); + unsigned blocksize = rsrc->surface.bpe; switch (blocksize) { case 1: |