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

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: fix coded size, shm handle Created 5 years, 9 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/message_loop/message_loop_proxy.h" 16 #include "base/message_loop/message_loop_proxy.h"
17 #include "base/stl_util.h" 17 #include "base/stl_util.h"
18 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
19 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
20 #include "base/trace_event/trace_event.h" 20 #include "base/trace_event/trace_event.h"
21 #include "content/common/gpu/gpu_channel_manager.h" 21 #include "content/common/gpu/gpu_channel_manager.h"
22 #include "content/common/gpu/gpu_memory_buffer_factory.h" 22 #include "content/common/gpu/gpu_memory_buffer_factory.h"
23 #include "content/common/gpu/gpu_messages.h" 23 #include "content/common/gpu/gpu_messages.h"
24 #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h"
24 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
25 #include "gpu/command_buffer/common/mailbox.h" 26 #include "gpu/command_buffer/common/mailbox.h"
26 #include "gpu/command_buffer/common/value_state.h" 27 #include "gpu/command_buffer/common/value_state.h"
27 #include "gpu/command_buffer/service/gpu_scheduler.h" 28 #include "gpu/command_buffer/service/gpu_scheduler.h"
28 #include "gpu/command_buffer/service/image_factory.h" 29 #include "gpu/command_buffer/service/image_factory.h"
29 #include "gpu/command_buffer/service/mailbox_manager_impl.h" 30 #include "gpu/command_buffer/service/mailbox_manager_impl.h"
30 #include "gpu/command_buffer/service/sync_point_manager.h" 31 #include "gpu/command_buffer/service/sync_point_manager.h"
31 #include "gpu/command_buffer/service/valuebuffer_manager.h" 32 #include "gpu/command_buffer/service/valuebuffer_manager.h"
32 #include "ipc/ipc_channel.h" 33 #include "ipc/ipc_channel.h"
33 #include "ipc/message_filter.h" 34 #include "ipc/message_filter.h"
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 } 661 }
661 } 662 }
662 663
663 void GpuChannel::OnDestroy() { 664 void GpuChannel::OnDestroy() {
664 TRACE_EVENT0("gpu", "GpuChannel::OnDestroy"); 665 TRACE_EVENT0("gpu", "GpuChannel::OnDestroy");
665 gpu_channel_manager_->RemoveChannel(client_id_); 666 gpu_channel_manager_->RemoveChannel(client_id_);
666 } 667 }
667 668
668 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { 669 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
669 bool handled = true; 670 bool handled = true;
671 LOG(ERROR) << __func__ << ", type=" << msg.type();
672
670 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) 673 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg)
671 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer, 674 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer,
672 OnCreateOffscreenCommandBuffer) 675 OnCreateOffscreenCommandBuffer)
673 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, 676 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer,
674 OnDestroyCommandBuffer) 677 OnDestroyCommandBuffer)
678 IPC_MESSAGE_HANDLER(GpuMsg_CreateJpegDecoder, OnCreateJpegDecoder)
675 IPC_MESSAGE_UNHANDLED(handled = false) 679 IPC_MESSAGE_UNHANDLED(handled = false)
676 IPC_END_MESSAGE_MAP() 680 IPC_END_MESSAGE_MAP()
677 DCHECK(handled) << msg.type(); 681 DCHECK(handled) << msg.type();
678 return handled; 682 return handled;
679 } 683 }
680 684
681 void GpuChannel::HandleMessage() { 685 void GpuChannel::HandleMessage() {
682 handle_messages_scheduled_ = false; 686 handle_messages_scheduled_ = false;
683 if (deferred_messages_.empty()) 687 if (deferred_messages_.empty())
684 return; 688 return;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 router_.RemoveRoute(route_id); 790 router_.RemoveRoute(route_id);
787 stubs_.Remove(route_id); 791 stubs_.Remove(route_id);
788 // In case the renderer is currently blocked waiting for a sync reply from the 792 // 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. 793 // stub, we need to make sure to reschedule the GpuChannel here.
790 if (need_reschedule) { 794 if (need_reschedule) {
791 // This stub won't get a chance to reschedule, so update the count now. 795 // This stub won't get a chance to reschedule, so update the count now.
792 StubSchedulingChanged(true); 796 StubSchedulingChanged(true);
793 } 797 }
794 } 798 }
795 799
800 void GpuChannel::OnCreateJpegDecoder(int32 route_id, bool* succeeded) {
801 LOG(ERROR) << "GpuChannel::OnCreateJpegDecoder";
802 GpuJpegDecodeAccelerator* decoder = new GpuJpegDecodeAccelerator(
803 this,
804 route_id, io_message_loop_);
805 (void)decoder; // it will delete itself??
wuchengli 2015/03/23 06:30:14 No. I think you need some kind of DestructionObser
kcwu 2015/03/30 18:12:14 Done.
806
807 *succeeded = decoder->Initialize();
808 }
809
796 void GpuChannel::MessageProcessed() { 810 void GpuChannel::MessageProcessed() {
797 messages_processed_++; 811 messages_processed_++;
798 if (preempting_flag_.get()) { 812 if (preempting_flag_.get()) {
799 io_message_loop_->PostTask( 813 io_message_loop_->PostTask(
800 FROM_HERE, 814 FROM_HERE,
801 base::Bind(&GpuChannelMessageFilter::MessageProcessed, 815 base::Bind(&GpuChannelMessageFilter::MessageProcessed,
802 filter_, 816 filter_,
803 messages_processed_)); 817 messages_processed_));
804 } 818 }
805 } 819 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 } 870 }
857 } 871 }
858 } 872 }
859 873
860 void GpuChannel::HandleUpdateValueState( 874 void GpuChannel::HandleUpdateValueState(
861 unsigned int target, const gpu::ValueState& state) { 875 unsigned int target, const gpu::ValueState& state) {
862 pending_valuebuffer_state_->UpdateState(target, state); 876 pending_valuebuffer_state_->UpdateState(target, state);
863 } 877 }
864 878
865 } // namespace content 879 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698