| 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 void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 41 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
| 42 virtual void* GetShareHandle() OVERRIDE; | 42 virtual void* GetShareHandle() OVERRIDE; |
| 43 virtual void* GetDisplay() OVERRIDE; | 43 virtual void* GetDisplay() OVERRIDE; |
| 44 virtual void* GetConfig() OVERRIDE; | 44 virtual void* GetConfig() OVERRIDE; |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 // ImageTransportSurface implementation. | 47 // ImageTransportSurface implementation. |
| 48 virtual void OnBufferPresented( | 48 virtual void OnBufferPresented( |
| 49 uint32 sync_point) OVERRIDE; | 49 uint32 sync_point) OVERRIDE; |
| 50 virtual void OnResizeViewACK() OVERRIDE; | 50 virtual void OnResizeViewACK() OVERRIDE; |
| 51 virtual void OnSetFrontSurfaceIsProtected( |
| 52 bool is_protected, |
| 53 uint32 protection_state_id) OVERRIDE; |
| 51 virtual void OnResize(gfx::Size size) OVERRIDE; | 54 virtual void OnResize(gfx::Size size) OVERRIDE; |
| 52 | 55 |
| 53 // GpuCommandBufferStub::DestructionObserver implementation. | 56 // GpuCommandBufferStub::DestructionObserver implementation. |
| 54 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE; | 57 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE; |
| 55 | 58 |
| 56 private: | 59 private: |
| 57 // A texture backing the front/back buffer in the parent stub. | 60 // A texture backing the front/back buffer in the parent stub. |
| 58 struct Texture { | 61 struct Texture { |
| 59 Texture(); | 62 Texture(); |
| 60 ~Texture(); | 63 ~Texture(); |
| 61 | 64 |
| 62 // The client-side id in the parent stub. | 65 // The client-side id in the parent stub. |
| 63 uint32 client_id; | 66 uint32 client_id; |
| 64 | 67 |
| 65 // The currently allocated size. | 68 // The currently allocated size. |
| 66 gfx::Size size; | 69 gfx::Size size; |
| 67 | 70 |
| 68 // Whether or not that texture has been sent to the client yet. | 71 // Whether or not that texture has been sent to the client yet. |
| 69 bool sent_to_client; | 72 bool sent_to_client; |
| 70 | 73 |
| 71 // The texture info in the parent stub. | 74 // The texture info in the parent stub. |
| 72 gpu::gles2::TextureManager::TextureInfo::Ref info; | 75 gpu::gles2::TextureManager::TextureInfo::Ref info; |
| 73 }; | 76 }; |
| 74 | 77 |
| 75 virtual ~TextureImageTransportSurface(); | 78 virtual ~TextureImageTransportSurface(); |
| 76 void CreateBackTexture(const gfx::Size& size); | 79 void CreateBackTexture(const gfx::Size& size); |
| 77 void ReleaseBackTexture(); | |
| 78 void AttachBackTextureToFBO(); | 80 void AttachBackTextureToFBO(); |
| 81 void ReleaseTexture(int id); |
| 79 void ReleaseParentStub(); | 82 void ReleaseParentStub(); |
| 83 void AdjustFrontBufferAllocation(); |
| 80 void BufferPresentedImpl(); | 84 void BufferPresentedImpl(); |
| 85 int front() const { return front_; } |
| 81 int back() const { return 1 - front_; } | 86 int back() const { return 1 - front_; } |
| 82 | 87 |
| 83 // The framebuffer that represents this surface (service id). Allocated lazily | 88 // The framebuffer that represents this surface (service id). Allocated lazily |
| 84 // in OnMakeCurrent. | 89 // in OnMakeCurrent. |
| 85 uint32 fbo_id_; | 90 uint32 fbo_id_; |
| 86 | 91 |
| 87 // The front and back buffers. | 92 // The front and back buffers. |
| 88 Texture textures_[2]; | 93 Texture textures_[2]; |
| 89 | 94 |
| 90 gfx::Rect previous_damage_rect_; | 95 gfx::Rect previous_damage_rect_; |
| 91 | 96 |
| 92 // Indicates which of the 2 above is the front buffer. | 97 // Indicates which of the 2 above is the front buffer. |
| 93 int front_; | 98 int front_; |
| 94 | 99 |
| 95 // Whether or not the command buffer stub has been destroyed. | 100 // Whether or not the command buffer stub has been destroyed. |
| 96 bool stub_destroyed_; | 101 bool stub_destroyed_; |
| 97 | 102 |
| 98 bool backbuffer_suggested_allocation_; | 103 bool backbuffer_suggested_allocation_; |
| 99 bool frontbuffer_suggested_allocation_; | 104 bool frontbuffer_suggested_allocation_; |
| 100 | 105 |
| 106 bool frontbuffer_is_protected_; |
| 107 uint32 protection_state_id_; |
| 108 |
| 101 scoped_ptr<ImageTransportHelper> helper_; | 109 scoped_ptr<ImageTransportHelper> helper_; |
| 102 gfx::GLSurfaceHandle handle_; | 110 gfx::GLSurfaceHandle handle_; |
| 103 GpuCommandBufferStub* parent_stub_; | 111 GpuCommandBufferStub* parent_stub_; |
| 104 | 112 |
| 105 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); | 113 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); |
| 106 }; | 114 }; |
| 107 | 115 |
| 108 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 116 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |