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

Side by Side Diff: ui/ozone/platform/dri/hardware_display_controller.cc

Issue 838633002: [Ozone-DRI] Reuse framebuffer when re-enabling CRTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 11 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 | « no previous file | ui/ozone/platform/dri/screen_manager.cc » ('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/dri/hardware_display_controller.h" 5 #include "ui/ozone/platform/dri/hardware_display_controller.h"
6 6
7 #include <drm.h> 7 #include <drm.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <string.h> 9 #include <string.h>
10 #include <xf86drm.h> 10 #include <xf86drm.h>
(...skipping 30 matching lines...) Expand all
41 void* controller) { 41 void* controller) {
42 static_cast<CrtcController*>(controller) 42 static_cast<CrtcController*>(controller)
43 ->OnPageFlipEvent(frame, seconds, useconds); 43 ->OnPageFlipEvent(frame, seconds, useconds);
44 } 44 }
45 45
46 } // namespace 46 } // namespace
47 47
48 HardwareDisplayController::HardwareDisplayController( 48 HardwareDisplayController::HardwareDisplayController(
49 scoped_ptr<CrtcController> controller) 49 scoped_ptr<CrtcController> controller)
50 : is_disabled_(true) { 50 : is_disabled_(true) {
51 memset(&mode_, 0, sizeof(mode_));
51 AddCrtc(controller.Pass()); 52 AddCrtc(controller.Pass());
52 } 53 }
53 54
54 HardwareDisplayController::~HardwareDisplayController() { 55 HardwareDisplayController::~HardwareDisplayController() {
55 // Reset the cursor. 56 // Reset the cursor.
56 UnsetCursor(); 57 UnsetCursor();
57 } 58 }
58 59
59 bool HardwareDisplayController::Modeset(const OverlayPlane& primary, 60 bool HardwareDisplayController::Modeset(const OverlayPlane& primary,
60 drmModeModeInfo mode) { 61 drmModeModeInfo mode) {
61 TRACE_EVENT0("dri", "HDC::Modeset"); 62 TRACE_EVENT0("dri", "HDC::Modeset");
62 DCHECK(primary.buffer.get()); 63 DCHECK(primary.buffer.get());
63 bool status = true; 64 bool status = true;
64 for (size_t i = 0; i < crtc_controllers_.size(); ++i) 65 for (size_t i = 0; i < crtc_controllers_.size(); ++i)
65 status &= crtc_controllers_[i]->Modeset(primary, mode); 66 status &= crtc_controllers_[i]->Modeset(primary, mode);
66 67
67 current_planes_ = std::vector<OverlayPlane>(1, primary); 68 current_planes_ = std::vector<OverlayPlane>(1, primary);
68 pending_planes_.clear(); 69 pending_planes_.clear();
69 is_disabled_ = false; 70 is_disabled_ = false;
70 mode_ = mode; 71 mode_ = mode;
71 return status; 72 return status;
72 } 73 }
73 74
74 bool HardwareDisplayController::Enable() { 75 bool HardwareDisplayController::Enable() {
75 TRACE_EVENT0("dri", "HDC::Enable"); 76 TRACE_EVENT0("dri", "HDC::Enable");
76 DCHECK(!current_planes_.empty()); 77 DCHECK(!current_planes_.empty());
77 const OverlayPlane* primary = OverlayPlane::GetPrimaryPlane(current_planes_); 78 const OverlayPlane* primary = OverlayPlane::GetPrimaryPlane(current_planes_);
78 DCHECK(primary->buffer.get());
79 bool status = true;
80 for (size_t i = 0; i < crtc_controllers_.size(); ++i)
81 status &= crtc_controllers_[i]->Modeset(*primary, mode_);
82 79
83 return status; 80 return Modeset(*primary, mode_);
84 } 81 }
85 82
86 void HardwareDisplayController::Disable() { 83 void HardwareDisplayController::Disable() {
87 TRACE_EVENT0("dri", "HDC::Disable"); 84 TRACE_EVENT0("dri", "HDC::Disable");
88 for (size_t i = 0; i < crtc_controllers_.size(); ++i) 85 for (size_t i = 0; i < crtc_controllers_.size(); ++i)
89 crtc_controllers_[i]->Disable(); 86 crtc_controllers_[i]->Disable();
90 87
91 is_disabled_ = true; 88 is_disabled_ = true;
92 } 89 }
93 90
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 uint64_t HardwareDisplayController::GetTimeOfLastFlip() const { 235 uint64_t HardwareDisplayController::GetTimeOfLastFlip() const {
239 uint64_t time = 0; 236 uint64_t time = 0;
240 for (size_t i = 0; i < crtc_controllers_.size(); ++i) 237 for (size_t i = 0; i < crtc_controllers_.size(); ++i)
241 if (time < crtc_controllers_[i]->time_of_last_flip()) 238 if (time < crtc_controllers_[i]->time_of_last_flip())
242 time = crtc_controllers_[i]->time_of_last_flip(); 239 time = crtc_controllers_[i]->time_of_last_flip();
243 240
244 return time; 241 return time;
245 } 242 }
246 243
247 } // namespace ui 244 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/platform/dri/screen_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698