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) if (!directory)
return -1; return -1;
// ToDo: the former R5 "stub" driver is called "vesa" under Haiku; however, // TODO: We do not need to avoid the "vesa" or "framebuffer" drivers this way
// we do not need to avoid this driver this way when is has been ported // once they been ported to the new driver architecture - the special case here
// to the new driver architecture - the special case here can then be // can then be removed.
// removed.
int count = 0; int count = 0;
struct dirent *entry = NULL; struct dirent *entry = NULL;
int current_card_fd = -1; int current_card_fd = -1;
char path[PATH_MAX]; char path[PATH_MAX];
while (count < deviceNumber && (entry = readdir(directory)) != NULL) { while (count < deviceNumber && (entry = readdir(directory)) != NULL) {
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") || if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")
!strcmp(entry->d_name, "stub") || !strcmp(entry->d_name, "vesa")) || !strcmp(entry->d_name, "vesa") || !strcmp(entry->d_name, "framebuffer"))
continue; continue;
if (current_card_fd >= 0) { if (current_card_fd >= 0) {
@@ -433,11 +432,15 @@ DWindowHWInterface::_OpenGraphicsDevice(int deviceNumber)
count++; 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 (count < deviceNumber) {
if (deviceNumber == 1) { if (deviceNumber == 1) {
sprintf(path, "/dev/graphics/vesa"); sprintf(path, "/dev/graphics/vesa");
current_card_fd = open(path, B_READ_WRITE); 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 { } else {
close(current_card_fd); close(current_card_fd);
current_card_fd = B_ENTRY_NOT_FOUND; current_card_fd = B_ENTRY_NOT_FOUND;
@@ -241,14 +241,14 @@ AccelerantHWInterface::_OpenGraphicsDevice(int deviceNumber)
int device = -1; int device = -1;
int count = 0; int count = 0;
if (!use_fail_safe_video_mode()) { if (!use_fail_safe_video_mode()) {
// TODO: We do not need to avoid the "vesa" driver this way once it has // TODO: We do not need to avoid the "vesa" or "framebuffer" drivers this way
// been ported to the new driver architecture - the special case here // once they been ported to the new driver architecture - the special case here
// can then be removed. // can then be removed.
struct dirent *entry; struct dirent *entry;
char path[PATH_MAX]; char path[PATH_MAX];
while (count < deviceNumber && (entry = readdir(directory)) != NULL) { while (count < deviceNumber && (entry = readdir(directory)) != NULL) {
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") 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; continue;
if (device >= 0) { 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 (count < deviceNumber) {
if (deviceNumber == 1) { if (deviceNumber == 1) {
device = open("/dev/graphics/vesa", B_READ_WRITE); device = open("/dev/graphics/vesa", B_READ_WRITE);
fVGADevice = device; if (device > 0) {
// store the device, so that we can access the planar blitter // store the device, so that we can access the planar blitter
fVGADevice = device;
} else {
device = open("/dev/graphics/framebuffer", B_READ_WRITE);
}
} else { } else {
close(device); close(device);
device = B_ENTRY_NOT_FOUND; device = B_ENTRY_NOT_FOUND;