mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
turnip: add blit_format_texture
The use of FMT6_8_8_8_8_UNORM for z24s8/z24x8 is for blit src. Make that clear by moving the logic from fd6_texture_format to the newly added blit_format_texture. Add a comment on why this is simpler than in fdl6_view_init. This should have no functional change in practice. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21117>
This commit is contained in:
parent
659b2e56bd
commit
75f601279b
2 changed files with 31 additions and 31 deletions
|
|
@ -64,6 +64,28 @@ format_to_ifmt(enum pipe_format format)
|
|||
}
|
||||
}
|
||||
|
||||
static struct tu_native_format
|
||||
blit_format_texture(enum pipe_format format, enum a6xx_tile_mode tile_mode)
|
||||
{
|
||||
struct tu_native_format fmt = tu6_format_texture(format, tile_mode);
|
||||
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_Z24X8_UNORM:
|
||||
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
|
||||
/* Similar to in fdl6_view_init, we want to use
|
||||
* FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8 or FMT6_8_8_8_8_UNORM for blit
|
||||
* src. Since this is called when there is no image and thus no ubwc,
|
||||
* we can always use FMT6_8_8_8_8_UNORM.
|
||||
*/
|
||||
fmt.fmt = FMT6_8_8_8_8_UNORM;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return fmt;
|
||||
}
|
||||
|
||||
static void
|
||||
r2d_coords(struct tu_cs *cs,
|
||||
const VkOffset2D *dst,
|
||||
|
|
@ -247,7 +269,7 @@ r2d_src_buffer(struct tu_cmd_buffer *cmd,
|
|||
uint32_t width, uint32_t height,
|
||||
enum pipe_format dst_format)
|
||||
{
|
||||
struct tu_native_format fmt = tu6_format_texture(format, TILE6_LINEAR);
|
||||
struct tu_native_format fmt = blit_format_texture(format, TILE6_LINEAR);
|
||||
enum a6xx_format color_format = fmt.fmt;
|
||||
fixup_src_format(&format, dst_format, &color_format);
|
||||
|
||||
|
|
@ -1006,7 +1028,7 @@ r3d_src_buffer(struct tu_cmd_buffer *cmd,
|
|||
{
|
||||
uint32_t desc[A6XX_TEX_CONST_DWORDS];
|
||||
|
||||
struct tu_native_format fmt = tu6_format_texture(format, TILE6_LINEAR);
|
||||
struct tu_native_format fmt = blit_format_texture(format, TILE6_LINEAR);
|
||||
enum a6xx_format color_format = fmt.fmt;
|
||||
fixup_src_format(&format, dst_format, &color_format);
|
||||
|
||||
|
|
@ -1043,7 +1065,7 @@ r3d_src_gmem(struct tu_cmd_buffer *cmd,
|
|||
uint32_t desc[A6XX_TEX_CONST_DWORDS];
|
||||
memcpy(desc, iview->view.descriptor, sizeof(desc));
|
||||
|
||||
enum a6xx_format fmt = tu6_format_texture(format, TILE6_LINEAR).fmt;
|
||||
enum a6xx_format fmt = blit_format_texture(format, TILE6_LINEAR).fmt;
|
||||
fixup_src_format(&format, dst_format, &fmt);
|
||||
|
||||
/* patch the format so that depth/stencil get the right format and swizzle */
|
||||
|
|
@ -1881,8 +1903,8 @@ tu_CmdCopyImageToBuffer2KHR(VkCommandBuffer commandBuffer,
|
|||
static bool
|
||||
is_swapped_format(enum pipe_format format)
|
||||
{
|
||||
struct tu_native_format linear = tu6_format_texture(format, TILE6_LINEAR);
|
||||
struct tu_native_format tiled = tu6_format_texture(format, TILE6_3);
|
||||
struct tu_native_format linear = blit_format_texture(format, TILE6_LINEAR);
|
||||
struct tu_native_format tiled = blit_format_texture(format, TILE6_3);
|
||||
return linear.fmt != tiled.fmt || linear.swap != tiled.swap;
|
||||
}
|
||||
|
||||
|
|
@ -3180,7 +3202,7 @@ store_cp_blit(struct tu_cmd_buffer *cmd,
|
|||
r2d_dst(cs, &iview->view, layer, src_format);
|
||||
}
|
||||
|
||||
enum a6xx_format fmt = tu6_format_texture(src_format, TILE6_2).fmt;
|
||||
enum a6xx_format fmt = blit_format_texture(src_format, TILE6_2).fmt;
|
||||
fixup_src_format(&src_format, dst_format, &fmt);
|
||||
|
||||
tu_cs_emit_regs(cs,
|
||||
|
|
|
|||
|
|
@ -94,35 +94,13 @@ tu6_format_color(enum pipe_format format, enum a6xx_tile_mode tile_mode)
|
|||
return fmt;
|
||||
}
|
||||
|
||||
static struct tu_native_format
|
||||
tu6_format_texture_unchecked(enum pipe_format format, enum a6xx_tile_mode tile_mode)
|
||||
struct tu_native_format
|
||||
tu6_format_texture(enum pipe_format format, enum a6xx_tile_mode tile_mode)
|
||||
{
|
||||
struct tu_native_format fmt = {
|
||||
.fmt = fd6_texture_format(format, tile_mode),
|
||||
.swap = fd6_texture_swap(format, tile_mode),
|
||||
};
|
||||
|
||||
switch (format) {
|
||||
case PIPE_FORMAT_Z24X8_UNORM:
|
||||
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
|
||||
/* freedreno uses Z24_UNORM_S8_UINT (sampling) or
|
||||
* FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8 (blits) for this format, while we use
|
||||
* FMT6_8_8_8_8_UNORM or FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8
|
||||
*/
|
||||
fmt.fmt = FMT6_8_8_8_8_UNORM;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return fmt;
|
||||
}
|
||||
|
||||
struct tu_native_format
|
||||
tu6_format_texture(enum pipe_format format, enum a6xx_tile_mode tile_mode)
|
||||
{
|
||||
struct tu_native_format fmt = tu6_format_texture_unchecked(format, tile_mode);
|
||||
assert(fmt.fmt != FMT6_NONE);
|
||||
return fmt;
|
||||
}
|
||||
|
|
@ -130,7 +108,7 @@ tu6_format_texture(enum pipe_format format, enum a6xx_tile_mode tile_mode)
|
|||
static bool
|
||||
tu6_format_texture_supported(enum pipe_format format)
|
||||
{
|
||||
return tu6_format_texture_unchecked(format, TILE6_LINEAR).fmt != FMT6_NONE;
|
||||
return fd6_texture_format(format, TILE6_LINEAR) != FMT6_NONE;
|
||||
}
|
||||
|
||||
enum tu6_ubwc_compat_type {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue