Some minor tweaks and improvments

This commit is contained in:
Josh.5
2022-10-07 03:46:52 +13:00
parent f233991597
commit 477e25f82c
7 changed files with 77 additions and 32 deletions

View File

@@ -117,31 +117,36 @@ RUN \
&& \
echo
# Install mesa requirements
# Install mesa and vulkan requirements
RUN \
echo "**** Update apt database ****" \
&& dpkg --add-architecture i386 \
&& apt-get update \
&& \
echo "**** Install mesa and vulkan requirements ****" \
echo "**** Install mesa requirements ****" \
&& apt-get install -y --no-install-recommends \
libegl1 \
libgl1-mesa-dri \
libgl1-mesa-dri:i386 \
libgl1-mesa-glx \
libgles2-mesa \
libglu1-mesa \
libglx-mesa0:i386 \
mesa-utils \
mesa-utils-extra \
&& \
echo "**** Install vulkan requirements ****" \
&& apt-get install -y --no-install-recommends \
libvulkan1 \
libvulkan1:i386 \
mesa-vulkan-drivers \
mesa-vulkan-drivers:i386 \
vulkan-tools \
&& \
echo "**** Install desktop requirements ****" \
&& apt-get install -y --no-install-recommends \
libdbus-1-3 \
libegl1 \
libgtk-3-0 \
libgtk2.0-0 \
libsdl2-2.0-0 \
libvulkan1 \
libvulkan1:i386 \
mesa-utils \
mesa-utils-extra \
mesa-vulkan-drivers \
mesa-vulkan-drivers:i386 \
vainfo \
vulkan-tools \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
@@ -388,18 +393,11 @@ RUN \
&& \
echo
# Setup video/audio streaming deps
# Setup audio streaming deps
RUN \
echo "**** Update apt database ****" \
&& apt-get update \
&& \
echo "**** Install Intel media drivers and VAAPI ****" \
&& apt-get install -y --no-install-recommends \
intel-media-va-driver-non-free \
i965-va-driver-shaders \
libva2 \
vainfo \
&& \
echo "**** Install audio streaming deps ****" \
&& apt-get install -y --no-install-recommends \
bzip2 \
@@ -459,6 +457,28 @@ RUN \
&& \
echo
# Setup video streaming deps
RUN \
echo "**** Update apt database ****" \
&& apt-get update \
&& \
echo "**** Install Intel media drivers and VAAPI ****" \
&& apt-get install -y --no-install-recommends \
intel-media-va-driver-non-free \
i965-va-driver-shaders \
libva2 \
vainfo \
&& \
echo "**** Section cleanup ****" \
&& apt-get clean autoclean -y \
&& apt-get autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/* \
&& \
echo
# Configure default user and set env
ENV \
USER="default" \
@@ -490,7 +510,8 @@ ENV \
DISPLAY_VIDEO_PORT="DFP" \
DISPLAY=":55" \
NVIDIA_DRIVER_CAPABILITIES="all" \
NVIDIA_VISIBLE_DEVICES="all"
NVIDIA_VISIBLE_DEVICES="all" \
XDG_RUNTIME_DIR="/tmp/.X11-unix/run"
# Set container configuration environment variables
ENV \

View File

@@ -14,7 +14,9 @@ services:
hard: 524288
# NETWORK:
## NOTE: Steam headless always required the use of the host network
## NOTE: Steam headless always requires the use of the host network.
## If we do not use the host network, then device input is not possible
## and your controllers will not work in steam games.
network_mode: host
hostname: ${NAME}
extra_hosts:

View File

@@ -57,9 +57,7 @@ echo "Setting umask to ${UMASK}";
umask ${UMASK}
# Configure the 'XDG_RUNTIME_DIR' to something that is easily shared between containers
export XDG_RUNTIME_DIR=/tmp/.X11-unix/run
# export XDG_RUNTIME_DIR=/run/user/${PUID}
# Configure the 'XDG_RUNTIME_DIR' path
echo "Create the user XDG_RUNTIME_DIR path '${XDG_RUNTIME_DIR}'"
mkdir -p ${XDG_RUNTIME_DIR}
chown -R ${PUID}:${PGID} ${XDG_RUNTIME_DIR}

View File

@@ -51,7 +51,7 @@ min_log_level = info
# upnp = on
# The file where current state of Sunshine is stored
file_state = /home/default/sunshine_state.json
# file_state = sunshine_state.json
# The file where user credentials for the UI are stored
# By default, credentials are stored in `file_state`

View File

@@ -23,3 +23,19 @@ wait_for_x() {
fi
done
}
get_nvidia_gpu_id() {
# Fech NVIDIA GPU device (if one exists)
if [ "${NVIDIA_VISIBLE_DEVICES:-}" == "all" ]; then
gpu_select=$(nvidia-smi --format=csv --query-gpu=uuid 2> /dev/null | sed -n 2p)
elif [ -z "${NVIDIA_VISIBLE_DEVICES:-}" ]; then
gpu_select=$(nvidia-smi --format=csv --query-gpu=uuid 2> /dev/null | sed -n 2p)
else
gpu_select=$(nvidia-smi --format=csv --id=$(echo "${NVIDIA_VISIBLE_DEVICES:-}" | cut -d ',' -f1) --query-gpu=uuid | sed -n 2p)
if [ -z "$gpu_select" ]; then
gpu_select=$(nvidia-smi --format=csv --query-gpu=uuid 2> /dev/null | sed -n 2p)
fi
fi
echo ${gpu_select}
}

View File

@@ -19,8 +19,6 @@ trap _term SIGTERM SIGINT
# CONFIGURE:
XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-:/tmp/.X11-unix/run}
#XAUTHORITY=${XDG_RUNTIME_DIR:-/home/${USER}/.xauthority}
XDG_DATA_DIRS="${XDG_DATA_DIRS}:/var/lib/flatpak/exports/share:/home/${USER}/.local/share/flatpak/exports/share"
export $(dbus-launch)

View File

@@ -24,8 +24,18 @@ mkdir -p /home/${USER}/sunshine
if [[ ! -f /home/${USER}/sunshine/sunshine.conf ]]; then
cp -vf /templates/sunshine/* /home/${USER}/sunshine/
# TODO: Set the default encoder '# encoder = nvenc'
# TODO: Enable the vaapi device if not using nvenc
# vainfo --display drm --device /dev/dri/renderD128 2> /dev/null | grep -E "((VAProfileH264High|VAProfileHEVCMain|VAProfileHEVCMain10).*VAEntrypointEncSlice)"
# nvidia_gpu_id=$(get_nvidia_gpu_id)
# if [[ "X${nvidia_gpu_id:-}" != "X" ]]; then
# if [[ "all video" == *"${NVIDIA_DRIVER_CAPABILITIES}"* ]]; then
# # Check if we have a nvidia GPU available
# sed -i 's|^# encoder.*=.*$|encoder = nvenc|' /home/${USER}/sunshine/sunshine.conf
# fi
# else
# # TODO: Enable the vaapi device if not using nvenc
# # vainfo --display drm --device /dev/dri/renderD128 2> /dev/null | grep -E "((VAProfileH264High|VAProfileHEVCMain|VAProfileHEVCMain10).*VAEntrypointEncSlice)"
# # Loop over any render devices
# echo
# fi
fi
# Reset the default username/password
@@ -38,7 +48,7 @@ fi
# Wait for the X server to start
wait_for_x
# Start the sunshine server
sunshine min_log_level=info /home/${USER}/sunshine/sunshine.conf &
sunshine /home/${USER}/sunshine/sunshine.conf &
sunshine_pid=$!