kms/update: Make custom page flip be per update

Custom page flips are meant to allow using e.g. EGLStream API to
indirectly trigger page flip queueing, when the KMS API cannot be used
directly. This is really something that is specific to a device, so
instead of making part of the page flip API, make it a configuration of
the update itself.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
Jonas Ådahl 2020-10-01 18:28:13 +02:00 committed by Marge Bot
parent 94ab6d8736
commit 5ba2d79076
5 changed files with 39 additions and 41 deletions

View File

@ -716,6 +716,7 @@ process_page_flip (MetaKmsImplDevice *impl_device,
MetaKmsPlaneAssignment *plane_assignment;
MetaKmsPageFlipData *page_flip_data;
MetaKmsCustomPageFlipFunc custom_page_flip_func;
gpointer custom_page_flip_user_data;
int fd;
int ret;
@ -729,10 +730,12 @@ process_page_flip (MetaKmsImplDevice *impl_device,
page_flip->user_data);
fd = meta_kms_impl_device_get_fd (impl_device);
custom_page_flip_func = page_flip->custom_page_flip_func;
meta_kms_update_get_custom_page_flip_func (update,
&custom_page_flip_func,
&custom_page_flip_user_data);
if (custom_page_flip_func)
{
ret = custom_page_flip_func (page_flip->custom_page_flip_user_data,
ret = custom_page_flip_func (custom_page_flip_user_data,
meta_kms_page_flip_data_ref (page_flip_data));
}
else
@ -773,7 +776,7 @@ process_page_flip (MetaKmsImplDevice *impl_device,
refresh_rate,
page_flip_data,
custom_page_flip_func,
page_flip->custom_page_flip_user_data);
custom_page_flip_user_data);
}
else
{

View File

@ -92,8 +92,6 @@ typedef struct _MetaKmsPageFlip
const MetaKmsPageFlipFeedback *feedback;
MetaKmsPageFlipFlag flags;
gpointer user_data;
MetaKmsCustomPageFlipFunc custom_page_flip_func;
gpointer custom_page_flip_user_data;
} MetaKmsPageFlip;
void meta_kms_plane_feedback_free (MetaKmsPlaneFeedback *plane_feedback);
@ -129,6 +127,10 @@ GList * meta_kms_update_get_connector_updates (MetaKmsUpdate *update);
GList * meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update);
void meta_kms_update_get_custom_page_flip_func (MetaKmsUpdate *update,
MetaKmsCustomPageFlipFunc *custom_page_flip_func,
gpointer *custom_page_flip_user_data);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaKmsPlaneFeedback,
meta_kms_plane_feedback_free)

View File

@ -40,6 +40,9 @@ struct _MetaKmsUpdate
GList *page_flips;
GList *connector_updates;
GList *crtc_gammas;
MetaKmsCustomPageFlipFunc custom_page_flip_func;
gpointer custom_page_flip_user_data;
};
void
@ -342,28 +345,14 @@ meta_kms_update_page_flip (MetaKmsUpdate *update,
}
void
meta_kms_update_custom_page_flip (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
const MetaKmsPageFlipFeedback *feedback,
gpointer user_data,
MetaKmsCustomPageFlipFunc custom_page_flip_func,
gpointer custom_page_flip_user_data)
meta_kms_update_set_custom_page_flip (MetaKmsUpdate *update,
MetaKmsCustomPageFlipFunc func,
gpointer user_data)
{
MetaKmsPageFlip *page_flip;
g_assert (!meta_kms_update_is_sealed (update));
g_assert (meta_kms_crtc_get_device (crtc) == update->device);
page_flip = g_new0 (MetaKmsPageFlip, 1);
*page_flip = (MetaKmsPageFlip) {
.crtc = crtc,
.feedback = feedback,
.user_data = user_data,
.custom_page_flip_func = custom_page_flip_func,
.custom_page_flip_user_data = custom_page_flip_user_data,
};
update->page_flips = g_list_prepend (update->page_flips, page_flip);
update->custom_page_flip_func = func;
update->custom_page_flip_user_data = user_data;
}
void
@ -451,6 +440,15 @@ meta_kms_update_get_device (MetaKmsUpdate *update)
return update->device;
}
void
meta_kms_update_get_custom_page_flip_func (MetaKmsUpdate *update,
MetaKmsCustomPageFlipFunc *custom_page_flip_func,
gpointer *custom_page_flip_user_data)
{
*custom_page_flip_func = update->custom_page_flip_func;
*custom_page_flip_user_data = update->custom_page_flip_user_data;
}
MetaKmsUpdate *
meta_kms_update_new (MetaKmsDevice *device)
{

View File

@ -128,12 +128,9 @@ void meta_kms_update_page_flip (MetaKmsUpdate *update,
MetaKmsPageFlipFlag flags,
gpointer user_data);
void meta_kms_update_custom_page_flip (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
const MetaKmsPageFlipFeedback *feedback,
gpointer user_data,
MetaKmsCustomPageFlipFunc custom_page_flip_func,
gpointer custom_page_flip_user_data);
void meta_kms_update_set_custom_page_flip (MetaKmsUpdate *update,
MetaKmsCustomPageFlipFunc func,
gpointer user_data);
void meta_kms_plane_assignment_set_cursor_hotspot (MetaKmsPlaneAssignment *plane_assignment,
int x,

View File

@ -1291,24 +1291,22 @@ meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
}
meta_crtc_kms_assign_primary_plane (crtc_kms, buffer, kms_update);
meta_kms_update_page_flip (kms_update,
meta_crtc_kms_get_kms_crtc (crtc_kms),
&page_flip_feedback,
flags,
g_object_ref (view));
break;
#ifdef HAVE_EGL_DEVICE
case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
meta_kms_update_custom_page_flip (kms_update,
meta_crtc_kms_get_kms_crtc (crtc_kms),
&page_flip_feedback,
g_object_ref (view),
meta_kms_update_set_custom_page_flip (kms_update,
custom_egl_stream_page_flip,
onscreen_native);
break;
#endif
}
meta_kms_update_page_flip (kms_update,
meta_crtc_kms_get_kms_crtc (crtc_kms),
&page_flip_feedback,
flags,
g_object_ref (view));
}
static void