From 50261bf5ee9a870271499b78618c4c31e14603a6 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sat, 12 Oct 2024 11:35:25 -0400 Subject: [PATCH 01/22] build(flatpak): migrate to libayatanna-appindicator (#3295) --- packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.yml b/packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.yml index 3313ed25..bead37b8 100644 --- a/packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.yml +++ b/packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.yml @@ -33,13 +33,13 @@ modules: - "modules/xvfb/xvfb.json" # Runtime dependencies - - shared-modules/libappindicator/libappindicator-gtk3-12.10.json + - shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json - "modules/avahi.json" - "modules/boost.json" - "modules/libevdev.json" - "modules/libnotify.json" - "modules/miniupnpc.json" - - "modules/numactl.json" # TODO: is this still needed? + - "modules/numactl.json" # Caching is configured until here, not including CUDA, since it is too large for GitHub cache - "modules/cuda.json" From 25ed2d5b4a5bde402bc573b5dd1c8479757a9735 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sat, 12 Oct 2024 13:08:38 -0400 Subject: [PATCH 02/22] build(homebrew): fix boost linking (#3296) --- packaging/sunshine.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packaging/sunshine.rb b/packaging/sunshine.rb index b5220fe4..68193ec1 100644 --- a/packaging/sunshine.rb +++ b/packaging/sunshine.rb @@ -23,8 +23,8 @@ class @PROJECT_NAME@ < Formula end option "with-docs", "Enable docs" - option "with-dynamic-boost", "Dynamically link Boost libraries" - option "without-dynamic-boost", "Statically link Boost libraries" # default option + option "with-static-boost", "Enable static link of Boost libraries" + option "without-static-boost", "Disable static link of Boost libraries" # default option depends_on "cmake" => :build depends_on "doxygen" => :build @@ -35,6 +35,7 @@ class @PROJECT_NAME@ < Formula depends_on "miniupnpc" depends_on "openssl" depends_on "opus" + depends_on "boost" => :recommended depends_on "icu4c" => :recommended on_linux do @@ -84,14 +85,17 @@ class @PROJECT_NAME@ < Formula args << "-DBUILD_DOCS=OFF" end - if build.without? "dynamic-boost" + if build.without? "static-boost" + args << "-DBOOST_USE_STATIC=OFF" + ohai "Disabled statically linking Boost libraries" + else args << "-DBOOST_USE_STATIC=ON" - ohai "Statically linking Boost libraries" + ohai "Enabled statically linking Boost libraries" unless Formula["icu4c"].any_version_installed? odie <<~EOS icu4c must be installed to link against static Boost libraries, - either install icu4c or use brew install sunshine --with-dynamic-boost instead + either install icu4c or use brew install sunshine --with-static-boost instead EOS end ENV.append "CXXFLAGS", "-I#{Formula["icu4c"].opt_include}" @@ -99,9 +103,6 @@ class @PROJECT_NAME@ < Formula ENV.append "LDFLAGS", "-L#{icu4c_lib_path}" ENV["LIBRARY_PATH"] = icu4c_lib_path ohai "Linking against ICU libraries at: #{icu4c_lib_path}" - else - args << "-DBOOST_USE_STATIC=OFF" - ohai "Dynamically linking Boost libraries" end system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args From 593883a13f6d80ab9aa810d1c7dc8163106d03da Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sun, 13 Oct 2024 11:18:17 -0400 Subject: [PATCH 03/22] ci(coverage): simplify gcovr exclusions (#3299) --- .github/workflows/CI.yml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c37a97d8..50eb3c1d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -488,13 +488,11 @@ jobs: working-directory: build run: | ${{ steps.python.outputs.python-path }} -m pip install gcovr - ${{ steps.python.outputs.python-path }} -m gcovr -r .. \ + ${{ steps.python.outputs.python-path }} -m gcovr . -r ../src \ --exclude-noncode-lines \ --exclude-throw-branches \ --exclude-unreachable-branches \ - --exclude '.*_deps/.*' \ - --exclude '.*tests/.*' \ - --exclude '.*third-party/.*' \ + --verbose \ --xml-pretty \ -o coverage.xml @@ -922,13 +920,10 @@ jobs: cd ${build_dir} ${{ steps.python.outputs.python-path }} -m pip install gcovr - sudo ${{ steps.python.outputs.python-path }} -m gcovr -r ../${dir} \ + sudo ${{ steps.python.outputs.python-path }} -m gcovr . -r ../${dir}/src \ --exclude-noncode-lines \ --exclude-throw-branches \ --exclude-unreachable-branches \ - --exclude '.*${dir}/_deps/.*' \ - --exclude '.*${dir}/tests/.*' \ - --exclude '.*${dir}/third-party/.*' \ --gcov-object-directory $(pwd) \ --verbose \ --xml-pretty \ @@ -1190,13 +1185,11 @@ jobs: working-directory: build run: | ${{ steps.python-path.outputs.python-path }} -m pip install "gcovr<8.0" - ${{ steps.python-path.outputs.python-path }} -m gcovr -r .. \ + ${{ steps.python-path.outputs.python-path }} -m gcovr . -r ../src \ --exclude-noncode-lines \ --exclude-throw-branches \ --exclude-unreachable-branches \ - --exclude '.*_deps/.*' \ - --exclude '.*tests/.*' \ - --exclude '.*third-party/.*' \ + --verbose \ --xml-pretty \ -o coverage.xml From 1d80d3946ee13f90545203c4b2a1134d4fd94cb7 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Sun, 13 Oct 2024 14:54:15 -0400 Subject: [PATCH 04/22] revert: "ci(windows): pin gcovr to < 8.0" (#3283) Revert "ci(windows): pin gcovr to < 8.0 (#3277)" This reverts commit d3ad63654aa5b80618e1687d65d93e003d7f2d70. --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 50eb3c1d..f183243f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1184,7 +1184,7 @@ jobs: shell: msys2 {0} working-directory: build run: | - ${{ steps.python-path.outputs.python-path }} -m pip install "gcovr<8.0" + ${{ steps.python-path.outputs.python-path }} -m pip install gcovr ${{ steps.python-path.outputs.python-path }} -m gcovr . -r ../src \ --exclude-noncode-lines \ --exclude-throw-branches \ From 5b435fd0c1810c4994211a6f4eb1b053a4359514 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 13 Oct 2024 18:04:52 -0500 Subject: [PATCH 05/22] fix(display): fix logic to remember ddprobe already ran (#3293) --- src/platform/windows/display_base.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/platform/windows/display_base.cpp b/src/platform/windows/display_base.cpp index d4731c0e..c6167886 100644 --- a/src/platform/windows/display_base.cpp +++ b/src/platform/windows/display_base.cpp @@ -419,11 +419,13 @@ namespace platf::dxgi { // Try probing with different GPU preferences and verify_frame_capture flag if (validate_and_test_gpu_preference(display_name, true)) { + set_gpu_preference = true; return true; } // If no valid configuration was found, try again with verify_frame_capture == false if (validate_and_test_gpu_preference(display_name, false)) { + set_gpu_preference = true; return true; } From 3744c43ea7c91ae1b9d2a0d9a5d9e10523d687b6 Mon Sep 17 00:00:00 2001 From: Andy Grundman Date: Sun, 13 Oct 2024 21:36:27 -0400 Subject: [PATCH 06/22] fix(audio/windows): don't set virtual speakers higher than 24-bit mode (#3294) Windows: don't try to set Steam speakers to 32-bit mode to avoid clobbering spatial audio settings --- src/platform/windows/audio.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/platform/windows/audio.cpp b/src/platform/windows/audio.cpp index bc208128..3335eeb0 100644 --- a/src/platform/windows/audio.cpp +++ b/src/platform/windows/audio.cpp @@ -124,9 +124,8 @@ namespace { create_virtual_sink_waveformats() { if constexpr (channel_count == 2) { auto channel_mask = waveformat_mask_stereo; + // only choose 24 or 16-bit formats to avoid clobbering existing Dolby/DTS spatial audio settings return { - create_waveformat(sample_format_e::f32, channel_count, channel_mask), - create_waveformat(sample_format_e::s32, channel_count, channel_mask), create_waveformat(sample_format_e::s24in32, channel_count, channel_mask), create_waveformat(sample_format_e::s24, channel_count, channel_mask), create_waveformat(sample_format_e::s16, channel_count, channel_mask), From 53bbe3fc5517ad777e4b577c3f46a130c85045e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 08:53:34 -0400 Subject: [PATCH 07/22] build(deps): bump vue from 3.5.11 to 3.5.12 (#3301) Bumps [vue](https://github.com/vuejs/core) from 3.5.11 to 3.5.12. - [Release notes](https://github.com/vuejs/core/releases) - [Changelog](https://github.com/vuejs/core/blob/main/CHANGELOG.md) - [Commits](https://github.com/vuejs/core/compare/v3.5.11...v3.5.12) --- updated-dependencies: - dependency-name: vue dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a2ac9e73..78d6994c 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "@lizardbyte/shared-web": "2024.921.191855", - "vue": "3.5.11", + "vue": "3.5.12", "vue-i18n": "9.14.0" }, "devDependencies": { From 63dbf72ad615c571659463b36902aca31e30f976 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:30:10 +0000 Subject: [PATCH 08/22] build(deps): bump third-party/wayland-protocols from `df2b5e5` to `9ac1a09` (#3302) build(deps): bump third-party/wayland-protocols Bumps third-party/wayland-protocols from `df2b5e5` to `9ac1a09`. --- updated-dependencies: - dependency-name: third-party/wayland-protocols dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third-party/wayland-protocols | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/wayland-protocols b/third-party/wayland-protocols index df2b5e5e..9ac1a097 160000 --- a/third-party/wayland-protocols +++ b/third-party/wayland-protocols @@ -1 +1 @@ -Subproject commit df2b5e5e7b507515a54e5f5f3b410da5dc05d690 +Subproject commit 9ac1a0977eea1b2f525e375089131f7d696a74ee From 67ab6e3c79770c6c31a3e93f68d41ab10d77903b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:47:47 +0000 Subject: [PATCH 09/22] build(deps): bump third-party/wlr-protocols from `2b8d433` to `ffb89ac` (#3278) Bumps third-party/wlr-protocols from `2b8d433` to `ffb89ac`. --- updated-dependencies: - dependency-name: third-party/wlr-protocols dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third-party/wlr-protocols | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/wlr-protocols b/third-party/wlr-protocols index 2b8d4332..ffb89ac7 160000 --- a/third-party/wlr-protocols +++ b/third-party/wlr-protocols @@ -1 +1 @@ -Subproject commit 2b8d43325b7012cc3f9b55c08d26e50e42beac7d +Subproject commit ffb89ac790096f6e6272822c8d5df7d0cc6fcdfa From 7352e7277a65d8f18cfe2b1669873ae9af933605 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:28:55 -0400 Subject: [PATCH 10/22] build(linux): fail build if capture dependencies not found (#3305) --- cmake/compile_definitions/linux.cmake | 23 ++++++++--------------- cmake/prep/options.cmake | 2 +- packaging/sunshine.rb | 2 ++ 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/cmake/compile_definitions/linux.cmake b/cmake/compile_definitions/linux.cmake index 94465abe..6f10aaf9 100644 --- a/cmake/compile_definitions/linux.cmake +++ b/cmake/compile_definitions/linux.cmake @@ -67,6 +67,8 @@ if(${SUNSHINE_ENABLE_CUDA}) # message(STATUS "CUDA NVCC Flags: ${CUDA_NVCC_FLAGS}") message(STATUS "CUDA Architectures: ${CMAKE_CUDA_ARCHITECTURES}") + elseif(${CUDA_FAIL_ON_MISSING}) + message(FATAL_ERROR "CUDA not found") endif() endif() if(CUDA_FOUND) @@ -82,8 +84,8 @@ endif() # drm if(${SUNSHINE_ENABLE_DRM}) - find_package(LIBDRM) - find_package(LIBCAP) + find_package(LIBDRM REQUIRED) + find_package(LIBCAP REQUIRED) else() set(LIBDRM_FOUND OFF) set(LIBCAP_FOUND OFF) @@ -95,10 +97,6 @@ if(LIBDRM_FOUND AND LIBCAP_FOUND) list(APPEND PLATFORM_TARGET_FILES "${CMAKE_SOURCE_DIR}/src/platform/linux/kmsgrab.cpp") list(APPEND SUNSHINE_DEFINITIONS EGL_NO_X11=1) -elseif(NOT LIBDRM_FOUND) - message(WARNING "Missing libdrm") -elseif(NOT LIBDRM_FOUND) - message(WARNING "Missing libcap") endif() # evdev @@ -106,7 +104,7 @@ include(dependencies/libevdev_Sunshine) # vaapi if(${SUNSHINE_ENABLE_VAAPI}) - find_package(Libva) + find_package(Libva REQUIRED) else() set(LIBVA_FOUND OFF) endif() @@ -121,7 +119,7 @@ endif() # wayland if(${SUNSHINE_ENABLE_WAYLAND}) - find_package(Wayland) + find_package(Wayland REQUIRED) else() set(WAYLAND_FOUND OFF) endif() @@ -153,7 +151,7 @@ endif() # x11 if(${SUNSHINE_ENABLE_X11}) - find_package(X11) + find_package(X11 REQUIRED) else() set(X11_FOUND OFF) endif() @@ -187,10 +185,9 @@ if(${SUNSHINE_ENABLE_TRAY}) endif() pkg_check_modules(LIBNOTIFY libnotify) if(NOT APPINDICATOR_FOUND OR NOT LIBNOTIFY_FOUND) - set(SUNSHINE_TRAY 0) - message(WARNING "Missing appindicator or libnotify, disabling tray icon") message(STATUS "APPINDICATOR_FOUND: ${APPINDICATOR_FOUND}") message(STATUS "LIBNOTIFY_FOUND: ${LIBNOTIFY_FOUND}") + message(FATAL_ERROR "Couldn't find either appindicator or libnotify") else() include_directories(SYSTEM ${APPINDICATOR_INCLUDE_DIRS} ${LIBNOTIFY_INCLUDE_DIRS}) link_directories(${APPINDICATOR_LIBRARY_DIRS} ${LIBNOTIFY_LIBRARY_DIRS}) @@ -203,10 +200,6 @@ else() message(STATUS "Tray icon disabled") endif() -if(${SUNSHINE_ENABLE_TRAY} AND ${SUNSHINE_TRAY} EQUAL 0 AND SUNSHINE_REQUIRE_TRAY) - message(FATAL_ERROR "Tray icon is required") -endif() - if(${SUNSHINE_USE_LEGACY_INPUT}) # TODO: Remove this legacy option after the next stable release list(APPEND PLATFORM_TARGET_FILES "${CMAKE_SOURCE_DIR}/src/platform/linux/input/legacy_input.cpp") else() diff --git a/cmake/prep/options.cmake b/cmake/prep/options.cmake index 2914c4db..ba1dc193 100644 --- a/cmake/prep/options.cmake +++ b/cmake/prep/options.cmake @@ -22,7 +22,6 @@ option(BUILD_WERROR "Enable -Werror flag." OFF) option(SUNSHINE_CONFIGURE_ONLY "Configure special files only, then exit." OFF) option(SUNSHINE_ENABLE_TRAY "Enable system tray icon. This option will be ignored on macOS." ON) -option(SUNSHINE_REQUIRE_TRAY "Require system tray icon. Fail the build if tray requirements are not met." ON) option(SUNSHINE_SYSTEM_WAYLAND_PROTOCOLS "Use system installation of wayland-protocols rather than the submodule." OFF) @@ -32,6 +31,7 @@ else() option(BOOST_USE_STATIC "Use static boost libraries." ON) endif() +option(CUDA_FAIL_ON_MISSING "Fail the build if CUDA is not found." ON) option(CUDA_INHERIT_COMPILE_OPTIONS "When building CUDA code, inherit compile options from the the main project. You may want to disable this if your IDE throws errors about unknown flags after running cmake." ON) diff --git a/packaging/sunshine.rb b/packaging/sunshine.rb index 68193ec1..98b48eaa 100644 --- a/packaging/sunshine.rb +++ b/packaging/sunshine.rb @@ -105,6 +105,8 @@ class @PROJECT_NAME@ < Formula ohai "Linking against ICU libraries at: #{icu4c_lib_path}" end + args << "-DCUDA_FAIL_ON_MISSING=OFF" if OS.linux? + system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args cd "build" do From bd2e1dc8c0d66f2b3294ef9b21a3f2e4347ad4a4 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 14 Oct 2024 20:34:22 -0500 Subject: [PATCH 11/22] fix(video): encode at least one frame before capture reinit (#3300) --- src/video.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/video.cpp b/src/video.cpp index 5f810860..3824c295 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -1857,7 +1857,14 @@ namespace video { } while (true) { - if (shutdown_event->peek() || reinit_event.peek() || !images->running()) { + // Break out of the encoding loop if any of the following are true: + // a) The stream is ending + // b) Sunshine is quitting + // c) The capture side is waiting to reinit and we've encoded at least one frame + // + // If we have to reinit before we have received any captured frames, we will encode + // the blank dummy frame just to let Moonlight know that we're alive. + if (shutdown_event->peek() || !images->running() || (reinit_event.peek() && frame_nr > 1)) { break; } From 6fa6a7d515b672041a9090b7f2357a0f0e2900d1 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 14 Oct 2024 23:15:53 -0500 Subject: [PATCH 12/22] build(deps): remove unused dependency on libvdpau (#3307) --- cmake/dependencies/common.cmake | 2 +- cmake/packaging/linux.cmake | 2 -- docker/clion-toolchain.dockerfile | 1 - packaging/linux/Arch/PKGBUILD | 1 - packaging/linux/fedora/Sunshine.spec | 2 -- packaging/sunshine.rb | 1 - scripts/linux_build.sh | 2 -- 7 files changed, 1 insertion(+), 10 deletions(-) diff --git a/cmake/dependencies/common.cmake b/cmake/dependencies/common.cmake index 01065b38..5a98a5fd 100644 --- a/cmake/dependencies/common.cmake +++ b/cmake/dependencies/common.cmake @@ -27,7 +27,7 @@ if(NOT DEFINED FFMPEG_PREPARED_BINARIES) if(WIN32) set(FFMPEG_PLATFORM_LIBRARIES mfplat ole32 strmiids mfuuid vpl) elseif(UNIX AND NOT APPLE) - set(FFMPEG_PLATFORM_LIBRARIES numa va va-drm va-x11 vdpau X11) + set(FFMPEG_PLATFORM_LIBRARIES numa va va-drm va-x11 X11) endif() set(FFMPEG_PREPARED_BINARIES "${CMAKE_SOURCE_DIR}/third-party/build-deps/ffmpeg/${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") diff --git a/cmake/packaging/linux.cmake b/cmake/packaging/linux.cmake index 56968d1e..14b89ead 100644 --- a/cmake/packaging/linux.cmake +++ b/cmake/packaging/linux.cmake @@ -51,7 +51,6 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "\ libpulse0, \ libva2, \ libva-drm2, \ - libvdpau1, \ libwayland-client0, \ libx11-6, \ miniupnpc, \ @@ -64,7 +63,6 @@ set(CPACK_RPM_PACKAGE_REQUIRES "\ libevdev >= 1.5.6, \ libopusenc >= 0.2.1, \ libva >= 2.14.0, \ - libvdpau >= 1.5, \ libwayland-client >= 1.20.0, \ libX11 >= 1.7.3.1, \ miniupnpc >= 2.2.4, \ diff --git a/docker/clion-toolchain.dockerfile b/docker/clion-toolchain.dockerfile index 6acd82ff..ec54568c 100644 --- a/docker/clion-toolchain.dockerfile +++ b/docker/clion-toolchain.dockerfile @@ -46,7 +46,6 @@ apt-get install -y --no-install-recommends \ libpulse-dev \ libssl-dev \ libva-dev \ - libvdpau-dev \ libwayland-dev \ libx11-dev \ libxcb-shm0-dev \ diff --git a/packaging/linux/Arch/PKGBUILD b/packaging/linux/Arch/PKGBUILD index 5ee64748..e8729163 100644 --- a/packaging/linux/Arch/PKGBUILD +++ b/packaging/linux/Arch/PKGBUILD @@ -23,7 +23,6 @@ depends=( 'libnotify' 'libpulse' 'libva' - 'libvdpau' 'libx11' 'libxcb' 'libxfixes' diff --git a/packaging/linux/fedora/Sunshine.spec b/packaging/linux/fedora/Sunshine.spec index 73afe050..c19ddf78 100644 --- a/packaging/linux/fedora/Sunshine.spec +++ b/packaging/linux/fedora/Sunshine.spec @@ -27,7 +27,6 @@ BuildRequires: libevdev-devel BuildRequires: libgudev BuildRequires: libnotify-devel BuildRequires: libva-devel -BuildRequires: libvdpau-devel BuildRequires: libX11-devel BuildRequires: libxcb-devel BuildRequires: libXcursor-devel @@ -66,7 +65,6 @@ Requires: libdrm > 2.4.97 Requires: libevdev >= 1.5.6 Requires: libopusenc >= 0.2.1 Requires: libva >= 2.14.0 -Requires: libvdpau >= 1.5 Requires: libwayland-client >= 1.20.0 Requires: libX11 >= 1.7.3.1 Requires: miniupnpc >= 2.2.4 diff --git a/packaging/sunshine.rb b/packaging/sunshine.rb index 98b48eaa..1b603fc1 100644 --- a/packaging/sunshine.rb +++ b/packaging/sunshine.rb @@ -44,7 +44,6 @@ class @PROJECT_NAME@ < Formula depends_on "libdrm" depends_on "libnotify" depends_on "libva" - depends_on "libvdpau" depends_on "libx11" depends_on "libxcb" depends_on "libxcursor" diff --git a/scripts/linux_build.sh b/scripts/linux_build.sh index fc423a2d..4cf4c101 100644 --- a/scripts/linux_build.sh +++ b/scripts/linux_build.sh @@ -106,7 +106,6 @@ function add_debain_based_deps() { "libopus-dev" "libpulse-dev" "libssl-dev" - "libvdpau-dev" "libwayland-dev" # Wayland "libx11-dev" # X11 "libxcb-shm0-dev" # X11 @@ -162,7 +161,6 @@ function add_fedora_deps() { "libdrm-devel" "libevdev-devel" "libnotify-devel" - "libvdpau-devel" "libX11-devel" # X11 "libxcb-devel" # X11 "libXcursor-devel" # X11 From 95a6e8ba506084a3809321bd31acbe773e0dfad2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 08:52:45 -0400 Subject: [PATCH 13/22] build(deps): bump third-party/build-deps from `8c7caa1` to `5ae7ebd` (#3312) Bumps [third-party/build-deps](https://github.com/LizardByte/build-deps) from `8c7caa1` to `5ae7ebd`. - [Commits](https://github.com/LizardByte/build-deps/compare/8c7caa1f7105d60eb7c041b642f1363f481a1f93...5ae7ebdf07168dd824eab36e9e3eeb8a49aa24d8) --- updated-dependencies: - dependency-name: third-party/build-deps dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third-party/build-deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/build-deps b/third-party/build-deps index 8c7caa1f..5ae7ebdf 160000 --- a/third-party/build-deps +++ b/third-party/build-deps @@ -1 +1 @@ -Subproject commit 8c7caa1f7105d60eb7c041b642f1363f481a1f93 +Subproject commit 5ae7ebdf07168dd824eab36e9e3eeb8a49aa24d8 From f429d34ef574e6bc65f20ec41c7986a7350915c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:10:11 +0000 Subject: [PATCH 14/22] build(deps): bump third-party/moonlight-common-c from `8599b60` to `dff1690` (#3313) build(deps): bump third-party/moonlight-common-c Bumps [third-party/moonlight-common-c](https://github.com/moonlight-stream/moonlight-common-c) from `8599b60` to `dff1690`. - [Commits](https://github.com/moonlight-stream/moonlight-common-c/compare/8599b6042a4ba27749b0f94134dd614b4328a9bc...dff1690fe1fe603056ce9b6019f7c52063053f36) --- updated-dependencies: - dependency-name: third-party/moonlight-common-c dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third-party/moonlight-common-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/moonlight-common-c b/third-party/moonlight-common-c index 8599b604..dff1690f 160000 --- a/third-party/moonlight-common-c +++ b/third-party/moonlight-common-c @@ -1 +1 @@ -Subproject commit 8599b6042a4ba27749b0f94134dd614b4328a9bc +Subproject commit dff1690fe1fe603056ce9b6019f7c52063053f36 From d80fe79f816ccaa061003f461d33e7fedfb33905 Mon Sep 17 00:00:00 2001 From: A Literal Midwestern Rodent Date: Wed, 16 Oct 2024 15:57:23 -0500 Subject: [PATCH 15/22] docs(guides): add autostart guide (#3287) Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> --- docs/app_examples.md | 17 ++ docs/guides.md | 582 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 593 insertions(+), 6 deletions(-) diff --git a/docs/app_examples.md b/docs/app_examples.md index 33ad3c34..015fb791 100644 --- a/docs/app_examples.md +++ b/docs/app_examples.md @@ -238,6 +238,23 @@ This script is intended as a drop-in replacement with the same syntax. (It can b | Do | @code{}sh -c "kscreen-doctor output.HDMI-A-1.mode.${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}@${SUNSHINE_CLIENT_FPS}"@endcode | | Undo | @code{}kscreen-doctor output.HDMI-A-1.mode.3840x2160@120@endcode | +@attention{The names of your displays will differ between X11 and Wayland. +Be sure to use the correct name, depending on your session manager. +e.g. On X11, the monitor may be called ``HDMI-A-0``, but on Wayland, it may be called ``HDMI-A-1``. +} + +@hint{Replace ``HDMI-A-1`` with the display name of the monitor you would like to use for Moonlight. +You can list the monitors available to you with: +``` +kscreen-doctor -o +``` + +These will also give you the supported display properties for each monitor. You can select them either by +hard-coding their corresponding number (e.g. ``kscreen-doctor output.HDMI-A1.mode.0``) or using the above +``do`` command to fetch the resolution requested by your Moonlight client +(which has a chance of not being supported by your monitor). +} + ###### NVIDIA | Prep Step | Command | diff --git a/docs/guides.md b/docs/guides.md index 2069a3b5..182399e9 100644 --- a/docs/guides.md +++ b/docs/guides.md @@ -50,6 +50,10 @@ The virtual display is accelerated by the NVidia GPU using the TwinView configur I also only tested this on an Artix runit init system on LAN. I didn't have to do anything special with pulseaudio (pipewire untested). +Pipewire does not seem to work when Sunshine is started over an SSH session. +A workaround to this problem is to kill the Sunshine instance started via SSH, and start a new one +with the permissions of the desktop session. See [Autostart on boot without auto-login](#autostart-on-boot-without-auto-login) + Keep your monitors plugged in until the [Checkpoint](#checkpoint) step.} @tip{Prior to editing any system configurations, you should make a copy of the original file. @@ -291,13 +295,25 @@ To enable root login over SSH edit your SSHD config, and add `PermitRootLogin ye sudo cp /etc/sudoers.d/${USER} /etc/sudoers.d/${USER}.backup ``` -2. `cd` to the parent dir of the `sunshine-setup.sh` script. -3. Execute the following to update your sudoer config file. +2. `cd` to the parent dir of the `sunshine-setup.sh` script and take note of the full filepath. +3. Execute the following to edit your sudoer config file. - ```bash - echo "${USER} ALL=(ALL:ALL) ALL, NOPASSWD: $(pwd)/sunshine-setup.sh" \ - | sudo tee /etc/sudoers.d/${USER} - ``` +@danger{NEVER modify a file in ``sudoers.d`` directly. Always use the ``visudo`` command. This command checks your changes +before saving the file, and if the resulting changes would break sudo on your system, it will prompt you to fix +them. Modifying the file with nano or vim directly does not give you this sanity check and introduces the +possibility of losing sudo access to your machine. Tread carefully, and make a backup.} + +```bash +sudo visudo /etc/sudoers.d/${USER} +``` + +Copy the below configuration into the text editor. Change `${USER}` wherever it occurs to your username +(e.g. if your username is `sunshineisaawesome` you should change `${USER}` to `sunshineisawesome`) +or modify the path if you placed `sunshine-setup.sh` in a different area. + +``` +${USER} ALL=(ALL:ALL) ALL, NOPASSWD: /home/${USER}/scripts/sunshine-setup.sh +``` These changes allow the script to use sudo without being prompted with a password. @@ -484,6 +500,560 @@ and refresh rate prior to connecting to an app. See [Changing Resolution and Refresh Rate](md_docs_2app__examples#changing-resolution-and-refresh-rate) for more information.} +### Autostart on boot without auto-login + +| Author | [MidwesternRodent](https://github.com/midwesternrodent) | +| ---------- | ------------------------------------------------------- | +| Difficulty | Intermediate | + +After following this guide you will be able to: +1. Turn on the Sunshine host via Moonlight's Wake on LAN (WoL) feature. +2. Have Sunshine initialize to the login screen ready for you to enter your credentials. +3. Login to your desktop session remotely, and have your pipewire audio and Sunshine tray icon work appropriately. + +#### Specifications +This guide was created with the following software on the host: +1. OpenSSH server and client (both on the host machine) +2. Sunshine v2024.1003.1754422 +3. Debian 12 w/ KDE Plasma, SDDM, Wayland (also tested through xorg), and pipewire for audio. + +The host hardware that was used in developing this guide: +1. AMD 7900XTX +2. AMD Ryzen 7 7800X3D +3. 128GB DDR5 RAM +4. 4 displays in total. 2 1080p displays, 1 3440x1440 display, and 1 4k Roku TV which is used as the always-on display +for streaming. (could be subbed with a dummy plug). + +If you have used this guide on any alternative hardware or software (including non-debian based distros) +please, feel free to modify this guide and keep it growing! + +#### Caveats +1. When you login the machine will close your connection and you will have to reconnect. This is necessary due to an +issue similar to why the [Uinput Permissions Workaround](#uinput-permissions-workaround) is needed since SSH +connections are not treated the same as graphical logins. This causes weirdness like sound not working through +pipewire, and the tray icon for Sunshine not appearing. To get around this, we need to close the SSH initiated Sunshine +service, and start a new Sunshine service with the permissions of the graphical desktop. Unfortunately, this closes the +connection and forces you to reconnect through Moonlight. There is no way around this to the best of my knowledge +without enabling auto-login. +3. This guide does not cover using virtual displays. If you are using Nvidia graphics, +see [Remote SSH Headless Setup](#remote-ssh-headless-setup). If you are using AMD hardware, let me know +if you find something or feel free to add it to this guide. +4. I haven't (yet) found a way to disable sleep on the login screen, so if you wait too long after starting your PC, +the display may go to sleep and Moonlight will have trouble connecting. Shutting down and using WoL works great +though. + +@attention{This is definitely safer than enabling auto-login directly, especially for a dual-use PC that is not only +streamed via Moonlight, but is also used as a standard desktop. *However* I do not know the implications of having an +always running SSH client to the localhost on the same machine. It may be possible for someone with significant +knowledge and physical access to the machine to compromise your user account due to this always-running SSH session. +However, that's better than just having the desktop always available, or opening up SSH even just your LAN since this +guide specifically disables non-localhost connections, so I believe this is safer to use than auto-login for general +users. As always, your [threat model](https://en.wikipedia.org/wiki/Threat_model) may vary.} + +#### Prerequisites +In [Remote SSH Headless Setup](#remote-ssh-headless-setup) complete the following sections. + +1. [Static IP Setup](#static-ip-setup) +2. [SSH Server Setup](#ssh-server-setup) +3. [Virtual Display Setup](#virtual-display-setup) +4. [Uinput Permissions Workaround](#uinput-permissions-workaround) +5. [Stream Launcher Script](#stream-launcher-script) + +@note{On a default Debian 12 install using KDE Plasma, you are using the Simple Desktop Display Manager (SDDM). +Even if you are logging in to a Wayland session, SDDM by default starts with an xorg session, so this script +does not need to be modified if you primarily use a Wayland session (the default) when you login.} + +#### Instructions + +##### Enable Wake on LAN + +Wake on LAN (WoL) will allow you to send a magic packet to turn your PC on remotely. This is handled automatically by +Moonlight's "send wake on lan" option in the app but you do need to enable it on your host machine first. The +[instructions on the debian.org](https://wiki.debian.org/WakeOnLan#Enabling_WOL) site are a little hard to parse, so +I've simplified them below. + +@note{This may not work on all deb based distributions. If you know of a better way for POP OS, Ubuntu, or another +debian based distro please feel free to edit the guide yourself, or let me know.} + +First, find the name of your ethernet interface. + +```bash +ip link show +``` + +When I run this command, these are the results I receive +``` +1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 +   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +2: enp117s0: mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 +   link/ether 9c:6b:00:59:33:c1 brd ff:ff:ff:ff:ff:ff +``` + +We can ignore the loopback interface, and I can see my ethernet interface is called `enp117s0`. You might see +wireless interfaces here as well but they can also be ignored. + +@note{If your PC is only connected via Wi-Fi, it is still technically possible to get this working, but it is outside +the scope of this guide and requires more networking knowledge and a Wi-Fi chip that supports WoL. If this is your +first foray into linux, I'd recommend just getting a cable.} + +Now I can install ethtool and modify my interface to allow Wake on LAN. For your use, replace `enp117s0` with whatever +the name of your ethernet interface is from the command `ip link show` + +```bash +sudo apt update +sudo apt install ethtool +sudo ethtool -s enp117s0 wol g +``` + +##### SSH Client Setup +To start, we need to install an SSH client (which is different from the *server* in [Remote SSH Headless Setup](#remote-ssh-headless-setup)) +on our machine if this not already done. Open a terminal and enter the following commands. + +```bash +sudo apt update +sudo apt install openssh-client +``` + +Next we need to generate the keys we will use to connect to our SSH session. This is as simple as running the +following in a terminal: + +```bash +ssh-keygen +``` + +and simply pressing enter through the default options. This will place a file called `id_rsa` and `id_rsa.pub` +in the hidden folder `~/.ssh/`. This is the default key used when this user initiates an SSH session. + +Next, we'll copy that public key to the `~/.ssh/authorized_users` file. These are the public keys +allowed to access this machine over SSH, and will allow us to establish an SSH connection with this user +to the SSH server running on the localhost. + +```bash +cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys +``` + +@tip{If you also want any other machines (e.g. a laptop or Steam Deck) to connect to your machine remotely over ssh, +be sure to generate a pubkey on that machine and append it to the authorized_keys file like we did above.} + +###### SSH Server Modifications + +We'll want to make a few modification to the SSH server on the Sunshine host, both for convenience and security. + +Modify `/etc/ssh/sshd_config` with the following changes: + +@tabs{ + @tab{nano | ```bash + sudo nano /etc/ssh/sshd_config + ```} + @tab{vim | ```bash + sudo vi /etc/ssh/sshd_config + ```} +} + +Find the line with `PasswordAuthentication` and make sure it is set to `no` (removed the `#` if present. +Then find the line `PubkeyAuthentication` and make sure it is set to `yes` and remove the `#` from the beginning +if present. When you're done you should have these two lines in your config somewhere. + +``` +PubkeyAuthentication yes +PasswordAuthentication no +``` + +@tip{Using publickey encryption for SSH connections significantly increases your protection against brute force +attacks, and protects you against a rogue machine pretending to be your SSH server and stealing your password.} + +The next step is optional, but if you do not plan on connecting to your computer remotely via ssh and only have +installed SSH for the purposes of using Sunshine, it's a good idea to disable listening for remote SSH connections. +Do this by changing the following lines near the top of your ``sshd_config``: + +``` +#ListenAddress 0.0.0.0 +#ListenAddress :: +``` + +To the following: + +``` +ListenAddress 127.0.0.1 +ListenAddress ::1 +``` + +This will only allow SSH connections coming from your computer itself. + +@tip{on some distributions, the maintainers have added some files in ``/etc/ssh/sshd_config.d/`` which are pulled into +your ``sshd_config``. These modifications can conflict with what we've just done. If you have any files in +``/etc/ssh/sshd_config.d/``, make sure they do not include any of the changes we've just made or you will experience +problems. If they do, you can comment out those lines by placing a ``#`` at their beginning, or delete the files safely +if you don't plan to use SSH for anything other than Sunshine.} + +###### Quick Test and Accept Host Authenticity. + +Next, let's reboot the machine and try to connect! Accept any warnings about the unidentified host at this time, +you'll never see those appear again unless something changes with your setup. + +```bash +ssh $(whoami)@localhost +``` + +You should see a new login prompt for the machine you're already on, and when you type `exit` you should just see + +```bash +logout +Connection to localhost closed. +``` + +##### Run sunshine-setup on boot over SSH + +Thanks to [this comment from Gavin Haynes on Unix Stack exchange](https://unix.stackexchange.com/questions/669389/how-do-i-get-an-ssh-command-to-run-on-boot/669476#669476), +we can establish an SSH connection on boot to run the sunshine-setup script via a systemd service. + +###### Disable default Sunshine services + +These service files are sometimes overwritten when updating Sunshine with the .deb. +So we'll be making new ones and disabling the included service files for our purposes. + +``` +sudo sytstemctl disable sunshine +systemctl --user disable sunshine +``` + +@note{In order to disable the user service, you must be logged in to the graphical desktop environment and run the +command from a GUI terminal. You'll also likely need to approve a polkit request (a graphical popup that asks +for your password). Trying to disable the user service without being signed in to the graphical environment is a +recipe for pain, and is why ``sudo`` is not invoked on the second line in the command above.} + +###### Create the autossh-sunshine-start script + +@tabs{ + @tab{nano | ```bash + sudo nano /usr/local/bin/autossh-sunshine-start + ```} + @tab{vim | ```bash + sudo vi /usr/local/bin/autossh-sunshine-start + ```} +} + +Copy the below script to that location and replace `{USERNAME}` wherever it occurs with the username you created +the SSH public key for in the previous section. + +```bash +#!/bin/bash +ssh -i /home/{USERNAME}/.ssh/id_rsa {USERNAME}@localhost +"/home/{USERNAME}/scripts/sunshine.sh" +``` + +@attention{This script uses the location of the script in [Stream Launcher Script](#stream-launcher-script). +Please complete that section before continuing.} + +Once you've created the script, be sure to make it executable by running: + +```bash +sudo chmod +x /usr/local/bin/autossh-sunshine-start +``` + +###### Create the autossh systemd service file + +@tabs{ + @tab{nano | ```bash + sudo nano /etc/systemd/system/autossh-sunshine.service + ```} + @tab{vim | ```bash + sudo vi /etc/systemd/system/autossh-sunshine.service + ```} +} + +Copy and paste the below systemd file and save it to the location in the commands above. + +``` +[Unit] +Description=Start sunshine over an localhost SSH connection on boot +Requires=sshd.service +After=sshd.service + +[Service] +ExecStartPre=/bin/sleep 5 +ExecStart=/usr/local/bin/autossh-sunshine-start +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=multi-user.target +``` + +Make it executable, and enable the service when you're done. + +```bash +sudo chmod +x /etc/systemd/system/autossh-sunshine.service +sudo systemctl start autossh-sunshine +sudo systemctl enable autossh-sunshine +``` + +This point is a good time for a sanity check, so restart your PC and try to sign in to your desktop via Moonlight. +You should be able to access the login screen, enter your credentials, and control the user session. At this point +you'll notice the reason for the next section as your audio will be non-functional and you won't see any tray icon +for Sunshine. If you don't care about audio (and maybe a couple other bugs you might encounter from time to time due +to the permissions difference between an SSH session and the desktop session), you can consider yourself finished at +this point! + +@note{You might also notice some issues if you have multiple monitors setup (including the dummy plug), like the mouse +cursor not being on the right screen for you to login. We will address this in the last step of this guide. It requires +messing with some configs for SDDM.} + +##### Getting the audio working + +To get the audio (and tray icon, etc...) working we will create a systemd user service, that will start on a graphical +login, kill the autossh-sunshine system service, and start Sunshine just like the standard Sunshine service. +This service will also need to call the autossh-sunshine system service before it is stopped as the user service will +be killed when we log out of the graphical session, so we want to make sure we restart that SSH service so we don't +lose the ability to log back in if we need to. + +@tabs{ + @tab{nano | ```bash + sudo nano /usr/lib/systemd/user/sunshine-after-login.service + ```} + @tab{vim | ```bash + sudo vi /usr/lib/systemd/user/sunshine-after-login.service + ```} +} + +Once again, copy the below service file into your text editor at the location above. + +``` +[Unit] +Description=Start Sunshine with the permissions of the graphical desktop session +StartLimitIntervalSec=500 +StartLimitBurst=5 + +[Service] +# Avoid starting Sunshine before the desktop is fully initialized. +ExecStartPre=/usr/bin/pkill sunshine +ExecStartPre=/bin/sleep 5 +ExecStart=/usr/bin/sunshine +ExecStopPost=/usr/bin/systemctl start autossh-sunshine + +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=xdg-desktop-autostart.target +``` + +Make it executable, and enable it. + +```bash +sudo chmod +x /usr/lib/systemd/user/sunshine-after-login.service +systemctl --user enable sunshine-after-login +``` + +###### Polkit Rules for Sunshine User Service + +Since this is being run with the permissions of the graphical session, we need to make a polkit modification to allow +it to call the system service autossh-sunshine when this user service is stopped, without prompting us for a password. + +@tabs{ + @tab{nano | ```bash + sudo nano /etc/polkit-1/rules.d/sunshine.rules + ```} + @tab{vim | ```bash + sudo vi /etc/polkit-1/rules.d/sunshine.rules + ```} +} + +Once again, copy the below to the .rules file in your text editor. + +```js +polkit.addRule(function(action, subject) { +   if (action.id == "org.freedesktop.systemd1.manage-units" && +       action.lookup("unit") == "autossh-sunshine.service") +   { +       return polkit.Result.YES; +   } +}) +``` + +###### Modifications to sudoers.d files + +Lastly, we need to make a few modifications to the sudoers file for our users. Replace {USERNAME} below with your +username. You will be prompted to select either vi or nano for your editor if you've not used this command before, +choose whichever you prefer. + +``` +sudo visudo /etc/sudoers.d/{USERNAME} +``` + +@danger{NEVER modify a file in ``sudoers.d`` directly. Always use the ``visudo`` command. This command checks your changes +before saving the file, and if the resulting changes would break sudo on your system, it will prompt you to fix +them. Modifying the file with nano or vim directly does not give you this sanity check and introduces the +possibility of losing sudo access to your machine. Tread carefully, and make a backup.} + +As always, copy and paste the below into your user's `sudoers.d` configuration. Replace {USERNAME} with your username, +and {HOSTNAME} with the name of your computer. + +``` +{USERNAME} {HOSTNAME} = (root) NOPASSWD: /home/{USERNAME}/scripts/sunshine-setup.sh +{USERNAME} {HOSTNAME} = (root) NOPASSWD: /bin/sunshine +{USERNAME} {HOSTNAME} = (root) NOPASSWD: /usr/bin/systemctl start autossh-sunshine +{USERNAME} {HOSTNAME} = (root) NOPASSWD: /usr/bin/systemctl --user start sunshine-after-login +# The below is optional, but will allow us to send trigger a shutdown with a sunshine prep command, if desired. +{USERNAME} {HOSTNAME} = (root) NOPASSWD: /usr/sbin/shutdown +``` + +Once again, restart your computer and do a quick test. Make sure you can connect to the PC to login and enter your +credentials. You should be booted out of the system, and then can reconnect a few seconds later to the logged-in +desktop session. You should see a tray icon for Sunshine, and the sound should be working (or you may need to manually +select the sunshine-sink at least the first time). + +If you don't have multiple monitors, at this point you can consider yourself done! + +##### Configuring the login screen layout for multiple monitors + +This is not Sunshine specific, but is a frequent problem I had setting up Sunshine and thought it pertinent to add to +the guide. If you are using multiple monitors (even a single monitor with a dummy plug may have this problem) you +might notice the streamed login screen has one or more of the following problems: + +1. The text is way too small to see (caused by a too-high resolution) +2. The mouse cursor is off on some other screen (caused by not mirroring the displays) +3. There are multiple login screens overlapping each other (caused by differing resolutions, and trying to mirror +the display). + +###### Log in to an X11 Session + +This can be fixed, by modifying some scripts called by SDDM on boot. To start though, we need to make sure we're +logged into an x11 session, not Wayland or the terminal. As the Wayland session will give us incorrect information, +and the terminal will give us no information since no graphical environment exists. SDDM initially starts an x11 +session to display the login screen so we need to use xorg commands to change the display configuration. + +To do this, log out of your desktop session on the Sunshine host, and somewhere on the lower left of your screen +(depending on your SDDM theme) there will be some text that on Debian 12 KDE Plasma defaults to saying +`Session: Plasma (Wayland)`. Select this and choose `Plasma (X11)` from the drop down menu and sign in. + +###### Find your monitor identifiers. + +Open a terminal and run: + +```bash +xrandr | grep -w connected +``` + +This will require some more sleuthing on your part. Different PC hardware, and different monitors / connectors, +display the names differently. Some start at 0, some start 1. Some spell out "DisplayPort" some, say "DP". You will +need to modify all of the commands from here on out based on the output of the above command. I will use the output I +receive below as the example for the rest of this guide. + +```bash +DisplayPort-0 connected (normal left inverted right x axis y axis) +DisplayPort-1 connected (normal left inverted right x axis y axis) +DisplayPort-2 connected (normal left inverted right x axis y axis) +HDMI-A-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 800mm x 450mm +``` + +@note{If I instead run this command on Wayland, I get the following useless output. Hence the need to sign in to an +x11 session. + +```bash +XWAYLAND0 connected 2592x1458+6031+0 (normal left inverted right x axis y axis) 600mm x 340mm +XWAYLAND1 connected 2592x1458+0+0 (normal left inverted right x axis y axis) 480mm x 270mm +XWAYLAND2 connected primary 3440x1440+2592+0 (normal left inverted right x axis y axis) 800mm x 330mm +XWAYLAND3 connected 2592x1458+0+0 (normal left inverted right x axis y axis) 1440mm x 810mm + +``` +} + + +From this, you can see that my monitors are named the following under an x11 session. + +DisplayPort-0 +DisplayPort-1 +DisplayPort-2 +HDMI-A-0 + +@tip{If you have a label maker, now would be a good time to unplug some cables, determine where they are on your +system, and label the outputs on your graphics card to ease changing your setup in the future.} + +In my setup, after moving some inputs I changed my system so that these cables correspond to the below monitors + +| Display Name | Monitor | +| ------------- | --------------------------- | +| DisplayPort-0 | rightmost 1080p display | +| DisplayPort-1 | leftmost 1080p display | +| DisplayPort-2 | middle 3440x1440 display | +| HDMI-A-0 | 4k Roku TV (and dummy plug) | + +###### Modify the SDDM startup script + +For my purposes, I would prefer to have the Roku TV (which doubles as my always-on dummy plug) to always display a +1080p screen on login (this can be changed automatically after login). And I would like to retain the ability to use +my leftmost monitor to login to my physical desktop, but I'd like to disable my primary and rightmost displays. + +To do this, we need to modify the SDDM startup script to shut off DisplayPort-1 and DisplayPort-2, set HDMI-A-0 to +1080p and mirror it with DisplayPort-1. + +@tabs{ + @tab{nano | ```bash + sudo nano /usr/share/sddm/scripts/Xsetup + ```} + @tab{vim | ```bash + sudo vi /usr/share/sddm/scripts/Xsetup + ```} +} + +Which will open a script that looks like this. We will not be removing these lines. + +```bash +#!/bin/sh +# Xsetup - run as root before the login dialog appears + +if [ -e /sbin/prime-offload ]; then +   echo running NVIDIA Prime setup /sbin/prime-offload +   /sbin/prime-offload +fi +``` + +At the bottom of this Xsetup script though, we can add some xrandr commands + +To shut a display off, we can use: `xrandr --output {DISPLAYNAME} --off`. + +To set a display as the primary and accept +it's automatic (usually the maximum, but not always especially on TVs where the default refresh rate may be lower) +resolution and refresh rate we can use: `xrandr --output {DISPLAYNAME} --auto --primary`. + +To set a display to a specific resolution we can use: `xrandr --output {DISPLAYNAME} --mode {PIXELWIDTH}x{PIXELLENGTH}`. + +And lastly, to mirror a display we can use: `xrandr --output {DISPLAYNAME} --same-as {ANOTHER-DISPLAY}` + +So with my desire to mirror my TV and left displays, my Xsetup script now looks like this: + +```bash +#!/bin/sh +# Xsetup - run as root before the login dialog appears + +if [ -e /sbin/prime-offload ]; then +   echo running NVIDIA Prime setup /sbin/prime-offload +   /sbin/prime-offload +fi + +xrandr --output DisplayPort-0 --off +xrandr --output DisplayPort-2 --off +xrandr --output DisplayPort-1 --auto --primary +xrandr --output HDMI-A-0 --mode 1920x1080 +xrandr --output HDMI-A-0 --same-as DisplayPort-1 +``` + +Save this file, reboot, and you should see your login screen now respects these settings. Make sure when you log +back in, you select a Wayland session (if that is your preferred session manager). + +#### Next Steps + +Congratulations! You now have Sunshine starting on boot, you can login to your session remotely, you get all the +benefits of the graphical session permissions, and you can safely shut down your PC with the confidence you can +turn it back on when needed. + +@seealso{As Eric Dong recommended, I'll also send you to automate changing your displays. +You can add multiple commands, to turn off, or configure as many displays as you'd like with the sunshine prep +commands. See [Changing Resolution and Refresh Rate](md_docs_2app__examples#changing-resolution-and-refresh-rate) +for more information and remember that the display names for your prep commands, may be different than what you +found for SDDM.} + ## macOS @todo{It's looking lonely here.} From fc78f5a4e0b6649a2f59c4299c60ff8e02ddbca6 Mon Sep 17 00:00:00 2001 From: Caveat <59033732+caveat-makes-software@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:48:14 +0200 Subject: [PATCH 16/22] docs: improve flatpak start commands (#3264) --- docs/getting_started.md | 2 +- .../linux/flatpak/dev.lizardbyte.app.Sunshine.metainfo.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index 02de66e3..4b0533ee 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -224,7 +224,7 @@ flatpak run dev.lizardbyte.app.Sunshine ##### Run with KMS capture (Wayland & X11) ```bash -sudo -i PULSE_SERVER=unix:$(pactl info | awk '/Server String/{print$3}') flatpak run dev.lizardbyte.app.Sunshine +sudo -i PULSE_SERVER=unix:/run/user/$(id -u $whoami)/pulse/native flatpak run dev.lizardbyte.app.Sunshine ``` ##### Uninstall diff --git a/packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.metainfo.xml b/packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.metainfo.xml index 7b4f1f18..43c4cbdf 100644 --- a/packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.metainfo.xml +++ b/packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.metainfo.xml @@ -32,7 +32,7 @@

flatpak run --command=additional-install.sh @PROJECT_FQDN@

NOTE: Sunshine uses a self-signed certificate. The web browser will report it as not secure, but it is safe.

NOTE: KMS Grab (Optional)

-

sudo -i PULSE_SERVER=unix:$(pactl info | awk '/Server String/{print$3}') flatpak run @PROJECT_FQDN@

+

sudo -i PULSE_SERVER=unix:/run/user/$(id -u $whoami)/pulse/native flatpak run @PROJECT_FQDN@

From a3ba700522d5ee2bbc1b3eefe2c0d35c6faa57ac Mon Sep 17 00:00:00 2001 From: Degot <1160122+Degot@users.noreply.github.com> Date: Sat, 19 Oct 2024 05:49:34 +0300 Subject: [PATCH 17/22] fix: Reverse Proxy support (#3173) --- src_assets/common/assets/web/Navbar.vue | 14 +++++++------- src_assets/common/assets/web/apps.html | 10 +++++----- src_assets/common/assets/web/config.html | 6 +++--- src_assets/common/assets/web/index.html | 6 +++--- src_assets/common/assets/web/locale.js | 4 ++-- src_assets/common/assets/web/password.html | 2 +- src_assets/common/assets/web/pin.html | 2 +- src_assets/common/assets/web/template_header.html | 4 ++-- src_assets/common/assets/web/troubleshooting.html | 12 ++++++------ src_assets/common/assets/web/welcome.html | 4 ++-- vite.config.js | 1 + 11 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src_assets/common/assets/web/Navbar.vue b/src_assets/common/assets/web/Navbar.vue index 2358750b..166398b9 100644 --- a/src_assets/common/assets/web/Navbar.vue +++ b/src_assets/common/assets/web/Navbar.vue @@ -1,7 +1,7 @@