mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
anv: Let blorp handle indirect clear colors for CCS resolves
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
This commit is contained in:
parent
34b95f88e6
commit
5bc2849af9
3 changed files with 20 additions and 67 deletions
|
|
@ -175,6 +175,15 @@ get_blorp_surf_for_anv_buffer(struct anv_device *device,
|
|||
|
||||
#define ANV_AUX_USAGE_DEFAULT ((enum isl_aux_usage)0xff)
|
||||
|
||||
static struct blorp_address
|
||||
anv_to_blorp_address(struct anv_address addr)
|
||||
{
|
||||
return (struct blorp_address) {
|
||||
.buffer = addr.bo,
|
||||
.offset = addr.offset,
|
||||
};
|
||||
}
|
||||
|
||||
static void
|
||||
get_blorp_surf_for_anv_image(const struct anv_device *device,
|
||||
const struct anv_image *image,
|
||||
|
|
@ -1673,10 +1682,10 @@ anv_gen8_hiz_op_resolve(struct anv_cmd_buffer *cmd_buffer,
|
|||
|
||||
void
|
||||
anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,
|
||||
const struct anv_state surface_state,
|
||||
const struct anv_image * const image,
|
||||
VkImageAspectFlagBits aspect,
|
||||
const uint8_t level, const uint32_t layer_count,
|
||||
const uint8_t level,
|
||||
const uint32_t start_layer, const uint32_t layer_count,
|
||||
const enum blorp_fast_clear_op op)
|
||||
{
|
||||
assert(cmd_buffer && image);
|
||||
|
|
@ -1685,17 +1694,10 @@ anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,
|
|||
|
||||
/* The resolved subresource range must have a CCS buffer. */
|
||||
assert(level < anv_image_aux_levels(image, aspect));
|
||||
assert(layer_count <= anv_image_aux_layers(image, aspect, level));
|
||||
assert(start_layer + layer_count <=
|
||||
anv_image_aux_layers(image, aspect, level));
|
||||
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV && image->samples == 1);
|
||||
|
||||
/* Create a binding table for this surface state. */
|
||||
uint32_t binding_table;
|
||||
VkResult result =
|
||||
binding_table_for_surface_state(cmd_buffer, surface_state,
|
||||
&binding_table);
|
||||
if (result != VK_SUCCESS)
|
||||
return;
|
||||
|
||||
struct blorp_batch batch;
|
||||
blorp_batch_init(&cmd_buffer->device->blorp, &batch, cmd_buffer,
|
||||
BLORP_BATCH_PREDICATE_ENABLE);
|
||||
|
|
@ -1704,11 +1706,11 @@ anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,
|
|||
get_blorp_surf_for_anv_image(cmd_buffer->device, image, aspect,
|
||||
fast_clear_aux_usage(image, aspect),
|
||||
&surf);
|
||||
surf.clear_color_addr = anv_to_blorp_address(
|
||||
anv_image_get_clear_color_addr(cmd_buffer->device, image, aspect, level));
|
||||
|
||||
blorp_ccs_resolve_attachment(&batch, binding_table, &surf, level,
|
||||
layer_count,
|
||||
image->planes[plane].surface.isl.format,
|
||||
op);
|
||||
blorp_ccs_resolve(&batch, &surf, level, start_layer, layer_count,
|
||||
image->planes[plane].surface.isl.format, op);
|
||||
|
||||
blorp_batch_finish(&batch);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2535,10 +2535,10 @@ anv_gen8_hiz_op_resolve(struct anv_cmd_buffer *cmd_buffer,
|
|||
enum blorp_hiz_op op);
|
||||
void
|
||||
anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,
|
||||
const struct anv_state surface_state,
|
||||
const struct anv_image * const image,
|
||||
VkImageAspectFlagBits aspect,
|
||||
const uint8_t level, const uint32_t layer_count,
|
||||
const uint8_t level,
|
||||
const uint32_t start_layer, const uint32_t layer_count,
|
||||
const enum blorp_fast_clear_op op);
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -178,29 +178,6 @@ add_surface_state_reloc(struct anv_cmd_buffer *cmd_buffer,
|
|||
anv_batch_set_error(&cmd_buffer->batch, result);
|
||||
}
|
||||
|
||||
static void
|
||||
add_image_relocs(struct anv_cmd_buffer *cmd_buffer,
|
||||
const struct anv_image *image,
|
||||
const uint32_t plane,
|
||||
struct anv_surface_state state)
|
||||
{
|
||||
const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev;
|
||||
|
||||
add_surface_state_reloc(cmd_buffer, state.state,
|
||||
image->planes[plane].bo, state.address);
|
||||
|
||||
if (state.aux_address) {
|
||||
VkResult result =
|
||||
anv_reloc_list_add(&cmd_buffer->surface_relocs,
|
||||
&cmd_buffer->pool->alloc,
|
||||
state.state.offset + isl_dev->ss.aux_addr_offset,
|
||||
image->planes[plane].bo,
|
||||
state.aux_address);
|
||||
if (result != VK_SUCCESS)
|
||||
anv_batch_set_error(&cmd_buffer->batch, result);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_image_view_relocs(struct anv_cmd_buffer *cmd_buffer,
|
||||
const struct anv_image_view *image_view,
|
||||
|
|
@ -783,33 +760,7 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
|
|||
|
||||
genX(load_needs_resolve_predicate)(cmd_buffer, image, aspect, level);
|
||||
|
||||
enum isl_aux_usage aux_usage =
|
||||
image->planes[plane].aux_usage == ISL_AUX_USAGE_NONE ?
|
||||
ISL_AUX_USAGE_CCS_D : image->planes[plane].aux_usage;
|
||||
|
||||
/* Create a surface state with the right clear color and perform the
|
||||
* resolve.
|
||||
*/
|
||||
struct anv_surface_state surface_state;
|
||||
surface_state.state = anv_cmd_buffer_alloc_surface_state(cmd_buffer);
|
||||
anv_image_fill_surface_state(cmd_buffer->device,
|
||||
image, VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
&(struct isl_view) {
|
||||
.format = image->planes[plane].surface.isl.format,
|
||||
.swizzle = ISL_SWIZZLE_IDENTITY,
|
||||
.base_level = level,
|
||||
.levels = 1,
|
||||
.base_array_layer = base_layer,
|
||||
.array_len = layer_count,
|
||||
},
|
||||
ISL_SURF_USAGE_RENDER_TARGET_BIT,
|
||||
aux_usage, NULL, 0,
|
||||
&surface_state, NULL);
|
||||
add_image_relocs(cmd_buffer, image, 0, surface_state);
|
||||
genX(copy_fast_clear_dwords)(cmd_buffer, surface_state.state, image,
|
||||
aspect, level, false /* copy to ss */);
|
||||
anv_ccs_resolve(cmd_buffer, surface_state.state, image,
|
||||
aspect, level, layer_count,
|
||||
anv_ccs_resolve(cmd_buffer, image, aspect, level, base_layer, layer_count,
|
||||
image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_E ?
|
||||
BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL :
|
||||
BLORP_FAST_CLEAR_OP_RESOLVE_FULL);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue