mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
kms: Make KMS feedback struct ref counted
It'll later be sent asynchronously; to prepare for that make it ref counted with an atomic ref counter. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2854>
This commit is contained in:
parent
37db905ff9
commit
7253ac501d
@ -40,6 +40,8 @@ typedef struct _MetaKmsCrtcColorUpdate
|
||||
|
||||
typedef struct _MetaKmsFeedback
|
||||
{
|
||||
gatomicrefcount ref_count;
|
||||
|
||||
MetaKmsFeedbackResult result;
|
||||
|
||||
GList *failed_planes;
|
||||
|
@ -90,6 +90,7 @@ meta_kms_feedback_new_passed (GList *failed_planes)
|
||||
.result = META_KMS_FEEDBACK_PASSED,
|
||||
.failed_planes = failed_planes,
|
||||
};
|
||||
g_atomic_ref_count_init (&feedback->ref_count);
|
||||
|
||||
return feedback;
|
||||
}
|
||||
@ -106,18 +107,29 @@ meta_kms_feedback_new_failed (GList *failed_planes,
|
||||
.error = error,
|
||||
.failed_planes = failed_planes,
|
||||
};
|
||||
g_atomic_ref_count_init (&feedback->ref_count);
|
||||
|
||||
return feedback;
|
||||
}
|
||||
|
||||
MetaKmsFeedback *
|
||||
meta_kms_feedback_ref (MetaKmsFeedback *feedback)
|
||||
{
|
||||
g_atomic_ref_count_inc (&feedback->ref_count);
|
||||
return feedback;
|
||||
}
|
||||
|
||||
void
|
||||
meta_kms_feedback_free (MetaKmsFeedback *feedback)
|
||||
meta_kms_feedback_unref (MetaKmsFeedback *feedback)
|
||||
{
|
||||
if (g_atomic_ref_count_dec (&feedback->ref_count))
|
||||
{
|
||||
g_list_free_full (feedback->failed_planes,
|
||||
(GDestroyNotify) meta_kms_plane_feedback_free);
|
||||
g_clear_error (&feedback->error);
|
||||
g_free (feedback);
|
||||
}
|
||||
}
|
||||
|
||||
MetaKmsFeedbackResult
|
||||
meta_kms_feedback_get_result (const MetaKmsFeedback *feedback)
|
||||
|
@ -81,8 +81,10 @@ typedef struct _MetaKmsPlaneFeedback
|
||||
typedef void (* MetaKmsResultListenerFunc) (const MetaKmsFeedback *feedback,
|
||||
gpointer user_data);
|
||||
|
||||
MetaKmsFeedback * meta_kms_feedback_ref (MetaKmsFeedback *feedback);
|
||||
|
||||
META_EXPORT_TEST
|
||||
void meta_kms_feedback_free (MetaKmsFeedback *feedback);
|
||||
void meta_kms_feedback_unref (MetaKmsFeedback *feedback);
|
||||
|
||||
MetaKmsFeedbackResult meta_kms_feedback_get_result (const MetaKmsFeedback *feedback);
|
||||
|
||||
@ -202,7 +204,7 @@ meta_fixed_16_rectangle_to_rectangle (MetaFixed16Rectangle fixed_rect)
|
||||
meta_fixed_16_from_int (_w), \
|
||||
meta_fixed_16_from_int (_h))
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaKmsFeedback, meta_kms_feedback_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaKmsFeedback, meta_kms_feedback_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaKmsUpdate, meta_kms_update_free)
|
||||
|
||||
#endif /* META_KMS_UPDATE_H */
|
||||
|
@ -284,7 +284,7 @@ meta_test_kms_device_mode_set (void)
|
||||
META_KMS_ASSIGN_PLANE_FLAG_NONE);
|
||||
feedback = meta_kms_device_process_update_sync (device, update,
|
||||
META_KMS_UPDATE_FLAG_NONE);
|
||||
meta_kms_feedback_free (feedback);
|
||||
meta_kms_feedback_unref (feedback);
|
||||
meta_kms_update_free (update);
|
||||
|
||||
g_assert_nonnull (meta_kms_crtc_get_current_state (crtc));
|
||||
@ -349,7 +349,7 @@ meta_test_kms_device_power_save (void)
|
||||
META_KMS_ASSIGN_PLANE_FLAG_NONE);
|
||||
feedback = meta_kms_device_process_update_sync (device, update,
|
||||
META_KMS_UPDATE_FLAG_NONE);
|
||||
meta_kms_feedback_free (feedback);
|
||||
meta_kms_feedback_unref (feedback);
|
||||
meta_kms_update_free (update);
|
||||
|
||||
g_assert_true (meta_kms_crtc_is_active (crtc));
|
||||
@ -387,7 +387,7 @@ meta_test_kms_device_power_save (void)
|
||||
META_KMS_ASSIGN_PLANE_FLAG_NONE);
|
||||
feedback = meta_kms_device_process_update_sync (device, update,
|
||||
META_KMS_UPDATE_FLAG_NONE);
|
||||
meta_kms_feedback_free (feedback);
|
||||
meta_kms_feedback_unref (feedback);
|
||||
meta_kms_update_free (update);
|
||||
|
||||
g_assert_true (meta_kms_crtc_is_active (crtc));
|
||||
|
@ -357,7 +357,7 @@ meta_test_kms_update_page_flip (void)
|
||||
feedback =
|
||||
meta_kms_device_process_update_sync (device, update,
|
||||
META_KMS_UPDATE_FLAG_NONE);
|
||||
meta_kms_feedback_free (feedback);
|
||||
meta_kms_feedback_unref (feedback);
|
||||
meta_kms_update_free (update);
|
||||
|
||||
g_main_loop_run (data.loop);
|
||||
@ -382,7 +382,7 @@ meta_test_kms_update_page_flip (void)
|
||||
feedback =
|
||||
meta_kms_device_process_update_sync (device, update,
|
||||
META_KMS_UPDATE_FLAG_NONE);
|
||||
meta_kms_feedback_free (feedback);
|
||||
meta_kms_feedback_unref (feedback);
|
||||
meta_kms_update_free (update);
|
||||
|
||||
g_main_loop_run (data.loop);
|
||||
|
Loading…
Reference in New Issue
Block a user