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

Unified Diff: ui/ozone/platform/drm/gpu/drm_surface_unittest.cc

Issue 1334483002: Force buffer re-allocation when the backing display changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_surface.cc ('k') | ui/ozone/platform/drm/gpu/drm_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/drm/gpu/drm_surface_unittest.cc
diff --git a/ui/ozone/platform/drm/gpu/drm_surface_unittest.cc b/ui/ozone/platform/drm/gpu/drm_surface_unittest.cc
index 4498f1fc28afe80865f7be1892310efff307cb23..13774b2659c2d437c2b8582d7435b9d7c2a665e3 100644
--- a/ui/ozone/platform/drm/gpu/drm_surface_unittest.cc
+++ b/ui/ozone/platform/drm/gpu/drm_surface_unittest.cc
@@ -73,6 +73,10 @@ 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() {
@@ -88,10 +92,10 @@ TEST_F(DrmSurfaceTest, CheckFBIDOnSwap) {
surface_->PresentCanvas(gfx::Rect());
drm_->RunCallbacks();
// Framebuffer ID 1 is allocated in SetUp for the buffer used to modeset.
- EXPECT_EQ(3u, drm_->current_framebuffer());
+ EXPECT_EQ(2u, drm_->current_framebuffer());
surface_->PresentCanvas(gfx::Rect());
drm_->RunCallbacks();
- EXPECT_EQ(2u, drm_->current_framebuffer());
+ EXPECT_EQ(3u, drm_->current_framebuffer());
}
TEST_F(DrmSurfaceTest, CheckSurfaceContents) {
@@ -115,12 +119,12 @@ TEST_F(DrmSurfaceTest, CheckSurfaceContents) {
framebuffers.push_back(buffer);
}
- // Buffer 0 is the modesetting buffer, buffer 1 is the frontbuffer and buffer
- // 2 is the backbuffer.
+ // Buffer 0 is the modesetting buffer, buffer 2 is the frontbuffer and buffer
+ // 1 is the backbuffer.
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());
@@ -167,12 +171,12 @@ TEST_F(DrmSurfaceTest, CheckSurfaceContentsAfter2QueuedPresents) {
framebuffers.push_back(buffer);
}
- // Buffer 0 is the modesetting buffer, buffer 1 is the backbuffer and buffer
- // 2 is the frontbuffer.
+ // Buffer 0 is the modesetting buffer, buffer 2 is the backbuffer and buffer
+ // 1 is the frontbuffer.
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());
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_surface.cc ('k') | ui/ozone/platform/drm/gpu/drm_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698