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

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

Issue 2758013002: drm: Rename DRM_FORMAT_YV12 to DRM_FORMAT_YVU420. (Closed)
Patch Set: Created 3 years, 9 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 | « ui/gl/gl_image_native_pixmap.cc ('k') | 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>
11 #include <xf86drm.h> 11 #include <xf86drm.h>
12 #include <xf86drmMode.h> 12 #include <xf86drmMode.h>
13 #include <algorithm> 13 #include <algorithm>
14 #include <utility> 14 #include <utility>
15 15
16 #include "base/containers/small_map.h" 16 #include "base/containers/small_map.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "ui/display/util/edid_parser.h" 18 #include "ui/display/util/edid_parser.h"
19 19
20 #if !defined(DRM_FORMAT_YV12) 20 #if !defined(DRM_FORMAT_YV12)
dnicoara 2017/03/20 14:39:47 Can we remove this then?
Daniele Castagna 2017/03/21 01:11:40 Yes. Done.
21 // TODO(dcastagna): after libdrm has this definition, remove it. 21 // TODO(dcastagna): after libdrm has this definition, remove it.
22 #define DRM_FORMAT_YV12 fourcc_code('Y', 'V', '1', '2') 22 #define DRM_FORMAT_YV12 fourcc_code('Y', 'V', '1', '2')
23 #endif 23 #endif
24 24
25 namespace ui { 25 namespace ui {
26 26
27 namespace { 27 namespace {
28 28
29 static const size_t kDefaultCursorWidth = 64; 29 static const size_t kDefaultCursorWidth = 64;
30 static const size_t kDefaultCursorHeight = 64; 30 static const size_t kDefaultCursorHeight = 64;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 return DRM_FORMAT_XBGR8888; 377 return DRM_FORMAT_XBGR8888;
378 case gfx::BufferFormat::BGRA_8888: 378 case gfx::BufferFormat::BGRA_8888:
379 return DRM_FORMAT_ARGB8888; 379 return DRM_FORMAT_ARGB8888;
380 case gfx::BufferFormat::BGRX_8888: 380 case gfx::BufferFormat::BGRX_8888:
381 return DRM_FORMAT_XRGB8888; 381 return DRM_FORMAT_XRGB8888;
382 case gfx::BufferFormat::BGR_565: 382 case gfx::BufferFormat::BGR_565:
383 return DRM_FORMAT_RGB565; 383 return DRM_FORMAT_RGB565;
384 case gfx::BufferFormat::UYVY_422: 384 case gfx::BufferFormat::UYVY_422:
385 return DRM_FORMAT_UYVY; 385 return DRM_FORMAT_UYVY;
386 case gfx::BufferFormat::YVU_420: 386 case gfx::BufferFormat::YVU_420:
387 return DRM_FORMAT_YV12; 387 return DRM_FORMAT_YVU420;
388 case gfx::BufferFormat::YUV_420_BIPLANAR: 388 case gfx::BufferFormat::YUV_420_BIPLANAR:
389 return DRM_FORMAT_NV12; 389 return DRM_FORMAT_NV12;
390 default: 390 default:
391 NOTREACHED(); 391 NOTREACHED();
392 return 0; 392 return 0;
393 } 393 }
394 } 394 }
395 395
396 gfx::BufferFormat GetBufferFormatFromFourCCFormat(int format) { 396 gfx::BufferFormat GetBufferFormatFromFourCCFormat(int format) {
397 switch (format) { 397 switch (format) {
398 case DRM_FORMAT_R8: 398 case DRM_FORMAT_R8:
399 return gfx::BufferFormat::R_8; 399 return gfx::BufferFormat::R_8;
400 case DRM_FORMAT_GR88: 400 case DRM_FORMAT_GR88:
401 return gfx::BufferFormat::RG_88; 401 return gfx::BufferFormat::RG_88;
402 case DRM_FORMAT_ABGR8888: 402 case DRM_FORMAT_ABGR8888:
403 return gfx::BufferFormat::RGBA_8888; 403 return gfx::BufferFormat::RGBA_8888;
404 case DRM_FORMAT_XBGR8888: 404 case DRM_FORMAT_XBGR8888:
405 return gfx::BufferFormat::RGBX_8888; 405 return gfx::BufferFormat::RGBX_8888;
406 case DRM_FORMAT_ARGB8888: 406 case DRM_FORMAT_ARGB8888:
407 return gfx::BufferFormat::BGRA_8888; 407 return gfx::BufferFormat::BGRA_8888;
408 case DRM_FORMAT_XRGB8888: 408 case DRM_FORMAT_XRGB8888:
409 return gfx::BufferFormat::BGRX_8888; 409 return gfx::BufferFormat::BGRX_8888;
410 case DRM_FORMAT_RGB565: 410 case DRM_FORMAT_RGB565:
411 return gfx::BufferFormat::BGR_565; 411 return gfx::BufferFormat::BGR_565;
412 case DRM_FORMAT_UYVY: 412 case DRM_FORMAT_UYVY:
413 return gfx::BufferFormat::UYVY_422; 413 return gfx::BufferFormat::UYVY_422;
414 case DRM_FORMAT_NV12: 414 case DRM_FORMAT_NV12:
415 return gfx::BufferFormat::YUV_420_BIPLANAR; 415 return gfx::BufferFormat::YUV_420_BIPLANAR;
416 case DRM_FORMAT_YV12: 416 case DRM_FORMAT_YVU420:
417 return gfx::BufferFormat::YVU_420; 417 return gfx::BufferFormat::YVU_420;
418 default: 418 default:
419 NOTREACHED(); 419 NOTREACHED();
420 return gfx::BufferFormat::BGRA_8888; 420 return gfx::BufferFormat::BGRA_8888;
421 } 421 }
422 } 422 }
423 423
424 int GetFourCCFormatForOpaqueFramebuffer(gfx::BufferFormat format) { 424 int GetFourCCFormatForOpaqueFramebuffer(gfx::BufferFormat format) {
425 // DRM atomic interface doesn't currently support specifying an alpha 425 // DRM atomic interface doesn't currently support specifying an alpha
426 // blending. We can simulate disabling alpha bleding creating an fb 426 // blending. We can simulate disabling alpha bleding creating an fb
427 // with a format without the alpha channel. 427 // with a format without the alpha channel.
428 switch (format) { 428 switch (format) {
429 case gfx::BufferFormat::RGBA_8888: 429 case gfx::BufferFormat::RGBA_8888:
430 case gfx::BufferFormat::RGBX_8888: 430 case gfx::BufferFormat::RGBX_8888:
431 return DRM_FORMAT_XBGR8888; 431 return DRM_FORMAT_XBGR8888;
432 case gfx::BufferFormat::BGRA_8888: 432 case gfx::BufferFormat::BGRA_8888:
433 case gfx::BufferFormat::BGRX_8888: 433 case gfx::BufferFormat::BGRX_8888:
434 return DRM_FORMAT_XRGB8888; 434 return DRM_FORMAT_XRGB8888;
435 case gfx::BufferFormat::BGR_565: 435 case gfx::BufferFormat::BGR_565:
436 return DRM_FORMAT_RGB565; 436 return DRM_FORMAT_RGB565;
437 case gfx::BufferFormat::UYVY_422: 437 case gfx::BufferFormat::UYVY_422:
438 return DRM_FORMAT_UYVY; 438 return DRM_FORMAT_UYVY;
439 default: 439 default:
440 NOTREACHED(); 440 NOTREACHED();
441 return 0; 441 return 0;
442 } 442 }
443 } 443 }
444 } // namespace ui 444 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gl/gl_image_native_pixmap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698