kms: Allow setting the "VRR_ENABLED" property on a CRTC

Add functions to update and monitor the value of the "VRR_ENABLED"
KMS property.

This requires the addition of functions to process CRTC property
updates in both the atomic and the simple KMS backends. The
implementation is similar to the implemention of processing
connector updates.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
This commit is contained in:
Dor Askayo
2022-07-02 17:10:36 +03:00
committed by Marge Bot
parent b7128b1d12
commit 4ad282cf26
10 changed files with 276 additions and 4 deletions

View File

@ -179,6 +179,47 @@ set_connector_property (MetaKmsImplDevice *impl_device,
return TRUE;
}
static gboolean
set_crtc_property (MetaKmsImplDevice *impl_device,
MetaKmsCrtc *crtc,
MetaKmsCrtcProp prop,
uint64_t value,
GError **error)
{
uint32_t prop_id;
int fd;
int ret;
prop_id = meta_kms_crtc_get_prop_id (crtc, prop);
if (!prop_id)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"Property (%s) not found on CRTC %u",
meta_kms_crtc_get_prop_name (crtc, prop),
meta_kms_crtc_get_id (crtc));
return FALSE;
}
fd = meta_kms_impl_device_get_fd (impl_device);
ret = drmModeObjectSetProperty (fd,
meta_kms_crtc_get_id (crtc),
DRM_MODE_OBJECT_CRTC,
prop_id,
value);
if (ret != 0)
{
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
"Failed to set CRTC %u property %u: %s",
meta_kms_crtc_get_id (crtc),
prop_id,
g_strerror (-ret));
return FALSE;
}
return TRUE;
}
static gboolean
process_connector_update (MetaKmsImplDevice *impl_device,
MetaKmsUpdate *update,
@ -268,6 +309,28 @@ process_connector_update (MetaKmsImplDevice *impl_device,
return TRUE;
}
static gboolean
process_crtc_update (MetaKmsImplDevice *impl_device,
MetaKmsUpdate *update,
gpointer update_entry,
GError **error)
{
MetaKmsCrtcUpdate *crtc_update = update_entry;
MetaKmsCrtc *crtc = crtc_update->crtc;
if (crtc_update->vrr.has_update)
{
if (!set_crtc_property (impl_device,
crtc,
META_KMS_CRTC_PROP_VRR_ENABLED,
!!crtc_update->vrr.is_enabled,
error))
return FALSE;
}
return TRUE;
}
static CachedModeSet *
cached_mode_set_new (GList *connectors,
const drmModeModeInfo *drm_mode,
@ -1548,6 +1611,13 @@ meta_kms_impl_device_simple_process_update (MetaKmsImplDevice *impl_device,
&error))
goto err;
if (!process_entries (impl_device,
update,
meta_kms_update_get_crtc_updates (update),
process_crtc_update,
&error))
goto err;
if (!process_plane_assignments (impl_device, update, &failed_planes, &error))
goto err;