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

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: rebase Created 5 years, 7 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"
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"
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"
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
670 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) 671 IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg)
671 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer, 672 IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateOffscreenCommandBuffer,
672 OnCreateOffscreenCommandBuffer) 673 OnCreateOffscreenCommandBuffer)
673 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer, 674 IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyCommandBuffer,
674 OnDestroyCommandBuffer) 675 OnDestroyCommandBuffer)
676 IPC_MESSAGE_HANDLER(GpuMsg_CreateJpegDecoder, OnCreateJpegDecoder)
675 IPC_MESSAGE_UNHANDLED(handled = false) 677 IPC_MESSAGE_UNHANDLED(handled = false)
676 IPC_END_MESSAGE_MAP() 678 IPC_END_MESSAGE_MAP()
677 DCHECK(handled) << msg.type(); 679 DCHECK(handled) << msg.type();
678 return handled; 680 return handled;
679 } 681 }
680 682
681 void GpuChannel::HandleMessage() { 683 void GpuChannel::HandleMessage() {
682 handle_messages_scheduled_ = false; 684 handle_messages_scheduled_ = false;
683 if (deferred_messages_.empty()) 685 if (deferred_messages_.empty())
684 return; 686 return;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 router_.RemoveRoute(route_id); 788 router_.RemoveRoute(route_id);
787 stubs_.Remove(route_id); 789 stubs_.Remove(route_id);
788 // In case the renderer is currently blocked waiting for a sync reply from the 790 // 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. 791 // stub, we need to make sure to reschedule the GpuChannel here.
790 if (need_reschedule) { 792 if (need_reschedule) {
791 // This stub won't get a chance to reschedule, so update the count now. 793 // This stub won't get a chance to reschedule, so update the count now.
792 StubSchedulingChanged(true); 794 StubSchedulingChanged(true);
793 } 795 }
794 } 796 }
795 797
798 void GpuChannel::OnCreateJpegDecoder(int32 route_id, bool* succeeded) {
799 scoped_ptr<content::GpuJpegDecodeAccelerator> decoder(
800 new GpuJpegDecodeAccelerator(this, route_id, io_message_loop_));
801
802 *succeeded = decoder->Initialize();
803 DCHECK(jpeg_decoder_map_.get(route_id) == nullptr);
804 jpeg_decoder_map_.set(route_id, decoder.Pass());
805 }
806
807 void GpuChannel::ReleaseJpegDecoder(int32 route_id) {
808 scoped_ptr<content::GpuJpegDecodeAccelerator> decoder =
809 jpeg_decoder_map_.take_and_erase(route_id);
810 DCHECK(decoder);
811 ignore_result(decoder.release());
812 }
813
796 void GpuChannel::MessageProcessed() { 814 void GpuChannel::MessageProcessed() {
797 messages_processed_++; 815 messages_processed_++;
798 if (preempting_flag_.get()) { 816 if (preempting_flag_.get()) {
799 io_message_loop_->PostTask( 817 io_message_loop_->PostTask(
800 FROM_HERE, 818 FROM_HERE,
801 base::Bind(&GpuChannelMessageFilter::MessageProcessed, 819 base::Bind(&GpuChannelMessageFilter::MessageProcessed,
802 filter_, 820 filter_,
803 messages_processed_)); 821 messages_processed_));
804 } 822 }
805 } 823 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 } 874 }
857 } 875 }
858 } 876 }
859 877
860 void GpuChannel::HandleUpdateValueState( 878 void GpuChannel::HandleUpdateValueState(
861 unsigned int target, const gpu::ValueState& state) { 879 unsigned int target, const gpu::ValueState& state) {
862 pending_valuebuffer_state_->UpdateState(target, state); 880 pending_valuebuffer_state_->UpdateState(target, state);
863 } 881 }
864 882
865 } // namespace content 883 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698