summaryrefslogtreecommitdiffstats
path: root/ui/display/chromeos
diff options
context:
space:
mode:
Diffstat (limited to 'ui/display/chromeos')
-rw-r--r--ui/display/chromeos/x11/native_display_delegate_x11.cc17
-rw-r--r--ui/display/chromeos/x11/native_display_delegate_x11.h2
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);