diff options
author | Daniel Nicoara <dnicoara@chromium.org> | 2015-09-17 21:42:15 -0400 |
---|---|---|
committer | Daniel Nicoara <dnicoara@chromium.org> | 2015-09-18 01:42:58 +0000 |
commit | a76c01ab14ca78a91b5305b09255fe4335462439 (patch) | |
tree | c01ab65a2b9e32147b5e9903f021f856c4b03e7e /ui/ozone/platform/drm | |
parent | bbb986a1abfa88625a44980b2cce46a7b29037ad (diff) | |
download | chromium_src-a76c01ab14ca78a91b5305b09255fe4335462439.zip chromium_src-a76c01ab14ca78a91b5305b09255fe4335462439.tar.gz chromium_src-a76c01ab14ca78a91b5305b09255fe4335462439.tar.bz2 |
Revert "[Ozone-DRM] Modeset when re-mapping windows to controllers"
This reverts commit a8c88bddec37b978604ba6bf0399e16dd2146729.
Causing black screen on daisy, spring, minnie.
BUG=532765, 511446
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1353873003 .
Cr-Commit-Position: refs/branch-heads/2454@{#486}
Cr-Branched-From: 12bfc3360892ec53cd00fc239a47e5298beb063b-refs/heads/master@{#338390}
Diffstat (limited to 'ui/ozone/platform/drm')
-rw-r--r-- | ui/ozone/platform/drm/gpu/drm_surface.cc | 11 | ||||
-rw-r--r-- | ui/ozone/platform/drm/gpu/drm_surface_unittest.cc | 62 | ||||
-rw-r--r-- | ui/ozone/platform/drm/gpu/drm_window.cc | 15 | ||||
-rw-r--r-- | ui/ozone/platform/drm/gpu/drm_window.h | 2 | ||||
-rw-r--r-- | ui/ozone/platform/drm/gpu/drm_window_unittest.cc | 2 | ||||
-rw-r--r-- | ui/ozone/platform/drm/gpu/screen_manager.cc | 16 |
6 files changed, 35 insertions, 73 deletions
diff --git a/ui/ozone/platform/drm/gpu/drm_surface.cc b/ui/ozone/platform/drm/gpu/drm_surface.cc index dc9fbf5..f55c925 100644 --- a/ui/ozone/platform/drm/gpu/drm_surface.cc +++ b/ui/ozone/platform/drm/gpu/drm_surface.cc @@ -99,14 +99,9 @@ void DrmSurface::SchedulePageFlip() { // Update our front buffer pointer. std::swap(front_buffer_, back_buffer_); - // First set the pending flag otherwise there could be a re-entrancy issue if - // the callback is executed synchronously. - pending_pageflip_ = true; - if (!window_->SchedulePageFlip(false /* is_sync */, - base::Bind(&DrmSurface::OnPageFlip, - weak_ptr_factory_.GetWeakPtr()))) { - pending_pageflip_ = false; - } + pending_pageflip_ = window_->SchedulePageFlip( + false /* is_sync */, + base::Bind(&DrmSurface::OnPageFlip, weak_ptr_factory_.GetWeakPtr())); } void DrmSurface::OnPageFlip(gfx::SwapResult result) { diff --git a/ui/ozone/platform/drm/gpu/drm_surface_unittest.cc b/ui/ozone/platform/drm/gpu/drm_surface_unittest.cc index c384f12..4498f1f 100644 --- a/ui/ozone/platform/drm/gpu/drm_surface_unittest.cc +++ b/ui/ozone/platform/drm/gpu/drm_surface_unittest.cc @@ -29,20 +29,6 @@ const uint32_t kDefaultConnector = 2; const size_t kPlanesPerCrtc = 1; const uint32_t kDefaultCursorSize = 64; -std::vector<skia::RefPtr<SkSurface>> GetFramebuffers(ui::MockDrmDevice* drm) { - std::vector<skia::RefPtr<SkSurface>> framebuffers; - for (const auto& buffer : drm->buffers()) { - // Skip destroyed buffers and cursor buffers. - if (!buffer || (buffer->width() == kDefaultCursorSize && - buffer->height() == kDefaultCursorSize)) - continue; - - framebuffers.push_back(buffer); - } - - return framebuffers; -} - } // namespace class DrmSurfaceTest : public testing::Test { @@ -87,10 +73,6 @@ void DrmSurfaceTest::SetUp() { new ui::DrmSurface(screen_manager_->GetWindow(kDefaultWidgetHandle))); surface_->ResizeCanvas( gfx::Size(kDefaultMode.hdisplay, kDefaultMode.vdisplay)); - - // The window has been remapped to a controller. The first swap will cause the - // SWAP_NAK_RECREATE_BUFFERS without actually using the buffers. - surface_->PresentCanvas(gfx::Rect()); } void DrmSurfaceTest::TearDown() { @@ -105,13 +87,11 @@ void DrmSurfaceTest::TearDown() { TEST_F(DrmSurfaceTest, CheckFBIDOnSwap) { surface_->PresentCanvas(gfx::Rect()); drm_->RunCallbacks(); - - // Framebuffer ID 1 is allocated in SetUp for the buffer used to modeset and - // framebuffer ID 2 is used when the window to display mapping is done. + // Framebuffer ID 1 is allocated in SetUp for the buffer used to modeset. EXPECT_EQ(3u, drm_->current_framebuffer()); surface_->PresentCanvas(gfx::Rect()); drm_->RunCallbacks(); - EXPECT_EQ(4u, drm_->current_framebuffer()); + EXPECT_EQ(2u, drm_->current_framebuffer()); } TEST_F(DrmSurfaceTest, CheckSurfaceContents) { @@ -125,15 +105,22 @@ TEST_F(DrmSurfaceTest, CheckSurfaceContents) { drm_->RunCallbacks(); SkBitmap image; - std::vector<skia::RefPtr<SkSurface>> framebuffers = - GetFramebuffers(drm_.get()); + std::vector<skia::RefPtr<SkSurface>> framebuffers; + for (const auto& buffer : drm_->buffers()) { + // Skip cursor buffers. + if (buffer->width() == kDefaultCursorSize && + buffer->height() == kDefaultCursorSize) + continue; - // Buffer 0 is the modesetting buffer, buffer 2 is the frontbuffer and buffer - // 1 is the backbuffer. + framebuffers.push_back(buffer); + } + + // Buffer 0 is the modesetting buffer, buffer 1 is the frontbuffer and buffer + // 2 is the backbuffer. EXPECT_EQ(3u, framebuffers.size()); - image.setInfo(framebuffers[1]->getCanvas()->imageInfo()); - EXPECT_TRUE(framebuffers[1]->getCanvas()->readPixels(&image, 0, 0)); + image.setInfo(framebuffers[2]->getCanvas()->imageInfo()); + EXPECT_TRUE(framebuffers[2]->getCanvas()->readPixels(&image, 0, 0)); EXPECT_EQ(kDefaultMode.hdisplay, image.width()); EXPECT_EQ(kDefaultMode.vdisplay, image.height()); @@ -170,15 +157,22 @@ TEST_F(DrmSurfaceTest, CheckSurfaceContentsAfter2QueuedPresents) { drm_->RunCallbacks(); SkBitmap image; - std::vector<skia::RefPtr<SkSurface>> framebuffers = - GetFramebuffers(drm_.get()); + std::vector<skia::RefPtr<SkSurface>> framebuffers; + for (const auto& buffer : drm_->buffers()) { + // Skip cursor buffers. + if (buffer->width() == kDefaultCursorSize && + buffer->height() == kDefaultCursorSize) + continue; - // Buffer 0 is the modesetting buffer, buffer 2 is the backbuffer and buffer - // 1 is the frontbuffer. + framebuffers.push_back(buffer); + } + + // Buffer 0 is the modesetting buffer, buffer 1 is the backbuffer and buffer + // 2 is the frontbuffer. EXPECT_EQ(3u, framebuffers.size()); - image.setInfo(framebuffers[2]->getCanvas()->imageInfo()); - EXPECT_TRUE(framebuffers[2]->getCanvas()->readPixels(&image, 0, 0)); + image.setInfo(framebuffers[1]->getCanvas()->imageInfo()); + EXPECT_TRUE(framebuffers[1]->getCanvas()->readPixels(&image, 0, 0)); EXPECT_EQ(kDefaultMode.hdisplay, image.width()); EXPECT_EQ(kDefaultMode.vdisplay, image.height()); diff --git a/ui/ozone/platform/drm/gpu/drm_window.cc b/ui/ozone/platform/drm/gpu/drm_window.cc index f1dcbfa..3dda06c 100644 --- a/ui/ozone/platform/drm/gpu/drm_window.cc +++ b/ui/ozone/platform/drm/gpu/drm_window.cc @@ -126,15 +126,6 @@ void DrmWindow::QueueOverlayPlane(const OverlayPlane& plane) { bool DrmWindow::SchedulePageFlip(bool is_sync, const SwapCompletionCallback& callback) { - if (force_buffer_reallocation_) { - // Clear pending planes otherwise the next call to queue planes will just - // add on top. - pending_planes_.clear(); - force_buffer_reallocation_ = false; - callback.Run(gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS); - return true; - } - last_submitted_planes_.clear(); last_submitted_planes_.swap(pending_planes_); last_swap_sync_ = is_sync; @@ -213,12 +204,6 @@ void DrmWindow::SetController(HardwareDisplayController* controller) { if (controller_ == controller) return; - // Force buffer reallocation since the window moved to a different controller. - // This is required otherwise the GPU will eventually try to render into the - // buffer currently showing on the old controller (there is no guarantee that - // the old controller has been updated in the meantime). - force_buffer_reallocation_ = true; - controller_ = controller; device_manager_->UpdateDrmDevice( widget_, controller ? controller->GetAllocationDrmDevice() : nullptr); diff --git a/ui/ozone/platform/drm/gpu/drm_window.h b/ui/ozone/platform/drm/gpu/drm_window.h index c6fae3e..8f12738 100644 --- a/ui/ozone/platform/drm/gpu/drm_window.h +++ b/ui/ozone/platform/drm/gpu/drm_window.h @@ -134,8 +134,6 @@ class OZONE_EXPORT DrmWindow { OverlayPlaneList last_submitted_planes_; bool last_swap_sync_ = false; - bool force_buffer_reallocation_ = false; - DISALLOW_COPY_AND_ASSIGN(DrmWindow); }; diff --git a/ui/ozone/platform/drm/gpu/drm_window_unittest.cc b/ui/ozone/platform/drm/gpu/drm_window_unittest.cc index 7246c73..7810aaf 100644 --- a/ui/ozone/platform/drm/gpu/drm_window_unittest.cc +++ b/ui/ozone/platform/drm/gpu/drm_window_unittest.cc @@ -35,7 +35,7 @@ const int kDefaultCursorSize = 64; std::vector<skia::RefPtr<SkSurface>> GetCursorBuffers( const scoped_refptr<ui::MockDrmDevice> drm) { std::vector<skia::RefPtr<SkSurface>> cursor_buffers; - for (const auto& cursor_buffer : drm->buffers()) { + for (const skia::RefPtr<SkSurface>& cursor_buffer : drm->buffers()) { if (cursor_buffer->width() == kDefaultCursorSize && cursor_buffer->height() == kDefaultCursorSize) { cursor_buffers.push_back(cursor_buffer); diff --git a/ui/ozone/platform/drm/gpu/screen_manager.cc b/ui/ozone/platform/drm/gpu/screen_manager.cc index 72a14a1..4b4d3f1 100644 --- a/ui/ozone/platform/drm/gpu/screen_manager.cc +++ b/ui/ozone/platform/drm/gpu/screen_manager.cc @@ -292,20 +292,10 @@ void ScreenManager::UpdateControllerToWindowMapping() { // Apply the new mapping to all windows. for (auto pair : window_map_) { auto it = window_to_controller_map.find(pair.second); - HardwareDisplayController* controller = nullptr; if (it != window_to_controller_map.end()) - controller = it->second; - - bool should_enable = - controller && pair.second->GetController() != controller; - pair.second->SetController(controller); - - // If we're moving windows between controllers modeset the controller - // otherwise the controller may be waiting for a page flip while the window - // tries to schedule another buffer. - if (should_enable) - EnableController(controller, controller->origin(), - controller->get_mode()); + pair.second->SetController(it->second); + else + pair.second->SetController(nullptr); } } |