From 2d9e7f75eceba656c5111b7367d9a373aa13a2bb Mon Sep 17 00:00:00 2001 From: Zachary Lentz Date: Wed, 26 Oct 2022 13:41:17 -0700 Subject: [PATCH 1/2] WIP/FIX: only set mesa if renderer is failing --- scripts/dev_conda | 34 +++++++++++++++++++++++++++++----- scripts/pcds_conda | 33 +++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 9 deletions(-) diff --git a/scripts/dev_conda b/scripts/dev_conda index a14cb517..33c55eb6 100755 --- a/scripts/dev_conda +++ b/scripts/dev_conda @@ -53,11 +53,35 @@ source "${TOKEN_DIR}/typhos.sh" # Revert to Software Raster when SSH to avoid issues with QtQuick. # The same was done with PyDM and this fixes Designer and friends. if [ -n "${SSH_CONNECTION}" ]; then + echo "SSH Session" export QT_QUICK_BACKEND="software" - # On operator consoles over ssh for most users, opengl crashes unless this is set. - # This tells the GLX extension to use software rendering by way of the mesa library. - if [ -z "${__GLX_VENDOR_LIBRARY_NAME}" ]; then - export __GLX_VENDOR_LIBRARY_NAME="mesa" + # Check for errors in the renderer + # Manually fall back to mesa library if renderer doesn't work + if [ -x "$(command -v glxinfo)" ] && [ -z "${__GLX_VENDOR_LIBRARY_NAME}" ]; then + echo "Check for graphics errors" + GLX_OUTPUT="$(glxinfo -B 2>&1)" + if [ "${?}" -ne "0" ]; then + echo "Graphics error found" + export ERROR="1" + else + GLX_ERRORS="$(echo "${GLX_OUTPUT}" | grep -i "^error")" + if [ -n "${GLX_ERRORS}" ]; then + echo "Graphics warning found" + export ERROR="1" + else + echo "No errors" + export ERROR="0" + fi + fi + if [ "${ERROR}" -eq "1" ]; then + echo "Manual ovveride of GLX renderer" + export __GLX_VENDOR_LIBRARY_NAME="mesa" + else + echo "Use automatic renderer" + fi + else + echo "Cannot check for graphics errors" fi +else + echo "Not an SSH session" fi - diff --git a/scripts/pcds_conda b/scripts/pcds_conda index ee9b6033..d3d0e995 100755 --- a/scripts/pcds_conda +++ b/scripts/pcds_conda @@ -127,10 +127,35 @@ source "${TOKEN_DIR}/typhos.sh" # Revert to Software Raster when SSH to avoid issues with QtQuick. # The same was done with PyDM and this fixes Designer and friends. if [ -n "${SSH_CONNECTION}" ]; then + echo "SSH Session" export QT_QUICK_BACKEND="software" - # On operator consoles over ssh for most users, opengl crashes unless this is set. - # This tells the GLX extension to use software rendering by way of the mesa library. - if [ -z "${__GLX_VENDOR_LIBRARY_NAME}" ]; then - export __GLX_VENDOR_LIBRARY_NAME="mesa" + # Check for errors in the renderer + # Manually fall back to mesa library if renderer doesn't work + if [ -x "$(command -v glxinfo)" ] && [ -z "${__GLX_VENDOR_LIBRARY_NAME}" ]; then + echo "Check for graphics errors" + GLX_OUTPUT="$(glxinfo -B 2>&1)" + if [ "${?}" -ne "0" ]; then + echo "Graphics error found" + export ERROR="1" + else + GLX_ERRORS="$(echo "${GLX_OUTPUT}" | grep -i "^error")" + if [ -n "${GLX_ERRORS}" ]; then + echo "Graphics warning found" + export ERROR="1" + else + echo "No errors" + export ERROR="0" + fi + fi + if [ "${ERROR}" -eq "1" ]; then + echo "Manual ovveride of GLX renderer" + export __GLX_VENDOR_LIBRARY_NAME="mesa" + else + echo "Use automatic renderer" + fi + else + echo "Cannot check for graphics errors" fi +else + echo "Not an SSH session" fi From e29bbc4afa61f92be33e27fa22a2e8cf31fb3414 Mon Sep 17 00:00:00 2001 From: Zachary Lentz Date: Wed, 26 Oct 2022 14:47:45 -0700 Subject: [PATCH 2/2] MAINT: maximally simplify the glx error checking --- scripts/dev_conda | 33 ++++++--------------------------- scripts/pcds_conda | 33 ++++++--------------------------- 2 files changed, 12 insertions(+), 54 deletions(-) diff --git a/scripts/dev_conda b/scripts/dev_conda index 33c55eb6..e1814539 100755 --- a/scripts/dev_conda +++ b/scripts/dev_conda @@ -53,35 +53,14 @@ source "${TOKEN_DIR}/typhos.sh" # Revert to Software Raster when SSH to avoid issues with QtQuick. # The same was done with PyDM and this fixes Designer and friends. if [ -n "${SSH_CONNECTION}" ]; then - echo "SSH Session" - export QT_QUICK_BACKEND="software" - # Check for errors in the renderer - # Manually fall back to mesa library if renderer doesn't work + export QT_QUICK_BACKEND="software" + # Check for errors in the opengl rendering + # Manually fall back to mesa library if we know there is a problem if [ -x "$(command -v glxinfo)" ] && [ -z "${__GLX_VENDOR_LIBRARY_NAME}" ]; then - echo "Check for graphics errors" - GLX_OUTPUT="$(glxinfo -B 2>&1)" - if [ "${?}" -ne "0" ]; then - echo "Graphics error found" - export ERROR="1" - else - GLX_ERRORS="$(echo "${GLX_OUTPUT}" | grep -i "^error")" - if [ -n "${GLX_ERRORS}" ]; then - echo "Graphics warning found" - export ERROR="1" - else - echo "No errors" - export ERROR="0" - fi - fi - if [ "${ERROR}" -eq "1" ]; then - echo "Manual ovveride of GLX renderer" + # Expecting either a segfault or exit code 1 if there is a problem + if ! { glxinfo -B; } > /dev/null 2>&1; then export __GLX_VENDOR_LIBRARY_NAME="mesa" - else - echo "Use automatic renderer" fi - else - echo "Cannot check for graphics errors" fi -else - echo "Not an SSH session" fi + diff --git a/scripts/pcds_conda b/scripts/pcds_conda index d3d0e995..cd977ff1 100755 --- a/scripts/pcds_conda +++ b/scripts/pcds_conda @@ -127,35 +127,14 @@ source "${TOKEN_DIR}/typhos.sh" # Revert to Software Raster when SSH to avoid issues with QtQuick. # The same was done with PyDM and this fixes Designer and friends. if [ -n "${SSH_CONNECTION}" ]; then - echo "SSH Session" - export QT_QUICK_BACKEND="software" - # Check for errors in the renderer - # Manually fall back to mesa library if renderer doesn't work + export QT_QUICK_BACKEND="software" + # Check for errors in the opengl rendering + # Manually fall back to mesa library if we know there is a problem if [ -x "$(command -v glxinfo)" ] && [ -z "${__GLX_VENDOR_LIBRARY_NAME}" ]; then - echo "Check for graphics errors" - GLX_OUTPUT="$(glxinfo -B 2>&1)" - if [ "${?}" -ne "0" ]; then - echo "Graphics error found" - export ERROR="1" - else - GLX_ERRORS="$(echo "${GLX_OUTPUT}" | grep -i "^error")" - if [ -n "${GLX_ERRORS}" ]; then - echo "Graphics warning found" - export ERROR="1" - else - echo "No errors" - export ERROR="0" - fi - fi - if [ "${ERROR}" -eq "1" ]; then - echo "Manual ovveride of GLX renderer" + # Expecting either a segfault or exit code 1 if there is a problem + if ! { glxinfo -B; } > /dev/null 2>&1; then export __GLX_VENDOR_LIBRARY_NAME="mesa" - else - echo "Use automatic renderer" fi - else - echo "Cannot check for graphics errors" fi -else - echo "Not an SSH session" fi +