Treat virgl separate abstraction

Similar to angle and chromium command buffer, treat virgl as a separate
abstraction on top of real vendor driver.

Bug: chromium:1331350
Change-Id: Ib26707aa301e03a677f6dd9036851f66b30437f9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/558919
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Bo Liu 2022-07-14 18:04:02 -04:00 committed by SkCQ
parent e99248cf83
commit 1e30251d35
4 changed files with 11 additions and 6 deletions

View File

@ -3954,7 +3954,7 @@ void GrGLCaps::applyDriverCorrectnessWorkarounds(const GrGLContextInfo& ctxInfo,
}
// https://b.corp.google.com/issues/188410972
if (ctxInfo.renderer() == GrGLRenderer::kVirgl) {
if (ctxInfo.isRunningOverVirgl()) {
fDrawInstancedSupport = false;
}

View File

@ -59,6 +59,7 @@ public:
GrGLDriver driver() const { return fDriverInfo.fDriver; }
GrGLDriverVersion driverVersion() const { return fDriverInfo.fDriverVersion; }
bool isOverCommandBuffer() const { return fDriverInfo.fIsOverCommandBuffer; }
bool isRunningOverVirgl() const { return fDriverInfo.fIsRunningOverVirgl; }
const GrGLCaps* caps() const { return fGLCaps.get(); }
GrGLCaps* caps() { return fGLCaps.get(); }

View File

@ -363,9 +363,6 @@ static GrGLRenderer get_renderer(const char* rendererString, const GrGLExtension
if (strstr(rendererString, "llvmpipe")) {
return GrGLRenderer::kGalliumLLVM;
}
if (strstr(rendererString, "virgl")) {
return GrGLRenderer::kVirgl;
}
static const char kMaliGStr[] = "Mali-G";
if (0 == strncmp(rendererString, kMaliGStr, std::size(kMaliGStr) - 1)) {
return GrGLRenderer::kMaliG;
@ -394,6 +391,10 @@ static bool is_commamd_buffer(const char* rendererString, const char* versionStr
0 == strcmp(kChromium, suffix)));
}
static bool is_virgl(const char* rendererString) {
return !!strstr(rendererString, "virgl");
}
static std::tuple<GrGLDriver, GrGLDriverVersion> get_driver_and_version(GrGLStandard standard,
GrGLVendor vendor,
const char* vendorString,
@ -732,6 +733,8 @@ GrGLDriverInfo GrGLGetDriverInfo(const GrGLInterface* interface) {
info.fIsOverCommandBuffer = is_commamd_buffer(renderer, version);
info.fIsRunningOverVirgl = is_virgl(renderer);
return info;
}

View File

@ -196,8 +196,6 @@ enum class GrGLRenderer {
kGalliumLLVM,
kVirgl,
kMali4xx,
/** G-3x, G-5x, or G-7x */
kMaliG,
@ -313,6 +311,9 @@ struct GrGLDriverInfo {
// Are we running over the Chrome interprocess command buffer?
bool fIsOverCommandBuffer = false;
// Running over virgl guest driver.
bool fIsRunningOverVirgl = false;
};
GrGLDriverInfo GrGLGetDriverInfo(const GrGLInterface*);