Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 32 additions & 25 deletions build/trivalent.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions build/trivalent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"