Commit 57dfe469 authored by Jonas Ådahl's avatar Jonas Ådahl Committed by Georges Basile Stavracas Neto

kms-update: Seal updates when posting them

This makes sure that we won't accidentally change KMS transaction
updates after they have been posted.

GNOME/mutter!525
parent 22a91f23
......@@ -34,6 +34,7 @@ typedef struct _MetaKmsProperty
typedef struct _MetaKmsPlaneAssignment
{
MetaKmsUpdate *update;
MetaKmsCrtc *crtc;
MetaKmsPlane *plane;
uint32_t fb_id;
......@@ -67,6 +68,10 @@ typedef struct _MetaKmsPageFlip
gpointer custom_page_flip_user_data;
} 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,
MetaKmsConnector *connector,
uint32_t prop_id,
......
......@@ -27,6 +27,8 @@
struct _MetaKmsUpdate
{
gboolean is_sealed;
MetaPowerSave power_save;
GList *mode_sets;
GList *plane_assignments;
......@@ -81,8 +83,11 @@ meta_kms_update_assign_plane (MetaKmsUpdate *update,
{
MetaKmsPlaneAssignment *plane_assignment;
g_assert (!meta_kms_update_is_sealed (update));
plane_assignment = g_new0 (MetaKmsPlaneAssignment, 1);
*plane_assignment = (MetaKmsPlaneAssignment) {
.update = update,
.crtc = crtc,
.plane = plane,
.fb_id = fb_id,
......@@ -104,6 +109,8 @@ meta_kms_update_mode_set (MetaKmsUpdate *update,
{
MetaKmsModeSet *mode_set;
g_assert (!meta_kms_update_is_sealed (update));
mode_set = g_new0 (MetaKmsModeSet, 1);
*mode_set = (MetaKmsModeSet) {
.crtc = crtc,
......@@ -122,6 +129,8 @@ meta_kms_update_set_connector_property (MetaKmsUpdate *update,
{
MetaKmsConnectorProperty *prop;
g_assert (!meta_kms_update_is_sealed (update));
prop = g_new0 (MetaKmsConnectorProperty, 1);
*prop = (MetaKmsConnectorProperty) {
.connector = connector,
......@@ -141,6 +150,8 @@ meta_kms_update_page_flip (MetaKmsUpdate *update,
{
MetaKmsPageFlip *page_flip;
g_assert (!meta_kms_update_is_sealed (update));
page_flip = g_new0 (MetaKmsPageFlip, 1);
*page_flip = (MetaKmsPageFlip) {
.crtc = crtc,
......@@ -161,6 +172,8 @@ meta_kms_update_custom_page_flip (MetaKmsUpdate *update,
{
MetaKmsPageFlip *page_flip;
g_assert (!meta_kms_update_is_sealed (update));
page_flip = g_new0 (MetaKmsPageFlip, 1);
*page_flip = (MetaKmsPageFlip) {
.crtc = crtc,
......@@ -180,6 +193,8 @@ meta_kms_plane_assignment_set_plane_property (MetaKmsPlaneAssignment *plane_assi
{
MetaKmsProperty *plane_prop;
g_assert (!meta_kms_update_is_sealed (plane_assignment->update));
plane_prop = meta_kms_property_new (prop_id, value);
plane_assignment->plane_properties =
......@@ -216,6 +231,18 @@ meta_kms_update_has_mode_set (MetaKmsUpdate *update)
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 *
meta_kms_update_new (void)
{
......
......@@ -202,6 +202,8 @@ meta_kms_post_update_sync (MetaKms *kms,
MetaKmsUpdate *update,
GError **error)
{
meta_kms_update_seal (update);
return meta_kms_run_impl_task_sync (kms,
meta_kms_update_process_in_impl,
update,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment