diff --git a/build/trivalent.conf b/build/trivalent.conf index 1d448a4e..26365cec 100644 --- a/build/trivalent.conf +++ b/build/trivalent.conf @@ -4,41 +4,48 @@ ARCH="$(arch)" CHROMIUM_FLAGS="" FEATURES="" -# NATIVE_WAYLAND=[on|off] -case "$XDG_SESSION_TYPE" in - wayland) - NATIVE_WAYLAND="on" - ;; - x11) - NATIVE_WAYLAND="off" - ;; -esac - -# ENABLE_VULKAN=[on|off] -ENABLE_VULKAN="off" +# USE_WAYLAND=[true|false] +USE_WAYLAND="${USE_WAYLAND}" +if [ "$USE_WAYLAND" == "false" ]; then + CHROMIUM_FLAGS+=" --ozone-platform-hint=x11" +elif [ "$USE_WAYLAND" == "true" ] && [ "$XDG_SESSION_TYPE" == "wayland" ]; then + CHROMIUM_FLAGS+=" --ozone-platform-hint=wayland" +else + if [ "$USE_WAYLAND" == "true" ]; then + echo "Wayland is not supported on X11 sessions" + else + echo "Value provided by 'USE_WAYLAND' empty or invalid, defaulting to '$XDG_SESSION_TYPE'" + fi + case "$XDG_SESSION_TYPE" in + wayland) + USE_WAYLAND="true" + ;; + x11) + USE_WAYLAND="false" + ;; + esac +fi + +# ENABLE_VULKAN=[true|false] +ENABLE_VULKAN="false" # Other architectures are not tested for and should not be included yet if [ "$ARCH" == "x86_64" ] ; then - if [ "$NATIVE_WAYLAND" == "off" ] ; then + if [ "$USE_WAYLAND" == "false" ]; then CHROMIUM_FLAGS+=" --enable-native-gpu-memory-buffers" CHROMIUM_FLAGS+=" --enable-gpu-memory-buffer-video-frames" CHROMIUM_FLAGS+=" --enable-zero-copy" - CHROMIUM_FLAGS+=" --ignore-gpu-blocklist --disable-gpu-driver-bug-workaround" - CHROMIUM_FLAGS+=" --enable-gpu-rasterization" - + CHROMIUM_FLAGS+=" --ignore-gpu-blocklist" + CHROMIUM_FLAGS+=" --disable-gpu-driver-bug-workaround" + # Enable Vulkan - # (Vulkan is not supported on Wayland, it is also experimental on Linux) - ENABLE_VULKAN="on" + # (Vulkan is not supported on Wayland, it is also experimental) + ENABLE_VULKAN="true" fi - if [ "$ENABLE_VULKAN" == "on" ] ; then + if [ "$ENABLE_VULKAN" == "true" ]; then CHROMIUM_FLAGS+=" --use-angle=vulkan --use-vulkan" - FEATURES+=",Vulkan,DefaultANGLEVulkan,VulkanFromANGLE,VaapiIgnoreDriverChecks" - fi - - # Nvidia has issues on Wayland - if ! command -v nvidia-smi || [ -z "$DISPLAY" ]; then - CHROMIUM_FLAGS+=" --ozone-platform-hint=auto" + FEATURES+="Vulkan,DefaultANGLEVulkan,VulkanFromANGLE,VaapiIgnoreDriverChecks" fi fi diff --git a/build/trivalent.sh b/build/trivalent.sh index 7d17bc4e..eaa1a6b2 100755 --- a/build/trivalent.sh +++ b/build/trivalent.sh @@ -86,5 +86,8 @@ BWRAP_ARGS="--dev-bind / /" if [ -f "/etc/ld.so.preload" ]; then BWRAP_ARGS+=" --ro-bind /dev/null /etc/ld.so.preload" fi +if [ "$USE_WAYLAND" == "true" ]; then + BWRAP_ARGS+=" --unshare-ipc" # prevent IPC where it isn't needed (x11 performance depends on IPC) +fi exec /usr/bin/bwrap $BWRAP_ARGS "$HERE/$CHROMIUM_NAME" $CHROMIUM_FLAGS "$@"