Re: [Mesa-dev] [PATCH] swr: Update screen->context pointer with multiple contexts.

2016-06-17 Thread Chuck Atkins
Hey, we've all made those commits at one point or another.

+1 for code review!

- Chuck

On Fri, Jun 17, 2016 at 10:18 AM, Cherniak, Bruce 
wrote:

>
> > On Jun 17, 2016, at 8:56 AM, Rowley, Timothy O <
> timothy.o.row...@intel.com> wrote:
> >
> >
> >> On Jun 17, 2016, at 8:58 AM, Bruce Cherniak 
> wrote:
> >>
> >> A pipe pointer in the screen allows for access to current device context
> >> in flush_frontbuffer and resource_destroy.  This wasn't tracking current
> >> context in multi-context situations.
> >> ---
> >> src/gallium/drivers/swr/swr_context.cpp |6 --
> >> src/gallium/drivers/swr/swr_state.cpp   |4 
> >> 2 files changed, 8 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/src/gallium/drivers/swr/swr_context.cpp
> b/src/gallium/drivers/swr/swr_context.cpp
> >> index 3a5d9e0..df9e53e 100644
> >> --- a/src/gallium/drivers/swr/swr_context.cpp
> >> +++ b/src/gallium/drivers/swr/swr_context.cpp
> >> @@ -323,7 +323,8 @@ swr_destroy(struct pipe_context *pipe)
> >>   swr_destroy_scratch_buffers(ctx);
> >>
> >>   assert(screen);
> >> -   screen->pipe = NULL;
> >> +   if (screen->pipe == pipe)
> >> +  screen->pipe = NULL;
> >>
> >>   FREE(ctx);
> >> }
> >> @@ -366,7 +367,8 @@ swr_create_context(struct pipe_screen *p_screen,
> void *priv, unsigned flags)
> >>   if (ctx->swrContext == NULL)
> >>  goto fail;
> >>
> >> -   screen->pipe = >pipe;
> >> +   if (!screen->pipe)
> >> +  screen->pipe = >pipe;
> >>   ctx->pipe.screen = p_screen;
> >>   ctx->pipe.destroy = swr_destroy;
> >>   ctx->pipe.priv = priv;
> >> diff --git a/src/gallium/drivers/swr/swr_state.cpp
> b/src/gallium/drivers/swr/swr_state.cpp
> >> index 3eeb98d..8162fff 100644
> >> --- a/src/gallium/drivers/swr/swr_state.cpp
> >> +++ b/src/gallium/drivers/swr/swr_state.cpp
> >> @@ -776,6 +776,10 @@ swr_update_derived(struct pipe_context *pipe,
> >>   struct swr_context *ctx = swr_context(pipe);
> >>   struct swr_screen *screen = swr_screen(ctx->pipe.screen);
> >>
> >> +   /* Switch current screen->pipe context */
> >> +   if (screen->pipe != screen->pipe)
> >> +  screen->pipe = pipe;
> >> +
> >
> >
> > Pretty sure this test isn’t what you intended.
>
> Wow!  I need a cup of coffee!
> >
> >>   /* Any state that requires dirty flags to be re-triggered sets this
> mask */
> >>   /* For example, user_buffer vertex and index buffers. */
> >>   unsigned post_update_dirty_flags = 0;
> >> --
> >> 1.7.1
> >>
> >> ___
> >> 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
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] swr: Update screen->context pointer with multiple contexts.

2016-06-17 Thread Cherniak, Bruce

> On Jun 17, 2016, at 8:56 AM, Rowley, Timothy O  
> wrote:
> 
> 
>> On Jun 17, 2016, at 8:58 AM, Bruce Cherniak  wrote:
>> 
>> A pipe pointer in the screen allows for access to current device context
>> in flush_frontbuffer and resource_destroy.  This wasn't tracking current
>> context in multi-context situations.
>> ---
>> src/gallium/drivers/swr/swr_context.cpp |6 --
>> src/gallium/drivers/swr/swr_state.cpp   |4 
>> 2 files changed, 8 insertions(+), 2 deletions(-)
>> 
>> diff --git a/src/gallium/drivers/swr/swr_context.cpp 
>> b/src/gallium/drivers/swr/swr_context.cpp
>> index 3a5d9e0..df9e53e 100644
>> --- a/src/gallium/drivers/swr/swr_context.cpp
>> +++ b/src/gallium/drivers/swr/swr_context.cpp
>> @@ -323,7 +323,8 @@ swr_destroy(struct pipe_context *pipe)
>>   swr_destroy_scratch_buffers(ctx);
>> 
>>   assert(screen);
>> -   screen->pipe = NULL;
>> +   if (screen->pipe == pipe)
>> +  screen->pipe = NULL;
>> 
>>   FREE(ctx);
>> }
>> @@ -366,7 +367,8 @@ swr_create_context(struct pipe_screen *p_screen, void 
>> *priv, unsigned flags)
>>   if (ctx->swrContext == NULL)
>>  goto fail;
>> 
>> -   screen->pipe = >pipe;
>> +   if (!screen->pipe)
>> +  screen->pipe = >pipe;
>>   ctx->pipe.screen = p_screen;
>>   ctx->pipe.destroy = swr_destroy;
>>   ctx->pipe.priv = priv;
>> diff --git a/src/gallium/drivers/swr/swr_state.cpp 
>> b/src/gallium/drivers/swr/swr_state.cpp
>> index 3eeb98d..8162fff 100644
>> --- a/src/gallium/drivers/swr/swr_state.cpp
>> +++ b/src/gallium/drivers/swr/swr_state.cpp
>> @@ -776,6 +776,10 @@ swr_update_derived(struct pipe_context *pipe,
>>   struct swr_context *ctx = swr_context(pipe);
>>   struct swr_screen *screen = swr_screen(ctx->pipe.screen);
>> 
>> +   /* Switch current screen->pipe context */
>> +   if (screen->pipe != screen->pipe)
>> +  screen->pipe = pipe;
>> +
> 
> 
> Pretty sure this test isn’t what you intended.

Wow!  I need a cup of coffee!
> 
>>   /* Any state that requires dirty flags to be re-triggered sets this mask */
>>   /* For example, user_buffer vertex and index buffers. */
>>   unsigned post_update_dirty_flags = 0;
>> -- 
>> 1.7.1
>> 
>> ___
>> 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


Re: [Mesa-dev] [PATCH] swr: Update screen->context pointer with multiple contexts.

2016-06-17 Thread Rowley, Timothy O

> On Jun 17, 2016, at 8:58 AM, Bruce Cherniak  wrote:
> 
> A pipe pointer in the screen allows for access to current device context
> in flush_frontbuffer and resource_destroy.  This wasn't tracking current
> context in multi-context situations.
> ---
> src/gallium/drivers/swr/swr_context.cpp |6 --
> src/gallium/drivers/swr/swr_state.cpp   |4 
> 2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/swr/swr_context.cpp 
> b/src/gallium/drivers/swr/swr_context.cpp
> index 3a5d9e0..df9e53e 100644
> --- a/src/gallium/drivers/swr/swr_context.cpp
> +++ b/src/gallium/drivers/swr/swr_context.cpp
> @@ -323,7 +323,8 @@ swr_destroy(struct pipe_context *pipe)
>swr_destroy_scratch_buffers(ctx);
> 
>assert(screen);
> -   screen->pipe = NULL;
> +   if (screen->pipe == pipe)
> +  screen->pipe = NULL;
> 
>FREE(ctx);
> }
> @@ -366,7 +367,8 @@ swr_create_context(struct pipe_screen *p_screen, void 
> *priv, unsigned flags)
>if (ctx->swrContext == NULL)
>   goto fail;
> 
> -   screen->pipe = >pipe;
> +   if (!screen->pipe)
> +  screen->pipe = >pipe;
>ctx->pipe.screen = p_screen;
>ctx->pipe.destroy = swr_destroy;
>ctx->pipe.priv = priv;
> diff --git a/src/gallium/drivers/swr/swr_state.cpp 
> b/src/gallium/drivers/swr/swr_state.cpp
> index 3eeb98d..8162fff 100644
> --- a/src/gallium/drivers/swr/swr_state.cpp
> +++ b/src/gallium/drivers/swr/swr_state.cpp
> @@ -776,6 +776,10 @@ swr_update_derived(struct pipe_context *pipe,
>struct swr_context *ctx = swr_context(pipe);
>struct swr_screen *screen = swr_screen(ctx->pipe.screen);
> 
> +   /* Switch current screen->pipe context */
> +   if (screen->pipe != screen->pipe)
> +  screen->pipe = pipe;
> +


Pretty sure this test isn’t what you intended.

>/* Any state that requires dirty flags to be re-triggered sets this mask */
>/* For example, user_buffer vertex and index buffers. */
>unsigned post_update_dirty_flags = 0;
> -- 
> 1.7.1
> 
> ___
> 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