OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ | 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ |
6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ | 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ |
7 | 7 |
8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/common/gpu/gpu_command_buffer_stub.h" | 10 #include "content/common/gpu/gpu_command_buffer_stub.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Allocate the storage for the color buffer. The specified context is | 34 // Allocate the storage for the color buffer. The specified context is |
35 // current, and there is a texture bound to GL_TEXTURE_RECTANGLE_ARB. | 35 // current, and there is a texture bound to GL_TEXTURE_RECTANGLE_ARB. |
36 virtual bool AllocateColorBufferStorage( | 36 virtual bool AllocateColorBufferStorage( |
37 CGLContextObj context, GLuint texture, | 37 CGLContextObj context, GLuint texture, |
38 gfx::Size size, float scale_factor) = 0; | 38 gfx::Size size, float scale_factor) = 0; |
39 | 39 |
40 // Free the storage allocated in the AllocateColorBufferStorage call. The | 40 // Free the storage allocated in the AllocateColorBufferStorage call. The |
41 // GL texture that was bound has already been deleted by the caller. | 41 // GL texture that was bound has already been deleted by the caller. |
42 virtual void FreeColorBufferStorage() = 0; | 42 virtual void FreeColorBufferStorage() = 0; |
43 | 43 |
44 // Retrieve the handle for the surface to send to the browser process to | 44 // Swap buffers and return the handle for the surface to send to the browser |
45 // display. | 45 // process to display. |
46 virtual uint64 GetSurfaceHandle() const = 0; | 46 virtual void SwapBuffers(const gfx::Size& size, float scale_factor) = 0; |
47 | 47 |
48 // Called when a new frame has been rendered into the texture, and the | 48 // Indicate that the backbuffer will be written to. |
49 // browser is about to be sent the surface to display. | 49 virtual void WillWriteToBackbuffer() = 0; |
50 virtual void WillSwapBuffers() = 0; | |
51 | 50 |
52 // Called once for every WillSwapBuffers call when the buffer that was sent | 51 // Indicate that the backbuffer has been discarded and should not be seen |
53 // to the browser may be released by the GPU process (this may be because | 52 // again. |
54 // the browser is holding a reference, in which case this will come | 53 virtual void DiscardBackbuffer() = 0; |
55 // quickly, or it may be because the browser is done with the surface, in | 54 |
56 // which case it will come much later). | 55 // Called once for every SwapBuffers call when the IPC for the present has |
57 virtual void CanFreeSwappedBuffer() = 0; | 56 // been processed by the browser. |
| 57 virtual void SwapBuffersAckedByBrowser() = 0; |
58 }; | 58 }; |
59 | 59 |
60 ImageTransportSurfaceFBO(GpuChannelManager* manager, | 60 ImageTransportSurfaceFBO(GpuChannelManager* manager, |
61 GpuCommandBufferStub* stub, | 61 GpuCommandBufferStub* stub, |
62 gfx::PluginWindowHandle handle); | 62 gfx::PluginWindowHandle handle); |
63 | 63 |
64 // GLSurface implementation | 64 // GLSurface implementation |
65 virtual bool Initialize() OVERRIDE; | 65 virtual bool Initialize() OVERRIDE; |
66 virtual void Destroy() OVERRIDE; | 66 virtual void Destroy() OVERRIDE; |
67 virtual bool DeferDraws() OVERRIDE; | 67 virtual bool DeferDraws() OVERRIDE; |
68 virtual bool IsOffscreen() OVERRIDE; | 68 virtual bool IsOffscreen() OVERRIDE; |
69 virtual bool SwapBuffers() OVERRIDE; | 69 virtual bool SwapBuffers() OVERRIDE; |
70 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 70 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
71 virtual bool SupportsPostSubBuffer() OVERRIDE; | 71 virtual bool SupportsPostSubBuffer() OVERRIDE; |
72 virtual gfx::Size GetSize() OVERRIDE; | 72 virtual gfx::Size GetSize() OVERRIDE; |
73 virtual void* GetHandle() OVERRIDE; | 73 virtual void* GetHandle() OVERRIDE; |
74 virtual void* GetDisplay() OVERRIDE; | 74 virtual void* GetDisplay() OVERRIDE; |
75 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 75 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
76 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 76 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
77 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; | 77 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; |
78 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 78 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
79 | 79 |
80 // Called when the context may continue to make forward progress after a swap. | 80 // Called when the context may continue to make forward progress after a swap. |
81 void UnblockContextAfterPendingSwap(); | 81 void SendSwapBuffers(uint64 surface_handle, |
| 82 const gfx::Size pixel_size, |
| 83 float scale_factor); |
82 | 84 |
83 protected: | 85 protected: |
84 // ImageTransportSurface implementation | 86 // ImageTransportSurface implementation |
85 virtual void OnBufferPresented( | 87 virtual void OnBufferPresented( |
86 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 88 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
87 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; | 89 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; |
88 virtual void SetLatencyInfo( | 90 virtual void SetLatencyInfo( |
89 const std::vector<ui::LatencyInfo>&) OVERRIDE; | 91 const std::vector<ui::LatencyInfo>&) OVERRIDE; |
90 virtual void WakeUpGpu() OVERRIDE; | 92 virtual void WakeUpGpu() OVERRIDE; |
91 | 93 |
(...skipping 21 matching lines...) Expand all Loading... |
113 // Weak pointer to the context that this was last made current to. | 115 // Weak pointer to the context that this was last made current to. |
114 gfx::GLContext* context_; | 116 gfx::GLContext* context_; |
115 | 117 |
116 gfx::Size size_; | 118 gfx::Size size_; |
117 gfx::Size rounded_size_; | 119 gfx::Size rounded_size_; |
118 float scale_factor_; | 120 float scale_factor_; |
119 | 121 |
120 // Whether or not we've successfully made the surface current once. | 122 // Whether or not we've successfully made the surface current once. |
121 bool made_current_; | 123 bool made_current_; |
122 | 124 |
123 // Whether a SwapBuffers is pending. | 125 // Whether a SwapBuffers IPC needs to be sent to the browser. |
124 bool is_swap_buffers_pending_; | 126 bool is_swap_buffers_send_pending_; |
125 | |
126 // Whether we unscheduled command buffer because of pending SwapBuffers. | |
127 bool did_unschedule_; | |
128 | |
129 std::vector<ui::LatencyInfo> latency_info_; | 127 std::vector<ui::LatencyInfo> latency_info_; |
130 | 128 |
131 scoped_ptr<ImageTransportHelper> helper_; | 129 scoped_ptr<ImageTransportHelper> helper_; |
132 | 130 |
133 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurfaceFBO); | 131 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurfaceFBO); |
134 }; | 132 }; |
135 | 133 |
136 } // namespace content | 134 } // namespace content |
137 | 135 |
138 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_ | 136 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_ |
OLD | NEW |