diff options
author | alexst <alexst@chromium.org> | 2015-04-17 12:05:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-17 19:06:10 +0000 |
commit | f14b9219b64d5892fc43c45f6baa6e874293cde2 (patch) | |
tree | c8632086e5ad3f877bea316823b859fbff6d8a54 /ui/ozone/platform/drm/gpu/screen_manager_unittest.cc | |
parent | fc2f13691557ed28e604ad9e628a41d7f73591b7 (diff) | |
download | chromium_src-f14b9219b64d5892fc43c45f6baa6e874293cde2.zip chromium_src-f14b9219b64d5892fc43c45f6baa6e874293cde2.tar.gz chromium_src-f14b9219b64d5892fc43c45f6baa6e874293cde2.tar.bz2 |
[ozone] Keep track of pending frames on drm_window when hardware display controller is disabled or when in headless mode.
When display controller is disabled, it used to stop tracking which buffer was the considered front. Surface would fast ack all incoming buffers without presenting them, which means that any one of them could be getting painted into while display controller is off. Upon wakeup, the controller would grab what it thought was the last front buffer, but in practice it was not because of the fast acks. Net result is that it may try to modeset with the buffer GL is painting into, making it hang on a fence in the driver.
This patch removes all knowledge of front buffers from the display controller and explicitly sets it on the window, which tracks it while the controller is off.
BUG=473831
Committed: https://crrev.com/b47c9f5fb6b669b27e055ab8b305309170849732
Cr-Commit-Position: refs/heads/master@{#325326}
Review URL: https://codereview.chromium.org/1078183003
Cr-Commit-Position: refs/heads/master@{#325692}
Diffstat (limited to 'ui/ozone/platform/drm/gpu/screen_manager_unittest.cc')
-rw-r--r-- | ui/ozone/platform/drm/gpu/screen_manager_unittest.cc | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc b/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc index bf0d211..7ed4266 100644 --- a/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc +++ b/ui/ozone/platform/drm/gpu/screen_manager_unittest.cc @@ -121,8 +121,8 @@ TEST_F(ScreenManagerTest, CheckDuplicateConfiguration) { drm_, kPrimaryCrtc, kPrimaryConnector, GetPrimaryBounds().origin(), kDefaultMode); - // Should reuse existing framebuffer. - EXPECT_EQ(framebuffer, drm_->current_framebuffer()); + // Should not hold onto buffers. + EXPECT_NE(framebuffer, drm_->current_framebuffer()); EXPECT_TRUE(screen_manager_->GetDisplayController(GetPrimaryBounds())); EXPECT_FALSE(screen_manager_->GetDisplayController(GetSecondaryBounds())); @@ -254,8 +254,8 @@ TEST_F(ScreenManagerTest, ReuseFramebufferIfDisabledThenReEnabled) { drm_, kPrimaryCrtc, kPrimaryConnector, GetPrimaryBounds().origin(), kDefaultMode); - // Should reuse existing framebuffer. - EXPECT_EQ(framebuffer, drm_->current_framebuffer()); + // Buffers are released when disabled. + EXPECT_NE(framebuffer, drm_->current_framebuffer()); } TEST_F(ScreenManagerTest, CheckMirrorModeAfterBeginReEnabled) { @@ -398,3 +398,33 @@ TEST_F(ScreenManagerTest, ShouldDissociateWindowOnControllerRemoval) { window = screen_manager_->RemoveWindow(1); window->Shutdown(); } + +TEST_F(ScreenManagerTest, EnableControllerWhenWindowHasNoBuffer) { + ui::DrmDeviceManager device_manager(drm_); + scoped_ptr<ui::DrmWindow> window( + new ui::DrmWindow(1, &device_manager, screen_manager_.get())); + window->Initialize(); + window->OnBoundsChanged(GetPrimaryBounds()); + screen_manager_->AddWindow(1, window.Pass()); + + screen_manager_->AddDisplayController(drm_, kPrimaryCrtc, kPrimaryConnector); + screen_manager_->ConfigureDisplayController( + drm_, kPrimaryCrtc, kPrimaryConnector, GetPrimaryBounds().origin(), + kDefaultMode); + + EXPECT_TRUE(screen_manager_->GetWindow(1)->GetController()); + // There is a buffer after initial config. + uint32_t framebuffer = drm_->current_framebuffer(); + EXPECT_NE(0U, framebuffer); + + screen_manager_->ConfigureDisplayController( + drm_, kPrimaryCrtc, kPrimaryConnector, GetPrimaryBounds().origin(), + kDefaultMode); + + // There is a new buffer after we configured with the same mode but no + // pending frames on the window. + EXPECT_NE(framebuffer, drm_->current_framebuffer()); + + window = screen_manager_->RemoveWindow(1); + window->Shutdown(); +} |