libdrm: drmGetDeviceNameFromFd: Always return /dev/dri/ node for FreeBSD
Since we now always returns the /dev/dri/ node for drmGet<nodetype>DeviceNameFromFd, be consistant with the names returned in drmGetDeviceNameFromFd. Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>main
parent
f52e2b20ed
commit
5aa83dd6fa
15
xf86drm.c
15
xf86drm.c
|
@ -122,6 +122,7 @@ struct drm_pciinfo {
|
|||
static drmServerInfoPtr drm_server_info;
|
||||
|
||||
static bool drmNodeIsDRM(int maj, int min);
|
||||
static char *drmGetMinorNameForFD(int fd, int type);
|
||||
|
||||
drm_public void drmSetServerInfo(drmServerInfoPtr info)
|
||||
{
|
||||
|
@ -2776,24 +2777,16 @@ drm_public char *drmGetDeviceNameFromFd(int fd)
|
|||
{
|
||||
#ifdef __FreeBSD__
|
||||
struct stat sbuf;
|
||||
char dname[SPECNAMELEN];
|
||||
char name[SPECNAMELEN];
|
||||
int maj, min;
|
||||
int nodetype;
|
||||
|
||||
if (fstat(fd, &sbuf))
|
||||
return NULL;
|
||||
|
||||
maj = major(sbuf.st_rdev);
|
||||
min = minor(sbuf.st_rdev);
|
||||
|
||||
if (!drmNodeIsDRM(maj, min) || !S_ISCHR(sbuf.st_mode))
|
||||
return NULL;
|
||||
|
||||
if (!devname_r(sbuf.st_rdev, S_IFCHR, dname, sizeof(dname)))
|
||||
return NULL;
|
||||
|
||||
snprintf(name, sizeof(name), "/dev/%s", dname);
|
||||
return strdup(name);
|
||||
nodetype = drmGetMinorType(maj, min);
|
||||
return drmGetMinorNameForFD(fd, nodetype);
|
||||
#else
|
||||
char name[128];
|
||||
struct stat sbuf;
|
||||
|
|
Loading…
Reference in New Issue