summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-11-11 12:22:45 -0800
committerJason Ekstrand <[email protected]>2017-11-27 16:22:13 -0800
commit5bc2849af9a6e71b4b87d2b1e3f8037fa29e0972 (patch)
tree4b9e67011bf9610f117c511a09973b39636e4857 /src/intel
parent34b95f88e677c30cbdd0541a88a863e539ce36d6 (diff)
anv: Let blorp handle indirect clear colors for CCS resolves
Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Nanley Chery <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/anv_blorp.c32
-rw-r--r--src/intel/vulkan/anv_private.h4
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c51
3 files changed, 20 insertions, 67 deletions
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 7fc6958f22d..e244468e03b 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -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);
}
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 2c2e0b31bf6..ca3644d61e9 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -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
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index cc437ff16b0..ab5590d7cee 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -179,29 +179,6 @@ add_surface_state_reloc(struct anv_cmd_buffer *cmd_buffer,
}
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,
const uint32_t plane,
@@ -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);