From 3ffa774f121dc99d5e87bd29476a664636809d92 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 29 Jun 2024 19:28:51 +0200 Subject: [PATCH] drm: deny implicit modifiers for the cursor plane --- src/backend/drm/DRM.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/backend/drm/DRM.cpp b/src/backend/drm/DRM.cpp index 1a4ff90..76096c8 100644 --- a/src/backend/drm/DRM.cpp +++ b/src/backend/drm/DRM.cpp @@ -1134,6 +1134,17 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) { if (connector->crtc->pendingCursor) data.cursorFB = connector->crtc->pendingCursor; + if (data.cursorFB) { + // verify cursor format. This might be wrong on NVIDIA where linear buffers + // fail to be created from gbm + // TODO: add an API to detect this and request drm_dumb linear buffers. Or do something, + // idk + if (data.cursorFB->buffer->dmabuf().modifier == DRM_FORMAT_MOD_INVALID) { + backend->backend->log(AQ_LOG_TRACE, "drm: Dropping invalid buffer for cursor plane"); + data.cursorFB = nullptr; + } + } + data.blocking = BLOCKING; data.modeset = NEEDS_RECONFIG; data.flags = flags;