mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-02-16 02:30:52 +00:00
Remove atomic test-only commit
This is currently race-prone because nothing is synchronizing between other Qt and SDL uses of DRM master, so it can cause false negatives if we can't retake master ourselves.
This commit is contained in:
@@ -1365,8 +1365,8 @@ bool DrmRenderer::addFbForFrame(AVFrame *frame, uint32_t* newFbId, bool testMode
|
||||
drmFrame = (AVDRMFrameDescriptor*)frame->data[0];
|
||||
}
|
||||
|
||||
// For non-atomic drivers, check the IN_FORMATS property or legacy plane formats
|
||||
if (testMode && !m_PropSetter.isAtomic()) {
|
||||
// If we're testing, check the IN_FORMATS property or legacy plane formats
|
||||
if (testMode) {
|
||||
bool formatMatch = false;
|
||||
|
||||
uint64_t maskedModifier = drmFrame->objects[0].format_modifier;
|
||||
@@ -1497,69 +1497,6 @@ bool DrmRenderer::addFbForFrame(AVFrame *frame, uint32_t* newFbId, bool testMode
|
||||
return false;
|
||||
}
|
||||
|
||||
// For atomic drivers, we'll use a test-only commit to confirm this plane+FB works
|
||||
if (testMode && m_PropSetter.isAtomic()) {
|
||||
SDL_Rect src, dst;
|
||||
src.x = src.y = 0;
|
||||
src.w = frame->width;
|
||||
src.h = frame->height;
|
||||
|
||||
// This isn't a completely accurate test since SDL hasn't modeset to the new
|
||||
// display resolution that we'll actually be using for streaming (since we're
|
||||
// still not committed to even using DrmRenderer for rendering yet). Hopefully,
|
||||
// it will be good enough though.
|
||||
dst.x = dst.y = 0;
|
||||
drmModeCrtc* crtc = drmModeGetCrtc(m_DrmFd, m_Crtc.objectId());
|
||||
if (crtc != nullptr) {
|
||||
dst.w = crtc->width;
|
||||
dst.h = crtc->height;
|
||||
drmModeFreeCrtc(crtc);
|
||||
}
|
||||
else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"drmModeGetCrtc() failed: %d",
|
||||
errno);
|
||||
|
||||
// We'll just hope for the best here
|
||||
dst.w = frame->width;
|
||||
dst.h = frame->height;
|
||||
}
|
||||
|
||||
StreamUtils::scaleSourceToDestinationSurface(&src, &dst);
|
||||
|
||||
// Temporarily take DRM master if we dropped it after initialization
|
||||
if (!m_DrmStateModified) {
|
||||
drmSetMaster(m_DrmFd);
|
||||
}
|
||||
bool testResult = m_PropSetter.testPlane(m_VideoPlane,
|
||||
m_Crtc.objectId(),
|
||||
*newFbId,
|
||||
dst.x, dst.y,
|
||||
dst.w, dst.h,
|
||||
0, 0,
|
||||
frame->width << 16,
|
||||
frame->height << 16);
|
||||
if (!m_DrmStateModified) {
|
||||
drmDropMaster(m_DrmFd);
|
||||
}
|
||||
|
||||
if (testResult) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Selected DRM plane supports chosen decoding format and modifier: " FOURCC_FMT " %016" PRIx64,
|
||||
FOURCC_FMT_ARGS(drmFrame->layers[0].format),
|
||||
drmFrame->objects[0].format_modifier);
|
||||
}
|
||||
else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Selected DRM plane doesn't support chosen decoding format and modifier: " FOURCC_FMT " %016" PRIx64,
|
||||
FOURCC_FMT_ARGS(drmFrame->layers[0].format),
|
||||
drmFrame->objects[0].format_modifier);
|
||||
drmModeRmFB(m_DrmFd, *newFbId);
|
||||
*newFbId = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user