[Libva] Running libva applications without X
Mark Phelan
markthomasphelan at gmail.com
Wed Aug 28 14:36:48 PDT 2013
Gwenole Beauchesne <gb.devel at ...> writes:
>
> Hi,
>
> 2013/4/13 Jonathan Haws <Jonathan.Haws at ...>:
>
> > However, I don't have X setup or configured since I don't need it or
want it. Is there a way around this? Is
> there a way I can get X configured solely to provide me with this? Can I
simply pass a NULL pointer to this (I
> would doubt it)? I don't want to do any sort of displaying of the video -
just decoding.
> >
> > Are there better ways to do this? Am I on the right track? How can I
get my headless system ready to use VAAPI
> without a full blown window manager?
>
> You need to look into the VA/DRM API. I think I had sample code set in
> place in hwdecode-demos (vo_drm.c). This will work as long as you
> don't have an X server running and that you don't expect several users
> to do the same thing at the same time, i.e. access to the HW.
>
> It's very simple, you just need to create a VA display with
> vaGetDisplayDRM() instead of vaGetDisplay() used for X11. In the
> former case, you pass on a file descriptor to an open GPU device.
> Either you use libudev to determine the correct device path, or you
> have a consistent system and you could just open /dev/dri/card0
> instead.
>
> Regards,
> Gwenole.
>
Sorry to highjack this thread, but I'm trying to do the same thing and since
there aren't many of us out there, I figured this would be as good a place
as any to ask. I'm fairly new to all this, but have spent the last month
reading up extensively. Hopefully someone can help me.
I got vaGetDisplayDRM() to work and the returned display is passed into
vaInitialize(). However, I want 4 of the same application running, and
vaInitialize() fails on the 2-4 instances. I had the 4 instances all
running well using X11 and vaGetDisplay, so I'm very confident this has
something to do with the switch to not using X11.
a section of the code:
#ifdef HEADLESS_MODE
//for headless (no X11)
int drm_device = -1;
drm_device = open(DRM_DEVICE_PATH, O_RDWR|O_CLOEXEC);
std::cout << "mtp:: drm_device= " << drm_device << std::endl;
if(drm_device < 0)
{
std::cout << "mtp:: GPU device not found...Exiting" << std::endl;
exit(-1);
}
mVADisplay = vaGetDisplayDRM(drm_device);
if(!mVADisplay)
std::cout << "mtp:: Not a valid display" << std::endl;
close(drm_device);
if(!mVADisplay)
std::cout << "mtp:: Not a valid display::2nd" << std::endl;
#else
//for X11 use
mX11Display = XOpenDisplay(":0.0");
assert(mX11Display);
mVADisplay = vaGetDisplay(mX11Display);
#endif
mVAStatus = vaInitialize(mVADisplay, &maj, &min);
checkVAStatus("vaInitialize");
Thanks for any help anyone can provide!
More information about the Libva
mailing list