Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: ui/ozone/platform/drm/gpu/mock_hardware_display_plane_manager.cc

Issue 2948513003: Revert of ozone/drm: Only reuse ScanoutBuffers with compatible modifiers (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 };
22 drm_ = drm; 21 drm_ = drm;
23 crtcs_ = crtcs; 22 crtcs_ = crtcs;
24 for (size_t crtc_idx = 0; crtc_idx < crtcs_.size(); crtc_idx++) { 23 for (size_t crtc_idx = 0; crtc_idx < crtcs_.size(); crtc_idx++) {
25 for (size_t i = 0; i < planes_per_crtc; i++) { 24 for (size_t i = 0; i < planes_per_crtc; i++) {
26 std::unique_ptr<HardwareDisplayPlane> plane( 25 std::unique_ptr<HardwareDisplayPlane> plane(
27 new HardwareDisplayPlane(kPlaneBaseId + i, 1 << crtc_idx)); 26 new HardwareDisplayPlane(kPlaneBaseId + i, 1 << crtc_idx));
28 plane->Initialize(drm, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888), 27 plane->Initialize(drm, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888),
29 std::vector<drm_format_modifier>(1, linear_modifier), 28 std::vector<drm_format_modifier>(), // modifiers
30 false, true); 29 false, true);
31 planes_.push_back(std::move(plane)); 30 planes_.push_back(std::move(plane));
32 } 31 }
33 } 32 }
34 33
35 // The real HDPM uses sorted planes, so sort them for consistency. 34 // The real HDPM uses sorted planes, so sort them for consistency.
36 std::sort(planes_.begin(), planes_.end(), 35 std::sort(planes_.begin(), planes_.end(),
37 [](const std::unique_ptr<HardwareDisplayPlane>& l, 36 [](const std::unique_ptr<HardwareDisplayPlane>& l,
38 const std::unique_ptr<HardwareDisplayPlane>& r) { 37 const std::unique_ptr<HardwareDisplayPlane>& r) {
39 return l->plane_id() < r->plane_id(); 38 return l->plane_id() < r->plane_id();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 116
118 int MockHardwareDisplayPlaneManager::plane_count() const { 117 int MockHardwareDisplayPlaneManager::plane_count() const {
119 return plane_count_; 118 return plane_count_;
120 } 119 }
121 120
122 void MockHardwareDisplayPlaneManager::ResetPlaneCount() { 121 void MockHardwareDisplayPlaneManager::ResetPlaneCount() {
123 plane_count_ = 0; 122 plane_count_ = 0;
124 } 123 }
125 124
126 } // namespace ui 125 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_buffer_base.cc ('k') | ui/ozone/platform/drm/gpu/mock_scanout_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698