On Mon, Nov 13, 2017 at 08:12:49AM -0800, Jason Ekstrand wrote: > --- > src/intel/vulkan/anv_blorp.c | 32 +++++++++++++----------- > src/intel/vulkan/anv_private.h | 4 +-- > src/intel/vulkan/genX_cmd_buffer.c | 51 > +------------------------------------- > 3 files changed, 20 insertions(+), 67 deletions(-) >
This patch is Reviewed-by: Nanley Chery <nanley.g.ch...@intel.com> > diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c > index 6deb350..27320c2 100644 > --- a/src/intel/vulkan/anv_blorp.c > +++ b/src/intel/vulkan/anv_blorp.c > @@ -177,6 +177,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_image *image, > VkImageAspectFlags aspect, > @@ -1655,10 +1664,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); > @@ -1667,17 +1676,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); > @@ -1686,11 +1688,11 @@ anv_ccs_resolve(struct anv_cmd_buffer * const > cmd_buffer, > get_blorp_surf_for_anv_image(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 6eed057..a1b1d48 100644 > --- a/src/intel/vulkan/anv_private.h > +++ b/src/intel/vulkan/anv_private.h > @@ -2527,10 +2527,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 d7e4f23..2491b1d 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); > -- > 2.5.0.400.gff86faf > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev