mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-02-09 00:20:33 +01:00
modesetting: find the first compatible dri device as default
This change replaces the default "/dev/dri/card0" by a loop which searches for the first compatible device. This change avoids the error below which happens on some ARM boards: (EE) No devices detected. (EE) Fatal server error: (EE) no screens found(EE) (EE) Signed-off-by: Patrick Lerda <patrick9876@free.fr>
This commit is contained in:
parent
43f47e8e65
commit
df040e455b
1 changed files with 17 additions and 2 deletions
|
|
@ -227,6 +227,7 @@ get_passed_fd(void)
|
|||
static int
|
||||
open_hw(const char *dev)
|
||||
{
|
||||
char drm_name[] = "/dev/dri/card0";
|
||||
int fd;
|
||||
|
||||
if ((fd = get_passed_fd()) != -1)
|
||||
|
|
@ -237,8 +238,22 @@ open_hw(const char *dev)
|
|||
else {
|
||||
dev = getenv("KMSDEVICE");
|
||||
if ((NULL == dev) || ((fd = open(dev, O_RDWR | O_CLOEXEC, 0)) == -1)) {
|
||||
dev = "/dev/dri/card0";
|
||||
fd = open(dev, O_RDWR | O_CLOEXEC, 0);
|
||||
int i;
|
||||
|
||||
for (i = 0, dev=drm_name; i < 8; i++) {
|
||||
drm_name[13] = '0' + i;
|
||||
|
||||
if ((fd = open(drm_name, O_RDWR | O_CLOEXEC, 0)) >= 0) {
|
||||
uint64_t check_dumb = 0;
|
||||
|
||||
if (drmGetCap(fd, DRM_CAP_DUMB_BUFFER, &check_dumb) >= 0 && check_dumb)
|
||||
break;
|
||||
|
||||
close(fd);
|
||||
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fd == -1)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue