[Mesa-dev] [PATCH 3/3] dri: fixup driver names if needed

Christian Gmeiner christian.gmeiner at gmail.com
Thu Nov 3 14:25:22 UTC 2016


This makes it possible to 'use' the imx-drm driver. Remeber that it
is not possible to have sysmbol names in C/C++ with a '-' in it.

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 include/GL/internal/dri_interface.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 36ba65e..4ec3211 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -42,6 +42,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <dlfcn.h>
 #ifdef HAVE_LIBDRM
 #include <drm.h>
@@ -617,6 +618,12 @@ dri_get_extensions_name(const char *driver_name)
 	if (asprintf(&name, "%s_%s", __DRI_DRIVER_GET_EXTENSIONS, driver_name) < 0)
 		return NULL;
 
+	const size_t len = strlen(name);
+	for (size_t i = 0; i < len; i++) {
+		if (name[i] == '-')
+			name[i] = '_';
+	}
+
 	return name;
 }
 
-- 
2.7.4



More information about the mesa-dev mailing list