summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>2022-02-06 10:07:40 -0500
committerMarge Bot <emma+marge@anholt.net>2022-02-18 23:48:32 +0000
commit204e2ffe1bce4ef81605ae443e7c39cc13b82dd0 (patch)
tree72e305855283dbb859ad766f597748960c6a19f8
parente714fae2633e7a72d3312f3151613b032b4f79ea (diff)
asahi: Track mipmap state explicitly
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14903>
-rw-r--r--src/gallium/drivers/asahi/agx_pipe.c1
-rw-r--r--src/gallium/drivers/asahi/agx_state.c5
-rw-r--r--src/gallium/drivers/asahi/agx_state.h5
3 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c
index f0956891188..76b90b7bd38 100644
--- a/src/gallium/drivers/asahi/agx_pipe.c
+++ b/src/gallium/drivers/asahi/agx_pipe.c
@@ -163,6 +163,7 @@ agx_resource_create(struct pipe_screen *screen,
nresource->base.screen = screen;
nresource->modifier = agx_select_modifier(nresource);
+ nresource->mipmapped = (templ->last_level > 0);
unsigned offset = 0;
unsigned blocksize = util_format_get_blocksize(templ->format);
diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c
index 724ceb79977..5e9d0655e60 100644
--- a/src/gallium/drivers/asahi/agx_state.c
+++ b/src/gallium/drivers/asahi/agx_state.c
@@ -477,6 +477,7 @@ agx_create_sampler_view(struct pipe_context *pctx,
cfg.levels = state->u.tex.last_level - level + 1;
cfg.srgb = (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB);
cfg.address = rsrc->bo->ptr.gpu + rsrc->slices[level].offset;
+ cfg.unk_mipmapped = rsrc->mipmapped;
cfg.unk_2 = false;
cfg.stride = (rsrc->modifier == DRM_FORMAT_MOD_LINEAR) ?
@@ -741,8 +742,12 @@ agx_set_framebuffer_state(struct pipe_context *pctx,
cfg.level = surf->u.tex.level;
cfg.buffer = tex->bo->ptr.gpu;
+ if (tex->mipmapped)
+ cfg.unk_55 = 0x8;
+
cfg.stride = (tex->modifier == DRM_FORMAT_MOD_LINEAR) ?
(tex->slices[level].line_stride - 4) :
+ tex->mipmapped ? AGX_RT_STRIDE_TILED_MIPMAPPED :
AGX_RT_STRIDE_TILED;
};
}
diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h
index a4abc0760de..ffb423a9d46 100644
--- a/src/gallium/drivers/asahi/agx_state.h
+++ b/src/gallium/drivers/asahi/agx_state.h
@@ -234,6 +234,11 @@ struct agx_resource {
struct pipe_resource base;
uint64_t modifier;
+ /* Should probably be part of the modifier. Affects the tiling algorithm, or
+ * something like that.
+ */
+ bool mipmapped;
+
/* Hardware backing */
struct agx_bo *bo;