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

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

Issue 10052018: Drop frontbuffers with ui-use-gpu-process, synchronized with browser, decoupled from backbuffer dro… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor changes, rebasing with master Created 8 years, 6 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 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.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/texture_manager.h" 12 #include "gpu/command_buffer/service/texture_manager.h"
13 #include "ui/gl/gl_surface.h" 13 #include "ui/gl/gl_surface.h"
14 14
15 class GpuChannelManager; 15 class GpuChannelManager;
16 16
17 class TextureImageTransportSurface : 17 class TextureImageTransportSurface :
18 public ImageTransportSurface, 18 public ImageTransportSurface,
19 public GpuCommandBufferStub::DestructionObserver, 19 public GpuCommandBufferStub::DestructionObserver,
20 public gfx::GLSurface { 20 public gfx::GLSurface {
21 public: 21 public:
22 enum { kMaxRequestReleaseFrontRetries = 10 };
23
24 public:
22 TextureImageTransportSurface(GpuChannelManager* manager, 25 TextureImageTransportSurface(GpuChannelManager* manager,
23 GpuCommandBufferStub* stub, 26 GpuCommandBufferStub* stub,
24 const gfx::GLSurfaceHandle& handle); 27 const gfx::GLSurfaceHandle& handle);
25 28
26 // gfx::GLSurface implementation. 29 // gfx::GLSurface implementation.
27 virtual bool Initialize() OVERRIDE; 30 virtual bool Initialize() OVERRIDE;
28 virtual void Destroy() OVERRIDE; 31 virtual void Destroy() OVERRIDE;
29 virtual bool Resize(const gfx::Size& size) OVERRIDE; 32 virtual bool Resize(const gfx::Size& size) OVERRIDE;
30 virtual bool IsOffscreen() OVERRIDE; 33 virtual bool IsOffscreen() OVERRIDE;
31 virtual bool SwapBuffers() OVERRIDE; 34 virtual bool SwapBuffers() OVERRIDE;
32 virtual gfx::Size GetSize() OVERRIDE; 35 virtual gfx::Size GetSize() OVERRIDE;
33 virtual void* GetHandle() OVERRIDE; 36 virtual void* GetHandle() OVERRIDE;
34 virtual std::string GetExtensions() OVERRIDE; 37 virtual std::string GetExtensions() OVERRIDE;
35 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; 38 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
36 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; 39 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
37 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 40 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
38 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; 41 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE;
39 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; 42 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE;
40 virtual void* GetShareHandle() OVERRIDE; 43 virtual void* GetShareHandle() OVERRIDE;
41 virtual void* GetDisplay() OVERRIDE; 44 virtual void* GetDisplay() OVERRIDE;
42 virtual void* GetConfig() OVERRIDE; 45 virtual void* GetConfig() OVERRIDE;
43 46
44 protected: 47 protected:
45 // ImageTransportSurface implementation. 48 // ImageTransportSurface implementation.
46 virtual void OnNewSurfaceACK( 49 virtual void OnNewSurfaceACK(
47 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; 50 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE;
48 virtual void OnBuffersSwappedACK() OVERRIDE; 51 virtual void OnBuffersSwappedACK() OVERRIDE;
49 virtual void OnPostSubBufferACK() OVERRIDE; 52 virtual void OnPostSubBufferACK() OVERRIDE;
50 virtual void OnResizeViewACK() OVERRIDE; 53 virtual void OnResizeViewACK() OVERRIDE;
54 virtual void OnSetFrontSurfaceIsProtected(bool is_protected) OVERRIDE;
55 virtual void OnRequestReleaseFrontACK(int request_id,
56 int retry_count,
57 bool was_released) OVERRIDE;
51 virtual void OnResize(gfx::Size size) OVERRIDE; 58 virtual void OnResize(gfx::Size size) OVERRIDE;
52 59
53 // GpuCommandBufferStub::DestructionObserver implementation. 60 // GpuCommandBufferStub::DestructionObserver implementation.
54 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE; 61 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) OVERRIDE;
55 62
56 private: 63 private:
57 // A texture backing the front/back buffer in the parent stub. 64 // A texture backing the front/back buffer in the parent stub.
58 struct Texture { 65 struct Texture {
59 Texture(); 66 Texture();
60 ~Texture(); 67 ~Texture();
61 68
62 // The client-side id in the parent stub. 69 // The client-side id in the parent stub.
63 uint32 client_id; 70 uint32 client_id;
64 71
65 // The currently allocated size. 72 // The currently allocated size.
66 gfx::Size size; 73 gfx::Size size;
67 74
68 // Whether or not that texture has been sent to the client yet. 75 // Whether or not that texture has been sent to the client yet.
69 bool sent_to_client; 76 bool sent_to_client;
70 77
71 // The texture info in the parent stub. 78 // The texture info in the parent stub.
72 gpu::gles2::TextureManager::TextureInfo::Ref info; 79 gpu::gles2::TextureManager::TextureInfo::Ref info;
73 }; 80 };
74 81
75 virtual ~TextureImageTransportSurface(); 82 virtual ~TextureImageTransportSurface();
76 void CreateBackTexture(const gfx::Size& size); 83 void CreateBackTexture(const gfx::Size& size);
77 void ReleaseBackTexture();
78 void AttachBackTextureToFBO(); 84 void AttachBackTextureToFBO();
85 void RequestReleaseFrontTexture(int retry_count);
86 void ReleaseTexture(int id);
79 void ReleaseParentStub(); 87 void ReleaseParentStub();
88 void AdjustFrontBufferAllocation(int retry_count);
89 int front() const { return front_; }
80 int back() const { return 1 - front_; } 90 int back() const { return 1 - front_; }
81 91
82 // The framebuffer that represents this surface (service id). Allocated lazily 92 // The framebuffer that represents this surface (service id). Allocated lazily
83 // in OnMakeCurrent. 93 // in OnMakeCurrent.
84 uint32 fbo_id_; 94 uint32 fbo_id_;
85 95
86 // The front and back buffers. 96 // The front and back buffers.
87 Texture textures_[2]; 97 Texture textures_[2];
88 98
89 gfx::Rect previous_damage_rect_; 99 gfx::Rect previous_damage_rect_;
90 100
91 // Indicates which of the 2 above is the front buffer. 101 // Indicates which of the 2 above is the front buffer.
92 int front_; 102 int front_;
93 103
94 // Whether or not the command buffer stub has been destroyed. 104 // Whether or not the command buffer stub has been destroyed.
95 bool stub_destroyed_; 105 bool stub_destroyed_;
96 106
97 bool backbuffer_suggested_allocation_; 107 bool backbuffer_suggested_allocation_;
98 bool frontbuffer_suggested_allocation_; 108 bool frontbuffer_suggested_allocation_;
99 109
110 bool frontbuffer_is_protected_;
111 bool ui_may_not_have_frontbuffer_handle_;
112 int current_valid_release_front_request_id_;
113 int next_unique_release_front_request_id_;
114
100 scoped_ptr<ImageTransportHelper> helper_; 115 scoped_ptr<ImageTransportHelper> helper_;
101 GpuCommandBufferStub* parent_stub_; 116 GpuCommandBufferStub* parent_stub_;
102 117
103 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); 118 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface);
104 }; 119 };
105 120
106 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ 121 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698