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

Unified Diff: content/browser/compositor/gpu_browser_compositor_output_surface.h

Issue 516663003: Surfaceless OutputSurface implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implement GenRenderbuffers Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/compositor/gpu_browser_compositor_output_surface.h
diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.h b/content/browser/compositor/gpu_browser_compositor_output_surface.h
index dd1ac3f693dc8ba59404652a32aeb0017e570aa6..bd8d605b6cfa0455050c1f7bf0cd7effb531e6d3 100644
--- a/content/browser/compositor/gpu_browser_compositor_output_surface.h
+++ b/content/browser/compositor/gpu_browser_compositor_output_surface.h
@@ -7,6 +7,9 @@
#include "content/browser/compositor/browser_compositor_output_surface.h"
+#include "cc/output/context_provider.h"
+#include "content/common/content_export.h"
+
namespace ui {
class CompositorVSyncManager;
}
@@ -32,13 +35,77 @@ class GpuBrowserCompositorOutputSurface
virtual ~GpuBrowserCompositorOutputSurface();
- private:
+ protected:
// cc::OutputSurface implementation.
virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface);
};
+// Provides a surface that manages its own uffers, backed by
+// CreateImageCHROMIUM. Double/triple buffering is implemented
+// internally. Doublebuffering occurs if PageFlipComplete is called before
+// the next BindFramebuffer call, otherwise it creates extra buffers.
+class CONTENT_EXPORT BufferedOutputSurface {
alexst (slow to review) 2014/09/02 13:15:59 Let's move this into a separate file.
+ public:
+ BufferedOutputSurface(scoped_refptr<cc::ContextProvider> context_provider,
+ unsigned int internalformat);
+ ~BufferedOutputSurface();
+
+ void BindFramebuffer();
+ void SwapBuffers();
+ void PageFlipComplete();
+ void Reshape(const gfx::Size& size, float scale_factor);
+
+ unsigned int tex_id() { return tex_id_; }
+
+ private:
+ friend class BufferedOutputSurfaceTest;
+
+ void FreeAllSurfaces();
+
+ void FreeSurface(unsigned int* surface);
+
+ // Return a surface, available to be drawn into.
+ unsigned int GetNextSurface();
+
+ gfx::Size size_;
+ scoped_refptr<cc::ContextProvider> context_provider_;
+ unsigned int fbo_, depth_rb_, tex_id_;
+ unsigned int internalformat_;
+ unsigned int current_surface_; // This surface is currently bound.
+ unsigned int last_surface_; // This surface has been sent to the hardware.
+ unsigned int available_surface_; // This surface is free for use.
+ unsigned int in_flight_surface_; // This surface is waiting for the callback.
+};
+
+class GpuSurfacelessBrowserCompositorOutputSurface
alexst (slow to review) 2014/09/02 13:16:00 Let's put this in a separate file too.
+ : public GpuBrowserCompositorOutputSurface {
+ public:
+ GpuSurfacelessBrowserCompositorOutputSurface(
+ const scoped_refptr<ContextProviderCommandBuffer>& context,
+ int surface_id,
+ IDMap<BrowserCompositorOutputSurface>* output_surface_map,
+ const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
+ scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator,
+ unsigned internalformat,
+ int z_order);
+ virtual ~GpuSurfacelessBrowserCompositorOutputSurface();
+
+ private:
+ // cc::OutputSurface implementation.
+ virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE;
+ virtual void OnSwapBuffersComplete() OVERRIDE;
+ virtual void BindFramebuffer() OVERRIDE;
+ virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE;
+ virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE;
+
+ int z_order_;
+ bool expects_pageflip_messages_;
+ unsigned int internalformat_;
+ scoped_ptr<BufferedOutputSurface> output_surface_;
+};
+
} // namespace content
#endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_

Powered by Google App Engine
This is Rietveld 408576698