mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-02 15:55:39 +00:00
Don't draw with test-only renderers
This commit is contained in:
parent
bf4332b9e7
commit
d39a29759c
@ -211,6 +211,7 @@ bool Session::chooseDecoder(StreamingPreferences::VideoDecoderSelection vds,
|
|||||||
params.window = window;
|
params.window = window;
|
||||||
params.enableVsync = enableVsync;
|
params.enableVsync = enableVsync;
|
||||||
params.enableFramePacing = enableFramePacing;
|
params.enableFramePacing = enableFramePacing;
|
||||||
|
params.testOnly = testOnly;
|
||||||
params.vds = vds;
|
params.vds = vds;
|
||||||
|
|
||||||
memset(¶ms.hdrMetadata, 0, sizeof(params.hdrMetadata));
|
memset(¶ms.hdrMetadata, 0, sizeof(params.hdrMetadata));
|
||||||
|
@ -55,6 +55,7 @@ typedef struct _DECODER_PARAMETERS {
|
|||||||
int frameRate;
|
int frameRate;
|
||||||
bool enableVsync;
|
bool enableVsync;
|
||||||
bool enableFramePacing;
|
bool enableFramePacing;
|
||||||
|
bool testOnly;
|
||||||
HDR_MASTERING_METADATA hdrMetadata;
|
HDR_MASTERING_METADATA hdrMetadata;
|
||||||
} DECODER_PARAMETERS, *PDECODER_PARAMETERS;
|
} DECODER_PARAMETERS, *PDECODER_PARAMETERS;
|
||||||
|
|
||||||
|
@ -232,21 +232,23 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
return DIRECT_RENDERING_INIT_FAILED;
|
return DIRECT_RENDERING_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a dummy renderer to force SDL to complete the modesetting
|
if (!params->testOnly) {
|
||||||
// operation that the KMSDRM backend keeps pending until the next
|
// Create a dummy renderer to force SDL to complete the modesetting
|
||||||
// time we swap buffers. We have to do this before we enumerate
|
// operation that the KMSDRM backend keeps pending until the next
|
||||||
// CRTC modes below.
|
// time we swap buffers. We have to do this before we enumerate
|
||||||
SDL_Renderer* renderer = SDL_CreateRenderer(params->window, -1, SDL_RENDERER_SOFTWARE);
|
// CRTC modes below.
|
||||||
if (renderer != nullptr) {
|
SDL_Renderer* renderer = SDL_CreateRenderer(params->window, -1, SDL_RENDERER_SOFTWARE);
|
||||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
if (renderer != nullptr) {
|
||||||
SDL_RenderClear(renderer);
|
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderClear(renderer);
|
||||||
SDL_DestroyRenderer(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
}
|
SDL_DestroyRenderer(renderer);
|
||||||
else {
|
}
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
else {
|
||||||
"SDL_CreateRenderer() failed: %s",
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
SDL_GetError());
|
"SDL_CreateRenderer() failed: %s",
|
||||||
|
SDL_GetError());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drmModeRes* resources = drmModeGetResources(m_DrmFd);
|
drmModeRes* resources = drmModeGetResources(m_DrmFd);
|
||||||
|
@ -664,9 +664,6 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
m_ViewportWidth = dst.w;
|
m_ViewportWidth = dst.w;
|
||||||
m_ViewportHeight = dst.h;
|
m_ViewportHeight = dst.h;
|
||||||
|
|
||||||
glClearColor(0, 0, 0, 1);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
|
|
||||||
// SDL always uses swap interval 0 under the hood on Wayland systems,
|
// SDL always uses swap interval 0 under the hood on Wayland systems,
|
||||||
// because the compositor guarantees tear-free rendering. In this
|
// because the compositor guarantees tear-free rendering. In this
|
||||||
// situation, swap interval > 0 behaves as a frame pacing option
|
// situation, swap interval > 0 behaves as a frame pacing option
|
||||||
@ -699,7 +696,12 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
SDL_GL_SetSwapInterval(0);
|
SDL_GL_SetSwapInterval(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GL_SwapWindow(params->window);
|
if (!params->testOnly) {
|
||||||
|
// Draw a black frame until the video stream starts rendering
|
||||||
|
glClearColor(0, 0, 0, 1);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
SDL_GL_SwapWindow(params->window);
|
||||||
|
}
|
||||||
|
|
||||||
glGenTextures(EGL_MAX_PLANES, m_Textures);
|
glGenTextures(EGL_MAX_PLANES, m_Textures);
|
||||||
for (size_t i = 0; i < EGL_MAX_PLANES; ++i) {
|
for (size_t i = 0; i < EGL_MAX_PLANES; ++i) {
|
||||||
|
@ -219,19 +219,21 @@ int MmalRenderer::getDecoderColorspace()
|
|||||||
|
|
||||||
void MmalRenderer::setupBackground(PDECODER_PARAMETERS params)
|
void MmalRenderer::setupBackground(PDECODER_PARAMETERS params)
|
||||||
{
|
{
|
||||||
// Create a renderer and draw a black background for the area not covered by the MMAL overlay.
|
if (!params->testOnly) {
|
||||||
// On the KMSDRM backend, this triggers the modeset that puts the CRTC into the mode we selected.
|
// Create a renderer and draw a black background for the area not covered by the MMAL overlay.
|
||||||
m_BackgroundRenderer = SDL_CreateRenderer(params->window, -1, SDL_RENDERER_SOFTWARE);
|
// On the KMSDRM backend, this triggers the modeset that puts the CRTC into the mode we selected.
|
||||||
if (m_BackgroundRenderer == nullptr) {
|
m_BackgroundRenderer = SDL_CreateRenderer(params->window, -1, SDL_RENDERER_SOFTWARE);
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
if (m_BackgroundRenderer == nullptr) {
|
||||||
"SDL_CreateRenderer() failed: %s",
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
SDL_GetError());
|
"SDL_CreateRenderer() failed: %s",
|
||||||
return;
|
SDL_GetError());
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(m_BackgroundRenderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
SDL_SetRenderDrawColor(m_BackgroundRenderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||||
SDL_RenderClear(m_BackgroundRenderer);
|
SDL_RenderClear(m_BackgroundRenderer);
|
||||||
SDL_RenderPresent(m_BackgroundRenderer);
|
SDL_RenderPresent(m_BackgroundRenderer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MmalRenderer::InputPortCallback(MMAL_PORT_T*, MMAL_BUFFER_HEADER_T* buffer)
|
void MmalRenderer::InputPortCallback(MMAL_PORT_T*, MMAL_BUFFER_HEADER_T* buffer)
|
||||||
|
@ -152,10 +152,12 @@ bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
// Ensure the viewport is set to the desired video region
|
// Ensure the viewport is set to the desired video region
|
||||||
SDL_RenderSetViewport(m_Renderer, &dst);
|
SDL_RenderSetViewport(m_Renderer, &dst);
|
||||||
|
|
||||||
// Draw a black frame until the video stream starts rendering
|
if (!params->testOnly) {
|
||||||
SDL_SetRenderDrawColor(m_Renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
// Draw a black frame until the video stream starts rendering
|
||||||
SDL_RenderClear(m_Renderer);
|
SDL_SetRenderDrawColor(m_Renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||||
SDL_RenderPresent(m_Renderer);
|
SDL_RenderClear(m_Renderer);
|
||||||
|
SDL_RenderPresent(m_Renderer);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
// For some reason, using Direct3D9Ex breaks this with multi-monitor setups.
|
// For some reason, using Direct3D9Ex breaks this with multi-monitor setups.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user