| OLD | NEW |
| 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 <drm_fourcc.h> | 5 #include <drm_fourcc.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" | 10 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 EXPECT_TRUE(controller_->SchedulePageFlip( | 373 EXPECT_TRUE(controller_->SchedulePageFlip( |
| 374 planes, false /* test_only */, | 374 planes, false /* test_only */, |
| 375 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, | 375 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, |
| 376 base::Unretained(this)))); | 376 base::Unretained(this)))); |
| 377 | 377 |
| 378 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); | 378 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); |
| 379 drm_->RunCallbacks(); | 379 drm_->RunCallbacks(); |
| 380 EXPECT_EQ(1, page_flips_); | 380 EXPECT_EQ(1, page_flips_); |
| 381 } | 381 } |
| 382 | 382 |
| 383 TEST_F(HardwareDisplayControllerTest, FailPageFlipping) { |
| 384 drm_->set_page_flip_expectation(false); |
| 385 |
| 386 ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( |
| 387 new MockScanoutBuffer(kDefaultModeSize))); |
| 388 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); |
| 389 std::vector<ui::OverlayPlane> planes = |
| 390 std::vector<ui::OverlayPlane>(1, plane1); |
| 391 EXPECT_FALSE(controller_->SchedulePageFlip( |
| 392 planes, false /* test_only */, |
| 393 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, |
| 394 base::Unretained(this)))); |
| 395 |
| 396 drm_->RunCallbacks(); |
| 397 EXPECT_EQ(1, page_flips_); |
| 398 } |
| 399 |
| 400 TEST_F(HardwareDisplayControllerTest, FailPageFlippingDueToNoPrimaryPlane) { |
| 401 ui::OverlayPlane plane1( |
| 402 scoped_refptr<ui::ScanoutBuffer>(new MockScanoutBuffer(kDefaultModeSize)), |
| 403 1, gfx::OVERLAY_TRANSFORM_NONE, gfx::Rect(kDefaultModeSize), |
| 404 gfx::RectF(0, 0, 1, 1)); |
| 405 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); |
| 406 std::vector<ui::OverlayPlane> planes = |
| 407 std::vector<ui::OverlayPlane>(1, plane1); |
| 408 EXPECT_FALSE(controller_->SchedulePageFlip( |
| 409 planes, false /* test_only */, |
| 410 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, |
| 411 base::Unretained(this)))); |
| 412 |
| 413 drm_->RunCallbacks(); |
| 414 EXPECT_EQ(1, page_flips_); |
| 415 } |
| 416 |
| 383 TEST_F(HardwareDisplayControllerTest, AddCrtcMidPageFlip) { | 417 TEST_F(HardwareDisplayControllerTest, AddCrtcMidPageFlip) { |
| 384 ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( | 418 ui::OverlayPlane plane1(scoped_refptr<ui::ScanoutBuffer>( |
| 385 new MockScanoutBuffer(kDefaultModeSize))); | 419 new MockScanoutBuffer(kDefaultModeSize))); |
| 386 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); | 420 EXPECT_TRUE(controller_->Modeset(plane1, kDefaultMode)); |
| 387 std::vector<ui::OverlayPlane> planes = | 421 std::vector<ui::OverlayPlane> planes = |
| 388 std::vector<ui::OverlayPlane>(1, plane1); | 422 std::vector<ui::OverlayPlane>(1, plane1); |
| 389 EXPECT_TRUE(controller_->SchedulePageFlip( | 423 EXPECT_TRUE(controller_->SchedulePageFlip( |
| 390 planes, false /* test_only */, | 424 planes, false /* test_only */, |
| 391 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, | 425 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, |
| 392 base::Unretained(this)))); | 426 base::Unretained(this)))); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 408 planes, false /* test_only */, | 442 planes, false /* test_only */, |
| 409 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, | 443 base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, |
| 410 base::Unretained(this)))); | 444 base::Unretained(this)))); |
| 411 | 445 |
| 412 controller_->RemoveCrtc(drm_, kPrimaryCrtc); | 446 controller_->RemoveCrtc(drm_, kPrimaryCrtc); |
| 413 | 447 |
| 414 EXPECT_EQ(1, page_flips_); | 448 EXPECT_EQ(1, page_flips_); |
| 415 drm_->RunCallbacks(); | 449 drm_->RunCallbacks(); |
| 416 EXPECT_EQ(1, page_flips_); | 450 EXPECT_EQ(1, page_flips_); |
| 417 } | 451 } |
| OLD | NEW |