[Mesa-dev] RFC: Fixing XBMC crash with NV_vdpau_interop

Christian König deathsimple at vodafone.de
Sun Mar 23 04:36:57 PDT 2014

Am 22.03.2014 23:33, schrieb Brian Paul:
> On Sat, Mar 22, 2014 at 2:49 PM, Christian König 
> <deathsimple at vodafone.de <mailto:deathsimple at vodafone.de>> wrote:
>     Hi guys,
>     recently some XBMC users complained about crashes with the
>     relatively new NV_vdpau_interop support.
>     That turned out to be a problem with how st_atom_texture.c caches
>     the sampler view for a texture. Since the texture in question is
>     shared between two GLX contexts the pipe object the sampler view
>     was originally created for doesn't necessary match the pipe object
>     it is used with.
>     Now my question is am I missing something or is this case really
>     not correctly supported? Where is the check if a texture is used
>     in more than one context? The attached patch fixes the issue, but
>     I'm not sure if it is the right approach.
> I've run into this too.  I think the best thing to do (short of 
> removing the sampler view from the st_texture_object) is to walk over 
> all the textures in the share group at context-destroy time, looking 
> for sampler views belonging to the context being destroyed, then free 
> those sampler views.

Yeah, that's also a problem, but not what I'm currently dealing with.

My problem is that we pass a sampler view to a pipe context which 
doesn't belong to this context. Surprisingly the driver doesn't crash 
immediately, but instead works fine for at least some time.

Our radeonsi driver keeps an internal reference to all sample views 
bound to it, and so when some times later a new sampler view is bound we 
unreference the sampler view in question and crash because the context 
where this sampler view was created with no longer exists.

So it's reference inside the driver that crashes, not the one in the 
mesa state tracker. So there is probably nothing I can do except for 
what the attached patch does and try to never bind a sampler view to a 
context it doesn't belong to.

> I could probably whip up a patch next week.

Would you mind if I try to fix that? Doesn't sounds so complicated to me.


> -Brian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140323/ecf30dba/attachment-0001.html>

More information about the mesa-dev mailing list