[mutter] kms: Return gpointer from impl tasks
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] kms: Return gpointer from impl tasks
- Date: Tue, 11 Feb 2020 17:43:58 +0000 (UTC)
commit ec9d7145c87efd4437a547558e379f8bdaafe1f0
Author: Jonas Ådahl <jadahl gmail com>
Date: Fri Nov 8 23:47:48 2019 +0100
kms: Return gpointer from impl tasks
Currently only used to return either TRUE or FALSE to communicate
success or failure. Will be used to return feedback objects.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/930
src/backends/native/meta-kms-device.c | 18 ++++++++-------
src/backends/native/meta-kms-impl-device.c | 6 +++--
src/backends/native/meta-kms-private.h | 4 ++--
src/backends/native/meta-kms.c | 36 +++++++++++++++++-------------
4 files changed, 37 insertions(+), 27 deletions(-)
---
diff --git a/src/backends/native/meta-kms-device.c b/src/backends/native/meta-kms-device.c
index 376ac5a91..0d445a2c8 100644
--- a/src/backends/native/meta-kms-device.c
+++ b/src/backends/native/meta-kms-device.c
@@ -155,24 +155,26 @@ meta_kms_device_predict_states_in_impl (MetaKmsDevice *device,
meta_kms_impl_device_predict_states (impl_device, update);
}
-static gboolean
+static gpointer
dispatch_in_impl (MetaKmsImpl *impl,
gpointer user_data,
GError **error)
{
MetaKmsImplDevice *impl_device = META_KMS_IMPL_DEVICE (user_data);
+ gboolean ret;
- return meta_kms_impl_device_dispatch (impl_device, error);
+ ret = meta_kms_impl_device_dispatch (impl_device, error);
+ return GINT_TO_POINTER (ret);
}
-static gboolean
+static gpointer
dispatch_idle_in_impl (MetaKmsImpl *impl,
gpointer user_data,
GError **error)
{
meta_kms_impl_dispatch_idle (impl);
- return TRUE;
+ return GINT_TO_POINTER (TRUE);
}
int
@@ -211,7 +213,7 @@ typedef struct _CreateImplDeviceData
GList *out_planes;
} CreateImplDeviceData;
-static gboolean
+static gpointer
create_impl_device_in_impl (MetaKmsImpl *impl,
gpointer user_data,
GError **error)
@@ -228,7 +230,7 @@ create_impl_device_in_impl (MetaKmsImpl *impl,
data->out_connectors = meta_kms_impl_device_copy_connectors (impl_device);
data->out_planes = meta_kms_impl_device_copy_planes (impl_device);
- return TRUE;
+ return GINT_TO_POINTER (TRUE);
}
MetaKmsDevice *
@@ -280,7 +282,7 @@ typedef struct _FreeImplDeviceData
int out_fd;
} FreeImplDeviceData;
-static gboolean
+static gpointer
free_impl_device_in_impl (MetaKmsImpl *impl,
gpointer user_data,
GError **error)
@@ -294,7 +296,7 @@ free_impl_device_in_impl (MetaKmsImpl *impl,
data->out_fd = fd;
- return TRUE;
+ return GINT_TO_POINTER (TRUE);
}
static void
diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c
index 92b7bd37b..cf5aee9d3 100644
--- a/src/backends/native/meta-kms-impl-device.c
+++ b/src/backends/native/meta-kms-impl-device.c
@@ -137,14 +137,16 @@ meta_kms_impl_device_dispatch (MetaKmsImplDevice *impl_device,
return TRUE;
}
-static gboolean
+static gpointer
kms_event_dispatch_in_impl (MetaKmsImpl *impl,
gpointer user_data,
GError **error)
{
MetaKmsImplDevice *impl_device = user_data;
+ gboolean ret;
- return meta_kms_impl_device_dispatch (impl_device, error);
+ ret = meta_kms_impl_device_dispatch (impl_device, error);
+ return GINT_TO_POINTER (ret);
}
drmModePropertyPtr
diff --git a/src/backends/native/meta-kms-private.h b/src/backends/native/meta-kms-private.h
index 4b6aaee7e..65d441b2b 100644
--- a/src/backends/native/meta-kms-private.h
+++ b/src/backends/native/meta-kms-private.h
@@ -27,7 +27,7 @@
typedef void (* MetaKmsCallback) (MetaKms *kms,
gpointer user_data);
-typedef gboolean (* MetaKmsImplTaskFunc) (MetaKmsImpl *impl,
+typedef gpointer (* MetaKmsImplTaskFunc) (MetaKmsImpl *impl,
gpointer user_data,
GError **error);
@@ -38,7 +38,7 @@ void meta_kms_queue_callback (MetaKms *kms,
int meta_kms_flush_callbacks (MetaKms *kms);
-gboolean meta_kms_run_impl_task_sync (MetaKms *kms,
+gpointer meta_kms_run_impl_task_sync (MetaKms *kms,
MetaKmsImplTaskFunc func,
gpointer user_data,
GError **error);
diff --git a/src/backends/native/meta-kms.c b/src/backends/native/meta-kms.c
index 9453eaaa9..9c09a9504 100644
--- a/src/backends/native/meta-kms.c
+++ b/src/backends/native/meta-kms.c
@@ -201,7 +201,7 @@ meta_kms_predict_states_in_impl (MetaKms *kms,
update);
}
-static gboolean
+static gpointer
meta_kms_update_process_in_impl (MetaKmsImpl *impl,
gpointer user_data,
GError **error)
@@ -213,7 +213,7 @@ meta_kms_update_process_in_impl (MetaKmsImpl *impl,
meta_kms_predict_states_in_impl (meta_kms_impl_get_kms (impl), update);
- return ret;
+ return GINT_TO_POINTER (ret);
}
static gboolean
@@ -221,15 +221,18 @@ meta_kms_post_update_sync (MetaKms *kms,
MetaKmsUpdate *update,
GError **error)
{
+ gpointer ret;
+
meta_kms_update_seal (update);
COGL_TRACE_BEGIN_SCOPED (MetaKmsPostUpdateSync,
"KMS (post update)");
- return meta_kms_run_impl_task_sync (kms,
- meta_kms_update_process_in_impl,
- update,
- error);
+ ret = meta_kms_run_impl_task_sync (kms,
+ meta_kms_update_process_in_impl,
+ update,
+ error);
+ return GPOINTER_TO_INT (ret);
}
gboolean
@@ -241,13 +244,13 @@ meta_kms_post_pending_update_sync (MetaKms *kms,
error);
}
-static gboolean
+static gpointer
meta_kms_discard_pending_page_flips_in_impl (MetaKmsImpl *impl,
gpointer user_data,
GError **error)
{
meta_kms_impl_discard_pending_page_flips (impl);
- return TRUE;
+ return GINT_TO_POINTER (TRUE);
}
void
@@ -330,13 +333,13 @@ meta_kms_flush_callbacks (MetaKms *kms)
return callback_count;
}
-gboolean
+gpointer
meta_kms_run_impl_task_sync (MetaKms *kms,
MetaKmsImplTaskFunc func,
gpointer user_data,
GError **error)
{
- gboolean ret;
+ gpointer ret;
kms->in_impl_task = TRUE;
kms->waiting_for_impl_task = TRUE;
@@ -405,7 +408,7 @@ meta_kms_fd_impl_source_dispatch (GSource *source,
{
MetaKmsFdImplSource *fd_impl_source = (MetaKmsFdImplSource *) source;
MetaKms *kms = fd_impl_source->kms;
- gboolean ret;
+ gpointer ret;
GError *error = NULL;
kms->in_impl_task = TRUE;
@@ -414,7 +417,7 @@ meta_kms_fd_impl_source_dispatch (GSource *source,
&error);
kms->in_impl_task = FALSE;
- if (!ret)
+ if (!GPOINTER_TO_INT (ret))
{
g_warning ("Failed to dispatch fd source: %s", error->message);
g_error_free (error);
@@ -478,7 +481,7 @@ meta_kms_update_states_in_impl (MetaKms *kms)
NULL);
}
-static gboolean
+static gpointer
update_states_in_impl (MetaKmsImpl *impl,
gpointer user_data,
GError **error)
@@ -487,14 +490,17 @@ update_states_in_impl (MetaKmsImpl *impl,
meta_kms_update_states_in_impl (kms);
- return TRUE;
+ return GINT_TO_POINTER (TRUE);
}
static gboolean
meta_kms_update_states_sync (MetaKms *kms,
GError **error)
{
- return meta_kms_run_impl_task_sync (kms, update_states_in_impl, NULL, error);
+ gpointer ret;
+
+ ret = meta_kms_run_impl_task_sync (kms, update_states_in_impl, NULL, error);
+ return GPOINTER_TO_INT (ret);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]