aboutsummaryrefslogtreecommitdiffstats
path: root/fbi.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2016-03-24 11:35:51 +0100
committerGerd Hoffmann <kraxel@redhat.com>2016-03-24 11:35:51 +0100
commit7e1cb7262703c8d873b3838aaf4b5083716b5065 (patch)
tree0630c25626b6e7e45f511d4fc99c9896ec91f026 /fbi.c
parent5e68ede72c48aeae3412e31e5633c03d48048deb (diff)
downloadfbida-7e1cb7262703c8d873b3838aaf4b5083716b5065.tar.gz
gfx init and console switching tweaks
Diffstat (limited to 'fbi.c')
-rw-r--r--fbi.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/fbi.c b/fbi.c
index e25453f..b7edd3b 100644
--- a/fbi.c
+++ b/fbi.c
@@ -7,6 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
@@ -1433,7 +1434,8 @@ int main(int argc, char *argv[])
{
int once;
int i, arg, key;
- char *info, *desc, *filelist, *device;
+ bool framebuffer = false;
+ char *info, *desc, *filelist, *device, *mode;
char linebuffer[128];
struct flist *fprev = NULL;
@@ -1514,17 +1516,39 @@ int main(int argc, char *argv[])
/* gfx device init */
device = cfg_get_str(O_DEVICE);
- if (device && strncmp(device, "/dev/dri", 8) == 0) {
- gfx = drm_init(device);
+ mode = cfg_get_str(O_VIDEO_MODE);
+ if (device) {
+ /* device specified */
+ if (strncmp(device, "/dev/d", 6) == 0) {
+ gfx = drm_init(device);
+ } else {
+ framebuffer = true;
+ gfx = fb_init(device, mode, GET_VT());
+ }
} else {
- gfx = fb_init(device,
- cfg_get_str(O_VIDEO_MODE),
- GET_VT());
+ /* try drm first, failing that fb */
+ gfx = drm_init(NULL);
+ if (!gfx) {
+ framebuffer = true;
+ gfx = fb_init(NULL, mode, GET_VT());
+ }
+ }
+ if (!gfx) {
+ fprintf(stderr, "graphics init failed\n");
+ exit(1);
}
exit_signals_init();
- console_switch_init(console_switch_redraw);
- shadow_init(gfx);
signal(SIGTSTP,SIG_IGN);
+ if (console_switch_init(console_switch_redraw) < 0) {
+ fprintf(stderr, "NOTICE: No vt switching available on terminal.\n");
+ fprintf(stderr, "NOTICE: Not started from linux console? CONFIG_VT=n?\n");
+ if (framebuffer) {
+ fprintf(stderr, "WARNING: Running on framebuffer and can't manage access.\n");
+ fprintf(stderr, "WARNING: Other processes (fbcon too) can write to display.\n");
+ fprintf(stderr, "WARNING: Also can't properly cleanup on exit.\n");
+ }
+ }
+ shadow_init(gfx);
/* svga main loop */
tty_raw();