Chromium Code Reviews| 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 CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "ui/gl/gl_surface.h" | 23 #include "ui/gl/gl_surface.h" |
| 24 #include "ui/surface/transport_dib.h" | 24 #include "ui/surface/transport_dib.h" |
| 25 | 25 |
| 26 class GpuChannelManager; | 26 class GpuChannelManager; |
| 27 class GpuCommandBufferStub; | 27 class GpuCommandBufferStub; |
| 28 | 28 |
| 29 struct GpuHostMsg_AcceleratedSurfaceNew_Params; | 29 struct GpuHostMsg_AcceleratedSurfaceNew_Params; |
| 30 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 30 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 31 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; | 31 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; |
| 32 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; | 32 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; |
| 33 struct GpuHostMsg_AcceleratedSurfaceRequestReleaseFront_Params; | |
| 33 | 34 |
| 34 namespace gfx { | 35 namespace gfx { |
| 35 class GLSurface; | 36 class GLSurface; |
| 36 } | 37 } |
| 37 | 38 |
| 38 namespace gpu { | 39 namespace gpu { |
| 39 class GpuScheduler; | 40 class GpuScheduler; |
| 40 | 41 |
| 41 namespace gles2 { | 42 namespace gles2 { |
| 42 class GLES2Decoder; | 43 class GLES2Decoder; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 60 public: | 61 public: |
| 61 ImageTransportSurface(); | 62 ImageTransportSurface(); |
| 62 virtual ~ImageTransportSurface(); | 63 virtual ~ImageTransportSurface(); |
| 63 | 64 |
| 64 virtual void OnNewSurfaceACK( | 65 virtual void OnNewSurfaceACK( |
| 65 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; | 66 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; |
| 66 virtual void OnBuffersSwappedACK() = 0; | 67 virtual void OnBuffersSwappedACK() = 0; |
| 67 virtual void OnPostSubBufferACK() = 0; | 68 virtual void OnPostSubBufferACK() = 0; |
| 68 virtual void OnResizeViewACK() = 0; | 69 virtual void OnResizeViewACK() = 0; |
| 69 virtual void OnResize(gfx::Size size) = 0; | 70 virtual void OnResize(gfx::Size size) = 0; |
| 71 virtual void OnSetFrontSurfaceIsProtected(bool is_protected) = 0; | |
| 72 virtual void OnRequestReleaseFrontACK(int request_id, | |
| 73 int retry_count, | |
| 74 bool was_released) { }; | |
|
mmocny
2012/06/01 21:06:51
Is this default implementation alright here? Its
mmocny
2012/06/05 14:52:35
Done.
| |
| 70 | 75 |
| 71 // Creates the appropriate surface depending on the GL implementation. | 76 // Creates the appropriate surface depending on the GL implementation. |
| 72 static scoped_refptr<gfx::GLSurface> | 77 static scoped_refptr<gfx::GLSurface> |
| 73 CreateSurface(GpuChannelManager* manager, | 78 CreateSurface(GpuChannelManager* manager, |
| 74 GpuCommandBufferStub* stub, | 79 GpuCommandBufferStub* stub, |
| 75 const gfx::GLSurfaceHandle& handle); | 80 const gfx::GLSurfaceHandle& handle); |
| 76 protected: | 81 protected: |
| 77 // Used by certain implements of PostSubBuffer to determine | 82 // Used by certain implements of PostSubBuffer to determine |
| 78 // how much needs to be copied between frames. | 83 // how much needs to be copied between frames. |
| 79 void GetRegionsToCopy(const gfx::Rect& previous_damage_rect, | 84 void GetRegionsToCopy(const gfx::Rect& previous_damage_rect, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 102 // Helper send functions. Caller fills in the surface specific params | 107 // Helper send functions. Caller fills in the surface specific params |
| 103 // like size and surface id. The helper fills in the rest. | 108 // like size and surface id. The helper fills in the rest. |
| 104 void SendAcceleratedSurfaceNew( | 109 void SendAcceleratedSurfaceNew( |
| 105 GpuHostMsg_AcceleratedSurfaceNew_Params params); | 110 GpuHostMsg_AcceleratedSurfaceNew_Params params); |
| 106 void SendAcceleratedSurfaceBuffersSwapped( | 111 void SendAcceleratedSurfaceBuffersSwapped( |
| 107 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); | 112 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); |
| 108 void SendAcceleratedSurfacePostSubBuffer( | 113 void SendAcceleratedSurfacePostSubBuffer( |
| 109 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); | 114 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); |
| 110 void SendAcceleratedSurfaceRelease( | 115 void SendAcceleratedSurfaceRelease( |
| 111 GpuHostMsg_AcceleratedSurfaceRelease_Params params); | 116 GpuHostMsg_AcceleratedSurfaceRelease_Params params); |
| 117 void SendAcceleratedSurfaceRequestReleaseFront( | |
| 118 GpuHostMsg_AcceleratedSurfaceRequestReleaseFront_Params params); | |
| 112 void SendResizeView(const gfx::Size& size); | 119 void SendResizeView(const gfx::Size& size); |
| 113 | 120 |
| 114 // Whether or not we should execute more commands. | 121 // Whether or not we should execute more commands. |
| 115 void SetScheduled(bool is_scheduled); | 122 void SetScheduled(bool is_scheduled); |
| 116 | 123 |
| 117 void DeferToFence(base::Closure task); | 124 void DeferToFence(base::Closure task); |
| 118 | 125 |
| 119 // Make the surface's context current. | 126 // Make the surface's context current. |
| 120 bool MakeCurrent(); | 127 bool MakeCurrent(); |
| 121 | 128 |
| 122 // Set the default swap interval on the surface. | 129 // Set the default swap interval on the surface. |
| 123 static void SetSwapInterval(gfx::GLContext* context); | 130 static void SetSwapInterval(gfx::GLContext* context); |
| 124 | 131 |
| 125 void Suspend(); | 132 void Suspend(); |
| 126 | 133 |
| 127 private: | 134 private: |
| 128 gpu::GpuScheduler* Scheduler(); | 135 gpu::GpuScheduler* Scheduler(); |
| 129 gpu::gles2::GLES2Decoder* Decoder(); | 136 gpu::gles2::GLES2Decoder* Decoder(); |
| 130 | 137 |
| 131 // IPC::Message handlers. | 138 // IPC::Message handlers. |
| 132 void OnNewSurfaceACK(uint64 surface_handle, TransportDIB::Handle shm_handle); | 139 void OnNewSurfaceACK(uint64 surface_handle, TransportDIB::Handle shm_handle); |
| 133 void OnBuffersSwappedACK(); | 140 void OnBuffersSwappedACK(); |
| 134 void OnPostSubBufferACK(); | 141 void OnPostSubBufferACK(); |
| 135 void OnResizeViewACK(); | 142 void OnResizeViewACK(); |
| 143 void OnSetFrontSurfaceIsProtected(bool is_protected); | |
| 144 void OnRequestReleaseFrontACK(int request_id, | |
| 145 int retry_count, | |
| 146 bool was_released); | |
| 136 | 147 |
| 137 // Backbuffer resize callback. | 148 // Backbuffer resize callback. |
| 138 void Resize(gfx::Size size); | 149 void Resize(gfx::Size size); |
| 139 | 150 |
| 140 // Weak pointers that point to objects that outlive this helper. | 151 // Weak pointers that point to objects that outlive this helper. |
| 141 ImageTransportSurface* surface_; | 152 ImageTransportSurface* surface_; |
| 142 GpuChannelManager* manager_; | 153 GpuChannelManager* manager_; |
| 143 | 154 |
| 144 base::WeakPtr<GpuCommandBufferStub> stub_; | 155 base::WeakPtr<GpuCommandBufferStub> stub_; |
| 145 int32 route_id_; | 156 int32 route_id_; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 166 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 177 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
| 167 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 178 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
| 168 | 179 |
| 169 // ImageTransportSurface implementation. | 180 // ImageTransportSurface implementation. |
| 170 virtual void OnNewSurfaceACK( | 181 virtual void OnNewSurfaceACK( |
| 171 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; | 182 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; |
| 172 virtual void OnBuffersSwappedACK() OVERRIDE; | 183 virtual void OnBuffersSwappedACK() OVERRIDE; |
| 173 virtual void OnPostSubBufferACK() OVERRIDE; | 184 virtual void OnPostSubBufferACK() OVERRIDE; |
| 174 virtual void OnResizeViewACK() OVERRIDE; | 185 virtual void OnResizeViewACK() OVERRIDE; |
| 175 virtual void OnResize(gfx::Size size) OVERRIDE; | 186 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 187 virtual void OnSetFrontSurfaceIsProtected(bool is_protected) OVERRIDE; | |
| 188 virtual void OnRequestReleaseFrontACK(int request_id, | |
| 189 int retry_count, | |
| 190 bool was_released) OVERRIDE; | |
| 176 | 191 |
| 177 protected: | 192 protected: |
| 178 virtual ~PassThroughImageTransportSurface(); | 193 virtual ~PassThroughImageTransportSurface(); |
| 179 | 194 |
| 180 private: | 195 private: |
| 181 scoped_ptr<ImageTransportHelper> helper_; | 196 scoped_ptr<ImageTransportHelper> helper_; |
| 182 gfx::Size new_size_; | 197 gfx::Size new_size_; |
| 183 bool transport_; | 198 bool transport_; |
| 184 bool did_set_swap_interval_; | 199 bool did_set_swap_interval_; |
| 185 | 200 |
| 186 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 201 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
| 187 }; | 202 }; |
| 188 | 203 |
| 189 #endif // defined(ENABLE_GPU) | 204 #endif // defined(ENABLE_GPU) |
| 190 | 205 |
| 191 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 206 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |