| OLD | NEW |
| 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 "media/gpu/vaapi_drm_picture.h" | 5 #include "media/gpu/vaapi_drm_picture.h" |
| 6 | 6 |
| 7 #include "base/file_descriptor_posix.h" | 7 #include "base/file_descriptor_posix.h" |
| 8 #include "media/gpu/va_surface.h" | 8 #include "media/gpu/va_surface.h" |
| 9 #include "media/gpu/vaapi_wrapper.h" | 9 #include "media/gpu/vaapi_wrapper.h" |
| 10 #include "third_party/libva/va/drm/va_drm.h" | 10 #include "third_party/libva/va/drm/va_drm.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 if (gl_image_ && make_context_current_cb_.Run()) { | 39 if (gl_image_ && make_context_current_cb_.Run()) { |
| 40 gl_image_->ReleaseTexImage(GL_TEXTURE_EXTERNAL_OES); | 40 gl_image_->ReleaseTexImage(GL_TEXTURE_EXTERNAL_OES); |
| 41 DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR)); | 41 DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR)); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 static unsigned BufferFormatToInternalFormat(gfx::BufferFormat format) { | 45 static unsigned BufferFormatToInternalFormat(gfx::BufferFormat format) { |
| 46 switch (format) { | 46 switch (format) { |
| 47 case gfx::BufferFormat::BGRA_8888: | 47 case gfx::BufferFormat::BGRA_8888: |
| 48 return GL_BGRA_EXT; | 48 return GL_BGRA_EXT; |
| 49 | |
| 50 case gfx::BufferFormat::YVU_420: | 49 case gfx::BufferFormat::YVU_420: |
| 51 return GL_RGB_YCRCB_420_CHROMIUM; | 50 return GL_RGB_YCRCB_420_CHROMIUM; |
| 52 | 51 case gfx::BufferFormat::YUYV_422: |
| 52 return GL_RGB_YCBCR_422_CHROMIUM; |
| 53 default: | 53 default: |
| 54 NOTREACHED(); | 54 NOTREACHED(); |
| 55 return GL_BGRA_EXT; | 55 return GL_BGRA_EXT; |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool VaapiDrmPicture::Initialize() { | 59 bool VaapiDrmPicture::Initialize() { |
| 60 DCHECK(pixmap_); | 60 DCHECK(pixmap_); |
| 61 | 61 |
| 62 va_surface_ = vaapi_wrapper_->CreateVASurfaceForPixmap(pixmap_); | 62 va_surface_ = vaapi_wrapper_->CreateVASurfaceForPixmap(pixmap_); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |