[PATCH libdrm] xf86drm: test for render nodes before primary nodes

Jonathan Gray jsg at jsg.id.au
Sun May 12 16:50:49 UTC 2019


Unlike Linux the OpenBSD primary "drm" device name is substring of the
"drmR" render node device name and strncmp() tests resulted in render
nodes being flagged as primary nodes.

Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
---
 xf86drm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index 2858d826..42022cac 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3168,10 +3168,6 @@ drm_public int drmDevicesEqual(drmDevicePtr a, drmDevicePtr b)
 
 static int drmGetNodeType(const char *name)
 {
-    if (strncmp(name, DRM_PRIMARY_MINOR_NAME,
-        sizeof(DRM_PRIMARY_MINOR_NAME) - 1) == 0)
-        return DRM_NODE_PRIMARY;
-
     if (strncmp(name, DRM_CONTROL_MINOR_NAME,
         sizeof(DRM_CONTROL_MINOR_NAME ) - 1) == 0)
         return DRM_NODE_CONTROL;
@@ -3180,6 +3176,10 @@ static int drmGetNodeType(const char *name)
         sizeof(DRM_RENDER_MINOR_NAME) - 1) == 0)
         return DRM_NODE_RENDER;
 
+    if (strncmp(name, DRM_PRIMARY_MINOR_NAME,
+        sizeof(DRM_PRIMARY_MINOR_NAME) - 1) == 0)
+        return DRM_NODE_PRIMARY;
+
     return -EINVAL;
 }
 
-- 
2.21.0



More information about the dri-devel mailing list