| Index: cc/output/compositor_frame_sink.h
|
| diff --git a/cc/output/compositor_frame_sink.h b/cc/output/compositor_frame_sink.h
|
| index 32b22f98c1bb1289b3d95b154981a0046678c9f3..a69412924af0290e23f2884e4d201f6c5c3668aa 100644
|
| --- a/cc/output/compositor_frame_sink.h
|
| +++ b/cc/output/compositor_frame_sink.h
|
| @@ -16,7 +16,6 @@
|
| #include "cc/base/cc_export.h"
|
| #include "cc/output/context_provider.h"
|
| #include "cc/output/overlay_candidate_validator.h"
|
| -#include "cc/output/software_output_device.h"
|
| #include "cc/output/vulkan_context_provider.h"
|
| #include "cc/resources/returned_resource.h"
|
| #include "gpu/command_buffer/common/texture_in_use_response.h"
|
| @@ -49,99 +48,31 @@ class CompositorFrameSinkClient;
|
| class CC_EXPORT CompositorFrameSink
|
| : public base::trace_event::MemoryDumpProvider {
|
| public:
|
| - // Constructor for GL-based and/or software compositing.
|
| - explicit CompositorFrameSink(
|
| - scoped_refptr<ContextProvider> context_provider,
|
| - scoped_refptr<ContextProvider> worker_context_provider,
|
| - std::unique_ptr<SoftwareOutputDevice> software_device);
|
| -
|
| - // Constructor for Vulkan-based compositing.
|
| - explicit CompositorFrameSink(
|
| - scoped_refptr<VulkanContextProvider> vulkan_context_provider);
|
| + struct Capabilities {
|
| + Capabilities() = default;
|
|
|
| - ~CompositorFrameSink() override;
|
| + // TODO(enne): Remove this since everything uses begin frames now, but it
|
| + // causes some racey unit tests to fail.
|
| + bool adjust_deadline_for_parent = true;
|
|
|
| - struct Capabilities {
|
| - Capabilities()
|
| - : delegated_rendering(false),
|
| - max_frames_pending(1),
|
| - adjust_deadline_for_parent(true),
|
| - uses_default_gl_framebuffer(true),
|
| - flipped_compositor_frame_sink(false),
|
| - can_force_reclaim_resources(false),
|
| - delegated_sync_points_required(true) {}
|
| - bool delegated_rendering;
|
| - int max_frames_pending;
|
| - // This doesn't handle the <webview> case, but once BeginFrame is
|
| - // supported natively, we shouldn't need adjust_deadline_for_parent.
|
| - bool adjust_deadline_for_parent;
|
| - // Whether this output surface renders to the default OpenGL zero
|
| - // framebuffer or to an offscreen framebuffer.
|
| - bool uses_default_gl_framebuffer;
|
| - // Whether this CompositorFrameSink is flipped or not.
|
| - bool flipped_compositor_frame_sink;
|
| // Whether ForceReclaimResources can be called to reclaim all resources
|
| // from the CompositorFrameSink.
|
| - bool can_force_reclaim_resources;
|
| + bool can_force_reclaim_resources = false;
|
| // True if sync points for resources are needed when swapping delegated
|
| // frames.
|
| - bool delegated_sync_points_required;
|
| + bool delegated_sync_points_required = true;
|
| };
|
|
|
| - // ============== DISPLAY COMPOSITOR ONLY =======================
|
| -
|
| - virtual void EnsureBackbuffer();
|
| - virtual void DiscardBackbuffer();
|
| -
|
| - const gfx::ColorSpace& device_color_space() const {
|
| - return device_color_space_;
|
| - }
|
| -
|
| - // Called by subclasses after receiving a response from the gpu process to a
|
| - // query about whether a given set of textures is still in use by the OS
|
| - // compositor.
|
| - void DidReceiveTextureInUseResponses(
|
| - const gpu::TextureInUseResponses& responses);
|
| -
|
| - // Get the class capable of informing cc of hardware overlay capability.
|
| - virtual OverlayCandidateValidator* GetOverlayCandidateValidator() const;
|
| -
|
| - // Returns true if a main image overlay plane should be scheduled.
|
| - virtual bool IsDisplayedAsOverlayPlane() const;
|
| -
|
| - // Get the texture for the main image's overlay.
|
| - virtual unsigned GetOverlayTextureId() const;
|
| -
|
| - // If this returns true, then the surface will not attempt to draw.
|
| - virtual bool SurfaceIsSuspendForRecycle() const;
|
| -
|
| - virtual void Reshape(const gfx::Size& size,
|
| - float scale_factor,
|
| - const gfx::ColorSpace& color_space,
|
| - bool alpha);
|
| - gfx::Size SurfaceSize() const { return surface_size_; }
|
| -
|
| - virtual bool HasExternalStencilTest() const;
|
| - virtual void ApplyExternalStencil();
|
| -
|
| - // ============== LAYER TREE COMPOSITOR ONLY ===================
|
| -
|
| - // If supported, this causes a ReclaimResources for all resources that are
|
| - // currently in use.
|
| - virtual void ForceReclaimResources() {}
|
| -
|
| - virtual void BindFramebuffer();
|
| - // Gives the GL internal format that should be used for calling CopyTexImage2D
|
| - // when the framebuffer is bound via BindFramebuffer().
|
| - virtual uint32_t GetFramebufferCopyTextureFormat() = 0;
|
| + // Constructor for GL-based and/or software compositing.
|
| + explicit CompositorFrameSink(
|
| + scoped_refptr<ContextProvider> context_provider,
|
| + scoped_refptr<ContextProvider> worker_context_provider);
|
|
|
| - // Support for a pull-model where draws are requested by the output surface.
|
| - //
|
| - // CompositorFrameSink::Invalidate is called by the compositor to notify that
|
| - // there's new content.
|
| - virtual void Invalidate() {}
|
| + // Constructor for Vulkan-based compositing.
|
| + explicit CompositorFrameSink(
|
| + scoped_refptr<VulkanContextProvider> vulkan_context_provider);
|
|
|
| - // ============== BOTH TYPES OF COMPOSITOR ======================
|
| + ~CompositorFrameSink() override;
|
|
|
| // Called by the compositor on the compositor thread. This is a place where
|
| // thread-specific data for the output surface can be initialized, since from
|
| @@ -171,14 +102,19 @@ class CC_EXPORT CompositorFrameSink
|
| VulkanContextProvider* vulkan_context_provider() const {
|
| return vulkan_context_provider_.get();
|
| }
|
| - SoftwareOutputDevice* software_device() const {
|
| - return software_device_.get();
|
| - }
|
|
|
| - // The implementation may destroy or steal the contents of the CompositorFrame
|
| - // passed in (though it will not take ownership of the CompositorFrame
|
| - // itself). For successful swaps, the implementation must call
|
| - // DidSwapBuffersComplete() (via OnSwapBuffersComplete()) eventually.
|
| + // If supported, this causes a ReclaimResources for all resources that are
|
| + // currently in use.
|
| + virtual void ForceReclaimResources() {}
|
| +
|
| + // Support for a pull-model where draws are requested by the output surface.
|
| + //
|
| + // CompositorFrameSink::Invalidate is called by the compositor to notify that
|
| + // there's new content.
|
| + virtual void Invalidate() {}
|
| +
|
| + // For successful swaps, the implementation must call DidSwapBuffersComplete()
|
| + // (via OnSwapBuffersComplete()) eventually.
|
| virtual void SwapBuffers(CompositorFrame frame) = 0;
|
| virtual void OnSwapBuffersComplete();
|
|
|
| @@ -190,12 +126,9 @@ class CC_EXPORT CompositorFrameSink
|
| // This is used by both display and delegating implementations.
|
| void PostSwapBuffersComplete();
|
|
|
| - // This is how LayerTreeHostImpl hears about context loss when the Display
|
| - // is the one listening for context loss. Also used internally for the
|
| - // context provider to inform the LayerTreeHostImpl or Display about loss.
|
| - // It would become display-compositor-only when LayerTreeHostImpl receives
|
| - // its contexts independently from the "CompositorFrameSink".
|
| - virtual void DidLoseCompositorFrameSink();
|
| + // Bound to the ContextProvider to hear about when it is lost and inform the
|
| + // |client_|.
|
| + void DidLoseCompositorFrameSink();
|
|
|
| CompositorFrameSinkClient* client_ = nullptr;
|
|
|
| @@ -203,12 +136,6 @@ class CC_EXPORT CompositorFrameSink
|
| scoped_refptr<ContextProvider> context_provider_;
|
| scoped_refptr<ContextProvider> worker_context_provider_;
|
| scoped_refptr<VulkanContextProvider> vulkan_context_provider_;
|
| - std::unique_ptr<SoftwareOutputDevice> software_device_;
|
| - gfx::Size surface_size_;
|
| - float device_scale_factor_ = -1;
|
| - gfx::ColorSpace device_color_space_;
|
| - bool has_alpha_ = true;
|
| - gfx::ColorSpace color_space_;
|
| base::ThreadChecker client_thread_checker_;
|
|
|
| private:
|
|
|