mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 23:35:55 +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.enableVsync = enableVsync;
|
||||
params.enableFramePacing = enableFramePacing;
|
||||
params.testOnly = testOnly;
|
||||
params.vds = vds;
|
||||
|
||||
memset(¶ms.hdrMetadata, 0, sizeof(params.hdrMetadata));
|
||||
|
@ -55,6 +55,7 @@ typedef struct _DECODER_PARAMETERS {
|
||||
int frameRate;
|
||||
bool enableVsync;
|
||||
bool enableFramePacing;
|
||||
bool testOnly;
|
||||
HDR_MASTERING_METADATA hdrMetadata;
|
||||
} DECODER_PARAMETERS, *PDECODER_PARAMETERS;
|
||||
|
||||
|
@ -232,21 +232,23 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
return DIRECT_RENDERING_INIT_FAILED;
|
||||
}
|
||||
|
||||
// Create a dummy renderer to force SDL to complete the modesetting
|
||||
// operation that the KMSDRM backend keeps pending until the next
|
||||
// time we swap buffers. We have to do this before we enumerate
|
||||
// CRTC modes below.
|
||||
SDL_Renderer* renderer = SDL_CreateRenderer(params->window, -1, SDL_RENDERER_SOFTWARE);
|
||||
if (renderer != nullptr) {
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderPresent(renderer);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
}
|
||||
else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_CreateRenderer() failed: %s",
|
||||
SDL_GetError());
|
||||
if (!params->testOnly) {
|
||||
// Create a dummy renderer to force SDL to complete the modesetting
|
||||
// operation that the KMSDRM backend keeps pending until the next
|
||||
// time we swap buffers. We have to do this before we enumerate
|
||||
// CRTC modes below.
|
||||
SDL_Renderer* renderer = SDL_CreateRenderer(params->window, -1, SDL_RENDERER_SOFTWARE);
|
||||
if (renderer != nullptr) {
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderPresent(renderer);
|
||||
SDL_DestroyRenderer(renderer);
|
||||
}
|
||||
else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_CreateRenderer() failed: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
}
|
||||
|
||||
drmModeRes* resources = drmModeGetResources(m_DrmFd);
|
||||
|
@ -664,9 +664,6 @@ bool EGLRenderer::initialize(PDECODER_PARAMETERS params)
|
||||
m_ViewportWidth = dst.w;
|
||||
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,
|
||||
// because the compositor guarantees tear-free rendering. In this
|
||||
// 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_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);
|
||||
for (size_t i = 0; i < EGL_MAX_PLANES; ++i) {
|
||||
|
@ -219,19 +219,21 @@ int MmalRenderer::getDecoderColorspace()
|
||||
|
||||
void MmalRenderer::setupBackground(PDECODER_PARAMETERS params)
|
||||
{
|
||||
// Create a renderer and draw a black background for the area not covered by the MMAL overlay.
|
||||
// On the KMSDRM backend, this triggers the modeset that puts the CRTC into the mode we selected.
|
||||
m_BackgroundRenderer = SDL_CreateRenderer(params->window, -1, SDL_RENDERER_SOFTWARE);
|
||||
if (m_BackgroundRenderer == nullptr) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_CreateRenderer() failed: %s",
|
||||
SDL_GetError());
|
||||
return;
|
||||
}
|
||||
if (!params->testOnly) {
|
||||
// Create a renderer and draw a black background for the area not covered by the MMAL overlay.
|
||||
// On the KMSDRM backend, this triggers the modeset that puts the CRTC into the mode we selected.
|
||||
m_BackgroundRenderer = SDL_CreateRenderer(params->window, -1, SDL_RENDERER_SOFTWARE);
|
||||
if (m_BackgroundRenderer == nullptr) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_CreateRenderer() failed: %s",
|
||||
SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_SetRenderDrawColor(m_BackgroundRenderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||
SDL_RenderClear(m_BackgroundRenderer);
|
||||
SDL_RenderPresent(m_BackgroundRenderer);
|
||||
SDL_SetRenderDrawColor(m_BackgroundRenderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||
SDL_RenderClear(m_BackgroundRenderer);
|
||||
SDL_RenderPresent(m_BackgroundRenderer);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
SDL_RenderSetViewport(m_Renderer, &dst);
|
||||
|
||||
// Draw a black frame until the video stream starts rendering
|
||||
SDL_SetRenderDrawColor(m_Renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||
SDL_RenderClear(m_Renderer);
|
||||
SDL_RenderPresent(m_Renderer);
|
||||
if (!params->testOnly) {
|
||||
// Draw a black frame until the video stream starts rendering
|
||||
SDL_SetRenderDrawColor(m_Renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||
SDL_RenderClear(m_Renderer);
|
||||
SDL_RenderPresent(m_Renderer);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
// For some reason, using Direct3D9Ex breaks this with multi-monitor setups.
|
||||
|
Loading…
x
Reference in New Issue
Block a user