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

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

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: [WIP] gpu: Reuse transfer buffers more aggresively Created 6 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 #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 <vector> 9 #include <vector>
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/logging.h" 12 #include "base/logging.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 "gpu/command_buffer/service/feature_info.h" 15 #include "gpu/command_buffer/service/feature_info.h"
16 #include "gpu/command_buffer/service/gl_utils.h" 16 #include "gpu/command_buffer/service/gl_utils.h"
17 #include "gpu/gpu_export.h" 17 #include "gpu/gpu_export.h"
18 18
19 namespace gpu { 19 namespace gpu {
20 20
21 class GLES2Decoder; 21 class GLES2Decoder;
22 22
23 namespace gles2 { 23 namespace gles2 {
24 24
25 class FeatureInfo; 25 class FeatureInfo;
26 26
27 // This class keeps track of the queries and their state 27 // This class keeps track of the queries and their state
28 // As Queries are not shared there is one QueryManager per context. 28 // As Queries are not shared there is one QueryManager per context.
29 class GPU_EXPORT QueryManager { 29 class GPU_EXPORT QueryManager : public base::SupportsWeakPtr<QueryManager> {
30 public: 30 public:
31 class GPU_EXPORT Query : public base::RefCounted<Query> { 31 class GPU_EXPORT Query : public base::RefCounted<Query> {
32 public: 32 public:
33 Query( 33 Query(
34 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset); 34 QueryManager* manager, GLenum target, int32 shm_id, uint32 shm_offset);
35 35
36 GLenum target() const { 36 GLenum target() const {
37 return target_; 37 return target_;
38 } 38 }
39 39
(...skipping 10 matching lines...) Expand all
50 } 50 }
51 51
52 int32 shm_id() const { 52 int32 shm_id() const {
53 return shm_id_; 53 return shm_id_;
54 } 54 }
55 55
56 uint32 shm_offset() const { 56 uint32 shm_offset() const {
57 return shm_offset_; 57 return shm_offset_;
58 } 58 }
59 59
60 void set_serial(uint32 serial) {
61 serial_ = serial;
62 }
63
64 uint32 serial() const {
65 return serial_;
66 }
67
60 // Returns false if shared memory for sync is invalid. 68 // Returns false if shared memory for sync is invalid.
61 virtual bool Begin() = 0; 69 virtual bool Begin() = 0;
62 70
63 // Returns false if shared memory for sync is invalid. 71 // Returns false if shared memory for sync is invalid.
64 virtual bool End(uint32 submit_count) = 0; 72 virtual bool End(uint32 submit_count) = 0;
65 73
66 // Returns false if shared memory for sync is invalid. 74 // Returns false if shared memory for sync is invalid.
67 virtual bool Process() = 0; 75 virtual bool Process() = 0;
68 76
69 virtual void Destroy(bool have_context) = 0; 77 virtual void Destroy(bool have_context) = 0;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 144
137 // Count to set process count do when completed. 145 // Count to set process count do when completed.
138 uint32 submit_count_; 146 uint32 submit_count_;
139 147
140 // True if in the queue. 148 // True if in the queue.
141 bool pending_; 149 bool pending_;
142 150
143 // True if deleted. 151 // True if deleted.
144 bool deleted_; 152 bool deleted_;
145 153
154 uint32 serial_;
155
146 // List of callbacks to run when result is available. 156 // List of callbacks to run when result is available.
147 std::vector<base::Closure> callbacks_; 157 std::vector<base::Closure> callbacks_;
148 }; 158 };
149 159
150 QueryManager( 160 QueryManager(
151 GLES2Decoder* decoder, 161 GLES2Decoder* decoder,
152 FeatureInfo* feature_info); 162 FeatureInfo* feature_info);
153 ~QueryManager(); 163 ~QueryManager();
154 164
155 // Must call before destruction. 165 // Must call before destruction.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // Async pixel transfer queries waiting for completion. 245 // Async pixel transfer queries waiting for completion.
236 QueryQueue pending_transfer_queries_; 246 QueryQueue pending_transfer_queries_;
237 247
238 DISALLOW_COPY_AND_ASSIGN(QueryManager); 248 DISALLOW_COPY_AND_ASSIGN(QueryManager);
239 }; 249 };
240 250
241 } // namespace gles2 251 } // namespace gles2
242 } // namespace gpu 252 } // namespace gpu
243 253
244 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_ 254 #endif // GPU_COMMAND_BUFFER_SERVICE_QUERY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698