mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-12-14 21:32:27 +00:00
Draw the black background even for the KMSDRM backend to fix modesetting
This commit is contained in:
parent
f99f1f6441
commit
b9c73df488
1 changed files with 9 additions and 22 deletions
|
@ -219,32 +219,19 @@ int MmalRenderer::getDecoderColorspace()
|
||||||
|
|
||||||
void MmalRenderer::setupBackground(PDECODER_PARAMETERS params)
|
void MmalRenderer::setupBackground(PDECODER_PARAMETERS params)
|
||||||
{
|
{
|
||||||
SDL_SysWMinfo info;
|
// 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.
|
||||||
SDL_VERSION(&info.version);
|
m_BackgroundRenderer = SDL_CreateRenderer(params->window, -1, SDL_RENDERER_SOFTWARE);
|
||||||
|
if (m_BackgroundRenderer == nullptr) {
|
||||||
if (!SDL_GetWindowWMInfo(params->window, &info)) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"SDL_GetWindowWMInfo() failed: %s",
|
"SDL_CreateRenderer() failed: %s",
|
||||||
SDL_GetError());
|
SDL_GetError());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On X11, we can safely create a renderer and draw a black background.
|
SDL_SetRenderDrawColor(m_BackgroundRenderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||||
// Due to conflicts with Qt, it's unsafe to do this for KMSDRM.
|
SDL_RenderClear(m_BackgroundRenderer);
|
||||||
if (info.subsystem == SDL_SYSWM_X11) {
|
SDL_RenderPresent(m_BackgroundRenderer);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MmalRenderer::InputPortCallback(MMAL_PORT_T*, MMAL_BUFFER_HEADER_T* buffer)
|
void MmalRenderer::InputPortCallback(MMAL_PORT_T*, MMAL_BUFFER_HEADER_T* buffer)
|
||||||
|
|
Loading…
Reference in a new issue