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