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

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

Issue 1338843002: [Ozone-DRM] Use CRTC's mode when configuring it for mirror mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-scanout3
Patch Set: Removed get_mode() from HDC per dbehr@'s comment Created 5 years, 3 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 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
14 #include "third_party/skia/include/core/SkCanvas.h" 14 #include "third_party/skia/include/core/SkCanvas.h"
15 #include "ui/gfx/geometry/point.h" 15 #include "ui/gfx/geometry/point.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 #include "ui/gfx/swap_result.h" 17 #include "ui/gfx/swap_result.h"
18 #include "ui/ozone/platform/drm/gpu/crtc_controller.h" 18 #include "ui/ozone/platform/drm/gpu/crtc_controller.h"
19 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" 19 #include "ui/ozone/platform/drm/gpu/drm_buffer.h"
20 #include "ui/ozone/platform/drm/gpu/drm_device.h" 20 #include "ui/ozone/platform/drm/gpu/drm_device.h"
21 #include "ui/ozone/platform/drm/gpu/page_flip_request.h" 21 #include "ui/ozone/platform/drm/gpu/page_flip_request.h"
22 #include "ui/ozone/public/native_pixmap.h" 22 #include "ui/ozone/public/native_pixmap.h"
23 23
24 namespace ui { 24 namespace ui {
25 25
26 HardwareDisplayController::HardwareDisplayController( 26 HardwareDisplayController::HardwareDisplayController(
27 scoped_ptr<CrtcController> controller, 27 scoped_ptr<CrtcController> controller,
28 const gfx::Point& origin) 28 const gfx::Point& origin)
29 : origin_(origin), 29 : origin_(origin),
30 mode_(controller->mode()),
31 is_disabled_(controller->is_disabled()) { 30 is_disabled_(controller->is_disabled()) {
32 AddCrtc(controller.Pass()); 31 AddCrtc(controller.Pass());
33 } 32 }
34 33
35 HardwareDisplayController::~HardwareDisplayController() { 34 HardwareDisplayController::~HardwareDisplayController() {
36 // Reset the cursor. 35 // Reset the cursor.
37 UnsetCursor(); 36 UnsetCursor();
38 } 37 }
39 38
40 bool HardwareDisplayController::Modeset(const OverlayPlane& primary, 39 bool HardwareDisplayController::Modeset(const OverlayPlane& primary,
41 drmModeModeInfo mode) { 40 drmModeModeInfo mode) {
42 TRACE_EVENT0("drm", "HDC::Modeset"); 41 TRACE_EVENT0("drm", "HDC::Modeset");
43 DCHECK(primary.buffer.get()); 42 DCHECK(primary.buffer.get());
44 bool status = true; 43 bool status = true;
45 for (size_t i = 0; i < crtc_controllers_.size(); ++i) 44 for (size_t i = 0; i < crtc_controllers_.size(); ++i)
46 status &= crtc_controllers_[i]->Modeset(primary, mode); 45 status &= crtc_controllers_[i]->Modeset(primary, mode);
47 46
48 is_disabled_ = false; 47 is_disabled_ = false;
49 mode_ = mode;
50 48
51 return status; 49 return status;
52 } 50 }
51
52 bool HardwareDisplayController::Enable(const OverlayPlane& primary) {
53 TRACE_EVENT0("drm", "HDC::Enable");
54 DCHECK(primary.buffer.get());
55 bool status = true;
56 for (size_t i = 0; i < crtc_controllers_.size(); ++i) {
57 status &=
58 crtc_controllers_[i]->Modeset(primary, crtc_controllers_[i]->mode());
59 }
60
61 is_disabled_ = false;
62
63 return status;
64 }
53 65
54 void HardwareDisplayController::Disable() { 66 void HardwareDisplayController::Disable() {
55 TRACE_EVENT0("drm", "HDC::Disable"); 67 TRACE_EVENT0("drm", "HDC::Disable");
56 for (size_t i = 0; i < crtc_controllers_.size(); ++i) 68 for (size_t i = 0; i < crtc_controllers_.size(); ++i)
57 crtc_controllers_[i]->Disable(); 69 crtc_controllers_[i]->Disable();
58 70
59 71
60 is_disabled_ = true; 72 is_disabled_ = true;
61 } 73 }
62 74
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 219
208 bool HardwareDisplayController::IsMirrored() const { 220 bool HardwareDisplayController::IsMirrored() const {
209 return crtc_controllers_.size() > 1; 221 return crtc_controllers_.size() > 1;
210 } 222 }
211 223
212 bool HardwareDisplayController::IsDisabled() const { 224 bool HardwareDisplayController::IsDisabled() const {
213 return is_disabled_; 225 return is_disabled_;
214 } 226 }
215 227
216 gfx::Size HardwareDisplayController::GetModeSize() const { 228 gfx::Size HardwareDisplayController::GetModeSize() const {
217 return gfx::Size(mode_.hdisplay, mode_.vdisplay); 229 // If there are multiple CRTCs they should all have the same size.
230 return gfx::Size(crtc_controllers_[0]->mode().hdisplay,
231 crtc_controllers_[0]->mode().vdisplay);
218 } 232 }
219 233
220 uint64_t HardwareDisplayController::GetTimeOfLastFlip() const { 234 uint64_t HardwareDisplayController::GetTimeOfLastFlip() const {
221 uint64_t time = 0; 235 uint64_t time = 0;
222 for (size_t i = 0; i < crtc_controllers_.size(); ++i) 236 for (size_t i = 0; i < crtc_controllers_.size(); ++i)
223 if (time < crtc_controllers_[i]->time_of_last_flip()) 237 if (time < crtc_controllers_[i]->time_of_last_flip())
224 time = crtc_controllers_[i]->time_of_last_flip(); 238 time = crtc_controllers_[i]->time_of_last_flip();
225 239
226 return time; 240 return time;
227 } 241 }
228 242
229 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice() 243 scoped_refptr<DrmDevice> HardwareDisplayController::GetAllocationDrmDevice()
230 const { 244 const {
231 DCHECK(!crtc_controllers_.empty()); 245 DCHECK(!crtc_controllers_.empty());
232 // TODO(dnicoara) When we support mirroring across DRM devices, figure out 246 // TODO(dnicoara) When we support mirroring across DRM devices, figure out
233 // which device should be used for allocations. 247 // which device should be used for allocations.
234 return crtc_controllers_[0]->drm(); 248 return crtc_controllers_[0]->drm();
235 } 249 }
236 250
237 } // namespace ui 251 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/hardware_display_controller.h ('k') | ui/ozone/platform/drm/gpu/screen_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698