[Libva] linux vaapi without graphical env

Nik Orlov nikitos1550 at yandex.ru
Fri Mar 28 04:21:11 PDT 2014


It is possible to do multipass h.264 encoding with VAAPI, like with x.264, when it is saves stats log?

28.03.2014, 05:22, "Zhao Yakui" <yakui.zhao at intel.com>:
> On Thu, 2014-03-27 at 10:46 -0600, Nik Orlov wrote:
>
>>  Hello! Thanks!
>>
>>  As I see, libva can use X11 or direct DRM, and it can`t use DRM when system has running X11. Am I right?
>>  I will have research (google) about relations between dri and drm.
>
> Hi, Nik
>
>     What Matt said is right. The libva can work with X11 or DRM.
> The h264encode example can show you how to use it without X11.
> Even when X11 is already started, the h264encode still can use the DRM
> to encode. The following code can be used to run the encoding with DRM.
> (It is found in the file of libva/test/common/va_display_drm.c)
> {
>     VADisplay va_dpy;
>     drm_fd = open("/dev/dri/card0", O_RDWR);
>     if (drm_fd < 0) {
>         fprintf(stderr, "error: can't open DRM connection!\n");
>         return NULL;
>     }
>     va_dpy = vaGetDisplayDRM(drm_fd);
> }
>
> Thanks.
>    Yakui
>
>>  27.03.2014, 20:01, "Matt Pekar" <mpekar at raineyelectronics.com>:
>>>  I'm not sure of the exact relationship between dri and drm (maybe dri became drm?), but you can use it/them to run libva without X.
>>>
>>>  In our code, we first attempt to initialize libva with X11 (for desktop development), then a secondary attempt is made to initialize through DRM (which is how our program runs in production).
>>>
>>>  The tricky part is that DRM requires some elevated permissions, and we made some changes to the va_drm_auth.c file to accommodate that better for us.
>>>
>>>  The code is something along these lines:
>>>
>>>  VADisplay va_display;
>>>
>>>  printf("attempting to connect through X");
>>>  Display* x11_display = XOpenDisplay(":0.0");
>>>  if(x11_display != NULL)
>>>  {
>>>  printf("connected through X");
>>>  va_display = vaGetDisplay(x11_display);
>>>  return;
>>>  }
>>>
>>>  printf("attempting to connect through drm");
>>>  int drm_fd = open("/dev/dri/card0", O_RDWR);
>>>  if (element->drm_fd > 0)
>>>  {
>>>  printf("connected through drm on /dev/dri/card0");
>>>
>>>  va_display = vaGetDisplayDRM(element->drm_fd);
>>>
>>>  return;
>>>  }
>>>
>>>  //error
>>>
>>>  On Thu, Mar 27, 2014 at 8:32 AM, Nik Orlov <nikitos1550 at yandex.ru> wrote:
>>>>  Hello!
>>>>
>>>>  As I have read here (http://www.freedesktop.org/wiki/Software/vaapi/)
>>>>
>>>>  The current video decode/encode interface is window system independent, so that potentially it can be used with graphics sub-systems other than X. In a nutshell it is basically a scheme to pass various types of data buffers from the application to the GPU for decoding or encoding. Feedback on the API is greatly welcomed, as this is intended to be a community collaborative effort.
>>>>
>>>>  So, there is some way to setup debian or ubuntu without Xorg to use libva.
>>>>  Maybe someone show me right way? At the moment I don`t know infrustructure of libva.
>>>>
>>>>  There is schem from wiki (http://en.wikipedia.org/wiki/Video_Acceleration_API) http://en.wikipedia.org/wiki/File:Vaapi_illustration.svg
>>>>  I don`t understand VA Hardware Driver needs to use all DRILib, DRMLib and direct access to hardware OR it can use one of them?
>>>>
>>>>  According to sources of h264encoding test from libva-1.1.1 it uses some functions with display
>>>>
>>>>      va_dpy = va_open_display();
>>>>      va_status = vaInitialize(va_dpy, &major_ver, &minor_ver);
>>>>      CHECK_VASTATUS(va_status, "vaInitialize");
>>>>
>>>>  It seems I still Xorg to use this features, or there is another way?
>>>>
>>>>  --
>>>>  Ник Орлов mailto:nikitos1550 at yandex.ru
>>>>  _______________________________________________
>>>>  Libva mailing list
>>>>  Libva at lists.freedesktop.org
>>>>  http://lists.freedesktop.org/mailman/listinfo/libva

-- 
Ник Орлов mailto:nikitos1550 at yandex.ru


More information about the Libva mailing list