backends/drm: ignore opaque formats for the cursor plane
The kernel may expose an opaque format that we normally prefer, so to prevent picking an opaque format for the cursor, filter those out.
This commit is contained in:
parent
166b5f96fc
commit
4df1b3a219
3 changed files with 12 additions and 3 deletions
|
@ -39,7 +39,7 @@ static TextureTransforms drmToTextureRotation(DrmPipeline *pipeline)
|
|||
|
||||
EglGbmCursorLayer::EglGbmCursorLayer(EglGbmBackend *eglBackend, DrmPipeline *pipeline)
|
||||
: DrmOverlayLayer(pipeline)
|
||||
, m_surface(pipeline->gpu(), eglBackend, pipeline->gpu()->atomicModeSetting() ? EglGbmLayerSurface::BufferTarget::Linear : EglGbmLayerSurface::BufferTarget::Dumb)
|
||||
, m_surface(pipeline->gpu(), eglBackend, pipeline->gpu()->atomicModeSetting() ? EglGbmLayerSurface::BufferTarget::Linear : EglGbmLayerSurface::BufferTarget::Dumb, EglGbmLayerSurface::FormatOption::RequireAlpha)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -42,10 +42,11 @@ static gbm_format_name_desc formatName(uint32_t format)
|
|||
return ret;
|
||||
}
|
||||
|
||||
EglGbmLayerSurface::EglGbmLayerSurface(DrmGpu *gpu, EglGbmBackend *eglBackend, BufferTarget target)
|
||||
EglGbmLayerSurface::EglGbmLayerSurface(DrmGpu *gpu, EglGbmBackend *eglBackend, BufferTarget target, FormatOption formatOption)
|
||||
: m_gpu(gpu)
|
||||
, m_eglBackend(eglBackend)
|
||||
, m_bufferTarget(target)
|
||||
, m_formatOption(formatOption)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -193,6 +194,9 @@ std::optional<EglGbmLayerSurface::Surface> EglGbmLayerSurface::createSurface(con
|
|||
};
|
||||
const auto testFormats = [this, &size, &formats](const QVector<GbmFormat> &gbmFormats, MultiGpuImportMode importMode) -> std::optional<Surface> {
|
||||
for (const auto &format : gbmFormats) {
|
||||
if (m_formatOption == FormatOption::RequireAlpha && format.alphaSize == 0) {
|
||||
continue;
|
||||
}
|
||||
const auto surface = createSurface(size, format.drmFormat, formats[format.drmFormat], importMode);
|
||||
if (surface.has_value()) {
|
||||
return surface;
|
||||
|
|
|
@ -47,7 +47,11 @@ public:
|
|||
Linear,
|
||||
Dumb
|
||||
};
|
||||
EglGbmLayerSurface(DrmGpu *gpu, EglGbmBackend *eglBackend, BufferTarget target = BufferTarget::Normal);
|
||||
enum class FormatOption {
|
||||
PreferAlpha,
|
||||
RequireAlpha
|
||||
};
|
||||
EglGbmLayerSurface(DrmGpu *gpu, EglGbmBackend *eglBackend, BufferTarget target = BufferTarget::Normal, FormatOption formatOption = FormatOption::PreferAlpha);
|
||||
~EglGbmLayerSurface();
|
||||
|
||||
std::optional<OutputLayerBeginFrameInfo> startRendering(const QSize &bufferSize, TextureTransforms transformation, const QMap<uint32_t, QVector<uint64_t>> &formats);
|
||||
|
@ -94,6 +98,7 @@ private:
|
|||
DrmGpu *const m_gpu;
|
||||
EglGbmBackend *const m_eglBackend;
|
||||
const BufferTarget m_bufferTarget;
|
||||
const FormatOption m_formatOption;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue