With Michel's suggestion I've not seen a freeze in Plasmashell or Steam so
far

Tested-by: Mike Lothian <m...@fireburn.co.uk>

On Wed, 9 May 2018 at 21:47 Mike Lothian <m...@fireburn.co.uk> wrote:

> On Tue, 8 May 2018 at 20:47 Adam Jackson <a...@redhat.com> wrote:
>
>> dri*_bind_context, when switching current drawables, will drop the
>> reference on the old one; since that refcount has probably now gone to
>> zero that means we lose all the state we applied to that drawable
>> before, like when swaps are expected to complete.
>>
>> Dropping this reference might make some sense for drawables that aren't
>> _ours_, since we don't get events for destroyed resources and need to
>> rely on the server throwing errors when we name a no-longer-valid
>> drawable. But if the resource is one that this client created, we can be
>> reasonably sure that it will be explicitly destroyed by the same client
>> - and if not, the client is likely to exit anyway, so the memory leak
>> doesn't matter.
>>
>> So, bump the refcnt if the XID of the drawable indicates that it's one
>> of ours. This is, admittedly, a hack. The proper solution would involve
>> rather more surgery to the MakeCurrent path than I can type quickly, let
>> alone test promptly against a wide enough range of servers and DRIs to
>> have any confidence in. I'll work on the real solution, but in the
>> meantime this is effectively not a memory leak for any real scenario,
>> and fixes a real bug.
>>
>> Signed-off-by: Adam Jackson <a...@redhat.com>
>> Cc: Michel Dänzer <michel.daen...@amd.com>
>> Cc: Mike Lothian <m...@fireburn.co.uk>
>> Cc: Mario Kleiner <mario.kleiner...@gmail.com>
>> Cc: Tobias Klausmann <tobias.johannes.klausm...@mni.thm.de>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106351
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106372
>> ---
>>  src/glx/dri_common.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
>> index ab5d6c5bc0..d42ca71124 100644
>> --- a/src/glx/dri_common.c
>> +++ b/src/glx/dri_common.c
>> @@ -411,7 +411,8 @@ driInferDrawableConfig(struct glx_screen *psc,
>> GLXDrawable draw)
>>  _X_HIDDEN __GLXDRIdrawable *
>>  driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
>>  {
>> -   struct glx_display *const priv = __glXInitialize(gc->psc->dpy);
>> +   Display *dpy = gc->psc->dpy;
>> +   struct glx_display *const priv = __glXInitialize(dpy);
>>     __GLXDRIdrawable *pdraw;
>>     struct glx_screen *psc;
>>     struct glx_config *config = gc->config;
>> @@ -449,6 +450,8 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable
>> glxDrawable)
>>        return NULL;
>>     }
>>     pdraw->refcount = 1;
>> +   if ((glxDrawable & dpy->resource_mask) == dpy->resource_base)
>> +      pdraw->refcount ++;
>>
>>     return pdraw;
>>  }
>> --
>> 2.17.0
>>
>>
> Hi
>
> This doesn't fix the freezes in Plasmashell
>
> Both of Mario's patches improved things
>
> Regards
>
> Mike
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to