| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" | 6 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" |
| 7 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" | 7 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" |
| 8 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h" | 8 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h" |
| 9 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" | 9 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" |
| 10 #include "ui/ozone/platform/drm/gpu/drm_window.h" | 10 #include "ui/ozone/platform/drm/gpu/drm_window.h" |
| 11 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" | 11 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" |
| 12 #include "ui/ozone/platform/drm/gpu/screen_manager.h" | 12 #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
| 13 #include "ui/ozone/platform/drm/test/mock_drm_device.h" | 13 #include "ui/ozone/platform/drm/test/mock_drm_device.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 void EmptySwapCallback(gfx::SwapResult) { | |
| 18 } | |
| 19 | |
| 20 // Create a basic mode for a 6x4 screen. | 17 // Create a basic mode for a 6x4 screen. |
| 21 const drmModeModeInfo kDefaultMode = | 18 const drmModeModeInfo kDefaultMode = |
| 22 {0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, {'\0'}}; | 19 {0, 6, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, {'\0'}}; |
| 23 | 20 |
| 24 const uint32_t kPrimaryCrtc = 1; | 21 const uint32_t kPrimaryCrtc = 1; |
| 25 const uint32_t kPrimaryConnector = 2; | 22 const uint32_t kPrimaryConnector = 2; |
| 26 const uint32_t kSecondaryCrtc = 3; | 23 const uint32_t kSecondaryCrtc = 3; |
| 27 const uint32_t kSecondaryConnector = 4; | 24 const uint32_t kSecondaryConnector = 4; |
| 28 | 25 |
| 29 } // namespace | 26 } // namespace |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 } | 452 } |
| 456 | 453 |
| 457 TEST_F(ScreenManagerTest, EnableControllerWhenWindowHasBuffer) { | 454 TEST_F(ScreenManagerTest, EnableControllerWhenWindowHasBuffer) { |
| 458 scoped_ptr<ui::DrmWindow> window( | 455 scoped_ptr<ui::DrmWindow> window( |
| 459 new ui::DrmWindow(1, device_manager_.get(), screen_manager_.get())); | 456 new ui::DrmWindow(1, device_manager_.get(), screen_manager_.get())); |
| 460 window->Initialize(); | 457 window->Initialize(); |
| 461 window->OnBoundsChanged(GetPrimaryBounds()); | 458 window->OnBoundsChanged(GetPrimaryBounds()); |
| 462 scoped_refptr<ui::ScanoutBuffer> buffer = | 459 scoped_refptr<ui::ScanoutBuffer> buffer = |
| 463 buffer_generator_->Create(drm_, GetPrimaryBounds().size()); | 460 buffer_generator_->Create(drm_, GetPrimaryBounds().size()); |
| 464 window->QueueOverlayPlane(ui::OverlayPlane(buffer)); | 461 window->QueueOverlayPlane(ui::OverlayPlane(buffer)); |
| 465 window->SchedulePageFlip(false /* is_sync */, base::Bind(&EmptySwapCallback)); | 462 window->SchedulePageFlip(false /* is_sync */, base::Bind(&base::DoNothing)); |
| 466 screen_manager_->AddWindow(1, window.Pass()); | 463 screen_manager_->AddWindow(1, window.Pass()); |
| 467 | 464 |
| 468 screen_manager_->AddDisplayController(drm_, kPrimaryCrtc, kPrimaryConnector); | 465 screen_manager_->AddDisplayController(drm_, kPrimaryCrtc, kPrimaryConnector); |
| 469 screen_manager_->ConfigureDisplayController( | 466 screen_manager_->ConfigureDisplayController( |
| 470 drm_, kPrimaryCrtc, kPrimaryConnector, GetPrimaryBounds().origin(), | 467 drm_, kPrimaryCrtc, kPrimaryConnector, GetPrimaryBounds().origin(), |
| 471 kDefaultMode); | 468 kDefaultMode); |
| 472 | 469 |
| 473 EXPECT_EQ(buffer->GetFramebufferId(), drm_->current_framebuffer()); | 470 EXPECT_EQ(buffer->GetFramebufferId(), drm_->current_framebuffer()); |
| 474 | 471 |
| 475 window = screen_manager_->RemoveWindow(1); | 472 window = screen_manager_->RemoveWindow(1); |
| 476 window->Shutdown(); | 473 window->Shutdown(); |
| 477 } | 474 } |
| OLD | NEW |