drm: Branch 'master' - 2 commits
[email protected] (GitLab Mirror) Wed, 3 Jul 2019 11:39:01 +0000 (UTC)
| Newsgroups | gmane.comp.video.dri.patches |
|---|---|
| Message-ID | <[email protected]> |
xf86drm.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) New commits: commit 293b95e81531dbfc1327cbaae125cc13e7fb074d Author: Jonathan Gray <[email protected]> Date: Mon May 13 02:52:04 2019 +1000 xf86drm: open correct render node on non-linux drm render nodes have the same major as drm primary devices but offset the minor by a base of 128. I expected the name of the device to have numbering starting at 0 when these non-linux codepaths were added (before OpenBSD had render nodes). Signed-off-by: Jonathan Gray <[email protected]> Acked-by: Eric Engestrom <[email protected]> diff --git a/xf86drm.c b/xf86drm.c index 39a82063..33624305 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -2904,7 +2904,7 @@ static char *drmGetMinorNameForFD(int fd, int type) char buf[PATH_MAX + 1]; const char *dev_name; unsigned int maj, min; - int n, base; + int n; if (fstat(fd, &sbuf)) return NULL; @@ -2929,11 +2929,7 @@ static char *drmGetMinorNameForFD(int fd, int type) return NULL; }; - base = drmGetMinorBase(type); - if (base < 0) - return NULL; - - n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min - base); + n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min); if (n == -1 || n >= sizeof(buf)) return NULL; @@ -3827,7 +3823,7 @@ drm_public int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) char node[PATH_MAX + 1]; const char *dev_name; int node_type, subsystem_type; - int maj, min, n, ret, base; + int maj, min, n, ret; if (fd == -1 || device == NULL) return -EINVAL; @@ -3859,11 +3855,7 @@ drm_public int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) return -EINVAL; }; - base = drmGetMinorBase(node_type); - if (base < 0) - return -EINVAL; - - n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min - base); + n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min); if (n == -1 || n >= PATH_MAX) return -errno; if (stat(node, &sbuf)) @@ -4083,7 +4075,7 @@ drm_public char *drmGetDeviceNameFromFd2(int fd) char node[PATH_MAX + 1]; const char *dev_name; int node_type; - int maj, min, n, base; + int maj, min, n; if (fstat(fd, &sbuf)) return NULL; @@ -4112,11 +4104,7 @@ drm_public char *drmGetDeviceNameFromFd2(int fd) return NULL; }; - base = drmGetMinorBase(node_type); - if (base < 0) - return NULL; - - n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min - base); + n = snprintf(node, PATH_MAX, dev_name, DRM_DIR_NAME, min); if (n == -1 || n >= PATH_MAX) return NULL; commit 13e2c356039ab5270174c9401c120bc9df5e23a6 Author: Jonathan Gray <[email protected]> Date: Mon May 13 02:50:49 2019 +1000 xf86drm: test for render nodes before primary nodes 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 <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Eric Engestrom <[email protected]> diff --git a/xf86drm.c b/xf86drm.c index 953fc762..39a82063 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3141,10 +3141,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; @@ -3153,6 +3149,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; } --