Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: content/common/gpu/texture_image_transport_surface.h

Issue 11194042: Implement TextureImageTransportSurface using texture mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "content/common/gpu/image_transport_surface.h" 11 #include "content/common/gpu/image_transport_surface.h"
12 #include "gpu/command_buffer/service/mailbox_manager.h"
12 #include "gpu/command_buffer/service/texture_manager.h" 13 #include "gpu/command_buffer/service/texture_manager.h"
13 #include "ui/gl/gl_surface.h" 14 #include "ui/gl/gl_surface.h"
14 15
15 class GpuChannelManager; 16 class GpuChannelManager;
16 17
17 class TextureImageTransportSurface : 18 class TextureImageTransportSurface :
18 public ImageTransportSurface, 19 public ImageTransportSurface,
19 public GpuCommandBufferStub::DestructionObserver, 20 public GpuCommandBufferStub::DestructionObserver,
20 public gfx::GLSurface, 21 public gfx::GLSurface,
21 public base::SupportsWeakPtr<TextureImageTransportSurface> { 22 public base::SupportsWeakPtr<TextureImageTransportSurface> {
(...skipping 29 matching lines...) Expand all
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
60 private: 61 private:
61 // A texture backing the front/back buffer in the parent stub. 62 // A texture backing the front/back buffer.
62 struct Texture { 63 struct Texture {
63 Texture(); 64 Texture();
64 ~Texture(); 65 ~Texture();
65 66
66 // The client-side id in the parent stub. 67 // The identifier for the client.
67 uint32 client_id; 68 uint32 identifier;
68 69
69 // The currently allocated size. 70 // The currently allocated size.
70 gfx::Size size; 71 gfx::Size size;
71 72
72 // Whether or not that texture has been sent to the client yet. 73 // Whether or not that texture has been sent to the client yet.
73 bool sent_to_client; 74 bool sent_to_client;
74 75
75 // The texture info in the parent stub. 76 // The actual GL texture id.
76 gpu::gles2::TextureManager::TextureInfo::Ref info; 77 uint32 service_id;
78
79 // The mailbox name for this texture.
80 gpu::gles2::MailboxName mailbox_name;
77 }; 81 };
78 82
79 virtual ~TextureImageTransportSurface(); 83 virtual ~TextureImageTransportSurface();
80 void CreateBackTexture(const gfx::Size& size); 84 void CreateBackTexture(const gfx::Size& size);
81 void AttachBackTextureToFBO(); 85 void AttachBackTextureToFBO();
82 void ReleaseTexture(int id); 86 void ReleaseTexture(int id);
83 void ReleaseParentStub();
84 void AdjustFrontBufferAllocation(); 87 void AdjustFrontBufferAllocation();
85 void BufferPresentedImpl(); 88 void BufferPresentedImpl();
86 int front() const { return front_; } 89 int front() const { return front_; }
87 int back() const { return 1 - front_; } 90 int back() const { return 1 - front_; }
91 uint32 GenerateId();
92 void ProduceTexture(Texture& texture);
93 void ConsumeTexture(Texture& texture);
88 94
89 // The framebuffer that represents this surface (service id). Allocated lazily 95 // The framebuffer that represents this surface (service id). Allocated lazily
90 // in OnMakeCurrent. 96 // in OnMakeCurrent.
91 uint32 fbo_id_; 97 uint32 fbo_id_;
92 98
93 // The front and back buffers. 99 // The front and back buffers.
94 Texture textures_[2]; 100 Texture textures_[2];
95 101
96 gfx::Rect previous_damage_rect_; 102 gfx::Rect previous_damage_rect_;
97 103
98 // Indicates which of the 2 above is the front buffer. 104 // Indicates which of the 2 above is the front buffer.
99 int front_; 105 int front_;
100 106
101 // Whether or not the command buffer stub has been destroyed. 107 // Whether or not the command buffer stub has been destroyed.
102 bool stub_destroyed_; 108 bool stub_destroyed_;
103 109
104 bool backbuffer_suggested_allocation_; 110 bool backbuffer_suggested_allocation_;
105 bool frontbuffer_suggested_allocation_; 111 bool frontbuffer_suggested_allocation_;
106 112
107 bool frontbuffer_is_protected_; 113 bool frontbuffer_is_protected_;
108 uint32 protection_state_id_; 114 uint32 protection_state_id_;
109 115
110 scoped_ptr<ImageTransportHelper> helper_; 116 scoped_ptr<ImageTransportHelper> helper_;
111 gfx::GLSurfaceHandle handle_; 117 gfx::GLSurfaceHandle handle_;
112 GpuCommandBufferStub* parent_stub_;
113 118
114 // The offscreen surface used to make the context current. However note that 119 // The offscreen surface used to make the context current. However note that
115 // the actual rendering is always redirected to an FBO. 120 // the actual rendering is always redirected to an FBO.
116 scoped_refptr<GLSurface> surface_; 121 scoped_refptr<GLSurface> surface_;
117 122
118 // Whether a SwapBuffers is pending. 123 // Whether a SwapBuffers is pending.
119 bool is_swap_buffers_pending_; 124 bool is_swap_buffers_pending_;
120 125
121 // Whether we unscheduled command buffer because of pending SwapBuffers. 126 // Whether we unscheduled command buffer because of pending SwapBuffers.
122 bool did_unschedule_; 127 bool did_unschedule_;
123 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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698