Commit 5b878716 authored by kylechar's avatar kylechar Committed by Commit Bot

viz: Rename and move InProcessContextProvider.

Move InProcessContextProvider into viz service directory where it's
used. It didn't belong in components/viz/common. Also rename it
VizProcessContextProvider to better describe the class and to avoid
confusion with the other InProcessContextProvider implementation.

Bug: none
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: I2af04eda873d8b157befe2b277186483f583f266
Reviewed-on: https://chromium-review.googlesource.com/1010605
Commit-Queue: kylechar <kylechar@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550610}
parent aa48bca2
......@@ -62,8 +62,6 @@ viz_component("common") {
"gpu/context_lost_observer.h",
"gpu/context_provider.cc",
"gpu/context_provider.h",
"gpu/in_process_context_provider.cc",
"gpu/in_process_context_provider.h",
"gpu/raster_context_provider.cc",
"gpu/raster_context_provider.h",
"gpu/texture_allocation.cc",
......@@ -165,9 +163,6 @@ viz_component("common") {
"//gpu/command_buffer/client:gles2_interface",
"//gpu/command_buffer/client:raster",
"//gpu/command_buffer/client:raster_interface",
"//gpu/command_buffer/service",
"//gpu/ipc:gl_in_process_context",
"//gpu/skia_bindings:skia_bindings",
"//gpu/vulkan:buildflags",
"//mojo/public/cpp/bindings",
"//skia",
......
......@@ -4,12 +4,8 @@ include_rules = [
"+cc/output",
"+cc/resources",
"+gpu/command_buffer",
"+gpu/config/gpu_feature_info.h",
"+gpu/GLES2/gl2extchromium.h",
"+gpu/ipc",
"+gpu/skia_bindings",
"+gpu/vulkan",
"+third_party/khronos/GLES2/gl2.h",
"+third_party/khronos/GLES2/gl2ext.h",
"+third_party/skia/include/gpu",
]
......@@ -105,6 +105,8 @@ viz_component("service") {
"display_embedder/shared_bitmap_allocation_notifier_impl.h",
"display_embedder/software_output_surface.cc",
"display_embedder/software_output_surface.h",
"display_embedder/viz_process_context_provider.cc",
"display_embedder/viz_process_context_provider.h",
"frame_sinks/compositor_frame_sink_impl.cc",
"frame_sinks/compositor_frame_sink_impl.h",
"frame_sinks/compositor_frame_sink_support.cc",
......@@ -168,12 +170,15 @@ viz_component("service") {
"//cc/paint",
"//components/crash/core/common:crash_key",
"//components/viz/common",
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/command_buffer/client:raster",
"//gpu/ipc:gl_in_process_context",
# Note that dependency on //gpu/ipc/client is for GpuMemoryBufferImpl. This
# dependency should not be in public_deps.
"//gpu/ipc/client",
"//gpu/ipc/service",
"//gpu/skia_bindings:skia_bindings",
"//gpu/vulkan:buildflags",
"//media",
"//media/capture:capture_lib",
......
......@@ -11,17 +11,18 @@ include_rules = [
"+components/viz/service/display/output_surface.h",
"+components/viz/service/display/overlay_candidate_validator.h",
"+components/viz/service/display/software_output_device.h",
"+gpu/config/gpu_feature_info.h",
"+gpu/GLES2",
"+gpu/command_buffer/client",
"+gpu/command_buffer/common",
"+gpu/command_buffer/service",
"+gpu/ipc/client",
"+gpu/ipc/common",
"+gpu/ipc/in_process_command_buffer.h",
"+gpu/ipc/service",
"+gpu/ipc",
"+gpu/skia_bindings",
"+mojo/public/cpp/bindings",
"+mojo/public/cpp/system",
"+skia",
"+third_party/khronos/GLES2/gl2.h",
"+third_party/khronos/GLES2/gl2ext.h",
"+third_party/skia",
"+ui/accelerated_widget_mac",
"+ui/display",
......
......@@ -20,7 +20,7 @@
namespace viz {
GLOutputSurface::GLOutputSurface(
scoped_refptr<InProcessContextProvider> context_provider,
scoped_refptr<VizProcessContextProvider> context_provider,
SyntheticBeginFrameSource* synthetic_begin_frame_source)
: OutputSurface(context_provider),
synthetic_begin_frame_source_(synthetic_begin_frame_source),
......@@ -100,7 +100,7 @@ void GLOutputSurface::SwapBuffers(OutputSurfaceFrame frame) {
uint32_t GLOutputSurface::GetFramebufferCopyTextureFormat() {
// TODO(danakj): What attributes are used for the default framebuffer here?
// Can it have alpha? InProcessContextProvider doesn't take any
// Can it have alpha? VizProcessContextProvider doesn't take any
// attributes.
return GL_RGB;
}
......
......@@ -7,8 +7,8 @@
#include <memory>
#include "components/viz/common/gpu/in_process_context_provider.h"
#include "components/viz/service/display/output_surface.h"
#include "components/viz/service/display_embedder/viz_process_context_provider.h"
#include "ui/latency/latency_tracker.h"
namespace viz {
......@@ -20,7 +20,7 @@ class SyntheticBeginFrameSource;
class GLOutputSurface : public OutputSurface,
public OutputSurface::LatencyInfoCache::Client {
public:
GLOutputSurface(scoped_refptr<InProcessContextProvider> context_provider,
GLOutputSurface(scoped_refptr<VizProcessContextProvider> context_provider,
SyntheticBeginFrameSource* synthetic_begin_frame_source);
~GLOutputSurface() override;
......
......@@ -18,7 +18,7 @@
namespace viz {
GLOutputSurfaceBufferQueue::GLOutputSurfaceBufferQueue(
scoped_refptr<InProcessContextProvider> context_provider,
scoped_refptr<VizProcessContextProvider> context_provider,
gpu::SurfaceHandle surface_handle,
SyntheticBeginFrameSource* synthetic_begin_frame_source,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
......
......@@ -10,9 +10,9 @@
#include "base/memory/weak_ptr.h"
#include "components/viz/common/gl_helper.h"
#include "components/viz/common/gpu/context_provider.h"
#include "components/viz/common/gpu/in_process_context_provider.h"
#include "components/viz/service/display/output_surface.h"
#include "components/viz/service/display_embedder/gl_output_surface.h"
#include "components/viz/service/display_embedder/viz_process_context_provider.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/swap_result.h"
......@@ -34,7 +34,7 @@ class SyntheticBeginFrameSource;
class GLOutputSurfaceBufferQueue : public GLOutputSurface {
public:
GLOutputSurfaceBufferQueue(
scoped_refptr<InProcessContextProvider> context_provider,
scoped_refptr<VizProcessContextProvider> context_provider,
gpu::SurfaceHandle surface_handle,
SyntheticBeginFrameSource* synthetic_begin_frame_source,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
......
......@@ -9,7 +9,7 @@
namespace viz {
GLOutputSurfaceMac::GLOutputSurfaceMac(
scoped_refptr<InProcessContextProvider> context_provider,
scoped_refptr<VizProcessContextProvider> context_provider,
gpu::SurfaceHandle surface_handle,
SyntheticBeginFrameSource* synthetic_begin_frame_source,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
......
......@@ -12,7 +12,7 @@ namespace viz {
class GLOutputSurfaceMac : public GLOutputSurfaceBufferQueue {
public:
GLOutputSurfaceMac(scoped_refptr<InProcessContextProvider> context_provider,
GLOutputSurfaceMac(scoped_refptr<VizProcessContextProvider> context_provider,
gpu::SurfaceHandle surface_handle,
SyntheticBeginFrameSource* synthetic_begin_frame_source,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
......
......@@ -9,7 +9,7 @@
namespace viz {
GLOutputSurfaceOzone::GLOutputSurfaceOzone(
scoped_refptr<InProcessContextProvider> context_provider,
scoped_refptr<VizProcessContextProvider> context_provider,
gpu::SurfaceHandle surface_handle,
SyntheticBeginFrameSource* synthetic_begin_frame_source,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
......
......@@ -11,12 +11,13 @@ namespace viz {
class GLOutputSurfaceOzone : public GLOutputSurfaceBufferQueue {
public:
GLOutputSurfaceOzone(scoped_refptr<InProcessContextProvider> context_provider,
gpu::SurfaceHandle surface_handle,
SyntheticBeginFrameSource* synthetic_begin_frame_source,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
uint32_t target,
uint32_t internal_format);
GLOutputSurfaceOzone(
scoped_refptr<VizProcessContextProvider> context_provider,
gpu::SurfaceHandle surface_handle,
SyntheticBeginFrameSource* synthetic_begin_frame_source,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
uint32_t target,
uint32_t internal_format);
~GLOutputSurfaceOzone() override;
private:
......
......@@ -9,7 +9,7 @@
namespace viz {
GLOutputSurfaceWin::GLOutputSurfaceWin(
scoped_refptr<InProcessContextProvider> context_provider,
scoped_refptr<VizProcessContextProvider> context_provider,
SyntheticBeginFrameSource* synthetic_begin_frame_source,
bool use_overlays)
: GLOutputSurface(context_provider, synthetic_begin_frame_source) {
......
......@@ -16,7 +16,7 @@ class CompositorOverlayCandidateValidatorWin;
class GLOutputSurfaceWin : public GLOutputSurface {
public:
GLOutputSurfaceWin(scoped_refptr<InProcessContextProvider> context_provider,
GLOutputSurfaceWin(scoped_refptr<VizProcessContextProvider> context_provider,
SyntheticBeginFrameSource* synthetic_begin_frame_source,
bool use_overlays);
~GLOutputSurfaceWin() override;
......
......@@ -11,7 +11,6 @@
#include "cc/base/switches.h"
#include "components/viz/common/display/renderer_settings.h"
#include "components/viz/common/frame_sinks/begin_frame_source.h"
#include "components/viz/common/gpu/in_process_context_provider.h"
#include "components/viz/service/display/display.h"
#include "components/viz/service/display/display_scheduler.h"
#include "components/viz/service/display_embedder/external_begin_frame_controller_impl.h"
......@@ -19,6 +18,7 @@
#include "components/viz/service/display_embedder/in_process_gpu_memory_buffer_manager.h"
#include "components/viz/service/display_embedder/server_shared_bitmap_manager.h"
#include "components/viz/service/display_embedder/software_output_surface.h"
#include "components/viz/service/display_embedder/viz_process_context_provider.h"
#include "gpu/command_buffer/client/shared_memory_limits.h"
#include "gpu/command_buffer/service/image_factory.h"
#include "gpu/ipc/common/surface_handle.h"
......@@ -109,12 +109,12 @@ std::unique_ptr<Display> GpuDisplayProvider::CreateDisplay(
output_surface = std::make_unique<SoftwareOutputSurface>(
CreateSoftwareOutputDeviceForPlatform(surface_handle), task_runner_);
} else {
scoped_refptr<InProcessContextProvider> context_provider;
scoped_refptr<VizProcessContextProvider> context_provider;
// Retry creating and binding |context_provider| on transient failures.
gpu::ContextResult context_result = gpu::ContextResult::kTransientFailure;
while (context_result != gpu::ContextResult::kSuccess) {
context_provider = base::MakeRefCounted<InProcessContextProvider>(
context_provider = base::MakeRefCounted<VizProcessContextProvider>(
gpu_service_, surface_handle, gpu_memory_buffer_manager_.get(),
image_factory_, gpu_channel_manager_delegate_,
gpu::SharedMemoryLimits(), nullptr /* shared_context */);
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/viz/common/gpu/in_process_context_provider.h"
#include "components/viz/service/display_embedder/viz_process_context_provider.h"
#include <stdint.h>
......@@ -47,14 +47,14 @@ gpu::ContextCreationAttribs CreateAttributes() {
} // namespace
InProcessContextProvider::InProcessContextProvider(
VizProcessContextProvider::VizProcessContextProvider(
scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
gpu::SurfaceHandle surface_handle,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
gpu::ImageFactory* image_factory,
gpu::GpuChannelManagerDelegate* gpu_channel_manager_delegate,
const gpu::SharedMemoryLimits& limits,
InProcessContextProvider* shared_context)
VizProcessContextProvider* shared_context)
: attributes_(CreateAttributes()),
context_(gpu::GLInProcessContext::CreateWithoutInit()),
context_result_(context_->Initialize(
......@@ -73,29 +73,29 @@ InProcessContextProvider::InProcessContextProvider(
context_->GetImplementation(),
base::ThreadTaskRunnerHandle::Get())) {}
InProcessContextProvider::~InProcessContextProvider() = default;
VizProcessContextProvider::~VizProcessContextProvider() = default;
void InProcessContextProvider::AddRef() const {
base::RefCountedThreadSafe<InProcessContextProvider>::AddRef();
void VizProcessContextProvider::AddRef() const {
base::RefCountedThreadSafe<VizProcessContextProvider>::AddRef();
}
void InProcessContextProvider::Release() const {
base::RefCountedThreadSafe<InProcessContextProvider>::Release();
void VizProcessContextProvider::Release() const {
base::RefCountedThreadSafe<VizProcessContextProvider>::Release();
}
gpu::ContextResult InProcessContextProvider::BindToCurrentThread() {
gpu::ContextResult VizProcessContextProvider::BindToCurrentThread() {
return context_result_;
}
gpu::gles2::GLES2Interface* InProcessContextProvider::ContextGL() {
gpu::gles2::GLES2Interface* VizProcessContextProvider::ContextGL() {
return context_->GetImplementation();
}
gpu::ContextSupport* InProcessContextProvider::ContextSupport() {
gpu::ContextSupport* VizProcessContextProvider::ContextSupport() {
return context_->GetImplementation();
}
class GrContext* InProcessContextProvider::GrContext() {
class GrContext* VizProcessContextProvider::GrContext() {
if (gr_context_)
return gr_context_->get();
......@@ -111,27 +111,29 @@ class GrContext* InProcessContextProvider::GrContext() {
return gr_context_->get();
}
ContextCacheController* InProcessContextProvider::CacheController() {
ContextCacheController* VizProcessContextProvider::CacheController() {
return cache_controller_.get();
}
base::Lock* InProcessContextProvider::GetLock() {
base::Lock* VizProcessContextProvider::GetLock() {
return &context_lock_;
}
const gpu::Capabilities& InProcessContextProvider::ContextCapabilities() const {
const gpu::Capabilities& VizProcessContextProvider::ContextCapabilities()
const {
return context_->GetCapabilities();
}
const gpu::GpuFeatureInfo& InProcessContextProvider::GetGpuFeatureInfo() const {
const gpu::GpuFeatureInfo& VizProcessContextProvider::GetGpuFeatureInfo()
const {
return context_->GetGpuFeatureInfo();
}
void InProcessContextProvider::AddObserver(ContextLostObserver* obs) {}
void VizProcessContextProvider::AddObserver(ContextLostObserver* obs) {}
void InProcessContextProvider::RemoveObserver(ContextLostObserver* obs) {}
void VizProcessContextProvider::RemoveObserver(ContextLostObserver* obs) {}
uint32_t InProcessContextProvider::GetCopyTextureInternalFormat() {
uint32_t VizProcessContextProvider::GetCopyTextureInternalFormat() {
if (attributes_.alpha_size > 0)
return GL_RGBA;
DCHECK_NE(attributes_.red_size, 0);
......@@ -140,19 +142,19 @@ uint32_t InProcessContextProvider::GetCopyTextureInternalFormat() {
return GL_RGB;
}
void InProcessContextProvider::SetSwapBuffersCompletionCallback(
void VizProcessContextProvider::SetSwapBuffersCompletionCallback(
const gpu::InProcessCommandBuffer::SwapBuffersCompletionCallback&
callback) {
context_->SetSwapBuffersCompletionCallback(callback);
}
void InProcessContextProvider::SetUpdateVSyncParametersCallback(
void VizProcessContextProvider::SetUpdateVSyncParametersCallback(
const gpu::InProcessCommandBuffer::UpdateVSyncParametersCallback&
callback) {
context_->SetUpdateVSyncParametersCallback(callback);
}
void InProcessContextProvider::SetPresentationCallback(
void VizProcessContextProvider::SetPresentationCallback(
const gpu::InProcessCommandBuffer::PresentationCallback& callback) {
context_->SetPresentationCallback(callback);
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_VIZ_COMMON_GPU_IN_PROCESS_CONTEXT_PROVIDER_H_
#define COMPONENTS_VIZ_COMMON_GPU_IN_PROCESS_CONTEXT_PROVIDER_H_
#ifndef COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_VIZ_PROCESS_CONTEXT_PROVIDER_H_
#define COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_VIZ_PROCESS_CONTEXT_PROVIDER_H_
#include <stdint.h>
......@@ -13,7 +13,7 @@
#include "base/synchronization/lock.h"
#include "components/viz/common/gpu/context_cache_controller.h"
#include "components/viz/common/gpu/context_provider.h"
#include "components/viz/common/viz_common_export.h"
#include "components/viz/service/viz_service_export.h"
#include "gpu/command_buffer/common/context_creation_attribs.h"
#include "gpu/ipc/in_process_command_buffer.h"
#include "ui/gfx/native_widget_types.h"
......@@ -34,22 +34,20 @@ class GrContextForGLES2Interface;
namespace viz {
// A ContextProvider used in the viz process to setup command buffers between
// the compositor and gpu thread.
// TODO(kylechar): Rename VizProcessContextProvider and move to
// components/viz/service.
class VIZ_COMMON_EXPORT InProcessContextProvider
: public base::RefCountedThreadSafe<InProcessContextProvider>,
// A ContextProvider used in the viz process to setup an InProcessCommandBuffer
// for the display compositor.
class VIZ_SERVICE_EXPORT VizProcessContextProvider
: public base::RefCountedThreadSafe<VizProcessContextProvider>,
public ContextProvider {
public:
InProcessContextProvider(
VizProcessContextProvider(
scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
gpu::SurfaceHandle surface_handle,
gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
gpu::ImageFactory* image_factory,
gpu::GpuChannelManagerDelegate* gpu_channel_manager_delegate,
const gpu::SharedMemoryLimits& limits,
InProcessContextProvider* shared_context);
VizProcessContextProvider* shared_context);
// ContextProvider implementation.
void AddRef() const override;
......@@ -79,8 +77,8 @@ class VIZ_COMMON_EXPORT InProcessContextProvider
const gpu::InProcessCommandBuffer::PresentationCallback& callback);
protected:
friend class base::RefCountedThreadSafe<InProcessContextProvider>;
~InProcessContextProvider() override;
friend class base::RefCountedThreadSafe<VizProcessContextProvider>;
~VizProcessContextProvider() override;
private:
const gpu::ContextCreationAttribs attributes_;
......@@ -94,4 +92,4 @@ class VIZ_COMMON_EXPORT InProcessContextProvider
} // namespace viz
#endif // COMPONENTS_VIZ_COMMON_GPU_IN_PROCESS_CONTEXT_PROVIDER_H_
#endif // COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_VIZ_PROCESS_CONTEXT_PROVIDER_H_
......@@ -17,7 +17,6 @@
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "components/crash/core/common/crash_key.h"
#include "components/viz/common/gpu/in_process_context_provider.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/scheduler.h"
......
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