mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
v3d: Use the TLB R/B swapping instead of recompiles when available.
The recompile reduction is nice, but this also makes it so that a straight texture copy could get optimized some day to not unpack/repack the f16 values.
This commit is contained in:
parent
3923cf626d
commit
4018eb04e8
4 changed files with 17 additions and 3 deletions
|
|
@ -811,6 +811,12 @@ v3d_create_surface(struct pipe_context *pctx,
|
|||
|
||||
surface->format = v3d_get_rt_format(&screen->devinfo, psurf->format);
|
||||
|
||||
const struct util_format_description *desc =
|
||||
util_format_description(psurf->format);
|
||||
|
||||
surface->swap_rb = (desc->swizzle[0] == PIPE_SWIZZLE_Z &&
|
||||
psurf->format != PIPE_FORMAT_B5G6R5_UNORM);
|
||||
|
||||
if (util_format_is_depth_or_stencil(psurf->format)) {
|
||||
switch (psurf->format) {
|
||||
case PIPE_FORMAT_Z16_UNORM:
|
||||
|
|
|
|||
|
|
@ -104,6 +104,13 @@ struct v3d_surface {
|
|||
*/
|
||||
uint8_t internal_bpp;
|
||||
|
||||
/**
|
||||
* If the R and B channels should be swapped. On V3D 3.x, we do it in
|
||||
* the shader and the blend equation. On V3D 4.1+, we can use the new
|
||||
* TLB load/store flags instead of recompiling.
|
||||
*/
|
||||
bool swap_rb;
|
||||
|
||||
uint32_t padded_height_of_output_image_in_uif_blocks;
|
||||
|
||||
/* If the resource being referenced is separate stencil, then this is
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ load_general(struct v3d_cl *cl, struct pipe_surface *psurf, int buffer,
|
|||
load.input_image_format = V3D_OUTPUT_IMAGE_FORMAT_S8;
|
||||
else
|
||||
load.input_image_format = surf->format;
|
||||
load.r_b_swap = surf->swap_rb;
|
||||
|
||||
if (surf->tiling == VC5_TILING_UIF_NO_XOR ||
|
||||
surf->tiling == VC5_TILING_UIF_XOR) {
|
||||
|
|
@ -137,6 +138,7 @@ store_general(struct v3d_job *job,
|
|||
else
|
||||
store.output_image_format = surf->format;
|
||||
|
||||
store.r_b_swap = surf->swap_rb;
|
||||
store.memory_format = surf->tiling;
|
||||
|
||||
if (surf->tiling == VC5_TILING_UIF_NO_XOR ||
|
||||
|
|
|
|||
|
|
@ -481,6 +481,7 @@ v3d_set_framebuffer_state(struct pipe_context *pctx,
|
|||
struct pipe_surface *cbuf = v3d->framebuffer.cbufs[i];
|
||||
if (!cbuf)
|
||||
continue;
|
||||
struct v3d_surface *v3d_cbuf = v3d_surface(cbuf);
|
||||
|
||||
const struct util_format_description *desc =
|
||||
util_format_description(cbuf->format);
|
||||
|
|
@ -488,10 +489,8 @@ v3d_set_framebuffer_state(struct pipe_context *pctx,
|
|||
/* For BGRA8 formats (DRI window system default format), we
|
||||
* need to swap R and B, since the HW's format is RGBA8.
|
||||
*/
|
||||
if (desc->swizzle[0] == PIPE_SWIZZLE_Z &&
|
||||
cbuf->format != PIPE_FORMAT_B5G6R5_UNORM) {
|
||||
if (v3d->screen->devinfo.ver < 42 && v3d_cbuf->swap_rb)
|
||||
v3d->swap_color_rb |= 1 << i;
|
||||
}
|
||||
|
||||
if (desc->swizzle[3] == PIPE_SWIZZLE_1)
|
||||
v3d->blend_dst_alpha_one |= 1 << i;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue