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 <utility> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" | 12 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" |
12 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" | 13 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h" |
13 #include "ui/ozone/platform/drm/gpu/hardware_display_plane.h" | 14 #include "ui/ozone/platform/drm/gpu/hardware_display_plane.h" |
14 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" | 15 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" |
15 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" | 16 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" |
16 #include "ui/ozone/platform/drm/gpu/mock_drm_device.h" | 17 #include "ui/ozone/platform/drm/gpu/mock_drm_device.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void InitForTest(const FakePlaneInfo* planes, | 60 void InitForTest(const FakePlaneInfo* planes, |
60 size_t count, | 61 size_t count, |
61 const std::vector<uint32_t>& crtcs) { | 62 const std::vector<uint32_t>& crtcs) { |
62 crtcs_ = crtcs; | 63 crtcs_ = crtcs; |
63 for (size_t i = 0; i < count; i++) { | 64 for (size_t i = 0; i < count; i++) { |
64 scoped_ptr<ui::HardwareDisplayPlane> plane(new ui::HardwareDisplayPlane( | 65 scoped_ptr<ui::HardwareDisplayPlane> plane(new ui::HardwareDisplayPlane( |
65 planes[i].id, planes[i].allowed_crtc_mask)); | 66 planes[i].id, planes[i].allowed_crtc_mask)); |
66 // Add support to test more formats. | 67 // Add support to test more formats. |
67 plane->Initialize(drm_, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888), | 68 plane->Initialize(drm_, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888), |
68 false, true); | 69 false, true); |
69 planes_.push_back(plane.Pass()); | 70 planes_.push_back(std::move(plane)); |
70 } | 71 } |
71 // The real HDPM uses sorted planes, so sort them for consistency. | 72 // The real HDPM uses sorted planes, so sort them for consistency. |
72 std::sort(planes_.begin(), planes_.end(), | 73 std::sort(planes_.begin(), planes_.end(), |
73 [](const scoped_ptr<ui::HardwareDisplayPlane>& l, | 74 [](const scoped_ptr<ui::HardwareDisplayPlane>& l, |
74 const scoped_ptr<ui::HardwareDisplayPlane>& r) { | 75 const scoped_ptr<ui::HardwareDisplayPlane>& r) { |
75 return l->plane_id() < r->plane_id(); | 76 return l->plane_id() < r->plane_id(); |
76 }); | 77 }); |
77 } | 78 } |
78 | 79 |
79 bool Commit(ui::HardwareDisplayPlaneList* plane_list, | 80 bool Commit(ui::HardwareDisplayPlaneList* plane_list, |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 assigns.push_back(ui::OverlayPlane(primary_buffer)); | 293 assigns.push_back(ui::OverlayPlane(primary_buffer)); |
293 drm->plane_manager()->BeginFrame(&hdpl); | 294 drm->plane_manager()->BeginFrame(&hdpl); |
294 EXPECT_TRUE(drm->plane_manager()->AssignOverlayPlanes(&hdpl, assigns, | 295 EXPECT_TRUE(drm->plane_manager()->AssignOverlayPlanes(&hdpl, assigns, |
295 crtcs[0], &crtc)); | 296 crtcs[0], &crtc)); |
296 EXPECT_EQ(0, drm->get_overlay_clear_call_count()); | 297 EXPECT_EQ(0, drm->get_overlay_clear_call_count()); |
297 EXPECT_TRUE(drm->plane_manager()->Commit(&hdpl, false)); | 298 EXPECT_TRUE(drm->plane_manager()->Commit(&hdpl, false)); |
298 EXPECT_EQ(1, drm->get_overlay_clear_call_count()); | 299 EXPECT_EQ(1, drm->get_overlay_clear_call_count()); |
299 } | 300 } |
300 | 301 |
301 } // namespace | 302 } // namespace |
OLD | NEW |