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

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

Issue 1100803004: ozone: Add ability to set clinet capabilities which we will need for atomic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert PS4 Created 5 years, 7 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
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.cc ('k') | ui/ozone/platform/drm/test/mock_drm_device.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" 5 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h"
6 6
7 #include <drm.h> 7 #include <drm.h>
8 #include <xf86drm.h> 8 #include <xf86drm.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 HardwareDisplayPlaneManager::HardwareDisplayPlaneManager() : drm_(nullptr) { 62 HardwareDisplayPlaneManager::HardwareDisplayPlaneManager() : drm_(nullptr) {
63 } 63 }
64 64
65 HardwareDisplayPlaneManager::~HardwareDisplayPlaneManager() { 65 HardwareDisplayPlaneManager::~HardwareDisplayPlaneManager() {
66 } 66 }
67 67
68 bool HardwareDisplayPlaneManager::Initialize(DrmDevice* drm) { 68 bool HardwareDisplayPlaneManager::Initialize(DrmDevice* drm) {
69 drm_ = drm; 69 drm_ = drm;
70
71 // Try to get all of the planes if possible, so we don't have to try to
72 // discover hidden primary planes.
73 bool has_universal_planes = false;
74 #if defined(DRM_CLIENT_CAP_UNIVERSAL_PLANES)
75 has_universal_planes = drm->SetCapability(DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
76 #endif // defined(DRM_CLIENT_CAP_UNIVERSAL_PLANES)
77
70 ScopedDrmResourcesPtr resources(drmModeGetResources(drm->get_fd())); 78 ScopedDrmResourcesPtr resources(drmModeGetResources(drm->get_fd()));
71 if (!resources) { 79 if (!resources) {
72 PLOG(ERROR) << "Failed to get resources"; 80 PLOG(ERROR) << "Failed to get resources";
73 return false; 81 return false;
74 } 82 }
75 83
76 ScopedDrmPlaneResPtr plane_resources(drmModeGetPlaneResources(drm->get_fd())); 84 ScopedDrmPlaneResPtr plane_resources(drmModeGetPlaneResources(drm->get_fd()));
77 if (!plane_resources) { 85 if (!plane_resources) {
78 PLOG(ERROR) << "Failed to get plane resources"; 86 PLOG(ERROR) << "Failed to get plane resources";
79 return false; 87 return false;
(...skipping 17 matching lines...) Expand all
97 scoped_ptr<HardwareDisplayPlane> plane( 105 scoped_ptr<HardwareDisplayPlane> plane(
98 CreatePlane(drm_plane->plane_id, drm_plane->possible_crtcs)); 106 CreatePlane(drm_plane->plane_id, drm_plane->possible_crtcs));
99 if (plane->Initialize(drm)) 107 if (plane->Initialize(drm))
100 planes_.push_back(plane.release()); 108 planes_.push_back(plane.release());
101 } 109 }
102 110
103 // crbug.com/464085: if driver reports no primary planes for a crtc, create a 111 // crbug.com/464085: if driver reports no primary planes for a crtc, create a
104 // dummy plane for which we can assign exactly one overlay. 112 // dummy plane for which we can assign exactly one overlay.
105 // TODO(dnicoara): refactor this to simplify AssignOverlayPlanes and move 113 // TODO(dnicoara): refactor this to simplify AssignOverlayPlanes and move
106 // this workaround into HardwareDisplayPlaneLegacy. 114 // this workaround into HardwareDisplayPlaneLegacy.
107 for (int i = 0; i < resources->count_crtcs; ++i) { 115 if (!has_universal_planes) {
108 if (plane_ids.find(resources->crtcs[i] - 1) == plane_ids.end()) { 116 for (int i = 0; i < resources->count_crtcs; ++i) {
109 scoped_ptr<HardwareDisplayPlane> dummy_plane( 117 if (plane_ids.find(resources->crtcs[i] - 1) == plane_ids.end()) {
110 CreatePlane(resources->crtcs[i] - 1, (1 << i))); 118 scoped_ptr<HardwareDisplayPlane> dummy_plane(
111 dummy_plane->set_is_dummy(true); 119 CreatePlane(resources->crtcs[i] - 1, (1 << i)));
112 if (dummy_plane->Initialize(drm)) 120 dummy_plane->set_is_dummy(true);
113 planes_.push_back(dummy_plane.release()); 121 if (dummy_plane->Initialize(drm))
122 planes_.push_back(dummy_plane.release());
123 }
114 } 124 }
115 } 125 }
116 126
117 std::sort(planes_.begin(), planes_.end(), 127 std::sort(planes_.begin(), planes_.end(),
118 [](HardwareDisplayPlane* l, HardwareDisplayPlane* r) { 128 [](HardwareDisplayPlane* l, HardwareDisplayPlane* r) {
119 return l->plane_id() < r->plane_id(); 129 return l->plane_id() < r->plane_id();
120 }); 130 });
121 return true; 131 return true;
122 } 132 }
123 133
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 if (plane->owning_crtc() == crtc_id) { 223 if (plane->owning_crtc() == crtc_id) {
214 plane->set_owning_crtc(0); 224 plane->set_owning_crtc(0);
215 plane->set_in_use(false); 225 plane->set_in_use(false);
216 } else { 226 } else {
217 plane_list->old_plane_list.push_back(plane); 227 plane_list->old_plane_list.push_back(plane);
218 } 228 }
219 } 229 }
220 } 230 }
221 231
222 } // namespace ui 232 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_device.cc ('k') | ui/ozone/platform/drm/test/mock_drm_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698