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

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

Issue 2894523007: Use display::DisplayMode in ozone/drm/gpu (Closed)
Patch Set: review nits Created 3 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 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 ScopedDrmPropertyPtr property(drmModeGetProperty(fd, crtc_props->props[i])); 191 ScopedDrmPropertyPtr property(drmModeGetProperty(fd, crtc_props->props[i]));
192 if (property && !strcmp(property->name, "CTM")) { 192 if (property && !strcmp(property->name, "CTM")) {
193 return true; 193 return true;
194 } 194 }
195 } 195 }
196 return false; 196 return false;
197 } 197 }
198 198
199 } // namespace 199 } // namespace
200 200
201 DisplayMode_Params GetDisplayModeParams(const display::DisplayMode& mode) {
202 DisplayMode_Params params;
203 params.size = mode.size();
204 params.is_interlaced = mode.is_interlaced();
205 params.refresh_rate = mode.refresh_rate();
206 return params;
207 }
208
209 std::unique_ptr<const display::DisplayMode> CreateDisplayModeFromParams(
210 const DisplayMode_Params& pmode) {
211 return base::MakeUnique<const display::DisplayMode>(
212 pmode.size, pmode.is_interlaced, pmode.refresh_rate);
213 }
214
215 const gfx::Size ModeSize(const drmModeModeInfo& mode) {
216 return gfx::Size(mode.hdisplay, mode.vdisplay);
217 }
218
219 float ModeRefreshRate(const drmModeModeInfo& mode) {
220 return GetRefreshRate(mode);
221 }
222
223 bool ModeIsInterlaced(const drmModeModeInfo& mode) {
224 return mode.flags & DRM_MODE_FLAG_INTERLACE;
225 }
226
201 gfx::Size GetMaximumCursorSize(int fd) { 227 gfx::Size GetMaximumCursorSize(int fd) {
202 uint64_t width = 0, height = 0; 228 uint64_t width = 0, height = 0;
203 // Querying cursor dimensions is optional and is unsupported on older Chrome 229 // Querying cursor dimensions is optional and is unsupported on older Chrome
204 // OS kernels. 230 // OS kernels.
205 if (drmGetCap(fd, DRM_CAP_CURSOR_WIDTH, &width) != 0 || 231 if (drmGetCap(fd, DRM_CAP_CURSOR_WIDTH, &width) != 0 ||
206 drmGetCap(fd, DRM_CAP_CURSOR_HEIGHT, &height) != 0) { 232 drmGetCap(fd, DRM_CAP_CURSOR_HEIGHT, &height) != 0) {
207 return gfx::Size(kDefaultCursorWidth, kDefaultCursorHeight); 233 return gfx::Size(kDefaultCursorWidth, kDefaultCursorHeight);
208 } 234 }
209 return gfx::Size(width, height); 235 return gfx::Size(width, height);
210 } 236 }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 case gfx::BufferFormat::YUV_420_BIPLANAR: 459 case gfx::BufferFormat::YUV_420_BIPLANAR:
434 return DRM_FORMAT_NV12; 460 return DRM_FORMAT_NV12;
435 case gfx::BufferFormat::YVU_420: 461 case gfx::BufferFormat::YVU_420:
436 return DRM_FORMAT_YVU420; 462 return DRM_FORMAT_YVU420;
437 default: 463 default:
438 NOTREACHED(); 464 NOTREACHED();
439 return 0; 465 return 0;
440 } 466 }
441 } 467 }
442 } // namespace ui 468 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/common/drm_util.h ('k') | ui/ozone/platform/drm/common/drm_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698