diff --git a/README.md b/README.md index 0f7cc5e..99b370b 100644 --- a/README.md +++ b/README.md @@ -74,10 +74,9 @@ No network connection or JavaScript runtime is needed to display the icons on th ## Video presentation -**Settings → Display → Video Presentation** defaults to **Software**, which writes directly to the -framebuffer when available and performed better in xemu. **GPU** uses NV2A color conversion and scaling -with automatic software fallback. The setting is saved as `streaming.gpu_presentation` and both paths -are available in the same build. +**Settings → Display → Video Presentation** defaults to **GPU**, which uses NV2A color conversion and +scaling with automatic software fallback. **Software** combines the decoded video and overlay on the +CPU before displaying each frame. Moonlight keeps your selection in `streaming.gpu_presentation`. ## Stream audio diff --git a/src/_nxdk_compat/ffmpeg_memory.h b/src/_nxdk_compat/ffmpeg_memory.h index 22be585..7180ef2 100644 --- a/src/_nxdk_compat/ffmpeg_memory.h +++ b/src/_nxdk_compat/ffmpeg_memory.h @@ -1,6 +1,6 @@ /** * @file src/_nxdk_compat/ffmpeg_memory.h - * @brief Declares the aligned allocation family used privately by FFmpeg. + * @brief Declares aligned allocation for FFmpeg and software scanout on Xbox. */ #pragma once diff --git a/src/app/client_state.h b/src/app/client_state.h index b0931ee..9083590 100644 --- a/src/app/client_state.h +++ b/src/app/client_state.h @@ -78,6 +78,7 @@ namespace app { inline constexpr int DEFAULT_STREAM_FRAMERATE = 60; ///< Stream frame rate at the default 640x480 resolution. inline constexpr int DEFAULT_STREAM_BITRATE_KBPS = 3000; ///< Bitrate for the default 640x480, 60 FPS profile. + inline constexpr bool DEFAULT_GPU_PRESENTATION = true; ///< Default to NV2A presentation with software fallback. /** * @brief Focus areas used by the two-pane settings screen. @@ -387,7 +388,7 @@ namespace app { * @brief Preferences for presenting decoded video and its on-screen statistics. */ struct VideoPresentationPreferences { - bool gpuPresentation = false; ///< Opt in to NV2A presentation with software fallback on new streams. + bool gpuPresentation = DEFAULT_GPU_PRESENTATION; ///< Use NV2A presentation with software fallback on new streams. bool showPerformanceStats = false; ///< Display live performance telemetry and include it in the stream summary. }; diff --git a/src/app/settings_storage.h b/src/app/settings_storage.h index f1b11dd..2afa650 100644 --- a/src/app/settings_storage.h +++ b/src/app/settings_storage.h @@ -29,7 +29,7 @@ namespace app { bool playAudioOnXbox = true; ///< True when the Xbox should decode and play streamed audio locally. std::string screenshotDirectory; ///< Screenshot folder; empty selects the title-scoped screenshots directory. bool keyboardDockTop = false; ///< Dock the stream keyboard to the top instead of the bottom. - bool gpuPresentation = false; ///< Opt in to NV2A presentation with software fallback. + bool gpuPresentation = DEFAULT_GPU_PRESENTATION; ///< Use NV2A presentation with software fallback. streaming::AudioMode audioMode = streaming::AudioMode::stereo; ///< Source channels and local playback mix. }; @@ -59,7 +59,7 @@ namespace app { std::string default_settings_path(); /** - * @brief Load saved preferences, defaulting to stereo and deriving the bitrate when absent. + * @brief Load saved preferences. Missing values use GPU presentation, stereo audio, and a bitrate derived from the stream mode. * * @param filePath Settings file to read. * @return Loaded settings plus any non-fatal warnings. diff --git a/src/streaming/ffmpeg_stream_backend.cpp b/src/streaming/ffmpeg_stream_backend.cpp index b9038bf..45e3bd1 100644 --- a/src/streaming/ffmpeg_stream_backend.cpp +++ b/src/streaming/ffmpeg_stream_backend.cpp @@ -595,17 +595,6 @@ namespace streaming { return video_.codecName; } - /** - * @brief Return whether two SDL rectangles describe the same area. - * - * @param left First rectangle. - * @param right Second rectangle. - * @return True when every rectangle field matches. - */ - bool rectangles_match(const SDL_Rect &left, const SDL_Rect &right) { - return left.x == right.x && left.y == right.y && left.w == right.w && left.h == right.h; - } - #ifdef NXDK /** * @brief Convert the active Xbox framebuffer bpp to FFmpeg's packed RGB format. @@ -663,10 +652,10 @@ namespace streaming { " ms / age " + std::to_string(video_.lastReceiveAgeUs.load() / 1000U) + " ms | " + audio_.describe_playback(); } - bool FfmpegStreamBackend::render_latest_video_frame(SDL_Renderer *renderer, int screenWidth, int screenHeight, bool allowDirectFramebuffer) { + bool FfmpegStreamBackend::render_latest_video_frame(SDL_Renderer *renderer, int screenWidth, int screenHeight) { const auto before = acceleration_.gpuFrames + acceleration_.softwareFrames; const auto started = PltGetMicroseconds(); - const bool result = render_video_frame(renderer, screenWidth, screenHeight, allowDirectFramebuffer); + const bool result = render_video_frame(renderer, screenWidth, screenHeight); if (result) { statisticsBitmapChanged_ = false; if (acceleration_.gpuFrames + acceleration_.softwareFrames > before) { @@ -676,12 +665,12 @@ namespace streaming { return result; } - bool FfmpegStreamBackend::render_video_frame(SDL_Renderer *renderer, int screenWidth, int screenHeight, bool allowDirectFramebuffer) { + bool FfmpegStreamBackend::render_video_frame(SDL_Renderer *renderer, int screenWidth, int screenHeight) { if (renderer == nullptr || !video_.hasFrame.load()) { return false; } - bool textureNeedsUpload = false; + bool newFrame = false; if (const std::uint64_t publishedFrameVersion = video_.publishedFrameVersion.load(); publishedFrameVersion != video_.renderedFrameVersion) { std::scoped_lock lock(video_.frame_mutex()); if (video_.latestFrameVersion != video_.renderedFrameVersion && video_.latestFrame.view().width > 0) { @@ -690,7 +679,7 @@ namespace streaming { } video_.renderFrame.swap(video_.latestFrame); video_.renderedFrameVersion = video_.latestFrameVersion; - textureNeedsUpload = true; + newFrame = true; } } @@ -699,40 +688,56 @@ namespace streaming { return false; } + const SDL_Rect destination = build_letterboxed_destination(screenWidth, screenHeight, frame.width, frame.height); #ifdef NXDK - if (allowDirectFramebuffer && gpuPresentationEnabled_ && !overlayFailed_) { - if (!textureNeedsUpload && !statisticsBitmapChanged_ && presenter_.active()) { - return true; - } - const SDL_Rect destination = build_letterboxed_destination(screenWidth, screenHeight, frame.width, frame.height); - if (!presenter_.active()) { - const VIDEO_MODE mode = XVideoGetMode(); - if (auto *framebuffer = XVideoGetFB(); framebuffer != nullptr && mode.width > 0 && mode.height > 0 && (mode.bpp == 16 || mode.bpp == 32)) { - std::memset(framebuffer, 0, static_cast(mode.width) * static_cast(mode.height) * static_cast(mode.bpp / 8)); - XVideoFlushFB(); - } - } - std::string reason; - if (presenter_.present(frame, {destination.x, destination.y, destination.w, destination.h}, &reason, {}, &statisticsOverlay_)) { - if (textureNeedsUpload) { - ++acceleration_.gpuFrames; + if (render_gpu_video_frame(destination, newFrame)) { + return true; + } + if (!softwareScanoutFailed_) { + if (render_latest_video_frame_to_framebuffer(screenWidth, screenHeight)) { + if (newFrame) { + ++acceleration_.softwareFrames; } return true; } + softwareScanoutFailed_ = true; + logging::warn("stream", "Double-buffered scanout unavailable; using SDL software presentation"); + stop_video_presentation(); + } +#endif + return render_sdl_video_frame(renderer, destination, newFrame); + } + +#ifdef NXDK + bool FfmpegStreamBackend::render_gpu_video_frame(const SDL_Rect &destination, bool newFrame) { + if (!gpuPresentationEnabled_ || overlayFailed_) { + return false; + } + if (!newFrame && !statisticsBitmapChanged_ && presenter_.active()) { + return true; + } + if (!presenter_.active()) { + const VIDEO_MODE mode = XVideoGetMode(); + if (auto *framebuffer = XVideoGetFB(); framebuffer != nullptr && mode.width > 0 && mode.height > 0 && (mode.bpp == 16 || mode.bpp == 32)) { + std::memset(framebuffer, 0, static_cast(mode.width) * static_cast(mode.height) * static_cast(mode.bpp / 8)); + XVideoFlushFB(); + } + } + if (std::string reason; !presenter_.present(video_.renderFrame.view(), {destination.x, destination.y, destination.w, destination.h}, &reason, {}, &statisticsOverlay_)) { overlayFailed_ = true; acceleration_.record_fallback(reason); logging::warn("stream", "GPU presentation fallback: " + reason); + return false; } - if (allowDirectFramebuffer && render_latest_video_frame_to_framebuffer(screenWidth, screenHeight)) { - if (textureNeedsUpload) { - ++acceleration_.softwareFrames; - } - return true; + if (newFrame) { + ++acceleration_.gpuFrames; } -#else - (void) allowDirectFramebuffer; + return true; + } #endif + bool FfmpegStreamBackend::render_sdl_video_frame(SDL_Renderer *renderer, const SDL_Rect &destination, bool textureNeedsUpload) { + const auto &frame = video_.renderFrame.view(); if (video_.texture == nullptr || video_.textureWidth != frame.width || video_.textureHeight != frame.height) { if (video_.texture != nullptr) { SDL_DestroyTexture(video_.texture); @@ -755,10 +760,12 @@ namespace streaming { return false; } - const SDL_Rect destination = build_letterboxed_destination(screenWidth, screenHeight, frame.width, frame.height); + SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); + SDL_RenderClear(renderer); const bool presented = SDL_RenderCopy(renderer, video_.texture, nullptr, &destination) == 0; if (presented) { render_sdl_statistics(renderer, destination); + SDL_RenderPresent(renderer); } if (presented && textureNeedsUpload) { ++acceleration_.softwareFrames; @@ -808,6 +815,7 @@ namespace streaming { acceleration_.gpuPresentationRequested = gpuPresentationEnabled_; statistics_.reset(); overlayFailed_ = false; + softwareScanoutFailed_ = false; const int cpuFlags = av_get_cpu_flags(); acceleration_.cpuFeatures = (cpuFlags & AV_CPU_FLAG_SSE) != 0 ? "MMX/SSE" : ((cpuFlags & AV_CPU_FLAG_MMX) != 0 ? "MMX" : "Scalar"); acceleration_.threaded = std::string(avcodec_configuration()).find("--enable-w32threads") != std::string::npos; @@ -885,6 +893,9 @@ namespace streaming { acceleration_.record_fallback("GPU overlay teardown timed out; acceleration disabled"); logging::warn("stream", "GPU overlay teardown timed out; buffers retained to avoid DMA into freed storage"); } + if (!softwareScanout_.reset()) { + logging::warn("stream", "Software scanout retirement timed out; extra framebuffer retained"); + } } void FfmpegStreamBackend::cleanup_video_decoder() { @@ -935,8 +946,6 @@ namespace streaming { video_.renderedFrameVersion = 0; video_.publishedFrameVersion.store(0); video_.codecName = "video"; - video_.directFramebufferDestination = SDL_Rect {0, 0, 0, 0}; - video_.directFramebufferCleared = false; video_.decoderStopRequested.store(false); video_.hasFrame.store(false); video_.submittedDecodeUnitCount.store(0); @@ -1071,10 +1080,9 @@ namespace streaming { bool FfmpegStreamBackend::render_latest_video_frame_to_framebuffer(int screenWidth, int screenHeight) { #ifdef NXDK const VIDEO_MODE videoMode = XVideoGetMode(); - std::uint8_t *framebuffer = XVideoGetFB(); const int bytesPerPixel = xbox_framebuffer_bytes_per_pixel(videoMode.bpp); const AVPixelFormat destinationFormat = xbox_framebuffer_pixel_format(videoMode.bpp); - if (framebuffer == nullptr || videoMode.width <= 0 || videoMode.height <= 0 || bytesPerPixel <= 0 || destinationFormat == AV_PIX_FMT_NONE) { + if (videoMode.width <= 0 || videoMode.height <= 0 || bytesPerPixel <= 0 || destinationFormat == AV_PIX_FMT_NONE) { return false; } @@ -1087,10 +1095,11 @@ namespace streaming { } const int framebufferPitch = videoMode.width * bytesPerPixel; - if (!video_.directFramebufferCleared || !rectangles_match(video_.directFramebufferDestination, destination)) { - std::memset(framebuffer, 0, static_cast(framebufferPitch) * static_cast(videoMode.height)); - video_.directFramebufferDestination = destination; - video_.directFramebufferCleared = true; + const auto framebufferSize = static_cast(framebufferPitch) * videoMode.height; + const VideoRectangle videoArea {destination.x, destination.y, destination.w, destination.h}; + auto *framebuffer = softwareScanout_.back_buffer(framebufferSize, videoArea); + if (framebuffer == nullptr) { + return false; } video_.presentScaleContext = sws_getCachedContext( @@ -1141,9 +1150,8 @@ namespace streaming { return false; } - statisticsOverlay_.draw_rgb(framebuffer, static_cast(framebufferPitch) * videoMode.height, framebufferPitch, videoMode.width, videoMode.height, videoMode.bpp, {destination.x, destination.y, destination.w, destination.h}); - XVideoFlushFB(); - return true; + statisticsOverlay_.draw_rgb(framebuffer, framebufferSize, framebufferPitch, videoMode.width, videoMode.height, videoMode.bpp, videoArea); + return softwareScanout_.present(); #else (void) screenWidth; (void) screenHeight; diff --git a/src/streaming/ffmpeg_stream_backend.h b/src/streaming/ffmpeg_stream_backend.h index f6087a5..d3b944d 100644 --- a/src/streaming/ffmpeg_stream_backend.h +++ b/src/streaming/ffmpeg_stream_backend.h @@ -23,6 +23,7 @@ #include "src/streaming/audio_player.h" #include "src/streaming/ffmpeg_video_frame.h" #include "src/streaming/pvideo_presenter.h" +#include "src/streaming/software_scanout.h" #include "src/streaming/stats_overlay.h" struct AVCodecContext; @@ -183,10 +184,9 @@ namespace streaming { * @param renderer SDL renderer used by the stream session. * @param screenWidth Current renderer output width. * @param screenHeight Current renderer output height. - * @param allowDirectFramebuffer True when platform-specific direct presentation may bypass SDL's renderer. - * @return True when a decoded frame was available and rendered. + * @return True when decoded video is displayed on any presentation path. */ - bool render_latest_video_frame(SDL_Renderer *renderer, int screenWidth, int screenHeight, bool allowDirectFramebuffer = true); + bool render_latest_video_frame(SDL_Renderer *renderer, int screenWidth, int screenHeight); /** * @brief Restore CPU framebuffer output before drawing shutdown or summary UI on the render thread. @@ -262,10 +262,24 @@ namespace streaming { * @param renderer SDL video renderer. * @param screenWidth Output width. * @param screenHeight Output height. - * @param allowDirectFramebuffer Permit Xbox GPU or direct framebuffer presentation. * @return True after successful presentation. */ - bool render_video_frame(SDL_Renderer *renderer, int screenWidth, int screenHeight, bool allowDirectFramebuffer); + bool render_video_frame(SDL_Renderer *renderer, int screenWidth, int screenHeight); + /** + * @brief Present the current video and UI through the GPU overlay when available. + * @param destination Output video rectangle. + * @param newFrame True when a new decoded frame was acquired. + * @return True when GPU presentation is active and the output is up to date. + */ + bool render_gpu_video_frame(const SDL_Rect &destination, bool newFrame); + /** + * @brief Upload and present the current video and UI through SDL. + * @param renderer SDL video renderer. + * @param destination Output video rectangle. + * @param textureNeedsUpload True when a new decoded frame was acquired. + * @return True after successful SDL presentation. + */ + bool render_sdl_video_frame(SDL_Renderer *renderer, const SDL_Rect &destination, bool textureNeedsUpload); /** * @brief Draw the cached panel when the SDL presentation fallback is used. * @param renderer SDL video renderer. @@ -406,11 +420,9 @@ namespace streaming { mutable std::mutex frameMutex_; ///< Guards latest decoded frame publication between worker and render threads. public: - SDL_Rect directFramebufferDestination {0, 0, 0, 0}; FfmpegVideoFrame latestFrame; ///< Mailbox slot exchanged under frameMutex_. FfmpegVideoFrame decodeFrame; ///< Decoder-owned slot reused to publish each new reference. FfmpegVideoFrame renderFrame; ///< Render-thread reference retained for presentation and UI redraws. - bool directFramebufferCleared = false; std::atomic decoderStopRequested = false; std::atomic hasFrame = false; std::atomic publishedFrameVersion = 0; @@ -427,6 +439,7 @@ namespace streaming { AudioPlayer audio_; ///< Session Opus decoder and SDL playback device. ScreenshotTask screenshot_ {}; ///< Single capture slot, bounded to one additional YUV frame. PvideoPresenter presenter_; ///< Main-thread GPU presentation resources. + SoftwareScanout softwareScanout_; ///< Main-thread software scanout pages. VideoOverlay statisticsOverlay_; ///< Shared cached panel for all presentation paths. VideoStatistics statistics_; ///< Cumulative decode and presentation telemetry. SDL_Texture *statisticsTexture_ = nullptr; ///< Cached panel texture for SDL's final fallback. @@ -434,8 +447,9 @@ namespace streaming { bool statisticsTextureChanged_ = false; ///< SDL texture requires the current bitmap. VideoRectangle statisticsTextureDamage_ {}; ///< Pending SDL texture upload, accumulated until software presentation. VideoAccelerationReport acceleration_; ///< Session diagnostics survive decoder cleanup. - bool gpuPresentationEnabled_ = false; ///< Session opt-in applied before decoder setup. + bool gpuPresentationEnabled_ = false; ///< Session preference applied before decoder setup. bool overlayFailed_ = false; ///< Avoid repeating a known failing hardware path this session. + bool softwareScanoutFailed_ = false; ///< Use the SDL fallback after software scanout fails. }; } // namespace streaming diff --git a/src/streaming/session.cpp b/src/streaming/session.cpp index e28058a..b5a2740 100644 --- a/src/streaming/session.cpp +++ b/src/streaming/session.cpp @@ -1208,26 +1208,13 @@ namespace { SDL_GetRendererOutputSize(resources->renderer, &screenWidth, &screenHeight); const bool hasDecodedVideo = mediaBackend != nullptr && mediaBackend->has_decoded_video(); -#ifdef NXDK - if (hasDecodedVideo && mediaBackend->render_latest_video_frame(resources->renderer, screenWidth, screenHeight, true)) { + if (hasDecodedVideo && mediaBackend->render_latest_video_frame(resources->renderer, screenWidth, screenHeight)) { render_stream_input_diagnostics(resources); return true; } -#endif - if (hasDecodedVideo) { - SDL_SetRenderDrawColor(resources->renderer, 0x00, 0x00, 0x00, 0xFF); - } else { - SDL_SetRenderDrawColor(resources->renderer, BACKGROUND_RED, BACKGROUND_GREEN, BACKGROUND_BLUE, 0xFF); - } + SDL_SetRenderDrawColor(resources->renderer, BACKGROUND_RED, BACKGROUND_GREEN, BACKGROUND_BLUE, 0xFF); SDL_RenderClear(resources->renderer); - const bool renderedVideo = hasDecodedVideo && mediaBackend->render_latest_video_frame(resources->renderer, screenWidth, screenHeight, false); - if (renderedVideo) { - SDL_RenderPresent(resources->renderer); - render_stream_input_diagnostics(resources); - return true; - } - int cursorY = 28; int titleHeight = 0; render_text_line(resources->renderer, resources->titleFont, "Moonlight Streaming", {{ACCENT_RED, ACCENT_GREEN, ACCENT_BLUE, 0xFF}, 28, cursorY, std::max(1, screenWidth - 56), &titleHeight}); @@ -1240,11 +1227,9 @@ namespace { mediaBackend != nullptr ? mediaBackend->build_overlay_status_line() : std::string("FFmpeg decode backend unavailable"), input::STREAM_EXIT_HINT, }; - if (!renderedVideo) { - lines.emplace(lines.begin() + 2, std::string("Mode: ") + std::to_string(context.streamConfiguration.width) + "x" + std::to_string(context.streamConfiguration.height) + " @ " + std::to_string(context.streamConfiguration.fps) + " FPS | " + (mediaBackend != nullptr ? mediaBackend->active_video_decoder_name() : std::string("video")) + " | Stereo"); - lines.emplace(lines.begin() + 4, std::string("Launch mode: ") + (context.serverInformation.rtspSessionUrl != nullptr ? "Session URL supplied by host" : "Default RTSP discovery")); - lines.emplace(lines.begin() + 5, "Waiting for the first decoded video frame and audio output."); - } + lines.emplace(lines.begin() + 2, std::string("Mode: ") + std::to_string(context.streamConfiguration.width) + "x" + std::to_string(context.streamConfiguration.height) + " @ " + std::to_string(context.streamConfiguration.fps) + " FPS | " + (mediaBackend != nullptr ? mediaBackend->active_video_decoder_name() : std::string("video")) + " | Stereo"); + lines.emplace(lines.begin() + 4, std::string("Launch mode: ") + (context.serverInformation.rtspSessionUrl != nullptr ? "Session URL supplied by host" : "Default RTSP discovery")); + lines.emplace(lines.begin() + 5, "Waiting for the first decoded video frame and audio output."); render_text_lines(resources->renderer, resources->bodyFont, lines, screenWidth, &cursorY); diff --git a/src/streaming/software_scanout.cpp b/src/streaming/software_scanout.cpp new file mode 100644 index 0000000..20d2b6d --- /dev/null +++ b/src/streaming/software_scanout.cpp @@ -0,0 +1,154 @@ +/** + * @file src/streaming/software_scanout.cpp + * @brief Composes software frames off-screen before publishing them through Xbox scanout. + */ +// class header include +#include "src/streaming/software_scanout.h" + +// local includes +#include "src/_nxdk_compat/ffmpeg_memory.h" + +#ifdef NXDK + // standard includes + #include + + // nxdk includes + #include + #include + #include + #include + +namespace { + constexpr std::uint32_t CRTC_START = 0x600800; ///< Physical address of the primary scanout page. + constexpr std::uint32_t CRTC_INTERRUPT = 0x600100; ///< Display interrupt status with write-one-to-clear semantics. + constexpr std::uint32_t VBLANK = 1; ///< End of active display. + + /** + * @brief Wait for a fresh vblank without taking ownership of the display IRQ. + * @return True when a vblank occurs within 50 milliseconds. + */ + bool wait_for_vblank() { + VIDEOREG(CRTC_INTERRUPT) = VBLANK; + const auto start = GetTickCount(); + while ((VIDEOREG(CRTC_INTERRUPT) & VBLANK) == 0) { + if (GetTickCount() - start >= 50U) { + return false; + } + Sleep(1); + } + return true; + } + + /** + * @brief Program the scanout address, leaving nxdk's CPU framebuffer pointer intact for SDL. + * @param page Contiguous framebuffer allocation. + */ + void set_scanout(std::uint8_t *page) { + VIDEOREG(CRTC_START) = static_cast(MmGetPhysicalAddress(page)); + } +} // namespace +#endif + +namespace streaming { + void SoftwareScanout::StagingBufferDeleter::operator()(std::byte *buffer) const noexcept { + moonlight_ffmpeg_aligned_free(buffer); + } + + SoftwareScanout::~SoftwareScanout() { + reset(); + } + + std::uint8_t *SoftwareScanout::back_buffer(std::size_t size, const VideoRectangle &destination) { +#ifdef NXDK + if (!synchronized_) { + return nullptr; + } + if (pages_[1] == nullptr) { + pages_[0] = XVideoGetFB(); + if (pages_[0] == nullptr || size == 0) { + return nullptr; + } + if (XVideoGetMode().height >= 720) { + // A second HD scanout allocation can reuse VRAM from the boot logo. + // xemu may select the cached GPU texture at that address instead of + // the CPU framebuffer. Keep the nxdk scanout address for HD modes. + auto *allocation = moonlight_ffmpeg_aligned_malloc(size + 64U, 32U); + staging_.reset(static_cast(allocation)); + pages_[1] = static_cast(allocation); + if (allocation != nullptr) { + stagingSize_ = size; + } + } else if (!scanoutQuarantined_) { + pages_[1] = static_cast(MmAllocateContiguousMemoryEx(size, 0, 0x03ffffff, 0x1000, PAGE_READWRITE | PAGE_WRITECOMBINE)); + } + if (pages_[1] == nullptr) { + return nullptr; + } + } + const auto back = front_ ^ 1U; + if (auto &previous = destinations_[back]; previous.x != destination.x || previous.y != destination.y || previous.width != destination.width || previous.height != destination.height) { + std::memset(pages_[back], 0, size); + previous = destination; + } + return pages_[back]; +#else + (void) size; + (void) destination; + return nullptr; +#endif + } + + bool SoftwareScanout::present() { +#ifdef NXDK + if (pages_[1] == nullptr || !synchronized_) { + return false; + } + if (staging_) { + synchronized_ = wait_for_vblank(); + if (synchronized_) { + std::memcpy(pages_[0], pages_[1], stagingSize_); + XVideoFlushFB(); + } + return synchronized_; + } + XVideoFlushFB(); + front_ ^= 1U; + set_scanout(pages_[front_]); + // xemu refreshes its VGA surface before signaling vblank. Its renderer can + // keep reading the previous page until the first vblank after this write. + synchronized_ = wait_for_vblank(); + return synchronized_; +#else + return false; +#endif + } + + bool SoftwareScanout::reset() { +#ifdef NXDK + if (pages_[1] == nullptr) { + return true; + } + bool retired = true; + if (staging_) { + staging_.reset(); + stagingSize_ = 0; + } else { + set_scanout(pages_[0]); + retired = wait_for_vblank(); + if (retired) { + MmFreeContiguousMemory(pages_[1]); + } else { + // Scanout may still read the extra page. Leave it allocated for the rest of the process. + scanoutQuarantined_ = true; + } + } + pages_ = {}; + destinations_ = {}; + front_ = 0; + synchronized_ = true; + return retired; +#else + return true; +#endif + } +} // namespace streaming diff --git a/src/streaming/software_scanout.h b/src/streaming/software_scanout.h new file mode 100644 index 0000000..689299f --- /dev/null +++ b/src/streaming/software_scanout.h @@ -0,0 +1,73 @@ +/** + * @file src/streaming/software_scanout.h + * @brief Buffered Xbox scanout for CPU-composited video. + */ +#pragma once + +// standard includes +#include +#include +#include +#include + +// local includes +#include "src/streaming/video_acceleration.h" + +namespace streaming { + /** + * @brief Display CPU-composited frames using page flips in SD and a fixed scanout in HD. + * + * The active video mode must remain fixed until reset. All operations belong + * to the stream render thread. + */ + class SoftwareScanout { + public: + SoftwareScanout() = default; + /** + * @brief Restore the nxdk scanout before releasing the extra page. + */ + ~SoftwareScanout(); + SoftwareScanout(const SoftwareScanout &) = delete; + SoftwareScanout &operator=(const SoftwareScanout &) = delete; + + /** + * @brief Get a buffer outside active scanout and clear pixels outside the new video area. + * @param size Framebuffer size in bytes for the current display mode. + * @param destination Video area that will be completely redrawn. + * @return Writable frame storage, or nullptr when unavailable. + */ + std::uint8_t *back_buffer(std::size_t size, const VideoRectangle &destination); + + /** + * @brief Display the completed frame by flipping pages or copying to the primary framebuffer. + * @return True when presentation succeeded and the drawing buffer is available again. + */ + bool present(); + + /** + * @brief Restore nxdk scanout and release the extra framebuffer. + * @return True if the framebuffer could be safely released. + */ + bool reset(); + + private: + /** + * @brief Release an aligned staging allocation through the Xbox compatibility allocator. + */ + struct StagingBufferDeleter { + /** + * @brief Release the owned staging allocation. + * @param buffer Aligned staging allocation. + */ + void operator()(std::byte *buffer) const noexcept; + }; + + inline static bool scanoutQuarantined_ = false; ///< Disable page flips for this process after an unconfirmed retirement. + std::array pages_ {}; ///< nxdk's primary framebuffer and the additional drawing buffer. + std::array destinations_ {}; ///< Video area last drawn on each page. + std::unique_ptr staging_; ///< Owns the aligned HD staging buffer. + std::size_t stagingSize_ = 0; ///< Bytes to copy from the staged frame to scanout. + std::size_t front_ = 0; ///< Page most recently submitted to scanout. + bool synchronized_ = true; ///< A completed vblank has retired the previous page. + }; +} // namespace streaming diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 541f231..a2d6664 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -102,7 +102,9 @@ gtest_discover_tests(${PROJECT_NAME} # Keep NXDK and the fake Windows headers isolated from ordinary host tests. add_executable(test_pvideo_presenter "${CMAKE_SOURCE_DIR}/tests/gpu/pvideo_presenter_test.cpp" + "${CMAKE_SOURCE_DIR}/src/_nxdk_compat/ffmpeg_memory.c" "${CMAKE_SOURCE_DIR}/src/streaming/pvideo_presenter.cpp" + "${CMAKE_SOURCE_DIR}/src/streaming/software_scanout.cpp" "${CMAKE_SOURCE_DIR}/src/streaming/video_acceleration.cpp" "${CMAKE_SOURCE_DIR}/src/streaming/video_overlay.cpp") target_compile_definitions(test_pvideo_presenter PRIVATE NXDK) diff --git a/tests/gpu/pvideo_presenter_test.cpp b/tests/gpu/pvideo_presenter_test.cpp index 4af2e72..ab6246c 100644 --- a/tests/gpu/pvideo_presenter_test.cpp +++ b/tests/gpu/pvideo_presenter_test.cpp @@ -2,9 +2,8 @@ * @file tests/gpu/pvideo_presenter_test.cpp * @brief Exercises the production presenter against deterministic NV2A, pbkit and allocator shims. */ -// test includes -// test includes -#include +// test header include +#include "src/streaming/pvideo_presenter.h" // standard includes #include @@ -14,14 +13,30 @@ // lib includes #include +#include #include #include #include // local includes -#include "src/streaming/pvideo_presenter.h" +#include "src/streaming/software_scanout.h" namespace { + constexpr std::uint32_t CRTC_START = 0x600800; ///< Physical scanout base. + constexpr std::uint32_t CRTC_INTERRUPT = 0x600100; ///< Vertical blank status. + constexpr std::uint32_t CPU_FRAMEBUFFER = 0x40000; ///< Fake physical address of the nxdk page. + + /** + * @brief Track the surface latched by the fake software display at vblank. + */ + struct SoftwareDisplay { + bool pollVblank = false; ///< Simulate software polling of the vblank status. + bool signalVblank = true; ///< Signal vblank when simulated time advances. + std::uint32_t flushedScanout = 0; ///< Scanout base when framebuffer writes were flushed. + std::uint32_t displayedScanout = CPU_FRAMEBUFFER; ///< Page latched by the display at the last vblank. + std::uint8_t primaryPixelAtVblank = 0; ///< First byte of the primary framebuffer when retrace starts. + }; + /** * @brief Mutable fake hardware, reset independently for each lifecycle test. */ @@ -42,6 +57,7 @@ namespace { std::uint32_t originalStart = 0; ///< CPU scanout restored by pb_kill. bool videoEnabled = true; ///< TV encoder output state. bool backgroundCleared = false; ///< GPU background was cleared before overlay submission. + SoftwareDisplay softwareDisplay; ///< Simulates software presentation timing. std::map allocations; ///< Live DMA allocations and addresses. std::uint32_t nextPhysical = 0x100000; ///< Next fake physical allocation address. }; @@ -68,6 +84,7 @@ namespace { hardware.pitch = 640 * 4; hardware.videoEnabled = true; hardware.backgroundCleared = false; + hardware.softwareDisplay = {}; hardware.nextPhysical = 0x100000; ASSERT_TRUE(hardware.allocations.empty()); } @@ -102,17 +119,30 @@ unsigned char *XVideoGetFB() { return hardware.framebuffer.data(); } +void XVideoFlushFB() { + hardware.softwareDisplay.flushedScanout = VIDEOREG(CRTC_START); +} + void XVideoSetVideoEnable(int enable) { hardware.videoEnabled = enable != 0; } DWORD GetTickCount() { + if (hardware.softwareDisplay.pollVblank) { + // The software wait acknowledges stale status before reading the clock. + VIDEOREG(CRTC_INTERRUPT) = 0; + } return hardware.ticks; } void Sleep(DWORD milliseconds) { hardware.ticks += milliseconds; ++hardware.vblanks; + if (hardware.softwareDisplay.pollVblank && hardware.softwareDisplay.signalVblank) { + hardware.softwareDisplay.displayedScanout = VIDEOREG(CRTC_START); + hardware.softwareDisplay.primaryPixelAtVblank = hardware.framebuffer[0]; + VIDEOREG(CRTC_INTERRUPT) = 1; + } } std::uint32_t pb_get_vbl_counter() { @@ -187,9 +217,137 @@ void MmFreeContiguousMemory(void *buffer) { } std::uintptr_t MmGetPhysicalAddress(void *buffer) { + if (buffer == hardware.framebuffer.data()) { + return CPU_FRAMEBUFFER; + } return buffer == hardware.gpuBuffer.data() ? 0x80000 : hardware.allocations.at(buffer); } +/** + * @brief Keep each composed software page intact until the display has latched its replacement. + */ +TEST_F(PvideoPresenterTest, RetiresSoftwarePagesAfterTheAddressLatches) { + hardware.softwareDisplay.pollVblank = true; + VIDEOREG(CRTC_START) = CPU_FRAMEBUFFER; + streaming::SoftwareScanout scanout; + EXPECT_FALSE(scanout.present()); + const std::size_t size = hardware.framebuffer.size(); + auto *primary = XVideoGetFB(); + primary[0] = 0x73; + auto *first = scanout.back_buffer(size, destination); + ASSERT_NE(first, nullptr); + EXPECT_NE(first, primary); + EXPECT_EQ(first[0], 0); + EXPECT_EQ(primary[0], 0x73); + first[0] = 0x24; + streaming::VideoOverlay overlay; + overlay.set_bitmap(1, 1, {0xff}, streaming::VideoOverlayPlacement::full_screen); + ASSERT_TRUE(overlay.draw_rgb(first, size, hardware.mode.width * 4, hardware.mode.width, hardware.mode.height, hardware.mode.bpp, destination)); + const auto overlayOffset = static_cast(destination.y) * hardware.mode.width * 4; + EXPECT_EQ(first[overlayOffset], 0xff); + EXPECT_EQ(primary[overlayOffset], 0); + EXPECT_EQ(VIDEOREG(CRTC_START), CPU_FRAMEBUFFER); + ASSERT_TRUE(scanout.present()); + EXPECT_EQ(hardware.softwareDisplay.flushedScanout, CPU_FRAMEBUFFER); + EXPECT_EQ(hardware.softwareDisplay.displayedScanout, MmGetPhysicalAddress(first)); + EXPECT_EQ(XVideoGetFB(), primary); + + auto *second = scanout.back_buffer(size, destination); + ASSERT_EQ(second, primary); + EXPECT_EQ(second[0], 0); + EXPECT_EQ(VIDEOREG(CRTC_START), MmGetPhysicalAddress(first)); + ASSERT_TRUE(scanout.present()); + EXPECT_EQ(hardware.softwareDisplay.displayedScanout, CPU_FRAMEBUFFER); + EXPECT_EQ(scanout.back_buffer(size, destination)[0], 0x24); + EXPECT_EQ(scanout.back_buffer(size, {0, 0, 640, 480})[0], 0); + ASSERT_TRUE(scanout.present()); + EXPECT_EQ(hardware.softwareDisplay.displayedScanout, MmGetPhysicalAddress(first)); + + EXPECT_TRUE(scanout.reset()); + EXPECT_EQ(hardware.softwareDisplay.displayedScanout, CPU_FRAMEBUFFER); + EXPECT_TRUE(hardware.allocations.empty()); +} + +/** + * @brief Unavailable contiguous memory leaves the original software framebuffer active. + */ +TEST_F(PvideoPresenterTest, LeavesPrimaryScanoutActiveWhenSoftwareAllocationFails) { + hardware.allocationsUntilFailure = 0; + VIDEOREG(CRTC_START) = CPU_FRAMEBUFFER; + streaming::SoftwareScanout scanout; + EXPECT_EQ(scanout.back_buffer(hardware.framebuffer.size(), destination), nullptr); + EXPECT_EQ(VIDEOREG(CRTC_START), CPU_FRAMEBUFFER); +} + +/** + * @brief Missing retrace stops page reuse while the display may still read the previous frame. + */ +TEST_F(PvideoPresenterTest, BlocksSoftwarePageReuseOnVblankTimeout) { + hardware.softwareDisplay.pollVblank = true; + hardware.softwareDisplay.signalVblank = false; + VIDEOREG(CRTC_START) = CPU_FRAMEBUFFER; + streaming::SoftwareScanout scanout; + auto *back = scanout.back_buffer(hardware.framebuffer.size(), destination); + ASSERT_NE(back, nullptr); + EXPECT_FALSE(scanout.present()); + EXPECT_EQ(hardware.ticks, 50U); + EXPECT_EQ(VIDEOREG(CRTC_START), MmGetPhysicalAddress(back)); + EXPECT_EQ(hardware.softwareDisplay.displayedScanout, CPU_FRAMEBUFFER); + EXPECT_EQ(scanout.back_buffer(hardware.framebuffer.size(), destination), nullptr); + EXPECT_FALSE(scanout.present()); + hardware.softwareDisplay.signalVblank = true; + EXPECT_TRUE(scanout.reset()); +} + +/** + * @brief 720p copies a fully composed frame at vblank without scanning out the staging allocation. + */ +TEST_F(PvideoPresenterTest, CopiesHighDefinitionFrameWithoutChangingScanoutAddress) { + hardware.mode = {1280, 720, 32, 60}; + hardware.softwareDisplay.pollVblank = true; + VIDEOREG(CRTC_START) = CPU_FRAMEBUFFER; + streaming::SoftwareScanout scanout; + auto *primary = XVideoGetFB(); + constexpr std::size_t frameBytes = 32; + std::fill_n(primary, frameBytes + 1, 0x57); + auto *staged = scanout.back_buffer(frameBytes, {0, 0, 1280, 720}); + ASSERT_NE(staged, nullptr); + EXPECT_NE(staged, primary); + EXPECT_EQ(reinterpret_cast(staged) % 32U, 0U); + std::fill_n(staged, frameBytes, 0x35); + EXPECT_EQ(primary[0], 0x57); + EXPECT_TRUE(hardware.allocations.empty()); + + ASSERT_TRUE(scanout.present()); + EXPECT_EQ(hardware.softwareDisplay.primaryPixelAtVblank, 0x57); + EXPECT_EQ(VIDEOREG(CRTC_START), CPU_FRAMEBUFFER); + EXPECT_EQ(hardware.softwareDisplay.displayedScanout, CPU_FRAMEBUFFER); + EXPECT_TRUE(std::equal(staged, staged + frameBytes, primary)); + EXPECT_EQ(primary[frameBytes], 0x57); + EXPECT_EQ(scanout.back_buffer(frameBytes, {0, 0, 1280, 720}), staged); + EXPECT_TRUE(scanout.reset()); + EXPECT_EQ(VIDEOREG(CRTC_START), CPU_FRAMEBUFFER); +} + +/** + * @brief On retrace timeout, keep the currently displayed HD frame intact. + */ +TEST_F(PvideoPresenterTest, DoesNotCopyHighDefinitionFrameOnVblankTimeout) { + hardware.mode = {1280, 720, 32, 60}; + hardware.softwareDisplay.pollVblank = true; + hardware.softwareDisplay.signalVblank = false; + VIDEOREG(CRTC_START) = CPU_FRAMEBUFFER; + streaming::SoftwareScanout scanout; + XVideoGetFB()[0] = 0x67; + auto *staged = scanout.back_buffer(32, {0, 0, 1280, 720}); + ASSERT_NE(staged, nullptr); + staged[0] = 0x29; + EXPECT_FALSE(scanout.present()); + EXPECT_EQ(XVideoGetFB()[0], 0x67); + EXPECT_EQ(VIDEOREG(CRTC_START), CPU_FRAMEBUFFER); + EXPECT_TRUE(scanout.reset()); +} + /** * @brief Both RAM buffers are submitted through bank zero with source dimensions in pixels. */ diff --git a/tests/support/pvideo/hal/video.h b/tests/support/pvideo/hal/video.h index b375d48..80ae731 100644 --- a/tests/support/pvideo/hal/video.h +++ b/tests/support/pvideo/hal/video.h @@ -43,6 +43,10 @@ VIDEO_MODE XVideoGetMode(); * @return Mutable framebuffer storage. */ unsigned char *XVideoGetFB(); +/** + * @brief Record when the CPU has finished writing a framebuffer. + */ +void XVideoFlushFB(); /** * @brief Enable or disable output. * diff --git a/tests/support/pvideo/synchapi.h b/tests/support/pvideo/synchapi.h new file mode 100644 index 0000000..f762f94 --- /dev/null +++ b/tests/support/pvideo/synchapi.h @@ -0,0 +1,13 @@ +/** + * @file tests/support/pvideo/synchapi.h + * @brief Declares the fake sleep function for presenter lifecycle tests. + */ +#pragma once + +#include + +/** + * @brief Advance time and simulated vblank. + * @param milliseconds Simulated sleep duration. + */ +void Sleep(std::uint32_t milliseconds); diff --git a/tests/support/pvideo/sysinfoapi.h b/tests/support/pvideo/sysinfoapi.h new file mode 100644 index 0000000..4342ff4 --- /dev/null +++ b/tests/support/pvideo/sysinfoapi.h @@ -0,0 +1,13 @@ +/** + * @file tests/support/pvideo/sysinfoapi.h + * @brief Declares the fake monotonic clock for presenter lifecycle tests. + */ +#pragma once + +#include + +/** + * @brief Get simulated milliseconds. + * @return Fixture clock. + */ +std::uint32_t GetTickCount(); diff --git a/tests/support/pvideo/windows.h b/tests/support/pvideo/windows.h index 55e4432..549f564 100644 --- a/tests/support/pvideo/windows.h +++ b/tests/support/pvideo/windows.h @@ -1,25 +1,13 @@ /** * @file tests/support/pvideo/windows.h - * @brief Supplies deterministic time and allocation flags for presenter lifecycle tests. + * @brief Supplies Win32 types and timing declarations for presenter lifecycle tests. */ #pragma once +#include "synchapi.h" +#include "sysinfoapi.h" + #include using DWORD = std::uint32_t; ///< Xbox millisecond tick type. inline constexpr int TRUE = 1; ///< Enabled output. -inline constexpr int PAGE_READWRITE = 4; ///< Writable allocation flag. -inline constexpr int PAGE_WRITECOMBINE = 0x400; ///< Write-combined allocation flag. - -/** - * @brief Get simulated milliseconds. - * - * @return Fixture clock. - */ -DWORD GetTickCount(); -/** - * @brief Advance time and simulated vblank. - * - * @param milliseconds Simulated sleep duration. - */ -void Sleep(DWORD milliseconds); diff --git a/tests/support/pvideo/xboxkrnl/xboxkrnl.h b/tests/support/pvideo/xboxkrnl/xboxkrnl.h index 1cbb3f5..e5f8e55 100644 --- a/tests/support/pvideo/xboxkrnl/xboxkrnl.h +++ b/tests/support/pvideo/xboxkrnl/xboxkrnl.h @@ -7,6 +7,9 @@ #include #include +inline constexpr int PAGE_READWRITE = 4; ///< Writable allocation flag. +inline constexpr int PAGE_WRITECOMBINE = 0x400; ///< Write-combined allocation flag. + /** * @brief Allocate tracked DMA storage. * @param size Allocation size. diff --git a/tests/unit/app/client_state_test.cpp b/tests/unit/app/client_state_test.cpp index 5fe5f2c..ca61c6d 100644 --- a/tests/unit/app/client_state_test.cpp +++ b/tests/unit/app/client_state_test.cpp @@ -185,7 +185,7 @@ namespace { EXPECT_EQ(state.settings.loggingLevel, logging::LogLevel::none); EXPECT_EQ(state.settings.streamFramerate, 60); EXPECT_EQ(state.settings.streamBitrateKbps, 3000); - EXPECT_FALSE(state.settings.presentation.gpuPresentation); + EXPECT_TRUE(state.settings.presentation.gpuPresentation); } TEST(ClientStateTest, ReplacesHostsFromPersistenceWithoutMarkingThemDirty) { @@ -1483,28 +1483,28 @@ namespace { EXPECT_EQ(state.detailMenu.selected_item()->label, "Performance Stats: On"); } - /** @brief Switch from the software default to GPU and back while preserving bitrate and statistics. */ - TEST(ClientStateTest, DisplaySettingsCanSelectGpuPresentation) { + /** @brief Switch from the GPU default to software and back while preserving bitrate and statistics. */ + TEST(ClientStateTest, DisplaySettingsCanSelectSoftwarePresentation) { auto state = app::create_initial_state(); ASSERT_NO_FATAL_FAILURE(open_display_settings_options(state)); ASSERT_TRUE(state.detailMenu.select_item_by_id("toggle-gpu-presentation")); - ASSERT_FALSE(state.settings.presentation.gpuPresentation); + ASSERT_TRUE(state.settings.presentation.gpuPresentation); state.settings.streamBitrateKbps = 4500; state.settings.presentation.showPerformanceStats = true; EXPECT_TRUE(app::handle_command(state, input::UiCommand::activate).persistence.settingsChanged); - EXPECT_TRUE(state.settings.presentation.gpuPresentation); + EXPECT_FALSE(state.settings.presentation.gpuPresentation); EXPECT_TRUE(state.settings.dirty); ASSERT_NE(state.detailMenu.selected_item(), nullptr); - EXPECT_EQ(state.detailMenu.selected_item()->label, "Video Presentation: GPU"); + EXPECT_EQ(state.detailMenu.selected_item()->label, "Video Presentation: Software"); EXPECT_EQ(state.settings.streamBitrateKbps, 4500); EXPECT_TRUE(state.settings.presentation.showPerformanceStats); EXPECT_TRUE(app::handle_command(state, input::UiCommand::activate).persistence.settingsChanged); - EXPECT_FALSE(state.settings.presentation.gpuPresentation); + EXPECT_TRUE(state.settings.presentation.gpuPresentation); EXPECT_TRUE(state.settings.presentation.showPerformanceStats); ASSERT_NE(state.detailMenu.selected_item(), nullptr); - EXPECT_EQ(state.detailMenu.selected_item()->label, "Video Presentation: Software"); + EXPECT_EQ(state.detailMenu.selected_item()->label, "Video Presentation: GPU"); } /** diff --git a/tests/unit/app/settings_storage_test.cpp b/tests/unit/app/settings_storage_test.cpp index c424722..8761874 100644 --- a/tests/unit/app/settings_storage_test.cpp +++ b/tests/unit/app/settings_storage_test.cpp @@ -107,25 +107,25 @@ namespace { EXPECT_FALSE(loadResult.settings.playAudioOnXbox); } - /** @brief Persist explicit GPU selection and default to software with old or invalid settings. */ + /** @brief Persist an explicit software selection and default to GPU with old or invalid settings. */ TEST_F(SettingsStorageTest, SavesAndLoadsPresentationPreference) { write_text_file(settingsPath, "[streaming]\nfps = 30\n"); const auto partial = app::load_app_settings(settingsPath); - EXPECT_FALSE(partial.settings.gpuPresentation); + EXPECT_TRUE(partial.settings.gpuPresentation); EXPECT_EQ(partial.settings.streamFramerate, 30); EXPECT_EQ(partial.settings.streamBitrateKbps, 1000); app::AppSettings settings; - settings.gpuPresentation = true; + settings.gpuPresentation = false; ASSERT_TRUE(app::save_app_settings(settings, settingsPath).success); - const auto gpu = app::load_app_settings(settingsPath); - EXPECT_TRUE(gpu.settings.gpuPresentation); - EXPECT_TRUE(gpu.warnings.empty()); - EXPECT_FALSE(gpu.cleanupRequired); + const auto software = app::load_app_settings(settingsPath); + EXPECT_FALSE(software.settings.gpuPresentation); + EXPECT_TRUE(software.warnings.empty()); + EXPECT_FALSE(software.cleanupRequired); write_text_file(settingsPath, "[streaming]\ngpu_presentation = 'software'\n"); const auto invalid = app::load_app_settings(settingsPath); - EXPECT_FALSE(invalid.settings.gpuPresentation); + EXPECT_TRUE(invalid.settings.gpuPresentation); ASSERT_EQ(invalid.warnings.size(), 1U); EXPECT_NE(invalid.warnings.front().find("streaming.gpu_presentation"), std::string::npos); } @@ -185,7 +185,7 @@ namespace { EXPECT_FALSE(loadResult.settings.preferredVideoModeSet); EXPECT_EQ(loadResult.settings.streamFramerate, 60); EXPECT_EQ(loadResult.settings.streamBitrateKbps, 3000); - EXPECT_FALSE(loadResult.settings.gpuPresentation); + EXPECT_TRUE(loadResult.settings.gpuPresentation); EXPECT_FALSE(loadResult.settings.playAudioOnPc); EXPECT_FALSE(loadResult.settings.showPerformanceStats); EXPECT_TRUE(loadResult.settings.playAudioOnXbox);