| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_IN_PROCESS_COMMAND_BUFFER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 // This class provides a thread-safe interface to the global GPU service (for | 58 // This class provides a thread-safe interface to the global GPU service (for |
| 59 // example GPU thread) when being run in single process mode. | 59 // example GPU thread) when being run in single process mode. |
| 60 // However, the behavior for accessing one context (i.e. one instance of this | 60 // However, the behavior for accessing one context (i.e. one instance of this |
| 61 // class) from different client threads is undefined. | 61 // class) from different client threads is undefined. |
| 62 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, | 62 class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer, |
| 63 public GpuControl { | 63 public GpuControl { |
| 64 public: | 64 public: |
| 65 class Service; | 65 class Service; |
| 66 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); | 66 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); |
| 67 virtual ~InProcessCommandBuffer(); | 67 ~InProcessCommandBuffer() override; |
| 68 | 68 |
| 69 // If |surface| is not NULL, use it directly; in this case, the command | 69 // If |surface| is not NULL, use it directly; in this case, the command |
| 70 // buffer gpu thread must be the same as the client thread. Otherwise create | 70 // buffer gpu thread must be the same as the client thread. Otherwise create |
| 71 // a new GLSurface. | 71 // a new GLSurface. |
| 72 bool Initialize(scoped_refptr<gfx::GLSurface> surface, | 72 bool Initialize(scoped_refptr<gfx::GLSurface> surface, |
| 73 bool is_offscreen, | 73 bool is_offscreen, |
| 74 gfx::AcceleratedWidget window, | 74 gfx::AcceleratedWidget window, |
| 75 const gfx::Size& size, | 75 const gfx::Size& size, |
| 76 const std::vector<int32>& attribs, | 76 const std::vector<int32>& attribs, |
| 77 gfx::GpuPreference gpu_preference, | 77 gfx::GpuPreference gpu_preference, |
| 78 const base::Closure& context_lost_callback, | 78 const base::Closure& context_lost_callback, |
| 79 InProcessCommandBuffer* share_group); | 79 InProcessCommandBuffer* share_group); |
| 80 void Destroy(); | 80 void Destroy(); |
| 81 | 81 |
| 82 // CommandBuffer implementation: | 82 // CommandBuffer implementation: |
| 83 virtual bool Initialize() override; | 83 bool Initialize() override; |
| 84 virtual State GetLastState() override; | 84 State GetLastState() override; |
| 85 virtual int32 GetLastToken() override; | 85 int32 GetLastToken() override; |
| 86 virtual void Flush(int32 put_offset) override; | 86 void Flush(int32 put_offset) override; |
| 87 virtual void WaitForTokenInRange(int32 start, int32 end) override; | 87 void WaitForTokenInRange(int32 start, int32 end) override; |
| 88 virtual void WaitForGetOffsetInRange(int32 start, int32 end) override; | 88 void WaitForGetOffsetInRange(int32 start, int32 end) override; |
| 89 virtual void SetGetBuffer(int32 shm_id) override; | 89 void SetGetBuffer(int32 shm_id) override; |
| 90 virtual scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, | 90 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size, |
| 91 int32* id) override; | 91 int32* id) override; |
| 92 virtual void DestroyTransferBuffer(int32 id) override; | 92 void DestroyTransferBuffer(int32 id) override; |
| 93 virtual gpu::error::Error GetLastError() override; | 93 gpu::error::Error GetLastError() override; |
| 94 | 94 |
| 95 // GpuControl implementation: | 95 // GpuControl implementation: |
| 96 virtual gpu::Capabilities GetCapabilities() override; | 96 gpu::Capabilities GetCapabilities() override; |
| 97 virtual int32 CreateImage(ClientBuffer buffer, | 97 int32 CreateImage(ClientBuffer buffer, |
| 98 size_t width, | 98 size_t width, |
| 99 size_t height, | 99 size_t height, |
| 100 unsigned internalformat) override; | 100 unsigned internalformat) override; |
| 101 virtual void DestroyImage(int32 id) override; | 101 void DestroyImage(int32 id) override; |
| 102 virtual int32 CreateGpuMemoryBufferImage(size_t width, | 102 int32 CreateGpuMemoryBufferImage(size_t width, |
| 103 size_t height, | 103 size_t height, |
| 104 unsigned internalformat, | 104 unsigned internalformat, |
| 105 unsigned usage) override; | 105 unsigned usage) override; |
| 106 virtual uint32 InsertSyncPoint() override; | 106 uint32 InsertSyncPoint() override; |
| 107 virtual uint32 InsertFutureSyncPoint() override; | 107 uint32 InsertFutureSyncPoint() override; |
| 108 virtual void RetireSyncPoint(uint32 sync_point) override; | 108 void RetireSyncPoint(uint32 sync_point) override; |
| 109 virtual void SignalSyncPoint(uint32 sync_point, | 109 void SignalSyncPoint(uint32 sync_point, |
| 110 const base::Closure& callback) override; | 110 const base::Closure& callback) override; |
| 111 virtual void SignalQuery(uint32 query_id, | 111 void SignalQuery(uint32 query_id, const base::Closure& callback) override; |
| 112 const base::Closure& callback) override; | 112 void SetSurfaceVisible(bool visible) override; |
| 113 virtual void SetSurfaceVisible(bool visible) override; | 113 uint32 CreateStreamTexture(uint32 texture_id) override; |
| 114 virtual uint32 CreateStreamTexture(uint32 texture_id) override; | |
| 115 | 114 |
| 116 // The serializer interface to the GPU service (i.e. thread). | 115 // The serializer interface to the GPU service (i.e. thread). |
| 117 class Service { | 116 class Service { |
| 118 public: | 117 public: |
| 119 Service(); | 118 Service(); |
| 120 virtual ~Service(); | 119 virtual ~Service(); |
| 121 | 120 |
| 122 virtual void AddRef() const = 0; | 121 virtual void AddRef() const = 0; |
| 123 virtual void Release() const = 0; | 122 virtual void Release() const = 0; |
| 124 | 123 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 228 |
| 230 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; | 229 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; |
| 231 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; | 230 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; |
| 232 | 231 |
| 233 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); | 232 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); |
| 234 }; | 233 }; |
| 235 | 234 |
| 236 } // namespace gpu | 235 } // namespace gpu |
| 237 | 236 |
| 238 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ | 237 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ |
| OLD | NEW |