ta->ubwc_blockheight),
ubwc_tile_height_alignment);
+ layout->pitchalign =
+ util_logbase2_ceil(fdl6_pitchalign(layout, mip_levels - 1) * layout->cpp >> 6);
+
for (uint32_t level = 0; level < mip_levels; level++) {
uint32_t depth = u_minify(depth0, level);
struct fdl_slice *slice = &layout->slices[level];
uint32_t size; /* Size of the whole image, in bytes. */
uint32_t base_align; /* Alignment of the base address, in bytes. */
+ uint8_t pitchalign; /* log2(pitchalign / 64) */
};
static inline uint32_t
</enum>
-<enum name="a6xx_tex_fetchsize">
- <value name="TFETCH6_1_BYTE" value="0"/>
- <value name="TFETCH6_2_BYTE" value="1"/>
- <value name="TFETCH6_4_BYTE" value="2"/>
- <value name="TFETCH6_8_BYTE" value="3"/>
- <value name="TFETCH6_16_BYTE" value="4"/>
-</enum>
-
<!-- probably same as a5xx -->
<enum name="a6xx_depth_format">
<value name="DEPTH6_NONE" value="0"/>
behavior of texture in dEQP-GLES31.functional.texture.texture_buffer.render.as_fragment_texture.buffer_size_131071
-->
<bitfield name="UNK4" pos="4" type="boolean"/>
- <bitfield name="FETCHSIZE" low="0" high="3" type="a6xx_tex_fetchsize"/>
+ <!-- minimum pitch (for mipmap levels): log2(pitchalign / 64) -->
+ <bitfield name="PITCHALIGN" low="0" high="3" type="uint"/>
<doc>Pitch in bytes (so actually stride)</doc>
<bitfield name="PITCH" low="7" high="28" type="uint"/>
<bitfield name="TYPE" low="29" high="30" type="a6xx_tex_type"/>
A6XX_TEX_CONST_0_SWIZ_W(vk_format == VK_FORMAT_R8_UNORM ? A6XX_TEX_X : A6XX_TEX_W);
desc[1] = A6XX_TEX_CONST_1_WIDTH(width) | A6XX_TEX_CONST_1_HEIGHT(height);
desc[2] =
- A6XX_TEX_CONST_2_FETCHSIZE(tu6_fetchsize(vk_format)) |
A6XX_TEX_CONST_2_PITCH(pitch) |
A6XX_TEX_CONST_2_TYPE(A6XX_TEX_2D);
desc[3] = 0;
/* patched for gmem */
dst[0] &= ~(A6XX_TEX_CONST_0_SWAP__MASK | A6XX_TEX_CONST_0_TILE_MODE__MASK);
dst[0] |= A6XX_TEX_CONST_0_TILE_MODE(TILE6_2);
- dst[2] &= ~(A6XX_TEX_CONST_2_TYPE__MASK | A6XX_TEX_CONST_2_PITCH__MASK);
- dst[2] |=
+ dst[2] =
A6XX_TEX_CONST_2_TYPE(A6XX_TEX_2D) |
A6XX_TEX_CONST_2_PITCH(cmd->state.tiling_config.tile0.extent.width * att->cpp);
dst[3] = 0;
return vk_error(device->instance, VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT);
}
-enum a6xx_tex_fetchsize
-tu6_fetchsize(VkFormat format)
-{
- switch (vk_format_get_blocksize(format)) {
- case 1: return TFETCH6_1_BYTE;
- case 2: return TFETCH6_2_BYTE;
- case 4: return TFETCH6_4_BYTE;
- case 8: return TFETCH6_8_BYTE;
- case 16: return TFETCH6_16_BYTE;
- default:
- unreachable("bad block size");
- }
-}
-
static void
compose_swizzle(unsigned char *swiz, const VkComponentMapping *mapping)
{
A6XX_TEX_CONST_0_MIPLVLS(tu_get_levelCount(image, range) - 1);
iview->descriptor[1] = A6XX_TEX_CONST_1_WIDTH(width) | A6XX_TEX_CONST_1_HEIGHT(height);
iview->descriptor[2] =
- A6XX_TEX_CONST_2_FETCHSIZE(tu6_fetchsize(format)) |
+ A6XX_TEX_CONST_2_PITCHALIGN(layout->pitchalign) |
A6XX_TEX_CONST_2_PITCH(pitch) |
A6XX_TEX_CONST_2_TYPE(tu6_tex_type(pCreateInfo->viewType, false));
iview->descriptor[3] = A6XX_TEX_CONST_3_ARRAY_PITCH(layer_size);
enum a3xx_msaa_samples
tu_msaa_samples(uint32_t samples);
-enum a6xx_tex_fetchsize
-tu6_fetchsize(VkFormat format);
struct tu_image_view
{
OUT_RING(state, texconst0);
OUT_RING(state, A6XX_TEX_CONST_1_WIDTH(pfb->width) |
A6XX_TEX_CONST_1_HEIGHT(pfb->height));
- OUT_RINGP(state, A6XX_TEX_CONST_2_TYPE(A6XX_TEX_2D) |
- A6XX_TEX_CONST_2_FETCHSIZE(TFETCH6_2_BYTE),
+ OUT_RINGP(state, A6XX_TEX_CONST_2_TYPE(A6XX_TEX_2D),
&ctx->batch->fb_read_patches);
OUT_RING(state, A6XX_TEX_CONST_3_ARRAY_PITCH(rsc->layout.layer_size));
return formats[format].swap;
}
-// XXX possibly same as a4xx..
-enum a6xx_tex_fetchsize
-fd6_pipe2fetchsize(enum pipe_format format)
-{
- if (format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT)
- format = PIPE_FORMAT_Z32_FLOAT;
-
- switch (util_format_get_blocksizebits(format)) {
- case 8: return TFETCH6_1_BYTE;
- case 16: return TFETCH6_2_BYTE;
- case 32: return TFETCH6_4_BYTE;
- case 64: return TFETCH6_8_BYTE;
- case 96: return TFETCH6_1_BYTE; /* Does this matter? */
- case 128: return TFETCH6_16_BYTE;
- default:
- debug_printf("Unknown block size for format %s: %d\n",
- util_format_name(format),
- util_format_get_blocksizebits(format));
- return TFETCH6_1_BYTE;
- }
-}
-
enum a6xx_depth_format
fd6_pipe2depth(enum pipe_format format)
{
enum a6xx_format fd6_pipe2tex(enum pipe_format format);
enum a6xx_format fd6_pipe2color(enum pipe_format format);
enum a3xx_color_swap fd6_pipe2swap(enum pipe_format format);
-enum a6xx_tex_fetchsize fd6_pipe2fetchsize(enum pipe_format format);
enum a6xx_depth_format fd6_pipe2depth(enum pipe_format format);
enum a6xx_tex_swiz fd6_pipe2swiz(unsigned swiz);
struct pipe_resource *prsc;
enum pipe_format pfmt;
enum a6xx_format fmt;
- enum a6xx_tex_fetchsize fetchsize;
enum a6xx_tex_type type;
bool srgb;
uint32_t cpp;
img->prsc = prsc;
img->pfmt = format;
img->fmt = fd6_pipe2tex(format);
- img->fetchsize = fd6_pipe2fetchsize(format);
img->type = fd6_tex_type(prsc->target);
img->srgb = util_format_is_srgb(format);
img->cpp = rsc->layout.cpp;
img->prsc = prsc;
img->pfmt = format;
img->fmt = fd6_pipe2tex(format);
- img->fetchsize = fd6_pipe2fetchsize(format);
img->type = fd6_tex_type(prsc->target);
img->srgb = util_format_is_srgb(format);
img->cpp = rsc->layout.cpp;
PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W));
OUT_RING(ring, A6XX_TEX_CONST_1_WIDTH(img->width) |
A6XX_TEX_CONST_1_HEIGHT(img->height));
- OUT_RING(ring, A6XX_TEX_CONST_2_FETCHSIZE(img->fetchsize) |
+ OUT_RING(ring,
COND(img->buffer, A6XX_TEX_CONST_2_UNK4 | A6XX_TEX_CONST_2_UNK31) |
A6XX_TEX_CONST_2_TYPE(img->type) |
A6XX_TEX_CONST_2_PITCH(img->pitch));
A6XX_TEX_CONST_1_WIDTH(u_minify(prsc->width0, lvl)) |
A6XX_TEX_CONST_1_HEIGHT(u_minify(prsc->height0, lvl));
so->texconst2 =
- A6XX_TEX_CONST_2_FETCHSIZE(fd6_pipe2fetchsize(format)) |
+ A6XX_TEX_CONST_2_PITCHALIGN(rsc->layout.pitchalign) |
A6XX_TEX_CONST_2_PITCH(slice->pitch);
so->offset = fd_resource_offset(rsc, lvl, cso->u.tex.first_layer);
so->ubwc_offset = fd_resource_ubwc_offset(rsc, lvl, cso->u.tex.first_layer);