freedreno: Convert the slice struct to the new resource header.
authorEric Anholt <eric@anholt.net>
Wed, 20 Nov 2019 20:40:25 +0000 (12:40 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 26 Nov 2019 18:46:07 +0000 (18:46 +0000)
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 <robdclark@chromium.org>
23 files changed:
src/gallium/drivers/freedreno/a2xx/fd2_gmem.c
src/gallium/drivers/freedreno/a2xx/fd2_resource.c
src/gallium/drivers/freedreno/a2xx/fd2_texture.c
src/gallium/drivers/freedreno/a3xx/fd3_emit.c
src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
src/gallium/drivers/freedreno/a3xx/fd3_resource.c
src/gallium/drivers/freedreno/a3xx/fd3_texture.c
src/gallium/drivers/freedreno/a4xx/fd4_emit.c
src/gallium/drivers/freedreno/a4xx/fd4_gmem.c
src/gallium/drivers/freedreno/a4xx/fd4_texture.c
src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
src/gallium/drivers/freedreno/a5xx/fd5_gmem.c
src/gallium/drivers/freedreno/a5xx/fd5_image.c
src/gallium/drivers/freedreno/a5xx/fd5_resource.c
src/gallium/drivers/freedreno/a5xx/fd5_texture.c
src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
src/gallium/drivers/freedreno/a6xx/fd6_image.c
src/gallium/drivers/freedreno/a6xx/fd6_resource.c
src/gallium/drivers/freedreno/a6xx/fd6_texture.c
src/gallium/drivers/freedreno/freedreno_resource.c
src/gallium/drivers/freedreno/freedreno_resource.h
src/gallium/drivers/freedreno/ir3/ir3_gallium.c

index bf112149b03d317408d36280239ae5c7dc39e939..23188af9386dc8f9981e68c48c8864e2a03a7aac 100644 (file)
@@ -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);
 
index 27e9500ff883ca2e06b5dc7901cfcac36c3548b6..cccbccf5bd1c5a042601a13ce3e074ddfc6ef92c 100644 (file)
@@ -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 */
index 3fc43e3c4e87730e9775730c0975531ddf0dcfee..a2bd72e9efe4ec288762cca30169a365393c8a96 100644 (file)
@@ -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) |
index 1c96eff1ad7a42cca64a78a3b60baefc9f7cd9e5..715b437461830092c2da8256cac9619c263fa82a 100644 (file)
@@ -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);
 
index 20094431076853d700dd6c56dca3381dd291e066..d30915bdc70fd3a652e76e98f04406799a98421a 100644 (file)
@@ -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;
index 7fce61be99bfa37a8889ea860d42bb2fe0c0bdc0..b29c846e3b0e4599d2e50d062078743c7afd6a09 100644 (file)
@@ -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) {
index 3abdc1677c4303e2ae9ab20ae5fcc0f09ce706de..e65adba3c59d662f287bbefe212f985c6cf75de5 100644 (file)
@@ -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) {
index 0bf38924fb7f7a5d55e15b90b65e7891c5224b0c..0422ceaee6950544e42d5f6d9785fe8c41bd15a5 100644 (file)
@@ -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
index 947a2f0b12b8195cbb4b20a45e994ac213d58d9b..510ebb89044ee505cf4e5ce777396e7660bc22da 100644 (file)
@@ -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)
index d67e4da90535335786bb20cd2112cf9e7c7950d9..69f4d45a18104573b27778969b04758c6984ab1b 100644 (file)
@@ -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;
 
index c3db9b983cd23c1303c21b7f19fcb4609bd6ba8e..bb02079b1d46243ece6cca4015596171f9580498 100644 (file)
@@ -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;
index 12b00b80f26e3517845b9532a20ad5850ce589c4..5b8bfb650c729474c0bd88b55cf8c699f9d7f50b 100644 (file)
@@ -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;
 
index 2f3389072b04cf5398ffbe1e31f48f53021dbbfd..4e1f77a63ad76e05806644350e4e146a20e447d0 100644 (file)
@@ -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) {
index 9b1a492730813b8dfbca5fc19b476cdf9b84a557..00174b9afe184a63e31838dfb3add60e3f0d8928 100644 (file)
@@ -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;
 
index 6b341d4b5b8babff07b4862b7ed179a95e36cda7..0a3f2ec68af7946b3cd8d6115bb889dbf00ab514 100644 (file)
@@ -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;
 
index bb146ed80e27a686ea91055fc76b7256ba8d0999..9d601d07c952c24410ef63fda00b0592f6129794 100644 (file)
@@ -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;
index 2b2f9b8c66e213729e1ea7259d9acc68eee84e19..34b5643deae102a8f29ede7991784596886a37bb 100644 (file)
@@ -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;
index 92dab0f0c9aa3c193b18df22f464dafdf12ff210..8ec50c063a0b457364b937e8bf74c3fcd75a0289 100644 (file)
@@ -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);
index 89cf395b77b3d36ec558d65da1d31b8e0db20a6c..1dd2fa1381e8bcb4bcccf4b721394e2d211bbd91 100644 (file)
@@ -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;
 
index f0565125dfcd0ebad4438cb153a72990af2f3215..5bde6abc1e5579422173f0b09d6730a317e714ca 100644 (file)
@@ -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;
 
index dbb84b11dbcb430de0d674736bcc4f0d2573f2f8..0044b9804b3eee20a87eb7b6f06f9809b057150b 100644 (file)
@@ -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;
 
index 14c06ded44c29aae85ab13a3b667a54cd6a6a5f1..d019727bf31573b6ae997bb17eaf9333612d76d0 100644 (file)
 
 #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));
index db2e375228cc9f0a32ab8a00df5475b1dc6a87aa..a9eb189d1f219fd90fafa831c3f558c53f8738c0 100644 (file)
@@ -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