OSDN Git Service

drm: remove va_drm_is_authenticated check
authorEmil Velikov <emil.l.velikov@gmail.com>
Tue, 15 Nov 2016 15:24:15 +0000 (15:24 +0000)
committerSean V Kelley <seanvk@posteo.de>
Thu, 17 Nov 2016 22:38:19 +0000 (14:38 -0800)
If we do not use a render node we must authenticate. Doing the extra
GetClient calls/ioctls does not help much, so don't bother.

Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Sean V Kelley <seanvk@posteo.de>
va/drm/va_drm.c
va/drm/va_drm_auth.c
va/drm/va_drm_auth.h

index 08071cf..59e33fa 100644 (file)
@@ -74,12 +74,8 @@ va_DisplayContextGetDriverName(
         if (ret < 0)
             return VA_STATUS_ERROR_OPERATION_FAILED;
 
-        if (!va_drm_is_authenticated(drm_state->fd)) {
-            if (!va_drm_authenticate(drm_state->fd, magic))
-                return VA_STATUS_ERROR_OPERATION_FAILED;
-            if (!va_drm_is_authenticated(drm_state->fd))
-                return VA_STATUS_ERROR_OPERATION_FAILED;
-        }
+        if (!va_drm_authenticate(drm_state->fd, magic))
+            return VA_STATUS_ERROR_OPERATION_FAILED;
     }
 
     drm_state->auth_type = VA_DRM_AUTH_CUSTOM;
index 53794d3..592381d 100644 (file)
 #include "va_drm_auth.h"
 #include "va_drm_auth_x11.h"
 
-#if defined __linux__
-# include <sys/syscall.h>
-#endif
-
-/* Checks whether the thread id is the current thread */
-static bool
-is_local_tid(pid_t tid)
-{
-#if defined __linux__
-    /* On Linux systems, drmGetClient() would return the thread ID
-       instead of the actual process ID */
-    return syscall(SYS_gettid) == tid;
-#else
-    return false;
-#endif
-}
-
-/* Checks whether DRM connection is authenticated */
-bool
-va_drm_is_authenticated(int fd)
-{
-    pid_t client_pid;
-    int i, auth, pid, uid;
-    unsigned long magic, iocs;
-    bool is_authenticated = false;
-
-    client_pid = getpid();
-    for (i = 0; !is_authenticated; i++) {
-        if (drmGetClient(fd, i, &auth, &pid, &uid, &magic, &iocs) != 0)
-            break;
-        is_authenticated = auth && (pid == client_pid || is_local_tid(pid));
-    }
-    return is_authenticated;
-}
-
 /* Try to authenticate the DRM connection with the supplied magic id */
 bool
 va_drm_authenticate(int fd, uint32_t magic)
index 1aa6989..a8ca794 100644 (file)
 
 DLL_HIDDEN
 bool
-va_drm_is_authenticated(int fd);
-
-DLL_HIDDEN
-bool
 va_drm_authenticate(int fd, uint32_t magic);
 
 #endif /* VA_DRM_AUTH_H */