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_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 5 #ifndef CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
6 #define CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/common/gpu/gpu_command_buffer_stub.h" | 10 #include "content/common/gpu/gpu_command_buffer_stub.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 41 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
42 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; | 42 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
43 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 43 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
44 virtual void* GetShareHandle() OVERRIDE; | 44 virtual void* GetShareHandle() OVERRIDE; |
45 virtual void* GetDisplay() OVERRIDE; | 45 virtual void* GetDisplay() OVERRIDE; |
46 virtual void* GetConfig() OVERRIDE; | 46 virtual void* GetConfig() OVERRIDE; |
47 | 47 |
48 protected: | 48 protected: |
49 // ImageTransportSurface implementation. | 49 // ImageTransportSurface implementation. |
50 virtual void OnBufferPresented( | 50 virtual void OnBufferPresented( |
| 51 bool presented, |
51 uint32 sync_point) OVERRIDE; | 52 uint32 sync_point) OVERRIDE; |
52 virtual void OnResizeViewACK() OVERRIDE; | 53 virtual void OnResizeViewACK() OVERRIDE; |
53 virtual void OnSetFrontSurfaceIsProtected( | 54 virtual void OnSetFrontSurfaceIsProtected( |
54 bool is_protected, | 55 bool is_protected, |
55 uint32 protection_state_id) OVERRIDE; | 56 uint32 protection_state_id) OVERRIDE; |
56 virtual void OnResize(gfx::Size size) OVERRIDE; | 57 virtual void OnResize(gfx::Size size) OVERRIDE; |
57 | 58 |
58 // GpuCommandBufferStub::DestructionObserver implementation. | 59 // GpuCommandBufferStub::DestructionObserver implementation. |
59 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE; | 60 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE; |
60 | 61 |
(...skipping 15 matching lines...) Expand all Loading... |
76 // The texture info in the parent stub. | 77 // The texture info in the parent stub. |
77 gpu::gles2::TextureManager::TextureInfo::Ref info; | 78 gpu::gles2::TextureManager::TextureInfo::Ref info; |
78 }; | 79 }; |
79 | 80 |
80 virtual ~TextureImageTransportSurface(); | 81 virtual ~TextureImageTransportSurface(); |
81 void CreateBackTexture(const gfx::Size& size); | 82 void CreateBackTexture(const gfx::Size& size); |
82 void AttachBackTextureToFBO(); | 83 void AttachBackTextureToFBO(); |
83 void ReleaseTexture(int id); | 84 void ReleaseTexture(int id); |
84 void ReleaseParentStub(); | 85 void ReleaseParentStub(); |
85 void AdjustFrontBufferAllocation(); | 86 void AdjustFrontBufferAllocation(); |
86 void BufferPresentedImpl(); | 87 void BufferPresentedImpl(bool presented); |
87 int front() const { return front_; } | 88 int front() const { return front_; } |
88 int back() const { return 1 - front_; } | 89 int back() const { return 1 - front_; } |
89 | 90 |
90 // The framebuffer that represents this surface (service id). Allocated lazily | 91 // The framebuffer that represents this surface (service id). Allocated lazily |
91 // in OnMakeCurrent. | 92 // in OnMakeCurrent. |
92 uint32 fbo_id_; | 93 uint32 fbo_id_; |
93 | 94 |
94 // The front and back buffers. | 95 // The front and back buffers. |
95 Texture textures_[2]; | 96 Texture textures_[2]; |
96 | 97 |
(...skipping 18 matching lines...) Expand all Loading... |
115 // The offscreen surface used to make the context current. However note that | 116 // The offscreen surface used to make the context current. However note that |
116 // the actual rendering is always redirected to an FBO. | 117 // the actual rendering is always redirected to an FBO. |
117 scoped_refptr<GLSurface> surface_; | 118 scoped_refptr<GLSurface> surface_; |
118 | 119 |
119 // Whether a SwapBuffers is pending. | 120 // Whether a SwapBuffers is pending. |
120 bool is_swap_buffers_pending_; | 121 bool is_swap_buffers_pending_; |
121 | 122 |
122 // Whether we unscheduled command buffer because of pending SwapBuffers. | 123 // Whether we unscheduled command buffer because of pending SwapBuffers. |
123 bool did_unschedule_; | 124 bool did_unschedule_; |
124 | 125 |
| 126 // Whether or not the buffer flip went through browser side on the last |
| 127 // swap or post sub buffer. |
| 128 bool did_flip_; |
| 129 |
125 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); | 130 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); |
126 }; | 131 }; |
127 | 132 |
128 } // namespace content | 133 } // namespace content |
129 | 134 |
130 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 135 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |