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.
This commit is contained in:
Xaver Hugl 2022-03-18 15:40:53 +01:00
parent ec75943425
commit f31b4b36d7

View file

@ -119,21 +119,12 @@ void DrmOutput::updateCursor()
} }
const auto plane = m_pipeline->pending.crtc->cursorPlane(); const auto plane = m_pipeline->pending.crtc->cursorPlane();
if (!m_cursor || (plane && !plane->formats().value(m_cursor->drmFormat()).contains(DRM_FORMAT_MOD_LINEAR))) { if (!m_cursor || (plane && !plane->formats().value(m_cursor->drmFormat()).contains(DRM_FORMAT_MOD_LINEAR))) {
if (plane) { if (plane && (!plane->formats().contains(DRM_FORMAT_ARGB8888) || !plane->formats().value(DRM_FORMAT_ARGB8888).contains(DRM_FORMAT_MOD_LINEAR))) {
const auto formatModifiers = plane->formats(); m_pipeline->setCursor(nullptr);
const auto formats = formatModifiers.keys(); m_setCursorSuccessful = false;
for (uint32_t format : formats) { return;
if (!formatModifiers[format].contains(DRM_FORMAT_MOD_LINEAR)) {
continue;
}
m_cursor = QSharedPointer<DumbSwapchain>::create(m_gpu, m_gpu->cursorSize(), format, QImage::Format::Format_ARGB32_Premultiplied);
if (!m_cursor->isEmpty()) {
break;
}
}
} else {
m_cursor = QSharedPointer<DumbSwapchain>::create(m_gpu, m_gpu->cursorSize(), DRM_FORMAT_XRGB8888, QImage::Format::Format_ARGB32_Premultiplied);
} }
m_cursor = QSharedPointer<DumbSwapchain>::create(m_gpu, m_gpu->cursorSize(), plane ? DRM_FORMAT_ARGB8888 : DRM_FORMAT_XRGB8888, QImage::Format::Format_ARGB32_Premultiplied);
if (!m_cursor || m_cursor->isEmpty()) { if (!m_cursor || m_cursor->isEmpty()) {
m_pipeline->setCursor(nullptr); m_pipeline->setCursor(nullptr);
m_setCursorSuccessful = false; m_setCursorSuccessful = false;