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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 controller_->SchedulePageFlip( | 301 controller_->SchedulePageFlip( |
302 planes, base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, | 302 planes, base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, |
303 base::Unretained(this))); | 303 base::Unretained(this))); |
304 drm_->RunCallbacks(); | 304 drm_->RunCallbacks(); |
305 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, last_swap_result_); | 305 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, last_swap_result_); |
306 EXPECT_EQ(1, page_flips_); | 306 EXPECT_EQ(1, page_flips_); |
307 | 307 |
308 const ui::HardwareDisplayPlane* owned_plane = nullptr; | 308 const ui::HardwareDisplayPlane* owned_plane = nullptr; |
309 for (const auto& plane : drm_->plane_manager()->planes()) { | 309 for (const auto& plane : drm_->plane_manager()->planes()) { |
310 if (plane->in_use()) | 310 if (plane->in_use()) |
311 owned_plane = plane; | 311 owned_plane = plane.get(); |
312 } | 312 } |
313 | 313 |
314 ASSERT_TRUE(owned_plane != nullptr); | 314 ASSERT_TRUE(owned_plane != nullptr); |
315 EXPECT_EQ(kPrimaryCrtc, owned_plane->owning_crtc()); | 315 EXPECT_EQ(kPrimaryCrtc, owned_plane->owning_crtc()); |
316 | 316 |
317 // Removing the crtc should not free the plane or change ownership. | 317 // Removing the crtc should not free the plane or change ownership. |
318 scoped_ptr<ui::CrtcController> crtc = | 318 scoped_ptr<ui::CrtcController> crtc = |
319 controller_->RemoveCrtc(drm_, kPrimaryCrtc); | 319 controller_->RemoveCrtc(drm_, kPrimaryCrtc); |
320 EXPECT_TRUE(owned_plane->in_use()); | 320 EXPECT_TRUE(owned_plane->in_use()); |
321 EXPECT_EQ(kPrimaryCrtc, owned_plane->owning_crtc()); | 321 EXPECT_EQ(kPrimaryCrtc, owned_plane->owning_crtc()); |
(...skipping 18 matching lines...) Expand all Loading... |
340 controller_->SchedulePageFlip( | 340 controller_->SchedulePageFlip( |
341 planes, base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, | 341 planes, base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, |
342 base::Unretained(this))); | 342 base::Unretained(this))); |
343 drm_->RunCallbacks(); | 343 drm_->RunCallbacks(); |
344 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, last_swap_result_); | 344 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, last_swap_result_); |
345 EXPECT_EQ(1, page_flips_); | 345 EXPECT_EQ(1, page_flips_); |
346 | 346 |
347 const ui::HardwareDisplayPlane* owned_plane = nullptr; | 347 const ui::HardwareDisplayPlane* owned_plane = nullptr; |
348 for (const auto& plane : drm_->plane_manager()->planes()) | 348 for (const auto& plane : drm_->plane_manager()->planes()) |
349 if (plane->in_use()) | 349 if (plane->in_use()) |
350 owned_plane = plane; | 350 owned_plane = plane.get(); |
351 ASSERT_TRUE(owned_plane != nullptr); | 351 ASSERT_TRUE(owned_plane != nullptr); |
352 EXPECT_EQ(kPrimaryCrtc, owned_plane->owning_crtc()); | 352 EXPECT_EQ(kPrimaryCrtc, owned_plane->owning_crtc()); |
353 scoped_ptr<ui::CrtcController> crtc = | 353 scoped_ptr<ui::CrtcController> crtc = |
354 controller_->RemoveCrtc(drm_, kPrimaryCrtc); | 354 controller_->RemoveCrtc(drm_, kPrimaryCrtc); |
355 // Destroying crtc should free the plane. | 355 // Destroying crtc should free the plane. |
356 crtc.reset(); | 356 crtc.reset(); |
357 uint32_t crtc_nullid = 0; | 357 uint32_t crtc_nullid = 0; |
358 EXPECT_FALSE(owned_plane->in_use()); | 358 EXPECT_FALSE(owned_plane->in_use()); |
359 EXPECT_EQ(crtc_nullid, owned_plane->owning_crtc()); | 359 EXPECT_EQ(crtc_nullid, owned_plane->owning_crtc()); |
360 } | 360 } |
(...skipping 10 matching lines...) Expand all Loading... |
371 controller_->SchedulePageFlip( | 371 controller_->SchedulePageFlip( |
372 planes, base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, | 372 planes, base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, |
373 base::Unretained(this))); | 373 base::Unretained(this))); |
374 drm_->RunCallbacks(); | 374 drm_->RunCallbacks(); |
375 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, last_swap_result_); | 375 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, last_swap_result_); |
376 EXPECT_EQ(1, page_flips_); | 376 EXPECT_EQ(1, page_flips_); |
377 | 377 |
378 ui::HardwareDisplayPlane* primary_crtc_plane = nullptr; | 378 ui::HardwareDisplayPlane* primary_crtc_plane = nullptr; |
379 for (const auto& plane : drm_->plane_manager()->planes()) { | 379 for (const auto& plane : drm_->plane_manager()->planes()) { |
380 if (plane->in_use() && kPrimaryCrtc == plane->owning_crtc()) | 380 if (plane->in_use() && kPrimaryCrtc == plane->owning_crtc()) |
381 primary_crtc_plane = plane; | 381 primary_crtc_plane = plane.get(); |
382 } | 382 } |
383 | 383 |
384 ASSERT_TRUE(primary_crtc_plane != nullptr); | 384 ASSERT_TRUE(primary_crtc_plane != nullptr); |
385 | 385 |
386 scoped_ptr<ui::HardwareDisplayController> hdc_controller; | 386 scoped_ptr<ui::HardwareDisplayController> hdc_controller; |
387 hdc_controller.reset(new ui::HardwareDisplayController( | 387 hdc_controller.reset(new ui::HardwareDisplayController( |
388 controller_->RemoveCrtc(drm_, kPrimaryCrtc), controller_->origin())); | 388 controller_->RemoveCrtc(drm_, kPrimaryCrtc), controller_->origin())); |
389 controller_->SchedulePageFlip( | 389 controller_->SchedulePageFlip( |
390 planes, base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, | 390 planes, base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, |
391 base::Unretained(this))); | 391 base::Unretained(this))); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 planes, base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, | 488 planes, base::Bind(&HardwareDisplayControllerTest::PageFlipCallback, |
489 base::Unretained(this))); | 489 base::Unretained(this))); |
490 | 490 |
491 controller_->RemoveCrtc(drm_, kPrimaryCrtc); | 491 controller_->RemoveCrtc(drm_, kPrimaryCrtc); |
492 | 492 |
493 EXPECT_EQ(1, page_flips_); | 493 EXPECT_EQ(1, page_flips_); |
494 drm_->RunCallbacks(); | 494 drm_->RunCallbacks(); |
495 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, last_swap_result_); | 495 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, last_swap_result_); |
496 EXPECT_EQ(1, page_flips_); | 496 EXPECT_EQ(1, page_flips_); |
497 } | 497 } |
OLD | NEW |