Commit e4accf84 authored by Peng Huang's avatar Peng Huang Committed by Commit Bot

Enable virualized context for SkiaRenderer code path

Bug: 900941, 902904
Change-Id: I1b374fe1efd9c0612fc6f42a84eefd8bc3b1e320
Reviewed-on: https://chromium-review.googlesource.com/c/1370189
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616083}
parent 3e390e1c
......@@ -13,6 +13,7 @@
#include "components/viz/service/display/output_surface_frame.h"
#include "components/viz/service/gl/gpu_service_impl.h"
#include "gpu/command_buffer/common/swap_buffers_complete_params.h"
#include "gpu/command_buffer/service/context_state.h"
#include "gpu/command_buffer/service/gr_shader_cache.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/scheduler.h"
......@@ -39,7 +40,6 @@
#if BUILDFLAG(ENABLE_VULKAN)
#include "gpu/vulkan/vulkan_implementation.h"
#endif
namespace viz {
namespace {
......@@ -124,7 +124,6 @@ void SkiaOutputSurfaceImplOnGpu::Reshape(
LOG(FATAL) << "Failed to resize.";
// TODO(penghuang): Handle the failure.
}
DCHECK(gl_context()->IsCurrent(gl_surface_.get()));
DCHECK(gr_context());
SkSurfaceProps surface_props =
......@@ -466,14 +465,17 @@ void SkiaOutputSurfaceImplOnGpu::InitializeForGL() {
if (!MakeCurrent())
return;
gl_version_info_ = gl_context()->GetVersionInfo();
auto* context = context_state_->real_context();
gl_version_info_ = context->GetVersionInfo();
capabilities_.flipped_output_surface = gl_surface_->FlipsVertically();
// Get stencil bits from the default frame buffer.
auto* current_gl = gl_context()->GetCurrentGL();
auto* current_gl = context->GetCurrentGL();
const auto* version = current_gl->Version;
auto* api = current_gl->Api;
api->glBindFramebufferEXTFn(GL_FRAMEBUFFER, 0);
gr_context()->resetContext(kRenderTarget_GrGLBackendState);
GLint stencil_bits = 0;
if (version->is_desktop_core_profile) {
api->glGetFramebufferAttachmentParameterivEXTFn(
......@@ -482,7 +484,7 @@ void SkiaOutputSurfaceImplOnGpu::InitializeForGL() {
} else {
api->glGetIntegervFn(GL_STENCIL_BITS, &stencil_bits);
}
CHECK_GL_ERROR();
capabilities_.supports_stencil = stencil_bits > 0;
}
......
......@@ -140,7 +140,6 @@ class SkiaOutputSurfaceImplOnGpu : public gpu::ImageTransportSurfaceDelegate {
bool MakeCurrent();
GrContext* gr_context() { return context_state_->gr_context; }
gl::GLContext* gl_context() { return context_state_->context(); }
const gpu::CommandBufferId command_buffer_id_;
GpuServiceImpl* const gpu_service_;
......
......@@ -300,7 +300,6 @@ GpuServiceImpl::GetContextStateForGLSurface(gl::GLSurface* surface) {
// compatible.
DCHECK_EQ(surface->GetCompatibilityKey(),
context_state->surface()->GetCompatibilityKey());
DCHECK(!context_state->use_virtualized_gl_contexts);
return context_state;
}
......
......@@ -426,18 +426,11 @@ gpu::ContextResult InProcessCommandBuffer::InitializeOnGpuThread(
use_virtualized_gl_context_ |=
context_group_->feature_info()->workarounds().use_virtualized_gl_contexts;
const auto& gpu_feature_info = task_executor_->gpu_feature_info();
const bool use_oop_rasterization =
gpu_feature_info.status_values[GPU_FEATURE_TYPE_OOP_RASTERIZATION] ==
gpu::kGpuFeatureStatusEnabled;
// With OOP-R and SkiaRenderer, we will only have one GLContext
// and share it with RasterDecoders and DisplayCompositor. So it is not
// necessary to use virtualized gl context anymore.
// TODO(penghuang): Make virtualized gl context work with SkiaRenderer + DDL +
// OOPR. https://crbug.com/838899
if (features::IsUsingSkiaRenderer() && use_oop_rasterization)
use_virtualized_gl_context_ = false;
#if defined(OS_MACOSX)
// TODO(penghuang): remove below line when the framebuffer issue is fixed in
// skia. https://crbug.com/914495
use_virtualized_gl_context_ &= !features::IsUsingSkiaRenderer();
#endif
// TODO(sunnyps): Should this use ScopedCrashKey instead?
crash_keys::gpu_gl_context_is_virtual.Set(use_virtualized_gl_context_ ? "1"
......
......@@ -125,18 +125,11 @@ gpu::ContextResult GLES2CommandBufferStub::Initialize(
// only a single context. See crbug.com/510243 for details.
use_virtualized_gl_context_ |= manager->mailbox_manager()->UsesSync();
const auto& gpu_feature_info = manager->gpu_feature_info();
const bool use_oop_rasterization =
gpu_feature_info.status_values[GPU_FEATURE_TYPE_OOP_RASTERIZATION] ==
gpu::kGpuFeatureStatusEnabled;
// With OOP-R and SkiaRenderer, we will only have one GLContext
// and share it with RasterDecoders and DisplayCompositor. So it is not
// necessary to use virtualized gl context anymore.
// TODO(penghuang): Make virtualized gl context work with SkiaRenderer + DDL +
// OOPR. https://crbug.com/838899
if (features::IsUsingSkiaRenderer() && use_oop_rasterization)
use_virtualized_gl_context_ = false;
#if defined(OS_MACOSX)
// TODO(penghuang): remove below line when the framebuffer issue is fixed in
// skia. https://crbug.com/914495
use_virtualized_gl_context_ &= !features::IsUsingSkiaRenderer();
#endif
bool offscreen = (surface_handle_ == kNullSurfaceHandle);
gl::GLSurface* default_surface = manager->default_offscreen_surface();
......
......@@ -375,17 +375,11 @@ GpuChannelManager::GetRasterDecoderContextState(ContextResult* result) {
// only a single context. See crbug.com/510243 for details.
use_virtualized_gl_contexts |= mailbox_manager_->UsesSync();
const bool use_oop_rasterization =
gpu_feature_info_.status_values[GPU_FEATURE_TYPE_OOP_RASTERIZATION] ==
gpu::kGpuFeatureStatusEnabled;
// With OOP-R and SkiaRenderer, we will only have one GLContext
// and share it with RasterDecoders and DisplayCompositor. So it is not
// necessary to use virtualized gl context anymore.
// TODO(penghuang): Make virtualized gl context work with SkiaRenderer + DDL +
// OOPR. https://crbug.com/838899
if (features::IsUsingSkiaRenderer() && use_oop_rasterization)
use_virtualized_gl_contexts = false;
#if defined(OS_MACOSX)
// TODO(penghuang): remove below line when the framebuffer issue is fixed in
// skia. https://crbug.com/914495
use_virtualized_gl_contexts &= !features::IsUsingSkiaRenderer();
#endif
const bool use_passthrough_decoder =
gles2::PassthroughCommandDecoderSupported() &&
......
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