Index: media/gpu/vaapi_drm_picture.cc |
diff --git a/media/gpu/vaapi_drm_picture.cc b/media/gpu/vaapi_drm_picture.cc |
index b6e1f13731f76f636ec235ec48e8b0a81207506b..dbac9db163976d905baf93f699bca1d069c68f73 100644 |
--- a/media/gpu/vaapi_drm_picture.cc |
+++ b/media/gpu/vaapi_drm_picture.cc |
@@ -5,6 +5,7 @@ |
#include "media/gpu/vaapi_drm_picture.h" |
#include "base/file_descriptor_posix.h" |
+#include "gpu/ipc/common/gpu_memory_buffer_support.h" |
#include "media/gpu/va_surface.h" |
#include "media/gpu/vaapi_wrapper.h" |
#include "third_party/libva/va/drm/va_drm.h" |
@@ -50,6 +51,9 @@ static unsigned BufferFormatToInternalFormat(gfx::BufferFormat format) { |
case gfx::BufferFormat::YVU_420: |
return GL_RGB_YCRCB_420_CHROMIUM; |
+ case gfx::BufferFormat::YUV_420_BIPLANAR: |
+ return GL_RGB_YCBCR_420V_CHROMIUM; |
+ |
default: |
NOTREACHED(); |
return GL_BGRA_EXT; |
@@ -104,8 +108,13 @@ bool VaapiDrmPicture::Initialize() { |
bool VaapiDrmPicture::Allocate(gfx::BufferFormat format) { |
ui::OzonePlatform* platform = ui::OzonePlatform::GetInstance(); |
ui::SurfaceFactoryOzone* factory = platform->GetSurfaceFactoryOzone(); |
+ gfx::BufferUsage usage = gfx::BufferUsage::GPU_READ; |
+ DCHECK(gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage)); |
+ if (gpu::IsNativeGpuMemoryBufferConfigurationSupported( |
+ format, gfx::BufferUsage::SCANOUT)) |
+ usage = gfx::BufferUsage::SCANOUT; |
pixmap_ = factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size_, |
- format, gfx::BufferUsage::SCANOUT); |
+ format, usage); |
if (!pixmap_) { |
DVLOG(1) << "Failed allocating a pixmap"; |
return false; |
@@ -137,7 +146,9 @@ bool VaapiDrmPicture::DownloadFromSurface( |
} |
bool VaapiDrmPicture::AllowOverlay() const { |
- return true; |
+ // TODO(dshwang): make it true when cros kernel supports NV12 overlay. |
+ // crbug.com/683347 |
+ return pixmap_->GetBufferUsage() == gfx::BufferUsage::SCANOUT; |
} |
} // namespace media |