mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 04:42:14 +00:00
kms/update: Add destroy-notify to result listener user data
No thread guarantees, users need to handle it themselves. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2777>
This commit is contained in:
parent
27ed069766
commit
3b2f95cb1f
@ -367,7 +367,8 @@ assign_cursor_plane (MetaCursorRendererNative *native,
|
||||
meta_kms_update_add_result_listener (kms_update,
|
||||
&kms_update_listener_vtable,
|
||||
NULL,
|
||||
native);
|
||||
native,
|
||||
NULL);
|
||||
|
||||
crtc_cursor_data->buffer = buffer;
|
||||
|
||||
|
@ -131,6 +131,7 @@ struct _MetaKmsResultListener
|
||||
GMainContext *main_context;
|
||||
const MetaKmsResultListenerVtable *vtable;
|
||||
gpointer user_data;
|
||||
GDestroyNotify destroy_notify;
|
||||
|
||||
MetaKmsFeedback *feedback;
|
||||
};
|
||||
|
@ -624,7 +624,8 @@ void
|
||||
meta_kms_update_add_result_listener (MetaKmsUpdate *update,
|
||||
const MetaKmsResultListenerVtable *vtable,
|
||||
GMainContext *main_context,
|
||||
gpointer user_data)
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_notify)
|
||||
{
|
||||
MetaKmsResultListener *listener;
|
||||
|
||||
@ -633,6 +634,7 @@ meta_kms_update_add_result_listener (MetaKmsUpdate *update,
|
||||
.main_context = main_context,
|
||||
.vtable = vtable,
|
||||
.user_data = user_data,
|
||||
.destroy_notify = destroy_notify,
|
||||
};
|
||||
|
||||
update->result_listeners = g_list_append (update->result_listeners,
|
||||
@ -672,6 +674,8 @@ meta_kms_result_listener_notify (MetaKmsResultListener *listener)
|
||||
void
|
||||
meta_kms_result_listener_free (MetaKmsResultListener *listener)
|
||||
{
|
||||
if (listener->destroy_notify)
|
||||
listener->destroy_notify (listener->user_data);
|
||||
g_clear_pointer (&listener->feedback, meta_kms_feedback_unref);
|
||||
g_free (listener);
|
||||
}
|
||||
|
@ -197,7 +197,8 @@ META_EXPORT_TEST
|
||||
void meta_kms_update_add_result_listener (MetaKmsUpdate *update,
|
||||
const MetaKmsResultListenerVtable *vtable,
|
||||
GMainContext *main_context,
|
||||
gpointer user_data);
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_notify);
|
||||
|
||||
META_EXPORT_TEST
|
||||
void meta_kms_update_merge_from (MetaKmsUpdate *update,
|
||||
|
@ -1170,7 +1170,8 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
|
||||
meta_kms_update_add_result_listener (kms_update,
|
||||
&swap_buffer_result_listener_vtable,
|
||||
NULL,
|
||||
onscreen_native);
|
||||
onscreen_native,
|
||||
NULL);
|
||||
|
||||
ensure_crtc_modes (onscreen, kms_update);
|
||||
meta_onscreen_native_flip_crtc (onscreen,
|
||||
@ -1391,7 +1392,8 @@ meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
|
||||
meta_kms_update_add_result_listener (kms_update,
|
||||
&scanout_result_listener_vtable,
|
||||
NULL,
|
||||
onscreen_native);
|
||||
onscreen_native,
|
||||
NULL);
|
||||
|
||||
meta_onscreen_native_flip_crtc (onscreen,
|
||||
onscreen_native->view,
|
||||
@ -1570,7 +1572,8 @@ meta_onscreen_native_finish_frame (CoglOnscreen *onscreen,
|
||||
meta_kms_update_add_result_listener (kms_update,
|
||||
&finish_frame_result_listener_vtable,
|
||||
NULL,
|
||||
onscreen_native);
|
||||
onscreen_native,
|
||||
NULL);
|
||||
|
||||
meta_kms_update_add_page_flip_listener (kms_update,
|
||||
kms_crtc,
|
||||
|
@ -876,6 +876,7 @@ post_mode_set_updates (MetaRendererNative *renderer_native)
|
||||
meta_kms_update_add_result_listener (kms_update,
|
||||
&mode_sets_result_listener_vtable,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
feedback =
|
||||
|
@ -382,7 +382,8 @@ on_scanout_fallback_before_paint (ClutterStage *stage,
|
||||
meta_kms_update_add_result_listener (kms_update,
|
||||
&scanout_fallback_result_listener_vtable,
|
||||
NULL,
|
||||
test);
|
||||
test,
|
||||
NULL);
|
||||
|
||||
test->scanout_fallback.scanout_failed_view = stage_view;
|
||||
}
|
||||
|
@ -830,11 +830,13 @@ meta_test_kms_update_feedback (void)
|
||||
meta_kms_update_add_result_listener (update,
|
||||
&main_thread_result_listener_vtable,
|
||||
NULL,
|
||||
&data);
|
||||
&data,
|
||||
NULL);
|
||||
meta_kms_update_add_result_listener (update,
|
||||
&callback_thread_result_listener_vtable,
|
||||
data.thread_main_context,
|
||||
&data);
|
||||
&data,
|
||||
NULL);
|
||||
|
||||
meta_kms_device_post_update (device, update,
|
||||
META_KMS_UPDATE_FLAG_NONE);
|
||||
|
Loading…
Reference in New Issue
Block a user