From 756f5c98b86772b3b3ee707014a6065babdfc649 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Sun, 9 Aug 2009 15:26:19 +0000 Subject: [PATCH] fixed BScreen mode.flags handling. This is now compatible with BeOS, and fixes for instance the use of Dualhead Setup for the Matrox and nVidia driver which make use of 'free' flags. A modeset command should be relayed to the accelerant even if it differs by just a single bit: the accelerant best knows how to handle this. Remark: Haiku's screen preflet refuses to set modes once a virtual screen is set since it doesn't recognize the currently set mode. I guess that could be fixed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32212 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/Screen.cpp | 13 ------------- src/servers/app/VirtualScreen.cpp | 19 ++++++------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/servers/app/Screen.cpp b/src/servers/app/Screen.cpp index 3fd8fda000..8156759624 100644 --- a/src/servers/app/Screen.cpp +++ b/src/servers/app/Screen.cpp @@ -93,19 +93,6 @@ Screen::SetMode(const display_mode& mode, bool makeDefault) { display_mode current; GetMode(¤t); - // TODO: decide how best to handle the flags here - things like - // the screen preflet will generally always set the flags to 0, - // while it seems asking the accelerant to automatically pick the - // best mode might not necessarily. For the time being, match the - // flags before doing the mode comparison in order to prevent - // mode switches for otherwise identical modes (this was relatively - // easily observed on at least the radeon accelerant - on first boot - // the best mode picked included a flag mask of 0xffffffff ; - // if you switched the resolution of one workspace to something else - // and then back to the resolution it started with, you would observe - // a mode switch when jumping between that workspace and the others - // that were still using the automatically set default mode) - current.flags = mode.flags; if (!memcmp(&mode, ¤t, sizeof(display_mode))) return B_OK; diff --git a/src/servers/app/VirtualScreen.cpp b/src/servers/app/VirtualScreen.cpp index 484e9c3355..55f3edadb5 100644 --- a/src/servers/app/VirtualScreen.cpp +++ b/src/servers/app/VirtualScreen.cpp @@ -108,11 +108,8 @@ VirtualScreen::StoreConfiguration(BMessage& settings) display_mode mode; screen->GetMode(&mode); - screenSettings.AddInt32("width", mode.virtual_width); - screenSettings.AddInt32("height", mode.virtual_height); - screenSettings.AddInt32("color space", mode.space); - screenSettings.AddData("timing", B_RAW_TYPE, &mode.timing, - sizeof(display_timing)); + screenSettings.AddData("mode", B_RAW_TYPE, &mode, + sizeof(display_mode)); settings.AddMessage("screen", &screenSettings); } @@ -142,16 +139,12 @@ VirtualScreen::AddScreen(Screen* screen) BMessage settings; if (_GetConfiguration(screen, settings) == B_OK) { // we found settings for this screen, and try to apply them now - int32 width, height, colorSpace; - const display_timing* timing; + const display_mode* mode; ssize_t size; - if (settings.FindInt32("width", &width) == B_OK - && settings.FindInt32("height", &height) == B_OK - && settings.FindInt32("color space", &colorSpace) == B_OK - && settings.FindData("timing", B_RAW_TYPE, (const void**)&timing, + if (settings.FindData("mode", B_RAW_TYPE, (const void**)&mode, &size) == B_OK - && size == sizeof(display_timing)) - status = screen->SetMode(width, height, colorSpace, *timing, true); + && size == sizeof(display_mode)) + status = screen->SetMode(*mode, true); // TODO: named settings will get lost if setting the mode failed! } if (status < B_OK) {