Rename the device to be /dev/dri instead of /dev/dri to avoid a conflict.
Rename proc entry from /proc/graphics to /proc/dri to be consistent.main
parent
46e1467a83
commit
0371c290a1
|
@ -148,7 +148,7 @@ static int drm_open(const char *file)
|
|||
|
||||
int drmAvailable(void)
|
||||
{
|
||||
if (!access("/proc/graphics/0", R_OK)) return 1;
|
||||
if (!access("/proc/dri/0", R_OK)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ static int drmOpenByBusid(const char *busid)
|
|||
int fd;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
sprintf(dev_name, "/dev/graphics/card%d", i);
|
||||
sprintf(dev_name, "/dev/dri/card%d", i);
|
||||
if ((fd = drm_open(dev_name)) >= 0) {
|
||||
buf = drmGetBusid(fd);
|
||||
if (buf && !strcmp(buf, busid)) {
|
||||
|
@ -224,14 +224,14 @@ static int drmOpenByName(const char *name)
|
|||
if (dirmode & S_IRGRP) dirmode |= S_IXGRP;
|
||||
if (dirmode & S_IROTH) dirmode |= S_IXOTH;
|
||||
dirmode &= ~(S_IWGRP | S_IWOTH);
|
||||
mkdir("/dev/graphics", 0);
|
||||
chown("/dev/graphics", user, group);
|
||||
chmod("/dev/graphics", dirmode);
|
||||
mkdir("/dev/dri", 0);
|
||||
chown("/dev/dri", user, group);
|
||||
chmod("/dev/dri", dirmode);
|
||||
}
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
sprintf(proc_name, "/proc/graphics/%d/name", i);
|
||||
sprintf(dev_name, "/dev/graphics/card%d", i);
|
||||
sprintf(proc_name, "/proc/dri/%d/name", i);
|
||||
sprintf(dev_name, "/dev/dri/card%d", i);
|
||||
if ((fd = open(proc_name, 0, 0)) >= 0) {
|
||||
retcode = read(fd, buf, sizeof(buf)-1);
|
||||
close(fd);
|
||||
|
@ -260,7 +260,7 @@ static int drmOpenByName(const char *name)
|
|||
}
|
||||
|
||||
/* drmOpen looks up the specified name and busid, and opens the device
|
||||
found. The entry in /dev/graphics is created if necessary (and if root).
|
||||
found. The entry in /dev/dri is created if necessary (and if root).
|
||||
A file descriptor is returned. On error, the return value is
|
||||
negative. */
|
||||
|
||||
|
|
16
linux/proc.c
16
linux/proc.c
|
@ -79,26 +79,26 @@ int drm_proc_init(drm_device_t *dev)
|
|||
struct proc_dir_entry *ent;
|
||||
int i, j;
|
||||
|
||||
drm_root = create_proc_entry("graphics", S_IFDIR, NULL);
|
||||
drm_root = create_proc_entry("dri", S_IFDIR, NULL);
|
||||
if (!drm_root) {
|
||||
DRM_ERROR("Cannot create /proc/graphics\n");
|
||||
DRM_ERROR("Cannot create /proc/dri\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Instead of doing this search, we should
|
||||
add some global support for /proc/graphics. */
|
||||
add some global support for /proc/dri. */
|
||||
for (i = 0; i < 8; i++) {
|
||||
sprintf(drm_slot_name, "graphics/%d", i);
|
||||
sprintf(drm_slot_name, "dri/%d", i);
|
||||
drm_dev_root = create_proc_entry(drm_slot_name, S_IFDIR, NULL);
|
||||
if (!drm_dev_root) {
|
||||
DRM_ERROR("Cannot create /proc/%s\n", drm_slot_name);
|
||||
remove_proc_entry("graphics", NULL);
|
||||
remove_proc_entry("dri", NULL);
|
||||
}
|
||||
if (drm_dev_root->nlink == 2) break;
|
||||
drm_dev_root = NULL;
|
||||
}
|
||||
if (!drm_dev_root) {
|
||||
DRM_ERROR("Cannot find slot in /proc/graphics\n");
|
||||
DRM_ERROR("Cannot find slot in /proc/dri\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ int drm_proc_init(drm_device_t *dev)
|
|||
remove_proc_entry(drm_proc_list[i].name,
|
||||
drm_dev_root);
|
||||
remove_proc_entry(drm_slot_name, NULL);
|
||||
remove_proc_entry("graphics", NULL);
|
||||
remove_proc_entry("dri", NULL);
|
||||
return -1;
|
||||
}
|
||||
ent->read_proc = drm_proc_list[i].f;
|
||||
|
@ -135,7 +135,7 @@ int drm_proc_cleanup(void)
|
|||
}
|
||||
remove_proc_entry(drm_slot_name, NULL);
|
||||
}
|
||||
remove_proc_entry("graphics", NULL);
|
||||
remove_proc_entry("dri", NULL);
|
||||
remove_proc_entry(DRM_NAME, NULL);
|
||||
}
|
||||
drm_root = drm_dev_root = NULL;
|
||||
|
|
|
@ -218,8 +218,8 @@ int main(int argc, char **argv)
|
|||
info->list[i].low_mark,
|
||||
info->list[i].high_mark);
|
||||
}
|
||||
printf("===== /proc/graphics/0/mem =====\n");
|
||||
sprintf(buf, "cat /proc/graphics/0/mem");
|
||||
printf("===== /proc/dri/0/mem =====\n");
|
||||
sprintf(buf, "cat /proc/dri/0/mem");
|
||||
system(buf);
|
||||
#if 1
|
||||
if (!(bufs = drmMapBufs(fd))) {
|
||||
|
@ -234,8 +234,8 @@ int main(int argc, char **argv)
|
|||
bufs->list[i].total,
|
||||
bufs->list[i].address);
|
||||
}
|
||||
printf("===== /proc/graphics/0/vma =====\n");
|
||||
sprintf(buf, "cat /proc/graphics/0/vma");
|
||||
printf("===== /proc/dri/0/vma =====\n");
|
||||
sprintf(buf, "cat /proc/dri/0/vma");
|
||||
system(buf);
|
||||
#endif
|
||||
break;
|
||||
|
@ -249,8 +249,8 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
printf("0x%08lx:0x%04lx added\n", offset, size);
|
||||
printf("===== /proc/graphics/0/mem =====\n");
|
||||
sprintf(buf, "cat /proc/graphics/0/mem");
|
||||
printf("===== /proc/dri/0/mem =====\n");
|
||||
sprintf(buf, "cat /proc/dri/0/mem");
|
||||
system(buf);
|
||||
break;
|
||||
case 'r':
|
||||
|
@ -266,8 +266,8 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
printf("0x%08lx:0x%04lx added\n", offset, size);
|
||||
printf("===== /proc/graphics/0/mem =====\n");
|
||||
sprintf(buf, "cat /proc/graphics/0/mem");
|
||||
printf("===== /proc/dri/0/mem =====\n");
|
||||
sprintf(buf, "cat /proc/dri/0/mem");
|
||||
system(buf);
|
||||
break;
|
||||
case 's':
|
||||
|
@ -280,7 +280,7 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
printf("0x%04lx byte shm added at 0x%08lx\n", size, handle);
|
||||
sprintf(buf, "cat /proc/graphics/0/vm");
|
||||
sprintf(buf, "cat /proc/dri/0/vm");
|
||||
system(buf);
|
||||
break;
|
||||
case 'P':
|
||||
|
@ -293,12 +293,12 @@ int main(int argc, char **argv)
|
|||
}
|
||||
printf("0x%08lx:0x%04lx mapped at %p for pid %d\n",
|
||||
offset, size, address, getpid());
|
||||
printf("===== /proc/graphics/0/vma =====\n");
|
||||
sprintf(buf, "cat /proc/graphics/0/vma");
|
||||
printf("===== /proc/dri/0/vma =====\n");
|
||||
sprintf(buf, "cat /proc/dri/0/vma");
|
||||
system(buf);
|
||||
mprotect((void *)offset, size, PROT_READ);
|
||||
printf("===== /proc/graphics/0/vma =====\n");
|
||||
sprintf(buf, "cat /proc/graphics/0/vma");
|
||||
printf("===== /proc/dri/0/vma =====\n");
|
||||
sprintf(buf, "cat /proc/dri/0/vma");
|
||||
system(buf);
|
||||
break;
|
||||
case 'w':
|
||||
|
@ -316,10 +316,10 @@ int main(int argc, char **argv)
|
|||
sprintf(buf, "cat /proc/%d/maps", getpid());
|
||||
system(buf);
|
||||
printf("===== /proc/grphics/0/mem =====\n");
|
||||
sprintf(buf, "cat /proc/graphics/0/mem");
|
||||
sprintf(buf, "cat /proc/dri/0/mem");
|
||||
system(buf);
|
||||
printf("===== /proc/graphics/0/vma =====\n");
|
||||
sprintf(buf, "cat /proc/graphics/0/vma");
|
||||
printf("===== /proc/dri/0/vma =====\n");
|
||||
sprintf(buf, "cat /proc/dri/0/vma");
|
||||
system(buf);
|
||||
printf("===== READING =====\n");
|
||||
for (i = 0; i < 0x10; i++)
|
||||
|
@ -336,8 +336,8 @@ int main(int argc, char **argv)
|
|||
for (i = 0; i < 0x10; i++)
|
||||
printf("%02x ", (unsigned int)((unsigned char *)address)[i]);
|
||||
printf("\n");
|
||||
printf("===== /proc/graphics/0/vma =====\n");
|
||||
sprintf(buf, "cat /proc/graphics/0/vma");
|
||||
printf("===== /proc/dri/0/vma =====\n");
|
||||
sprintf(buf, "cat /proc/dri/0/vma");
|
||||
system(buf);
|
||||
break;
|
||||
case 'L':
|
||||
|
|
Loading…
Reference in New Issue