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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 1451353002: Implement GpuArcVideoService for arc video accelerator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase: follow ArcBridgeService changes Created 4 years, 11 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 #include "content/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { 597 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
598 DCHECK(CalledOnValidThread()); 598 DCHECK(CalledOnValidThread());
599 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) 599 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
600 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized) 600 IPC_MESSAGE_HANDLER(GpuHostMsg_Initialized, OnInitialized)
601 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) 601 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
602 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated) 602 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated)
603 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated, 603 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated,
604 OnGpuMemoryBufferCreated) 604 OnGpuMemoryBufferCreated)
605 IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext, 605 IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext,
606 OnDidCreateOffscreenContext) 606 OnDidCreateOffscreenContext)
607 IPC_MESSAGE_HANDLER(GpuHostMsg_ArcVideoAcceleratorChannelCreated,
608 OnArcVideoAcceleratorChannelCreated)
607 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext) 609 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext)
608 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext, 610 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext,
609 OnDidDestroyOffscreenContext) 611 OnDidDestroyOffscreenContext)
610 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats, 612 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats,
611 OnGpuMemoryUmaStatsReceived) 613 OnGpuMemoryUmaStatsReceived)
612 #if defined(OS_MACOSX) 614 #if defined(OS_MACOSX)
613 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 615 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
614 OnAcceleratedSurfaceBuffersSwapped(message)) 616 OnAcceleratedSurfaceBuffersSwapped(message))
615 #endif 617 #endif
616 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyChannel, 618 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyChannel,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 748 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
747 int client_id, 749 int client_id,
748 const gpu::SyncToken& sync_token) { 750 const gpu::SyncToken& sync_token) {
749 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); 751 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer");
750 752
751 DCHECK(CalledOnValidThread()); 753 DCHECK(CalledOnValidThread());
752 754
753 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token)); 755 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token));
754 } 756 }
755 757
758 void GpuProcessHost::CreateArcVideoAcceleratorChannel(
759 const CreateArcVideoAcceleratorChannelCallback& callback) {
760 DCHECK(CalledOnValidThread());
761
762 if (Send(new GpuMsg_CreateArcVideoAcceleratorChannel())) {
763 create_arc_video_accelerator_channel_requests_.push(callback);
764 } else {
765 callback.Run(IPC::ChannelHandle());
766 }
767 }
768
756 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { 769 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) {
757 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); 770 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result);
758 initialized_ = result; 771 initialized_ = result;
759 772
760 if (!initialized_) 773 if (!initialized_)
761 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); 774 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure();
762 else if (!in_process_) 775 else if (!in_process_)
763 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); 776 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
764 } 777 }
765 778
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 826
814 if (create_gpu_memory_buffer_requests_.empty()) 827 if (create_gpu_memory_buffer_requests_.empty())
815 return; 828 return;
816 829
817 CreateGpuMemoryBufferCallback callback = 830 CreateGpuMemoryBufferCallback callback =
818 create_gpu_memory_buffer_requests_.front(); 831 create_gpu_memory_buffer_requests_.front();
819 create_gpu_memory_buffer_requests_.pop(); 832 create_gpu_memory_buffer_requests_.pop();
820 callback.Run(handle); 833 callback.Run(handle);
821 } 834 }
822 835
836 void GpuProcessHost::OnArcVideoAcceleratorChannelCreated(
837 const IPC::ChannelHandle& handle) {
838 if (create_arc_video_accelerator_channel_requests_.empty()) {
839 RouteOnUIThread(
840 GpuHostMsg_OnLogMessage(logging::LOG_WARNING, "WARNING",
841 "Received a ArcVideoAcceleratorChannelCreated "
842 "message but no requests in queue."));
843 return;
844 }
845
846 CreateArcVideoAcceleratorChannelCallback callback =
847 create_arc_video_accelerator_channel_requests_.front();
848 create_arc_video_accelerator_channel_requests_.pop();
849 callback.Run(handle);
850 }
851
823 void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) { 852 void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) {
824 urls_with_live_offscreen_contexts_.insert(url); 853 urls_with_live_offscreen_contexts_.insert(url);
825 } 854 }
826 855
827 void GpuProcessHost::OnDidLoseContext(bool offscreen, 856 void GpuProcessHost::OnDidLoseContext(bool offscreen,
828 gpu::error::ContextLostReason reason, 857 gpu::error::ContextLostReason reason,
829 const GURL& url) { 858 const GURL& url) {
830 // TODO(kbr): would be nice to see the "offscreen" flag too. 859 // TODO(kbr): would be nice to see the "offscreen" flag too.
831 TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext", 860 TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext",
832 "reason", reason, 861 "reason", reason,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 create_command_buffer_requests_.pop(); 1047 create_command_buffer_requests_.pop();
1019 callback.Run(CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST); 1048 callback.Run(CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST);
1020 } 1049 }
1021 1050
1022 while (!create_gpu_memory_buffer_requests_.empty()) { 1051 while (!create_gpu_memory_buffer_requests_.empty()) {
1023 CreateGpuMemoryBufferCallback callback = 1052 CreateGpuMemoryBufferCallback callback =
1024 create_gpu_memory_buffer_requests_.front(); 1053 create_gpu_memory_buffer_requests_.front();
1025 create_gpu_memory_buffer_requests_.pop(); 1054 create_gpu_memory_buffer_requests_.pop();
1026 callback.Run(gfx::GpuMemoryBufferHandle()); 1055 callback.Run(gfx::GpuMemoryBufferHandle());
1027 } 1056 }
1057
1058 while (!create_arc_video_accelerator_channel_requests_.empty()) {
1059 CreateArcVideoAcceleratorChannelCallback callback =
1060 create_arc_video_accelerator_channel_requests_.front();
1061 create_arc_video_accelerator_channel_requests_.pop();
1062 callback.Run(IPC::ChannelHandle());
1063 }
1028 } 1064 }
1029 1065
1030 void GpuProcessHost::BlockLiveOffscreenContexts() { 1066 void GpuProcessHost::BlockLiveOffscreenContexts() {
1031 for (std::multiset<GURL>::iterator iter = 1067 for (std::multiset<GURL>::iterator iter =
1032 urls_with_live_offscreen_contexts_.begin(); 1068 urls_with_live_offscreen_contexts_.begin();
1033 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { 1069 iter != urls_with_live_offscreen_contexts_.end(); ++iter) {
1034 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( 1070 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(
1035 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); 1071 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN);
1036 } 1072 }
1037 } 1073 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1181 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1146 ClientIdToShaderCacheMap::iterator iter = 1182 ClientIdToShaderCacheMap::iterator iter =
1147 client_id_to_shader_cache_.find(client_id); 1183 client_id_to_shader_cache_.find(client_id);
1148 // If the cache doesn't exist then this is an off the record profile. 1184 // If the cache doesn't exist then this is an off the record profile.
1149 if (iter == client_id_to_shader_cache_.end()) 1185 if (iter == client_id_to_shader_cache_.end())
1150 return; 1186 return;
1151 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1187 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1152 } 1188 }
1153 1189
1154 } // namespace content 1190 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698