diff options
author | dbehr@chromium.org <dbehr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-25 02:43:50 +0000 |
---|---|---|
committer | dbehr@chromium.org <dbehr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-25 02:43:50 +0000 |
commit | 2b573a5778618eb9a238094368caa493cb9da591 (patch) | |
tree | f3d2b22eed8dd4ea2717f3f07ad6d73cda7edf34 /ui/display/chromeos | |
parent | 396e2f347e5a5e5345d6ec884a3db42078b18b4d (diff) | |
download | chromium_src-2b573a5778618eb9a238094368caa493cb9da591.zip chromium_src-2b573a5778618eb9a238094368caa493cb9da591.tar.gz chromium_src-2b573a5778618eb9a238094368caa493cb9da591.tar.bz2 |
disable crtcs bigger than new screen size during mode switch
When switching modes, we disable CRTCs that do not fit on current freamebuffer,
change framebuffer size, then enable required CRTCs in the right locations.
This fails in a switch from extended desktop to mirror mode, e.g. from
1366x768+1920x1080 to 1024x768 mirrored. Both CRTCs fit into current framebuffer
but they are smaller than the framebuffer we are about to resize to (1024x768)
so XRRSetScreenSize(1024,768) call fails because it cannot shrink framebuffer
size below size of currently enabled CRTCs. The solution is to disable CRTCs
that are bigger than minimum of current and new framebuffer.
BUG=chromium:366280
TEST=switch between mirror and extended desktop on Link or Squawks. Screen size\
(in DISPLAY=:0.0 xrandr --verbose) should shrink when switching to mirror mode.
R=djkurtz@chromium.org
R=oshima@chromium.org
Signed-off-by: Dominik Behr <dbehr@chromium.org>
Review URL: https://codereview.chromium.org/253513002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266095 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/display/chromeos')
-rw-r--r-- | ui/display/chromeos/x11/native_display_delegate_x11.cc | 17 | ||||
-rw-r--r-- | ui/display/chromeos/x11/native_display_delegate_x11.h | 2 |
2 files changed, 11 insertions, 8 deletions
diff --git a/ui/display/chromeos/x11/native_display_delegate_x11.cc b/ui/display/chromeos/x11/native_display_delegate_x11.cc index 7003605..f6acd60 100644 --- a/ui/display/chromeos/x11/native_display_delegate_x11.cc +++ b/ui/display/chromeos/x11/native_display_delegate_x11.cc @@ -299,7 +299,7 @@ void NativeDisplayDelegateX11::CreateFrameBuffer(const gfx::Size& size) { if (size.width() == current_width && size.height() == current_height) return; - DestroyUnusedCrtcs(); + DestroyUnusedCrtcs(size); int mm_width = size.width() * kPixelsToMmScale; int mm_height = size.height() * kPixelsToMmScale; XRRSetScreenSize( @@ -520,7 +520,7 @@ bool NativeDisplayDelegateX11::SetHDCPState(const DisplaySnapshot& output, } } -void NativeDisplayDelegateX11::DestroyUnusedCrtcs() { +void NativeDisplayDelegateX11::DestroyUnusedCrtcs(const gfx::Size& new_size) { CHECK(screen_) << "Server not grabbed"; // Setting the screen size will fail if any CRTC doesn't fit afterwards. // At the same time, turning CRTCs off and back on uses up a lot of time. @@ -553,12 +553,15 @@ void NativeDisplayDelegateX11::DestroyUnusedCrtcs() { if (mode_info) { mode = static_cast<const DisplayModeX11*>(mode_info)->mode_id(); - // In case our CRTC doesn't fit in our current framebuffer, disable it. + // In case our CRTC doesn't fit in common area of our current and about + // to be resized framebuffer, disable it. // It'll get reenabled after we resize the framebuffer. - int current_width = DisplayWidth(display_, DefaultScreen(display_)); - int current_height = DisplayHeight(display_, DefaultScreen(display_)); - if (mode_info->size().width() > current_width || - mode_info->size().height() > current_height) { + int max_width = std::min(DisplayWidth(display_, + DefaultScreen(display_)), new_size.width()); + int max_height = std::min(DisplayHeight(display_, + DefaultScreen(display_)), new_size.height()); + if (mode_info->size().width() > max_width || + mode_info->size().height() > max_height) { mode = None; output = None; mode_info = NULL; diff --git a/ui/display/chromeos/x11/native_display_delegate_x11.h b/ui/display/chromeos/x11/native_display_delegate_x11.h index f9eade3..a276495 100644 --- a/ui/display/chromeos/x11/native_display_delegate_x11.h +++ b/ui/display/chromeos/x11/native_display_delegate_x11.h @@ -111,7 +111,7 @@ class DISPLAY_EXPORT NativeDisplayDelegateX11 : public NativeDisplayDelegate { // Destroys unused CRTCs and parks used CRTCs in a way which allows a // framebuffer resize. This is faster than turning them off, resizing, // then turning them back on. - void DestroyUnusedCrtcs(); + void DestroyUnusedCrtcs(const gfx::Size& new_size); bool ConfigureCrtc(RRCrtc crtc, RRMode mode, RROutput output, int x, int y); |