nvk: Use row_stride_B instead of width for render and copies
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26719>
This commit is contained in:
committed by
Marge Bot
parent
301e707db5
commit
1a2f23439b
@@ -129,7 +129,11 @@ struct nil_image_level {
|
||||
/** Tiling for this level */
|
||||
struct nil_tiling tiling;
|
||||
|
||||
/** Stride between rows in bytes */
|
||||
/** Stride between rows in bytes
|
||||
*
|
||||
* For linear images, this is the obvious stride. For tiled images, it's
|
||||
* the width of the mip level rounded up to the tile size.
|
||||
*/
|
||||
uint32_t row_stride_B;
|
||||
};
|
||||
|
||||
|
||||
@@ -232,7 +232,12 @@ nouveau_copy_rect(struct nvk_cmd_buffer *cmd, struct nouveau_copy *copy)
|
||||
GOB_HEIGHT_GOB_HEIGHT_FERMI_8 :
|
||||
GOB_HEIGHT_GOB_HEIGHT_TESLA_4,
|
||||
});
|
||||
P_NV90B5_SET_SRC_WIDTH(p, copy->src.extent_el.width * src_bw);
|
||||
/* We use the stride for copies because the copy hardware has no
|
||||
* concept of a tile width. Instead, we just set the width to the
|
||||
* stride divided by bpp.
|
||||
*/
|
||||
uint32_t src_stride_el = copy->src.row_stride / copy->src.bpp;
|
||||
P_NV90B5_SET_SRC_WIDTH(p, src_stride_el * src_bw);
|
||||
P_NV90B5_SET_SRC_HEIGHT(p, copy->src.extent_el.height);
|
||||
P_NV90B5_SET_SRC_DEPTH(p, copy->src.extent_el.depth);
|
||||
if (copy->src.image_type == VK_IMAGE_TYPE_3D)
|
||||
@@ -268,7 +273,12 @@ nouveau_copy_rect(struct nvk_cmd_buffer *cmd, struct nouveau_copy *copy)
|
||||
GOB_HEIGHT_GOB_HEIGHT_FERMI_8 :
|
||||
GOB_HEIGHT_GOB_HEIGHT_TESLA_4,
|
||||
});
|
||||
P_NV90B5_SET_DST_WIDTH(p, copy->dst.extent_el.width * dst_bw);
|
||||
/* We use the stride for copies because the copy hardware has no
|
||||
* concept of a tile width. Instead, we just set the width to the
|
||||
* stride divided by bpp.
|
||||
*/
|
||||
uint32_t dst_stride_el = copy->dst.row_stride / copy->dst.bpp;
|
||||
P_NV90B5_SET_DST_WIDTH(p, dst_stride_el * dst_bw);
|
||||
P_NV90B5_SET_DST_HEIGHT(p, copy->dst.extent_el.height);
|
||||
P_NV90B5_SET_DST_DEPTH(p, copy->dst.extent_el.depth);
|
||||
if (copy->dst.image_type == VK_IMAGE_TYPE_3D)
|
||||
|
||||
@@ -639,10 +639,17 @@ nvk_CmdBeginRendering(VkCommandBuffer commandBuffer,
|
||||
P_NV9097_SET_COLOR_TARGET_B(p, i, addr);
|
||||
|
||||
if (level->tiling.is_tiled) {
|
||||
P_NV9097_SET_COLOR_TARGET_WIDTH(p, i, level_extent_sa.w);
|
||||
P_NV9097_SET_COLOR_TARGET_HEIGHT(p, i, level_extent_sa.h);
|
||||
const enum pipe_format p_format =
|
||||
vk_format_to_pipe_format(iview->vk.format);
|
||||
|
||||
/* We use the stride for depth/stencil targets because the Z/S
|
||||
* hardware has no concept of a tile width. Instead, we just set
|
||||
* the width to the stride divided by bpp.
|
||||
*/
|
||||
const uint32_t row_stride_el =
|
||||
level->row_stride_B / util_format_get_blocksize(p_format);
|
||||
P_NV9097_SET_COLOR_TARGET_WIDTH(p, i, row_stride_el);
|
||||
P_NV9097_SET_COLOR_TARGET_HEIGHT(p, i, level_extent_sa.h);
|
||||
const uint8_t ct_format = nil_format_to_color_target(p_format);
|
||||
P_NV9097_SET_COLOR_TARGET_FORMAT(p, i, ct_format);
|
||||
|
||||
@@ -773,8 +780,15 @@ nvk_CmdBeginRendering(VkCommandBuffer commandBuffer,
|
||||
struct nil_extent4d level_extent_sa =
|
||||
nil_image_level_extent_sa(&nil_image, mip_level);
|
||||
|
||||
/* We use the stride for depth/stencil targets because the Z/S hardware
|
||||
* has no concept of a tile width. Instead, we just set the width to
|
||||
* the stride divided by bpp.
|
||||
*/
|
||||
const uint32_t row_stride_el =
|
||||
level->row_stride_B / util_format_get_blocksize(p_format);
|
||||
|
||||
P_MTHD(p, NV9097, SET_ZT_SIZE_A);
|
||||
P_NV9097_SET_ZT_SIZE_A(p, level_extent_sa.w);
|
||||
P_NV9097_SET_ZT_SIZE_A(p, row_stride_el);
|
||||
P_NV9097_SET_ZT_SIZE_B(p, level_extent_sa.h);
|
||||
P_NV9097_SET_ZT_SIZE_C(p, {
|
||||
.third_dimension = base_array_layer + layer_count,
|
||||
|
||||
Reference in New Issue
Block a user