From 150a9e35ad2fcd2676a75d4f4b7d306edc3e0b17 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 22 Aug 2023 22:43:37 -0700 Subject: [PATCH] clutter: Add va_marshallers for stage signals Adds va_marshallers to the ClutterStage signals. This allows for better stack traces to be retrieved when profiling. Additionally, since the generic marshaller was using GBoxedCopy/GBoxedFree functions for the GValue usage, the previous code was acquiring a global reader/writer lock in GObject via g_boxed_free() usage. With G_SIGNAL_TYPE_STATIC_SCOPE, the generated marshallers can avoid the additional copy/free on the instance. Part-of: --- clutter/clutter/clutter-marshal.list | 2 + clutter/clutter/clutter-stage.c | 60 +++++++++++++++++++++------- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/clutter/clutter/clutter-marshal.list b/clutter/clutter/clutter-marshal.list index cb64b2dfa..8fa9ccf91 100644 --- a/clutter/clutter/clutter-marshal.list +++ b/clutter/clutter/clutter-marshal.list @@ -18,6 +18,8 @@ VOID:INT,INT VOID:INT,POINTER VOID:FLOAT,FLOAT VOID:INT,INT,INT,INT +VOID:OBJECT,BOXED +VOID:OBJECT,BOXED,BOXED VOID:OBJECT,FLAGS VOID:OBJECT,FLAGS,BOOLEAN VOID:OBJECT,FLAGS,UINT diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index c50baac25..107db148b 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -23,7 +23,7 @@ /** * ClutterStage: - * + * * Top level visual element to which actors are placed. * * #ClutterStage is a top level 'window' on which child actors are placed @@ -1471,10 +1471,15 @@ clutter_stage_class_init (ClutterStageClass *klass) G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, 0, - NULL, NULL, NULL, + NULL, NULL, + _clutter_marshal_VOID__OBJECT_BOXED, G_TYPE_NONE, 2, CLUTTER_TYPE_STAGE_VIEW, - CLUTTER_TYPE_FRAME); + CLUTTER_TYPE_FRAME | G_SIGNAL_TYPE_STATIC_SCOPE); + g_signal_set_va_marshaller (stage_signals[BEFORE_UPDATE], + G_TYPE_FROM_CLASS (gobject_class), + _clutter_marshal_VOID__OBJECT_BOXEDv); + /** * ClutterStage::prepare-frame: * @stage: the stage that received the event @@ -1489,10 +1494,14 @@ clutter_stage_class_init (ClutterStageClass *klass) G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, 0, - NULL, NULL, NULL, + NULL, NULL, + _clutter_marshal_VOID__OBJECT_BOXED, G_TYPE_NONE, 2, CLUTTER_TYPE_STAGE_VIEW, - CLUTTER_TYPE_FRAME); + CLUTTER_TYPE_FRAME | G_SIGNAL_TYPE_STATIC_SCOPE); + g_signal_set_va_marshaller (stage_signals[PREPARE_FRAME], + G_TYPE_FROM_CLASS (gobject_class), + _clutter_marshal_VOID__OBJECT_BOXEDv); /** * ClutterStage::before-paint: @@ -1507,10 +1516,15 @@ clutter_stage_class_init (ClutterStageClass *klass) G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ClutterStageClass, before_paint), - NULL, NULL, NULL, + NULL, NULL, + _clutter_marshal_VOID__OBJECT_BOXED, G_TYPE_NONE, 2, CLUTTER_TYPE_STAGE_VIEW, - CLUTTER_TYPE_FRAME); + CLUTTER_TYPE_FRAME | G_SIGNAL_TYPE_STATIC_SCOPE); + g_signal_set_va_marshaller (stage_signals[BEFORE_PAINT], + G_TYPE_FROM_CLASS (gobject_class), + _clutter_marshal_VOID__OBJECT_BOXEDv); + /** * ClutterStage::after-paint: * @stage: the stage that received the event @@ -1525,10 +1539,14 @@ clutter_stage_class_init (ClutterStageClass *klass) G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, 0, /* no corresponding vfunc */ - NULL, NULL, NULL, + NULL, NULL, + _clutter_marshal_VOID__OBJECT_BOXED, G_TYPE_NONE, 2, CLUTTER_TYPE_STAGE_VIEW, - CLUTTER_TYPE_FRAME); + CLUTTER_TYPE_FRAME | G_SIGNAL_TYPE_STATIC_SCOPE); + g_signal_set_va_marshaller (stage_signals[AFTER_PAINT], + G_TYPE_FROM_CLASS (gobject_class), + _clutter_marshal_VOID__OBJECT_BOXEDv); /** * ClutterStage::after-update: @@ -1541,10 +1559,14 @@ clutter_stage_class_init (ClutterStageClass *klass) G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, 0, - NULL, NULL, NULL, + NULL, NULL, + _clutter_marshal_VOID__OBJECT_BOXED, G_TYPE_NONE, 2, CLUTTER_TYPE_STAGE_VIEW, - CLUTTER_TYPE_FRAME); + CLUTTER_TYPE_FRAME | G_SIGNAL_TYPE_STATIC_SCOPE); + g_signal_set_va_marshaller (stage_signals[AFTER_UPDATE], + G_TYPE_FROM_CLASS (gobject_class), + _clutter_marshal_VOID__OBJECT_BOXEDv); /** * ClutterStage::paint-view: @@ -1565,11 +1587,15 @@ clutter_stage_class_init (ClutterStageClass *klass) G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (ClutterStageClass, paint_view), - NULL, NULL, NULL, + NULL, NULL, + _clutter_marshal_VOID__OBJECT_BOXED_BOXED, G_TYPE_NONE, 3, CLUTTER_TYPE_STAGE_VIEW, - CAIRO_GOBJECT_TYPE_REGION, - CLUTTER_TYPE_FRAME); + CAIRO_GOBJECT_TYPE_REGION | G_SIGNAL_TYPE_STATIC_SCOPE, + CLUTTER_TYPE_FRAME | G_SIGNAL_TYPE_STATIC_SCOPE); + g_signal_set_va_marshaller (stage_signals[PAINT_VIEW], + G_TYPE_FROM_CLASS (gobject_class), + _clutter_marshal_VOID__OBJECT_BOXED_BOXEDv); /** * ClutterStage::presented: (skip) @@ -1584,10 +1610,14 @@ clutter_stage_class_init (ClutterStageClass *klass) G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, 0, - NULL, NULL, NULL, + NULL, NULL, + _clutter_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2, CLUTTER_TYPE_STAGE_VIEW, G_TYPE_POINTER); + g_signal_set_va_marshaller (stage_signals[PRESENTED], + G_TYPE_FROM_CLASS (gobject_class), + _clutter_marshal_VOID__OBJECT_POINTERv); /** * ClutterStage::gl-video-memory-purged: (skip)