Commit 844212cf authored by Chuck Atkins's avatar Chuck Atkins Committed by Kitware Robot
Browse files

Merge topic 'add-expat'

daa37b56 Disable mesa-swr tests until VTK segfault is addressed
f9b8afc2 Update regex for SWR diagnostic messages
7ff65ebb mesa: fix segfault when swr is selected but not supported
40a23354

 Add expat for mesa dependencies
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !414
parents 9759aa1a daa37b56
......@@ -96,6 +96,7 @@ function (superbuild_find_projects var)
boxlib
catalyst
egl
expat
fontconfig
glproto
gperf
......
......@@ -111,6 +111,9 @@ if (python_enabled AND USE_SYSTEM_python AND NOT python_FIND_LIBRARIES)
set(PARAVIEW_ENABLE_PYTHON OFF)
endif()
if (expat_ENABLED)
list(APPEND paraviews_platform_dependencies expat)
endif ()
superbuild_add_project(paraview
DEBUGGABLE
......@@ -157,6 +160,7 @@ superbuild_add_project(paraview
-DVTK_USE_SYSTEM_LIBXML2:BOOL=${libxml2_enabled}
-DVTK_USE_SYSTEM_PNG:BOOL=${png_enabled}
-DVTK_USE_SYSTEM_ZLIB:BOOL=${zlib_enabled}
-DVTK_USE_SYSTEM_EXPAT:BOOL=${expat_enabled}
-DModule_vtkIOADIOS:BOOL=${adios_enabled}
-DVTK_SMP_IMPLEMENTATION_TYPE:STRING=${paraview_smp_backend}
-DVTK_LEGACY_REMOVE:BOOL=ON
......
if(BUILD_SHARED_LIBS)
set(expat_args_shared --enable-shared --disable-static)
else()
set(expat_args_shared --disable-shared --enable-static)
endif()
superbuild_add_project(expat
CAN_USE_SYSTEM
CONFIGURE_COMMAND
<SOURCE_DIR>/configure
--prefix=<INSTALL_DIR>
${expat_args_shared}
BUILD_COMMAND
$(MAKE)
INSTALL_COMMAND
make install
BUILD_IN_SOURCE 1)
find_package(EXPAT REQUIRED)
superbuild_add_extra_cmake_args(
-DEXPAT_INCLUDE_DIR:PATH=${EXPAT_INCLUDE_DIR}
-DEXPAT_LIBRARY:FILEPATH=${EXPAT_LIBRARY})
......@@ -77,7 +77,7 @@ endif ()
superbuild_add_project(${project}
CAN_USE_SYSTEM
DEPENDS llvm zlib ${mesa_type_deps}
DEPENDS llvm zlib ${mesa_type_deps} expat
CONFIGURE_COMMAND
./autogen.sh
${mesa_common_config_args}
......@@ -96,3 +96,7 @@ superbuild_apply_patch(${project} revert-xz
# Fix some borked sed flags
superbuild_apply_patch(${project} sed-flags
"Fix incompatible sed flags in configure")
# Fix a segfault when swr is not supported
superbuild_apply_patch(${project} fix-swr-unsupported-segfault
"Fix segfault when SWR is used on an unsupported architecture")
From 540e49e1054d60f5f3809b6efc828ac4cac8c708 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Thu, 22 Feb 2018 09:19:37 -0500
Subject: [PATCH] glx: Properly handle cases where screen creation fails
This fixes a segfault exposed by a29d63ecf7 which occurs when swr is
used on an unsupported architecture.
v2: re-work to place logic in xmesa_init_display
Signed-off-by: Chuck Atkins <chuck.atkins@kitware.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
Cc: George Kyriazis <george.kyriazis@intel.com>
Cc: Bruce Cherniak <bruce.cherniak@intel.com>
---
src/gallium/state_trackers/glx/xlib/glx_api.c | 5 ++-
src/gallium/state_trackers/glx/xlib/xm_api.c | 56 +++++++++++++--------------
src/gallium/state_trackers/glx/xlib/xm_api.h | 2 +-
3 files changed, 33 insertions(+), 30 deletions(-)
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 1994e6823a..6ec3a31d5f 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -743,7 +743,10 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
int numAux = 0;
GLint num_samples = 0;
- xmesa_init( dpy );
+ if (xmesa_init( dpy ) != 0) {
+ _mesa_warning(NULL, "Failed to initialize display");
+ return NULL;
+ }
parselist = list;
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 934c0aba11..e8cbb618ce 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -142,8 +142,11 @@ xmesa_close_display(Display *display)
{
XMesaExtDisplayInfo *info, *prev;
+ /* These assertions are not valid since screen creation can fail and result
+ * in an empty list
assert(MesaExtInfo.ndisplays > 0);
assert(MesaExtInfo.head);
+ */
_XLockMutex(_Xglobal_lock);
/* first find display */
@@ -223,7 +226,30 @@ xmesa_init_display( Display *display )
return NULL;
}
info->display = display;
+
xmdpy = &info->mesaDisplay; /* to be filled out below */
+ xmdpy->display = display;
+ xmdpy->pipe = NULL;
+
+ xmdpy->smapi = CALLOC_STRUCT(st_manager);
+ if (!xmdpy->smapi) {
+ Xfree(info);
+ mtx_unlock(&init_mutex);
+ return NULL;
+ }
+
+ xmdpy->screen = driver.create_pipe_screen(display);
+ if (!xmdpy->screen) {
+ free(xmdpy->smapi);
+ Xfree(info);
+ mtx_unlock(&init_mutex);
+ return NULL;
+ }
+
+ /* At this point, both smapi and screen are known to be valid */
+ xmdpy->smapi->screen = xmdpy->screen;
+ xmdpy->smapi->get_param = xmesa_get_param;
+ (void) mtx_init(&xmdpy->mutex, mtx_plain);
/* chain to the list of displays */
_XLockMutex(_Xglobal_lock);
@@ -232,32 +258,6 @@ xmesa_init_display( Display *display )
MesaExtInfo.ndisplays++;
_XUnlockMutex(_Xglobal_lock);
- /* now create the new XMesaDisplay info */
- assert(display);
-
- xmdpy->display = display;
- xmdpy->screen = driver.create_pipe_screen(display);
- xmdpy->smapi = CALLOC_STRUCT(st_manager);
- xmdpy->pipe = NULL;
- if (xmdpy->smapi) {
- xmdpy->smapi->screen = xmdpy->screen;
- xmdpy->smapi->get_param = xmesa_get_param;
- }
-
- if (xmdpy->screen && xmdpy->smapi) {
- (void) mtx_init(&xmdpy->mutex, mtx_plain);
- }
- else {
- if (xmdpy->screen) {
- xmdpy->screen->destroy(xmdpy->screen);
- xmdpy->screen = NULL;
- }
- free(xmdpy->smapi);
- xmdpy->smapi = NULL;
-
- xmdpy->display = NULL;
- }
-
mtx_unlock(&init_mutex);
return xmdpy;
@@ -935,10 +935,10 @@ xmesa_get_name(void)
/**
* Do per-display initializations.
*/
-void
+int
xmesa_init( Display *display )
{
- xmesa_init_display(display);
+ return xmesa_init_display(display) ? 0 : 1;
}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h
index 06bf839c96..e420679313 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.h
@@ -359,7 +359,7 @@ struct xmesa_buffer {
extern const char *
xmesa_get_name(void);
-extern void
+extern int
xmesa_init(Display *dpy);
extern XMesaBuffer
--
2.14.3
From 540e49e1054d60f5f3809b6efc828ac4cac8c708 Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Thu, 22 Feb 2018 09:19:37 -0500
Subject: [PATCH] glx: Properly handle cases where screen creation fails
This fixes a segfault exposed by a29d63ecf7 which occurs when swr is
used on an unsupported architecture.
v2: re-work to place logic in xmesa_init_display
Signed-off-by: Chuck Atkins <chuck.atkins@kitware.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
Cc: George Kyriazis <george.kyriazis@intel.com>
Cc: Bruce Cherniak <bruce.cherniak@intel.com>
---
src/gallium/state_trackers/glx/xlib/glx_api.c | 5 ++-
src/gallium/state_trackers/glx/xlib/xm_api.c | 56 +++++++++++++--------------
src/gallium/state_trackers/glx/xlib/xm_api.h | 2 +-
3 files changed, 33 insertions(+), 30 deletions(-)
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 1994e6823a..6ec3a31d5f 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -743,7 +743,10 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
int numAux = 0;
GLint num_samples = 0;
- xmesa_init( dpy );
+ if (xmesa_init( dpy ) != 0) {
+ _mesa_warning(NULL, "Failed to initialize display");
+ return NULL;
+ }
parselist = list;
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index 934c0aba11..e8cbb618ce 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -142,8 +142,11 @@ xmesa_close_display(Display *display)
{
XMesaExtDisplayInfo *info, *prev;
+ /* These assertions are not valid since screen creation can fail and result
+ * in an empty list
assert(MesaExtInfo.ndisplays > 0);
assert(MesaExtInfo.head);
+ */
_XLockMutex(_Xglobal_lock);
/* first find display */
@@ -223,7 +226,30 @@ xmesa_init_display( Display *display )
return NULL;
}
info->display = display;
+
xmdpy = &info->mesaDisplay; /* to be filled out below */
+ xmdpy->display = display;
+ xmdpy->pipe = NULL;
+
+ xmdpy->smapi = CALLOC_STRUCT(st_manager);
+ if (!xmdpy->smapi) {
+ Xfree(info);
+ mtx_unlock(&init_mutex);
+ return NULL;
+ }
+
+ xmdpy->screen = driver.create_pipe_screen(display);
+ if (!xmdpy->screen) {
+ free(xmdpy->smapi);
+ Xfree(info);
+ mtx_unlock(&init_mutex);
+ return NULL;
+ }
+
+ /* At this point, both smapi and screen are known to be valid */
+ xmdpy->smapi->screen = xmdpy->screen;
+ xmdpy->smapi->get_param = xmesa_get_param;
+ (void) mtx_init(&xmdpy->mutex, mtx_plain);
/* chain to the list of displays */
_XLockMutex(_Xglobal_lock);
@@ -232,32 +258,6 @@ xmesa_init_display( Display *display )
MesaExtInfo.ndisplays++;
_XUnlockMutex(_Xglobal_lock);
- /* now create the new XMesaDisplay info */
- assert(display);
-
- xmdpy->display = display;
- xmdpy->screen = driver.create_pipe_screen(display);
- xmdpy->smapi = CALLOC_STRUCT(st_manager);
- xmdpy->pipe = NULL;
- if (xmdpy->smapi) {
- xmdpy->smapi->screen = xmdpy->screen;
- xmdpy->smapi->get_param = xmesa_get_param;
- }
-
- if (xmdpy->screen && xmdpy->smapi) {
- (void) mtx_init(&xmdpy->mutex, mtx_plain);
- }
- else {
- if (xmdpy->screen) {
- xmdpy->screen->destroy(xmdpy->screen);
- xmdpy->screen = NULL;
- }
- free(xmdpy->smapi);
- xmdpy->smapi = NULL;
-
- xmdpy->display = NULL;
- }
-
mtx_unlock(&init_mutex);
return xmdpy;
@@ -935,10 +935,10 @@ xmesa_get_name(void)
/**
* Do per-display initializations.
*/
-void
+int
xmesa_init( Display *display )
{
- xmesa_init_display(display);
+ return xmesa_init_display(display) ? 0 : 1;
}
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h
index 06bf839c96..e420679313 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.h
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.h
@@ -359,7 +359,7 @@ struct xmesa_buffer {
extern const char *
xmesa_get_name(void);
-extern void
+extern int
xmesa_init(Display *dpy);
extern XMesaBuffer
--
2.14.3
......@@ -152,13 +152,18 @@ if (mesa_enabled AND python_enabled)
"${CMAKE_CURRENT_LIST_DIR}/python/CheckOpenGLVersion.py"
"mesa" "llvmpipe")
if (mesa_USE_SWR)
paraview_add_test("mesa-swr" "${pvpython_exe}"
${mesa_swr_arg}
"${CMAKE_CURRENT_LIST_DIR}/python/CheckOpenGLVersion.py"
"mesa" "swr")
# Mesa exits with failure.
set_tests_properties(paraview-mesa-swr
PROPERTIES PASS_REGULAR_EXPRESSION "SWR detected")
# Either don't add or add but explicitly disable this test for now
# until the underlying VTK segfault is fixed.
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.9)
paraview_add_test("mesa-swr" "${pvpython_exe}"
${mesa_swr_arg}
"${CMAKE_CURRENT_LIST_DIR}/python/CheckOpenGLVersion.py"
"mesa" "swr")
# Mesa exits with failure.
set_tests_properties(paraview-mesa-swr PROPERTIES
PASS_REGULAR_EXPRESSION "SWR (detected|could not initialize)"
DISABLED TRUE)
endif()
endif()
endif ()
......
superbuild_set_revision(expat
URL "http://www.paraview.org/files/dependencies/expat-2.2.5.tar.bz2"
URL_MD5 789e297f547980fc9ecc036f9a070d49)
superbuild_set_revision(llvm
URL "http://www.paraview.org/files/dependencies/llvm-5.0.1.src.tar.xz"
URL_MD5 3a4ec6dcbc71579eeaec7cb157fe2168)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment