kms: Concentrate update processing in MetaKmsDevice
It was a bit scattered, with it being split between MetaKms and MetaKmsImpl, dealing with MetaKmsDevice and MetaKmsImplDevice differentation. Replace this by, for now, single entry point on MetaKmsDevice: meta_kms_device_process_update_sync() that does the right thing. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
This commit is contained in:
parent
43a1ba3432
commit
c35e8f5a51
@ -29,9 +29,6 @@ MetaKmsUpdateChanges meta_kms_device_update_states_in_impl (MetaKmsDevice *devic
|
||||
uint32_t crtc_id,
|
||||
uint32_t connector_id);
|
||||
|
||||
void meta_kms_device_predict_states_in_impl (MetaKmsDevice *device,
|
||||
MetaKmsUpdate *update);
|
||||
|
||||
void meta_kms_device_add_fake_plane_in_impl (MetaKmsDevice *device,
|
||||
MetaKmsPlaneType plane_type,
|
||||
MetaKmsCrtc *crtc);
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "backends/native/meta-kms-impl.h"
|
||||
#include "backends/native/meta-kms-plane.h"
|
||||
#include "backends/native/meta-kms-private.h"
|
||||
#include "backends/native/meta-kms-update-private.h"
|
||||
|
||||
struct _MetaKmsDevice
|
||||
{
|
||||
@ -259,15 +260,39 @@ meta_kms_device_update_states_in_impl (MetaKmsDevice *device,
|
||||
return changes;
|
||||
}
|
||||
|
||||
void
|
||||
meta_kms_device_predict_states_in_impl (MetaKmsDevice *device,
|
||||
MetaKmsUpdate *update)
|
||||
typedef struct
|
||||
{
|
||||
MetaKmsUpdate *update;
|
||||
MetaKmsUpdateFlag flags;
|
||||
} PostUpdateData;
|
||||
|
||||
static gpointer
|
||||
process_update_in_impl (MetaKmsImpl *impl,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
PostUpdateData *data = user_data;
|
||||
MetaKmsUpdate *update = data->update;
|
||||
MetaKmsDevice *device = meta_kms_update_get_device (update);
|
||||
MetaKmsImplDevice *impl_device = meta_kms_device_get_impl_device (device);
|
||||
|
||||
meta_assert_in_kms_impl (device->kms);
|
||||
return meta_kms_impl_device_process_update (impl_device, update, data->flags);
|
||||
}
|
||||
|
||||
meta_kms_impl_device_predict_states (impl_device, update);
|
||||
MetaKmsFeedback *
|
||||
meta_kms_device_process_update_sync (MetaKmsDevice *device,
|
||||
MetaKmsUpdate *update,
|
||||
MetaKmsUpdateFlag flags)
|
||||
{
|
||||
MetaKms *kms = META_KMS (meta_kms_device_get_kms (device));
|
||||
PostUpdateData data;
|
||||
|
||||
data = (PostUpdateData) {
|
||||
.update = update,
|
||||
.flags = flags,
|
||||
};
|
||||
return meta_kms_run_impl_task_sync (kms, process_update_in_impl,
|
||||
&data, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -72,6 +72,10 @@ MetaKmsPlane * meta_kms_device_get_cursor_plane_for (MetaKmsDevice *device,
|
||||
|
||||
GList * meta_kms_device_get_fallback_modes (MetaKmsDevice *device);
|
||||
|
||||
MetaKmsFeedback * meta_kms_device_process_update_sync (MetaKmsDevice *device,
|
||||
MetaKmsUpdate *update,
|
||||
MetaKmsUpdateFlag flags);
|
||||
|
||||
MetaKmsDevice * meta_kms_device_new (MetaKms *kms,
|
||||
const char *path,
|
||||
MetaKmsDeviceFlag flags,
|
||||
|
@ -772,7 +772,7 @@ err:
|
||||
return META_KMS_UPDATE_CHANGE_FULL;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
meta_kms_impl_device_predict_states (MetaKmsImplDevice *impl_device,
|
||||
MetaKmsUpdate *update)
|
||||
{
|
||||
@ -816,6 +816,8 @@ meta_kms_impl_device_process_update (MetaKmsImplDevice *impl_device,
|
||||
|
||||
meta_kms_impl_device_hold_fd (impl_device);
|
||||
feedback = klass->process_update (impl_device, update, flags);
|
||||
if (!(flags & META_KMS_UPDATE_FLAG_TEST_ONLY))
|
||||
meta_kms_impl_device_predict_states (impl_device, update);
|
||||
meta_kms_impl_device_unhold_fd (impl_device);
|
||||
|
||||
return feedback;
|
||||
|
@ -139,9 +139,6 @@ MetaKmsUpdateChanges meta_kms_impl_device_update_states (MetaKmsImplDevice *impl
|
||||
uint32_t crtc_id,
|
||||
uint32_t connector_id);
|
||||
|
||||
void meta_kms_impl_device_predict_states (MetaKmsImplDevice *impl_device,
|
||||
MetaKmsUpdate *update);
|
||||
|
||||
void meta_kms_impl_device_notify_modes_set (MetaKmsImplDevice *impl_device);
|
||||
|
||||
MetaKmsPlane * meta_kms_impl_device_add_fake_plane (MetaKmsImplDevice *impl_device,
|
||||
|
@ -77,23 +77,6 @@ meta_kms_impl_remove_impl_device (MetaKmsImpl *impl,
|
||||
priv->impl_devices = g_list_remove (priv->impl_devices, impl_device);
|
||||
}
|
||||
|
||||
MetaKmsFeedback *
|
||||
meta_kms_impl_process_update (MetaKmsImpl *impl,
|
||||
MetaKmsUpdate *update,
|
||||
MetaKmsUpdateFlag flags)
|
||||
{
|
||||
MetaKmsImplPrivate *priv = meta_kms_impl_get_instance_private (impl);
|
||||
MetaKmsDevice *device;
|
||||
MetaKmsImplDevice *impl_device;
|
||||
|
||||
meta_assert_in_kms_impl (priv->kms);
|
||||
|
||||
device = meta_kms_update_get_device (update);
|
||||
impl_device = meta_kms_device_get_impl_device (device);
|
||||
|
||||
return meta_kms_impl_device_process_update (impl_device, update, flags);
|
||||
}
|
||||
|
||||
void
|
||||
meta_kms_impl_discard_pending_page_flips (MetaKmsImpl *impl)
|
||||
{
|
||||
|
@ -31,10 +31,6 @@ G_DECLARE_FINAL_TYPE (MetaKmsImpl, meta_kms_impl,
|
||||
|
||||
MetaKms * meta_kms_impl_get_kms (MetaKmsImpl *impl);
|
||||
|
||||
MetaKmsFeedback * meta_kms_impl_process_update (MetaKmsImpl *impl,
|
||||
MetaKmsUpdate *update,
|
||||
MetaKmsUpdateFlag flags);
|
||||
|
||||
void meta_kms_impl_add_impl_device (MetaKmsImpl *impl,
|
||||
MetaKmsImplDevice *impl_device);
|
||||
|
||||
|
@ -73,6 +73,13 @@ typedef enum _MetaKmsUpdateChanges
|
||||
META_KMS_UPDATE_CHANGE_FULL = -1,
|
||||
} MetaKmsUpdateChanges;
|
||||
|
||||
typedef enum _MetaKmsUpdateFlag
|
||||
{
|
||||
META_KMS_UPDATE_FLAG_NONE = 0,
|
||||
META_KMS_UPDATE_FLAG_PRESERVE_ON_ERROR = 1 << 0,
|
||||
META_KMS_UPDATE_FLAG_TEST_ONLY = 1 << 1,
|
||||
} MetaKmsUpdateFlag;
|
||||
|
||||
typedef enum _MetaKmsPlaneType MetaKmsPlaneType;
|
||||
|
||||
typedef enum _MetaKmsPropType
|
||||
|
@ -247,40 +247,12 @@ meta_kms_take_pending_update (MetaKms *kms,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MetaKmsUpdate *update;
|
||||
MetaKmsUpdateFlag flags;
|
||||
} PostUpdateData;
|
||||
|
||||
static gpointer
|
||||
meta_kms_process_update_in_impl (MetaKmsImpl *impl,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
PostUpdateData *data = user_data;
|
||||
MetaKmsUpdate *update = data->update;
|
||||
MetaKmsFeedback *feedback;
|
||||
|
||||
feedback = meta_kms_impl_process_update (impl, data->update, data->flags);
|
||||
|
||||
if (!(data->flags & META_KMS_UPDATE_FLAG_TEST_ONLY))
|
||||
{
|
||||
MetaKmsDevice *device = meta_kms_update_get_device (update);
|
||||
|
||||
meta_kms_device_predict_states_in_impl (device, update);
|
||||
}
|
||||
|
||||
return feedback;
|
||||
}
|
||||
|
||||
MetaKmsFeedback *
|
||||
meta_kms_post_pending_update_sync (MetaKms *kms,
|
||||
MetaKmsDevice *device,
|
||||
MetaKmsUpdateFlag flags)
|
||||
{
|
||||
MetaKmsUpdate *update;
|
||||
PostUpdateData data;
|
||||
MetaKmsFeedback *feedback;
|
||||
GList *result_listeners;
|
||||
GList *l;
|
||||
@ -294,14 +266,7 @@ meta_kms_post_pending_update_sync (MetaKms *kms,
|
||||
|
||||
meta_kms_update_lock (update);
|
||||
|
||||
data = (PostUpdateData) {
|
||||
.update = update,
|
||||
.flags = flags,
|
||||
};
|
||||
feedback = meta_kms_run_impl_task_sync (kms,
|
||||
meta_kms_process_update_in_impl,
|
||||
&data,
|
||||
NULL);
|
||||
feedback = meta_kms_device_process_update_sync (device, update, flags);
|
||||
|
||||
result_listeners = meta_kms_update_take_result_listeners (update);
|
||||
|
||||
@ -340,32 +305,21 @@ meta_kms_post_pending_update_sync (MetaKms *kms,
|
||||
return feedback;
|
||||
}
|
||||
|
||||
static gpointer
|
||||
meta_kms_test_update_in_impl (MetaKmsImpl *impl,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
MetaKmsUpdate *update = user_data;
|
||||
MetaKmsUpdateFlag flags;
|
||||
|
||||
flags = META_KMS_UPDATE_FLAG_TEST_ONLY;
|
||||
return meta_kms_impl_process_update (impl, update, flags);
|
||||
}
|
||||
|
||||
MetaKmsFeedback *
|
||||
meta_kms_post_test_update_sync (MetaKms *kms,
|
||||
MetaKmsUpdate *update)
|
||||
{
|
||||
MetaKmsDevice *device = meta_kms_update_get_device (update);
|
||||
MetaKmsUpdateFlag flags;
|
||||
|
||||
g_assert (!meta_kms_update_get_page_flip_listeners (update));
|
||||
g_assert (!meta_kms_update_get_mode_sets (update));
|
||||
g_assert (!meta_kms_update_get_connector_updates (update));
|
||||
|
||||
meta_kms_update_lock (update);
|
||||
|
||||
return meta_kms_run_impl_task_sync (kms,
|
||||
meta_kms_test_update_in_impl,
|
||||
update,
|
||||
NULL);
|
||||
flags = META_KMS_UPDATE_FLAG_TEST_ONLY;
|
||||
return meta_kms_device_process_update_sync (device, update, flags);
|
||||
}
|
||||
|
||||
static gpointer
|
||||
|
@ -31,13 +31,6 @@ typedef enum _MetaKmsFlags
|
||||
META_KMS_FLAG_NO_MODE_SETTING = 1 << 0,
|
||||
} MetaKmsFlags;
|
||||
|
||||
typedef enum _MetaKmsUpdateFlag
|
||||
{
|
||||
META_KMS_UPDATE_FLAG_NONE = 0,
|
||||
META_KMS_UPDATE_FLAG_PRESERVE_ON_ERROR = 1 << 0,
|
||||
META_KMS_UPDATE_FLAG_TEST_ONLY = 1 << 1,
|
||||
} MetaKmsUpdateFlag;
|
||||
|
||||
#define META_TYPE_KMS (meta_kms_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (MetaKms, meta_kms, META, KMS, GObject)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user