[Libva] [PATCH] xvba-va-driver: call XDisplayClose in vaTerminate

Rinat Ibragimov ibragimovrinat at mail.ru
Wed Jul 3 12:57:03 PDT 2013


Среда,  3 июля 2013, 18:59 +02:00 от Gwenole Beauchesne <gb.devel at gmail.com>:
> Hi,

Hi.

> 
> There used to be a bug in the AMD driver if the local display is
> closed. There looked to be some kind of caching of the underlying HW
> resources when XOpenDisplay() is called with NULL or from an explicit
> display-name that was formerly used.

I was hoping absence of XCloseDisplay() in xvba-va-driver was just oversight.
Unfortunately I think that bug (or that kind of bug) is still there in fglrx. I've seen
SIGSEGVs after calling XCloseDisplay().

> 
> If you don't see any crash in most player applications (mplayer,
> gstreamer-vaapi, vlc, etc.), this means that bug was fixed and the
> patch is OK. It would also be interesting if you could manage to find
> the exact version of fglrx that fixed the bug. :)

I've not tested it thoroughly, but I don't remember mplayer-vaapi crashing
on that system with patch applied.
I don't think I will be able to do any of tests soon, since I don't have access
to any AMD-based video hardware now.

Sorry for noise. 

> 
> Thanks,
> Gwenole.

Thank you for the response.

> 
> 2013/4/19 Rinat Ibragimov <ibragimovrinat at mail.ru>:
> > Hi.
> >
> > Don't know where to report xvba-va-driver issue I faced. Hope it's ok
> > to do it here.
> >
> > With xvba-va-driver the following code fails to do all 1000 iterations.
> > Inside vaInitialize xvba-va-driver opens connection to X server with
> > XOpenDisplay, but never closes it. So after around 200 iterations
> > vaInitialize returns an error.
> >
> > === cut 1 ===
> >
> > #include <va/va.h>
> > #include <va/va_x11.h>
> > #include <va/va_glx.h>
> > #include <assert.h>
> > #include <stdio.h>
> >
> > int main(void)
> > {
> >         int vmajor, vminor;
> >         Display *dpy;
> >         VADisplay va_dpy;
> >         dpy = XOpenDisplay(NULL);
> >         assert(dpy);
> >
> >         for (int k = 0; k < 1000; k ++) {
> >                 printf("k = %d\n", k);
> >                 va_dpy = vaGetDisplay(dpy);
> >                 VAStatus status = vaInitialize(va_dpy, &vmajor, &vminor);
> >                 if (VA_STATUS_SUCCESS != status)
> >                         return 1;
> >                 vaTerminate(va_dpy);
> >         }
> >
> >         XCloseDisplay(dpy);
> > }
> >
> > === cut 1 ===
> >
> >
> > This patch solves problem for me.
> >
> > === cut 2 ===
> >
> > diff -ur xvba-video-0.8.0/src/xvba_driver.c xvba-video-0.8.0-n/src/xvba_driver.c
> > --- xvba-video-0.8.0/src/xvba_driver.c  2011-06-14 15:07:13.000000000 +0400
> > +++ xvba-video-0.8.0-n/src/xvba_driver.c        2013-04-19 15:28:00.000000000 +0400
> > @@ -125,6 +125,8 @@
> >      }
> >
> >      xvba_gate_exit();
> > +    if (driver_data->x11_dpy_local)
> > +        XCloseDisplay(driver_data->x11_dpy_local);
> >  }
> >
> >  // vaInitialize
> >
> >
> > === cut 2 ===
> >
> >
> > ---
> > Rinat
> 

---
Rinat


More information about the Libva mailing list