turnip: add support to clear LRZ
v2: * Don't emit tu6_clear_lrz() using a IB but in the command stream provided. (Jonathan Marek) * Valid_clear_ib is always false if TU_DEBUG_NOLRZ is set. Remove the useless condition. (Jonathan Marek) * Added more comments. * Use r2d function for blitting LRZ. (Jonathan Marek) v3: * Do LRZ tracking in the command buffer state (Connor). v4: * Simplify the emission of source setup (Jonathan Marek) v5: * Separate LRZ setup in a different function. * Not hide LRZ setup inside GMEM path (Jonathan Marek) * Fix iova address emission in tu6_clear_lrz() (Jonathan Marek) * Add CCU sysmem flushes (Jonathan Marek) v6: * Fixed bug related to storing a VkClearValue pointer that could be out-of-scope when we access to it for emitting LRZ clear. v7: * Merge tu6_clear_lrz() and tu6_clear_lrz_setup() into the same function and emit LRZ clear at the beginning of the renderpass. Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5146>
This commit is contained in:
committed by
Marge Bot
parent
0b2cfd0668
commit
0ca87ed506
@@ -914,6 +914,24 @@ copy_format(VkFormat format, VkImageAspectFlags aspect_mask, bool copy_buffer)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tu6_clear_lrz(struct tu_cmd_buffer *cmd,
|
||||
struct tu_cs *cs,
|
||||
struct tu_image *image,
|
||||
const VkClearValue *value)
|
||||
{
|
||||
const struct blit_ops *ops = &r2d_ops;
|
||||
|
||||
ops->setup(cmd, cs, VK_FORMAT_D16_UNORM, VK_IMAGE_ASPECT_DEPTH_BIT, ROTATE_0, true, false);
|
||||
ops->clear_value(cs, VK_FORMAT_D16_UNORM, value);
|
||||
ops->dst_buffer(cs, VK_FORMAT_D16_UNORM,
|
||||
image->bo->iova + image->bo_offset + image->lrz_offset,
|
||||
image->lrz_pitch * 2);
|
||||
ops->coords(cs, &(VkOffset2D) {}, NULL, &(VkExtent2D) {image->lrz_pitch, image->lrz_height});
|
||||
ops->run(cmd, cs);
|
||||
ops->teardown(cmd, cs);
|
||||
}
|
||||
|
||||
static void
|
||||
tu_image_view_copy_blit(struct tu_image_view *iview,
|
||||
struct tu_image *image,
|
||||
|
||||
@@ -1205,8 +1205,6 @@ tu6_tile_render_begin(struct tu_cmd_buffer *cmd, struct tu_cs *cs)
|
||||
|
||||
tu6_emit_event_write(cmd, cs, LRZ_FLUSH);
|
||||
|
||||
/* lrz clear? */
|
||||
|
||||
tu_cs_emit_pkt7(cs, CP_SKIP_IB2_ENABLE_GLOBAL, 1);
|
||||
tu_cs_emit(cs, 0x0);
|
||||
|
||||
@@ -2922,6 +2920,9 @@ tu_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
|
||||
(att->clear_mask & (VK_IMAGE_ASPECT_COLOR_BIT | VK_IMAGE_ASPECT_DEPTH_BIT))) {
|
||||
cmd->state.lrz.image = image;
|
||||
cmd->state.lrz.valid = true;
|
||||
|
||||
tu6_clear_lrz(cmd, &cmd->cs, image, &pRenderPassBegin->pClearValues[a]);
|
||||
tu6_emit_event_write(cmd, &cmd->cs, PC_CCU_FLUSH_COLOR_TS);
|
||||
} else {
|
||||
cmd->state.lrz.valid = false;
|
||||
}
|
||||
|
||||
@@ -1145,6 +1145,9 @@ tu6_emit_viewport(struct tu_cs *cs, const VkViewport *viewport, uint32_t num_vie
|
||||
void
|
||||
tu6_emit_scissor(struct tu_cs *cs, const VkRect2D *scs, uint32_t scissor_count);
|
||||
|
||||
void
|
||||
tu6_clear_lrz(struct tu_cmd_buffer *cmd, struct tu_cs *cs, struct tu_image* image, const VkClearValue *value);
|
||||
|
||||
void
|
||||
tu6_emit_sample_locations(struct tu_cs *cs, const VkSampleLocationsInfoEXT *samp_loc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user