kms/impl: Dont discard page flips in callback when failed up front

If posting an update resulted in an immediate error, don't communicate
this failure using the page flip feedback callbacks, but directly as a
return value.

This makes it possible for the direct client buffer scanout path not to
pass around flags triggering this behavior, meaning we can handle such
direct scanouts better.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
Jonas Ådahl 2020-10-02 10:11:39 +02:00 committed by Marge Bot
parent 2df6327367
commit a2b8668544
5 changed files with 7 additions and 50 deletions

View File

@ -814,23 +814,6 @@ process_page_flip (MetaKmsImplDevice *impl_device,
return TRUE;
}
static void
discard_page_flip (MetaKmsImplDevice *impl_device,
MetaKmsUpdate *update,
MetaKmsPageFlip *page_flip)
{
MetaKmsCrtc *crtc;
MetaKmsPageFlipData *page_flip_data;
crtc = page_flip->crtc;
page_flip_data = meta_kms_page_flip_data_new (impl_device,
crtc,
page_flip->feedback,
page_flip->user_data);
meta_kms_page_flip_data_discard_in_impl (page_flip_data, NULL);
meta_kms_page_flip_data_unref (page_flip_data);
}
static gboolean
process_entries (MetaKmsImplDevice *impl_device,
MetaKmsUpdate *update,
@ -1029,7 +1012,6 @@ meta_kms_impl_device_simple_process_update (MetaKmsImplDevice *impl_device,
{
GError *error = NULL;
GList *failed_planes;
GList *l;
if (!process_entries (impl_device,
update,
@ -1073,16 +1055,6 @@ err_planes_not_assigned:
failed_planes = generate_all_failed_feedbacks (update);
err_planes_assigned:
for (l = meta_kms_update_get_page_flips (update); l; l = l->next)
{
MetaKmsPageFlip *page_flip = l->data;
if (page_flip->flags & META_KMS_PAGE_FLIP_FLAG_NO_DISCARD_FEEDBACK)
continue;
discard_page_flip (impl_device, update, page_flip);
}
return meta_kms_feedback_new_failed (failed_planes, error);
}

View File

@ -90,7 +90,6 @@ typedef struct _MetaKmsPageFlip
{
MetaKmsCrtc *crtc;
const MetaKmsPageFlipFeedback *feedback;
MetaKmsPageFlipFlag flags;
gpointer user_data;
} MetaKmsPageFlip;

View File

@ -325,7 +325,6 @@ void
meta_kms_update_page_flip (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
const MetaKmsPageFlipFeedback *feedback,
MetaKmsPageFlipFlag flags,
gpointer user_data)
{
MetaKmsPageFlip *page_flip;
@ -337,7 +336,6 @@ meta_kms_update_page_flip (MetaKmsUpdate *update,
*page_flip = (MetaKmsPageFlip) {
.crtc = crtc,
.feedback = feedback,
.flags = flags,
.user_data = user_data,
};

View File

@ -42,12 +42,6 @@ typedef enum _MetaKmsAssignPlaneFlag
META_KMS_ASSIGN_PLANE_FLAG_FB_UNCHANGED = 1 << 0,
} MetaKmsAssignPlaneFlag;
typedef enum _MetaKmsPageFlipFlag
{
META_KMS_PAGE_FLIP_FLAG_NONE = 0,
META_KMS_PAGE_FLIP_FLAG_NO_DISCARD_FEEDBACK = 1 << 0,
} MetaKmsPageFlipFlag;
struct _MetaKmsPageFlipFeedback
{
void (* flipped) (MetaKmsCrtc *crtc,
@ -125,7 +119,6 @@ MetaKmsPlaneAssignment * meta_kms_update_unassign_plane (MetaKmsUpdate *update,
void meta_kms_update_page_flip (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
const MetaKmsPageFlipFeedback *feedback,
MetaKmsPageFlipFlag flags,
gpointer user_data);
void meta_kms_update_set_custom_page_flip (MetaKmsUpdate *update,

View File

@ -1250,10 +1250,9 @@ queue_dummy_power_save_page_flip (CoglOnscreen *onscreen)
}
static void
meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
MetaRendererView *view,
MetaCrtc *crtc,
MetaKmsPageFlipFlag flags)
meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
MetaRendererView *view,
MetaCrtc *crtc)
{
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
@ -1305,7 +1304,6 @@ meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
meta_kms_update_page_flip (kms_update,
meta_crtc_kms_get_kms_crtc (crtc_kms),
&page_flip_feedback,
flags,
g_object_ref (view));
}
@ -1348,8 +1346,7 @@ meta_onscreen_native_set_crtc_mode (CoglOnscreen *onscreen,
}
static void
meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen,
MetaKmsPageFlipFlag flags)
meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen)
{
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
@ -1358,8 +1355,7 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen,
COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeFlipCrtcs,
"Onscreen (flip CRTCs)");
meta_onscreen_native_flip_crtc (onscreen, view, onscreen_native->crtc,
flags);
meta_onscreen_native_flip_crtc (onscreen, view, onscreen_native->crtc);
}
static gboolean
@ -1988,7 +1984,7 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
if (power_save_mode == META_POWER_SAVE_ON)
{
ensure_crtc_modes (onscreen);
meta_onscreen_native_flip_crtcs (onscreen, META_KMS_PAGE_FLIP_FLAG_NONE);
meta_onscreen_native_flip_crtcs (onscreen);
}
else
{
@ -2192,8 +2188,7 @@ meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
g_set_object (&onscreen_native->gbm.next_fb, META_DRM_BUFFER (scanout));
ensure_crtc_modes (onscreen);
meta_onscreen_native_flip_crtcs (onscreen,
META_KMS_PAGE_FLIP_FLAG_NO_DISCARD_FEEDBACK);
meta_onscreen_native_flip_crtcs (onscreen);
kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (onscreen_native->crtc));
kms_device = meta_kms_crtc_get_device (kms_crtc);