summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a3xx
diff options
context:
space:
mode:
authorKhaled Emara <[email protected]>2019-08-25 23:39:02 +0200
committerRob Clark <[email protected]>2019-08-30 08:54:30 -0700
commited1954ced38be473b64cefd5dc31e372601dfdc1 (patch)
treee47e7d400f25a5515fa7ca17d3d0e1793bc8e31f /src/gallium/drivers/freedreno/a3xx
parent8de25ecd6b493c67f96d1f123535311964ba302e (diff)
freedreno/a3xx: fix texture tiling parameters
* Fix 2D/2DArray/3D tiling parameters: There is a bottom threshold for width and height. * Renable tiling for Cubemap, after setting the right parameters. Reviewed-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/a3xx')
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_resource.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_resource.c b/src/gallium/drivers/freedreno/a3xx/fd3_resource.c
index 5bde52c62be..4f8e195f199 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_resource.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_resource.c
@@ -41,16 +41,30 @@ setup_slices(struct fd_resource *rsc, uint32_t alignment, enum pipe_format forma
uint32_t blocks;
if (rsc->tile_mode) {
- width = util_next_power_of_two(width);
- height = util_next_power_of_two(height);
- uint32_t tpitch = width * rsc->cpp;
- slice->pitch = (tpitch > 32) ? tpitch : 32;
+ if (prsc->target != PIPE_TEXTURE_CUBE) {
+ if (level == 0) {
+ width = util_next_power_of_two(width);
+ height = util_next_power_of_two(height);
+ }
+ width = MAX2(width, 8);
+ height = MAX2(height, 4);
+ // Multiplying by 4 is the result of the 4x4 tiling pattern.
+ slice->pitch = width * 4;
+ blocks = util_format_get_nblocks(format, width, height);
+ } else {
+ uint32_t twidth, theight;
+ twidth = align(width, 8);
+ theight = align(height, 4);
+ // Multiplying by 4 is the result of the 4x4 tiling pattern.
+ slice->pitch = twidth * 4;
+ blocks = util_format_get_nblocks(format, twidth, theight);
+ }
} else {
slice->pitch = width = align(width, pitchalign);
+ blocks = util_format_get_nblocks(format, slice->pitch, height);
}
slice->offset = size;
- blocks = util_format_get_nblocks(format, slice->pitch, height);
/* 1d array and 2d array textures must all have the same layer size
* for each miplevel on a3xx. 3d textures can have different layer
* sizes for high levels, but the hw auto-sizer is buggy (or at least
@@ -96,16 +110,13 @@ fd3_setup_slices(struct fd_resource *rsc)
}
static bool
-ok_format(enum pipe_format pfmt, const struct pipe_resource * tmpl)
+ok_format(enum pipe_format pfmt)
{
enum a3xx_color_fmt fmt = fd3_pipe2color(pfmt);
if (fmt == ~0)
return false;
- if (tmpl->target == PIPE_TEXTURE_CUBE)
- return false;
-
switch (pfmt) {
case PIPE_FORMAT_R8_UINT:
case PIPE_FORMAT_R8_SINT:
@@ -121,7 +132,7 @@ ok_format(enum pipe_format pfmt, const struct pipe_resource * tmpl)
unsigned
fd3_tile_mode(const struct pipe_resource *tmpl)
{
- if (ok_format(tmpl->format, tmpl))
+ if (ok_format(tmpl->format))
return TILE_4X4;
return LINEAR;
}