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

Side by Side Diff: media/gpu/vaapi_wrapper.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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/gpu/vaapi_wrapper.h" 5 #include "media/gpu/vaapi_wrapper.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 uint32_t BufferFormatToVAFourCC(gfx::BufferFormat fmt) { 67 uint32_t BufferFormatToVAFourCC(gfx::BufferFormat fmt) {
68 switch (fmt) { 68 switch (fmt) {
69 case gfx::BufferFormat::BGRX_8888: 69 case gfx::BufferFormat::BGRX_8888:
70 return VA_FOURCC_BGRX; 70 return VA_FOURCC_BGRX;
71 case gfx::BufferFormat::BGRA_8888: 71 case gfx::BufferFormat::BGRA_8888:
72 return VA_FOURCC_BGRA; 72 return VA_FOURCC_BGRA;
73 case gfx::BufferFormat::UYVY_422: 73 case gfx::BufferFormat::UYVY_422:
74 return VA_FOURCC_UYVY; 74 return VA_FOURCC_UYVY;
75 case gfx::BufferFormat::YVU_420: 75 case gfx::BufferFormat::YVU_420:
76 return VA_FOURCC_YV12; 76 return VA_FOURCC_YV12;
77 case gfx::BufferFormat::YUV_420_BIPLANAR:
78 return VA_FOURCC_NV12;
77 default: 79 default:
78 NOTREACHED(); 80 NOTREACHED();
79 return 0; 81 return 0;
80 } 82 }
81 } 83 }
82 84
83 uint32_t BufferFormatToVARTFormat(gfx::BufferFormat fmt) { 85 uint32_t BufferFormatToVARTFormat(gfx::BufferFormat fmt) {
84 switch (fmt) { 86 switch (fmt) {
85 case gfx::BufferFormat::UYVY_422: 87 case gfx::BufferFormat::UYVY_422:
86 return VA_RT_FORMAT_YUV422; 88 return VA_RT_FORMAT_YUV422;
87 case gfx::BufferFormat::BGRX_8888: 89 case gfx::BufferFormat::BGRX_8888:
88 case gfx::BufferFormat::BGRA_8888: 90 case gfx::BufferFormat::BGRA_8888:
89 return VA_RT_FORMAT_RGB32; 91 return VA_RT_FORMAT_RGB32;
90 case gfx::BufferFormat::YVU_420: 92 case gfx::BufferFormat::YVU_420:
93 case gfx::BufferFormat::YUV_420_BIPLANAR:
91 return VA_RT_FORMAT_YUV420; 94 return VA_RT_FORMAT_YUV420;
92 default: 95 default:
93 NOTREACHED(); 96 NOTREACHED();
94 return 0; 97 return 0;
95 } 98 }
96 } 99 }
97 100
98 } // namespace 101 } // namespace
99 #endif 102 #endif
100 103
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 int dmabuf_fd = pixmap->GetDmaBufFd(i); 638 int dmabuf_fd = pixmap->GetDmaBufFd(i);
636 if (dmabuf_fd < 0) { 639 if (dmabuf_fd < 0) {
637 LOG(ERROR) << "Failed to get dmabuf from an Ozone NativePixmap"; 640 LOG(ERROR) << "Failed to get dmabuf from an Ozone NativePixmap";
638 return nullptr; 641 return nullptr;
639 } 642 }
640 fds[i] = dmabuf_fd; 643 fds[i] = dmabuf_fd;
641 } 644 }
642 va_attrib_extbuf.buffers = fds.data(); 645 va_attrib_extbuf.buffers = fds.data();
643 va_attrib_extbuf.num_buffers = fds.size(); 646 va_attrib_extbuf.num_buffers = fds.size();
644 647
645 va_attrib_extbuf.flags = 0; 648 va_attrib_extbuf.flags = VA_SURFACE_EXTBUF_DESC_ENABLE_TILING;
646 va_attrib_extbuf.private_data = NULL; 649 va_attrib_extbuf.private_data = NULL;
647 650
648 std::vector<VASurfaceAttrib> va_attribs(2); 651 std::vector<VASurfaceAttrib> va_attribs(2);
649 652
650 va_attribs[0].type = VASurfaceAttribMemoryType; 653 va_attribs[0].type = VASurfaceAttribMemoryType;
651 va_attribs[0].flags = VA_SURFACE_ATTRIB_SETTABLE; 654 va_attribs[0].flags = VA_SURFACE_ATTRIB_SETTABLE;
652 va_attribs[0].value.type = VAGenericValueTypeInteger; 655 va_attribs[0].value.type = VAGenericValueTypeInteger;
653 va_attribs[0].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME; 656 va_attribs[0].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME;
654 657
655 va_attribs[1].type = VASurfaceAttribExternalBufferDescriptor; 658 va_attribs[1].type = VASurfaceAttribExternalBufferDescriptor;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 drm_fd_.reset(HANDLE_EINTR(dup(fd))); 1257 drm_fd_.reset(HANDLE_EINTR(dup(fd)));
1255 } 1258 }
1256 #endif // USE_OZONE 1259 #endif // USE_OZONE
1257 1260
1258 bool VaapiWrapper::VADisplayState::VAAPIVersionLessThan(int major, int minor) { 1261 bool VaapiWrapper::VADisplayState::VAAPIVersionLessThan(int major, int minor) {
1259 return (major_version_ < major) || 1262 return (major_version_ < major) ||
1260 (major_version_ == major && minor_version_ < minor); 1263 (major_version_ == major && minor_version_ < minor);
1261 } 1264 }
1262 1265
1263 } // namespace media 1266 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698