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 82e16ece31ad9a927aa289b6f8647d8574b3d7c1..4492a56c57ede0c29176dbef5831fd71a1331cf2 100644 |
--- a/content/common/gpu/media/vaapi_drm_picture.cc |
+++ b/content/common/gpu/media/vaapi_drm_picture.cc |
@@ -6,6 +6,7 @@ |
#include "content/common/gpu/media/va_surface.h" |
#include "content/common/gpu/media/vaapi_drm_picture.h" |
#include "content/common/gpu/media/vaapi_wrapper.h" |
+#include "gpu/command_buffer/service/texture_manager.h" |
#include "third_party/libva/va/drm/va_drm.h" |
#include "third_party/libva/va/va.h" |
#include "third_party/libva/va/va_drmcommon.h" |
@@ -13,6 +14,7 @@ |
#include "ui/gl/gl_bindings.h" |
#include "ui/gl/gl_image_linux_dma_buffer.h" |
#include "ui/gl/scoped_binders.h" |
+#include "ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.h" |
#include "ui/ozone/public/native_pixmap.h" |
#include "ui/ozone/public/ozone_platform.h" |
#include "ui/ozone/public/surface_factory_ozone.h" |
@@ -25,7 +27,7 @@ VaapiDrmPicture::VaapiDrmPicture( |
int32 picture_buffer_id, |
uint32 texture_id, |
const gfx::Size& size) |
- : VaapiPicture(picture_buffer_id, texture_id, size), |
+ : VaapiPicture(picture_buffer_id, texture_id, size, true), |
vaapi_wrapper_(vaapi_wrapper), |
make_context_current_(make_context_current) { |
} |
@@ -39,7 +41,8 @@ VaapiDrmPicture::~VaapiDrmPicture() { |
} |
} |
-bool VaapiDrmPicture::Initialize() { |
+bool VaapiDrmPicture::Initialize(gpu::gles2::TextureManager* texture_manager, |
+ gpu::gles2::TextureRef* texture_ref) { |
// We want to create a VASurface and an EGLImage out of the same |
// memory buffer, so we can output decoded pictures to it using |
// VAAPI and also use it to paint with GL. |
@@ -101,21 +104,20 @@ bool VaapiDrmPicture::Initialize() { |
if (!make_context_current_.Run()) |
return false; |
- // Create an EGLImage out of the same buffer. |
- gl_image_ = new gfx::GLImageLinuxDMABuffer(size(), GL_RGBA); |
- if (!gl_image_->Initialize(base::FileDescriptor(dmabuf_fd, false), |
- gfx::GpuMemoryBuffer::BGRA_8888, dmabuf_pitch)) { |
- LOG(ERROR) << "Failed to create a GLImageLinuxDMABuffer for a NativePixmap"; |
- return false; |
- } |
- |
- // Bind the EGLImage to the given GL texture. |
gfx::ScopedTextureBinder texture_binder(GL_TEXTURE_EXTERNAL_OES, |
texture_id()); |
+ gl_image_ = ui::GpuMemoryBufferFactoryOzoneNativeBuffer::CreateImageForPixmap( |
+ pixmap_, size(), gfx::GpuMemoryBuffer::RGBA_8888, GL_RGBA); |
+ if (!gl_image_) { |
+ LOG(ERROR) << "Failed to create GLImage"; |
+ return false; |
+ } |
if (!gl_image_->BindTexImage(GL_TEXTURE_EXTERNAL_OES)) { |
LOG(ERROR) << "Failed to bind texture to GLImage"; |
return false; |
} |
+ texture_manager->SetLevelImage(texture_ref, GL_TEXTURE_EXTERNAL_OES, 0, |
Pawel Osciak
2015/01/21 13:07:08
I think we can get texture_ref from texture_manage
achaulk
2015/01/21 17:10:03
Unfortunately, it's the wrong texture_id, we need
|
+ gl_image_.get()); |
return true; |
} |