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

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

Issue 1140773003: [1.5/2][Ozone-Drm] Keep track of display origin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@handle-display-init3
Patch Set: . 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/drm_display.h" 5 #include "ui/ozone/platform/drm/gpu/drm_display.h"
6 6
7 #include <xf86drmMode.h> 7 #include <xf86drmMode.h>
8 8
9 #include "ui/display/types/gamma_ramp_rgb_entry.h" 9 #include "ui/display/types/gamma_ramp_rgb_entry.h"
10 #include "ui/ozone/platform/drm/common/drm_util.h" 10 #include "ui/ozone/platform/drm/common/drm_util.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 NOTREACHED(); 62 NOTREACHED();
63 return std::string(); 63 return std::string();
64 } 64 }
65 65
66 gfx::Size GetDrmModeSize(const drmModeModeInfo& mode) { 66 gfx::Size GetDrmModeSize(const drmModeModeInfo& mode) {
67 return gfx::Size(mode.hdisplay, mode.vdisplay); 67 return gfx::Size(mode.hdisplay, mode.vdisplay);
68 } 68 }
69 69
70 std::vector<drmModeModeInfo> GetDrmModeVector(drmModeConnector* connector) {
71 std::vector<drmModeModeInfo> modes;
72 for (int i = 0; i < connector->count_modes; ++i)
73 modes.push_back(connector->modes[i]);
74
75 return modes;
76 }
77
70 } // namespace 78 } // namespace
71 79
72 DrmDisplay::DrmDisplay(ScreenManager* screen_manager, 80 DrmDisplay::DrmDisplay(ScreenManager* screen_manager,
73 int64_t display_id, 81 const scoped_refptr<DrmDevice>& drm)
74 const scoped_refptr<DrmDevice>& drm, 82 : screen_manager_(screen_manager), display_id_(-1), drm_(drm) {
75 uint32_t crtc,
76 uint32_t connector,
77 const std::vector<drmModeModeInfo>& modes)
78 : screen_manager_(screen_manager),
79 display_id_(display_id),
80 drm_(drm),
81 crtc_(crtc),
82 connector_(connector),
83 modes_(modes) {
84 } 83 }
85 84
86 DrmDisplay::~DrmDisplay() { 85 DrmDisplay::~DrmDisplay() {
87 } 86 }
88 87
88 DisplaySnapshot_Params DrmDisplay::Update(HardwareDisplayControllerInfo* info,
89 size_t display_index) {
90 DisplaySnapshot_Params params =
91 CreateDisplaySnapshotParams(info, drm_->get_fd(), display_index, origin_);
92 crtc_ = info->crtc()->crtc_id;
93 connector_ = info->connector()->connector_id;
94 display_id_ = params.display_id;
95 modes_ = GetDrmModeVector(info->connector());
96 return params;
97 }
98
89 bool DrmDisplay::Configure(const drmModeModeInfo* mode, 99 bool DrmDisplay::Configure(const drmModeModeInfo* mode,
90 const gfx::Point& origin) { 100 const gfx::Point& origin) {
91 VLOG(1) << "DRM configuring: device=" << drm_->device_path().value() 101 VLOG(1) << "DRM configuring: device=" << drm_->device_path().value()
92 << " crtc=" << crtc_ << " connector=" << connector_ 102 << " crtc=" << crtc_ << " connector=" << connector_
93 << " origin=" << origin.ToString() 103 << " origin=" << origin.ToString()
94 << " size=" << (mode ? GetDrmModeSize(*mode).ToString() : "0x0"); 104 << " size=" << (mode ? GetDrmModeSize(*mode).ToString() : "0x0");
95 105
96 if (mode) { 106 if (mode) {
97 if (!screen_manager_->ConfigureDisplayController(drm_, crtc_, connector_, 107 if (!screen_manager_->ConfigureDisplayController(drm_, crtc_, connector_,
98 origin, *mode)) { 108 origin, *mode)) {
99 VLOG(1) << "Failed to configure: device=" << drm_->device_path().value() 109 VLOG(1) << "Failed to configure: device=" << drm_->device_path().value()
100 << " crtc=" << crtc_ << " connector=" << connector_; 110 << " crtc=" << crtc_ << " connector=" << connector_;
101 return false; 111 return false;
102 } 112 }
103 } else { 113 } else {
104 if (!screen_manager_->DisableDisplayController(drm_, crtc_)) { 114 if (!screen_manager_->DisableDisplayController(drm_, crtc_)) {
105 VLOG(1) << "Failed to disable device=" << drm_->device_path().value() 115 VLOG(1) << "Failed to disable device=" << drm_->device_path().value()
106 << " crtc=" << crtc_; 116 << " crtc=" << crtc_;
107 return false; 117 return false;
108 } 118 }
109 } 119 }
110 120
121 origin_ = origin;
111 return true; 122 return true;
112 } 123 }
113 124
114 bool DrmDisplay::GetHDCPState(HDCPState* state) { 125 bool DrmDisplay::GetHDCPState(HDCPState* state) {
115 ScopedDrmConnectorPtr connector(drm_->GetConnector(connector_)); 126 ScopedDrmConnectorPtr connector(drm_->GetConnector(connector_));
116 if (!connector) { 127 if (!connector) {
117 PLOG(ERROR) << "Failed to get connector " << connector_; 128 PLOG(ERROR) << "Failed to get connector " << connector_;
118 return false; 129 return false;
119 } 130 }
120 131
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 170 }
160 171
161 void DrmDisplay::SetGammaRamp(const std::vector<GammaRampRGBEntry>& lut) { 172 void DrmDisplay::SetGammaRamp(const std::vector<GammaRampRGBEntry>& lut) {
162 if (!drm_->SetGammaRamp(crtc_, lut)) { 173 if (!drm_->SetGammaRamp(crtc_, lut)) {
163 LOG(ERROR) << "Failed to set gamma ramp for display: crtc_id = " << crtc_ 174 LOG(ERROR) << "Failed to set gamma ramp for display: crtc_id = " << crtc_
164 << " size = " << lut.size(); 175 << " size = " << lut.size();
165 } 176 }
166 } 177 }
167 178
168 } // namespace ui 179 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_display.h ('k') | ui/ozone/platform/drm/gpu/drm_gpu_display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698