aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/a5xx
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2020-07-07 18:27:32 -0400
committerMarge Bot <[email protected]>2020-07-08 20:46:08 +0000
commit979e7e3680792dc23d434295edd10b161af8aee3 (patch)
tree3a04deaed74d2a95215e05c8c8ccb00884e05f1b /src/gallium/drivers/freedreno/a5xx
parent4b290b759a8c85c7d493f1ddd7d38b322bbe1276 (diff)
freedreno/layout: layout simplifications and pitch from level 0 pitch
This updates a3xx/a4xx/a5xx to fix the fetchsize to "PITCHALIGN" (called "MINLINEOFFSET" by the a3xx docs), and some simplifications to make things more like a6xx. Also similar simplifications for a2xx layout code. The pitch can always be determined using a simple calculation from the base level pitch, so don't pre-calculate a pitch for each mipmap level. Signed-off-by: Jonathan Marek <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5796>
Diffstat (limited to 'src/gallium/drivers/freedreno/a5xx')
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_format.c25
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_format.h1
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_image.c5
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_texture.c3
4 files changed, 2 insertions, 32 deletions
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_format.c b/src/gallium/drivers/freedreno/a5xx/fd5_format.c
index a201b64402f..f5a17cebb8b 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_format.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_format.c
@@ -372,31 +372,6 @@ fd5_pipe2swap(enum pipe_format format)
return formats[format].swap;
}
-// XXX possibly same as a4xx..
-enum a5xx_tex_fetchsize
-fd5_pipe2fetchsize(enum pipe_format format)
-{
- if (format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT)
- format = PIPE_FORMAT_Z32_FLOAT;
-
- if (util_format_description(format)->layout == UTIL_FORMAT_LAYOUT_ASTC)
- return TFETCH5_16_BYTE;
-
- switch (util_format_get_blocksizebits(format) / util_format_get_blockwidth(format)) {
- case 8: return TFETCH5_1_BYTE;
- case 16: return TFETCH5_2_BYTE;
- case 32: return TFETCH5_4_BYTE;
- case 64: return TFETCH5_8_BYTE;
- case 96: return TFETCH5_1_BYTE; /* Does this matter? */
- case 128: return TFETCH5_16_BYTE;
- default:
- debug_printf("Unknown block size for format %s: %d\n",
- util_format_name(format),
- util_format_get_blocksizebits(format));
- return TFETCH5_1_BYTE;
- }
-}
-
enum a5xx_depth_format
fd5_pipe2depth(enum pipe_format format)
{
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_format.h b/src/gallium/drivers/freedreno/a5xx/fd5_format.h
index b052aa52960..f662455ef65 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_format.h
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_format.h
@@ -35,7 +35,6 @@ enum a5xx_vtx_fmt fd5_pipe2vtx(enum pipe_format format);
enum a5xx_tex_fmt fd5_pipe2tex(enum pipe_format format);
enum a5xx_color_fmt fd5_pipe2color(enum pipe_format format);
enum a3xx_color_swap fd5_pipe2swap(enum pipe_format format);
-enum a5xx_tex_fetchsize fd5_pipe2fetchsize(enum pipe_format format);
enum a5xx_depth_format fd5_pipe2depth(enum pipe_format format);
uint32_t fd5_tex_swiz(enum pipe_format format, unsigned swizzle_r,
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_image.c b/src/gallium/drivers/freedreno/a5xx/fd5_image.c
index d49215ee55e..8badf74f928 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_image.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_image.c
@@ -44,7 +44,6 @@ static enum a4xx_state_block imgsb[] = {
struct fd5_image {
enum pipe_format pfmt;
enum a5xx_tex_fmt fmt;
- enum a5xx_tex_fetchsize fetchsize;
enum a5xx_tex_type type;
bool srgb;
uint32_t cpp;
@@ -71,7 +70,6 @@ static void translate_image(struct fd5_image *img, struct pipe_image_view *pimg)
img->pfmt = format;
img->fmt = fd5_pipe2tex(format);
- img->fetchsize = fd5_pipe2fetchsize(format);
img->type = fd5_tex_type(prsc->target);
img->srgb = util_format_is_srgb(format);
img->cpp = rsc->layout.cpp;
@@ -138,8 +136,7 @@ static void emit_image_tex(struct fd_ringbuffer *ring, unsigned slot,
COND(img->srgb, A5XX_TEX_CONST_0_SRGB));
OUT_RING(ring, A5XX_TEX_CONST_1_WIDTH(img->width) |
A5XX_TEX_CONST_1_HEIGHT(img->height));
- OUT_RING(ring, A5XX_TEX_CONST_2_FETCHSIZE(img->fetchsize) |
- A5XX_TEX_CONST_2_TYPE(img->type) |
+ OUT_RING(ring, A5XX_TEX_CONST_2_TYPE(img->type) |
A5XX_TEX_CONST_2_PITCH(img->pitch));
OUT_RING(ring, A5XX_TEX_CONST_3_ARRAY_PITCH(img->array_pitch));
if (img->bo) {
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_texture.c b/src/gallium/drivers/freedreno/a5xx/fd5_texture.c
index f411cffc1c7..84e66d504ab 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_texture.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_texture.c
@@ -257,7 +257,6 @@ fd5_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
A5XX_TEX_CONST_1_WIDTH(elements) |
A5XX_TEX_CONST_1_HEIGHT(1);
so->texconst2 =
- A5XX_TEX_CONST_2_FETCHSIZE(fd5_pipe2fetchsize(format)) |
A5XX_TEX_CONST_2_PITCH(elements * rsc->layout.cpp);
so->offset = cso->u.buf.offset;
} else {
@@ -272,7 +271,7 @@ fd5_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc,
A5XX_TEX_CONST_1_WIDTH(u_minify(prsc->width0, lvl)) |
A5XX_TEX_CONST_1_HEIGHT(u_minify(prsc->height0, lvl));
so->texconst2 =
- A5XX_TEX_CONST_2_FETCHSIZE(fd5_pipe2fetchsize(format)) |
+ A5XX_TEX_CONST_2_PITCHALIGN(rsc->layout.pitchalign - 6) |
A5XX_TEX_CONST_2_PITCH(fd_resource_pitch(rsc, lvl));
so->offset = fd_resource_offset(rsc, lvl, cso->u.tex.first_layer);
}