fix get vblank counter failed: Invalid argument

The error "get vblank counter failed: Invalid argument" occurs when drmWaitVBlank is called on a CRTC that is not enabled/active. The kernel returns EINVAL because you cannot get vblank counters for a disabled CRTC.
This commit is contained in:
Joseph Crowell
2026-02-19 15:33:55 +10:00
parent 3f48bbfe95
commit 29cb761cf5

View File

@@ -44,6 +44,7 @@
#include "amdgpu_bo_helper.h"
#include "amdgpu_glamor.h"
#include "amdgpu_pixmap.h"
#include "amdgpu_video.h"
#include <X11/extensions/dpmsconst.h>
@@ -211,6 +212,9 @@ int drmmode_crtc_get_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc)
ScrnInfoPtr scrn = crtc->scrn;
uint32_t seq;
if (!amdgpu_crtc_is_enabled(crtc))
return -1;
if (!drmmode_wait_vblank(crtc, DRM_VBLANK_RELATIVE, 0, 0, ust, &seq)) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"get vblank counter failed: %s\n", strerror(errno));