diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-03 18:57:24 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-03 18:57:24 +0000 |
commit | 1cfb7420fb7ea2fa5a6360bbee5424918e84a027 (patch) | |
tree | 6ca1fd441d8675a06370fc54ac06bcbeb099b5fa /chrome/gpu | |
parent | 6b723128f5c6b090b87949875dcc4e55304a4461 (diff) | |
download | chromium_src-1cfb7420fb7ea2fa5a6360bbee5424918e84a027.zip chromium_src-1cfb7420fb7ea2fa5a6360bbee5424918e84a027.tar.gz chromium_src-1cfb7420fb7ea2fa5a6360bbee5424918e84a027.tar.bz2 |
Complete initializing a GPU video decoder in a GLES2 context
In this patch a ggl::Context is connected to the GpuVideoDecoderHost in the
renderer process. In the GPU process the GpuVideoDecoder is connected to a
gles2::GLES2Decoder.
These changes will be used in the future to switch context before issuing
video decode commands. This is also needed by the GPU process to translate
a client texture ID to a service texture ID in the GPU video decoder.
BUG=53714
TEST=none
Review URL: http://codereview.chromium.org/3266008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/gpu')
-rw-r--r-- | chrome/gpu/gpu_channel.cc | 15 | ||||
-rw-r--r-- | chrome/gpu/gpu_command_buffer_stub.h | 3 | ||||
-rw-r--r-- | chrome/gpu/gpu_video_decoder.cc | 9 | ||||
-rw-r--r-- | chrome/gpu/gpu_video_decoder.h | 18 | ||||
-rw-r--r-- | chrome/gpu/gpu_video_service.cc | 13 | ||||
-rw-r--r-- | chrome/gpu/gpu_video_service.h | 4 |
6 files changed, 43 insertions, 19 deletions
diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc index a63faa9..ea20f22 100644 --- a/chrome/gpu/gpu_channel.cc +++ b/chrome/gpu/gpu_channel.cc @@ -208,14 +208,21 @@ void GpuChannel::OnGetVideoService(GpuVideoServiceInfoParam* info) { void GpuChannel::OnCreateVideoDecoder(GpuVideoDecoderInfoParam* info) { #if defined(ENABLE_GPU) LOG(INFO) << "GpuChannel::OnCreateVideoDecoder"; - info->decoder_id_ = -1; + info->decoder_id = -1; GpuVideoService* service = GpuVideoService::get(); if (service == NULL) return; - info->decoder_host_route_id_ = GenerateRouteID(); - info->decoder_route_id_ = GenerateRouteID(); - service->CreateVideoDecoder(this, &router_, info); + // The context ID corresponds to the command buffer used. + GpuCommandBufferStub* stub = stubs_.Lookup(info->context_id); + + info->decoder_host_route_id = GenerateRouteID(); + info->decoder_route_id = GenerateRouteID(); + + // TODO(hclam): Need to be careful about the lifetime of the command buffer + // decoder. + service->CreateVideoDecoder(this, &router_, info, + stub->processor()->decoder()); #endif } diff --git a/chrome/gpu/gpu_command_buffer_stub.h b/chrome/gpu/gpu_command_buffer_stub.h index f0e1461..6f7e3df 100644 --- a/chrome/gpu/gpu_command_buffer_stub.h +++ b/chrome/gpu/gpu_command_buffer_stub.h @@ -41,6 +41,9 @@ class GpuCommandBufferStub // IPC::Message::Sender implementation: virtual bool Send(IPC::Message* msg); + // Get the GLContext associated with this object. + gpu::GPUProcessor* processor() const { return processor_.get(); } + int32 route_id() const { return route_id_; } private: diff --git a/chrome/gpu/gpu_video_decoder.cc b/chrome/gpu/gpu_video_decoder.cc index 5dcb723..61db5f9 100644 --- a/chrome/gpu/gpu_video_decoder.cc +++ b/chrome/gpu/gpu_video_decoder.cc @@ -199,12 +199,14 @@ void GpuVideoDecoder::OnFillBufferCallback(scoped_refptr<VideoFrame> frame) { GpuVideoDecoder::GpuVideoDecoder( const GpuVideoDecoderInfoParam* param, GpuChannel* channel, - base::ProcessHandle handle) - : decoder_host_route_id_(param->decoder_host_route_id_), + base::ProcessHandle handle, + gpu::gles2::GLES2Decoder* decoder) + : decoder_host_route_id_(param->decoder_host_route_id), output_transfer_buffer_busy_(false), pending_output_requests_(0), channel_(channel), - renderer_handle_(handle) { + renderer_handle_(handle), + gles2_decoder_(decoder) { memset(&config_, 0, sizeof(config_)); memset(&info_, 0, sizeof(info_)); #if defined(OS_WIN) && defined(ENABLE_GPU_DECODER) @@ -315,4 +317,3 @@ void GpuVideoDecoder::SendFillBufferDone( LOG(ERROR) << "GpuVideoDecoderMsg_FillThisBufferDone failed"; } } - diff --git a/chrome/gpu/gpu_video_decoder.h b/chrome/gpu/gpu_video_decoder.h index 977cd02..d47085a 100644 --- a/chrome/gpu/gpu_video_decoder.h +++ b/chrome/gpu/gpu_video_decoder.h @@ -13,14 +13,20 @@ #include "media/video/video_decode_engine.h" #include "ipc/ipc_channel.h" -class GpuChannel; - using media::VideoCodecConfig; using media::VideoCodecInfo; using media::VideoStreamInfo; using media::VideoFrame; using media::Buffer; +namespace gpu { +namespace gles2 { +class GLES2Decoder; +} // namespace gles2 +} // namespace gpu + +class GpuChannel; + class GpuVideoDecoder : public IPC::Channel::Listener, public base::RefCountedThreadSafe<GpuVideoDecoder>, @@ -44,7 +50,8 @@ class GpuVideoDecoder GpuVideoDecoder(const GpuVideoDecoderInfoParam* param, GpuChannel* channel_, - base::ProcessHandle handle); + base::ProcessHandle handle, + gpu::gles2::GLES2Decoder* decoder); virtual ~GpuVideoDecoder() {} private: @@ -66,6 +73,11 @@ class GpuVideoDecoder GpuChannel* channel_; base::ProcessHandle renderer_handle_; + // The GLES2 decoder has the context associated with this decoder. This object + // is used to switch GLES2 context and translate client texture ID to service + // ID. + gpu::gles2::GLES2Decoder* gles2_decoder_; + scoped_ptr<base::SharedMemory> input_transfer_buffer_; scoped_ptr<base::SharedMemory> output_transfer_buffer_; diff --git a/chrome/gpu/gpu_video_service.cc b/chrome/gpu/gpu_video_service.cc index bc95936..8d1ca4e 100644 --- a/chrome/gpu/gpu_video_service.cc +++ b/chrome/gpu/gpu_video_service.cc @@ -43,23 +43,25 @@ bool GpuVideoService::UnintializeGpuVideoService() { bool GpuVideoService::CreateVideoDecoder( GpuChannel* channel, MessageRouter* router, - GpuVideoDecoderInfoParam* param) { + GpuVideoDecoderInfoParam* param, + gpu::gles2::GLES2Decoder* gles2_decoder) { GpuVideoDecoderInfo decoder_info; int32 decoder_id = GetNextAvailableDecoderID(); - param->decoder_id_ = decoder_id; + param->decoder_id = decoder_id; base::ProcessHandle handle = channel->renderer_handle(); - decoder_info.decoder_ = new GpuVideoDecoder(param, channel, handle); + decoder_info.decoder_ = new GpuVideoDecoder(param, channel, handle, + gles2_decoder); decoder_info.channel_ = channel; decoder_info.param = *param; decoder_map_[decoder_id] = decoder_info; - router->AddRoute(param->decoder_route_id_, decoder_info.decoder_); + router->AddRoute(param->decoder_route_id, decoder_info.decoder_); return true; } void GpuVideoService::DestroyVideoDecoder( MessageRouter* router, int32 decoder_id) { - int32 route_id = decoder_map_[decoder_id].param.decoder_route_id_; + int32 route_id = decoder_map_[decoder_id].param.decoder_route_id; router->RemoveRoute(route_id); decoder_map_.erase(decoder_id); } @@ -67,4 +69,3 @@ void GpuVideoService::DestroyVideoDecoder( int32 GpuVideoService::GetNextAvailableDecoderID() { return ++next_available_decoder_id_; } - diff --git a/chrome/gpu/gpu_video_service.h b/chrome/gpu/gpu_video_service.h index 985d8e8..0b446bb 100644 --- a/chrome/gpu/gpu_video_service.h +++ b/chrome/gpu/gpu_video_service.h @@ -24,7 +24,8 @@ class GpuVideoService : public IPC::Channel::Listener, bool CreateVideoDecoder(GpuChannel* channel, MessageRouter* router, - GpuVideoDecoderInfoParam* param); + GpuVideoDecoderInfoParam* param, + gpu::gles2::GLES2Decoder* gles2_decoder); void DestroyVideoDecoder(MessageRouter* router, int32 decoder_id); @@ -52,4 +53,3 @@ class GpuVideoService : public IPC::Channel::Listener, }; #endif // CHROME_GPU_GPU_VIDEO_SERVICE_H_ - |