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/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: Rebase after quirks changes Created 4 years, 8 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/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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return (GetNameForEnumValue(property.get(), connector->prop_values[index]) == 150 return (GetNameForEnumValue(property.get(), connector->prop_values[index]) ==
151 "Full aspect"); 151 "Full aspect");
152 } 152 }
153 153
154 int ConnectorIndex(int device_index, int display_index) { 154 int ConnectorIndex(int device_index, int display_index) {
155 DCHECK_LT(device_index, 16); 155 DCHECK_LT(device_index, 16);
156 DCHECK_LT(display_index, 16); 156 DCHECK_LT(display_index, 16);
157 return ((device_index << 4) + display_index) & 0xFF; 157 return ((device_index << 4) + display_index) & 0xFF;
158 } 158 }
159 159
160 bool HasColorCorrectionMatrix(int fd, drmModeCrtc* crtc) {
161 ScopedDrmObjectPropertyPtr crtc_props(
162 drmModeObjectGetProperties(fd, crtc->crtc_id, DRM_MODE_OBJECT_CRTC));
163
164 for (uint32_t i = 0; i < crtc_props->count_props; ++i) {
165 ScopedDrmPropertyPtr property(drmModeGetProperty(fd, crtc_props->props[i]));
166 if (property && !strcmp(property->name, "CTM")) {
167 return true;
168 }
169 }
170 return false;
171 }
172
160 } // namespace 173 } // namespace
161 174
162 HardwareDisplayControllerInfo::HardwareDisplayControllerInfo( 175 HardwareDisplayControllerInfo::HardwareDisplayControllerInfo(
163 ScopedDrmConnectorPtr connector, 176 ScopedDrmConnectorPtr connector,
164 ScopedDrmCrtcPtr crtc, 177 ScopedDrmCrtcPtr crtc,
165 size_t index) 178 size_t index)
166 : connector_(std::move(connector)), crtc_(std::move(crtc)), index_(index) {} 179 : connector_(std::move(connector)), crtc_(std::move(crtc)), index_(index) {}
167 180
168 HardwareDisplayControllerInfo::~HardwareDisplayControllerInfo() { 181 HardwareDisplayControllerInfo::~HardwareDisplayControllerInfo() {
169 } 182 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 DisplaySnapshot_Params params; 235 DisplaySnapshot_Params params;
223 int64_t connector_index = ConnectorIndex(device_index, info->index()); 236 int64_t connector_index = ConnectorIndex(device_index, info->index());
224 params.display_id = connector_index; 237 params.display_id = connector_index;
225 params.origin = origin; 238 params.origin = origin;
226 params.sys_path = sys_path; 239 params.sys_path = sys_path;
227 params.physical_size = 240 params.physical_size =
228 gfx::Size(info->connector()->mmWidth, info->connector()->mmHeight); 241 gfx::Size(info->connector()->mmWidth, info->connector()->mmHeight);
229 params.type = GetDisplayType(info->connector()); 242 params.type = GetDisplayType(info->connector());
230 params.is_aspect_preserving_scaling = 243 params.is_aspect_preserving_scaling =
231 IsAspectPreserving(fd, info->connector()); 244 IsAspectPreserving(fd, info->connector());
245 params.has_color_correction_matrix =
246 HasColorCorrectionMatrix(fd, info->crtc());
232 247
233 ScopedDrmPropertyBlobPtr edid_blob( 248 ScopedDrmPropertyBlobPtr edid_blob(
234 GetDrmPropertyBlob(fd, info->connector(), "EDID")); 249 GetDrmPropertyBlob(fd, info->connector(), "EDID"));
235 250
236 if (edid_blob) { 251 if (edid_blob) {
237 params.edid.assign( 252 params.edid.assign(
238 static_cast<uint8_t*>(edid_blob->data), 253 static_cast<uint8_t*>(edid_blob->data),
239 static_cast<uint8_t*>(edid_blob->data) + edid_blob->length); 254 static_cast<uint8_t*>(edid_blob->data) + edid_blob->length);
240 255
241 GetDisplayIdFromEDID(params.edid, connector_index, &params.display_id, 256 GetDisplayIdFromEDID(params.edid, connector_index, &params.display_id,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 case gfx::BufferFormat::BGRX_8888: 335 case gfx::BufferFormat::BGRX_8888:
321 return DRM_FORMAT_XRGB8888; 336 return DRM_FORMAT_XRGB8888;
322 case gfx::BufferFormat::UYVY_422: 337 case gfx::BufferFormat::UYVY_422:
323 return DRM_FORMAT_UYVY; 338 return DRM_FORMAT_UYVY;
324 default: 339 default:
325 NOTREACHED(); 340 NOTREACHED();
326 return 0; 341 return 0;
327 } 342 }
328 } 343 }
329 } // namespace ui 344 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/common/native_display_delegate_ozone.cc ('k') | ui/ozone/platform/drm/gpu/drm_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698