aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amdfalconx86
diff options
context:
space:
mode:
authorAwais Belal <awais_belal@mentor.com>2016-11-11 14:54:24 +0500
committerAwais Belal <awais_belal@mentor.com>2016-11-11 14:57:09 +0500
commit2244ac6dbba5fc841ee896fd97d24c3a49f4b272 (patch)
tree5e34059ea840bf9f745eaef5d5a6bd32dd411572 /meta-amdfalconx86
parentb02508bcb2913dfcc98120a7351dcec729d88210 (diff)
downloadmeta-amd-2244ac6dbba5fc841ee896fd97d24c3a49f4b272.tar.gz
meta-amd-2244ac6dbba5fc841ee896fd97d24c3a49f4b272.tar.bz2
meta-amd-2244ac6dbba5fc841ee896fd97d24c3a49f4b272.zip
vulkan-loader-layers: fix segfault on vulkaninfo
The vulkaninfo command segfaults if the DISPLAY environment variable is not set because it uses xlib and xcb interfaces which in a way that assumes availability of the said variable. We now explicitly check such scenarios to avoid segfaulting and provide user with a bit of detail. Signed-off-by: Awais Belal <awais_belal@mentor.com>
Diffstat (limited to 'meta-amdfalconx86')
-rw-r--r--meta-amdfalconx86/recipes-graphics/lunarg-sdk/vulkan-loader-layers/0009-vulkaninfo.c-fix-segfault-when-DISPLAY-is-not-set.patch67
-rw-r--r--meta-amdfalconx86/recipes-graphics/lunarg-sdk/vulkan-loader-layers_1.0.26.bb3
2 files changed, 69 insertions, 1 deletions
diff --git a/meta-amdfalconx86/recipes-graphics/lunarg-sdk/vulkan-loader-layers/0009-vulkaninfo.c-fix-segfault-when-DISPLAY-is-not-set.patch b/meta-amdfalconx86/recipes-graphics/lunarg-sdk/vulkan-loader-layers/0009-vulkaninfo.c-fix-segfault-when-DISPLAY-is-not-set.patch
new file mode 100644
index 00000000..25785ffb
--- /dev/null
+++ b/meta-amdfalconx86/recipes-graphics/lunarg-sdk/vulkan-loader-layers/0009-vulkaninfo.c-fix-segfault-when-DISPLAY-is-not-set.patch
@@ -0,0 +1,67 @@
+From b73227e97086116e596206b22ce0356bfc9b0a2c Mon Sep 17 00:00:00 2001
+From: Awais Belal <awais_belal@mentor.com>
+Date: Fri, 11 Nov 2016 14:48:54 +0500
+Subject: [PATCH] vulkaninfo.c: fix segfault when DISPLAY is not set
+
+Both xlib and xcb interfaces expect the DISPLAY environment
+variable to be set before creation of a window and the
+display creation mechanism would segfault if that is
+not the case and won't provide the user with details on
+what has to be done to correct the problem.
+We now handle such scenarios and exit cleanly after
+providing the user with some details.
+
+Signed-off-by: Awais Belal <awais_belal@mentor.com>
+---
+ demos/vulkaninfo.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/demos/vulkaninfo.c b/demos/vulkaninfo.c
+index 324720c..da0a7c3 100644
+--- a/demos/vulkaninfo.c
++++ b/demos/vulkaninfo.c
+@@ -900,6 +900,9 @@ static void app_create_xlib_window(struct app_instance *inst) {
+ long visualMask = VisualScreenMask;
+ int numberOfVisuals;
+
++ if (inst->xlib_display == NULL)
++ return;
++
+ XVisualInfo vInfoTemplate={};
+ vInfoTemplate.screen = DefaultScreen(inst->xlib_display);
+ XVisualInfo *visualInfo = XGetVisualInfo(inst->xlib_display, visualMask,
+@@ -1488,6 +1491,12 @@ int main(int argc, char **argv) {
+ app_destroy_win32_window(&inst);
+ }
+ #endif
++#if defined(VK_USE_PLATFORM_XCB_KHR) || defined(VK_USE_PLATFORM_XLIB_KHR)
++ if (getenv("DISPLAY") == NULL) {
++ printf("'DISPLAY' environment variable not set... Exiting!\n");
++ goto out;
++ }
++#endif
+ //--XCB--
+ #ifdef VK_USE_PLATFORM_XCB_KHR
+ if (has_extension(VK_KHR_XCB_SURFACE_EXTENSION_NAME,
+@@ -1508,6 +1517,10 @@ int main(int argc, char **argv) {
+ if (has_extension(VK_KHR_XLIB_SURFACE_EXTENSION_NAME,
+ inst.global_extension_count, inst.global_extensions)) {
+ app_create_xlib_window(&inst);
++ if (inst.xlib_display == NULL) {
++ printf("'DISPLAY' variable not set correctly. Exiting!\n'");
++ goto out;
++ }
+ for (i = 0; i < gpu_count; i++) {
+ app_create_xlib_surface(&inst);
+ printf("GPU id : %u (%s)\n", i, gpus[i].props.deviceName);
+@@ -1528,6 +1541,7 @@ int main(int argc, char **argv) {
+ printf("\n\n");
+ }
+
++out:
+ for (i = 0; i < gpu_count; i++)
+ app_gpu_destroy(&gpus[i]);
+
+--
+1.9.1
+
diff --git a/meta-amdfalconx86/recipes-graphics/lunarg-sdk/vulkan-loader-layers_1.0.26.bb b/meta-amdfalconx86/recipes-graphics/lunarg-sdk/vulkan-loader-layers_1.0.26.bb
index 0891de49..e18e7353 100644
--- a/meta-amdfalconx86/recipes-graphics/lunarg-sdk/vulkan-loader-layers_1.0.26.bb
+++ b/meta-amdfalconx86/recipes-graphics/lunarg-sdk/vulkan-loader-layers_1.0.26.bb
@@ -26,7 +26,8 @@ SRC_URI = "git://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers;branch
file://0004-install-the-vulkan-loader.patch \
file://0005-install-demos.patch \
file://0006-json-correct-layer-lib-paths.patch \
- file://0008-demos-make-shader-location-relative.patch"
+ file://0008-demos-make-shader-location-relative.patch \
+ file://0009-vulkaninfo.c-fix-segfault-when-DISPLAY-is-not-set.patch"
EXTRA_OECMAKE = " \
-DCUSTOM_GLSLANG_BIN_ROOT=1 \