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

Side by Side Diff: media/gpu/vaapi_drm_picture.cc

Issue 2648633005: cros: Support YUYV format for GPU memory buffer video frames
Patch Set: Created 3 years, 11 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 "base/file_descriptor_posix.h" 5 #include "base/file_descriptor_posix.h"
6 #include "media/gpu/va_surface.h" 6 #include "media/gpu/va_surface.h"
7 #include "media/gpu/vaapi_drm_picture.h" 7 #include "media/gpu/vaapi_drm_picture.h"
8 #include "media/gpu/vaapi_wrapper.h" 8 #include "media/gpu/vaapi_wrapper.h"
9 #include "third_party/libva/va/drm/va_drm.h" 9 #include "third_party/libva/va/drm/va_drm.h"
10 #include "third_party/libva/va/va.h" 10 #include "third_party/libva/va/va.h"
(...skipping 27 matching lines...) Expand all
38 if (gl_image_ && make_context_current_cb_.Run()) { 38 if (gl_image_ && make_context_current_cb_.Run()) {
39 gl_image_->ReleaseTexImage(GL_TEXTURE_EXTERNAL_OES); 39 gl_image_->ReleaseTexImage(GL_TEXTURE_EXTERNAL_OES);
40 DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR)); 40 DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR));
41 } 41 }
42 } 42 }
43 43
44 static unsigned BufferFormatToInternalFormat(gfx::BufferFormat format) { 44 static unsigned BufferFormatToInternalFormat(gfx::BufferFormat format) {
45 switch (format) { 45 switch (format) {
46 case gfx::BufferFormat::BGRA_8888: 46 case gfx::BufferFormat::BGRA_8888:
47 return GL_BGRA_EXT; 47 return GL_BGRA_EXT;
48
49 case gfx::BufferFormat::YVU_420: 48 case gfx::BufferFormat::YVU_420:
50 return GL_RGB_YCRCB_420_CHROMIUM; 49 return GL_RGB_YCRCB_420_CHROMIUM;
51 50 case gfx::BufferFormat::YUYV_422:
51 return GL_RGB_YCBCR_422_CHROMIUM;
52 default: 52 default:
53 NOTREACHED(); 53 NOTREACHED();
54 return GL_BGRA_EXT; 54 return GL_BGRA_EXT;
55 } 55 }
56 } 56 }
57 57
58 bool VaapiDrmPicture::Initialize() { 58 bool VaapiDrmPicture::Initialize() {
59 DCHECK(pixmap_); 59 DCHECK(pixmap_);
60 60
61 va_surface_ = vaapi_wrapper_->CreateVASurfaceForPixmap(pixmap_); 61 va_surface_ = vaapi_wrapper_->CreateVASurfaceForPixmap(pixmap_);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 bool VaapiDrmPicture::DownloadFromSurface( 134 bool VaapiDrmPicture::DownloadFromSurface(
135 const scoped_refptr<VASurface>& va_surface) { 135 const scoped_refptr<VASurface>& va_surface) {
136 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_); 136 return vaapi_wrapper_->BlitSurface(va_surface, va_surface_);
137 } 137 }
138 138
139 bool VaapiDrmPicture::AllowOverlay() const { 139 bool VaapiDrmPicture::AllowOverlay() const {
140 return true; 140 return true;
141 } 141 }
142 142
143 } // namespace media 143 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698