[Mesa-dev] [PATCH v2 21/24] anv: Allow fast-clearing the first slice of a multi-slice image
Nanley Chery
nanleychery at gmail.com
Sat Feb 3 01:58:37 UTC 2018
On Fri, Feb 02, 2018 at 04:42:14PM -0800, Jason Ekstrand wrote:
> On Fri, Feb 2, 2018 at 2:39 PM, Nanley Chery <nanleychery at gmail.com> wrote:
>
> > On Fri, Jan 19, 2018 at 03:47:38PM -0800, Jason Ekstrand wrote:
> > > Now that we're tracking aux properly per-slice, we can enable this for
> > > applications which actually care.
> > > ---
> > > src/intel/vulkan/anv_blorp.c | 22 +++++++++++++++-------
> > > src/intel/vulkan/genX_cmd_buffer.c | 13 +++++++++----
> > > 2 files changed, 24 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
> > > index 594b0d8..73a44fd 100644
> > > --- a/src/intel/vulkan/anv_blorp.c
> > > +++ b/src/intel/vulkan/anv_blorp.c
> > > @@ -1205,9 +1205,16 @@ anv_cmd_buffer_clear_subpass(struct
> > anv_cmd_buffer *cmd_buffer)
> > > image, VK_IMAGE_ASPECT_COLOR_BIT,
> > > att_state->aux_usage, &surf);
> > >
> > > + uint32_t base_layer = iview->planes[0].isl.base_array_layer;
> > > + uint32_t layer_count = fb->layers;
> > > +
> > > if (att_state->fast_clear) {
> > > surf.clear_color = vk_to_isl_color(att_state->
> > clear_value.color);
> > >
> > > + /* We only support fast-clears on the first layer */
> > > + assert(iview->planes[0].isl.base_level == 0);
> > > + assert(iview->planes[0].isl.base_array_layer == 0);
> > > +
> > > /* From the Sky Lake PRM Vol. 7, "Render Target Fast Clear":
> > > *
> > > * "After Render target fast clear, pipe-control with color
> > cache
> > > @@ -1229,27 +1236,28 @@ anv_cmd_buffer_clear_subpass(struct
> > anv_cmd_buffer *cmd_buffer)
> > >
> > > assert(image->n_planes == 1);
> > > blorp_fast_clear(&batch, &surf, iview->planes[0].isl.format,
> > > - iview->planes[0].isl.base_level,
> > > - iview->planes[0].isl.base_array_layer,
> > fb->layers,
> > > + iview->planes[0].isl.base_level, base_layer,
> > 1,
> > > render_area.offset.x, render_area.offset.y,
> > > render_area.offset.x +
> > render_area.extent.width,
> > > render_area.offset.y +
> > render_area.extent.height);
> > > + base_layer++;
> > > + layer_count--;
> > >
> > > cmd_buffer->state.pending_pipe_bits |=
> > > ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT |
> > ANV_PIPE_CS_STALL_BIT;
> > > - } else {
> > > + }
> > > +
> > > + if (layer_count > 0) {
> > > assert(image->n_planes == 1);
> > > anv_cmd_buffer_mark_image_written(cmd_buffer, image,
> > > VK_IMAGE_ASPECT_COLOR_BIT,
> > > att_state->aux_usage,
> > > iview->planes[0].isl.base_
> > level,
> > > - iview->planes[0].isl.base_
> > array_layer,
> > > - fb->layers);
> > > + base_layer, layer_count);
> > >
> > > blorp_clear(&batch, &surf, iview->planes[0].isl.format,
> > > anv_swizzle_for_render(iview->
> > planes[0].isl.swizzle),
> > > - iview->planes[0].isl.base_level,
> > > - iview->planes[0].isl.base_array_layer, fb->layers,
> > > + iview->planes[0].isl.base_level, base_layer,
> > layer_count,
> > > render_area.offset.x, render_area.offset.y,
> > > render_area.offset.x + render_area.extent.width,
> > > render_area.offset.y + render_area.extent.height,
> > > diff --git a/src/intel/vulkan/genX_cmd_buffer.c
> > b/src/intel/vulkan/genX_cmd_buffer.c
> > > index 4c83a5c..484246d 100644
> > > --- a/src/intel/vulkan/genX_cmd_buffer.c
> > > +++ b/src/intel/vulkan/genX_cmd_buffer.c
> > > @@ -329,12 +329,17 @@ color_attachment_compute_aux_usage(struct
> > anv_device * device,
> > > */
> > > if (att_state->fast_clear &&
> > > (iview->planes[0].isl.base_level > 0 ||
> > > - iview->image->type == VK_IMAGE_TYPE_3D ||
> > > - iview->image->array_size > 0)) {
> > > + iview->planes[0].isl.base_array_layer > 0 ||
> > > + cmd_state->framebuffer->layers > 1)) {
> > > anv_perf_warn(device->instance, iview->image,
> > > "Rendering to a multi-LOD or multi-layer
> > framebuffer "
> > > - "with LOAD_OP_CLEAR. Not fast-clearing");
> > > - att_state->fast_clear = false;
> > > + "with LOAD_OP_CLEAR. Only fast-clearing the
> > first "
> > > + "slice");
> > > +
> > > + /* Leave fast_clear enabled if we are clearing the first
> > slice. */
> > > + if (iview->planes[0].isl.base_level > 0 ||
> > > + iview->planes[0].isl.base_array_layer > 0)
> > > + att_state->fast_clear = false;
> >
> > The new perf_warn is only true for the else portion of this if statement.
> >
>
> No, it fires whenever the framebuffer is on LOD > 0 or multi-layer because
> there are slices that are being rendered to which are not being
> fast-cleared. This if, on the other hand, disables fast clear if none of
> the slices can be fast-cleared (i.e. zero is not in the set).
>
>
Sorry, I meant to say that the perf_warn is only *always* true in the
else case. The perf_warn will wrongly state that it's fast-clearing the
first slice even though the image view starts on level 1 or layer 1. By
"else portion" I'm referring to:
if (iview->planes[0].isl.base_level > 0 ||
iview->planes[0].isl.base_array_layer > 0) {
att_state->fast_clear = false;
} else {
^^^
This
}
> > > }
> > >
> > > if (att_state->fast_clear) {
> > > --
> > > 2.5.0.400.gff86faf
> > >
> > > _______________________________________________
> > > mesa-dev mailing list
> > > mesa-dev at lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
More information about the mesa-dev
mailing list