Commit f22540dd authored by kylechar's avatar kylechar Committed by Commit Bot

Add SkiaRenderer support to InProcessContextFactory.

This CL adds support to use SkiaRenderer with InProcessContextFactory.
The existing constructor will use SkiaRenderer based on the feature
list, so it will depend on the command line and default feature state.
Also add a new constructor that lets tests pick between GLRenderer and
SkiaRenderer so parameterized tests can be implemented.

Bug: 956144
Change-Id: I5424237ccd8eecf9d7b20d59bd4627b27ed37749
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715106Reviewed-by: default avatarSean Gilhuly <sgilhuly@chromium.org>
Commit-Queue: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680101}
parent 76a2a31c
......@@ -16,6 +16,7 @@
#include "build/build_config.h"
#include "cc/base/switches.h"
#include "cc/test/pixel_test_output_surface.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/begin_frame_source.h"
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
#include "components/viz/common/gpu/context_provider.h"
......@@ -25,8 +26,11 @@
#include "components/viz/service/display/display_scheduler.h"
#include "components/viz/service/display/output_surface_client.h"
#include "components/viz/service/display/output_surface_frame.h"
#include "components/viz/service/display_embedder/skia_output_surface_dependency_impl.h"
#include "components/viz/service/display_embedder/skia_output_surface_impl.h"
#include "components/viz/service/frame_sinks/direct_layer_tree_frame_sink.h"
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
#include "components/viz/test/test_gpu_service_holder.h"
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/command_buffer/client/gles2_interface.h"
#include "gpu/command_buffer/common/context_creation_attribs.h"
......@@ -156,6 +160,14 @@ struct InProcessContextFactory::PerCompositorData {
InProcessContextFactory::InProcessContextFactory(
viz::HostFrameSinkManager* host_frame_sink_manager,
viz::FrameSinkManagerImpl* frame_sink_manager)
: InProcessContextFactory(host_frame_sink_manager,
frame_sink_manager,
features::IsUsingSkiaRenderer()) {}
InProcessContextFactory::InProcessContextFactory(
viz::HostFrameSinkManager* host_frame_sink_manager,
viz::FrameSinkManagerImpl* frame_sink_manager,
bool use_skia_renderer)
: frame_sink_id_allocator_(kDefaultClientId),
use_test_surface_(true),
disable_vsync_(base::CommandLine::ForCurrentProcess()->HasSwitch(
......@@ -166,6 +178,8 @@ InProcessContextFactory::InProcessContextFactory(
DCHECK_NE(gl::GetGLImplementation(), gl::kGLImplementationNone)
<< "If running tests, ensure that main() is calling "
<< "gl::GLSurfaceTestSupport::InitializeOneOff()";
if (use_skia_renderer)
renderer_settings_.use_skia_renderer = true;
#if defined(OS_MACOSX)
renderer_settings_.release_overlay_resources_after_gpu_query = true;
// Ensure that tests don't wait for frames that will never come.
......@@ -229,7 +243,14 @@ void InProcessContextFactory::CreateLayerTreeFrameSink(
"UICompositor", support_locking);
std::unique_ptr<viz::OutputSurface> display_output_surface;
if (use_test_surface_) {
if (renderer_settings_.use_skia_renderer) {
display_output_surface = viz::SkiaOutputSurfaceImpl::Create(
std::make_unique<viz::SkiaOutputSurfaceDependencyImpl>(
viz::TestGpuServiceHolder::GetInstance()->gpu_service(),
gpu::kNullSurfaceHandle),
renderer_settings_);
} else if (use_test_surface_) {
bool flipped_output_surface = false;
display_output_surface = std::make_unique<cc::PixelTestOutputSurface>(
context_provider, flipped_output_surface);
......
......@@ -32,11 +32,15 @@ class InProcessContextFactory : public ContextFactory,
public ContextFactoryPrivate {
public:
// Both |host_frame_sink_manager| and |frame_sink_manager| must outlive the
// ContextFactory.
// ContextFactory. The constructor without |use_skia_renderer| will use
// SkiaRenderer if the feature is enabled.
// TODO(crbug.com/657959): |frame_sink_manager| should go away and we should
// use the LayerTreeFrameSink from the HostFrameSinkManager.
InProcessContextFactory(viz::HostFrameSinkManager* host_frame_sink_manager,
viz::FrameSinkManagerImpl* frame_sink_manager);
InProcessContextFactory(viz::HostFrameSinkManager* host_frame_sink_manager,
viz::FrameSinkManagerImpl* frame_sink_manager,
bool use_skia_renderer);
~InProcessContextFactory() override;
viz::FrameSinkManagerImpl* GetFrameSinkManager() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment