Index: content/common/gpu/media/vaapi_drm_picture.cc |
diff --git a/content/common/gpu/media/vaapi_drm_picture.cc b/content/common/gpu/media/vaapi_drm_picture.cc |
index 941bc113af68f50c2a7d5b08b84618927f232ae4..9ce96194122a31fe163f98b9f711b3474e446c64 100644 |
--- a/content/common/gpu/media/vaapi_drm_picture.cc |
+++ b/content/common/gpu/media/vaapi_drm_picture.cc |
@@ -2,6 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include <vector> |
+ |
#include "base/file_descriptor_posix.h" |
#include "content/common/gpu/media/va_surface.h" |
#include "content/common/gpu/media/vaapi_drm_picture.h" |
@@ -9,6 +11,7 @@ |
#include "third_party/libva/va/drm/va_drm.h" |
#include "third_party/libva/va/va.h" |
#include "third_party/libva/va/va_drmcommon.h" |
+#include "third_party/webrtc/base/scoped_ref_ptr.h" |
#include "ui/gfx/gpu_memory_buffer.h" |
#include "ui/gl/gl_bindings.h" |
#include "ui/gl/gl_image_linux_dma_buffer.h" |
@@ -62,7 +65,7 @@ bool VaapiDrmPicture::Initialize() { |
LOG(ERROR) << "Failed to get dmabuf from an Ozone NativePixmap"; |
return false; |
} |
- int dmabuf_pitch = pixmap_->GetDmaBufPitch(); |
+ std::vector<int> dmabuf_pitches = { pixmap_->GetDmaBufPitch() }; |
// Create a VASurface out of the created buffer using the dmabuf. |
VASurfaceAttribExternalBuffers va_attrib_extbuf; |
@@ -70,9 +73,9 @@ bool VaapiDrmPicture::Initialize() { |
va_attrib_extbuf.pixel_format = VA_FOURCC_BGRX; |
va_attrib_extbuf.width = size().width(); |
va_attrib_extbuf.height = size().height(); |
- va_attrib_extbuf.data_size = size().height() * dmabuf_pitch; |
+ va_attrib_extbuf.data_size = size().height() * dmabuf_pitches[0]; |
va_attrib_extbuf.num_planes = 1; |
- va_attrib_extbuf.pitches[0] = dmabuf_pitch; |
+ va_attrib_extbuf.pitches[0] = dmabuf_pitches[0]; |
va_attrib_extbuf.offsets[0] = 0; |
va_attrib_extbuf.buffers = reinterpret_cast<unsigned long*>(&dmabuf_fd); |
va_attrib_extbuf.num_buffers = 1; |
@@ -104,8 +107,12 @@ bool VaapiDrmPicture::Initialize() { |
gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, |
texture_id()); |
- gl_image_ = ui::GpuMemoryBufferFactoryOzoneNativeBuffer::CreateImageForPixmap( |
- pixmap_, size(), gfx::GpuMemoryBuffer::BGRA_8888, GL_RGBA); |
+ const std::vector<gfx::GpuMemoryBuffer::Format> formats( |
+ 1, gfx::GpuMemoryBuffer::BGRA_8888); |
+ const std::vector<scoped_refptr<ui::NativePixmap>> pixmaps(1, pixmap_); |
+ gl_image_ = |
+ ui::GpuMemoryBufferFactoryOzoneNativeBuffer::CreateImageForPixmaps( |
+ 1, pixmaps, size(), formats, GL_RGBA); |
if (!gl_image_) { |
LOG(ERROR) << "Failed to create GLImage"; |
return false; |