From 6b723128f5c6b090b87949875dcc4e55304a4461 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Fri, 3 Sep 2010 18:50:03 +0000 Subject: Connect GpuVideoDecodeServiceHost with ggl::Context and CommandBufferProxy BUG=53714 A GpuVideoDecodeServiceHost needs to be connected with a ggl::Contect and its associated comand buffer for the following reasons: 1. The gpu video decoder in gpu process needs to be in the correct GLES2 context. 2. On context lost the gpu video decoder needs to destroy itself. This patch is able to connect the GpuVideoDecoderHost to the context although the context is not passed into the decoder, so the code path is currently broken. In a future patch we need to do the following: 1. Inject a ggl::Context into IpcVideoDecoder. 2. Complete the plumbing so that inside the gpu process we can associate a video decoder with a GLES2 context. Review URL: http://codereview.chromium.org/3215008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58517 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/ggl/ggl.cc | 13 +++++++++++++ chrome/renderer/ggl/ggl.h | 4 ++++ 2 files changed, 17 insertions(+) (limited to 'chrome/renderer/ggl') diff --git a/chrome/renderer/ggl/ggl.cc b/chrome/renderer/ggl/ggl.cc index 279247f..62453f7 100644 --- a/chrome/renderer/ggl/ggl.cc +++ b/chrome/renderer/ggl/ggl.cc @@ -11,6 +11,7 @@ #include "chrome/renderer/command_buffer_proxy.h" #include "chrome/renderer/ggl/ggl.h" #include "chrome/renderer/gpu_channel_host.h" +#include "chrome/renderer/gpu_video_service_host.h" #include "chrome/renderer/render_widget.h" #include "ipc/ipc_channel_handle.h" @@ -97,6 +98,9 @@ class Context : public base::SupportsWeakPtr { // not useful at this point. bool SwapBuffers(); + // Create a hardware accelerated video decoder associated with this context. + GpuVideoDecoderHost* CreateVideoDecoder(); + // Get the current error code. Error GetError(); @@ -320,6 +324,11 @@ bool Context::SwapBuffers() { return true; } +GpuVideoDecoderHost* Context::CreateVideoDecoder() { + return GpuVideoServiceHost::get()->CreateVideoDecoder( + command_buffer_->route_id()); +} + Error Context::GetError() { gpu::CommandBuffer::State state = command_buffer_->GetState(); if (state.error == gpu::error::kNoError) { @@ -456,6 +465,10 @@ bool DestroyContext(Context* context) { #endif } +GpuVideoDecoderHost* CreateVideoDecoder(Context* context) { + return context->CreateVideoDecoder(); +} + Error GetError() { #if defined(ENABLE_GPU) Context* context = GetCurrentContext(); diff --git a/chrome/renderer/ggl/ggl.h b/chrome/renderer/ggl/ggl.h index 38f83ad..8d3f0e2 100644 --- a/chrome/renderer/ggl/ggl.h +++ b/chrome/renderer/ggl/ggl.h @@ -16,6 +16,7 @@ #include "gfx/size.h" class GpuChannelHost; +class GpuVideoDecoderHost; namespace ggl { @@ -114,6 +115,9 @@ bool SwapBuffers(Context* context); // Destroy the given GGL context. bool DestroyContext(Context* context); +// Create a hardware video decoder corresponding to the context. +GpuVideoDecoderHost* CreateVideoDecoder(Context* context); + // TODO(gman): Remove this void DisableShaderTranslation(Context* context); -- cgit v1.1