Re: [Mesa-dev] [PATCH 03/11] anv/cmd_buffer: Properly handle render passes with 0 attachments

2017-07-17 Thread Jason Ekstrand
On Mon, Jul 17, 2017 at 4:18 AM, James Legg 
wrote:

> On Tue, 2017-07-11 at 17:04 -0700, Jason Ekstrand wrote:
> > We were early returning and never created the NULL surface state.
> >
> > Cc: mesa-sta...@lists.freedesktop.org
>
> This patch fixes a bug that affected me.
>
> Tested-by: James Legg 
>

Thanks!  Lionel already reviewed the patch so I went ahead and pushed this
one.  It's got a stable CC so it should end up back-ported to 17.1 as well.


> I submitted a similar patch before seeing this one
> (https://patchwork.freedesktop.org/patch/167047/). I'll drop that if
> this one is merged.
>
> James
>
> > ---
> >  src/intel/vulkan/genX_cmd_buffer.c | 23 +++
> >  1 file changed, 11 insertions(+), 12 deletions(-)
> >
> > diff --git a/src/intel/vulkan/genX_cmd_buffer.c
> b/src/intel/vulkan/genX_cmd_buffer.c
> > index 53c58ca..9b3bb10 100644
> > --- a/src/intel/vulkan/genX_cmd_buffer.c
> > +++ b/src/intel/vulkan/genX_cmd_buffer.c
> > @@ -429,19 +429,18 @@ genX(cmd_buffer_setup_attachments)(struct
> anv_cmd_buffer *cmd_buffer,
> >
> > vk_free(_buffer->pool->alloc, state->attachments);
> >
> > -   if (pass->attachment_count == 0) {
> > +   if (pass->attachment_count > 0) {
> > +  state->attachments = vk_alloc(_buffer->pool->alloc,
> > +pass->attachment_count *
> > + sizeof(state->attachments[0]),
> > +8, VK_SYSTEM_ALLOCATION_SCOPE_
> OBJECT);
> > +  if (state->attachments == NULL) {
> > + /* Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer
> */
> > + return anv_batch_set_error(_buffer->batch,
> > +VK_ERROR_OUT_OF_HOST_MEMORY);
> > +  }
> > +   } else {
> >state->attachments = NULL;
> > -  return VK_SUCCESS;
> > -   }
> > -
> > -   state->attachments = vk_alloc(_buffer->pool->alloc,
> > - pass->attachment_count *
> > -  sizeof(state->attachments[0]),
> > - 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
> > -   if (state->attachments == NULL) {
> > -  /* Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */
> > -  return anv_batch_set_error(_buffer->batch,
> > - VK_ERROR_OUT_OF_HOST_MEMORY);
> > }
> >
> > /* Reserve one for the NULL state. */
> > --
> > 2.5.0.400.gff86faf
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 03/11] anv/cmd_buffer: Properly handle render passes with 0 attachments

2017-07-17 Thread James Legg
On Tue, 2017-07-11 at 17:04 -0700, Jason Ekstrand wrote:
> We were early returning and never created the NULL surface state.
> 
> Cc: mesa-sta...@lists.freedesktop.org

This patch fixes a bug that affected me.

Tested-by: James Legg 

I submitted a similar patch before seeing this one
(https://patchwork.freedesktop.org/patch/167047/). I'll drop that if
this one is merged.

James

> ---
>  src/intel/vulkan/genX_cmd_buffer.c | 23 +++
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
> b/src/intel/vulkan/genX_cmd_buffer.c
> index 53c58ca..9b3bb10 100644
> --- a/src/intel/vulkan/genX_cmd_buffer.c
> +++ b/src/intel/vulkan/genX_cmd_buffer.c
> @@ -429,19 +429,18 @@ genX(cmd_buffer_setup_attachments)(struct 
> anv_cmd_buffer *cmd_buffer,
>  
> vk_free(_buffer->pool->alloc, state->attachments);
>  
> -   if (pass->attachment_count == 0) {
> +   if (pass->attachment_count > 0) {
> +  state->attachments = vk_alloc(_buffer->pool->alloc,
> +pass->attachment_count *
> + sizeof(state->attachments[0]),
> +8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
> +  if (state->attachments == NULL) {
> + /* Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */
> + return anv_batch_set_error(_buffer->batch,
> +VK_ERROR_OUT_OF_HOST_MEMORY);
> +  }
> +   } else {
>    state->attachments = NULL;
> -  return VK_SUCCESS;
> -   }
> -
> -   state->attachments = vk_alloc(_buffer->pool->alloc,
> - pass->attachment_count *
> -  sizeof(state->attachments[0]),
> - 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
> -   if (state->attachments == NULL) {
> -  /* Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */
> -  return anv_batch_set_error(_buffer->batch,
> - VK_ERROR_OUT_OF_HOST_MEMORY);
> }
>  
> /* Reserve one for the NULL state. */
> -- 
> 2.5.0.400.gff86faf
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 03/11] anv/cmd_buffer: Properly handle render passes with 0 attachments

2017-07-11 Thread Jason Ekstrand
We were early returning and never created the NULL surface state.

Cc: mesa-sta...@lists.freedesktop.org
---
 src/intel/vulkan/genX_cmd_buffer.c | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c 
b/src/intel/vulkan/genX_cmd_buffer.c
index 53c58ca..9b3bb10 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -429,19 +429,18 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer 
*cmd_buffer,
 
vk_free(_buffer->pool->alloc, state->attachments);
 
-   if (pass->attachment_count == 0) {
+   if (pass->attachment_count > 0) {
+  state->attachments = vk_alloc(_buffer->pool->alloc,
+pass->attachment_count *
+ sizeof(state->attachments[0]),
+8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+  if (state->attachments == NULL) {
+ /* Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */
+ return anv_batch_set_error(_buffer->batch,
+VK_ERROR_OUT_OF_HOST_MEMORY);
+  }
+   } else {
   state->attachments = NULL;
-  return VK_SUCCESS;
-   }
-
-   state->attachments = vk_alloc(_buffer->pool->alloc,
- pass->attachment_count *
-  sizeof(state->attachments[0]),
- 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
-   if (state->attachments == NULL) {
-  /* Propagate VK_ERROR_OUT_OF_HOST_MEMORY to vkEndCommandBuffer */
-  return anv_batch_set_error(_buffer->batch,
- VK_ERROR_OUT_OF_HOST_MEMORY);
}
 
/* Reserve one for the NULL state. */
-- 
2.5.0.400.gff86faf

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev