[Libva] Use libva as user without X

Thomas Scheuermann scheuermann at barco.com
Wed Oct 8 23:34:20 PDT 2014


Hi Haihao,

Am 09.10.2014 um 04:43 schrieb Xiang, Haihao:
> Hi,
>
> According to your log, drmGetClient() is called twice.
>
>>> ioctl(3, 0xc0286405, 0x7fffe00d6260)    = 0
>>> ioctl(3, 0xc0286405, 0x7fffe00d6260)    = -1
> Is /dev/dri/card0 using by other processes ? If yes, non-root user (non
> master user indeed) can't use /dev/dri/card0, unless you use render
> node. You can check /dev/dri/card0 is used or not by lsof:
>
> $> sudo lsof /dev/dri/card0
Thanks, this was the reason. plymouthd used /dev/dri/card0.
After stopping this daemon, everything worked.

Regards,

Thomas
>
> Thanks
> Haihao
>
>> Hi Gwenole,
>>
>> Am 08.10.2014 um 11:57 schrieb Gwenole Beauchesne:
>>> Hi Thomas,
>>>
>>> 2014-10-08 11:30 GMT+02:00 Thomas Scheuermann <scheuermann at barco.com>:
>>>> Hi,
>>>>
>>>> how can I use libva as non-root user on a system without X running?
>>> - Check what group /dev/dri/card<n> or /dev/dri/renderD<n|0x80> belongs to
>>> - Add your user to that group
>> My user is in the video group and the device  is:
>> crw-rw---- 1 root video 226,  0 Oct  8 09:16 /dev/dri/card0
>> My kernel is 3.14
>> But it doesn't work.
>> My system is a debian wheezy with some backports like the kernel.
>>> e.g. on a Ubuntu system, /dev/dri/card0 is in the "video" group. If
>>> you want a user X to access to the device, just add user X to the
>>> "video" group too.
>>>
>>> Note: starting with Kernel >= 3.15, and with libva from git master,
>>> you can use the device without authentication. This means that you can
>>> have user Y logged in, and who has started a display server, while
>>> still allowing user X to remote connect and use the device.
>>>
>>>> If I run vainfo as a non-root user, I get
>>>>
>>>> $ vainfo
>>>> error: XDG_RUNTIME_DIR not set in the environment.
>>>> error: can't connect to X server!
>>>> libva info: VA-API version 0.35.1
>>>> libva info: va_getDriverName() returns 1
>>>> libva error: va_getDriverName() failed with operation
>>>> failed,driver_name=i965
>>>> vaInitialize failed with error code 1 (operation failed),exit
>>>>
>>>> If I do the same as root, I get
>>>>
>>>> # vainfo
>>>> error: XDG_RUNTIME_DIR not set in the environment.
>>>> error: can't connect to X server!
>>>> libva info: VA-API version 0.35.1
>>>> libva info: va_getDriverName() returns 0
>>>> libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
>>>> libva info: Found init function __vaDriverInit_0_35
>>>> libva info: va_openDriver() returns 0
>>>> vainfo: VA-API version: 0.35 (libva 1.3.1)
>>>> vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Mobile -
>>>> 1.3.2
>>>> vainfo: Supported profile and entrypoints
>>>>         VAProfileMPEG2Simple            :    VAEntrypointVLD
>>>>         VAProfileMPEG2Simple            :    VAEntrypointEncSlice
>>>>         VAProfileMPEG2Main              :    VAEntrypointVLD
>>>>         VAProfileMPEG2Main              :    VAEntrypointEncSlice
>>>>         VAProfileH264ConstrainedBaseline:    VAEntrypointVLD
>>>>         VAProfileH264ConstrainedBaseline:    VAEntrypointEncSlice
>>>>         VAProfileH264Main               :    VAEntrypointVLD
>>>>         VAProfileH264Main               :    VAEntrypointEncSlice
>>>>         VAProfileH264High               :    VAEntrypointVLD
>>>>         VAProfileH264High               :    VAEntrypointEncSlice
>>>>         VAProfileVC1Simple              :    VAEntrypointVLD
>>>>         VAProfileVC1Main                :    VAEntrypointVLD
>>>>         VAProfileVC1Advanced            :    VAEntrypointVLD
>>>>         VAProfileNone                   :    VAEntrypointVideoProc
>>>>         VAProfileJPEGBaseline           :    VAEntrypointVLD
>>>>
>>>> The difference is in the ioctl to /dev/dri/card0. As non-root user I get:
>>>>
>>>> ioctl(3, 0xc0406400, 0x14786c0)         = 0
>>>> ioctl(3, 0xc0406400, 0x14786c0)         = 0
>>>> ioctl(3, 0x80046402, 0x7fffe00d6300)    = 0
>>>> ioctl(3, 0xc0286405, 0x7fffe00d6260)    = 0
>>>> ioctl(3, 0xc0286405, 0x7fffe00d6260)    = -1 EINVAL (Invalid argument)
>>>> futex(0x7f549de7a0ec, FUTEX_WAKE_PRIVATE, 2147483647) = 0
>>>> ioctl(3, 0x40046411, 0x7fffe00d62e0)    = -1 EACCES (Permission denied)
>>>> write(2, "libva info: va_getDriverName() r"..., 41libva info:
>>>> va_getDriverName() returns 1
>>>> ) = 41
>>>> write(2, "libva error: va_getDriverName() "..., 78libva error:
>>>> va_getDriverName() failed with operation failed,driver_name=i965
>>>> ) = 78
>>>>
>>>> but as root I get:
>>>>
>>>> ioctl(3, 0xc0406400, 0x10656c0)         = 0
>>>> ioctl(3, 0xc0406400, 0x10656c0)         = 0
>>>> ioctl(3, 0x80046402, 0x7fff4a5b24b0)    = 0
>>>> ioctl(3, 0xc0286405, 0x7fff4a5b2410)    = 0
>>>> write(2, "libva info: va_getDriverName() r"..., 41libva info:
>>>> va_getDriverName() returns 0
>>>> ) = 41
>>>> geteuid()                               = 0
>>>> getuid()                                = 0
>>>> write(2, "libva info: Trying to open /usr/"..., 75libva info: Trying to
>>>> open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
>>>> ) = 75
>>>>
>>>> Regards,
>>>>
>>>> Thomas
>>>> This message is subject to the following terms and conditions: MAIL
>>>> DISCLAIMER<http://www.barco.com/en/maildisclaimer>
>>>> _______________________________________________
>>>> Libva mailing list
>>>> Libva at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/libva
>>> Regards,
>> This message is subject to the following terms and conditions: MAIL DISCLAIMER<http://www.barco.com/en/maildisclaimer>
>> _______________________________________________
>> Libva mailing list
>> Libva at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/libva
>

This message is subject to the following terms and conditions: MAIL DISCLAIMER<http://www.barco.com/en/maildisclaimer>


More information about the Libva mailing list