You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.9 KiB
72 lines
2.9 KiB
8 months ago
|
From 041cb248e818823caaaabc67db92b16499d0416d Mon Sep 17 00:00:00 2001
|
||
|
From: Vasiliy Telezhnikov <vasilyt@chromium.org>
|
||
|
Date: Thu, 02 Feb 2023 15:42:28 +0000
|
||
|
Subject: [PATCH] CHECK that passthrough command decoder is used on launched platforms
|
||
|
|
||
|
This CL adds enforces that validating command decoder is not used on
|
||
|
platforms where passthrough is fully launched. We still allow to use it
|
||
|
by tests on linux
|
||
|
|
||
|
Bug: 1406585
|
||
|
Change-Id: Id6bc1d748fdf9c953dde76c8d4b5f59ddef60857
|
||
|
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4212134
|
||
|
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
|
||
|
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
|
||
|
Cr-Commit-Position: refs/heads/main@{#1100440}
|
||
|
---
|
||
|
|
||
|
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
||
|
index eb710696..b22dffb 100644
|
||
|
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
||
|
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
||
|
@@ -3447,7 +3447,13 @@
|
||
|
outputter, group);
|
||
|
}
|
||
|
|
||
|
+// Allow linux to run fuzzers.
|
||
|
+#if BUILDFLAG(ENABLE_VALIDATING_COMMAND_DECODER) || BUILDFLAG(IS_LINUX)
|
||
|
return new GLES2DecoderImpl(client, command_buffer_service, outputter, group);
|
||
|
+#else
|
||
|
+ LOG(FATAL) << "Validating command decoder is not supported.";
|
||
|
+ return nullptr;
|
||
|
+#endif
|
||
|
}
|
||
|
|
||
|
GLES2DecoderImpl::GLES2DecoderImpl(
|
||
|
diff --git a/gpu/ipc/service/gpu_init.cc b/gpu/ipc/service/gpu_init.cc
|
||
|
index 40977d9b..50171e20 100644
|
||
|
--- a/gpu/ipc/service/gpu_init.cc
|
||
|
+++ b/gpu/ipc/service/gpu_init.cc
|
||
|
@@ -510,8 +510,9 @@
|
||
|
|
||
|
auto impl = gl::GetGLImplementationParts();
|
||
|
bool gl_disabled = impl == gl::kGLImplementationDisabled;
|
||
|
- bool is_swangle = impl == gl::ANGLEImplementation::kSwiftShader;
|
||
|
|
||
|
+#if BUILDFLAG(ENABLE_VALIDATING_COMMAND_DECODER)
|
||
|
+ bool is_swangle = impl == gl::ANGLEImplementation::kSwiftShader;
|
||
|
// Compute passthrough decoder status before ComputeGpuFeatureInfo below.
|
||
|
// Do this after GL is initialized so extensions can be queried.
|
||
|
// Using SwANGLE forces the passthrough command decoder.
|
||
|
@@ -533,6 +534,20 @@
|
||
|
}
|
||
|
gpu_preferences_.use_passthrough_cmd_decoder =
|
||
|
gpu_info_.passthrough_cmd_decoder;
|
||
|
+#else
|
||
|
+ // If gl is disabled passthrough/validating command decoder doesn't matter. If
|
||
|
+ // it's not ensure that passthrough command decoder is supported as it's our
|
||
|
+ // only option.
|
||
|
+ if (!gl_disabled) {
|
||
|
+ LOG_IF(FATAL, !gles2::PassthroughCommandDecoderSupported())
|
||
|
+ << "Passthrough is not supported, GL is "
|
||
|
+ << gl::GetGLImplementationGLName(gl::GetGLImplementationParts())
|
||
|
+ << ", ANGLE is "
|
||
|
+ << gl::GetGLImplementationANGLEName(gl::GetGLImplementationParts());
|
||
|
+ gpu_info_.passthrough_cmd_decoder = true;
|
||
|
+ gpu_preferences_.use_passthrough_cmd_decoder = true;
|
||
|
+ }
|
||
|
+#endif
|
||
|
|
||
|
// We need to collect GL strings (VENDOR, RENDERER) for blocklisting purposes.
|
||
|
if (!gl_disabled) {
|