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

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

Issue 1279703004: Ozone: HDC should only keep track of planes owned by it’s crtc controllers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Track owned planes Created 5 years, 4 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/crtc_controller.cc ('k') | no next file » | 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_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 10
(...skipping 24 matching lines...) Expand all
35 HardwareDisplayController::~HardwareDisplayController() { 35 HardwareDisplayController::~HardwareDisplayController() {
36 // Reset the cursor. 36 // Reset the cursor.
37 UnsetCursor(); 37 UnsetCursor();
38 } 38 }
39 39
40 bool HardwareDisplayController::Modeset(const OverlayPlane& primary, 40 bool HardwareDisplayController::Modeset(const OverlayPlane& primary,
41 drmModeModeInfo mode) { 41 drmModeModeInfo mode) {
42 TRACE_EVENT0("drm", "HDC::Modeset"); 42 TRACE_EVENT0("drm", "HDC::Modeset");
43 DCHECK(primary.buffer.get()); 43 DCHECK(primary.buffer.get());
44 bool status = true; 44 bool status = true;
45 for (size_t i = 0; i < crtc_controllers_.size(); ++i) 45
46 status &= crtc_controllers_[i]->Modeset(primary, mode); 46 scoped_refptr<DrmDevice> drm = GetAllocationDrmDevice();
47 HardwareDisplayPlaneList* plane_list = owned_hardware_planes_.get(drm.get());
48 // CRTC controllers owned by this HDC might have changed, refresh the list.
dnicoara 2015/08/18 17:07:52 Since the RemoveCrtc() all updates the list for th
kalyank 2015/08/18 23:15:40 Done.
49 plane_list->old_plane_list.clear();
50
51 HardwareDisplayPlaneManager* manager = drm->plane_manager();
52 const ScopedVector<HardwareDisplayPlane>& all_planes = manager->planes();
53 for (auto* controller : crtc_controllers_) {
54 status &= controller->Modeset(primary, mode);
55 uint32_t crtc = controller->crtc();
56 for (auto* plane : all_planes) {
57 if (plane->in_use() && (plane->owning_crtc() == crtc))
58 plane_list->old_plane_list.push_back(plane);
59 }
60 }
47 61
48 is_disabled_ = false; 62 is_disabled_ = false;
49 mode_ = mode; 63 mode_ = mode;
50 64
51 return status; 65 return status;
52 } 66 }
53 67
54 void HardwareDisplayController::Disable() { 68 void HardwareDisplayController::Disable() {
55 TRACE_EVENT0("drm", "HDC::Disable"); 69 TRACE_EVENT0("drm", "HDC::Disable");
56 for (size_t i = 0; i < crtc_controllers_.size(); ++i) 70 for (size_t i = 0; i < crtc_controllers_.size(); ++i)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Remove entry from |owned_hardware_planes_| iff no other crtcs share it. 170 // Remove entry from |owned_hardware_planes_| iff no other crtcs share it.
157 bool found = false; 171 bool found = false;
158 for (ScopedVector<CrtcController>::iterator it = 172 for (ScopedVector<CrtcController>::iterator it =
159 crtc_controllers_.begin(); 173 crtc_controllers_.begin();
160 it != crtc_controllers_.end(); ++it) { 174 it != crtc_controllers_.end(); ++it) {
161 if ((*it)->drm() == controller->drm()) { 175 if ((*it)->drm() == controller->drm()) {
162 found = true; 176 found = true;
163 break; 177 break;
164 } 178 }
165 } 179 }
166 if (!found) 180 if (found) {
181 std::vector<HardwareDisplayPlane*> all_planes;
182 HardwareDisplayPlaneList* plane_list =
183 owned_hardware_planes_.get(drm.get());
184 all_planes.swap(plane_list->old_plane_list);
185 for (auto* plane : all_planes) {
186 if (plane->owning_crtc() != crtc)
187 plane_list->old_plane_list.push_back(plane);
188 }
189 } else {
167 owned_hardware_planes_.erase(controller->drm().get()); 190 owned_hardware_planes_.erase(controller->drm().get());
191 }
168 192
169 return controller.Pass(); 193 return controller.Pass();
170 } 194 }
171 } 195 }
172 196
173 return nullptr; 197 return nullptr;
174 } 198 }
175 199
176 bool HardwareDisplayController::HasCrtc(const scoped_refptr<DrmDevice>& drm, 200 bool HardwareDisplayController::HasCrtc(const scoped_refptr<DrmDevice>& drm,
177 uint32_t crtc) const { 201 uint32_t crtc) const {
(...skipping 28 matching lines...) Expand all
206 230
207 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() 231 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice()
208 const { 232 const {
209 DCHECK(!crtc_controllers_.empty()); 233 DCHECK(!crtc_controllers_.empty());
210 // TODO(dnicoara) When we support mirroring across DRM devices, figure out 234 // TODO(dnicoara) When we support mirroring across DRM devices, figure out
211 // which device should be used for allocations. 235 // which device should be used for allocations.
212 return crtc_controllers_[0]->drm(); 236 return crtc_controllers_[0]->drm();
213 } 237 }
214 238
215 } // namespace ui 239 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/crtc_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698