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

Unified 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, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/common/gpu/texture_image_transport_surface.h
diff --git a/content/common/gpu/texture_image_transport_surface.h b/content/common/gpu/texture_image_transport_surface.h
index 150b5858bee835654f2c30450af813d46b882401..4f433a0dc550d7df6832842335622d2b78287a8c 100644
--- a/content/common/gpu/texture_image_transport_surface.h
+++ b/content/common/gpu/texture_image_transport_surface.h
@@ -5,11 +5,14 @@
#ifndef CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_
#define CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_
+#include <map>
+
#include "base/basictypes.h"
-#include "base/memory/weak_ptr.h"
#include "content/common/gpu/gpu_command_buffer_stub.h"
#include "content/common/gpu/image_transport_surface.h"
+#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/texture_manager.h"
+#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface.h"
namespace content {
@@ -18,8 +21,7 @@ class GpuChannelManager;
class TextureImageTransportSurface :
public ImageTransportSurface,
public GpuCommandBufferStub::DestructionObserver,
- public gfx::GLSurface,
- public base::SupportsWeakPtr<TextureImageTransportSurface> {
+ public gfx::GLSurface {
public:
TextureImageTransportSurface(GpuChannelManager* manager,
GpuCommandBufferStub* stub,
@@ -48,57 +50,47 @@ class TextureImageTransportSurface :
protected:
// ImageTransportSurface implementation.
virtual void OnBufferPresented(
- bool presented,
+ uint64 surface_handle,
uint32 sync_point) OVERRIDE;
virtual void OnResizeViewACK() OVERRIDE;
- virtual void OnSetFrontSurfaceIsProtected(
- bool is_protected,
- uint32 protection_state_id) OVERRIDE;
virtual void OnResize(gfx::Size size) OVERRIDE;
// GpuCommandBufferStub::DestructionObserver implementation.
virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE;
private:
- // A texture backing the front/back buffer in the parent stub.
+ // A texture backing the front/back buffer.
struct Texture {
Texture();
~Texture();
- // The client-side id in the parent stub.
- uint32 client_id;
-
// The currently allocated size.
gfx::Size size;
- // Whether or not that texture has been sent to the client yet.
- bool sent_to_client;
+ // The actual GL texture id.
+ uint32 service_id;
- // The texture info in the parent stub.
- gpu::gles2::TextureManager::TextureInfo::Ref info;
+ // The surface identifier for this texture.
+ uint64 identifier;
};
virtual ~TextureImageTransportSurface();
- void CreateBackTexture(const gfx::Size& size);
+ void CreateBackTexture();
void AttachBackTextureToFBO();
- void ReleaseTexture(int id);
- void ReleaseParentStub();
+ void ReleaseBackBuffer();
void AdjustFrontBufferAllocation();
- void BufferPresentedImpl(bool presented);
- int front() const { return front_; }
- int back() const { return 1 - front_; }
+ void BufferPresentedImpl(uint64 surface_handle);
+ void ProduceTexture(Texture& texture);
+ void ConsumeTexture(Texture& texture);
// The framebuffer that represents this surface (service id). Allocated lazily
// in OnMakeCurrent.
uint32 fbo_id_;
- // The front and back buffers.
- Texture textures_[2];
-
- gfx::Rect previous_damage_rect_;
+ // The current backbuffer
piman 2012/11/30 03:54:32 nit: .
+ Texture backbuffer_;
- // Indicates which of the 2 above is the front buffer.
- int front_;
+ gfx::Size current_size_;
// Whether or not the command buffer stub has been destroyed.
bool stub_destroyed_;
@@ -106,16 +98,15 @@ class TextureImageTransportSurface :
bool backbuffer_suggested_allocation_;
bool frontbuffer_suggested_allocation_;
- bool frontbuffer_is_protected_;
- uint32 protection_state_id_;
-
scoped_ptr<ImageTransportHelper> helper_;
gfx::GLSurfaceHandle handle_;
- GpuCommandBufferStub* parent_stub_;
// The offscreen surface used to make the context current. However note that
// the actual rendering is always redirected to an FBO.
- scoped_refptr<GLSurface> surface_;
+ scoped_refptr<gfx::GLSurface> surface_;
+
+ // Holds a reference to the underlying context for cleanup.
+ scoped_refptr<gfx::GLContext> context_;
// Whether a SwapBuffers is pending.
bool is_swap_buffers_pending_;
@@ -123,9 +114,12 @@ class TextureImageTransportSurface :
// Whether we unscheduled command buffer because of pending SwapBuffers.
bool did_unschedule_;
- // Whether or not the buffer flip went through browser side on the last
- // swap or post sub buffer.
- bool did_flip_;
+ // The mailbox names used for texture exchange. Uses the texture
+ // identifier as the key.
+ std::map<uint64, gpu::gles2::MailboxName> mailbox_names_;
piman 2012/11/30 03:54:32 Because the ids are only 1 and 2, maybe just make
+
+ // Holds a reference to the mailbox manager for cleanup.
+ scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface);
};

Powered by Google App Engine
This is Rietveld 408576698