| 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/gfx/size.h" | 23 #include "ui/gfx/size.h" |
| 24 #include "ui/gfx/surface/transport_dib.h" | 24 #include "ui/gfx/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_AcceleratedSurfaceSuggestDiscard_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 OnDiscardSurface(uint64 surface_id) = 0; |
| 70 | 72 |
| 71 // Creates the appropriate surface depending on the GL implementation. | 73 // Creates the appropriate surface depending on the GL implementation. |
| 72 static scoped_refptr<gfx::GLSurface> | 74 static scoped_refptr<gfx::GLSurface> |
| 73 CreateSurface(GpuChannelManager* manager, | 75 CreateSurface(GpuChannelManager* manager, |
| 74 GpuCommandBufferStub* stub, | 76 GpuCommandBufferStub* stub, |
| 75 const gfx::GLSurfaceHandle& handle); | 77 const gfx::GLSurfaceHandle& handle); |
| 76 protected: | 78 protected: |
| 77 // Used by certain implements of PostSubBuffer to determine | 79 // Used by certain implements of PostSubBuffer to determine |
| 78 // how much needs to be copied between frames. | 80 // how much needs to be copied between frames. |
| 79 void GetRegionsToCopy(const gfx::Rect& previous_damage_rect, | 81 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 | 104 // Helper send functions. Caller fills in the surface specific params |
| 103 // like size and surface id. The helper fills in the rest. | 105 // like size and surface id. The helper fills in the rest. |
| 104 void SendAcceleratedSurfaceNew( | 106 void SendAcceleratedSurfaceNew( |
| 105 GpuHostMsg_AcceleratedSurfaceNew_Params params); | 107 GpuHostMsg_AcceleratedSurfaceNew_Params params); |
| 106 void SendAcceleratedSurfaceBuffersSwapped( | 108 void SendAcceleratedSurfaceBuffersSwapped( |
| 107 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); | 109 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); |
| 108 void SendAcceleratedSurfacePostSubBuffer( | 110 void SendAcceleratedSurfacePostSubBuffer( |
| 109 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); | 111 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); |
| 110 void SendAcceleratedSurfaceRelease( | 112 void SendAcceleratedSurfaceRelease( |
| 111 GpuHostMsg_AcceleratedSurfaceRelease_Params params); | 113 GpuHostMsg_AcceleratedSurfaceRelease_Params params); |
| 114 void SendAcceleratedSurfaceSuggestDiscard( |
| 115 GpuHostMsg_AcceleratedSurfaceSuggestDiscard_Params params); |
| 112 void SendResizeView(const gfx::Size& size); | 116 void SendResizeView(const gfx::Size& size); |
| 113 | 117 |
| 114 // Whether or not we should execute more commands. | 118 // Whether or not we should execute more commands. |
| 115 void SetScheduled(bool is_scheduled); | 119 void SetScheduled(bool is_scheduled); |
| 116 | 120 |
| 117 void DeferToFence(base::Closure task); | 121 void DeferToFence(base::Closure task); |
| 118 | 122 |
| 119 // Make the surface's context current. | 123 // Make the surface's context current. |
| 120 bool MakeCurrent(); | 124 bool MakeCurrent(); |
| 121 | 125 |
| 122 // Set the default swap interval on the surface. | 126 // Set the default swap interval on the surface. |
| 123 void SetSwapInterval(); | 127 void SetSwapInterval(); |
| 124 | 128 |
| 125 void Suspend(); | 129 void Suspend(); |
| 126 | 130 |
| 127 private: | 131 private: |
| 128 gpu::GpuScheduler* Scheduler(); | 132 gpu::GpuScheduler* Scheduler(); |
| 129 gpu::gles2::GLES2Decoder* Decoder(); | 133 gpu::gles2::GLES2Decoder* Decoder(); |
| 130 | 134 |
| 131 // IPC::Message handlers. | 135 // IPC::Message handlers. |
| 132 void OnNewSurfaceACK(uint64 surface_handle, TransportDIB::Handle shm_handle); | 136 void OnNewSurfaceACK(uint64 surface_handle, TransportDIB::Handle shm_handle); |
| 133 void OnBuffersSwappedACK(); | 137 void OnBuffersSwappedACK(); |
| 134 void OnPostSubBufferACK(); | 138 void OnPostSubBufferACK(); |
| 135 void OnResizeViewACK(); | 139 void OnResizeViewACK(); |
| 140 void OnDiscardSurface(uint64 surface_id); |
| 136 | 141 |
| 137 // Backbuffer resize callback. | 142 // Backbuffer resize callback. |
| 138 void Resize(gfx::Size size); | 143 void Resize(gfx::Size size); |
| 139 | 144 |
| 140 // Weak pointers that point to objects that outlive this helper. | 145 // Weak pointers that point to objects that outlive this helper. |
| 141 ImageTransportSurface* surface_; | 146 ImageTransportSurface* surface_; |
| 142 GpuChannelManager* manager_; | 147 GpuChannelManager* manager_; |
| 143 | 148 |
| 144 base::WeakPtr<GpuCommandBufferStub> stub_; | 149 base::WeakPtr<GpuCommandBufferStub> stub_; |
| 145 int32 route_id_; | 150 int32 route_id_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 166 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 171 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
| 167 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 172 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
| 168 | 173 |
| 169 // ImageTransportSurface implementation. | 174 // ImageTransportSurface implementation. |
| 170 virtual void OnNewSurfaceACK( | 175 virtual void OnNewSurfaceACK( |
| 171 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; | 176 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; |
| 172 virtual void OnBuffersSwappedACK() OVERRIDE; | 177 virtual void OnBuffersSwappedACK() OVERRIDE; |
| 173 virtual void OnPostSubBufferACK() OVERRIDE; | 178 virtual void OnPostSubBufferACK() OVERRIDE; |
| 174 virtual void OnResizeViewACK() OVERRIDE; | 179 virtual void OnResizeViewACK() OVERRIDE; |
| 175 virtual void OnResize(gfx::Size size) OVERRIDE; | 180 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 181 virtual void OnDiscardSurface(uint64 surface_id) OVERRIDE; |
| 176 | 182 |
| 177 protected: | 183 protected: |
| 178 virtual ~PassThroughImageTransportSurface(); | 184 virtual ~PassThroughImageTransportSurface(); |
| 179 | 185 |
| 180 private: | 186 private: |
| 181 scoped_ptr<ImageTransportHelper> helper_; | 187 scoped_ptr<ImageTransportHelper> helper_; |
| 182 gfx::Size new_size_; | 188 gfx::Size new_size_; |
| 183 bool transport_; | 189 bool transport_; |
| 184 bool did_set_swap_interval_; | 190 bool did_set_swap_interval_; |
| 185 | 191 |
| 186 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 192 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
| 187 }; | 193 }; |
| 188 | 194 |
| 189 #endif // defined(ENABLE_GPU) | 195 #endif // defined(ENABLE_GPU) |
| 190 | 196 |
| 191 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 197 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |