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

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: addressed dcheng's comments 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 #if defined(OS_CHROMEOS)
608 IPC_MESSAGE_HANDLER(GpuHostMsg_ArcVideoAcceleratorChannelCreated,
609 OnArcVideoAcceleratorChannelCreated)
610 #endif
607 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext) 611 IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext)
608 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext, 612 IPC_MESSAGE_HANDLER(GpuHostMsg_DidDestroyOffscreenContext,
609 OnDidDestroyOffscreenContext) 613 OnDidDestroyOffscreenContext)
610 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats, 614 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats,
611 OnGpuMemoryUmaStatsReceived) 615 OnGpuMemoryUmaStatsReceived)
612 #if defined(OS_MACOSX) 616 #if defined(OS_MACOSX)
613 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 617 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
614 OnAcceleratedSurfaceBuffersSwapped(message)) 618 OnAcceleratedSurfaceBuffersSwapped(message))
615 #endif 619 #endif
616 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyChannel, 620 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyChannel,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 750 void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
747 int client_id, 751 int client_id,
748 const gpu::SyncToken& sync_token) { 752 const gpu::SyncToken& sync_token) {
749 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); 753 TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer");
750 754
751 DCHECK(CalledOnValidThread()); 755 DCHECK(CalledOnValidThread());
752 756
753 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token)); 757 Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token));
754 } 758 }
755 759
760 #if defined(OS_CHROMEOS)
761 void GpuProcessHost::CreateArcVideoAcceleratorChannel(
762 const CreateArcVideoAcceleratorChannelCallback& callback) {
763 DCHECK(CalledOnValidThread());
764
765 if (Send(new GpuMsg_CreateArcVideoAcceleratorChannel())) {
766 create_arc_video_accelerator_channel_requests_.push(callback);
767 } else {
768 callback.Run(IPC::ChannelHandle());
769 }
770 }
771 #endif
772
756 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { 773 void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) {
757 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); 774 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result);
758 initialized_ = result; 775 initialized_ = result;
759 776
760 if (!initialized_) 777 if (!initialized_)
761 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure(); 778 GpuDataManagerImpl::GetInstance()->OnGpuProcessInitFailure();
762 else if (!in_process_) 779 else if (!in_process_)
763 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); 780 GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info);
764 } 781 }
765 782
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 830
814 if (create_gpu_memory_buffer_requests_.empty()) 831 if (create_gpu_memory_buffer_requests_.empty())
815 return; 832 return;
816 833
817 CreateGpuMemoryBufferCallback callback = 834 CreateGpuMemoryBufferCallback callback =
818 create_gpu_memory_buffer_requests_.front(); 835 create_gpu_memory_buffer_requests_.front();
819 create_gpu_memory_buffer_requests_.pop(); 836 create_gpu_memory_buffer_requests_.pop();
820 callback.Run(handle); 837 callback.Run(handle);
821 } 838 }
822 839
840 #if defined(OS_CHROMEOS)
841 void GpuProcessHost::OnArcVideoAcceleratorChannelCreated(
842 const IPC::ChannelHandle& handle) {
843 if (create_arc_video_accelerator_channel_requests_.empty()) {
844 RouteOnUIThread(
845 GpuHostMsg_OnLogMessage(logging::LOG_WARNING, "WARNING",
846 "Received a ArcVideoAcceleratorChannelCreated "
847 "message but no requests in queue."));
848 return;
849 }
850
851 CreateArcVideoAcceleratorChannelCallback callback =
852 create_arc_video_accelerator_channel_requests_.front();
853 create_arc_video_accelerator_channel_requests_.pop();
854 callback.Run(handle);
855 }
856 #endif
857
823 void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) { 858 void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) {
824 urls_with_live_offscreen_contexts_.insert(url); 859 urls_with_live_offscreen_contexts_.insert(url);
825 } 860 }
826 861
827 void GpuProcessHost::OnDidLoseContext(bool offscreen, 862 void GpuProcessHost::OnDidLoseContext(bool offscreen,
828 gpu::error::ContextLostReason reason, 863 gpu::error::ContextLostReason reason,
829 const GURL& url) { 864 const GURL& url) {
830 // TODO(kbr): would be nice to see the "offscreen" flag too. 865 // TODO(kbr): would be nice to see the "offscreen" flag too.
831 TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext", 866 TRACE_EVENT2("gpu", "GpuProcessHost::OnDidLoseContext",
832 "reason", reason, 867 "reason", reason,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 create_command_buffer_requests_.pop(); 1053 create_command_buffer_requests_.pop();
1019 callback.Run(CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST); 1054 callback.Run(CREATE_COMMAND_BUFFER_FAILED_AND_CHANNEL_LOST);
1020 } 1055 }
1021 1056
1022 while (!create_gpu_memory_buffer_requests_.empty()) { 1057 while (!create_gpu_memory_buffer_requests_.empty()) {
1023 CreateGpuMemoryBufferCallback callback = 1058 CreateGpuMemoryBufferCallback callback =
1024 create_gpu_memory_buffer_requests_.front(); 1059 create_gpu_memory_buffer_requests_.front();
1025 create_gpu_memory_buffer_requests_.pop(); 1060 create_gpu_memory_buffer_requests_.pop();
1026 callback.Run(gfx::GpuMemoryBufferHandle()); 1061 callback.Run(gfx::GpuMemoryBufferHandle());
1027 } 1062 }
1063
1064 #if defined(OS_CHROMEOS)
1065 while (!create_arc_video_accelerator_channel_requests_.empty()) {
1066 CreateArcVideoAcceleratorChannelCallback callback =
1067 create_arc_video_accelerator_channel_requests_.front();
1068 create_arc_video_accelerator_channel_requests_.pop();
1069 callback.Run(IPC::ChannelHandle());
1070 }
1071 #endif
1028 } 1072 }
1029 1073
1030 void GpuProcessHost::BlockLiveOffscreenContexts() { 1074 void GpuProcessHost::BlockLiveOffscreenContexts() {
1031 for (std::multiset<GURL>::iterator iter = 1075 for (std::multiset<GURL>::iterator iter =
1032 urls_with_live_offscreen_contexts_.begin(); 1076 urls_with_live_offscreen_contexts_.begin();
1033 iter != urls_with_live_offscreen_contexts_.end(); ++iter) { 1077 iter != urls_with_live_offscreen_contexts_.end(); ++iter) {
1034 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( 1078 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(
1035 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); 1079 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN);
1036 } 1080 }
1037 } 1081 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1189 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1146 ClientIdToShaderCacheMap::iterator iter = 1190 ClientIdToShaderCacheMap::iterator iter =
1147 client_id_to_shader_cache_.find(client_id); 1191 client_id_to_shader_cache_.find(client_id);
1148 // If the cache doesn't exist then this is an off the record profile. 1192 // If the cache doesn't exist then this is an off the record profile.
1149 if (iter == client_id_to_shader_cache_.end()) 1193 if (iter == client_id_to_shader_cache_.end())
1150 return; 1194 return;
1151 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1195 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1152 } 1196 }
1153 1197
1154 } // namespace content 1198 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698