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