kms/device: Move universal plane cap check to mode set init
This leaves only the atomic mode setting cap check before creating the impl device, aiming to make it possible to create a non-mode-setting MetaKmsImplDevice implementation. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
parent
7c25953c65
commit
34b0f9c124
2 changed files with 12 additions and 10 deletions
|
@ -281,22 +281,12 @@ meta_create_kms_impl_device (MetaKmsDevice *device,
|
|||
{
|
||||
GType impl_device_type;
|
||||
gboolean supports_atomic_mode_setting;
|
||||
int ret;
|
||||
g_autofree char *driver_name = NULL;
|
||||
g_autofree char *driver_description = NULL;
|
||||
const char *atomic_kms_enable_env;
|
||||
|
||||
meta_assert_in_kms_impl (meta_kms_impl_get_kms (impl));
|
||||
|
||||
ret = drmSetClientCap (fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
|
||||
if (ret != 0)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
|
||||
"Failed to activate universal planes: %s",
|
||||
g_strerror (-ret));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!get_driver_info (fd, &driver_name, &driver_description))
|
||||
{
|
||||
driver_name = g_strdup ("unknown");
|
||||
|
@ -340,6 +330,8 @@ meta_create_kms_impl_device (MetaKmsDevice *device,
|
|||
}
|
||||
else
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = drmSetClientCap (fd, DRM_CLIENT_CAP_ATOMIC, 1);
|
||||
if (ret == 0)
|
||||
supports_atomic_mode_setting = TRUE;
|
||||
|
|
|
@ -787,8 +787,18 @@ meta_kms_impl_device_init_mode_setting (MetaKmsImplDevice *impl_device,
|
|||
{
|
||||
MetaKmsImplDevicePrivate *priv =
|
||||
meta_kms_impl_device_get_instance_private (impl_device);
|
||||
int ret;
|
||||
drmModeRes *drm_resources;
|
||||
|
||||
ret = drmSetClientCap (priv->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
|
||||
if (ret != 0)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
|
||||
"Failed to activate universal planes: %s",
|
||||
g_strerror (-ret));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
drm_resources = drmModeGetResources (priv->fd);
|
||||
if (!drm_resources)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue