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

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

Issue 2678343011: chromeos: decode video into NV12 format instead of RGBA in vaapi decoder (Closed)
Patch Set: decide scanout in runtime Created 3 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 | « ui/ozone/platform/drm/common/drm_util.h ('k') | ui/ozone/platform/drm/gpu/drm_thread.cc » ('j') | 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 <gbm.h>
8 #include <stdint.h> 9 #include <stdint.h>
9 #include <stdlib.h> 10 #include <stdlib.h>
10 #include <sys/mman.h> 11 #include <sys/mman.h>
11 #include <xf86drm.h> 12 #include <xf86drm.h>
12 #include <xf86drmMode.h> 13 #include <xf86drmMode.h>
13 #include <algorithm> 14 #include <algorithm>
14 #include <utility> 15 #include <utility>
15 16
16 #include "base/containers/flat_map.h" 17 #include "base/containers/flat_map.h"
17 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 case gfx::BufferFormat::YUV_420_BIPLANAR: 512 case gfx::BufferFormat::YUV_420_BIPLANAR:
512 return DRM_FORMAT_NV12; 513 return DRM_FORMAT_NV12;
513 case gfx::BufferFormat::YVU_420: 514 case gfx::BufferFormat::YVU_420:
514 return DRM_FORMAT_YVU420; 515 return DRM_FORMAT_YVU420;
515 default: 516 default:
516 NOTREACHED(); 517 NOTREACHED();
517 return 0; 518 return 0;
518 } 519 }
519 } 520 }
520 521
522 uint32_t GetGbmFlagsFromBufferUsage(gfx::BufferUsage usage) {
523 switch (usage) {
524 case gfx::BufferUsage::GPU_READ:
525 return GBM_BO_USE_TEXTURING;
526 case gfx::BufferUsage::SCANOUT:
527 return GBM_BO_USE_SCANOUT;
528 case gfx::BufferUsage::SCANOUT_CPU_READ_WRITE:
529 return GBM_BO_USE_SCANOUT | GBM_BO_USE_LINEAR;
530 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE:
531 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT:
532 return GBM_BO_USE_TEXTURING | GBM_BO_USE_LINEAR;
533 }
534 }
535
536 gfx::BufferUsage GetBufferUsageFromGbmFlags(int flags) {
537 switch (flags) {
538 case GBM_BO_USE_TEXTURING:
gurchetansingh 2017/06/28 20:59:18 After the gbm.h change lands, you still have to ro
539 return gfx::BufferUsage::GPU_READ;
540 case GBM_BO_USE_SCANOUT:
541 return gfx::BufferUsage::SCANOUT;
542 case GBM_BO_USE_SCANOUT | GBM_BO_USE_LINEAR:
543 return gfx::BufferUsage::SCANOUT_CPU_READ_WRITE;
544 case GBM_BO_USE_TEXTURING | GBM_BO_USE_LINEAR:
545 return gfx::BufferUsage::GPU_READ_CPU_READ_WRITE;
546 default:
547 NOTREACHED();
548 return gfx::BufferUsage::SCANOUT;
549 }
550 }
551
521 MovableDisplaySnapshots CreateMovableDisplaySnapshotsFromParams( 552 MovableDisplaySnapshots CreateMovableDisplaySnapshotsFromParams(
522 const std::vector<DisplaySnapshot_Params>& displays) { 553 const std::vector<DisplaySnapshot_Params>& displays) {
523 MovableDisplaySnapshots snapshots; 554 MovableDisplaySnapshots snapshots;
524 for (const auto& d : displays) 555 for (const auto& d : displays)
525 snapshots.push_back(base::MakeUnique<DisplaySnapshotProxy>(d)); 556 snapshots.push_back(base::MakeUnique<DisplaySnapshotProxy>(d));
526 return snapshots; 557 return snapshots;
527 } 558 }
528 559
529 } // namespace ui 560 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/common/drm_util.h ('k') | ui/ozone/platform/drm/gpu/drm_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698