[Libva] using libva video compression on system with no monitor

Xiang, Haihao haihao.xiang at intel.com
Thu Aug 16 09:23:18 PDT 2012


> -----Original Message-----
> From: rlandle at gdrs.com [mailto:rlandle at gdrs.com]
> Sent: Thursday, August 16, 2012 8:45 PM
> To: gb.devel at gmail.com; Xiang, Haihao
> Cc: libva at lists.freedesktop.org
> Subject: RE: [Libva] using libva video compression on system with no monitor
> 
> I agree with Gwenole.
> I verified that I am in the video group, and I changed the file mode and group
> of /dev/dri/card0 but it did not help.
> 
> >>ls -l /dev/dri/card0
> crw-rw----+ 1 root video 226, 0 Aug 16 07:46 /dev/dri/card0
> 
> I can only get this to work with "root" privileges.

The master fd is always authenticated in DRM

        /* if there is no current master make this fd it */
        mutex_lock(&dev->struct_mutex);
        if (!priv->minor->master) {
                /* create a new master */
                priv->minor->master = drm_master_create(priv->minor);
                if (!priv->minor->master) {
                        mutex_unlock(&dev->struct_mutex);
                        ret = -ENOMEM;
                        goto out_free;
                }

                priv->is_master = 1;      <====  mark it as master
                /* take another reference for the copy in the local file priv */
                priv->master = drm_master_get(priv->minor->master);

                priv->authenticated = 1;  <====  authenticated   
           ......
       }	

Is there any other process that is accessing /dev/dri/card0 before you run VAAPI application ? If yes, 
The opened fd=open("/dev/dri/card0", ...) in this VAAPI application isn't the master fd.

In addition, ioctl DRM_IOCTL_AUTH_MAGIC doesn't need root privileges (drmAuthMagic is the wrapper of ioctl(fd, DRM_IOCTL_AUTH_MAGIC, ...))

       DRM_IOCTL_DEF(DRM_IOCTL_AUTH_MAGIC, drm_authmagic, DRM_AUTH|DRM_MASTER),

As you see, DRM_ROOT_ONLY isn't needed although it is also authenticated for root in DRM.

On the other hand, va_drm won't call drmAuthMagic() for the master fd because va_drm_is_authenticated() returns true.

Thanks
Haihao


> 
> 
> 
> 
> -----Original Message-----
> From: Gwenole Beauchesne [mailto:gb.devel at gmail.com]
> Sent: Thursday, August 16, 2012 4:25 AM
> To: Xiang, Haihao
> Cc: Robert J. Landle; libva at lists.freedesktop.org
> Subject: Re: [Libva] using libva video compression on system with no monitor
> 
> Hi,
> 
> 2012/8/16 Xiang, Haihao <haihao.xiang at intel.com>:
> 
> >> I see a comment in /va/drm/va_drm_auth.c
> >>
> >>  /* Default: root + master privs are needed for the following call */
> >
> > Master is enough.
> 
> Master requires "root" privileges.
> 
> > That is because the permission is wrong for you. Usually the file mode
> > of /dev/dri/card0 is
> >
> > crw-rw---- 1 root video 226, 0 2012-08-16 08:55 /dev/dri/card0
> >
> > So either add the user into video group or change the file mode.
> 
> The other condition is to *not* have any X server running, or that you provide
> a valid DISPLAY in that case.
> 
> Regards,
> Gwenole.
> 
> -------------------------------------------------------
> This is an e-mail from General Dynamics Robotic Systems. It is for the intended
> recipient only and may contain confidential and privileged information. No
> one else may read, print, store, copy, forward or act in reliance on it or its
> attachments. If you are not the intended recipient, please return this message
> to the sender and delete the message and any attachments from your
> computer. Your cooperation is appreciated.



More information about the Libva mailing list