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