asahi: Track mipmap state explicitly

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14903>
This commit is contained in:
Alyssa Rosenzweig 2022-02-06 10:07:40 -05:00 committed by Marge Bot
parent e714fae263
commit 204e2ffe1b
3 changed files with 11 additions and 0 deletions

View file

@ -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);

View file

@ -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;
};
}

View file

@ -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;