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

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

Issue 2576263002: ozone: Allocate scanout buffer according to KMS modifiers (Closed)
Patch Set: ozone: Allocate scanout buffer according to KMS modifiers Created 3 years, 12 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 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_controller.h" 5 #include "ui/ozone/platform/drm/gpu/hardware_display_controller.h"
6 6
7 #include <drm.h> 7 #include <drm.h>
8 #include <string.h> 8 #include <string.h>
9 #include <xf86drm.h> 9 #include <xf86drm.h>
10 #include <utility> 10 #include <utility>
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 uint32_t z_order) const { 136 uint32_t z_order) const {
137 for (size_t i = 0; i < crtc_controllers_.size(); ++i) { 137 for (size_t i = 0; i < crtc_controllers_.size(); ++i) {
138 // Make sure all displays have overlay to support this format. 138 // Make sure all displays have overlay to support this format.
139 if (!crtc_controllers_[i]->IsFormatSupported(fourcc_format, z_order)) 139 if (!crtc_controllers_[i]->IsFormatSupported(fourcc_format, z_order))
140 return false; 140 return false;
141 } 141 }
142 142
143 return true; 143 return true;
144 } 144 }
145 145
146 std::vector<uint64_t> HardwareDisplayController::GetFormatModifiers(
147 uint32_t format) {
148 std::vector<uint64_t> modifiers;
149
150 if (crtc_controllers_.empty())
151 return modifiers;
152
153 modifiers = crtc_controllers_[0]->GetFormatModifiers(format);
154
155 for (size_t i = 1; i < crtc_controllers_.size(); ++i) {
156 std::vector<uint64_t> other =
157 crtc_controllers_[i]->GetFormatModifiers(format);
158 std::vector<uint64_t> intersection;
159
160 std::set_intersection(modifiers.begin(), modifiers.end(),
161 other.begin(), other.end(),
162 std::back_inserter(intersection));
163 modifiers = std::move(intersection);
164 }
165
166 return modifiers;
167 }
168
146 bool HardwareDisplayController::SetCursor( 169 bool HardwareDisplayController::SetCursor(
147 const scoped_refptr<ScanoutBuffer>& buffer) { 170 const scoped_refptr<ScanoutBuffer>& buffer) {
148 bool status = true; 171 bool status = true;
149 172
150 if (is_disabled_) 173 if (is_disabled_)
151 return true; 174 return true;
152 175
153 for (const auto& controller : crtc_controllers_) 176 for (const auto& controller : crtc_controllers_)
154 status &= controller->SetCursor(buffer); 177 status &= controller->SetCursor(buffer);
155 178
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 293
271 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() 294 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice()
272 const { 295 const {
273 DCHECK(!crtc_controllers_.empty()); 296 DCHECK(!crtc_controllers_.empty());
274 // TODO(dnicoara) When we support mirroring across DRM devices, figure out 297 // TODO(dnicoara) When we support mirroring across DRM devices, figure out
275 // which device should be used for allocations. 298 // which device should be used for allocations.
276 return crtc_controllers_[0]->drm(); 299 return crtc_controllers_[0]->drm();
277 } 300 }
278 301
279 } // namespace ui 302 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/hardware_display_controller.h ('k') | ui/ozone/platform/drm/gpu/hardware_display_plane.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698