Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GLImplementationParts to GPUInfo.
The current software_rendering is an ambiguous concept because SwiftShader sometimes is considered software rendering but other times not (for example, in testing, we use SwiftShader but try to go down hardware accelerated paths). So getting rid of |software_rendering| in GPUInfo to avoid confusion and misuse in the future. Instead, pass back the actual GLImplementationParts. In a followup, we should get rid of the |gl_implementation| and |angle_implementation| string from GPUInfo. TEST=bots R=geofflang@chromium.org Bug: 1422401 Change-Id: Icfde2fc9a2f370cb5cc66db6bb1956e6bfbb45d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4335241 Reviewed-by: Mustafa Emre Acer <meacer@chromium.org> Commit-Queue: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Cr-Commit-Position: refs/heads/main@{#1118804}
- Loading branch information
Showing
14 changed files
with
281 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
module gl.mojom; | ||
|
||
// Maps to its namesake in ui/gl/gl_implementation.h. | ||
enum GLImplementation { | ||
kGLImplementationNone, | ||
kGLImplementationDesktopGL, | ||
kGLImplementationDesktopGLCoreProfile, | ||
kGLImplementationEGLGLES2, | ||
kGLImplementationMockGL, | ||
kGLImplementationStubGL, | ||
kGLImplementationDisabled, | ||
kGLImplementationEGLANGLE, | ||
}; | ||
|
||
// Maps to its namesake in ui/gl/gl_implementation.h. | ||
enum ANGLEImplementation { | ||
kNone, | ||
kD3D9, | ||
kD3D11, | ||
kOpenGL, | ||
kOpenGLES, | ||
kNull, | ||
kVulkan, | ||
kSwiftShader, | ||
kMetal, | ||
kDefault, | ||
}; | ||
|
||
// Maps to its namesake in ui/gl/gl_implementation.h. | ||
struct GLImplementationParts { | ||
// The GL implementation currently in use. | ||
GLImplementation gl; | ||
// The ANGLE implementation currently in use. | ||
ANGLEImplementation angle; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ui/gl/mojom/gl_implementation_mojom_traits.h" | ||
#include "base/notreached.h" | ||
|
||
namespace mojo { | ||
|
||
// static | ||
gl::mojom::GLImplementation | ||
EnumTraits<gl::mojom::GLImplementation, gl::GLImplementation>::ToMojom( | ||
gl::GLImplementation impl) { | ||
switch (impl) { | ||
case gl::kGLImplementationNone: | ||
return gl::mojom::GLImplementation::kGLImplementationNone; | ||
case gl::kGLImplementationDesktopGL: | ||
return gl::mojom::GLImplementation::kGLImplementationDesktopGL; | ||
case gl::kGLImplementationDesktopGLCoreProfile: | ||
return gl::mojom::GLImplementation::kGLImplementationDesktopGLCoreProfile; | ||
case gl::kGLImplementationEGLGLES2: | ||
return gl::mojom::GLImplementation::kGLImplementationEGLGLES2; | ||
case gl::kGLImplementationMockGL: | ||
return gl::mojom::GLImplementation::kGLImplementationMockGL; | ||
case gl::kGLImplementationStubGL: | ||
return gl::mojom::GLImplementation::kGLImplementationStubGL; | ||
case gl::kGLImplementationDisabled: | ||
return gl::mojom::GLImplementation::kGLImplementationDisabled; | ||
case gl::kGLImplementationEGLANGLE: | ||
return gl::mojom::GLImplementation::kGLImplementationEGLANGLE; | ||
} | ||
NOTREACHED(); | ||
return gl::mojom::GLImplementation::kGLImplementationNone; | ||
} | ||
|
||
// static | ||
bool EnumTraits<gl::mojom::GLImplementation, gl::GLImplementation>::FromMojom( | ||
gl::mojom::GLImplementation input, | ||
gl::GLImplementation* out) { | ||
switch (input) { | ||
case gl::mojom::GLImplementation::kGLImplementationNone: | ||
*out = gl::kGLImplementationNone; | ||
return true; | ||
case gl::mojom::GLImplementation::kGLImplementationDesktopGL: | ||
*out = gl::kGLImplementationDesktopGL; | ||
return true; | ||
case gl::mojom::GLImplementation::kGLImplementationDesktopGLCoreProfile: | ||
*out = gl::kGLImplementationDesktopGLCoreProfile; | ||
return true; | ||
case gl::mojom::GLImplementation::kGLImplementationEGLGLES2: | ||
*out = gl::kGLImplementationEGLGLES2; | ||
return true; | ||
case gl::mojom::GLImplementation::kGLImplementationMockGL: | ||
*out = gl::kGLImplementationMockGL; | ||
return true; | ||
case gl::mojom::GLImplementation::kGLImplementationStubGL: | ||
*out = gl::kGLImplementationStubGL; | ||
return true; | ||
case gl::mojom::GLImplementation::kGLImplementationDisabled: | ||
*out = gl::kGLImplementationDisabled; | ||
return true; | ||
case gl::mojom::GLImplementation::kGLImplementationEGLANGLE: | ||
*out = gl::kGLImplementationEGLANGLE; | ||
return true; | ||
} | ||
NOTREACHED(); | ||
return false; | ||
} | ||
|
||
// static | ||
gl::mojom::ANGLEImplementation | ||
EnumTraits<gl::mojom::ANGLEImplementation, gl::ANGLEImplementation>::ToMojom( | ||
gl::ANGLEImplementation impl) { | ||
switch (impl) { | ||
case gl::ANGLEImplementation::kNone: | ||
return gl::mojom::ANGLEImplementation::kNone; | ||
case gl::ANGLEImplementation::kD3D9: | ||
return gl::mojom::ANGLEImplementation::kD3D9; | ||
case gl::ANGLEImplementation::kD3D11: | ||
return gl::mojom::ANGLEImplementation::kD3D11; | ||
case gl::ANGLEImplementation::kOpenGL: | ||
return gl::mojom::ANGLEImplementation::kOpenGL; | ||
case gl::ANGLEImplementation::kOpenGLES: | ||
return gl::mojom::ANGLEImplementation::kOpenGLES; | ||
case gl::ANGLEImplementation::kNull: | ||
return gl::mojom::ANGLEImplementation::kNull; | ||
case gl::ANGLEImplementation::kVulkan: | ||
return gl::mojom::ANGLEImplementation::kVulkan; | ||
case gl::ANGLEImplementation::kSwiftShader: | ||
return gl::mojom::ANGLEImplementation::kSwiftShader; | ||
case gl::ANGLEImplementation::kMetal: | ||
return gl::mojom::ANGLEImplementation::kMetal; | ||
case gl::ANGLEImplementation::kDefault: | ||
return gl::mojom::ANGLEImplementation::kDefault; | ||
} | ||
NOTREACHED(); | ||
return gl::mojom::ANGLEImplementation::kNone; | ||
} | ||
|
||
// static | ||
bool EnumTraits<gl::mojom::ANGLEImplementation, gl::ANGLEImplementation>:: | ||
FromMojom(gl::mojom::ANGLEImplementation input, | ||
gl::ANGLEImplementation* out) { | ||
switch (input) { | ||
case gl::mojom::ANGLEImplementation::kNone: | ||
*out = gl::ANGLEImplementation::kNone; | ||
return true; | ||
case gl::mojom::ANGLEImplementation::kD3D9: | ||
*out = gl::ANGLEImplementation::kD3D9; | ||
return true; | ||
case gl::mojom::ANGLEImplementation::kD3D11: | ||
*out = gl::ANGLEImplementation::kD3D11; | ||
return true; | ||
case gl::mojom::ANGLEImplementation::kOpenGL: | ||
*out = gl::ANGLEImplementation::kOpenGL; | ||
return true; | ||
case gl::mojom::ANGLEImplementation::kOpenGLES: | ||
*out = gl::ANGLEImplementation::kOpenGLES; | ||
return true; | ||
case gl::mojom::ANGLEImplementation::kNull: | ||
*out = gl::ANGLEImplementation::kNull; | ||
return true; | ||
case gl::mojom::ANGLEImplementation::kVulkan: | ||
*out = gl::ANGLEImplementation::kVulkan; | ||
return true; | ||
case gl::mojom::ANGLEImplementation::kSwiftShader: | ||
*out = gl::ANGLEImplementation::kSwiftShader; | ||
return true; | ||
case gl::mojom::ANGLEImplementation::kMetal: | ||
*out = gl::ANGLEImplementation::kMetal; | ||
return true; | ||
case gl::mojom::ANGLEImplementation::kDefault: | ||
*out = gl::ANGLEImplementation::kDefault; | ||
return true; | ||
} | ||
NOTREACHED(); | ||
return false; | ||
} | ||
|
||
// static | ||
bool StructTraits<gl::mojom::GLImplementationPartsDataView, | ||
gl::GLImplementationParts>:: | ||
Read(gl::mojom::GLImplementationPartsDataView data, | ||
gl::GLImplementationParts* out) { | ||
return data.ReadGl(&out->gl) && data.ReadAngle(&out->angle); | ||
} | ||
|
||
} // namespace mojo |
Oops, something went wrong.