backends/drm: only enforce modifiers default for surface creation

Whether or not we want to use explicit modifiers for our surfaces doesn't
matter for what format+modifiers drm planes support. This way direct scanout
works by default, without having to explicitly enable modifiers
This commit is contained in:
Xaver Hugl 2021-11-29 17:32:05 +01:00
parent 33f3a13a1a
commit 1f79f421b4
2 changed files with 6 additions and 6 deletions

View file

@ -73,10 +73,7 @@ bool DrmPlane::init()
checkSupport(5, Transformation::ReflectY);
// read formats from blob if available and if modifiers are supported, and from the plane object if not
bool modifiersEnvSet = false;
bool modifiersEnv = qEnvironmentVariableIntValue("KWIN_DRM_USE_MODIFIERS", &modifiersEnvSet) != 0;
bool allowModifiers = (gpu()->isNVidia() && !modifiersEnvSet) || (modifiersEnvSet && modifiersEnv);
if (auto formatProp = getProp(PropertyIndex::In_Formats); formatProp && gpu()->addFB2ModifiersSupported() && allowModifiers) {
if (auto formatProp = getProp(PropertyIndex::In_Formats); formatProp && gpu()->addFB2ModifiersSupported()) {
DrmScopedPointer<drmModePropertyBlobRes> propertyBlob(drmModeGetPropertyBlob(gpu()->fd(), formatProp->current()));
if (propertyBlob && propertyBlob->data) {
auto blob = static_cast<drm_format_modifier_blob*>(propertyBlob->data);

View file

@ -152,11 +152,14 @@ bool EglGbmBackend::resetOutput(Output &output)
QVector<uint64_t> modifiers = output.output->supportedModifiers(m_gbmFormat);
QSharedPointer<GbmSurface> gbmSurface;
bool modifiersEnvSet = false;
static bool modifiersEnv = qEnvironmentVariableIntValue("KWIN_DRM_USE_MODIFIERS", &modifiersEnvSet) != 0;
static bool allowModifiers = (gpu()->isNVidia() && !modifiersEnvSet) || (modifiersEnvSet && modifiersEnv);
#if HAVE_GBM_BO_GET_FD_FOR_PLANE
if (modifiers.isEmpty()) {
if (!allowModifiers) {
#else
// modifiers have to be disabled with multi-gpu if gbm_bo_get_fd_for_plane is not available
if (modifiers.isEmpty() || output.output->gpu() != m_gpu) {
if (!allowModifiers || output.output->gpu() != m_gpu) {
#endif
int flags = GBM_BO_USE_RENDERING;
if (output.output->gpu() == m_gpu) {