Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(772)

Side by Side Diff: ui/ozone/platform/dri/screen_manager_unittest.cc

Issue 838633002: [Ozone-DRI] Reuse framebuffer when re-enabling CRTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/dri/screen_manager.cc ('k') | ui/ozone/platform/dri/test/mock_dri_wrapper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "ui/ozone/platform/dri/dri_buffer.h" 6 #include "ui/ozone/platform/dri/dri_buffer.h"
7 #include "ui/ozone/platform/dri/hardware_display_controller.h" 7 #include "ui/ozone/platform/dri/hardware_display_controller.h"
8 #include "ui/ozone/platform/dri/screen_manager.h" 8 #include "ui/ozone/platform/dri/screen_manager.h"
9 #include "ui/ozone/platform/dri/test/mock_dri_wrapper.h" 9 #include "ui/ozone/platform/dri/test/mock_dri_wrapper.h"
10 10
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 EXPECT_FALSE(controller); 132 EXPECT_FALSE(controller);
133 } 133 }
134 134
135 TEST_F(ScreenManagerTest, CheckDuplicateConfiguration) { 135 TEST_F(ScreenManagerTest, CheckDuplicateConfiguration) {
136 screen_manager_->AddDisplayController(dri_.get(), kPrimaryCrtc, 136 screen_manager_->AddDisplayController(dri_.get(), kPrimaryCrtc,
137 kPrimaryConnector); 137 kPrimaryConnector);
138 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 138 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
139 kPrimaryConnector, 139 kPrimaryConnector,
140 GetPrimaryBounds().origin(), 140 GetPrimaryBounds().origin(),
141 kDefaultMode); 141 kDefaultMode);
142 uint32_t framebuffer = dri_->current_framebuffer();
143
142 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 144 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
143 kPrimaryConnector, 145 kPrimaryConnector,
144 GetPrimaryBounds().origin(), 146 GetPrimaryBounds().origin(),
145 kDefaultMode); 147 kDefaultMode);
146 148
149 // Should reuse existing framebuffer.
150 EXPECT_EQ(framebuffer, dri_->current_framebuffer());
151
147 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds())); 152 EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds()));
148 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds())); 153 EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds()));
149 } 154 }
150 155
151 TEST_F(ScreenManagerTest, CheckChangingMode) { 156 TEST_F(ScreenManagerTest, CheckChangingMode) {
152 screen_manager_->AddDisplayController(dri_.get(), kPrimaryCrtc, 157 screen_manager_->AddDisplayController(dri_.get(), kPrimaryCrtc,
153 kPrimaryConnector); 158 kPrimaryConnector);
154 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, 159 screen_manager_->ConfigureDisplayController(kPrimaryCrtc,
155 kPrimaryConnector, 160 kPrimaryConnector,
156 GetPrimaryBounds().origin(), 161 GetPrimaryBounds().origin(),
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 drmModeModeInfo new_mode = kDefaultMode; 273 drmModeModeInfo new_mode = kDefaultMode;
269 new_mode.vdisplay = 10; 274 new_mode.vdisplay = 10;
270 // Shouldn't enter mirror mode unless the display bounds are the same. 275 // Shouldn't enter mirror mode unless the display bounds are the same.
271 screen_manager_->ConfigureDisplayController( 276 screen_manager_->ConfigureDisplayController(
272 kSecondaryCrtc, kSecondaryConnector, GetPrimaryBounds().origin(), 277 kSecondaryCrtc, kSecondaryConnector, GetPrimaryBounds().origin(),
273 new_mode); 278 new_mode);
274 279
275 EXPECT_FALSE( 280 EXPECT_FALSE(
276 screen_manager_->GetDisplayController(GetPrimaryBounds())->IsMirrored()); 281 screen_manager_->GetDisplayController(GetPrimaryBounds())->IsMirrored());
277 } 282 }
283
284 TEST_F(ScreenManagerTest, ReuseFramebufferIfDisabledThenReEnabled) {
285 screen_manager_->AddDisplayController(dri_.get(), kPrimaryCrtc,
286 kPrimaryConnector);
287 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, kPrimaryConnector,
288 GetPrimaryBounds().origin(),
289 kDefaultMode);
290 uint32_t framebuffer = dri_->current_framebuffer();
291
292 screen_manager_->DisableDisplayController(kPrimaryCrtc);
293 EXPECT_EQ(0u, dri_->current_framebuffer());
294
295 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, kPrimaryConnector,
296 GetPrimaryBounds().origin(),
297 kDefaultMode);
298
299 // Should reuse existing framebuffer.
300 EXPECT_EQ(framebuffer, dri_->current_framebuffer());
301 }
302
303 TEST_F(ScreenManagerTest, CheckMirrorModeAfterBeginReEnabled) {
304 screen_manager_->AddDisplayController(dri_.get(), kPrimaryCrtc,
305 kPrimaryConnector);
306 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, kPrimaryConnector,
307 GetPrimaryBounds().origin(),
308 kDefaultMode);
309 screen_manager_->DisableDisplayController(kPrimaryCrtc);
310
311 screen_manager_->AddDisplayController(dri_.get(), kSecondaryCrtc,
312 kSecondaryConnector);
313 screen_manager_->ConfigureDisplayController(
314 kSecondaryCrtc, kSecondaryConnector, GetPrimaryBounds().origin(),
315 kDefaultMode);
316
317 base::WeakPtr<ui::HardwareDisplayController> controller =
318 screen_manager_->GetDisplayController(GetPrimaryBounds());
319 EXPECT_TRUE(controller);
320 EXPECT_FALSE(controller->IsMirrored());
321
322 screen_manager_->ConfigureDisplayController(kPrimaryCrtc, kPrimaryConnector,
323 GetPrimaryBounds().origin(),
324 kDefaultMode);
325 EXPECT_TRUE(controller);
326 EXPECT_TRUE(controller->IsMirrored());
327 }
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/screen_manager.cc ('k') | ui/ozone/platform/dri/test/mock_dri_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698