From: Eric Anholt Date: Wed, 20 Nov 2019 20:40:25 +0000 (-0800) Subject: freedreno: Convert the slice struct to the new resource header. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2e62a622e78d2268fb123e2551690ef9749ef055;p=mesa.git freedreno: Convert the slice struct to the new resource header. This gets the worst of the sed required for shared resource layout out of the way. The texture layout comment is dropped now that we're referencing the shared header, which has a more complete description. Acked-by: Rob Clark --- diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c b/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c index bf112149b03..23188af9386 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c @@ -89,8 +89,7 @@ emit_gmem2mem_surf(struct fd_batch *batch, uint32_t base, { struct fd_ringbuffer *ring = batch->tile_fini; struct fd_resource *rsc = fd_resource(psurf->texture); - struct fd_resource_slice *slice = - fd_resource_slice(rsc, psurf->u.tex.level); + struct fdl_slice *slice = fd_resource_slice(rsc, psurf->u.tex.level); uint32_t offset = fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer); enum pipe_format format = fd_gmem_restore_format(psurf->format); @@ -230,8 +229,7 @@ emit_mem2gmem_surf(struct fd_batch *batch, uint32_t base, { struct fd_ringbuffer *ring = batch->gmem; struct fd_resource *rsc = fd_resource(psurf->texture); - struct fd_resource_slice *slice = - fd_resource_slice(rsc, psurf->u.tex.level); + struct fdl_slice *slice = fd_resource_slice(rsc, psurf->u.tex.level); uint32_t offset = fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer); enum pipe_format format = fd_gmem_restore_format(psurf->format); @@ -437,8 +435,7 @@ fd2_emit_sysmem_prep(struct fd_batch *batch) return; struct fd_resource *rsc = fd_resource(psurf->texture); - struct fd_resource_slice *slice = - fd_resource_slice(rsc, psurf->u.tex.level); + struct fdl_slice *slice = fd_resource_slice(rsc, psurf->u.tex.level); uint32_t offset = fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer); diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_resource.c b/src/gallium/drivers/freedreno/a2xx/fd2_resource.c index 27e9500ff88..cccbccf5bd1 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_resource.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_resource.c @@ -37,7 +37,7 @@ fd2_setup_slices(struct fd_resource *rsc) uint32_t depth = prsc->depth0; for (level = 0; level <= prsc->last_level; level++) { - struct fd_resource_slice *slice = fd_resource_slice(rsc, level); + struct fdl_slice *slice = fd_resource_slice(rsc, level); uint32_t blocks; /* 32 * 32 block alignment */ diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c index 3fc43e3c4e8..a2bd72e9efe 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c @@ -181,7 +181,7 @@ fd2_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, so->base.reference.count = 1; so->base.context = pctx; - struct fd_resource_slice *slice0 = fd_resource_slice(rsc, 0); + struct fdl_slice *slice0 = fd_resource_slice(rsc, 0); so->tex0 = A2XX_SQ_TEX_0_SIGN_X(fmt.sign) | A2XX_SQ_TEX_0_SIGN_Y(fmt.sign) | diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index 1c96eff1ad7..715b4374618 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -215,8 +215,7 @@ emit_textures(struct fd_context *ctx, struct fd_ringbuffer *ring, unsigned end = fd_sampler_last_level(&view->base); for (j = 0; j < (end - start + 1); j++) { - struct fd_resource_slice *slice = - fd_resource_slice(rsc, j + start); + struct fdl_slice *slice = fd_resource_slice(rsc, j + start); OUT_RELOC(ring, rsc->bo, slice->offset, 0, 0); } } @@ -311,7 +310,7 @@ fd3_emit_gmem_restore_tex(struct fd_ringbuffer *ring, /* note: PIPE_BUFFER disallowed for surfaces */ unsigned lvl = psurf[i]->u.tex.level; - struct fd_resource_slice *slice = fd_resource_slice(rsc, lvl); + struct fdl_slice *slice = fd_resource_slice(rsc, lvl); debug_assert(psurf[i]->u.tex.first_layer == psurf[i]->u.tex.last_layer); diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c index 20094431076..d30915bdc70 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c @@ -55,7 +55,7 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs, enum a3xx_color_swap swap = WZYX; bool srgb = false; struct fd_resource *rsc = NULL; - struct fd_resource_slice *slice = NULL; + struct fdl_slice *slice = NULL; uint32_t stride = 0; uint32_t base = 0; uint32_t offset = 0; @@ -330,7 +330,7 @@ emit_gmem2mem_surf(struct fd_batch *batch, format = rsc->base.format; } - struct fd_resource_slice *slice = fd_resource_slice(rsc, psurf->u.tex.level); + struct fdl_slice *slice = fd_resource_slice(rsc, psurf->u.tex.level); uint32_t offset = fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer); @@ -738,7 +738,7 @@ fd3_emit_sysmem_prep(struct fd_batch *batch) struct pipe_surface *psurf = pfb->cbufs[i]; if (!psurf) continue; - struct fd_resource_slice *slice = + struct fdl_slice *slice = fd_resource_slice(fd_resource(psurf->texture), psurf->u.tex.level); pitch = slice->pitch; diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_resource.c b/src/gallium/drivers/freedreno/a3xx/fd3_resource.c index 7fce61be99b..b29c846e3b0 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_resource.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_resource.c @@ -37,7 +37,7 @@ setup_slices(struct fd_resource *rsc, uint32_t alignment, enum pipe_format forma uint32_t depth = prsc->depth0; for (level = 0; level <= prsc->last_level; level++) { - struct fd_resource_slice *slice = fd_resource_slice(rsc, level); + struct fdl_slice *slice = fd_resource_slice(rsc, level); uint32_t blocks; if (rsc->tile_mode) { diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c index 3abdc1677c4..e65adba3c59 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c @@ -263,7 +263,7 @@ fd3_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, A3XX_TEX_CONST_1_HEIGHT(u_minify(prsc->height0, lvl)); } /* when emitted, A3XX_TEX_CONST_2_INDX() must be OR'd in: */ - struct fd_resource_slice *slice = fd_resource_slice(rsc, lvl); + struct fdl_slice *slice = fd_resource_slice(rsc, lvl); so->texconst2 = A3XX_TEX_CONST_2_PITCH(fd3_pipe2nblocksx(cso->format, slice->pitch) * rsc->cpp); switch (prsc->target) { diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c index 0bf38924fb7..0422ceaee69 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.c @@ -301,7 +301,7 @@ fd4_emit_gmem_restore_tex(struct fd_ringbuffer *ring, unsigned nr_bufs, /* note: PIPE_BUFFER disallowed for surfaces */ unsigned lvl = bufs[i]->u.tex.level; - struct fd_resource_slice *slice = fd_resource_slice(rsc, lvl); + struct fdl_slice *slice = fd_resource_slice(rsc, lvl); unsigned offset = fd_resource_offset(rsc, lvl, bufs[i]->u.tex.first_layer); /* z32 restore is accomplished using depth write. If there is diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c b/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c index 947a2f0b12b..510ebb89044 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_gmem.c @@ -61,7 +61,7 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs, enum a3xx_color_swap swap = WZYX; bool srgb = false; struct fd_resource *rsc = NULL; - struct fd_resource_slice *slice = NULL; + struct fdl_slice *slice = NULL; uint32_t stride = 0; uint32_t base = 0; uint32_t offset = 0; @@ -152,7 +152,7 @@ emit_gmem2mem_surf(struct fd_batch *batch, bool stencil, struct fd_ringbuffer *ring = batch->gmem; struct fd_resource *rsc = fd_resource(psurf->texture); enum pipe_format pformat = psurf->format; - struct fd_resource_slice *slice; + struct fdl_slice *slice; uint32_t offset; if (!rsc->valid) diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c index d67e4da9053..69f4d45a181 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c @@ -222,7 +222,7 @@ fd4_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, { struct fd4_pipe_sampler_view *so = CALLOC_STRUCT(fd4_pipe_sampler_view); struct fd_resource *rsc = fd_resource(prsc); - struct fd_resource_slice *slice = NULL; + struct fdl_slice *slice = NULL; enum pipe_format format = cso->format; unsigned lvl, layers = 0; diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c b/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c index c3db9b983cd..bb02079b1d4 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c @@ -325,7 +325,7 @@ emit_blit(struct fd_ringbuffer *ring, const struct pipe_blit_info *info) const struct pipe_box *sbox = &info->src.box; const struct pipe_box *dbox = &info->dst.box; struct fd_resource *src, *dst; - struct fd_resource_slice *sslice, *dslice; + struct fdl_slice *sslice, *dslice; enum a5xx_color_fmt sfmt, dfmt; enum a5xx_tile_mode stile, dtile; enum a3xx_color_swap sswap, dswap; diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_gmem.c b/src/gallium/drivers/freedreno/a5xx/fd5_gmem.c index 12b00b80f26..5b8bfb650c7 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_gmem.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_gmem.c @@ -54,7 +54,7 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs, enum a3xx_color_swap swap = WZYX; bool srgb = false, sint = false, uint = false; struct fd_resource *rsc = NULL; - struct fd_resource_slice *slice = NULL; + struct fdl_slice *slice = NULL; uint32_t stride = 0; uint32_t size = 0; uint32_t base = 0; @@ -144,7 +144,7 @@ emit_zs(struct fd_ringbuffer *ring, struct pipe_surface *zsbuf, stride = cpp * gmem->bin_w; size = stride * gmem->bin_h; } else { - struct fd_resource_slice *slice = fd_resource_slice(rsc, 0); + struct fdl_slice *slice = fd_resource_slice(rsc, 0); stride = slice->pitch * rsc->cpp; size = slice->size0; } @@ -191,7 +191,7 @@ emit_zs(struct fd_ringbuffer *ring, struct pipe_surface *zsbuf, stride = 1 * gmem->bin_w; size = stride * gmem->bin_h; } else { - struct fd_resource_slice *slice = fd_resource_slice(rsc->stencil, 0); + struct fdl_slice *slice = fd_resource_slice(rsc->stencil, 0); stride = slice->pitch * rsc->cpp; size = slice->size0; } @@ -484,7 +484,7 @@ emit_mem2gmem_surf(struct fd_batch *batch, uint32_t base, // possibly we want to flip this around gmem2mem and keep depth // tiled in sysmem (and fixup sampler state to assume tiled).. this // might be required for doing depth/stencil in bypass mode? - struct fd_resource_slice *slice = fd_resource_slice(rsc, 0); + struct fdl_slice *slice = fd_resource_slice(rsc, 0); enum a5xx_color_fmt format = fd5_pipe2color(fd_gmem_restore_format(rsc->base.format)); @@ -609,7 +609,7 @@ emit_gmem2mem_surf(struct fd_batch *batch, uint32_t base, { struct fd_ringbuffer *ring = batch->gmem; struct fd_resource *rsc = fd_resource(psurf->texture); - struct fd_resource_slice *slice; + struct fdl_slice *slice; bool tiled; uint32_t offset; diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_image.c b/src/gallium/drivers/freedreno/a5xx/fd5_image.c index 2f3389072b0..4e1f77a63ad 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_image.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_image.c @@ -62,7 +62,7 @@ static void translate_image(struct fd5_image *img, struct pipe_image_view *pimg) enum pipe_format format = pimg->format; struct pipe_resource *prsc = pimg->resource; struct fd_resource *rsc = fd_resource(prsc); - struct fd_resource_slice *slice = NULL; + struct fdl_slice *slice = NULL; unsigned lvl; if (!pimg->resource) { diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_resource.c b/src/gallium/drivers/freedreno/a5xx/fd5_resource.c index 9b1a4927308..00174b9afe1 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_resource.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_resource.c @@ -63,7 +63,7 @@ setup_slices(struct fd_resource *rsc, uint32_t alignment, enum pipe_format forma heightalign = tile_alignment[rsc->cpp].heightalign; for (level = 0; level <= prsc->last_level; level++) { - struct fd_resource_slice *slice = fd_resource_slice(rsc, level); + struct fdl_slice *slice = fd_resource_slice(rsc, level); uint32_t aligned_height = height; uint32_t blocks; diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_texture.c b/src/gallium/drivers/freedreno/a5xx/fd5_texture.c index 6b341d4b5b8..0a3f2ec68af 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_texture.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_texture.c @@ -198,7 +198,7 @@ fd5_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, { struct fd5_pipe_sampler_view *so = CALLOC_STRUCT(fd5_pipe_sampler_view); struct fd_resource *rsc = fd_resource(prsc); - struct fd_resource_slice *slice = NULL; + struct fdl_slice *slice = NULL; enum pipe_format format = cso->format; unsigned lvl, layers = 0; diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c index bb146ed80e2..9d601d07c95 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c @@ -348,7 +348,7 @@ emit_blit_or_clear_texture(struct fd_context *ctx, struct fd_ringbuffer *ring, const struct pipe_box *sbox = &info->src.box; const struct pipe_box *dbox = &info->dst.box; struct fd_resource *src, *dst; - struct fd_resource_slice *sslice, *dslice; + struct fdl_slice *sslice, *dslice; enum a6xx_color_fmt sfmt, dfmt; enum a6xx_tile_mode stile, dtile; enum a3xx_color_swap sswap, dswap; diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c index 2b2f9b8c66e..34b5643deae 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c @@ -65,7 +65,7 @@ emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb, enum a3xx_color_swap swap = WZYX; bool sint = false, uint = false; struct fd_resource *rsc = NULL; - struct fd_resource_slice *slice = NULL; + struct fdl_slice *slice = NULL; uint32_t stride = 0; uint32_t offset, ubwc_offset; uint32_t tile_mode; @@ -182,7 +182,7 @@ emit_zs(struct fd_ringbuffer *ring, struct pipe_surface *zsbuf, if (zsbuf) { struct fd_resource *rsc = fd_resource(zsbuf->texture); enum a6xx_depth_format fmt = fd6_pipe2depth(zsbuf->format); - struct fd_resource_slice *slice = fd_resource_slice(rsc, 0); + struct fdl_slice *slice = fd_resource_slice(rsc, 0); uint32_t stride = slice->pitch * rsc->cpp; uint32_t size = slice->size0; uint32_t base = gmem ? gmem->zsbuf_base[0] : 0; @@ -238,7 +238,7 @@ emit_zs(struct fd_ringbuffer *ring, struct pipe_surface *zsbuf, OUT_RING(ring, CP_EVENT_WRITE_0_EVENT(UNK_25)); if (rsc->stencil) { - struct fd_resource_slice *slice = fd_resource_slice(rsc->stencil, 0); + struct fdl_slice *slice = fd_resource_slice(rsc->stencil, 0); stride = slice->pitch * rsc->stencil->cpp; size = slice->size0; uint32_t base = gmem ? gmem->zsbuf_base[1] : 0; @@ -966,7 +966,7 @@ emit_blit(struct fd_batch *batch, struct pipe_surface *psurf, bool stencil) { - struct fd_resource_slice *slice; + struct fdl_slice *slice; struct fd_resource *rsc = fd_resource(psurf->texture); enum pipe_format pfmt = psurf->format; uint32_t offset, ubwc_offset; diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_image.c b/src/gallium/drivers/freedreno/a6xx/fd6_image.c index 92dab0f0c9a..8ec50c063a0 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_image.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_image.c @@ -97,7 +97,7 @@ static void translate_image(struct fd6_image *img, const struct pipe_image_view img->buffer = false; unsigned lvl = pimg->u.tex.level; - struct fd_resource_slice *slice = fd_resource_slice(rsc, lvl); + struct fdl_slice *slice = fd_resource_slice(rsc, lvl); unsigned layers = pimg->u.tex.last_layer - pimg->u.tex.first_layer + 1; img->ubwc_offset = fd_resource_ubwc_offset(rsc, lvl, pimg->u.tex.first_layer); diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c index 89cf395b77b..1dd2fa1381e 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c @@ -84,7 +84,7 @@ setup_slices(struct fd_resource *rsc, uint32_t alignment, enum pipe_format forma debug_assert(tile_alignment[ta].pitchalign); for (level = 0; level <= prsc->last_level; level++) { - struct fd_resource_slice *slice = fd_resource_slice(rsc, level); + struct fdl_slice *slice = fd_resource_slice(rsc, level); uint32_t tile_mode = fd_resource_tile_mode(prsc, level); uint32_t width, height; diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c index f0565125dfc..5bde6abc1e5 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c @@ -220,7 +220,7 @@ fd6_sampler_view_create(struct pipe_context *pctx, struct pipe_resource *prsc, { struct fd6_pipe_sampler_view *so = CALLOC_STRUCT(fd6_pipe_sampler_view); struct fd_resource *rsc = fd_resource(prsc); - struct fd_resource_slice *slice = NULL; + struct fdl_slice *slice = NULL; enum pipe_format format = cso->format; unsigned lvl, layers = 0; diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index dbb84b11dbc..0044b9804b3 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -506,7 +506,7 @@ fd_resource_transfer_map(struct pipe_context *pctx, { struct fd_context *ctx = fd_context(pctx); struct fd_resource *rsc = fd_resource(prsc); - struct fd_resource_slice *slice = fd_resource_slice(rsc, level); + struct fdl_slice *slice = fd_resource_slice(rsc, level); struct fd_transfer *trans; struct pipe_transfer *ptrans; enum pipe_format format = prsc->format; @@ -544,7 +544,7 @@ fd_resource_transfer_map(struct pipe_context *pctx, staging_rsc = fd_alloc_staging(ctx, rsc, level, box); if (staging_rsc) { - struct fd_resource_slice *staging_slice = + struct fdl_slice *staging_slice = fd_resource_slice(staging_rsc, 0); // TODO for PIPE_TRANSFER_READ, need to do untiling blit.. trans->staging_prsc = &staging_rsc->base; @@ -661,7 +661,7 @@ fd_resource_transfer_map(struct pipe_context *pctx, */ staging_rsc = fd_alloc_staging(ctx, rsc, level, box); if (staging_rsc) { - struct fd_resource_slice *staging_slice = + struct fdl_slice *staging_slice = fd_resource_slice(staging_rsc, 0); trans->staging_prsc = &staging_rsc->base; trans->base.stride = util_format_get_nblocksx(format, @@ -782,7 +782,7 @@ setup_slices(struct fd_resource *rsc, uint32_t alignment, enum pipe_format forma uint32_t layers_in_level = rsc->layer_first ? 1 : prsc->array_size; for (level = 0; level <= prsc->last_level; level++) { - struct fd_resource_slice *slice = fd_resource_slice(rsc, level); + struct fdl_slice *slice = fd_resource_slice(rsc, level); uint32_t blocks; if (layout == UTIL_FORMAT_LAYOUT_ASTC) @@ -1093,7 +1093,7 @@ fd_resource_from_handle(struct pipe_screen *pscreen, { struct fd_screen *screen = fd_screen(pscreen); struct fd_resource *rsc = CALLOC_STRUCT(fd_resource); - struct fd_resource_slice *slice = fd_resource_slice(rsc, 0); + struct fdl_slice *slice = fd_resource_slice(rsc, 0); struct pipe_resource *prsc = &rsc->base; uint32_t pitchalign = fd_screen(pscreen)->gmem_alignw; diff --git a/src/gallium/drivers/freedreno/freedreno_resource.h b/src/gallium/drivers/freedreno/freedreno_resource.h index 14c06ded44c..d019727bf31 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.h +++ b/src/gallium/drivers/freedreno/freedreno_resource.h @@ -33,31 +33,7 @@ #include "freedreno_batch.h" #include "freedreno_util.h" - -/* Texture Layout on a3xx: - * - * Each mipmap-level contains all of it's layers (ie. all cubmap - * faces, all 1d/2d array elements, etc). The texture sampler is - * programmed with the start address of each mipmap level, and hw - * derives the layer offset within the level. - * - * Texture Layout on a4xx+: - * - * For cubemap and 2d array, each layer contains all of it's mipmap - * levels (layer_first layout). - * - * 3d textures are layed out as on a3xx, but unknown about 3d-array - * textures. - * - * In either case, the slice represents the per-miplevel information, - * but in layer_first layout it only includes the first layer, and - * an additional offset of (rsc->layer_size * layer) must be added. - */ -struct fd_resource_slice { - uint32_t offset; /* offset of first layer in slice */ - uint32_t pitch; - uint32_t size0; /* size of first layer in slice */ -}; +#include "freedreno/fdl/freedreno_layout.h" struct fd_resource { struct pipe_resource base; @@ -66,7 +42,7 @@ struct fd_resource { enum pipe_format internal_format; bool layer_first; /* see above description */ uint32_t layer_size; - struct fd_resource_slice slices[MAX_MIP_LEVELS]; + struct fdl_slice slices[MAX_MIP_LEVELS]; /* buffer range that has been initialized */ struct util_range valid_buffer_range; bool valid; @@ -149,7 +125,7 @@ fd_transfer(struct pipe_transfer *ptrans) return (struct fd_transfer *)ptrans; } -static inline struct fd_resource_slice * +static inline struct fdl_slice * fd_resource_slice(struct fd_resource *rsc, unsigned level) { assert(level <= rsc->base.last_level); @@ -169,7 +145,7 @@ fd_resource_layer_stride(struct fd_resource *rsc, unsigned level) static inline uint32_t fd_resource_offset(struct fd_resource *rsc, unsigned level, unsigned layer) { - struct fd_resource_slice *slice = fd_resource_slice(rsc, level); + struct fdl_slice *slice = fd_resource_slice(rsc, level); unsigned offset = slice->offset; offset += fd_resource_layer_stride(rsc, level) * layer; debug_assert(offset < fd_bo_size(rsc->bo)); diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c index db2e375228c..a9eb189d1f2 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c @@ -343,7 +343,7 @@ ir3_emit_image_dims(struct fd_screen *screen, const struct ir3_shader_variant *v dims[off + 0] = util_format_get_blocksize(img->format); if (img->resource->target != PIPE_BUFFER) { - struct fd_resource_slice *slice = + struct fdl_slice *slice = fd_resource_slice(rsc, img->u.tex.level); /* note for 2d/cube/etc images, even if re-interpreted * as a different color format, the pixel size should