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

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

Issue 7260008: Implement proper synchronization between HW video decode IPC and CommandBuffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 5 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_COMMAND_BUFFER_STUB_H_ 5 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_
6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ 6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_
7 #pragma once 7 #pragma once
8 8
9 #if defined(ENABLE_GPU) 9 #if defined(ENABLE_GPU)
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // Identifies the renderer process. 56 // Identifies the renderer process.
57 int32 renderer_id() const { return renderer_id_; } 57 int32 renderer_id() const { return renderer_id_; }
58 58
59 // Identifies a particular renderer belonging to the same renderer process. 59 // Identifies a particular renderer belonging to the same renderer process.
60 int32 render_view_id() const { return render_view_id_; } 60 int32 render_view_id() const { return render_view_id_; }
61 61
62 // Identifies the various GpuCommandBufferStubs in the GPU process belonging 62 // Identifies the various GpuCommandBufferStubs in the GPU process belonging
63 // to the same renderer process. 63 // to the same renderer process.
64 int32 route_id() const { return route_id_; } 64 int32 route_id() const { return route_id_; }
65 65
66 // Return the current token in the underlying command buffer, or 0 if not yet
67 // initialized.
68 int32 token() const {
69 return command_buffer_.get() ? command_buffer_->GetState().token : 0;
70 }
71
66 #if defined(OS_WIN) 72 #if defined(OS_WIN)
67 // Called only by the compositor window's window proc 73 // Called only by the compositor window's window proc
68 void OnCompositorWindowPainted(); 74 void OnCompositorWindowPainted();
69 #endif // defined(OS_WIN) 75 #endif // defined(OS_WIN)
70 76
71 void ViewResized(); 77 void ViewResized();
72 78
73 #if defined(TOUCH_UI) 79 #if defined(TOUCH_UI)
74 void AcceleratedSurfaceIOSurfaceSet(uint64 surface_id); 80 void AcceleratedSurfaceIOSurfaceSet(uint64 surface_id);
75 void AcceleratedSurfaceReleased(uint64 surface_id); 81 void AcceleratedSurfaceReleased(uint64 surface_id);
76 #endif // defined(TOUCH_UI) 82 #endif // defined(TOUCH_UI)
77 83
78 #if defined(OS_MACOSX) || defined(TOUCH_UI) 84 #if defined(OS_MACOSX) || defined(TOUCH_UI)
79 // Called only by the GpuChannel. 85 // Called only by the GpuChannel.
80 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count); 86 void AcceleratedSurfaceBuffersSwapped(uint64 swap_buffers_count);
81 #endif // defined(OS_MACOSX) || defined(TOUCH_UI) 87 #endif // defined(OS_MACOSX) || defined(TOUCH_UI)
82 88
83 // Called when the command buffer was destroyed, and the stub should now 89 // Called when the command buffer was destroyed, and the stub should now
84 // unblock itself and handle pending messages. 90 // unblock itself and handle pending messages.
85 void CommandBufferWasDestroyed(); 91 void CommandBufferWasDestroyed();
86 92
93 // Register a callback to be Run() whenever the underlying scheduler receives
94 // a set_token() call. The callback will be Run() with the just-set token as
95 // its only parameter. Multiple callbacks may be registered.
96 void AddSetTokenCallback(const base::Callback<void(int32)>& callback);
97
87 private: 98 private:
88 // Message handlers: 99 // Message handlers:
89 void OnInitialize(base::SharedMemoryHandle ring_buffer, 100 void OnInitialize(base::SharedMemoryHandle ring_buffer,
90 int32 size, 101 int32 size,
91 IPC::Message* reply_message); 102 IPC::Message* reply_message);
92 void OnSetParent(int32 parent_route_id, 103 void OnSetParent(int32 parent_route_id,
93 uint32 parent_texture_id, 104 uint32 parent_texture_id,
94 IPC::Message* reply_message); 105 IPC::Message* reply_message);
95 void OnGetState(IPC::Message* reply_message); 106 void OnGetState(IPC::Message* reply_message);
96 void OnFlush(int32 put_offset, 107 void OnFlush(int32 put_offset,
(...skipping 22 matching lines...) Expand all
119 void OnSetWindowSize(const gfx::Size& size); 130 void OnSetWindowSize(const gfx::Size& size);
120 #endif // defined(OS_MACOSX) 131 #endif // defined(OS_MACOSX)
121 132
122 #if defined(OS_MACOSX) || defined(TOUCH_UI) 133 #if defined(OS_MACOSX) || defined(TOUCH_UI)
123 void SwapBuffersCallback(); 134 void SwapBuffersCallback();
124 #endif // defined(TOUCH_UI) 135 #endif // defined(TOUCH_UI)
125 136
126 void ResizeCallback(gfx::Size size); 137 void ResizeCallback(gfx::Size size);
127 void ReportState(); 138 void ReportState();
128 139
140 // Callback registered with GpuScheduler to receive set_token() notifications.
141 void OnSetToken(int32 token);
142
129 // The lifetime of objects of this class is managed by a GpuChannel. The 143 // The lifetime of objects of this class is managed by a GpuChannel. The
130 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they 144 // GpuChannels destroy all the GpuCommandBufferStubs that they own when they
131 // are destroyed. So a raw pointer is safe. 145 // are destroyed. So a raw pointer is safe.
132 GpuChannel* channel_; 146 GpuChannel* channel_;
133 147
134 gfx::PluginWindowHandle handle_; 148 gfx::PluginWindowHandle handle_;
135 gfx::Size initial_size_; 149 gfx::Size initial_size_;
136 gpu::gles2::DisallowedExtensions disallowed_extensions_; 150 gpu::gles2::DisallowedExtensions disallowed_extensions_;
137 std::string allowed_extensions_; 151 std::string allowed_extensions_;
138 std::vector<int32> requested_attribs_; 152 std::vector<int32> requested_attribs_;
139 int32 route_id_; 153 int32 route_id_;
140 uint32 last_flush_count_; 154 uint32 last_flush_count_;
141 155
142 // The following two fields are used on Mac OS X to identify the window 156 // The following two fields are used on Mac OS X to identify the window
143 // for the rendering results on the browser side. 157 // for the rendering results on the browser side.
144 int32 renderer_id_; 158 int32 renderer_id_;
145 int32 render_view_id_; 159 int32 render_view_id_;
146 160
147 scoped_ptr<gpu::CommandBufferService> command_buffer_; 161 scoped_ptr<gpu::CommandBufferService> command_buffer_;
148 scoped_ptr<gpu::GpuScheduler> scheduler_; 162 scoped_ptr<gpu::GpuScheduler> scheduler_;
149 std::queue<IPC::Message*> deferred_messages_; 163 std::queue<IPC::Message*> deferred_messages_;
164 std::vector<base::Callback<void(int32)> > set_token_callbacks_;
150 165
151 // SetParent may be called before Initialize, in which case we need to keep 166 // SetParent may be called before Initialize, in which case we need to keep
152 // around the parent stub, so that Initialize can set the parent correctly. 167 // around the parent stub, so that Initialize can set the parent correctly.
153 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; 168 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_;
154 uint32 parent_texture_for_initialization_; 169 uint32 parent_texture_for_initialization_;
155 170
156 GpuWatchdog* watchdog_; 171 GpuWatchdog* watchdog_;
157 ScopedRunnableMethodFactory<GpuCommandBufferStub> task_factory_; 172 ScopedRunnableMethodFactory<GpuCommandBufferStub> task_factory_;
158 173
159 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); 174 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub);
160 }; 175 };
161 176
162 #endif // defined(ENABLE_GPU) 177 #endif // defined(ENABLE_GPU)
163 178
164 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ 179 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698