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

Gwenole Beauchesne gb.devel at gmail.com
Wed Jul 3 09:59:14 PDT 2013


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.

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. :)

Thanks,
Gwenole.

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


More information about the Libva mailing list