Fix libdrm return value vs errno confusion

libdrm is inconsistent between returning -1 with an errno set
and just returning -errno as the return value. Figuring out which
behavior a given libdrm function has require reading the source :/
This commit is contained in:
Cameron Gutman
2026-01-04 21:46:49 -06:00
parent 8726c1c7d0
commit bd32370b6d
2 changed files with 39 additions and 30 deletions

View File

@@ -827,7 +827,7 @@ void DrmRenderer::setHdrMode(bool enabled)
m_HdrOutputMetadataBlobId = 0;
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"drmModeCreatePropertyBlob() failed: %d",
errno);
err);
// Non-fatal
}
}
@@ -1083,7 +1083,7 @@ bool DrmRenderer::uploadSurfaceToFb(SDL_Surface *surface, uint32_t* handle, uint
if (err < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"drmModeAddFB2() failed: %d",
errno);
err);
goto Fail;
}
@@ -1312,7 +1312,7 @@ bool DrmRenderer::addFbForFrame(AVFrame *frame, uint32_t* newFbId, bool testMode
if (err < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"drmModeAddFB2[WithModifiers]() failed: %d",
errno);
err);
return false;
}