{
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);
{
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);
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);
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 */
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) |
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);
}
}
/* 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);
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;
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);
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;
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) {
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) {
/* 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
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;
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)
{
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;
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;
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;
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;
}
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;
}
// 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));
{
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;
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) {
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;
{
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;
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;
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;
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;
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;
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;
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);
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;
{
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;
{
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;
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;
*/
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,
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)
{
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;
#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;
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;
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);
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));
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