gbm: Don't pass any flags when creating buffers with modifiers

It seems it doesn't bring much and it may backfire. Especially don't
pass GBM_BO_USE_LINEAR as it will limit a lot the buffers that can be
created and GBM_BO_USE_RENDERING use seems to be more harmful than
helpful on most cases.
This commit is contained in:
Aleix Pol 2022-06-17 14:42:41 +02:00 committed by Aleix Pol Gonzalez
parent 78d80123f1
commit d5ddf55e9b
3 changed files with 6 additions and 27 deletions

View file

@ -245,13 +245,6 @@ else()
set(HAVE_GBM_BO_GET_FD_FOR_PLANE 0)
endif()
if (gbm_VERSION_STRING VERSION_GREATER_EQUAL 21.3.0)
set(GBM_CREATE_WITH_MODIFIERS2 1)
else()
set(GBM_CREATE_WITH_MODIFIERS2 0)
endif()
pkg_check_modules(Libxcvt IMPORTED_TARGET libxcvt>=0.1.1 REQUIRED)
add_feature_info(Libxcvt Libxcvt_FOUND "Required for generating modes in the drm backend")

View file

@ -12,18 +12,6 @@
#include <gbm.h>
#if !GBM_CREATE_WITH_MODIFIERS2
inline struct gbm_bo *
gbm_bo_create_with_modifiers2(struct gbm_device *gbm,
uint32_t width, uint32_t height,
uint32_t format,
const uint64_t *modifiers,
const unsigned int count, quint32 flags)
{
return gbm_bo_create_with_modifiers(gbm, width, height, format, modifiers, count);
}
#endif
namespace KWin
{
@ -68,14 +56,13 @@ inline DmaBufParams dmaBufParamsForBo(gbm_bo *bo)
inline gbm_bo *createGbmBo(gbm_device *device, const QSize &size, quint32 format, const QVector<uint64_t> &modifiers)
{
const uint32_t flags = GBM_BO_USE_RENDERING | GBM_BO_USE_LINEAR;
gbm_bo *bo = nullptr;
if (modifiers.count() > 0 && !(modifiers.count() == 1 && modifiers[0] == DRM_FORMAT_MOD_INVALID)) {
bo = gbm_bo_create_with_modifiers2(device,
size.width(),
size.height(),
format,
modifiers.constData(), modifiers.count(), 0);
bo = gbm_bo_create_with_modifiers(device,
size.width(),
size.height(),
format,
modifiers.constData(), modifiers.count());
}
if (!bo && (modifiers.isEmpty() || modifiers.contains(DRM_FORMAT_MOD_INVALID))) {
@ -83,7 +70,7 @@ inline gbm_bo *createGbmBo(gbm_device *device, const QSize &size, quint32 format
size.width(),
size.height(),
format,
flags);
GBM_BO_USE_LINEAR);
}
return bo;
}

View file

@ -33,4 +33,3 @@
#cmakedefine01 PipeWire_FOUND
#cmakedefine01 HAVE_XWAYLAND_LISTENFD
#cmakedefine01 GBM_CREATE_WITH_MODIFIERS2