diff --git a/packages/flutter_tools/lib/src/base/user_messages.dart b/packages/flutter_tools/lib/src/base/user_messages.dart index 43861f32417..7a63c2bac4d 100644 --- a/packages/flutter_tools/lib/src/base/user_messages.dart +++ b/packages/flutter_tools/lib/src/base/user_messages.dart @@ -275,6 +275,9 @@ class UserMessages { String get gtkLibrariesMissing => 'GTK 3.0 development libraries are required for Linux development.\n' 'They are likely available from your distribution (e.g.: apt install libgtk-3-dev)'; + String get eglinfoMissing => + "Unable to access driver information using 'eglinfo'.\n" + 'It is likely available from your distribution (e.g.: apt install mesa-utils)'; // Messages used in FlutterCommand String flutterElapsedTime(String name, String elapsedTime) => diff --git a/packages/flutter_tools/lib/src/linux/linux_doctor.dart b/packages/flutter_tools/lib/src/linux/linux_doctor.dart index bab8ae7a455..05c7641105f 100644 --- a/packages/flutter_tools/lib/src/linux/linux_doctor.dart +++ b/packages/flutter_tools/lib/src/linux/linux_doctor.dart @@ -7,6 +7,7 @@ import 'package:process/process.dart'; import '../base/io.dart'; import '../base/user_messages.dart'; import '../base/version.dart'; +import '../convert.dart'; import '../doctor_validator.dart'; /// A combination of version description and parsed version number. @@ -29,6 +30,87 @@ class _VersionInfo { Version? number; } +/// Information about graphics drivers. +class _DriverInformation { + _DriverInformation({required ProcessManager processManager}) : _processManager = processManager; + + final ProcessManager _processManager; + List> _sections = >[]; + + Future load() async { + ProcessResult? result; + try { + result = await _processManager.run(['eglinfo'], stdoutEncoding: utf8); + } on ArgumentError { + // ignore error. + } + if (result == null || result.exitCode != 0) { + return false; + } + + // Break into sections separated by an empty line. + final List lines = (result.stdout as String).split('\n'); + final List> sections = >[[]]; + for (final String line in lines) { + if (line == '') { + if (sections.last.isNotEmpty) { + sections.add([]); + } + } else { + sections.last.add(line); + } + } + if (sections.last.isEmpty) { + sections.removeLast(); + } + _sections = sections; + + return true; + } + + List? _getSection(String sectionName) { + for (final List lines in _sections) { + if (lines[0] == '$sectionName:') { + return lines; + } + } + + return null; + } + + // Extracts a variable from eglinfo output. + String? getVariable(String sectionName, String name) { + final List? lines = _getSection(sectionName); + if (lines == null) { + return null; + } + + final String prefix = '$name:'; + for (int i = 0; i < lines.length; i++) { + if (lines[i].startsWith(prefix)) { + String value = lines[i].substring(prefix.length).trim(); + // Combine multi-line indented values. + if (value == '') { + for (int j = i + 1; j < lines.length && lines[j].startsWith(' '); j++) { + if (value == '') { + value += ' '; + } + value += lines[j].trim(); + } + } + return value; + } + } + + return null; + } + + // Extracts a comma separated list variable. + List? getListVariable(String sectionName, String name) { + return getVariable(sectionName, name)?.split(',').map((String s) => s.trim()).toList(); + } +} + /// A validator that checks for Clang and Make build dependencies. class LinuxDoctorValidator extends DoctorValidator { LinuxDoctorValidator({required ProcessManager processManager, required UserMessages userMessages}) @@ -160,6 +242,94 @@ class LinuxDoctorValidator extends DoctorValidator { } } + // Messages for drivers. + { + final _DriverInformation driverInfo = _DriverInformation(processManager: _processManager); + if (!await driverInfo.load()) { + messages.add(ValidationMessage.hint(_userMessages.eglinfoMissing)); + } else { + const String kWaylandPlatform = 'Wayland platform'; + const String kX11Platform = 'X11 platform'; + const String kOpenGLCoreProfileRenderer = 'OpenGL core profile renderer'; + const String kOpenGLCoreProfileShadingLanguageVersion = + 'OpenGL core profile shading language version'; + const String kOpenGLCoreProfileVersion = 'OpenGL core profile version'; + const String kOpenGLCoreProfileExtensions = 'OpenGL core profile extensions'; + const String kOpenGLESProfileRenderer = 'OpenGL ES profile renderer'; + const String kOpenGLESProfileVersion = 'OpenGL ES profile version'; + const String kOpenGLESProfileShadingLanguageVersion = + 'OpenGL ES profile shading language version'; + const String kOpenGLESProfileExtensions = 'OpenGL ES profile extensions'; + + // Check both Wayland and X11 platforms for value. + String? getPlatformVariable(String name) { + final String? waylandValue = driverInfo.getVariable(kWaylandPlatform, name); + final String? x11Value = driverInfo.getVariable(kX11Platform, name); + if (waylandValue == null && x11Value == null) { + return null; + } + + if (waylandValue == null) { + return '$x11Value (X11)'; + } else if (x11Value == null) { + return '$waylandValue (Wayland)'; + } else if (waylandValue == x11Value) { + return waylandValue; + } else { + return '$waylandValue (Wayland) $x11Value (X11)'; + } + } + + // Check if has specified OpenGL extension. + ValidationMessage extensionStatus(String variableName, String extensionName) { + final List waylandExtensions = + driverInfo.getListVariable(kWaylandPlatform, variableName) ?? []; + final List x11Extensions = + driverInfo.getListVariable(kX11Platform, variableName) ?? []; + + final bool hasWayland = waylandExtensions.contains(extensionName); + final bool hasX11 = x11Extensions.contains(extensionName); + String status; + if (!hasWayland && !hasX11) { + status = 'no'; + } else if (!hasWayland) { + status = 'yes (X11)'; + } else if (!hasX11) { + status = 'yes (Wayland)'; + } else { + status = 'yes'; + } + + return ValidationMessage('$extensionName: $status'); + } + + final String? renderer = getPlatformVariable(kOpenGLCoreProfileRenderer); + if (renderer != null) { + messages.add(ValidationMessage('OpenGL core renderer: $renderer')); + final String version = getPlatformVariable(kOpenGLCoreProfileVersion) ?? 'unknown'; + messages.add(ValidationMessage('OpenGL core version: $version')); + final String shadingLanguageVersion = + getPlatformVariable(kOpenGLCoreProfileShadingLanguageVersion) ?? 'unknown'; + messages.add( + ValidationMessage('OpenGL core shading language version: $shadingLanguageVersion'), + ); + } + final String? esRenderer = getPlatformVariable(kOpenGLESProfileRenderer); + if (esRenderer != null) { + messages.add(ValidationMessage('OpenGL ES renderer: $esRenderer')); + final String version = getPlatformVariable(kOpenGLESProfileVersion) ?? 'unknown'; + messages.add(ValidationMessage('OpenGL ES version: $version')); + final String shadingLanguageVersion = + getPlatformVariable(kOpenGLESProfileShadingLanguageVersion) ?? 'unknown'; + messages.add( + ValidationMessage('OpenGL ES shading language version: $shadingLanguageVersion'), + ); + } + messages.add(extensionStatus(kOpenGLCoreProfileExtensions, 'GL_EXT_framebuffer_blit')); + messages.add(extensionStatus(kOpenGLESProfileExtensions, 'GL_EXT_texture_format_BGRA8888')); + } + } + return ValidationResult(validationType, messages); } diff --git a/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart b/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart index e3fbb036b02..ef948a39fe1 100644 --- a/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart +++ b/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart @@ -67,6 +67,102 @@ List _gtkLibrariesPresentCommands() { ]; } +// A command that will return typical-looking 'eglinfo' output +FakeCommand _eglinfoPresentCommand({ + bool wayland = true, + bool x11 = true, + bool core = true, + bool es = true, +}) { + String stdout = ''' +EGL client extensions string: + EGL_EXT_client_extensions +'''; + + if (wayland) { + stdout += ''' + +Wayland platform: +EGL API version: 1.5 +EGL vendor string: Mesa Project +EGL version string: 1.5 +EGL driver name: iris +'''; + if (core) { + stdout += ''' +OpenGL core profile vendor: Intel +OpenGL core profile renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2) +OpenGL core profile version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1 +OpenGL core profile shading language version: 4.60 +OpenGL core profile extensions: + GL_ARB_blend_func_extended, GL_EXT_framebuffer_blit +'''; + } + if (es) { + stdout += ''' +OpenGL ES profile vendor: Intel +OpenGL ES profile renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2) +OpenGL ES profile version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1 +OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20 +OpenGL ES profile extensions: + GL_EXT_EGL_image_storage, GL_EXT_texture_format_BGRA8888 +'''; + } + stdout += ''' +Configurations: + bf lv colorbuffer dp st ms vis cav bi renderable supported + id sz l r g b a th cl ns b id eat nd gl es es2 vg surfaces +--------------------------------------------------------------------- +0x01 32 0 10 10 10 2 0 0 0 0 0x00-- y y y win +'''; + } + + if (x11) { + stdout += ''' + +X11 platform: +EGL API version: 1.5 +EGL vendor string: Mesa Project +EGL version string: 1.5 +EGL driver name: iris +'''; + if (core) { + stdout += ''' +OpenGL core profile vendor: Intel +OpenGL core profile renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2) +OpenGL core profile version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1 +OpenGL core profile shading language version: 4.60 +OpenGL core profile extensions: + GL_ARB_blend_func_extended, GL_EXT_framebuffer_blit +'''; + } + if (es) { + stdout += ''' +OpenGL ES profile vendor: Intel +OpenGL ES profile renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2) +OpenGL ES profile version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1 +OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20 +OpenGL ES profile extensions: + GL_EXT_EGL_image_storage, GL_EXT_texture_format_BGRA8888 +'''; + } + stdout += ''' +Configurations: + bf lv colorbuffer dp st ms vis cav bi renderable supported + id sz l r g b a th cl ns b id eat nd gl es es2 vg surfaces +--------------------------------------------------------------------- +0x01 32 0 10 10 10 2 0 0 0 0 0x00-- y y y win +'''; + } + + return FakeCommand(command: const ['eglinfo'], stdout: stdout); +} + +// A command that will failure when running 'eglinfo'. +FakeCommand _eglinfoMissingCommand() { + return const FakeCommand(command: ['eglinfo'], exitCode: 1); +} + // Commands that give some failures for the GTK library pkg-config queries. List _gtkLibrariesMissingCommands() { return [ @@ -100,6 +196,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( processManager: processManager, @@ -113,6 +210,14 @@ void main() { ValidationMessage('cmake version 3.16.3'), ValidationMessage('ninja version 1.10.0'), ValidationMessage('pkg-config version 0.29'), + ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL core shading language version: 4.60'), + ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + ValidationMessage('GL_EXT_framebuffer_blit: yes'), + ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }, ); @@ -124,6 +229,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( processManager: processManager, @@ -138,6 +244,14 @@ void main() { ValidationMessage('cmake version 3.16.3'), ValidationMessage('ninja version 1.10.0'), ValidationMessage('pkg-config version 0.29'), + ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL core shading language version: 4.60'), + ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + ValidationMessage('GL_EXT_framebuffer_blit: yes'), + ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -148,6 +262,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( processManager: processManager, @@ -162,6 +277,14 @@ void main() { ValidationMessage.error('cmake 3.10.0 or later is required.'), ValidationMessage('ninja version 1.10.0'), ValidationMessage('pkg-config version 0.29'), + ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL core shading language version: 4.60'), + ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + ValidationMessage('GL_EXT_framebuffer_blit: yes'), + ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -172,6 +295,7 @@ void main() { _ninjaPresentCommand('0.8.1'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( processManager: processManager, @@ -186,6 +310,14 @@ void main() { ValidationMessage('ninja version 0.8.1'), ValidationMessage.error('ninja 1.8.0 or later is required.'), ValidationMessage('pkg-config version 0.29'), + ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL core shading language version: 4.60'), + ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + ValidationMessage('GL_EXT_framebuffer_blit: yes'), + ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -196,6 +328,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('0.27.0'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( processManager: processManager, @@ -210,6 +343,14 @@ void main() { ValidationMessage('ninja version 1.10.0'), ValidationMessage('pkg-config version 0.27.0'), ValidationMessage.error('pkg-config 0.29.0 or later is required.'), + ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL core shading language version: 4.60'), + ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + ValidationMessage('GL_EXT_framebuffer_blit: yes'), + ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -244,6 +385,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final UserMessages userMessages = UserMessages(); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( @@ -258,6 +400,16 @@ void main() { ValidationMessage.error(userMessages.cmakeMissing), const ValidationMessage('ninja version 1.10.0'), const ValidationMessage('pkg-config version 0.29'), + const ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage( + 'OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1', + ), + const ValidationMessage('OpenGL core shading language version: 4.60'), + const ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + const ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + const ValidationMessage('GL_EXT_framebuffer_blit: yes'), + const ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -268,6 +420,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final UserMessages userMessages = UserMessages(); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( @@ -282,6 +435,16 @@ void main() { ValidationMessage.error(userMessages.cmakeMissing), const ValidationMessage('ninja version 1.10.0'), const ValidationMessage('pkg-config version 0.29'), + const ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage( + 'OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1', + ), + const ValidationMessage('OpenGL core shading language version: 4.60'), + const ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + const ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + const ValidationMessage('GL_EXT_framebuffer_blit: yes'), + const ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -292,6 +455,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final UserMessages userMessages = UserMessages(); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( @@ -306,6 +470,16 @@ void main() { const ValidationMessage('cmake version 3.16.3'), const ValidationMessage('ninja version 1.10.0'), const ValidationMessage('pkg-config version 0.29'), + const ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage( + 'OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1', + ), + const ValidationMessage('OpenGL core shading language version: 4.60'), + const ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + const ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + const ValidationMessage('GL_EXT_framebuffer_blit: yes'), + const ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -316,6 +490,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final UserMessages userMessages = UserMessages(); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( @@ -330,6 +505,16 @@ void main() { const ValidationMessage('cmake version 3.16.3'), const ValidationMessage('ninja version 1.10.0'), const ValidationMessage('pkg-config version 0.29'), + const ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage( + 'OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1', + ), + const ValidationMessage('OpenGL core shading language version: 4.60'), + const ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + const ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + const ValidationMessage('GL_EXT_framebuffer_blit: yes'), + const ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -340,6 +525,7 @@ void main() { _missingBinaryCommand('ninja'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final UserMessages userMessages = UserMessages(); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( @@ -354,6 +540,16 @@ void main() { const ValidationMessage('cmake version 3.16.3'), ValidationMessage.error(userMessages.ninjaMissing), const ValidationMessage('pkg-config version 0.29'), + const ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage( + 'OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1', + ), + const ValidationMessage('OpenGL core shading language version: 4.60'), + const ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + const ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + const ValidationMessage('GL_EXT_framebuffer_blit: yes'), + const ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -364,6 +560,7 @@ void main() { _ninjaPresentCommand('bogus'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final UserMessages userMessages = UserMessages(); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( @@ -378,6 +575,16 @@ void main() { const ValidationMessage('cmake version 3.16.3'), ValidationMessage.error(userMessages.ninjaMissing), const ValidationMessage('pkg-config version 0.29'), + const ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage( + 'OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1', + ), + const ValidationMessage('OpenGL core shading language version: 4.60'), + const ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + const ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + const ValidationMessage('GL_EXT_framebuffer_blit: yes'), + const ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -388,6 +595,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _missingBinaryCommand('pkg-config'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final UserMessages userMessages = UserMessages(); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( @@ -412,6 +620,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('bogus'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final UserMessages userMessages = UserMessages(); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( @@ -436,6 +645,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesMissingCommands(), + _eglinfoPresentCommand(), ]); final UserMessages userMessages = UserMessages(); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( @@ -451,6 +661,16 @@ void main() { const ValidationMessage('ninja version 1.10.0'), const ValidationMessage('pkg-config version 0.29'), ValidationMessage.error(userMessages.gtkLibrariesMissing), + const ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage( + 'OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1', + ), + const ValidationMessage('OpenGL core shading language version: 4.60'), + const ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + const ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + const ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + const ValidationMessage('GL_EXT_framebuffer_blit: yes'), + const ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), ]); }); @@ -461,6 +681,7 @@ void main() { _ninjaPresentCommand('1.10.0'), _pkgConfigPresentCommand('0.29'), ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(), ]); final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( processManager: processManager, @@ -470,4 +691,156 @@ void main() { final ValidationResult result = await linuxDoctorValidator.validate(); expect(result.type, ValidationType.missing); }); + + testWithoutContext('Warning when eglinfo not available', () async { + final UserMessages userMessages = UserMessages(); + final ProcessManager processManager = FakeProcessManager.list([ + _clangPresentCommand('4.0.1'), + _cmakePresentCommand('3.16.3'), + _ninjaPresentCommand('1.10.0'), + _pkgConfigPresentCommand('0.29'), + ..._gtkLibrariesPresentCommands(), + _eglinfoMissingCommand(), + ]); + final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( + processManager: processManager, + userMessages: userMessages, + ); + final ValidationResult result = await linuxDoctorValidator.validate(); + + expect(result.type, ValidationType.success); + expect(result.messages, [ + const ValidationMessage('clang version 4.0.1-6+build1'), + const ValidationMessage('cmake version 3.16.3'), + const ValidationMessage('ninja version 1.10.0'), + const ValidationMessage('pkg-config version 0.29'), + ValidationMessage.hint(userMessages.eglinfoMissing), + ]); + }); + + testWithoutContext('Wayland only platform', () async { + final ProcessManager processManager = FakeProcessManager.list([ + _clangPresentCommand('4.0.1'), + _cmakePresentCommand('3.16.3'), + _ninjaPresentCommand('1.10.0'), + _pkgConfigPresentCommand('0.29'), + ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(x11: false), + ]); + final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( + processManager: processManager, + userMessages: UserMessages(), + ); + final ValidationResult result = await linuxDoctorValidator.validate(); + + expect(result.type, ValidationType.success); + expect(result.messages, const [ + ValidationMessage('clang version 4.0.1-6+build1'), + ValidationMessage('cmake version 3.16.3'), + ValidationMessage('ninja version 1.10.0'), + ValidationMessage('pkg-config version 0.29'), + ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2) (Wayland)'), + ValidationMessage( + 'OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1 (Wayland)', + ), + ValidationMessage('OpenGL core shading language version: 4.60 (Wayland)'), + ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2) (Wayland)'), + ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1 (Wayland)'), + ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20 (Wayland)'), + ValidationMessage('GL_EXT_framebuffer_blit: yes (Wayland)'), + ValidationMessage('GL_EXT_texture_format_BGRA8888: yes (Wayland)'), + ]); + }); + + testWithoutContext('X11 only platform', () async { + final ProcessManager processManager = FakeProcessManager.list([ + _clangPresentCommand('4.0.1'), + _cmakePresentCommand('3.16.3'), + _ninjaPresentCommand('1.10.0'), + _pkgConfigPresentCommand('0.29'), + ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(wayland: false), + ]); + final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( + processManager: processManager, + userMessages: UserMessages(), + ); + final ValidationResult result = await linuxDoctorValidator.validate(); + + expect(result.type, ValidationType.success); + expect(result.messages, const [ + ValidationMessage('clang version 4.0.1-6+build1'), + ValidationMessage('cmake version 3.16.3'), + ValidationMessage('ninja version 1.10.0'), + ValidationMessage('pkg-config version 0.29'), + ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2) (X11)'), + ValidationMessage( + 'OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1 (X11)', + ), + ValidationMessage('OpenGL core shading language version: 4.60 (X11)'), + ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2) (X11)'), + ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1 (X11)'), + ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20 (X11)'), + ValidationMessage('GL_EXT_framebuffer_blit: yes (X11)'), + ValidationMessage('GL_EXT_texture_format_BGRA8888: yes (X11)'), + ]); + }); + + testWithoutContext('No OpenGL ES', () async { + final ProcessManager processManager = FakeProcessManager.list([ + _clangPresentCommand('4.0.1'), + _cmakePresentCommand('3.16.3'), + _ninjaPresentCommand('1.10.0'), + _pkgConfigPresentCommand('0.29'), + ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(es: false), + ]); + final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( + processManager: processManager, + userMessages: UserMessages(), + ); + final ValidationResult result = await linuxDoctorValidator.validate(); + + expect(result.type, ValidationType.success); + expect(result.messages, const [ + ValidationMessage('clang version 4.0.1-6+build1'), + ValidationMessage('cmake version 3.16.3'), + ValidationMessage('ninja version 1.10.0'), + ValidationMessage('pkg-config version 0.29'), + ValidationMessage('OpenGL core renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL core version: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL core shading language version: 4.60'), + ValidationMessage('GL_EXT_framebuffer_blit: yes'), + ValidationMessage('GL_EXT_texture_format_BGRA8888: no'), + ]); + }); + + testWithoutContext('No OpenGL core', () async { + final ProcessManager processManager = FakeProcessManager.list([ + _clangPresentCommand('4.0.1'), + _cmakePresentCommand('3.16.3'), + _ninjaPresentCommand('1.10.0'), + _pkgConfigPresentCommand('0.29'), + ..._gtkLibrariesPresentCommands(), + _eglinfoPresentCommand(core: false), + ]); + final DoctorValidator linuxDoctorValidator = LinuxDoctorValidator( + processManager: processManager, + userMessages: UserMessages(), + ); + final ValidationResult result = await linuxDoctorValidator.validate(); + + expect(result.type, ValidationType.success); + expect(result.messages, const [ + ValidationMessage('clang version 4.0.1-6+build1'), + ValidationMessage('cmake version 3.16.3'), + ValidationMessage('ninja version 1.10.0'), + ValidationMessage('pkg-config version 0.29'), + ValidationMessage('OpenGL ES renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)'), + ValidationMessage('OpenGL ES version: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.10.1'), + ValidationMessage('OpenGL ES shading language version: OpenGL ES GLSL ES 3.20'), + ValidationMessage('GL_EXT_framebuffer_blit: no'), + ValidationMessage('GL_EXT_texture_format_BGRA8888: yes'), + ]); + }); }