| OLD | NEW |
| 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_COMMAND_BUFFER_SERVICE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "gpu/command_buffer/common/command_buffer.h" | 15 #include "gpu/command_buffer/common/command_buffer.h" |
| 16 #include "gpu/command_buffer/common/command_buffer_shared.h" | 16 #include "gpu/command_buffer/common/command_buffer_shared.h" |
| 17 | 17 |
| 18 namespace gpu { | 18 namespace gpu { |
| 19 | 19 |
| 20 class TransferBufferManagerInterface; | 20 class TransferBufferManagerInterface; |
| 21 | 21 |
| 22 class GPU_EXPORT CommandBufferServiceBase : public CommandBuffer { | 22 class GPU_EXPORT CommandBufferServiceBase : public CommandBuffer { |
| 23 public: | 23 public: |
| 24 // Sets the current get offset. This can be called from any thread. | 24 // Sets the current get offset. This can be called from any thread. |
| 25 virtual void SetGetOffset(int32_t get_offset) = 0; | 25 virtual void SetGetOffset(int32_t get_offset) = 0; |
| 26 | 26 |
| 27 // Set the release count for the last fence sync seen in the command stream. |
| 28 virtual void SetReleaseCount(uint64_t release_count) = 0; |
| 29 |
| 27 // Get the transfer buffer associated with an ID. Returns a null buffer for | 30 // Get the transfer buffer associated with an ID. Returns a null buffer for |
| 28 // ID 0. | 31 // ID 0. |
| 29 virtual scoped_refptr<gpu::Buffer> GetTransferBuffer(int32_t id) = 0; | 32 virtual scoped_refptr<gpu::Buffer> GetTransferBuffer(int32_t id) = 0; |
| 30 | 33 |
| 31 // Allows the reader to update the current token value. | 34 // Allows the reader to update the current token value. |
| 32 virtual void SetToken(int32_t token) = 0; | 35 virtual void SetToken(int32_t token) = 0; |
| 33 | 36 |
| 34 // Allows the reader to set the current parse error. | 37 // Allows the reader to set the current parse error. |
| 35 virtual void SetParseError(error::Error) = 0; | 38 virtual void SetParseError(error::Error) = 0; |
| 36 | 39 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 47 // API to manage the put and get pointers. | 50 // API to manage the put and get pointers. |
| 48 class GPU_EXPORT CommandBufferService : public CommandBufferServiceBase { | 51 class GPU_EXPORT CommandBufferService : public CommandBufferServiceBase { |
| 49 public: | 52 public: |
| 50 typedef base::Callback<bool(int32_t)> GetBufferChangedCallback; | 53 typedef base::Callback<bool(int32_t)> GetBufferChangedCallback; |
| 51 explicit CommandBufferService( | 54 explicit CommandBufferService( |
| 52 TransferBufferManagerInterface* transfer_buffer_manager); | 55 TransferBufferManagerInterface* transfer_buffer_manager); |
| 53 ~CommandBufferService() override; | 56 ~CommandBufferService() override; |
| 54 | 57 |
| 55 // CommandBuffer implementation: | 58 // CommandBuffer implementation: |
| 56 State GetLastState() override; | 59 State GetLastState() override; |
| 57 int32_t GetLastToken() override; | |
| 58 void Flush(int32_t put_offset) override; | 60 void Flush(int32_t put_offset) override; |
| 59 void OrderingBarrier(int32_t put_offset) override; | 61 void OrderingBarrier(int32_t put_offset) override; |
| 60 void WaitForTokenInRange(int32_t start, int32_t end) override; | 62 State WaitForTokenInRange(int32_t start, int32_t end) override; |
| 61 void WaitForGetOffsetInRange(int32_t start, int32_t end) override; | 63 State WaitForGetOffsetInRange(int32_t start, int32_t end) override; |
| 62 void SetGetBuffer(int32_t transfer_buffer_id) override; | 64 void SetGetBuffer(int32_t transfer_buffer_id) override; |
| 63 scoped_refptr<Buffer> CreateTransferBuffer(size_t size, int32_t* id) override; | 65 scoped_refptr<Buffer> CreateTransferBuffer(size_t size, int32_t* id) override; |
| 64 void DestroyTransferBuffer(int32_t id) override; | 66 void DestroyTransferBuffer(int32_t id) override; |
| 65 | 67 |
| 66 // CommandBufferServiceBase implementation: | 68 // CommandBufferServiceBase implementation: |
| 67 void SetGetOffset(int32_t get_offset) override; | 69 void SetGetOffset(int32_t get_offset) override; |
| 70 void SetReleaseCount(uint64_t release_count) override; |
| 68 scoped_refptr<Buffer> GetTransferBuffer(int32_t id) override; | 71 scoped_refptr<Buffer> GetTransferBuffer(int32_t id) override; |
| 69 void SetToken(int32_t token) override; | 72 void SetToken(int32_t token) override; |
| 70 void SetParseError(error::Error error) override; | 73 void SetParseError(error::Error error) override; |
| 71 void SetContextLostReason(error::ContextLostReason) override; | 74 void SetContextLostReason(error::ContextLostReason) override; |
| 72 int32_t GetPutOffset() override; | 75 int32_t GetPutOffset() override; |
| 73 | 76 |
| 74 // Sets a callback that is called whenever the put offset is changed. When | 77 // Sets a callback that is called whenever the put offset is changed. When |
| 75 // called with sync==true, the callback must not return until some progress | 78 // called with sync==true, the callback must not return until some progress |
| 76 // has been made (unless the command buffer is empty), i.e. the get offset | 79 // has been made (unless the command buffer is empty), i.e. the get offset |
| 77 // must have changed. It need not process the entire command buffer though. | 80 // must have changed. It need not process the entire command buffer though. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 103 std::unique_ptr<BufferBacking> shared_state_buffer_; | 106 std::unique_ptr<BufferBacking> shared_state_buffer_; |
| 104 CommandBufferSharedState* shared_state_; | 107 CommandBufferSharedState* shared_state_; |
| 105 int32_t num_entries_; | 108 int32_t num_entries_; |
| 106 int32_t get_offset_; | 109 int32_t get_offset_; |
| 107 int32_t put_offset_; | 110 int32_t put_offset_; |
| 108 base::Closure put_offset_change_callback_; | 111 base::Closure put_offset_change_callback_; |
| 109 GetBufferChangedCallback get_buffer_change_callback_; | 112 GetBufferChangedCallback get_buffer_change_callback_; |
| 110 base::Closure parse_error_callback_; | 113 base::Closure parse_error_callback_; |
| 111 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 114 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
| 112 int32_t token_; | 115 int32_t token_; |
| 116 uint64_t release_count_; |
| 113 uint32_t generation_; | 117 uint32_t generation_; |
| 114 error::Error error_; | 118 error::Error error_; |
| 115 error::ContextLostReason context_lost_reason_; | 119 error::ContextLostReason context_lost_reason_; |
| 116 | 120 |
| 117 DISALLOW_COPY_AND_ASSIGN(CommandBufferService); | 121 DISALLOW_COPY_AND_ASSIGN(CommandBufferService); |
| 118 }; | 122 }; |
| 119 | 123 |
| 120 } // namespace gpu | 124 } // namespace gpu |
| 121 | 125 |
| 122 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ | 126 #endif // GPU_COMMAND_BUFFER_SERVICE_COMMAND_BUFFER_SERVICE_H_ |
| OLD | NEW |