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

Side by Side Diff: gpu/command_buffer/client/cmd_buffer_helper.h

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: [RFC] gpu: Reuse transfer buffers more aggressively 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 // This file contains the command buffer helper class. 5 // This file contains the command buffer helper class.
6 6
7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 8 #define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
9 9
10 #include <string.h> 10 #include <string.h>
(...skipping 14 matching lines...) Expand all
25 // 25 //
26 // helper.AddCommand(...); 26 // helper.AddCommand(...);
27 // helper.AddCommand(...); 27 // helper.AddCommand(...);
28 // int32 token = helper.InsertToken(); 28 // int32 token = helper.InsertToken();
29 // helper.AddCommand(...); 29 // helper.AddCommand(...);
30 // helper.AddCommand(...); 30 // helper.AddCommand(...);
31 // [...] 31 // [...]
32 // 32 //
33 // helper.WaitForToken(token); // this doesn't return until the first two 33 // helper.WaitForToken(token); // this doesn't return until the first two
34 // // commands have been executed. 34 // // commands have been executed.
35 class GPU_EXPORT CommandBufferHelper { 35 class GPU_EXPORT CommandBufferHelper {
reveman 2014/01/02 01:31:29 What if we enumerate all internal queries and add
jadahl 2014/01/02 10:59:54 When would we WaitForQuery? In the current impleme
reveman 2014/01/02 11:56:44 Maybe we wouldn't block on queries when trying to
jadahl 2014/01/03 14:13:28 Thinking about tear down, is it really needed to w
piman 2014/01/08 05:08:04 I would prefer if GL concepts didn't leak into Com
reveman 2014/01/08 05:56:21 Makes sense. What if we just call this sequence nu
36 public: 36 public:
37 explicit CommandBufferHelper(CommandBuffer* command_buffer); 37 explicit CommandBufferHelper(CommandBuffer* command_buffer);
38 virtual ~CommandBufferHelper(); 38 virtual ~CommandBufferHelper();
39 39
40 // Initializes the CommandBufferHelper. 40 // Initializes the CommandBufferHelper.
41 // Parameters: 41 // Parameters:
42 // ring_buffer_size: The size of the ring buffer portion of the command 42 // ring_buffer_size: The size of the ring buffer portion of the command
43 // buffer. 43 // buffer.
44 bool Initialize(int32 ring_buffer_size); 44 bool Initialize(int32 ring_buffer_size);
45 45
(...skipping 30 matching lines...) Expand all
76 76
77 // Inserts a new token into the command buffer. This token either has a value 77 // Inserts a new token into the command buffer. This token either has a value
78 // different from previously inserted tokens, or ensures that previously 78 // different from previously inserted tokens, or ensures that previously
79 // inserted tokens with that value have already passed through the command 79 // inserted tokens with that value have already passed through the command
80 // stream. 80 // stream.
81 // Returns: 81 // Returns:
82 // the value of the new token or -1 if the command buffer reader has 82 // the value of the new token or -1 if the command buffer reader has
83 // shutdown. 83 // shutdown.
84 int32 InsertToken(); 84 int32 InsertToken();
85 85
86 // Returns true if the token has already passed.
87 // Parameters:
88 // the value of the token to check whether it has passed
89 bool HasTokenPassed(int32 token);
reveman 2014/01/02 01:31:29 why is this needed in addition to last_token_read(
jadahl 2014/01/02 10:59:54 No need. Will remove. No idea why I added it herei
epennerAtGoogle 2014/01/07 00:47:59 Just FYI, I actually like this (as an inline funct
90
86 // Waits until the token of a particular value has passed through the command 91 // Waits until the token of a particular value has passed through the command
87 // stream (i.e. commands inserted before that token have been executed). 92 // stream (i.e. commands inserted before that token have been executed).
88 // NOTE: This will call Flush if it needs to block. 93 // NOTE: This will call Flush if it needs to block.
89 // Parameters: 94 // Parameters:
90 // the value of the token to wait for. 95 // the value of the token to wait for.
91 void WaitForToken(int32 token); 96 void WaitForToken(int32 token);
92 97
93 // Called prior to each command being issued. Waits for a certain amount of 98 // Called prior to each command being issued. Waits for a certain amount of
94 // space to be available. Returns address of space. 99 // space to be available. Returns address of space.
95 CommandBufferEntry* GetSpace(uint32 entries); 100 CommandBufferEntry* GetSpace(uint32 entries);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // Using C runtime instead of base because this file cannot depend on base. 266 // Using C runtime instead of base because this file cannot depend on base.
262 clock_t last_flush_time_; 267 clock_t last_flush_time_;
263 268
264 friend class CommandBufferHelperTest; 269 friend class CommandBufferHelperTest;
265 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); 270 DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper);
266 }; 271 };
267 272
268 } // namespace gpu 273 } // namespace gpu
269 274
270 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ 275 #endif // GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698