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

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

Issue 2094863002: ozone: Add YV12 to drm_util.cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | no next file » | 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/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 12 matching lines...) Expand all
23 #endif 23 #endif
24 24
25 #if !defined(DRM_CAP_CURSOR_HEIGHT) 25 #if !defined(DRM_CAP_CURSOR_HEIGHT)
26 #define DRM_CAP_CURSOR_HEIGHT 0x9 26 #define DRM_CAP_CURSOR_HEIGHT 0x9
27 #endif 27 #endif
28 28
29 #if !defined(DRM_FORMAT_R8) 29 #if !defined(DRM_FORMAT_R8)
30 // TODO(dshwang): after most linux and libdrm has this definition, remove it. 30 // TODO(dshwang): after most linux and libdrm has this definition, remove it.
31 #define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') 31 #define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ')
32 #endif 32 #endif
33 #if !defined(DRM_FORMAT_YV12)
34 // TODO(dcastagna): after libdrm has this definition, remove it.
35 #define DRM_FORMAT_YV12 fourcc_code('Y', 'V', '1', '2')
36 #endif
33 37
34 namespace ui { 38 namespace ui {
35 39
36 namespace { 40 namespace {
37 41
38 static const size_t kDefaultCursorWidth = 64; 42 static const size_t kDefaultCursorWidth = 64;
39 static const size_t kDefaultCursorHeight = 64; 43 static const size_t kDefaultCursorHeight = 64;
40 44
41 bool IsCrtcInUse(uint32_t crtc, 45 bool IsCrtcInUse(uint32_t crtc,
42 const ScopedVector<HardwareDisplayControllerInfo>& displays) { 46 const ScopedVector<HardwareDisplayControllerInfo>& displays) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 case gfx::BufferFormat::RGBA_8888: 332 case gfx::BufferFormat::RGBA_8888:
329 return DRM_FORMAT_ABGR8888; 333 return DRM_FORMAT_ABGR8888;
330 case gfx::BufferFormat::RGBX_8888: 334 case gfx::BufferFormat::RGBX_8888:
331 return DRM_FORMAT_XBGR8888; 335 return DRM_FORMAT_XBGR8888;
332 case gfx::BufferFormat::BGRA_8888: 336 case gfx::BufferFormat::BGRA_8888:
333 return DRM_FORMAT_ARGB8888; 337 return DRM_FORMAT_ARGB8888;
334 case gfx::BufferFormat::BGRX_8888: 338 case gfx::BufferFormat::BGRX_8888:
335 return DRM_FORMAT_XRGB8888; 339 return DRM_FORMAT_XRGB8888;
336 case gfx::BufferFormat::UYVY_422: 340 case gfx::BufferFormat::UYVY_422:
337 return DRM_FORMAT_UYVY; 341 return DRM_FORMAT_UYVY;
342 case gfx::BufferFormat::YVU_420:
343 return DRM_FORMAT_YV12;
338 default: 344 default:
339 NOTREACHED(); 345 NOTREACHED();
340 return 0; 346 return 0;
341 } 347 }
342 } 348 }
343 349
344 gfx::BufferFormat GetBufferFormatFromFourCCFormat(int format) { 350 gfx::BufferFormat GetBufferFormatFromFourCCFormat(int format) {
345 switch (format) { 351 switch (format) {
346 case DRM_FORMAT_R8: 352 case DRM_FORMAT_R8:
347 return gfx::BufferFormat::R_8; 353 return gfx::BufferFormat::R_8;
348 case DRM_FORMAT_ABGR8888: 354 case DRM_FORMAT_ABGR8888:
349 return gfx::BufferFormat::RGBA_8888; 355 return gfx::BufferFormat::RGBA_8888;
350 case DRM_FORMAT_XBGR8888: 356 case DRM_FORMAT_XBGR8888:
351 return gfx::BufferFormat::RGBX_8888; 357 return gfx::BufferFormat::RGBX_8888;
352 case DRM_FORMAT_ARGB8888: 358 case DRM_FORMAT_ARGB8888:
353 return gfx::BufferFormat::BGRA_8888; 359 return gfx::BufferFormat::BGRA_8888;
354 case DRM_FORMAT_XRGB8888: 360 case DRM_FORMAT_XRGB8888:
355 return gfx::BufferFormat::BGRX_8888; 361 return gfx::BufferFormat::BGRX_8888;
356 case DRM_FORMAT_UYVY: 362 case DRM_FORMAT_UYVY:
357 return gfx::BufferFormat::UYVY_422; 363 return gfx::BufferFormat::UYVY_422;
364 case DRM_FORMAT_YV12:
365 return gfx::BufferFormat::YVU_420;
358 default: 366 default:
359 NOTREACHED(); 367 NOTREACHED();
360 return gfx::BufferFormat::BGRA_8888; 368 return gfx::BufferFormat::BGRA_8888;
361 } 369 }
362 } 370 }
363 371
364 int GetFourCCFormatForFramebuffer(gfx::BufferFormat format) { 372 int GetFourCCFormatForFramebuffer(gfx::BufferFormat format) {
365 // Currently, drm supports 24 bitcolordepth for hardware overlay. 373 // Currently, drm supports 24 bitcolordepth for hardware overlay.
366 switch (format) { 374 switch (format) {
367 case gfx::BufferFormat::RGBA_8888: 375 case gfx::BufferFormat::RGBA_8888:
368 case gfx::BufferFormat::RGBX_8888: 376 case gfx::BufferFormat::RGBX_8888:
369 return DRM_FORMAT_XBGR8888; 377 return DRM_FORMAT_XBGR8888;
370 case gfx::BufferFormat::BGRA_8888: 378 case gfx::BufferFormat::BGRA_8888:
371 case gfx::BufferFormat::BGRX_8888: 379 case gfx::BufferFormat::BGRX_8888:
372 return DRM_FORMAT_XRGB8888; 380 return DRM_FORMAT_XRGB8888;
373 case gfx::BufferFormat::UYVY_422: 381 case gfx::BufferFormat::UYVY_422:
374 return DRM_FORMAT_UYVY; 382 return DRM_FORMAT_UYVY;
375 default: 383 default:
376 NOTREACHED(); 384 NOTREACHED();
377 return 0; 385 return 0;
378 } 386 }
379 } 387 }
380 } // namespace ui 388 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698