mirror of
https://github.com/openbsd/xenocara.git
synced 2025-12-14 05:08:53 +00:00
fix drmGetMinorNameForFD(). tweaks and ok jsg@.
For the gpu n, the main device node is /dev/dri/card<n> and the render device node is /dev/dri/renderD<n+drmGetMinorBase()> not /dev/dri/renderD<n> and miod@ checked that no port should be affected.
This commit is contained in:
@@ -846,7 +846,7 @@ static int
|
|||||||
_priv_open_device(const char *path)
|
_priv_open_device(const char *path)
|
||||||
{
|
{
|
||||||
drmMsg("_priv_open_device\n");
|
drmMsg("_priv_open_device\n");
|
||||||
return open(path, O_RDWR, 0);
|
return open(path, O_RDWR);
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_public int priv_open_device(const char *)
|
drm_public int priv_open_device(const char *)
|
||||||
@@ -3539,6 +3539,10 @@ static char *drmGetMinorNameForFD(int fd, int type)
|
|||||||
const char *dev_name = drmGetDeviceName(type);
|
const char *dev_name = drmGetDeviceName(type);
|
||||||
unsigned int maj, min;
|
unsigned int maj, min;
|
||||||
int n;
|
int n;
|
||||||
|
int base = drmGetMinorBase(type);
|
||||||
|
|
||||||
|
if (base < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (fstat(fd, &sbuf))
|
if (fstat(fd, &sbuf))
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -3552,7 +3556,7 @@ static char *drmGetMinorNameForFD(int fd, int type)
|
|||||||
if (!dev_name)
|
if (!dev_name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, min);
|
n = snprintf(buf, sizeof(buf), dev_name, DRM_DIR_NAME, base + min);
|
||||||
if (n == -1 || n >= sizeof(buf))
|
if (n == -1 || n >= sizeof(buf))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user