dmabuf: Create buffers without the SCANOUT flag

gbm_bo_create_with_modifiers implies the GBM_BO_USE_SCANOUT flag, which
disables complex (tiled or compressed) formats that cannot be used for
scanout. This reduces performance. We don't need to scan out buffers
created for sceencasting/etc., so this is suboptimal.

By switching to gbm_bo_create_with_modifiers2, we can explicitly pass
the flags and avoid falling back to lower performance formats. Also add
a config check and fall back to the old version, to retain compatibility
with older mesa versions.
master
Asahi Lina 2 years ago committed by Aleix Pol Gonzalez
parent f5a80f0d3c
commit a508149882

@ -248,6 +248,11 @@ if (${gbm_VERSION} GREATER_EQUAL 21.1)
else()
set(HAVE_GBM_BO_GET_FD_FOR_PLANE 0)
endif()
if (${gbm_VERSION} GREATER_EQUAL 21.3)
set(HAVE_GBM_BO_CREATE_WITH_MODIFIERS2 1)
else()
set(HAVE_GBM_BO_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")

@ -58,11 +58,20 @@ inline gbm_bo *createGbmBo(gbm_device *device, const QSize &size, quint32 format
{
gbm_bo *bo = nullptr;
if (modifiers.count() > 0 && !(modifiers.count() == 1 && modifiers[0] == DRM_FORMAT_MOD_INVALID)) {
#if HAVE_GBM_BO_CREATE_WITH_MODIFIERS2
bo = gbm_bo_create_with_modifiers2(device,
size.width(),
size.height(),
format,
modifiers.constData(), modifiers.count(),
GBM_BO_USE_RENDERING);
#else
bo = gbm_bo_create_with_modifiers(device,
size.width(),
size.height(),
format,
modifiers.constData(), modifiers.count());
#endif
}
if (!bo && (modifiers.isEmpty() || modifiers.contains(DRM_FORMAT_MOD_INVALID))) {

@ -14,6 +14,7 @@
#cmakedefine01 HAVE_X11_XCB
#cmakedefine01 HAVE_X11_XINPUT
#cmakedefine01 HAVE_GBM_BO_GET_FD_FOR_PLANE
#cmakedefine01 HAVE_GBM_BO_CREATE_WITH_MODIFIERS2
#cmakedefine01 HAVE_MEMFD
#cmakedefine01 HAVE_BREEZE_DECO
#cmakedefine01 HAVE_SCHED_RESET_ON_FORK

Loading…
Cancel
Save