From 0f4440f99ff1844de36827265526badfc557e961 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Mon, 28 Mar 2005 09:05:28 +0000 Subject: [PATCH] Handle "screen fbdev/WIDTH/HEIGHT" to force use of FBDev DGA instead of XF86 DGA mode. In other words, root user can now use FBDev DGA though it's always recommended to run SheepShaver with a normal user. Increase "ramsize" bounds in the GUI and fully migrate to new "screen" modes. Remove "windowmodes" and "screenmodes" defaults. --- SheepShaver/src/Unix/prefs_editor_gtk.cpp | 20 +++++++++++++++++--- SheepShaver/src/Unix/prefs_unix.cpp | 2 -- SheepShaver/src/Unix/video_x.cpp | 19 ++++++++++++++----- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/SheepShaver/src/Unix/prefs_editor_gtk.cpp b/SheepShaver/src/Unix/prefs_editor_gtk.cpp index cecb29e9..45e19d95 100644 --- a/SheepShaver/src/Unix/prefs_editor_gtk.cpp +++ b/SheepShaver/src/Unix/prefs_editor_gtk.cpp @@ -569,6 +569,7 @@ static GtkWidget *w_frameskip, *w_display_x, *w_display_y; static GtkWidget *l_frameskip, *l_display_x, *l_display_y; static int display_type; static int dis_width, dis_height; +static bool is_fbdev_dga_mode = false; static GtkWidget *w_dspdevice_file, *w_mixerdevice_file; @@ -641,6 +642,12 @@ static void parse_graphics_prefs(void) display_type = DISPLAY_WINDOW; else if (sscanf(str, "dga/%d/%d", &dis_width, &dis_height) == 2) display_type = DISPLAY_SCREEN; +#ifdef ENABLE_FBDEV_DGA + else if (sscanf(str, "fbdev/%d/%d", &dis_width, &dis_height) == 2) { + is_fbdev_dga_mode = true; + display_type = DISPLAY_SCREEN; + } +#endif } else { uint32 window_modes = PrefsFindInt32("windowmodes"); @@ -697,6 +704,7 @@ static void read_graphics_settings(void) dis_height = atoi(str); char pref[256]; + bool use_screen_mode = true; switch (display_type) { case DISPLAY_WINDOW: sprintf(pref, "win/%d/%d", dis_width, dis_height); @@ -705,10 +713,16 @@ static void read_graphics_settings(void) sprintf(pref, "dga/%d/%d", dis_width, dis_height); break; default: + use_screen_mode = false; PrefsRemoveItem("screen"); return; } - PrefsReplaceString("screen", pref); + if (use_screen_mode) { + PrefsReplaceString("screen", pref); + // Old prefs are now migrated + PrefsRemoveItem("windowmodes"); + PrefsRemoveItem("screenmodes"); + } PrefsReplaceString("dsp", get_file_entry_path(w_dspdevice_file)); PrefsReplaceString("mixer", get_file_entry_path(w_mixerdevice_file)); @@ -1113,8 +1127,8 @@ static void create_memory_pane(GtkWidget *top) gtk_widget_show(vbox); gfloat min, max; - min = 1; - max = 256; + min = 4; + max = 512; w_ramsize_adj = gtk_adjustment_new(min, min, max, 1, 16, 0); gtk_adjustment_set_value(GTK_ADJUSTMENT(w_ramsize_adj), PrefsFindInt32("ramsize") >> 20); diff --git a/SheepShaver/src/Unix/prefs_unix.cpp b/SheepShaver/src/Unix/prefs_unix.cpp index ddf01d03..9a3b3c94 100644 --- a/SheepShaver/src/Unix/prefs_unix.cpp +++ b/SheepShaver/src/Unix/prefs_unix.cpp @@ -106,8 +106,6 @@ void AddPlatformPrefsDefaults(void) PrefsReplaceString("extfs", "/"); PrefsReplaceInt32("mousewheelmode", 1); PrefsReplaceInt32("mousewheellines", 3); - PrefsAddInt32("windowmodes", 3); - PrefsAddInt32("screenmodes", 0x3f); #ifdef __linux__ if (access("/dev/.devfsd", F_OK) < 0) { PrefsReplaceString("dsp", "/dev/dsp"); diff --git a/SheepShaver/src/Unix/video_x.cpp b/SheepShaver/src/Unix/video_x.cpp index ac54b16a..37fa5e1f 100644 --- a/SheepShaver/src/Unix/video_x.cpp +++ b/SheepShaver/src/Unix/video_x.cpp @@ -1359,13 +1359,18 @@ bool VideoInit(void) #ifdef ENABLE_FBDEV_DGA // FBDev available? - if (!has_dga && local_X11) { + bool has_fbdev_dga = false; + if (local_X11) { if ((fb_dev_fd = open("/dev/fb0", O_RDWR)) > 0) { if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo) != 0) close(fb_dev_fd); else { - has_dga = true; - is_fbdev_dga_mode = true; + has_fbdev_dga = true; + if (!has_dga) { + // Fallback to FBDev DGA mode if XF86 DGA is not possible + has_dga = true; + is_fbdev_dga_mode = true; + } fb_orig_vinfo = fb_vinfo; D(bug("Frame buffer device initial resolution: %dx%dx%d\n", fb_vinfo.xres, fb_vinfo.yres, fb_vinfo.bits_per_pixel)); } @@ -1408,6 +1413,12 @@ bool VideoInit(void) #ifdef ENABLE_XF86_DGA else if (has_dga && sscanf(mode_str, "dga/%d/%d", &default_width, &default_height) == 2) display_type = DIS_SCREEN; +#endif +#ifdef ENABLE_FBDEV_DGA + else if (has_fbdev_dga && sscanf(mode_str, "fbdev/%d/%d", &default_width, &default_height) == 2) { + is_fbdev_dga_mode = true; + display_type = DIS_SCREEN; + } #endif if (display_type == DIS_INVALID) { D(bug("Invalid screen mode specified, defaulting to old modes selection\n")); @@ -1676,8 +1687,6 @@ static void resume_emul(void) free(fb_save); fb_save = NULL; } - if (depth == 8) - palette_changed = true; // Unlock frame buffer (and continue MacOS thread) UNLOCK_FRAME_BUFFER;