gpu-info: consider "(Core Profile)" GL version annotation
Mesa annotates the GL version string with "(Core Profile)" when using the OpenGL 3 core profile and so our heuristics that try and determine what vendor and GPU is being used where being confused. This updates the check_mesa_driver_package() function to consider this optional annotation. This adds a small unit test to verify the parsing of some example version strings. We can update this with more real world version strings if the format changes again in the future. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 1a074173d20857c7bedb6a862958713e5ef8d2d1)
This commit is contained in:
parent
2f9a0a2c97
commit
8de1f83b1c
@ -28,6 +28,8 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <test-fixtures/test-unit.h>
|
||||
|
||||
#include "cogl-gpu-info-private.h"
|
||||
#include "cogl-context-private.h"
|
||||
#include "cogl-version.h"
|
||||
@ -415,8 +417,10 @@ check_mesa_driver_package (const CoglGpuInfoStrings *strings,
|
||||
NULL /* version_ret */))
|
||||
return FALSE;
|
||||
|
||||
/* In mesa this will be followed by a space and the name "Mesa" */
|
||||
if (!g_str_has_prefix (v, " Mesa "))
|
||||
/* In mesa this will be followed optionally by "(Core Profile)" and
|
||||
* then "Mesa" */
|
||||
v = strstr (v, " Mesa ");
|
||||
if (!v)
|
||||
return FALSE;
|
||||
|
||||
v += 6;
|
||||
@ -451,6 +455,24 @@ check_mesa_driver_package (const CoglGpuInfoStrings *strings,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UNIT_TEST (check_mesa_driver_package_parser,
|
||||
0, /* no requirements */
|
||||
0 /* no failure cases */)
|
||||
{
|
||||
const CoglGpuInfoStrings test_strings[] = {
|
||||
{ .version_string = "3.1 Mesa 9.2-devel15436ad" },
|
||||
{ .version_string = "3.1 (Core Profile) Mesa 9.2.0-devel (git-15436ad)" }
|
||||
};
|
||||
int i;
|
||||
int version;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (test_strings); i++)
|
||||
{
|
||||
g_assert (check_mesa_driver_package (&test_strings[i], &version));
|
||||
g_assert_cmpint (version, ==, COGL_VERSION_ENCODE (9, 2, 0));
|
||||
}
|
||||
}
|
||||
|
||||
static CoglBool
|
||||
check_unknown_driver_package (const CoglGpuInfoStrings *strings,
|
||||
int *version_out)
|
||||
|
Loading…
Reference in New Issue
Block a user