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

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

Issue 5317007: Add flow control between renderer and GPU processes, and, on Mac OS X,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_GPU_PROCESSOR_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/surface/transport_dib.h" 10 #include "app/surface/transport_dib.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 const char* allowed_extensions, 54 const char* allowed_extensions,
55 const std::vector<int32>& attribs, 55 const std::vector<int32>& attribs,
56 GPUProcessor* parent, 56 GPUProcessor* parent,
57 uint32 parent_texture_id); 57 uint32 parent_texture_id);
58 58
59 void Destroy(); 59 void Destroy();
60 void DestroyCommon(); 60 void DestroyCommon();
61 61
62 virtual void ProcessCommands(); 62 virtual void ProcessCommands();
63 63
64 // Helper which causes a call to ProcessCommands to be scheduled later.
65 void ScheduleProcessCommands();
66
64 // Implementation of CommandBufferEngine. 67 // Implementation of CommandBufferEngine.
65 virtual Buffer GetSharedMemoryBuffer(int32 shm_id); 68 virtual Buffer GetSharedMemoryBuffer(int32 shm_id);
66 virtual void set_token(int32 token); 69 virtual void set_token(int32 token);
67 virtual bool SetGetOffset(int32 offset); 70 virtual bool SetGetOffset(int32 offset);
68 virtual int32 GetGetOffset(); 71 virtual int32 GetGetOffset();
69 72
70 // Asynchronously resizes an offscreen frame buffer. 73 // Asynchronously resizes an offscreen frame buffer.
71 void ResizeOffscreenFrameBuffer(const gfx::Size& size); 74 void ResizeOffscreenFrameBuffer(const gfx::Size& size);
72 75
73 #if defined(OS_MACOSX) 76 #if defined(OS_MACOSX)
74 // Needed only on Mac OS X, which does not render into an on-screen 77 // Needed only on Mac OS X, which does not render into an on-screen
75 // window and therefore requires the backing store to be resized 78 // window and therefore requires the backing store to be resized
76 // manually. Returns an opaque identifier for the new backing store. 79 // manually. Returns an opaque identifier for the new backing store.
77 // There are two versions of this method: one for use with the IOSurface 80 // There are two versions of this method: one for use with the IOSurface
78 // available in Mac OS X 10.6; and, one for use with the 81 // available in Mac OS X 10.6; and, one for use with the
79 // TransportDIB-based version used on Mac OS X 10.5. 82 // TransportDIB-based version used on Mac OS X 10.5.
80 virtual uint64 SetWindowSizeForIOSurface(const gfx::Size& size); 83 virtual uint64 SetWindowSizeForIOSurface(const gfx::Size& size);
81 virtual TransportDIB::Handle SetWindowSizeForTransportDIB( 84 virtual TransportDIB::Handle SetWindowSizeForTransportDIB(
82 const gfx::Size& size); 85 const gfx::Size& size);
83 virtual void SetTransportDIBAllocAndFree( 86 virtual void SetTransportDIBAllocAndFree(
84 Callback2<size_t, TransportDIB::Handle*>::Type* allocator, 87 Callback2<size_t, TransportDIB::Handle*>::Type* allocator,
85 Callback1<TransportDIB::Id>::Type* deallocator); 88 Callback1<TransportDIB::Id>::Type* deallocator);
86 // Returns the id of the current IOSurface, or 0. 89 // Returns the id of the current IOSurface, or 0.
87 virtual uint64 GetSurfaceId(); 90 virtual uint64 GetSurfaceId();
91 // To prevent the GPU process from overloading the browser process,
92 // we need to track the number of swap buffers calls issued and
93 // acknowledged per on-screen (IOSurface-backed) context, and keep
94 // the GPU from getting too far ahead of the browser. Note that this
95 // is also predicated on a flow control mechanism between the
96 // renderer and GPU processes.
97 uint64 swap_buffers_count() const;
98 void set_acknowledged_swap_buffers_count(
99 uint64 acknowledged_swap_buffers_count);
88 #endif 100 #endif
89 101
90 // Sets a callback which is called when a SwapBuffers command is processed. 102 // Sets a callback which is called when a SwapBuffers command is processed.
91 // Must be called after Initialize(). 103 // Must be called after Initialize().
92 // It is not defined on which thread this callback is called. 104 // It is not defined on which thread this callback is called.
93 virtual void SetSwapBuffersCallback(Callback0::Type* callback); 105 virtual void SetSwapBuffersCallback(Callback0::Type* callback);
94 106
95 // Get the GLES2Decoder associated with this processor. 107 // Get the GLES2Decoder associated with this processor.
96 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } 108 gles2::GLES2Decoder* decoder() const { return decoder_.get(); }
97 109
(...skipping 17 matching lines...) Expand all
115 // through the ProcessCommands callback. 127 // through the ProcessCommands callback.
116 CommandBuffer* command_buffer_; 128 CommandBuffer* command_buffer_;
117 129
118 int commands_per_update_; 130 int commands_per_update_;
119 131
120 scoped_ptr<gles2::GLES2Decoder> decoder_; 132 scoped_ptr<gles2::GLES2Decoder> decoder_;
121 scoped_ptr<CommandParser> parser_; 133 scoped_ptr<CommandParser> parser_;
122 134
123 #if defined(OS_MACOSX) 135 #if defined(OS_MACOSX)
124 scoped_ptr<AcceleratedSurface> surface_; 136 scoped_ptr<AcceleratedSurface> surface_;
137 uint64 swap_buffers_count_;
138 uint64 acknowledged_swap_buffers_count_;
125 #endif 139 #endif
126 140
127 ScopedRunnableMethodFactory<GPUProcessor> method_factory_; 141 ScopedRunnableMethodFactory<GPUProcessor> method_factory_;
128 scoped_ptr<Callback0::Type> wrapped_swap_buffers_callback_; 142 scoped_ptr<Callback0::Type> wrapped_swap_buffers_callback_;
129 }; 143 };
130 144
131 } // namespace gpu 145 } // namespace gpu
132 146
133 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_ 147 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_PROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698