From 681422fe5950c8b29876e7ef0c03b8cbcfcd8a39 Mon Sep 17 00:00:00 2001
From: Ludovico de Nittis <ludovico.denittis@collabora.com>
Date: Thu, 22 Apr 2021 10:52:43 +0200
Subject: [PATCH] runtime: Add warning if $PLATFORM expansion cannot be
 detected

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
---
 pressure-vessel/runtime.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/pressure-vessel/runtime.c b/pressure-vessel/runtime.c
index 36cd71f4f..645955af7 100644
--- a/pressure-vessel/runtime.c
+++ b/pressure-vessel/runtime.c
@@ -4596,6 +4596,7 @@ pv_runtime_use_provider_graphics_stack (PvRuntime *self,
           g_autofree gchar *libdrm = NULL;
           g_autofree gchar *libdrm_amdgpu = NULL;
           g_autofree gchar *libglx_mesa = NULL;
+          g_autofree gchar *platform_token = NULL;
           g_autoptr(GPtrArray) patterns = NULL;
 
           if (!pv_runtime_get_ld_so (self, arch, &ld_so_in_runtime, error))
@@ -4769,6 +4770,17 @@ pv_runtime_use_provider_graphics_stack (PvRuntime *self,
                                                 platform_link, arch->details->tuple);
             }
 
+          platform_token = srt_system_info_dup_libdl_platform (system_info,
+                                                               multiarch_tuples[i],
+                                                               &local_error);
+          if (platform_token == NULL)
+            {
+              /* This is not a critical error, try to continue */
+              g_warning ("The dynamic linker expansion of \"$PLATFORM\" is not what we "
+                         "expected, VDPAU drivers might not work: %s", local_error->message);
+              g_clear_error (&local_error);
+            }
+
           if (!pv_runtime_create_aliases (self, arch, &local_error))
             {
               /* This is not a critical error, try to continue */
-- 
GitLab