[Mesa-dev] [PATCH 1/3] st/mesa: recreate sampler view on context change v2

Christian König deathsimple at vodafone.de
Tue Mar 25 10:30:01 PDT 2014


>
>> Will you try to implement the linked list?
>
> Sure, shouldn't be to much of a problem. 

It actually turned out to be easier as a small dynamically resized 
array. Patches are on the list CCing you, please review.

Thanks,
Christian.

Am 24.03.2014 17:56, schrieb Christian König:
> Am 24.03.2014 17:13, schrieb Brian Paul:
>> On 03/24/2014 10:04 AM, Christian König wrote:
>>> Am 24.03.2014 16:36, schrieb Brian Paul:
>>>> On 03/24/2014 08:06 AM, Christian König wrote:
>>>>> From: Christian König <christian.koenig at amd.com>
>>>>>
>>>>> With shared glx contexts it is possible that a texture is create and
>>>>> used
>>>>> in one context and then used in another one resulting in incorrect
>>>>> sampler view usage.
>>>>>
>>>>> v2: avoid template copy
>>>>>
>>>>> Signed-off-by: Christian König <christian.koenig at amd.com>
>>>>> Cc: "10.0 10.1" <mesa-stable at lists.freedesktop.org>
>>>>> ---
>>>>>   src/mesa/state_tracker/st_atom_texture.c | 7 +++++++
>>>>>   1 file changed, 7 insertions(+)
>>>>>
>>>>> diff --git a/src/mesa/state_tracker/st_atom_texture.c
>>>>> b/src/mesa/state_tracker/st_atom_texture.c
>>>>> index 3557a3f..dc7f635 100644
>>>>> --- a/src/mesa/state_tracker/st_atom_texture.c
>>>>> +++ b/src/mesa/state_tracker/st_atom_texture.c
>>>>> @@ -198,6 +198,13 @@ st_get_texture_sampler_view_from_stobj(struct
>>>>> st_texture_object *stObj,
>>>>>      if (!stObj->sampler_view) {
>>>>>         stObj->sampler_view =
>>>>>            st_create_texture_sampler_view_from_stobj(pipe, stObj,
>>>>> samp, format);
>>>>> +
>>>>> +   } else if (stObj->sampler_view->context != pipe) {
>>>>> +      /* Recreate view in correct context, use existing view as
>>>>> template */
>>>>> +      struct pipe_sampler_view *sv =
>>>>> +         pipe->create_sampler_view(pipe, stObj->pt,
>>>>> stObj->sampler_view);
>>>>> + pipe_sampler_view_reference(&stObj->sampler_view, NULL);
>>>>> +      stObj->sampler_view = sv;
>>>>>      }
>>>>>
>>>>>      return stObj->sampler_view;
>>>>>
>>>>
>>>> My concern with this is if there really are multiple contexts using
>>>> one texture, we're going to continuously destroy and create sampler
>>>> views when we validate state.  Right?
>>>
>>> Yes that's correct and it also concerned me as well.
>>>
>>>>
>>>> Ultimately, the right solution might be to have a list of sampler
>>>> views per texture, one sampler view per context.  Since there usually
>>>> aren't too many contexts sharing textures, a linked list would
>>>> probably be OK.
>>>>
>>>
>>> Completely agree, but this patchset is meant to be a bugfix for the
>>> crashes we experience with 10.x. For master a solution with a linked
>>> list should work better indeed.
>>
>> OK, let's put a 'XXX' comment describing that solution in the code 
>> for now.
>>
>> With that, Reviewed-by: Brian Paul <brianp at vmware.com>
>>
>
> Thanks, I've added the comment and pushed the result upstream.
>
> What about the other two patches? I would like to push at least #2 as 
> well, cause it is clearly a bugfix.
>
>> Will you try to implement the linked list?
>
> Sure, shouldn't be to much of a problem.
>
> Christian.
>
>>
>> -Brian
>>
>



More information about the mesa-dev mailing list