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

Unified Diff: content/common/gpu/media/gpu_video_decode_accelerator.cc

Issue 9814001: Add VAVDA, the VAAPI Video Decode Accelerator for Intel CPUs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing previous CR + threading redesign Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/media/gpu_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.cc b/content/common/gpu/media/gpu_video_decode_accelerator.cc
index 0ef9d87a67eb3822d57712703c96e60fac187b2c..10e956a1bdac2ee7cf0fb231fcf1b09d398fa2bf 100644
--- a/content/common/gpu/media/gpu_video_decode_accelerator.cc
+++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc
@@ -21,15 +21,24 @@
#include "content/common/gpu/gpu_command_buffer_stub.h"
#include "content/common/gpu/gpu_messages.h"
-#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
#if defined(OS_WIN)
#include "content/common/gpu/media/dxva_video_decode_accelerator.h"
-#else // OS_WIN
-#include "content/common/gpu/media/omx_video_decode_accelerator.h"
#endif // OS_WIN
+
+#if defined(OS_CHROMEOS)
+#if defined(ARCH_CPU_ARMEL)
+#include "content/common/gpu/media/omx_video_decode_accelerator.h"
+#elif defined(ARCH_CPU_X86_FAMILY)
+#include "ui/gfx/gl/gl_context_glx.h"
+#include "ui/gfx/gl/gl_surface_glx.h"
+#include "content/common/gpu/media/vaapi_video_decode_accelerator.h"
+#endif // ARCH_CPU_ARMEL
+#endif // OS_CHROMEOS
+
+#if defined(OS_WIN) || defined(OS_CHROMEOS)
#include "ui/gfx/gl/gl_context.h"
#include "ui/gfx/gl/gl_surface_egl.h"
-#endif
+#endif // OS_WIN || OS_CHROMEOS
#include "gpu/command_buffer/service/texture_manager.h"
#include "ui/gfx/size.h"
@@ -122,7 +131,7 @@ void GpuVideoDecodeAccelerator::Initialize(
DCHECK(init_done_msg);
init_done_msg_ = init_done_msg;
-#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)) || defined(OS_WIN)
+#if defined(OS_CHROMEOS) || defined(OS_WIN)
DCHECK(stub_ && stub_->decoder());
#if defined(OS_WIN)
if (base::win::GetVersion() < base::win::VERSION_WIN7) {
@@ -132,13 +141,24 @@ void GpuVideoDecodeAccelerator::Initialize(
}
DLOG(INFO) << "Initializing DXVA HW decoder for windows.";
DXVAVideoDecodeAccelerator* video_decoder =
- new DXVAVideoDecodeAccelerator(this);
-#else // OS_WIN
+ new DXVAVideoDecodeAccelerator(this, renderer_process);
+#elif defined(OS_CHROMEOS) // OS_WIN
+#if defined(ARCH_CPU_ARMEL)
OmxVideoDecodeAccelerator* video_decoder =
new OmxVideoDecodeAccelerator(this);
video_decoder->SetEglState(
gfx::GLSurfaceEGL::GetHardwareDisplay(),
stub_->decoder()->GetGLContext()->GetHandle());
+#elif defined(ARCH_CPU_X86_FAMILY)
+ VaapiVideoDecodeAccelerator* video_decoder =
+ new VaapiVideoDecodeAccelerator(this);
+ gfx::GLContextGLX* glx_context =
+ static_cast<gfx::GLContextGLX*>(stub_->decoder()->GetGLContext());
+ Display* display = glx_context->GetDisplay();
+ GLXContext glx_context_handle =
+ static_cast<GLXContext>(glx_context->GetHandle());
+ video_decoder->SetGlxState(display, glx_context_handle);
+#endif // ARCH_CPU_ARMEL
#endif // OS_WIN
video_decode_accelerator_ = video_decoder;
if (!video_decode_accelerator_->Initialize(profile))
@@ -146,7 +166,7 @@ void GpuVideoDecodeAccelerator::Initialize(
#else // Update RenderViewImpl::createMediaPlayer when adding clauses.
NOTIMPLEMENTED() << "HW video decode acceleration not available.";
NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
-#endif // defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
+#endif // defined(OS_CHROMEOS) || defined(OS_WIN)
}
void GpuVideoDecodeAccelerator::OnDecode(

Powered by Google App Engine
This is Rietveld 408576698