| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.h" |
| 6 | 6 |
| 7 #include <drm_fourcc.h> | 7 #include <drm_fourcc.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "ui/ozone/platform/drm/gpu/fake_plane_info.h" | 11 #include "ui/ozone/platform/drm/gpu/fake_plane_info.h" |
| 12 #include "ui/ozone/platform/drm/gpu/mock_scanout_buffer.h" | 12 #include "ui/ozone/platform/drm/gpu/mock_scanout_buffer.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 MockHardwareDisplayPlaneManager::MockHardwareDisplayPlaneManager( | 16 MockHardwareDisplayPlaneManager::MockHardwareDisplayPlaneManager( |
| 17 DrmDevice* drm, | 17 DrmDevice* drm, |
| 18 const std::vector<uint32_t>& crtcs, | 18 const std::vector<uint32_t>& crtcs, |
| 19 uint32_t planes_per_crtc) { | 19 uint32_t planes_per_crtc) { |
| 20 const int kPlaneBaseId = 50; | 20 const int kPlaneBaseId = 50; |
| 21 const struct drm_format_modifier linear_modifier { 0x1, DRM_FORMAT_MOD_NONE }; |
| 21 drm_ = drm; | 22 drm_ = drm; |
| 22 crtcs_ = crtcs; | 23 crtcs_ = crtcs; |
| 23 for (size_t crtc_idx = 0; crtc_idx < crtcs_.size(); crtc_idx++) { | 24 for (size_t crtc_idx = 0; crtc_idx < crtcs_.size(); crtc_idx++) { |
| 24 for (size_t i = 0; i < planes_per_crtc; i++) { | 25 for (size_t i = 0; i < planes_per_crtc; i++) { |
| 25 std::unique_ptr<HardwareDisplayPlane> plane( | 26 std::unique_ptr<HardwareDisplayPlane> plane( |
| 26 new HardwareDisplayPlane(kPlaneBaseId + i, 1 << crtc_idx)); | 27 new HardwareDisplayPlane(kPlaneBaseId + i, 1 << crtc_idx)); |
| 27 plane->Initialize(drm, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888), | 28 plane->Initialize(drm, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888), |
| 28 std::vector<drm_format_modifier>(), // modifiers | 29 std::vector<drm_format_modifier>(1, linear_modifier), |
| 29 false, true); | 30 false, true); |
| 30 planes_.push_back(std::move(plane)); | 31 planes_.push_back(std::move(plane)); |
| 31 } | 32 } |
| 32 } | 33 } |
| 33 | 34 |
| 34 // The real HDPM uses sorted planes, so sort them for consistency. | 35 // The real HDPM uses sorted planes, so sort them for consistency. |
| 35 std::sort(planes_.begin(), planes_.end(), | 36 std::sort(planes_.begin(), planes_.end(), |
| 36 [](const std::unique_ptr<HardwareDisplayPlane>& l, | 37 [](const std::unique_ptr<HardwareDisplayPlane>& l, |
| 37 const std::unique_ptr<HardwareDisplayPlane>& r) { | 38 const std::unique_ptr<HardwareDisplayPlane>& r) { |
| 38 return l->plane_id() < r->plane_id(); | 39 return l->plane_id() < r->plane_id(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 117 |
| 117 int MockHardwareDisplayPlaneManager::plane_count() const { | 118 int MockHardwareDisplayPlaneManager::plane_count() const { |
| 118 return plane_count_; | 119 return plane_count_; |
| 119 } | 120 } |
| 120 | 121 |
| 121 void MockHardwareDisplayPlaneManager::ResetPlaneCount() { | 122 void MockHardwareDisplayPlaneManager::ResetPlaneCount() { |
| 122 plane_count_ = 0; | 123 plane_count_ = 0; |
| 123 } | 124 } |
| 124 | 125 |
| 125 } // namespace ui | 126 } // namespace ui |
| OLD | NEW |