kms-update: Seal updates when posting them
This makes sure that we won't accidentally change KMS transaction updates after they have been posted. https://gitlab.gnome.org/GNOME/mutter/merge_requests/525
This commit is contained in:
parent
22a91f23ad
commit
57dfe4696d
@ -34,6 +34,7 @@ typedef struct _MetaKmsProperty
|
|||||||
|
|
||||||
typedef struct _MetaKmsPlaneAssignment
|
typedef struct _MetaKmsPlaneAssignment
|
||||||
{
|
{
|
||||||
|
MetaKmsUpdate *update;
|
||||||
MetaKmsCrtc *crtc;
|
MetaKmsCrtc *crtc;
|
||||||
MetaKmsPlane *plane;
|
MetaKmsPlane *plane;
|
||||||
uint32_t fb_id;
|
uint32_t fb_id;
|
||||||
@ -67,6 +68,10 @@ typedef struct _MetaKmsPageFlip
|
|||||||
gpointer custom_page_flip_user_data;
|
gpointer custom_page_flip_user_data;
|
||||||
} MetaKmsPageFlip;
|
} MetaKmsPageFlip;
|
||||||
|
|
||||||
|
void meta_kms_update_seal (MetaKmsUpdate *update);
|
||||||
|
|
||||||
|
gboolean meta_kms_update_is_sealed (MetaKmsUpdate *update);
|
||||||
|
|
||||||
void meta_kms_update_set_connector_property (MetaKmsUpdate *update,
|
void meta_kms_update_set_connector_property (MetaKmsUpdate *update,
|
||||||
MetaKmsConnector *connector,
|
MetaKmsConnector *connector,
|
||||||
uint32_t prop_id,
|
uint32_t prop_id,
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
struct _MetaKmsUpdate
|
struct _MetaKmsUpdate
|
||||||
{
|
{
|
||||||
|
gboolean is_sealed;
|
||||||
|
|
||||||
MetaPowerSave power_save;
|
MetaPowerSave power_save;
|
||||||
GList *mode_sets;
|
GList *mode_sets;
|
||||||
GList *plane_assignments;
|
GList *plane_assignments;
|
||||||
@ -81,8 +83,11 @@ meta_kms_update_assign_plane (MetaKmsUpdate *update,
|
|||||||
{
|
{
|
||||||
MetaKmsPlaneAssignment *plane_assignment;
|
MetaKmsPlaneAssignment *plane_assignment;
|
||||||
|
|
||||||
|
g_assert (!meta_kms_update_is_sealed (update));
|
||||||
|
|
||||||
plane_assignment = g_new0 (MetaKmsPlaneAssignment, 1);
|
plane_assignment = g_new0 (MetaKmsPlaneAssignment, 1);
|
||||||
*plane_assignment = (MetaKmsPlaneAssignment) {
|
*plane_assignment = (MetaKmsPlaneAssignment) {
|
||||||
|
.update = update,
|
||||||
.crtc = crtc,
|
.crtc = crtc,
|
||||||
.plane = plane,
|
.plane = plane,
|
||||||
.fb_id = fb_id,
|
.fb_id = fb_id,
|
||||||
@ -104,6 +109,8 @@ meta_kms_update_mode_set (MetaKmsUpdate *update,
|
|||||||
{
|
{
|
||||||
MetaKmsModeSet *mode_set;
|
MetaKmsModeSet *mode_set;
|
||||||
|
|
||||||
|
g_assert (!meta_kms_update_is_sealed (update));
|
||||||
|
|
||||||
mode_set = g_new0 (MetaKmsModeSet, 1);
|
mode_set = g_new0 (MetaKmsModeSet, 1);
|
||||||
*mode_set = (MetaKmsModeSet) {
|
*mode_set = (MetaKmsModeSet) {
|
||||||
.crtc = crtc,
|
.crtc = crtc,
|
||||||
@ -122,6 +129,8 @@ meta_kms_update_set_connector_property (MetaKmsUpdate *update,
|
|||||||
{
|
{
|
||||||
MetaKmsConnectorProperty *prop;
|
MetaKmsConnectorProperty *prop;
|
||||||
|
|
||||||
|
g_assert (!meta_kms_update_is_sealed (update));
|
||||||
|
|
||||||
prop = g_new0 (MetaKmsConnectorProperty, 1);
|
prop = g_new0 (MetaKmsConnectorProperty, 1);
|
||||||
*prop = (MetaKmsConnectorProperty) {
|
*prop = (MetaKmsConnectorProperty) {
|
||||||
.connector = connector,
|
.connector = connector,
|
||||||
@ -141,6 +150,8 @@ meta_kms_update_page_flip (MetaKmsUpdate *update,
|
|||||||
{
|
{
|
||||||
MetaKmsPageFlip *page_flip;
|
MetaKmsPageFlip *page_flip;
|
||||||
|
|
||||||
|
g_assert (!meta_kms_update_is_sealed (update));
|
||||||
|
|
||||||
page_flip = g_new0 (MetaKmsPageFlip, 1);
|
page_flip = g_new0 (MetaKmsPageFlip, 1);
|
||||||
*page_flip = (MetaKmsPageFlip) {
|
*page_flip = (MetaKmsPageFlip) {
|
||||||
.crtc = crtc,
|
.crtc = crtc,
|
||||||
@ -161,6 +172,8 @@ meta_kms_update_custom_page_flip (MetaKmsUpdate *update,
|
|||||||
{
|
{
|
||||||
MetaKmsPageFlip *page_flip;
|
MetaKmsPageFlip *page_flip;
|
||||||
|
|
||||||
|
g_assert (!meta_kms_update_is_sealed (update));
|
||||||
|
|
||||||
page_flip = g_new0 (MetaKmsPageFlip, 1);
|
page_flip = g_new0 (MetaKmsPageFlip, 1);
|
||||||
*page_flip = (MetaKmsPageFlip) {
|
*page_flip = (MetaKmsPageFlip) {
|
||||||
.crtc = crtc,
|
.crtc = crtc,
|
||||||
@ -180,6 +193,8 @@ meta_kms_plane_assignment_set_plane_property (MetaKmsPlaneAssignment *plane_assi
|
|||||||
{
|
{
|
||||||
MetaKmsProperty *plane_prop;
|
MetaKmsProperty *plane_prop;
|
||||||
|
|
||||||
|
g_assert (!meta_kms_update_is_sealed (plane_assignment->update));
|
||||||
|
|
||||||
plane_prop = meta_kms_property_new (prop_id, value);
|
plane_prop = meta_kms_property_new (prop_id, value);
|
||||||
|
|
||||||
plane_assignment->plane_properties =
|
plane_assignment->plane_properties =
|
||||||
@ -216,6 +231,18 @@ meta_kms_update_has_mode_set (MetaKmsUpdate *update)
|
|||||||
return !!update->mode_sets;
|
return !!update->mode_sets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_kms_update_seal (MetaKmsUpdate *update)
|
||||||
|
{
|
||||||
|
update->is_sealed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_kms_update_is_sealed (MetaKmsUpdate *update)
|
||||||
|
{
|
||||||
|
return update->is_sealed;
|
||||||
|
}
|
||||||
|
|
||||||
MetaKmsUpdate *
|
MetaKmsUpdate *
|
||||||
meta_kms_update_new (void)
|
meta_kms_update_new (void)
|
||||||
{
|
{
|
||||||
|
@ -202,6 +202,8 @@ meta_kms_post_update_sync (MetaKms *kms,
|
|||||||
MetaKmsUpdate *update,
|
MetaKmsUpdate *update,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
meta_kms_update_seal (update);
|
||||||
|
|
||||||
return meta_kms_run_impl_task_sync (kms,
|
return meta_kms_run_impl_task_sync (kms,
|
||||||
meta_kms_update_process_in_impl,
|
meta_kms_update_process_in_impl,
|
||||||
update,
|
update,
|
||||||
|
Loading…
Reference in New Issue
Block a user