wayland/dma-buf: Always send modifiers if AddFB2() is supported

To Wayland clients, it doesn't matter how we configure our onscreen
buffers, since they don't necessarily have the same bandwidth issues
related to mode setting, whichis the primary reason why we disable
modifiers using the udev rule, so simply check whether importing with
modifiers will work at all and advertise modifiers if so is the case.

This might help avoid issues using legacy non-modifiers path in drivers.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>
This commit is contained in:
Jonas Ådahl 2022-08-01 21:19:01 +02:00 committed by Marge Bot
parent 50396fc00e
commit 34475e7e98

View File

@ -56,6 +56,7 @@
#ifdef HAVE_NATIVE_BACKEND #ifdef HAVE_NATIVE_BACKEND
#include "backends/native/meta-drm-buffer-gbm.h" #include "backends/native/meta-drm-buffer-gbm.h"
#include "backends/native/meta-kms-device.h"
#include "backends/native/meta-kms-utils.h" #include "backends/native/meta-kms-utils.h"
#include "backends/native/meta-onscreen-native.h" #include "backends/native/meta-onscreen-native.h"
#include "backends/native/meta-renderer-native.h" #include "backends/native/meta-renderer-native.h"
@ -150,23 +151,19 @@ static GQuark quark_dma_buf_surface_feedback;
static gboolean static gboolean
should_send_modifiers (MetaBackend *backend) should_send_modifiers (MetaBackend *backend)
{
MetaSettings *settings = meta_backend_get_settings (backend);
if (meta_settings_is_experimental_feature_enabled (
settings, META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS))
return TRUE;
#ifdef HAVE_NATIVE_BACKEND
if (META_IS_BACKEND_NATIVE (backend))
{ {
MetaRenderer *renderer = meta_backend_get_renderer (backend); MetaRenderer *renderer = meta_backend_get_renderer (backend);
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer); MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
return meta_renderer_native_use_modifiers (renderer_native); MetaGpuKms *gpu_kms;
} MetaKmsDevice *kms_device;
#endif MetaKmsDeviceFlag flags;
return FALSE; gpu_kms = meta_renderer_native_get_primary_gpu (renderer_native);
kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
flags = meta_kms_device_get_flags (kms_device);
return !!(flags & META_KMS_DEVICE_FLAG_HAS_ADDFB2);
} }
static gint static gint