asahi: Use the internal format internally

Confusingly, after creation rsrc->base.format will contain the external
format due to u_transfer_helper quirks. For our internal use, we need to
look at the internal format, rsrc->layout.format. With the new layout
code, the rsrc->internal_format property is redundant, so we delete
that to reduce confusion.

Fixes dEQP-GLES3.functional.texture.format.sized.2d.depth32f_stencil8_*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18623>
This commit is contained in:
Alyssa Rosenzweig 2022-08-18 22:48:12 -04:00
parent dc05b042ab
commit 22de011675
3 changed files with 9 additions and 9 deletions

View file

@ -167,7 +167,6 @@ agx_resource_create(struct pipe_screen *screen,
nresource->modifier = agx_select_modifier(nresource);
nresource->mipmapped = (templ->last_level > 0);
nresource->internal_format = nresource->base.format;
assert(templ->format != PIPE_FORMAT_Z24X8_UNORM &&
templ->format != PIPE_FORMAT_Z24_UNORM_S8_UINT &&
@ -286,10 +285,10 @@ agx_transfer_map(struct pipe_context *pctx,
if (rsrc->modifier == DRM_FORMAT_MOD_APPLE_TWIDDLED) {
transfer->base.stride =
util_format_get_stride(resource->format, box->width);
util_format_get_stride(rsrc->layout.format, box->width);
transfer->base.layer_stride =
util_format_get_2d_size(resource->format, transfer->base.stride,
util_format_get_2d_size(rsrc->layout.format, transfer->base.stride,
box->height);
transfer->map = calloc(transfer->base.layer_stride, box->depth);
@ -1143,7 +1142,7 @@ agx_resource_get_stencil(struct pipe_resource *prsrc)
static enum pipe_format
agx_resource_get_internal_format(struct pipe_resource *prsrc)
{
return agx_resource(prsrc)->internal_format;
return agx_resource(prsrc)->layout.format;
}
static const struct u_transfer_vtbl transfer_vtbl = {

View file

@ -294,9 +294,6 @@ struct agx_resource {
* resources.
*/
struct agx_resource *separate_stencil;
/* Internal format, since many depth/stencil formats are emulated. */
enum pipe_format internal_format;
};
static inline struct agx_resource *

View file

@ -116,7 +116,7 @@ asahi_pack_iogpu_attachment(void *out, struct agx_resource *rsrc,
assert(surf->u.tex.first_layer == surf->u.tex.last_layer);
agx_pack(out, IOGPU_ATTACHMENT, cfg) {
cfg.type = asahi_classify_attachment(rsrc->base.format);
cfg.type = asahi_classify_attachment(rsrc->layout.format);
cfg.address = agx_map_surface_resource(surf, rsrc);
cfg.size = rsrc->layout.size_B;
cfg.percent = (100 * cfg.size) / total_size;
@ -205,7 +205,11 @@ demo_cmdbuf(uint64_t *buf, size_t size,
if (framebuffer->zsbuf) {
struct pipe_surface *zsbuf = framebuffer->zsbuf;
const struct util_format_description *desc =
util_format_description(zsbuf->texture->format);
util_format_description(agx_resource(zsbuf->texture)->layout.format);
assert(desc->format == PIPE_FORMAT_Z32_FLOAT ||
desc->format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT ||
desc->format == PIPE_FORMAT_S8_UINT);
cfg.depth_width = framebuffer->width;
cfg.depth_height = framebuffer->height;