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

Side by Side Diff: ui/ozone/platform/drm/common/drm_util.cc

Issue 1182063002: Add support for more advanced color correction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@qcms-fixed-point-gamma
Patch Set: Refactor for glevin@ and load VCGT always Created 5 years, 1 month 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/common/drm_util.h" 5 #include "ui/ozone/platform/drm/common/drm_util.h"
6 6
7 #include <drm_fourcc.h> 7 #include <drm_fourcc.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return (GetNameForEnumValue(property.get(), connector->prop_values[index]) == 149 return (GetNameForEnumValue(property.get(), connector->prop_values[index]) ==
150 "Full aspect"); 150 "Full aspect");
151 } 151 }
152 152
153 int ConnectorIndex(int device_index, int display_index) { 153 int ConnectorIndex(int device_index, int display_index) {
154 DCHECK_LT(device_index, 16); 154 DCHECK_LT(device_index, 16);
155 DCHECK_LT(display_index, 16); 155 DCHECK_LT(display_index, 16);
156 return ((device_index << 4) + display_index) & 0xFF; 156 return ((device_index << 4) + display_index) & 0xFF;
157 } 157 }
158 158
159 bool HasColorCorrectionMatrix(int fd, drmModeCrtc* crtc) {
160 ScopedDrmObjectPropertyPtr crtc_props(
161 drmModeObjectGetProperties(fd, crtc->crtc_id, DRM_MODE_OBJECT_CRTC));
162
163 for (uint32_t i = 0; i < crtc_props->count_props; ++i) {
164 ScopedDrmPropertyPtr property(drmModeGetProperty(fd, crtc_props->props[i]));
165 if (property && !strcmp(property->name, "CTM")) {
166 return true;
167 }
168 }
169 return false;
170 }
171
159 } // namespace 172 } // namespace
160 173
161 HardwareDisplayControllerInfo::HardwareDisplayControllerInfo( 174 HardwareDisplayControllerInfo::HardwareDisplayControllerInfo(
162 ScopedDrmConnectorPtr connector, 175 ScopedDrmConnectorPtr connector,
163 ScopedDrmCrtcPtr crtc, 176 ScopedDrmCrtcPtr crtc,
164 size_t index) 177 size_t index)
165 : connector_(connector.Pass()), crtc_(crtc.Pass()), index_(index) {} 178 : connector_(connector.Pass()), crtc_(crtc.Pass()), index_(index) {}
166 179
167 HardwareDisplayControllerInfo::~HardwareDisplayControllerInfo() { 180 HardwareDisplayControllerInfo::~HardwareDisplayControllerInfo() {
168 } 181 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 const gfx::Point& origin) { 232 const gfx::Point& origin) {
220 DisplaySnapshot_Params params; 233 DisplaySnapshot_Params params;
221 int64 connector_index = ConnectorIndex(device_index, info->index()); 234 int64 connector_index = ConnectorIndex(device_index, info->index());
222 params.display_id = connector_index; 235 params.display_id = connector_index;
223 params.origin = origin; 236 params.origin = origin;
224 params.physical_size = 237 params.physical_size =
225 gfx::Size(info->connector()->mmWidth, info->connector()->mmHeight); 238 gfx::Size(info->connector()->mmWidth, info->connector()->mmHeight);
226 params.type = GetDisplayType(info->connector()); 239 params.type = GetDisplayType(info->connector());
227 params.is_aspect_preserving_scaling = 240 params.is_aspect_preserving_scaling =
228 IsAspectPreserving(fd, info->connector()); 241 IsAspectPreserving(fd, info->connector());
242 params.has_color_correction_matrix =
243 HasColorCorrectionMatrix(fd, info->crtc());
229 244
230 ScopedDrmPropertyBlobPtr edid_blob( 245 ScopedDrmPropertyBlobPtr edid_blob(
231 GetDrmPropertyBlob(fd, info->connector(), "EDID")); 246 GetDrmPropertyBlob(fd, info->connector(), "EDID"));
232 247
233 if (edid_blob) { 248 if (edid_blob) {
234 std::vector<uint8_t> edid( 249 std::vector<uint8_t> edid(
235 static_cast<uint8_t*>(edid_blob->data), 250 static_cast<uint8_t*>(edid_blob->data),
236 static_cast<uint8_t*>(edid_blob->data) + edid_blob->length); 251 static_cast<uint8_t*>(edid_blob->data) + edid_blob->length);
237 252
238 GetDisplayIdFromEDID(edid, connector_index, &params.display_id, 253 GetDisplayIdFromEDID(edid, connector_index, &params.display_id,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return DRM_FORMAT_ARGB8888; 292 return DRM_FORMAT_ARGB8888;
278 case gfx::BufferFormat::BGRX_8888: 293 case gfx::BufferFormat::BGRX_8888:
279 return DRM_FORMAT_XRGB8888; 294 return DRM_FORMAT_XRGB8888;
280 default: 295 default:
281 NOTREACHED(); 296 NOTREACHED();
282 return 0; 297 return 0;
283 } 298 }
284 } 299 }
285 300
286 } // namespace ui 301 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698