<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 8, 2016 at 5:00 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Nov 08, 2016 at 04:24:48PM -0800, Jason Ekstrand wrote:<br>
> On Tue, Nov 8, 2016 at 3:13 PM, Nanley Chery <<a href="mailto:nanleychery@gmail.com">nanleychery@gmail.com</a>> wrote:<br>
><br>
> > On Sat, Oct 22, 2016 at 10:50:37AM -0700, Jason Ekstrand wrote:<br>
> > > This commit moves the allocation and filling out of surface state from<br>
> > > CreateImageView time to BeginRenderPass time.  Instead of allocating the<br>
> > > render target surface state as part of the image view, we allocate it in<br>
> > > the command buffer state at the same time that we set up clears.  For<br>
> > > secondary command buffers, we allocate memory for the surface states in<br>
> > > BeginCommandBuffer but don't fill them out; instead, we use our new<br>
> > > SOL-based memcpy function to copy the surface states from the primary<br>
> > > command buffer.  This allows us to handle secondary command buffers<br>
> > without<br>
> > > the user specifying the framebuffer ahead-of-time.<br>
> > > ---<br>
> > >  src/intel/vulkan/anv_cmd_<wbr>buffer.c  |  56 ----------<br>
> > >  src/intel/vulkan/anv_image.c       |  22 ----<br>
> > >  src/intel/vulkan/anv_private.h     |  24 ++++-<br>
> > >  src/intel/vulkan/genX_cmd_<wbr>buffer.c | 204 +++++++++++++++++++++++++++++-<br>
> > -------<br>
> > >  4 files changed, 180 insertions(+), 126 deletions(-)<br>
> > ><br>
> > > diff --git a/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
> > b/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
> > > index a652f9a..372030c 100644<br>
> > > --- a/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
> > > +++ b/src/intel/vulkan/anv_cmd_<wbr>buffer.c<br>
> > > @@ -144,62 +144,6 @@ anv_cmd_state_reset(struct anv_cmd_buffer<br>
> > *cmd_buffer)<br>
> > >     state->gen7.index_buffer = NULL;<br>
> > >  }<br>
> > ><br>
> > > -/**<br>
> > > - * Setup anv_cmd_state::attachments for vkCmdBeginRenderPass.<br>
> > > - */<br>
> > > -void<br>
> > > -anv_cmd_state_setup_<wbr>attachments(struct anv_cmd_buffer *cmd_buffer,<br>
> > > -                                const VkRenderPassBeginInfo *info)<br>
> > > -{<br>
> > > -   struct anv_cmd_state *state = &cmd_buffer->state;<br>
> > > -   ANV_FROM_HANDLE(anv_render_<wbr>pass, pass, info->renderPass);<br>
> > > -<br>
> > > -   vk_free(&cmd_buffer->pool-><wbr>alloc, state->attachments);<br>
> > > -<br>
> > > -   if (pass->attachment_count == 0) {<br>
> > > -      state->attachments = NULL;<br>
> > > -      return;<br>
> > > -   }<br>
> > > -<br>
> > > -   state->attachments = vk_alloc(&cmd_buffer->pool-><wbr>alloc,<br>
> > > -                                  pass->attachment_count *<br>
> > > -                                       sizeof(state->attachments[0]),<br>
> > > -                                  8, VK_SYSTEM_ALLOCATION_SCOPE_<br>
> > OBJECT);<br>
> > > -   if (state->attachments == NULL) {<br>
> > > -      /* FIXME: Propagate VK_ERROR_OUT_OF_HOST_MEMORY to<br>
> > vkEndCommandBuffer */<br>
> > > -      abort();<br>
> > > -   }<br>
> > > -<br>
> > > -   for (uint32_t i = 0; i < pass->attachment_count; ++i) {<br>
> > > -      struct anv_render_pass_attachment *att = &pass->attachments[i];<br>
> > > -      VkImageAspectFlags att_aspects = vk_format_aspects(att->format)<wbr>;<br>
> > > -      VkImageAspectFlags clear_aspects = 0;<br>
> > > -<br>
> > > -      if (att_aspects == VK_IMAGE_ASPECT_COLOR_BIT) {<br>
> > > -         /* color attachment */<br>
> > > -         if (att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {<br>
> > > -            clear_aspects |= VK_IMAGE_ASPECT_COLOR_BIT;<br>
> > > -         }<br>
> > > -      } else {<br>
> > > -         /* depthstencil attachment */<br>
> > > -         if ((att_aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&<br>
> > > -             att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {<br>
> > > -            clear_aspects |= VK_IMAGE_ASPECT_DEPTH_BIT;<br>
> > > -         }<br>
> > > -         if ((att_aspects & VK_IMAGE_ASPECT_STENCIL_BIT) &&<br>
> > > -             att->stencil_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {<br>
> > > -            clear_aspects |= VK_IMAGE_ASPECT_STENCIL_BIT;<br>
> > > -         }<br>
> > > -      }<br>
> > > -<br>
> > > -      state->attachments[i].pending_<wbr>clear_aspects = clear_aspects;<br>
> > > -      if (clear_aspects) {<br>
> > > -         assert(info->clearValueCount > i);<br>
> > > -         state->attachments[i].clear_<wbr>value = info->pClearValues[i];<br>
> > > -      }<br>
> > > -   }<br>
> > > -}<br>
> > > -<br>
> > >  VkResult<br>
> > >  anv_cmd_buffer_ensure_push_<wbr>constants_size(struct anv_cmd_buffer<br>
> > *cmd_buffer,<br>
> > >                                            gl_shader_stage stage,<br>
> > uint32_t size)<br>
> > > diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
> > > index b7c2e99..b014985 100644<br>
> > > --- a/src/intel/vulkan/anv_image.c<br>
> > > +++ b/src/intel/vulkan/anv_image.c<br>
> > > @@ -504,23 +504,6 @@ anv_CreateImageView(VkDevice _device,<br>
> > >        iview->sampler_surface_state.<wbr>alloc_size = 0;<br>
> > >     }<br>
> > ><br>
> > > -   if (image->usage & VK_IMAGE_USAGE_COLOR_<wbr>ATTACHMENT_BIT) {<br>
> > > -      iview->color_rt_surface_state = alloc_surface_state(device);<br>
> > > -<br>
> > > -      struct isl_view view = iview->isl;<br>
> > > -      view.usage |= ISL_SURF_USAGE_RENDER_TARGET_<wbr>BIT;<br>
> > > -      isl_surf_fill_state(&device-><wbr>isl_dev,<br>
> > > -                          iview->color_rt_surface_state.<wbr>map,<br>
> > > -                          .surf = &surface->isl,<br>
> > > -                          .view = &view,<br>
> > > -                          .mocs = device->default_mocs);<br>
> > > -<br>
> > > -      if (!device->info.has_llc)<br>
> > > -         anv_state_clflush(iview-><wbr>color_rt_surface_state);<br>
> > > -   } else {<br>
> > > -      iview->color_rt_surface_state.<wbr>alloc_size = 0;<br>
> > > -   }<br>
> > > -<br>
> > >     /* NOTE: This one needs to go last since it may stomp<br>
> > isl_view.format */<br>
> > >     if (image->usage & VK_IMAGE_USAGE_STORAGE_BIT) {<br>
> > >        iview->storage_surface_state = alloc_surface_state(device);<br>
> > > @@ -565,11 +548,6 @@ anv_DestroyImageView(VkDevice _device, VkImageView<br>
> > _iview,<br>
> > >     ANV_FROM_HANDLE(anv_device, device, _device);<br>
> > >     ANV_FROM_HANDLE(anv_image_<wbr>view, iview, _iview);<br>
> > ><br>
> > > -   if (iview->color_rt_surface_<wbr>state.alloc_size > 0) {<br>
> > > -      anv_state_pool_free(&device-><wbr>surface_state_pool,<br>
> > > -                          iview->color_rt_surface_state)<wbr>;<br>
> > > -   }<br>
> > > -<br>
> > >     if (iview->sampler_surface_state.<wbr>alloc_size > 0) {<br>
> > >        anv_state_pool_free(&device-><wbr>surface_state_pool,<br>
> > >                            iview->sampler_surface_state);<br>
> > > diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<br>
> > private.h<br>
> > > index a6611f1..2a98ea1 100644<br>
> > > --- a/src/intel/vulkan/anv_<wbr>private.h<br>
> > > +++ b/src/intel/vulkan/anv_<wbr>private.h<br>
> > > @@ -1059,6 +1059,8 @@ void anv_dynamic_state_copy(struct<br>
> > anv_dynamic_state *dest,<br>
> > >   * The clear value is valid only if there exists a pending clear.<br>
> > >   */<br>
> > >  struct anv_attachment_state {<br>
> > > +   struct anv_state                             color_rt_state;<br>
> > > +<br>
> > >     VkImageAspectFlags                           pending_clear_aspects;<br>
> > >     VkClearValue                                 clear_value;<br>
> > >  };<br>
> > > @@ -1099,6 +1101,19 @@ struct anv_cmd_state {<br>
> > >      */<br>
> > >     struct anv_attachment_state *                attachments;<br>
> > ><br>
> > > +   /**<br>
> > > +    * Surface states for color render targets.  These are stored in a<br>
> > single<br>
> > > +    * flat array.  For depth-stencil attachments, the surface state is<br>
> > simply<br>
> > > +    * left blank.<br>
> > > +    */<br>
> > > +   struct anv_state                             render_pass_states;<br>
> > > +<br>
> > > +   /**<br>
> > > +    * A null surface state of the right size to match the framebuffer.<br>
> > This<br>
> > > +    * is one of the states in render_pass_states.<br>
> > > +    */<br>
> > > +   struct anv_state                             null_surface_state;<br>
> > > +<br>
> > >     struct {<br>
> > >        struct anv_buffer *                       index_buffer;<br>
> > >        uint32_t                                  index_type; /**<<br>
> > 3DSTATE_INDEX_BUFFER.<wbr>IndexFormat */<br>
> > > @@ -1237,8 +1252,10 @@ void gen8_cmd_buffer_emit_depth_<wbr>viewport(struct<br>
> > anv_cmd_buffer *cmd_buffer,<br>
> > >                                           bool depth_clamp_enable);<br>
> > >  void gen7_cmd_buffer_emit_scissor(<wbr>struct anv_cmd_buffer *cmd_buffer);<br>
> > ><br>
> > > -void anv_cmd_state_setup_<wbr>attachments(struct anv_cmd_buffer *cmd_buffer,<br>
> > > -                                     const VkRenderPassBeginInfo *info);<br>
> > > +void anv_cmd_buffer_setup_<wbr>attachments(struct anv_cmd_buffer<br>
> > *cmd_buffer,<br>
> > > +                                      struct anv_render_pass *pass,<br>
> > > +                                      struct anv_framebuffer<br>
> > *framebuffer,<br>
> > > +                                      const VkClearValue *clear_values);<br>
> > ><br>
> > >  struct anv_state<br>
> > >  anv_cmd_buffer_push_constants(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
> > > @@ -1549,9 +1566,6 @@ struct anv_image_view {<br>
> > >     VkFormat vk_format;<br>
> > >     VkExtent3D extent; /**< Extent of VkImageViewCreateInfo::<wbr>baseMipLevel.<br>
> > */<br>
> > ><br>
> > > -   /** RENDER_SURFACE_STATE when using image as a color render target.<br>
> > */<br>
> > > -   struct anv_state color_rt_surface_state;<br>
> > > -<br>
> > >     /** RENDER_SURFACE_STATE when using image as a sampler surface. */<br>
> > >     struct anv_state sampler_surface_state;<br>
> > ><br>
> > > diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > > index 8734389..78b9bcc 100644<br>
> > > --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > > +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> > > @@ -25,6 +25,7 @@<br>
> > >  #include <stdbool.h><br>
> > ><br>
> > >  #include "anv_private.h"<br>
> > > +#include "vk_format_info.h"<br>
> > ><br>
> > >  #include "common/gen_l3_config.h"<br>
> > >  #include "genxml/gen_macros.h"<br>
> > > @@ -150,6 +151,142 @@ genX(cmd_buffer_emit_state_<wbr>base_address)(struct<br>
> > anv_cmd_buffer *cmd_buffer)<br>
> > >     }<br>
> > >  }<br>
> > ><br>
> > > +/**<br>
> > > + * Setup anv_cmd_state::attachments for vkCmdBeginRenderPass.<br>
> > > + */<br>
> > > +static void<br>
> > > +genX(cmd_buffer_setup_<wbr>attachments)(struct anv_cmd_buffer *cmd_buffer,<br>
> > > +                                   struct anv_render_pass *pass,<br>
> > > +                                   struct anv_framebuffer *framebuffer,<br>
> > > +                                   const VkClearValue *clear_values)<br>
> > > +{<br>
> > > +   const struct isl_device *isl_dev = &cmd_buffer->device->isl_dev;<br>
> > > +   struct anv_cmd_state *state = &cmd_buffer->state;<br>
> > > +<br>
> > > +   vk_free(&cmd_buffer->pool-><wbr>alloc, state->attachments);<br>
> > > +<br>
> > > +   if (pass->attachment_count == 0) {<br>
> > > +      state->attachments = NULL;<br>
> > > +      return;<br>
> > > +   }<br>
> > > +<br>
> > > +   state->attachments = vk_alloc(&cmd_buffer->pool-><wbr>alloc,<br>
> > > +                                 pass->attachment_count *<br>
> > > +                                      sizeof(state->attachments[0]),<br>
> > > +                                 8, VK_SYSTEM_ALLOCATION_SCOPE_<wbr>OBJECT);<br>
> > > +   if (state->attachments == NULL) {<br>
> > > +      /* FIXME: Propagate VK_ERROR_OUT_OF_HOST_MEMORY to<br>
> > vkEndCommandBuffer */<br>
> > > +      abort();<br>
> > > +   }<br>
> > > +<br>
> > > +   bool need_null_state = false;<br>
> > > +   for (uint32_t s = 0; s < pass->subpass_count; ++s) {<br>
> > > +      if (pass->subpasses[s].color_<wbr>count == 0) {<br>
> > > +         need_null_state = true;<br>
> > > +         break;<br>
> > > +      }<br>
> > > +   }<br>
> > > +<br>
> > > +   unsigned num_states = need_null_state;<br>
> > > +   for (uint32_t i = 0; i < pass->attachment_count; ++i) {<br>
> > > +      if (vk_format_is_color(pass-><wbr>attachments[i].format))<br>
> > > +         num_states++;<br>
> > > +   }<br>
> > > +<br>
> > > +   const uint32_t ss_stride = align_u32(isl_dev->ss.size,<br>
> > isl_dev->ss.align);<br>
> > > +   state->render_pass_states =<br>
> > > +      anv_state_stream_alloc(&cmd_<wbr>buffer->surface_state_stream,<br>
> > > +                             num_states * ss_stride, isl_dev->ss.align);<br>
> > > +<br>
> > > +   struct anv_state next_state = state->render_pass_states;<br>
> > > +   next_state.alloc_size = isl_dev->ss.size;<br>
> > > +<br>
> > > +   if (need_null_state) {<br>
> > > +      state->null_surface_state = next_state;<br>
> > > +      next_state.offset += ss_stride;<br>
> > > +      next_state.map += ss_stride;<br>
> > > +   }<br>
> > > +<br>
> > > +   for (uint32_t i = 0; i < pass->attachment_count; ++i) {<br>
> > > +      if (vk_format_is_color(pass-><wbr>attachments[i].format)) {<br>
> > > +         state->attachments[i].color_<wbr>rt_state = next_state;<br>
> > > +         next_state.offset += ss_stride;<br>
> > > +         next_state.map += ss_stride;<br>
> > > +      }<br>
> > > +   }<br>
> > > +   assert(next_state.offset == state->render_pass_states.<wbr>offset +<br>
> > > +                               state->render_pass_states.<wbr>alloc_size);<br>
> > > +<br>
> > > +   if (framebuffer) {<br>
> > > +      assert(pass->attachment_count == framebuffer->attachment_count)<wbr>;<br>
> > > +<br>
> > > +      if (need_null_state) {<br>
> > > +         struct GENX(RENDER_SURFACE_STATE) null_ss = {<br>
> > > +            .SurfaceType = SURFTYPE_NULL,<br>
> > > +            .SurfaceArray = framebuffer->layers > 0,<br>
> > > +            .SurfaceFormat = ISL_FORMAT_R8G8B8A8_UNORM,<br>
> > > +#if GEN_GEN >= 8<br>
> > > +            .TileMode = YMAJOR,<br>
> > > +#else<br>
> > > +            .TiledSurface = true,<br>
> > > +#endif<br>
> > > +            .Width = framebuffer->width - 1,<br>
> > > +            .Height = framebuffer->height - 1,<br>
> > > +            .Depth = framebuffer->layers - 1,<br>
> > > +            .RenderTargetViewExtent = framebuffer->layers - 1,<br>
> > > +         };<br>
> > > +         GENX(RENDER_SURFACE_STATE_<wbr>pack)(NULL,<br>
> > state->null_surface_state.map,<br>
> > > +                                         &null_ss);<br>
> > > +      }<br>
> > > +<br>
> > > +      for (uint32_t i = 0; i < pass->attachment_count; ++i) {<br>
> > > +         struct anv_render_pass_attachment *att = &pass->attachments[i];<br>
> > > +         VkImageAspectFlags att_aspects = vk_format_aspects(att->format)<br>
> > ;<br>
> > > +         VkImageAspectFlags clear_aspects = 0;<br>
> > > +<br>
> > > +         if (att_aspects == VK_IMAGE_ASPECT_COLOR_BIT) {<br>
> > > +            /* color attachment */<br>
> > > +            if (att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {<br>
> > > +               clear_aspects |= VK_IMAGE_ASPECT_COLOR_BIT;<br>
> > > +            }<br>
> > > +         } else {<br>
> > > +            /* depthstencil attachment */<br>
> > > +            if ((att_aspects & VK_IMAGE_ASPECT_DEPTH_BIT) &&<br>
> > > +                att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {<br>
> > > +               clear_aspects |= VK_IMAGE_ASPECT_DEPTH_BIT;<br>
> > > +            }<br>
> > > +            if ((att_aspects & VK_IMAGE_ASPECT_STENCIL_BIT) &&<br>
> > > +                att->stencil_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {<br>
> > > +               clear_aspects |= VK_IMAGE_ASPECT_STENCIL_BIT;<br>
> > > +            }<br>
> > > +         }<br>
> > > +<br>
> > > +         state->attachments[i].pending_<wbr>clear_aspects = clear_aspects;<br>
> > > +         if (clear_aspects)<br>
> > > +            state->attachments[i].clear_<wbr>value = clear_values[i];<br>
> > > +<br>
> > > +         struct anv_image_view *iview = framebuffer->attachments[i];<br>
> > > +         assert(iview->image->vk_format == att->format);<br>
> ><br>
> > This assertion fails when running Dota 2 on your wip/anv-null-fb branch.<br>
> > I don't know if this branch is the most up-to-date version of this<br>
> > series, but it was the easiest way to test it (I couldn't get the mailing<br>
> > list patches to apply with git am). Are you able to reproduce this?<br>
> ><br>
><br>
> That's odd... I haven't seen that and I have run dota2 with CCS on top of<br>
> this branch but may be not in a debug build.  What are the two formats when<br>
> it fails?  I suppose it's possible that it's ATTACHMENT_UNUSED or something.<br>
><br>
<br>
</div></div>(gdb) p iview->image->vk_format<br>
$1 = VK_FORMAT_B8G8R8A8_SRGB<br>
(gdb) p att->format<br>
$2 = VK_FORMAT_B8G8R8A8_UNORM<br></blockquote><div><br></div><div>Ugh... Looks like that assertion is invalid.  The format of the view needs to match but not necesaraly the format of the image.  I'll change it to "assert(iview->vk_format == att->format);"<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
><br>
> > - Nanley<br>
> ><br>
> > > +<br>
> > > +         if (att_aspects == VK_IMAGE_ASPECT_COLOR_BIT) {<br>
> > > +            struct isl_view view = iview->isl;<br>
> > > +            view.usage |= ISL_SURF_USAGE_RENDER_TARGET_<wbr>BIT;<br>
> > > +            isl_surf_fill_state(isl_dev,<br>
> > > +                                state->attachments[i].color_<br>
> > rt_state.map,<br>
> > > +                                .surf = &iview->image->color_surface.<br>
> > isl,<br>
> > > +                                .view = &view,<br>
> > > +                                .mocs = cmd_buffer->device->default_<br>
> > mocs);<br>
> > > +<br>
> > > +            anv_cmd_buffer_add_surface_<wbr>state_reloc(cmd_buffer,<br>
> > > +               state->attachments[i].color_<wbr>rt_state, iview->bo,<br>
> > iview->offset);<br>
> > > +         }<br>
> > > +      }<br>
> > > +<br>
> > > +      if (!cmd_buffer->device->info.<wbr>has_llc)<br>
> > > +         anv_state_clflush(state-><wbr>render_pass_states);<br>
> > > +   }<br>
> > > +}<br>
> > > +<br>
> > >  VkResult<br>
> > >  genX(BeginCommandBuffer)(<br>
> > >      VkCommandBuffer                             commandBuffer,<br>
> > > @@ -189,6 +326,9 @@ genX(BeginCommandBuffer)(<br>
> > >        cmd_buffer->state.subpass =<br>
> > >           &cmd_buffer->state.pass-><wbr>subpasses[pBeginInfo-><br>
> > pInheritanceInfo->subpass];<br>
> > ><br>
> > > +      genX(cmd_buffer_setup_<wbr>attachments)(cmd_buffer,<br>
> > cmd_buffer->state.pass,<br>
> > > +                                         NULL, NULL);<br>
> > > +<br>
> > >        cmd_buffer->state.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS;<br>
> > >     }<br>
> > ><br>
> > > @@ -232,6 +372,22 @@ genX(CmdExecuteCommands)(<br>
> > ><br>
> > >        assert(secondary->level == VK_COMMAND_BUFFER_LEVEL_<wbr>SECONDARY);<br>
> > ><br>
> > > +      if (secondary->usage_flags &<br>
> > > +          VK_COMMAND_BUFFER_USAGE_<wbr>RENDER_PASS_CONTINUE_BIT) {<br>
> > > +         /* If we're continuing a render pass from the primary, we need<br>
> > to<br>
> > > +          * copy the surface states for the current subpass into the<br>
> > storage<br>
> > > +          * we allocated for them in BeginCommandBuffer.<br>
> > > +          */<br>
> > > +         struct anv_bo *ss_bo = &primary->device->surface_<br>
> > <a href="http://state_block_pool.bo" rel="noreferrer" target="_blank">state_block_pool.bo</a>;<br>
> > > +         struct anv_state src_state = primary->state.render_pass_<br>
> > states;<br>
> > > +         struct anv_state dst_state = secondary->state.render_pass_<br>
> > states;<br>
> > > +         assert(src_state.alloc_size == dst_state.alloc_size);<br>
> > > +<br>
> > > +         genX(cmd_buffer_gpu_memcpy)(<wbr>primary, ss_bo, dst_state.offset,<br>
> > > +                                     ss_bo, src_state.offset,<br>
> > > +                                     src_state.alloc_size);<br>
> > > +      }<br>
> > > +<br>
> > >        anv_cmd_buffer_add_secondary(<wbr>primary, secondary);<br>
> > >     }<br>
> > ><br>
> > > @@ -628,43 +784,11 @@ cmd_buffer_alloc_push_<wbr>constants(struct<br>
> > anv_cmd_buffer *cmd_buffer)<br>
> > >     cmd_buffer->state.push_<wbr>constants_dirty |=<br>
> > VK_SHADER_STAGE_ALL_GRAPHICS;<br>
> > >  }<br>
> > ><br>
> > > -static struct anv_state<br>
> > > -alloc_null_surface_state(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
> > > -                         struct anv_framebuffer *fb)<br>
> > > -{<br>
> > > -   struct anv_state state =<br>
> > > -      anv_cmd_buffer_alloc_surface_<wbr>state(cmd_buffer);<br>
> > > -<br>
> > > -   struct GENX(RENDER_SURFACE_STATE) null_ss = {<br>
> > > -      .SurfaceType = SURFTYPE_NULL,<br>
> > > -      .SurfaceArray = fb->layers > 0,<br>
> > > -      .SurfaceFormat = ISL_FORMAT_R8G8B8A8_UNORM,<br>
> > > -#if GEN_GEN >= 8<br>
> > > -      .TileMode = YMAJOR,<br>
> > > -#else<br>
> > > -      .TiledSurface = true,<br>
> > > -#endif<br>
> > > -      .Width = fb->width - 1,<br>
> > > -      .Height = fb->height - 1,<br>
> > > -      .Depth = fb->layers - 1,<br>
> > > -      .RenderTargetViewExtent = fb->layers - 1,<br>
> > > -   };<br>
> > > -<br>
> > > -   GENX(RENDER_SURFACE_STATE_<wbr>pack)(NULL, state.map, &null_ss);<br>
> > > -<br>
> > > -   if (!cmd_buffer->device->info.<wbr>has_llc)<br>
> > > -      anv_state_clflush(state);<br>
> > > -<br>
> > > -   return state;<br>
> > > -}<br>
> > > -<br>
> > > -<br>
> > >  static VkResult<br>
> > >  emit_binding_table(struct anv_cmd_buffer *cmd_buffer,<br>
> > >                     gl_shader_stage stage,<br>
> > >                     struct anv_state *bt_state)<br>
> > >  {<br>
> > > -   struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;<br>
> > >     struct anv_subpass *subpass = cmd_buffer->state.subpass;<br>
> > >     struct anv_pipeline *pipeline;<br>
> > >     uint32_t bias, state_offset;<br>
> > > @@ -743,17 +867,10 @@ emit_binding_table(struct anv_cmd_buffer<br>
> > *cmd_buffer,<br>
> > >           assert(stage == MESA_SHADER_FRAGMENT);<br>
> > >           assert(binding->binding == 0);<br>
> > >           if (binding->index < subpass->color_count) {<br>
> > > -            const struct anv_image_view *iview =<br>
> > > -               fb->attachments[subpass-><wbr>color_attachments[binding-><br>
> > index]];<br>
> > > -<br>
> > > -            assert(iview->color_rt_<wbr>surface_state.alloc_size);<br>
> > > -            surface_state = iview->color_rt_surface_state;<br>
> > > -            anv_cmd_buffer_add_surface_<wbr>state_reloc(cmd_buffer,<br>
> > surface_state,<br>
> > > -                                                   iview->bo,<br>
> > iview->offset);<br>
> > > +            const unsigned att = subpass->color_attachments[<br>
> > binding->index];<br>
> > > +            surface_state = cmd_buffer->state.attachments[<br>
> > att].color_rt_state;<br>
> > >           } else {<br>
> > > -            /* Null render target */<br>
> > > -            struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;<br>
> > > -            surface_state = alloc_null_surface_state(cmd_<wbr>buffer, fb);<br>
> > > +            surface_state = cmd_buffer->state.null_<wbr>surface_state;<br>
> > >           }<br>
> > ><br>
> > >           bt_map[bias + s] = surface_state.offset + state_offset;<br>
> > > @@ -1837,7 +1954,8 @@ void genX(CmdBeginRenderPass)(<br>
> > >     cmd_buffer->state.framebuffer = framebuffer;<br>
> > >     cmd_buffer->state.pass = pass;<br>
> > >     cmd_buffer->state.render_area = pRenderPassBegin->renderArea;<br>
> > > -   anv_cmd_state_setup_<wbr>attachments(cmd_buffer, pRenderPassBegin);<br>
> > > +   genX(cmd_buffer_setup_<wbr>attachments)(cmd_buffer, pass, framebuffer,<br>
> > > +                                      pRenderPassBegin-><wbr>pClearValues);<br>
> > ><br>
> > >     genX(flush_pipeline_select_3d)<wbr>(cmd_buffer);<br>
> > ><br>
> > > --<br>
> > > 2.5.0.400.gff86faf<br>
> > ><br>
> > > ______________________________<wbr>_________________<br>
> > > mesa-dev mailing list<br>
> > > <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> > > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
> ><br>
</div></div></blockquote></div><br></div></div>