Commit 56c14e99 authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Disable virtual contexts if using passthrough

Bug: 942412,946550
Change-Id: I696419309b3ba4228c0791db90628bf6f36006a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1532964Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Jonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646359}
parent 29e2b7b1
......@@ -145,10 +145,16 @@ bool SharedContextState::InitializeGL(
DCHECK(context_->IsCurrent(nullptr));
bool use_passthrough_cmd_decoder =
gpu_preferences.use_passthrough_cmd_decoder &&
gles2::PassthroughCommandDecoderSupported();
// Virtualized contexts don't work with passthrough command decoder.
// See https://crbug.com/914976
DCHECK(!use_passthrough_cmd_decoder || !use_virtualized_gl_contexts_);
feature_info_ = std::move(feature_info);
feature_info_->Initialize(gpu::CONTEXT_TYPE_OPENGLES2,
gpu_preferences.use_passthrough_cmd_decoder &&
gles2::PassthroughCommandDecoderSupported(),
use_passthrough_cmd_decoder,
gles2::DisallowedFeatures());
auto* api = gl::g_current_gl_context;
......
......@@ -362,8 +362,20 @@ class CommandBufferSetup {
config_.workarounds, gpu_feature_info);
command_buffer_.reset(new CommandBufferDirect());
if (gpu_preferences_.use_passthrough_cmd_decoder) {
// Virtualized contexts don't work with passthrough command decoder.
// See https://crbug.com/914976
config_.workarounds.use_virtualized_gl_contexts = false;
}
scoped_refptr<gl::GLContext> shared_context;
if (config_.workarounds.use_virtualized_gl_contexts) {
shared_context = context_;
} else {
shared_context = CreateContext();
}
shared_context->MakeCurrent(surface_.get());
context_state_ = base::MakeRefCounted<SharedContextState>(
share_group_, surface_, context_,
share_group_, surface_, std::move(shared_context),
config_.workarounds.use_virtualized_gl_contexts, base::DoNothing());
context_state_->InitializeGrContext(config_.workarounds, nullptr);
context_state_->InitializeGL(gpu_preferences_, feature_info);
......@@ -391,6 +403,7 @@ class CommandBufferSetup {
gfx::ColorSpace::CreateSRGB(), usage);
}
context_->MakeCurrent(surface_.get());
#if defined(GPU_FUZZER_USE_RASTER_DECODER)
CHECK(feature_info->feature_flags().chromium_raster_transport);
auto* context = context_state_->context();
......@@ -462,7 +475,7 @@ class CommandBufferSetup {
decoder_.reset();
if (!context_lost)
context_state_->MakeCurrent(nullptr);
context_lost = !context_state_->MakeCurrent(nullptr);
shared_image_factory_->DestroyAllSharedImages(!context_lost);
shared_image_factory_.reset();
......@@ -533,18 +546,22 @@ class CommandBufferSetup {
CreateTransferBuffer(kTinyTransferBufferSize, 5);
}
void InitContext() {
#if !defined(GPU_FUZZER_USE_STUB)
context_ = new gl::GLContextEGL(share_group_.get());
context_->Initialize(surface_.get(), config_.gl_context_attribs);
scoped_refptr<gl::GLContext> CreateContext() {
#if defined(GPU_FUZZER_USE_STUB)
auto stub = base::MakeRefCounted<gl::GLContextStub>(share_group_.get());
stub->SetGLVersionString(config_.version);
stub->SetExtensionsString(config_.extensions.c_str());
stub->SetUseStubApi(true);
return stub;
#else
scoped_refptr<gl::GLContextStub> context_stub =
new gl::GLContextStub(share_group_.get());
context_stub->SetGLVersionString(config_.version);
context_stub->SetExtensionsString(config_.extensions.c_str());
context_stub->SetUseStubApi(true);
context_ = context_stub;
auto context = base::MakeRefCounted<gl::GLContextEGL>(share_group_.get());
context->Initialize(surface_.get(), config_.gl_context_attribs);
return context;
#endif
}
void InitContext() {
context_ = CreateContext();
// When not using the passthrough decoder, ANGLE should not be generating
// errors (the decoder should prevent those from happening). We register a
......
......@@ -448,6 +448,11 @@ gpu::ContextResult InProcessCommandBuffer::InitializeOnGpuThread(
use_virtualized_gl_context_ |=
context_group_->feature_info()->workarounds().use_virtualized_gl_contexts;
if (context_group_->use_passthrough_cmd_decoder()) {
// Virtualized contexts don't work with passthrough command decoder.
// See https://crbug.com/914976
use_virtualized_gl_context_ = false;
}
// TODO(sunnyps): Should this use ScopedCrashKey instead?
crash_keys::gpu_gl_context_is_virtual.Set(use_virtualized_gl_context_ ? "1"
: "0");
......
......@@ -369,6 +369,9 @@ scoped_refptr<SharedContextState> GpuChannelManager::GetSharedContextState(
scoped_refptr<gl::GLShareGroup> share_group;
if (use_passthrough_decoder) {
share_group = new gl::GLShareGroup();
// Virtualized contexts don't work with passthrough command decoder.
// See https://crbug.com/914976
use_virtualized_gl_contexts = false;
} else {
share_group = share_group_;
}
......
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