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

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

Issue 11194042: Implement TextureImageTransportSurface using texture mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years 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 | Annotate | Revision Log
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 "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 if (host) { 93 if (host) {
94 host->Send(message); 94 host->Send(message);
95 } else { 95 } else {
96 delete message; 96 delete message;
97 } 97 }
98 } 98 }
99 99
100 void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id, 100 void AcceleratedSurfaceBuffersSwappedCompletedForGPU(int host_id,
101 int route_id, 101 int route_id,
102 bool alive, 102 bool alive,
103 bool did_swap) { 103 uint64 surface_handle) {
104 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 104 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
105 BrowserThread::PostTask( 105 BrowserThread::PostTask(
106 BrowserThread::IO, 106 BrowserThread::IO,
107 FROM_HERE, 107 FROM_HERE,
108 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 108 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
109 host_id, 109 host_id,
110 route_id, 110 route_id,
111 alive, 111 alive,
112 did_swap)); 112 surface_handle));
113 return; 113 return;
114 } 114 }
115 115
116 GpuProcessHost* host = GpuProcessHost::FromID(host_id); 116 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
117 if (host) { 117 if (host) {
118 if (alive) 118 if (alive)
119 host->Send(new AcceleratedSurfaceMsg_BufferPresented( 119 host->Send(new AcceleratedSurfaceMsg_BufferPresented(
120 route_id, did_swap, 0)); 120 route_id, surface_handle, 0));
121 else 121 else
122 host->ForceShutdown(); 122 host->ForceShutdown();
123 } 123 }
124 } 124 }
125 125
126 #if defined(OS_WIN) 126 #if defined(OS_WIN)
127 // This sends a ViewMsg_SwapBuffers_ACK directly to the renderer process 127 // This sends a ViewMsg_SwapBuffers_ACK directly to the renderer process
128 // (RenderWidget). This path is currently not used with the threaded compositor. 128 // (RenderWidget). This path is currently not used with the threaded compositor.
129 void AcceleratedSurfaceBuffersSwappedCompletedForRenderer( 129 void AcceleratedSurfaceBuffersSwappedCompletedForRenderer(
130 int surface_id, 130 int surface_id,
(...skipping 21 matching lines...) Expand all
152 if (!rwh) 152 if (!rwh)
153 return; 153 return;
154 RenderWidgetHostImpl::From(rwh)->AcknowledgeSwapBuffersToRenderer(); 154 RenderWidgetHostImpl::From(rwh)->AcknowledgeSwapBuffersToRenderer();
155 if (interval != base::TimeDelta()) 155 if (interval != base::TimeDelta())
156 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval); 156 RenderWidgetHostImpl::From(rwh)->UpdateVSyncParameters(timebase, interval);
157 } 157 }
158 158
159 void AcceleratedSurfaceBuffersSwappedCompleted(int host_id, 159 void AcceleratedSurfaceBuffersSwappedCompleted(int host_id,
160 int route_id, 160 int route_id,
161 int surface_id, 161 int surface_id,
162 uint64 surface_handle,
162 bool alive, 163 bool alive,
163 base::TimeTicks timebase, 164 base::TimeTicks timebase,
164 base::TimeDelta interval) { 165 base::TimeDelta interval) {
165 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id, 166 AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id,
166 alive, true /* presented */); 167 alive, surface_handle);
167 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase, 168 AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase,
168 interval); 169 interval);
169 } 170 }
170 #endif // defined(OS_WIN) 171 #endif // defined(OS_WIN)
171 172
172 } // anonymous namespace 173 } // anonymous namespace
173 174
174 #if defined(TOOLKIT_GTK) 175 #if defined(TOOLKIT_GTK)
175 // Used to put a lock on surfaces so that the window to which the GPU 176 // Used to put a lock on surfaces so that the window to which the GPU
176 // process is drawing to doesn't disappear while it is drawing when 177 // process is drawing to doesn't disappear while it is drawing when
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no 698 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no
698 // plugin windows. 699 // plugin windows.
699 if (handle != gfx::kNullPluginWindow) { 700 if (handle != gfx::kNullPluginWindow) {
700 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 701 RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
701 return; 702 return;
702 } 703 }
703 704
704 base::ScopedClosureRunner scoped_completion_runner( 705 base::ScopedClosureRunner scoped_completion_runner(
705 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU, 706 base::Bind(&AcceleratedSurfaceBuffersSwappedCompletedForGPU,
706 host_id_, params.route_id, 707 host_id_, params.route_id,
707 true /* alive */, false /* presented */)); 708 true /* alive */, params.surface_handle));
708 709
709 int render_process_id = 0; 710 int render_process_id = 0;
710 int render_widget_id = 0; 711 int render_widget_id = 0;
711 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( 712 if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface(
712 params.surface_id, &render_process_id, &render_widget_id)) { 713 params.surface_id, &render_process_id, &render_widget_id)) {
713 return; 714 return;
714 } 715 }
715 RenderWidgetHelper* helper = 716 RenderWidgetHelper* helper =
716 RenderWidgetHelper::FromProcessHostID(render_process_id); 717 RenderWidgetHelper::FromProcessHostID(render_process_id);
717 if (!helper) 718 if (!helper)
(...skipping 14 matching lines...) Expand all
732 } 733 }
733 #endif // OS_MACOSX 734 #endif // OS_MACOSX
734 735
735 #if defined(OS_WIN) 736 #if defined(OS_WIN)
736 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 737 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
737 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 738 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
738 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); 739 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
739 740
740 base::ScopedClosureRunner scoped_completion_runner( 741 base::ScopedClosureRunner scoped_completion_runner(
741 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 742 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
742 host_id_, params.route_id, params.surface_id, 743 host_id_, params.route_id, params.surface_id, params.surface_handle,
743 true, base::TimeTicks(), base::TimeDelta())); 744 true, base::TimeTicks(), base::TimeDelta()));
744 745
745 gfx::PluginWindowHandle handle = 746 gfx::PluginWindowHandle handle =
746 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); 747 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id);
747 748
748 if (!handle) { 749 if (!handle) {
749 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI", 750 TRACE_EVENT1("gpu", "SurfaceIDNotFound_RoutingToUI",
750 "surface_id", params.surface_id); 751 "surface_id", params.surface_id);
751 #if defined(USE_AURA) 752 #if defined(USE_AURA)
752 // This is a content area swap, send it on to the UI thread. 753 // This is a content area swap, send it on to the UI thread.
753 scoped_completion_runner.Release(); 754 scoped_completion_runner.Release();
(...skipping 11 matching lines...) Expand all
765 return; 766 return;
766 } 767 }
767 768
768 scoped_completion_runner.Release(); 769 scoped_completion_runner.Release();
769 presenter->AsyncPresentAndAcknowledge( 770 presenter->AsyncPresentAndAcknowledge(
770 params.size, 771 params.size,
771 params.surface_handle, 772 params.surface_handle,
772 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, 773 base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted,
773 host_id_, 774 host_id_,
774 params.route_id, 775 params.route_id,
775 params.surface_id)); 776 params.surface_id,
777 params.surface_handle));
776 } 778 }
777 779
778 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer( 780 void GpuProcessHost::OnAcceleratedSurfacePostSubBuffer(
779 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) { 781 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params) {
780 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer"); 782 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfacePostSubBuffer");
781 783
782 NOTIMPLEMENTED(); 784 NOTIMPLEMENTED();
783 } 785 }
784 786
785 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) { 787 void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 const CreateCommandBufferCallback& callback, int32 route_id) { 984 const CreateCommandBufferCallback& callback, int32 route_id) {
983 callback.Run(route_id); 985 callback.Run(route_id);
984 } 986 }
985 987
986 void GpuProcessHost::CreateImageError( 988 void GpuProcessHost::CreateImageError(
987 const CreateImageCallback& callback, const gfx::Size size) { 989 const CreateImageCallback& callback, const gfx::Size size) {
988 callback.Run(size); 990 callback.Run(size);
989 } 991 }
990 992
991 } // namespace content 993 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698