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

Side by Side Diff: content/common/gpu/gpu_channel.cc

Issue 1016773002: MJPEG acceleration for video capture using VAAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: support multiple jpeg decoder Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <windows.h> 6 #include <windows.h>
7 #endif 7 #endif
8 8
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 10
11 #include <queue> 11 #include <queue>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/macros.h"
wuchengli 2015/04/24 05:54:24 not used?
kcwu 2015/04/30 19:25:41 For ignore_result()
16 #include "base/message_loop/message_loop_proxy.h" 17 #include "base/message_loop/message_loop_proxy.h"
17 #include "base/stl_util.h" 18 #include "base/stl_util.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
19 #include "base/timer/timer.h" 20 #include "base/timer/timer.h"
20 #include "base/trace_event/trace_event.h" 21 #include "base/trace_event/trace_event.h"
21 #include "content/common/gpu/gpu_channel_manager.h" 22 #include "content/common/gpu/gpu_channel_manager.h"
22 #include "content/common/gpu/gpu_memory_buffer_factory.h" 23 #include "content/common/gpu/gpu_memory_buffer_factory.h"
23 #include "content/common/gpu/gpu_messages.h" 24 #include "content/common/gpu/gpu_messages.h"
25 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h"
wuchengli 2015/04/24 05:54:24 gpu_channel.h already has this
kcwu 2015/04/30 19:25:41 Done.
24 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
25 #include "gpu/command_buffer/common/mailbox.h" 27 #include "gpu/command_buffer/common/mailbox.h"
26 #include "gpu/command_buffer/common/value_state.h" 28 #include "gpu/command_buffer/common/value_state.h"
27 #include "gpu/command_buffer/service/gpu_scheduler.h" 29 #include "gpu/command_buffer/service/gpu_scheduler.h"
28 #include "gpu/command_buffer/service/image_factory.h" 30 #include "gpu/command_buffer/service/image_factory.h"
29 #include "gpu/command_buffer/service/mailbox_manager_impl.h" 31 #include "gpu/command_buffer/service/mailbox_manager_impl.h"
30 #include "gpu/command_buffer/service/sync_point_manager.h" 32 #include "gpu/command_buffer/service/sync_point_manager.h"
31 #include "gpu/command_buffer/service/valuebuffer_manager.h" 33 #include "gpu/command_buffer/service/valuebuffer_manager.h"
32 #include "ipc/ipc_channel.h" 34 #include "ipc/ipc_channel.h"
33 #include "ipc/message_filter.h" 35 #include "ipc/message_filter.h"
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 gpu_channel_manager_->RemoveChannel(client_id_); 667 gpu_channel_manager_->RemoveChannel(client_id_);
666 } 668 }
667 669
668 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { 670 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
669 bool handled = true; 671 bool handled = true;
670 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) 672 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg)
671 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer, 673 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer,
672 OnCreateOffscreenCommandBuffer) 674 OnCreateOffscreenCommandBuffer)
673 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, 675 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer,
674 OnDestroyCommandBuffer) 676 OnDestroyCommandBuffer)
677 IPC_MESSAGE_HANDLER(GpuMsg_CreateJpegDecoder, OnCreateJpegDecoder)
675 IPC_MESSAGE_UNHANDLED(handled = false) 678 IPC_MESSAGE_UNHANDLED(handled = false)
676 IPC_END_MESSAGE_MAP() 679 IPC_END_MESSAGE_MAP()
677 DCHECK(handled) << msg.type(); 680 DCHECK(handled) << msg.type();
678 return handled; 681 return handled;
679 } 682 }
680 683
681 void GpuChannel::HandleMessage() { 684 void GpuChannel::HandleMessage() {
682 handle_messages_scheduled_ = false; 685 handle_messages_scheduled_ = false;
683 if (deferred_messages_.empty()) 686 if (deferred_messages_.empty())
684 return; 687 return;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 router_.RemoveRoute(route_id); 789 router_.RemoveRoute(route_id);
787 stubs_.Remove(route_id); 790 stubs_.Remove(route_id);
788 // In case the renderer is currently blocked waiting for a sync reply from the 791 // In case the renderer is currently blocked waiting for a sync reply from the
789 // stub, we need to make sure to reschedule the GpuChannel here. 792 // stub, we need to make sure to reschedule the GpuChannel here.
790 if (need_reschedule) { 793 if (need_reschedule) {
791 // This stub won't get a chance to reschedule, so update the count now. 794 // This stub won't get a chance to reschedule, so update the count now.
792 StubSchedulingChanged(true); 795 StubSchedulingChanged(true);
793 } 796 }
794 } 797 }
795 798
799 void GpuChannel::OnCreateJpegDecoder(int32 route_id, bool* succeeded) {
800 scoped_ptr<content::GpuJpegDecodeAccelerator> decoder(
801 new GpuJpegDecodeAccelerator(this, route_id, io_message_loop_));
802
803 *succeeded = decoder->Initialize();
804 DCHECK(jpeg_decoder_map_.get(route_id) == nullptr);
805 jpeg_decoder_map_.set(route_id, decoder.Pass());
806 }
807
808 void GpuChannel::ReleaseJpegDecoder(int32 route_id) {
809 scoped_ptr<content::GpuJpegDecodeAccelerator> decoder =
810 jpeg_decoder_map_.take_and_erase(route_id);
811 DCHECK(decoder);
812 ignore_result(decoder.release());
wuchengli 2015/04/24 05:54:24 not needed?
kcwu 2015/04/30 19:25:41 GpuChannel::ReleaseJpegDecoder is called from GpuJ
813 }
814
796 void GpuChannel::MessageProcessed() { 815 void GpuChannel::MessageProcessed() {
797 messages_processed_++; 816 messages_processed_++;
798 if (preempting_flag_.get()) { 817 if (preempting_flag_.get()) {
799 io_message_loop_->PostTask( 818 io_message_loop_->PostTask(
800 FROM_HERE, 819 FROM_HERE,
801 base::Bind(&GpuChannelMessageFilter::MessageProcessed, 820 base::Bind(&GpuChannelMessageFilter::MessageProcessed,
802 filter_, 821 filter_,
803 messages_processed_)); 822 messages_processed_));
804 } 823 }
805 } 824 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 } 875 }
857 } 876 }
858 } 877 }
859 878
860 void GpuChannel::HandleUpdateValueState( 879 void GpuChannel::HandleUpdateValueState(
861 unsigned int target, const gpu::ValueState& state) { 880 unsigned int target, const gpu::ValueState& state) {
862 pending_valuebuffer_state_->UpdateState(target, state); 881 pending_valuebuffer_state_->UpdateState(target, state);
863 } 882 }
864 883
865 } // namespace content 884 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698