mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 19:10:43 -05:00
kms/page-flip: Make tha data struct use gatomicref instead of int
While there are no threads that makes this necessary, lets change this now so we don't forget later. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
parent
d2ccc824ce
commit
6d6fd9c43d
@ -33,7 +33,7 @@ typedef struct _MetaKmsPageFlipClosure
|
|||||||
|
|
||||||
struct _MetaKmsPageFlipData
|
struct _MetaKmsPageFlipData
|
||||||
{
|
{
|
||||||
int ref_count;
|
gatomicrefcount ref_count;
|
||||||
|
|
||||||
MetaKmsImplDevice *impl_device;
|
MetaKmsImplDevice *impl_device;
|
||||||
MetaKmsCrtc *crtc;
|
MetaKmsCrtc *crtc;
|
||||||
@ -78,10 +78,10 @@ meta_kms_page_flip_data_new (MetaKmsImplDevice *impl_device,
|
|||||||
|
|
||||||
page_flip_data = g_new0 (MetaKmsPageFlipData , 1);
|
page_flip_data = g_new0 (MetaKmsPageFlipData , 1);
|
||||||
*page_flip_data = (MetaKmsPageFlipData) {
|
*page_flip_data = (MetaKmsPageFlipData) {
|
||||||
.ref_count = 1,
|
|
||||||
.impl_device = impl_device,
|
.impl_device = impl_device,
|
||||||
.crtc = crtc,
|
.crtc = crtc,
|
||||||
};
|
};
|
||||||
|
g_atomic_ref_count_init (&page_flip_data->ref_count);
|
||||||
|
|
||||||
return page_flip_data;
|
return page_flip_data;
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ meta_kms_page_flip_data_new (MetaKmsImplDevice *impl_device,
|
|||||||
MetaKmsPageFlipData *
|
MetaKmsPageFlipData *
|
||||||
meta_kms_page_flip_data_ref (MetaKmsPageFlipData *page_flip_data)
|
meta_kms_page_flip_data_ref (MetaKmsPageFlipData *page_flip_data)
|
||||||
{
|
{
|
||||||
page_flip_data->ref_count++;
|
g_atomic_ref_count_inc (&page_flip_data->ref_count);
|
||||||
|
|
||||||
return page_flip_data;
|
return page_flip_data;
|
||||||
}
|
}
|
||||||
@ -97,9 +97,7 @@ meta_kms_page_flip_data_ref (MetaKmsPageFlipData *page_flip_data)
|
|||||||
void
|
void
|
||||||
meta_kms_page_flip_data_unref (MetaKmsPageFlipData *page_flip_data)
|
meta_kms_page_flip_data_unref (MetaKmsPageFlipData *page_flip_data)
|
||||||
{
|
{
|
||||||
page_flip_data->ref_count--;
|
if (g_atomic_ref_count_dec (&page_flip_data->ref_count))
|
||||||
|
|
||||||
if (page_flip_data->ref_count == 0)
|
|
||||||
{
|
{
|
||||||
g_list_free_full (page_flip_data->closures,
|
g_list_free_full (page_flip_data->closures,
|
||||||
(GDestroyNotify) meta_kms_page_flip_closure_free);
|
(GDestroyNotify) meta_kms_page_flip_closure_free);
|
||||||
|
Loading…
Reference in New Issue
Block a user