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

Side by Side Diff: content/common/gpu/gpu_channel_manager.h

Issue 331723003: gpu: Remove Create/DeleteImage IPC by adding an X11_PIXMAP_BUFFER GpuMemoryBuffer type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: have GpuChannelManager implement X11PixmapTracker Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_channel.cc ('k') | content/common/gpu/gpu_channel_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_
6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ 6 #define CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/containers/scoped_ptr_hash_map.h" 12 #include "base/containers/scoped_ptr_hash_map.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/message_loop/message_loop_proxy.h" 16 #include "base/message_loop/message_loop_proxy.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "content/common/gpu/devtools_gpu_instrumentation.h" 18 #include "content/common/gpu/devtools_gpu_instrumentation.h"
19 #include "content/common/gpu/gpu_memory_manager.h" 19 #include "content/common/gpu/gpu_memory_manager.h"
20 #include "ipc/ipc_listener.h" 20 #include "ipc/ipc_listener.h"
21 #include "ipc/ipc_sender.h" 21 #include "ipc/ipc_sender.h"
22 #include "ui/gfx/native_widget_types.h" 22 #include "ui/gfx/native_widget_types.h"
23 #include "ui/gl/gl_surface.h" 23 #include "ui/gl/gl_surface.h"
24 24
25 #if defined(USE_X11)
26 #include "ui/gl/x11_pixmap_tracker.h"
27 #endif
28
25 namespace base { 29 namespace base {
26 class WaitableEvent; 30 class WaitableEvent;
27 } 31 }
28 32
29 namespace gfx { 33 namespace gfx {
30 class GLShareGroup; 34 class GLShareGroup;
31 struct GpuMemoryBufferHandle; 35 struct GpuMemoryBufferHandle;
32 } 36 }
33 37
34 namespace gpu { 38 namespace gpu {
(...skipping 13 matching lines...) Expand all
48 namespace content { 52 namespace content {
49 class GpuChannel; 53 class GpuChannel;
50 class GpuWatchdog; 54 class GpuWatchdog;
51 class MessageRouter; 55 class MessageRouter;
52 class SyncPointManager; 56 class SyncPointManager;
53 57
54 // A GpuChannelManager is a thread responsible for issuing rendering commands 58 // A GpuChannelManager is a thread responsible for issuing rendering commands
55 // managing the lifetimes of GPU channels and forwarding IPC requests from the 59 // managing the lifetimes of GPU channels and forwarding IPC requests from the
56 // browser process to them based on the corresponding renderer ID. 60 // browser process to them based on the corresponding renderer ID.
57 class GpuChannelManager : public IPC::Listener, 61 class GpuChannelManager : public IPC::Listener,
58 public IPC::Sender { 62 public IPC::Sender
63 #if defined(USE_X11)
64 ,
65 public gfx::X11PixmapTracker
alexst (slow to review) 2014/06/13 19:15:57 I like this general style, but as you mentioned th
reveman 2014/06/13 19:27:56 I agree. This was a bad idea.
reveman 2014/06/13 20:55:06 Take a look at latest patch. It adds a GpuMemoryBu
66 #endif
67 {
59 public: 68 public:
60 GpuChannelManager(MessageRouter* router, 69 GpuChannelManager(MessageRouter* router,
61 GpuWatchdog* watchdog, 70 GpuWatchdog* watchdog,
62 base::MessageLoopProxy* io_message_loop, 71 base::MessageLoopProxy* io_message_loop,
63 base::WaitableEvent* shutdown_event); 72 base::WaitableEvent* shutdown_event);
64 virtual ~GpuChannelManager(); 73 virtual ~GpuChannelManager();
65 74
66 // Remove the channel for a particular renderer. 75 // Remove the channel for a particular renderer.
67 void RemoveChannel(int client_id); 76 void RemoveChannel(int client_id);
68 77
69 // Listener overrides. 78 // Listener overrides.
70 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 79 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
71 80
72 // Sender overrides. 81 // Sender overrides.
73 virtual bool Send(IPC::Message* msg) OVERRIDE; 82 virtual bool Send(IPC::Message* msg) OVERRIDE;
74 83
84 #if defined(USE_X11)
85 // X11PixmapTracker overrides.
86 virtual XID AcquirePixmap(int primary_id, int secondary_id) OVERRIDE;
87 #endif
88
75 bool HandleMessagesScheduled(); 89 bool HandleMessagesScheduled();
76 uint64 MessagesProcessed(); 90 uint64 MessagesProcessed();
77 91
78 void LoseAllContexts(); 92 void LoseAllContexts();
79 93
80 base::WeakPtrFactory<GpuChannelManager> weak_factory_; 94 base::WeakPtrFactory<GpuChannelManager> weak_factory_;
81 95
82 int GenerateRouteID(); 96 int GenerateRouteID();
83 void AddRoute(int32 routing_id, IPC::Listener* listener); 97 void AddRoute(int32 routing_id, IPC::Listener* listener);
84 void RemoveRoute(int32 routing_id); 98 void RemoveRoute(int32 routing_id);
(...skipping 29 matching lines...) Expand all
114 void OnCloseChannel(const IPC::ChannelHandle& channel_handle); 128 void OnCloseChannel(const IPC::ChannelHandle& channel_handle);
115 void OnVisibilityChanged( 129 void OnVisibilityChanged(
116 int32 render_view_id, int32 client_id, bool visible); 130 int32 render_view_id, int32 client_id, bool visible);
117 void OnCreateViewCommandBuffer( 131 void OnCreateViewCommandBuffer(
118 const gfx::GLSurfaceHandle& window, 132 const gfx::GLSurfaceHandle& window,
119 int32 render_view_id, 133 int32 render_view_id,
120 int32 client_id, 134 int32 client_id,
121 const GPUCreateCommandBufferConfig& init_params, 135 const GPUCreateCommandBufferConfig& init_params,
122 int32 route_id); 136 int32 route_id);
123 void CreateImage( 137 void CreateImage(
124 gfx::PluginWindowHandle window, int32 client_id, int32 image_id); 138 const gfx::GpuMemoryBufferHandle& handle,
139 const gfx::Size& size,
140 unsigned internalformat,
141 int32 client_id,
142 int32 image_id);
125 void OnCreateImage( 143 void OnCreateImage(
126 gfx::PluginWindowHandle window, int32 client_id, int32 image_id); 144 const gfx::GpuMemoryBufferHandle& handle,
145 const gfx::Size& size,
146 unsigned internalformat,
147 int32 client_id,
148 int32 image_id);
127 void DeleteImage(int32 client_id, int32 image_id); 149 void DeleteImage(int32 client_id, int32 image_id);
128 void OnDeleteImage(int32 client_id, int32 image_id, int32 sync_point); 150 void OnDeleteImage(int32 client_id, int32 image_id, int32 sync_point);
129 void OnDeleteImageSyncPointRetired(ImageOperation*); 151 void OnDeleteImageSyncPointRetired(ImageOperation*);
130 void OnLoadedShader(std::string shader); 152 void OnLoadedShader(std::string shader);
131 void OnCreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, 153 void OnCreateGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
132 const gfx::Size& size, 154 const gfx::Size& size,
133 unsigned internalformat, 155 unsigned internalformat,
134 unsigned usage); 156 unsigned usage);
135 void OnDestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle, 157 void OnDestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferHandle& handle,
136 int32 sync_point); 158 int32 sync_point);
137 159
138 void OnLoseAllContexts(); 160 void OnLoseAllContexts();
139 161
162 #if defined(USE_X11)
163 void AddPixmap(XID pixmap, int pixmap_id, int client_id);
164 void RemoveAllPixmaps(int client_id);
165 #endif
166
140 scoped_refptr<base::MessageLoopProxy> io_message_loop_; 167 scoped_refptr<base::MessageLoopProxy> io_message_loop_;
141 base::WaitableEvent* shutdown_event_; 168 base::WaitableEvent* shutdown_event_;
142 169
143 // Used to send and receive IPC messages from the browser process. 170 // Used to send and receive IPC messages from the browser process.
144 MessageRouter* const router_; 171 MessageRouter* const router_;
145 172
146 // These objects manage channels to individual renderer processes there is 173 // These objects manage channels to individual renderer processes there is
147 // one channel for each renderer process that has connected to this GPU 174 // one channel for each renderer process that has connected to this GPU
148 // process. 175 // process.
149 GpuChannelMap gpu_channels_; 176 GpuChannelMap gpu_channels_;
150 scoped_refptr<gfx::GLShareGroup> share_group_; 177 scoped_refptr<gfx::GLShareGroup> share_group_;
151 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_; 178 scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
152 GpuMemoryManager gpu_memory_manager_; 179 GpuMemoryManager gpu_memory_manager_;
153 GpuEventsDispatcher gpu_devtools_events_dispatcher_; 180 GpuEventsDispatcher gpu_devtools_events_dispatcher_;
154 GpuWatchdog* watchdog_; 181 GpuWatchdog* watchdog_;
155 scoped_refptr<SyncPointManager> sync_point_manager_; 182 scoped_refptr<SyncPointManager> sync_point_manager_;
156 scoped_ptr<gpu::gles2::ProgramCache> program_cache_; 183 scoped_ptr<gpu::gles2::ProgramCache> program_cache_;
157 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_; 184 scoped_refptr<gpu::gles2::ShaderTranslatorCache> shader_translator_cache_;
158 scoped_refptr<gfx::GLSurface> default_offscreen_surface_; 185 scoped_refptr<gfx::GLSurface> default_offscreen_surface_;
159 ImageOperationQueue image_operations_; 186 ImageOperationQueue image_operations_;
160 187
188 #if defined(USE_X11)
189 typedef std::pair<int, int> X11PixmapMapKey;
190 typedef base::hash_map<X11PixmapMapKey, XID> X11PixmapMap;
191 X11PixmapMap pixmaps_;
192 base::ThreadChecker thread_checker_;
193 #endif
194
161 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager); 195 DISALLOW_COPY_AND_ASSIGN(GpuChannelManager);
162 }; 196 };
163 197
164 } // namespace content 198 } // namespace content
165 199
166 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_ 200 #endif // CONTENT_COMMON_GPU_GPU_CHANNEL_MANAGER_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.cc ('k') | content/common/gpu/gpu_channel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698