From f31b4b36d7333805cda39afbb316bbe74a82c8dd Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Fri, 18 Mar 2022 15:40:53 +0100 Subject: [PATCH] backends/drm: only allow ARGB8888 as the cursor format The raspberry pi exposes opaque formats for the cursor plane, and interprets them as being opaque as well... Considering that we effectively don't support anything else with the QPainter anyways, just hardcode ARGB8888 until we paint the cursor with OpenGl. --- src/backends/drm/drm_output.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/backends/drm/drm_output.cpp b/src/backends/drm/drm_output.cpp index d7b4bbd954..3a0c9614e4 100644 --- a/src/backends/drm/drm_output.cpp +++ b/src/backends/drm/drm_output.cpp @@ -119,21 +119,12 @@ void DrmOutput::updateCursor() } const auto plane = m_pipeline->pending.crtc->cursorPlane(); if (!m_cursor || (plane && !plane->formats().value(m_cursor->drmFormat()).contains(DRM_FORMAT_MOD_LINEAR))) { - if (plane) { - const auto formatModifiers = plane->formats(); - const auto formats = formatModifiers.keys(); - for (uint32_t format : formats) { - if (!formatModifiers[format].contains(DRM_FORMAT_MOD_LINEAR)) { - continue; - } - m_cursor = QSharedPointer::create(m_gpu, m_gpu->cursorSize(), format, QImage::Format::Format_ARGB32_Premultiplied); - if (!m_cursor->isEmpty()) { - break; - } - } - } else { - m_cursor = QSharedPointer::create(m_gpu, m_gpu->cursorSize(), DRM_FORMAT_XRGB8888, QImage::Format::Format_ARGB32_Premultiplied); + if (plane && (!plane->formats().contains(DRM_FORMAT_ARGB8888) || !plane->formats().value(DRM_FORMAT_ARGB8888).contains(DRM_FORMAT_MOD_LINEAR))) { + m_pipeline->setCursor(nullptr); + m_setCursorSuccessful = false; + return; } + m_cursor = QSharedPointer::create(m_gpu, m_gpu->cursorSize(), plane ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_XRGB8888, QImage::Format::Format_ARGB32_Premultiplied); if (!m_cursor || m_cursor->isEmpty()) { m_pipeline->setCursor(nullptr); m_setCursorSuccessful = false;