Skip to content
Snippets Groups Projects
Commit 6dbb3c5e authored by Ludovico de Nittis's avatar Ludovico de Nittis :palm_tree:
Browse files

graphics: Add detection of Primus graphics driver


We are now able to detect when the Primus graphics driver is in use.

Signed-off-by: default avatarLudovico de Nittis <ludovico.denittis@collabora.com>
parent 73d56251
No related branches found
No related tags found
1 merge request!166graphics: Add detection of Primus graphics driver
Pipeline #5153 passed
...@@ -786,8 +786,8 @@ _argv_for_list_glx_icds_in_path (const char *helpers_path, ...@@ -786,8 +786,8 @@ _argv_for_list_glx_icds_in_path (const char *helpers_path,
* This function returns %SRT_GRAPHICS_DRIVER_VENDOR_GLVND. * This function returns %SRT_GRAPHICS_DRIVER_VENDOR_GLVND.
* *
* For older GLX and EGL graphics stacks, the entry-point library libGL.so.1 or libEGL.so.1 * For older GLX and EGL graphics stacks, the entry-point library libGL.so.1 or libEGL.so.1
* is part of a particular vendor's graphics library, usually Mesa or NVIDIA. This function * is part of a particular vendor's graphics library, usually Mesa, NVIDIA or Primus. This
* attempts to determine which one. * function attempts to determine which one.
* *
* For Vulkan the entry-point library libvulkan.so.1 is always vendor-neutral * For Vulkan the entry-point library libvulkan.so.1 is always vendor-neutral
* (similar to GLVND), so this function is not useful. It always returns * (similar to GLVND), so this function is not useful. It always returns
...@@ -808,6 +808,8 @@ _srt_check_library_vendor (gchar **envp, ...@@ -808,6 +808,8 @@ _srt_check_library_vendor (gchar **envp,
SrtLibrary *library = NULL; SrtLibrary *library = NULL;
SrtLibraryIssues issues; SrtLibraryIssues issues;
const char * const *dependencies; const char * const *dependencies;
gboolean have_libstdc_deps = FALSE;
gboolean have_libxcb_deps = FALSE;
g_return_val_if_fail (envp != NULL, SRT_GRAPHICS_LIBRARY_VENDOR_UNKNOWN); g_return_val_if_fail (envp != NULL, SRT_GRAPHICS_LIBRARY_VENDOR_UNKNOWN);
...@@ -858,6 +860,21 @@ _srt_check_library_vendor (gchar **envp, ...@@ -858,6 +860,21 @@ _srt_check_library_vendor (gchar **envp,
library_vendor = SRT_GRAPHICS_LIBRARY_VENDOR_NVIDIA; library_vendor = SRT_GRAPHICS_LIBRARY_VENDOR_NVIDIA;
break; break;
} }
if (strstr (dependencies[i], "/libstdc++.so.") != NULL)
{
have_libstdc_deps = TRUE;
}
if (strstr (dependencies[i], "/libxcb.so.") != NULL)
{
have_libxcb_deps = TRUE;
}
}
if (library_vendor == SRT_GRAPHICS_LIBRARY_VENDOR_UNKNOWN_NON_GLVND &&
have_libstdc_deps &&
!have_libxcb_deps)
{
library_vendor = SRT_GRAPHICS_LIBRARY_VENDOR_PRIMUS;
} }
out: out:
......
...@@ -86,6 +86,7 @@ typedef enum ...@@ -86,6 +86,7 @@ typedef enum
* but the exact vendor is unknown * but the exact vendor is unknown
* @SRT_GRAPHICS_LIBRARY_VENDOR_MESA: The graphics driver is the mesa non-GLVND * @SRT_GRAPHICS_LIBRARY_VENDOR_MESA: The graphics driver is the mesa non-GLVND
* @SRT_GRAPHICS_LIBRARY_VENDOR_NVIDIA: The graphics driver is the Nvidia non-GLVND * @SRT_GRAPHICS_LIBRARY_VENDOR_NVIDIA: The graphics driver is the Nvidia non-GLVND
* @SRT_GRAPHICS_LIBRARY_VENDOR_PRIMUS: The graphics driver is the Primus non-GLVND
*/ */
typedef enum typedef enum
{ {
...@@ -94,6 +95,7 @@ typedef enum ...@@ -94,6 +95,7 @@ typedef enum
SRT_GRAPHICS_LIBRARY_VENDOR_UNKNOWN_NON_GLVND, SRT_GRAPHICS_LIBRARY_VENDOR_UNKNOWN_NON_GLVND,
SRT_GRAPHICS_LIBRARY_VENDOR_MESA, SRT_GRAPHICS_LIBRARY_VENDOR_MESA,
SRT_GRAPHICS_LIBRARY_VENDOR_NVIDIA, SRT_GRAPHICS_LIBRARY_VENDOR_NVIDIA,
SRT_GRAPHICS_LIBRARY_VENDOR_PRIMUS,
} SrtGraphicsLibraryVendor; } SrtGraphicsLibraryVendor;
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment