xf86drm: use the correct device minor names on OpenBSD

Add defines for the device minor names and make use of them
in drmGetMinorName() so the correct paths will be used on OpenBSD.

v2: don't add new defines to xf86drm.h to keep them out of the API
    as requested by Emil.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
main
Jonathan Gray 2015-07-21 03:12:56 +10:00 committed by Emil Velikov
parent 66c3afb75f
commit fc083322b0
2 changed files with 20 additions and 3 deletions

View File

@ -64,6 +64,16 @@
#include "xf86drm.h" #include "xf86drm.h"
#include "libdrm_macros.h" #include "libdrm_macros.h"
#ifdef __OpenBSD__
#define DRM_PRIMARY_MINOR_NAME "drm"
#define DRM_CONTROL_MINOR_NAME "drmC"
#define DRM_RENDER_MINOR_NAME "drmR"
#else
#define DRM_PRIMARY_MINOR_NAME "card"
#define DRM_CONTROL_MINOR_NAME "controlD"
#define DRM_RENDER_MINOR_NAME "renderD"
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
#define DRM_MAJOR 145 #define DRM_MAJOR 145
#endif #endif
@ -525,11 +535,11 @@ static const char *drmGetMinorName(int type)
{ {
switch (type) { switch (type) {
case DRM_NODE_PRIMARY: case DRM_NODE_PRIMARY:
return "card"; return DRM_PRIMARY_MINOR_NAME;
case DRM_NODE_CONTROL: case DRM_NODE_CONTROL:
return "controlD"; return DRM_CONTROL_MINOR_NAME;
case DRM_NODE_RENDER: case DRM_NODE_RENDER:
return "renderD"; return DRM_RENDER_MINOR_NAME;
default: default:
return NULL; return NULL;
} }

View File

@ -76,11 +76,18 @@ extern "C" {
(S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
#ifdef __OpenBSD__
#define DRM_DIR_NAME "/dev"
#define DRM_DEV_NAME "%s/drm%d"
#define DRM_CONTROL_DEV_NAME "%s/drmC%d"
#define DRM_RENDER_DEV_NAME "%s/drmR%d"
#else
#define DRM_DIR_NAME "/dev/dri" #define DRM_DIR_NAME "/dev/dri"
#define DRM_DEV_NAME "%s/card%d" #define DRM_DEV_NAME "%s/card%d"
#define DRM_CONTROL_DEV_NAME "%s/controlD%d" #define DRM_CONTROL_DEV_NAME "%s/controlD%d"
#define DRM_RENDER_DEV_NAME "%s/renderD%d" #define DRM_RENDER_DEV_NAME "%s/renderD%d"
#define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */ #define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */
#endif
#define DRM_ERR_NO_DEVICE (-1001) #define DRM_ERR_NO_DEVICE (-1001)
#define DRM_ERR_NO_ACCESS (-1002) #define DRM_ERR_NO_ACCESS (-1002)