app_server: Treat the framebuffer driver as a special case like VESA.

This should resolve the problems where the framebuffer driver was
getting picked instead of the "real" graphics driver, when available,
which led to the framebuffer driver getting merged back into the VESA
driver.

Change-Id: I4ad00d2ac3b5dda34aa63f8691d4cbb85e4f6bb5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4616
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2021-10-20 17:12:21 +00:00
committed by waddlesplash
parent 66415cd209
commit 411ccfeb96
2 changed files with 19 additions and 12 deletions
+10 -7
View File
@@ -409,17 +409,16 @@ DWindowHWInterface::_OpenGraphicsDevice(int deviceNumber)
if (!directory)
return -1;
// ToDo: the former R5 "stub" driver is called "vesa" under Haiku; however,
// we do not need to avoid this driver this way when is has been ported
// to the new driver architecture - the special case here can then be
// removed.
// TODO: We do not need to avoid the "vesa" or "framebuffer" drivers this way
// once they been ported to the new driver architecture - the special case here
// can then be removed.
int count = 0;
struct dirent *entry = NULL;
int current_card_fd = -1;
char path[PATH_MAX];
while (count < deviceNumber && (entry = readdir(directory)) != NULL) {
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") ||
!strcmp(entry->d_name, "stub") || !strcmp(entry->d_name, "vesa"))
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")
|| !strcmp(entry->d_name, "vesa") || !strcmp(entry->d_name, "framebuffer"))
continue;
if (current_card_fd >= 0) {
@@ -433,11 +432,15 @@ DWindowHWInterface::_OpenGraphicsDevice(int deviceNumber)
count++;
}
// Open VESA driver if we were not able to get a better one
// Open VESA or Framebuffer driver if we were not able to get a better one.
if (count < deviceNumber) {
if (deviceNumber == 1) {
sprintf(path, "/dev/graphics/vesa");
current_card_fd = open(path, B_READ_WRITE);
if (current_card_fd < 0) {
sprintf(path, "/dev/graphics/framebuffer");
current_card_fd = open(path, B_READ_WRITE);
}
} else {
close(current_card_fd);
current_card_fd = B_ENTRY_NOT_FOUND;
@@ -241,14 +241,14 @@ AccelerantHWInterface::_OpenGraphicsDevice(int deviceNumber)
int device = -1;
int count = 0;
if (!use_fail_safe_video_mode()) {
// TODO: We do not need to avoid the "vesa" driver this way once it has
// been ported to the new driver architecture - the special case here
// TODO: We do not need to avoid the "vesa" or "framebuffer" drivers this way
// once they been ported to the new driver architecture - the special case here
// can then be removed.
struct dirent *entry;
char path[PATH_MAX];
while (count < deviceNumber && (entry = readdir(directory)) != NULL) {
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")
|| !strcmp(entry->d_name, "vesa"))
|| !strcmp(entry->d_name, "vesa") || !strcmp(entry->d_name, "framebuffer"))
continue;
if (device >= 0) {
@@ -263,12 +263,16 @@ AccelerantHWInterface::_OpenGraphicsDevice(int deviceNumber)
}
}
// Open VESA driver if we were not able to get a better one
// Open VESA or Framebuffer driver if we were not able to get a better one.
if (count < deviceNumber) {
if (deviceNumber == 1) {
device = open("/dev/graphics/vesa", B_READ_WRITE);
fVGADevice = device;
if (device > 0) {
// store the device, so that we can access the planar blitter
fVGADevice = device;
} else {
device = open("/dev/graphics/framebuffer", B_READ_WRITE);
}
} else {
close(device);
device = B_ENTRY_NOT_FOUND;