diff --git a/Dockerfile b/Dockerfile index 7dd7334..98d164a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ diff --git a/docs/compose-files/docker-compose.default.yml b/docs/compose-files/docker-compose.default.yml index 100c38f..026b693 100644 --- a/docs/compose-files/docker-compose.default.yml +++ b/docs/compose-files/docker-compose.default.yml @@ -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: diff --git a/overlay/etc/cont-init.d/10-setup_user.sh b/overlay/etc/cont-init.d/10-setup_user.sh index 8eaded1..2a09cd7 100644 --- a/overlay/etc/cont-init.d/10-setup_user.sh +++ b/overlay/etc/cont-init.d/10-setup_user.sh @@ -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} diff --git a/overlay/templates/sunshine/sunshine.conf b/overlay/templates/sunshine/sunshine.conf index cf00432..81a4e42 100644 --- a/overlay/templates/sunshine/sunshine.conf +++ b/overlay/templates/sunshine/sunshine.conf @@ -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` diff --git a/overlay/usr/bin/common-functions.sh b/overlay/usr/bin/common-functions.sh index 1643da1..d21f69b 100755 --- a/overlay/usr/bin/common-functions.sh +++ b/overlay/usr/bin/common-functions.sh @@ -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} +} diff --git a/overlay/usr/bin/start-desktop.sh b/overlay/usr/bin/start-desktop.sh index 72f31c0..c53bbf5 100755 --- a/overlay/usr/bin/start-desktop.sh +++ b/overlay/usr/bin/start-desktop.sh @@ -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) diff --git a/overlay/usr/bin/start-sunshine.sh b/overlay/usr/bin/start-sunshine.sh index a301042..b949b1d 100755 --- a/overlay/usr/bin/start-sunshine.sh +++ b/overlay/usr/bin/start-sunshine.sh @@ -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=$!