kms/device: Differentiate between lack of AddFb2() and udev rule

We disable modifiers for two reasons: an udev rule saying so, or the
lack of a working drmModeAddFB2(). However, to the users, this is not
granular enough. While the current user, whether to enable modifiers in
MetaRendererNative, doesn't need more granularity, we want to send
modifiers to Wayland clients even if the onscreen framebuffers should
still be allocated without modifiers.

Prepare for differentiating between how Wayland DMA buffers work and how
onscreen buffer allocation work by separating the relevant device flags.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>
This commit is contained in:
Jonas Ådahl 2022-08-01 21:15:12 +02:00 committed by Marge Bot
parent 1844dcc08e
commit 50396fc00e
5 changed files with 10 additions and 13 deletions

View File

@ -134,15 +134,6 @@ meta_gpu_kms_is_platform_device (MetaGpuKms *gpu_kms)
return !!(flags & META_KMS_DEVICE_FLAG_PLATFORM_DEVICE);
}
gboolean
meta_gpu_kms_disable_modifiers (MetaGpuKms *gpu_kms)
{
MetaKmsDeviceFlag flags;
flags = meta_kms_device_get_flags (gpu_kms->kms_device);
return !!(flags & META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS);
}
static int
compare_outputs (gconstpointer one,
gconstpointer two)

View File

@ -47,7 +47,6 @@ gboolean meta_gpu_kms_is_crtc_active (MetaGpuKms *gpu_kms,
gboolean meta_gpu_kms_is_boot_vga (MetaGpuKms *gpu_kms);
gboolean meta_gpu_kms_is_platform_device (MetaGpuKms *gpu_kms);
gboolean meta_gpu_kms_disable_modifiers (MetaGpuKms *gpu_kms);
MetaKmsDevice * meta_gpu_kms_get_kms_device (MetaGpuKms *gpu_kms);

View File

@ -550,8 +550,8 @@ meta_kms_device_new (MetaKms *kms,
free (device->path);
device->path = data.out_path;
if (!device->caps.addfb2_modifiers)
device->flags |= META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS;
if (device->caps.addfb2_modifiers)
device->flags |= META_KMS_DEVICE_FLAG_HAS_ADDFB2;
return device;
}

View File

@ -62,6 +62,7 @@ typedef enum _MetaKmsDeviceFlag
META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS = 1 << 2,
META_KMS_DEVICE_FLAG_PREFERRED_PRIMARY = 1 << 3,
META_KMS_DEVICE_FLAG_NO_MODE_SETTING = 1 << 4,
META_KMS_DEVICE_FLAG_HAS_ADDFB2 = 1 << 5,
} MetaKmsDeviceFlag;
typedef enum _MetaKmsResourceChanges

View File

@ -2125,8 +2125,14 @@ meta_renderer_native_initable_init (GInitable *initable,
}
else
{
MetaKmsDevice *kms_device =
meta_gpu_kms_get_kms_device (renderer_native->primary_gpu_kms);
MetaKmsDeviceFlag flags;
flags = meta_kms_device_get_flags (kms_device);
renderer_native->use_modifiers =
!meta_gpu_kms_disable_modifiers (renderer_native->primary_gpu_kms);
!(flags & META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS) &&
flags & META_KMS_DEVICE_FLAG_HAS_ADDFB2;
}
meta_topic (META_DEBUG_KMS, "Usage of KMS modifiers is %s",