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

Side by Side Diff: gpu/command_buffer/service/query_manager.h

Issue 12213073: Re-land: Mark async texture uploads as completed from the upload thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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) 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 GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/hash_tables.h" 10 #include "base/hash_tables.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 // Returns false if shared memory for sync is invalid. 83 // Returns false if shared memory for sync is invalid.
84 bool MarkAsCompleted(uint64 result); 84 bool MarkAsCompleted(uint64 result);
85 85
86 void MarkAsPending(uint32 submit_count) { 86 void MarkAsPending(uint32 submit_count) {
87 DCHECK(!pending_); 87 DCHECK(!pending_);
88 pending_ = true; 88 pending_ = true;
89 submit_count_ = submit_count; 89 submit_count_ = submit_count;
90 } 90 }
91 91
92 void UnmarkAsPending() {
93 DCHECK(pending_);
94 pending_ = false;
95 }
96
92 // Returns false if shared memory for sync is invalid. 97 // Returns false if shared memory for sync is invalid.
93 bool AddToPendingQueue(uint32 submit_count) { 98 bool AddToPendingQueue(uint32 submit_count) {
94 return manager_->AddPendingQuery(this, submit_count); 99 return manager_->AddPendingQuery(this, submit_count);
95 } 100 }
96 101
102 // Returns false if shared memory for sync is invalid.
103 bool AddToPendingTransferQueue(uint32 submit_count) {
104 return manager_->AddPendingTransferQuery(this, submit_count);
105 }
106
97 void BeginQueryHelper(GLenum target, GLuint id) { 107 void BeginQueryHelper(GLenum target, GLuint id) {
98 manager_->BeginQueryHelper(target, id); 108 manager_->BeginQueryHelper(target, id);
99 } 109 }
100 110
101 void EndQueryHelper(GLenum target) { 111 void EndQueryHelper(GLenum target) {
102 manager_->EndQueryHelper(target); 112 manager_->EndQueryHelper(target);
103 } 113 }
104 114
115 uint32 submit_count() const {
116 return submit_count_;
117 }
118
105 private: 119 private:
106 friend class QueryManager; 120 friend class QueryManager;
107 friend class QueryManagerTest; 121 friend class QueryManagerTest;
108 friend class base::RefCounted<Query>; 122 friend class base::RefCounted<Query>;
109 123
110 uint32 submit_count() const {
111 return submit_count_;
112 }
113
114 // The manager that owns this Query. 124 // The manager that owns this Query.
115 QueryManager* manager_; 125 QueryManager* manager_;
116 126
117 // The type of query. 127 // The type of query.
118 GLenum target_; 128 GLenum target_;
119 129
120 // The shared memory used with this Query. 130 // The shared memory used with this Query.
121 int32 shm_id_; 131 int32 shm_id_;
122 uint32 shm_offset_; 132 uint32 shm_offset_;
123 133
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 182
173 // Wrappers for BeginQueryARB and EndQueryARB to hide differences between 183 // Wrappers for BeginQueryARB and EndQueryARB to hide differences between
174 // ARB_occlusion_query2 and EXT_occlusion_query_boolean. 184 // ARB_occlusion_query2 and EXT_occlusion_query_boolean.
175 void BeginQueryHelper(GLenum target, GLuint id); 185 void BeginQueryHelper(GLenum target, GLuint id);
176 void EndQueryHelper(GLenum target); 186 void EndQueryHelper(GLenum target);
177 187
178 // Adds to queue of queries waiting for completion. 188 // Adds to queue of queries waiting for completion.
179 // Returns false if any query is pointing to invalid shared memory. 189 // Returns false if any query is pointing to invalid shared memory.
180 bool AddPendingQuery(Query* query, uint32 submit_count); 190 bool AddPendingQuery(Query* query, uint32 submit_count);
181 191
192 // Adds to queue of trasnfer queries waiting for completion.
193 // Returns false if any query is pointing to invalid shared memory.
194 bool AddPendingTransferQuery(Query* query, uint32 submit_count);
195
182 // Removes a query from the queue of pending queries. 196 // Removes a query from the queue of pending queries.
183 // Returns false if any query is pointing to invalid shared memory. 197 // Returns false if any query is pointing to invalid shared memory.
184 bool RemovePendingQuery(Query* query); 198 bool RemovePendingQuery(Query* query);
185 199
186 // Returns a target used for the underlying GL extension 200 // Returns a target used for the underlying GL extension
187 // used to emulate a query. 201 // used to emulate a query.
188 GLenum AdjustTargetForEmulation(GLenum target); 202 GLenum AdjustTargetForEmulation(GLenum target);
189 203
190 // Used to validate shared memory and get GL errors. 204 // Used to validate shared memory and get GL errors.
191 GLES2Decoder* decoder_; 205 GLES2Decoder* decoder_;
192 206
193 bool use_arb_occlusion_query2_for_occlusion_query_boolean_; 207 bool use_arb_occlusion_query2_for_occlusion_query_boolean_;
194 bool use_arb_occlusion_query_for_occlusion_query_boolean_; 208 bool use_arb_occlusion_query_for_occlusion_query_boolean_;
195 209
196 // Counts the number of Queries allocated with 'this' as their manager. 210 // Counts the number of Queries allocated with 'this' as their manager.
197 // Allows checking no Query will outlive this. 211 // Allows checking no Query will outlive this.
198 unsigned query_count_; 212 unsigned query_count_;
199 213
200 // Info for each query in the system. 214 // Info for each query in the system.
201 typedef base::hash_map<GLuint, Query::Ref> QueryMap; 215 typedef base::hash_map<GLuint, Query::Ref> QueryMap;
202 QueryMap queries_; 216 QueryMap queries_;
203 217
204 // Queries waiting for completion. 218 // Queries waiting for completion.
205 typedef std::deque<Query::Ref> QueryQueue; 219 typedef std::deque<Query::Ref> QueryQueue;
206 QueryQueue pending_queries_; 220 QueryQueue pending_queries_;
207 221
222 // Async pixel transfer queries waiting for completion.
223 QueryQueue pending_transfer_queries_;
224
208 DISALLOW_COPY_AND_ASSIGN(QueryManager); 225 DISALLOW_COPY_AND_ASSIGN(QueryManager);
209 }; 226 };
210 227
211 } // namespace gles2 228 } // namespace gles2
212 } // namespace gpu 229 } // namespace gpu
213 230
214 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ 231 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698