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; 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 static gboolean
process_entries (MetaKmsImplDevice *impl_device, process_entries (MetaKmsImplDevice *impl_device,
MetaKmsUpdate *update, MetaKmsUpdate *update,
@ -1029,7 +1012,6 @@ meta_kms_impl_device_simple_process_update (MetaKmsImplDevice *impl_device,
{ {
GError *error = NULL; GError *error = NULL;
GList *failed_planes; GList *failed_planes;
GList *l;
if (!process_entries (impl_device, if (!process_entries (impl_device,
update, update,
@ -1073,16 +1055,6 @@ err_planes_not_assigned:
failed_planes = generate_all_failed_feedbacks (update); failed_planes = generate_all_failed_feedbacks (update);
err_planes_assigned: 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); return meta_kms_feedback_new_failed (failed_planes, error);
} }

View File

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

View File

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

View File

@ -42,12 +42,6 @@ typedef enum _MetaKmsAssignPlaneFlag
META_KMS_ASSIGN_PLANE_FLAG_FB_UNCHANGED = 1 << 0, META_KMS_ASSIGN_PLANE_FLAG_FB_UNCHANGED = 1 << 0,
} MetaKmsAssignPlaneFlag; } MetaKmsAssignPlaneFlag;
typedef enum _MetaKmsPageFlipFlag
{
META_KMS_PAGE_FLIP_FLAG_NONE = 0,
META_KMS_PAGE_FLIP_FLAG_NO_DISCARD_FEEDBACK = 1 << 0,
} MetaKmsPageFlipFlag;
struct _MetaKmsPageFlipFeedback struct _MetaKmsPageFlipFeedback
{ {
void (* flipped) (MetaKmsCrtc *crtc, void (* flipped) (MetaKmsCrtc *crtc,
@ -125,7 +119,6 @@ MetaKmsPlaneAssignment * meta_kms_update_unassign_plane (MetaKmsUpdate *update,
void meta_kms_update_page_flip (MetaKmsUpdate *update, void meta_kms_update_page_flip (MetaKmsUpdate *update,
MetaKmsCrtc *crtc, MetaKmsCrtc *crtc,
const MetaKmsPageFlipFeedback *feedback, const MetaKmsPageFlipFeedback *feedback,
MetaKmsPageFlipFlag flags,
gpointer user_data); gpointer user_data);
void meta_kms_update_set_custom_page_flip (MetaKmsUpdate *update, 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 static void
meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen, meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
MetaRendererView *view, MetaRendererView *view,
MetaCrtc *crtc, MetaCrtc *crtc)
MetaKmsPageFlipFlag flags)
{ {
CoglOnscreenEGL *onscreen_egl = onscreen->winsys; CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
MetaOnscreenNative *onscreen_native = onscreen_egl->platform; 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_kms_update_page_flip (kms_update,
meta_crtc_kms_get_kms_crtc (crtc_kms), meta_crtc_kms_get_kms_crtc (crtc_kms),
&page_flip_feedback, &page_flip_feedback,
flags,
g_object_ref (view)); g_object_ref (view));
} }
@ -1348,8 +1346,7 @@ meta_onscreen_native_set_crtc_mode (CoglOnscreen *onscreen,
} }
static void static void
meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen, meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen)
MetaKmsPageFlipFlag flags)
{ {
CoglOnscreenEGL *onscreen_egl = onscreen->winsys; CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
MetaOnscreenNative *onscreen_native = onscreen_egl->platform; MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
@ -1358,8 +1355,7 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen,
COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeFlipCrtcs, COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeFlipCrtcs,
"Onscreen (flip CRTCs)"); "Onscreen (flip CRTCs)");
meta_onscreen_native_flip_crtc (onscreen, view, onscreen_native->crtc, meta_onscreen_native_flip_crtc (onscreen, view, onscreen_native->crtc);
flags);
} }
static gboolean static gboolean
@ -1988,7 +1984,7 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
if (power_save_mode == META_POWER_SAVE_ON) if (power_save_mode == META_POWER_SAVE_ON)
{ {
ensure_crtc_modes (onscreen); ensure_crtc_modes (onscreen);
meta_onscreen_native_flip_crtcs (onscreen, META_KMS_PAGE_FLIP_FLAG_NONE); meta_onscreen_native_flip_crtcs (onscreen);
} }
else else
{ {
@ -2192,8 +2188,7 @@ meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
g_set_object (&onscreen_native->gbm.next_fb, META_DRM_BUFFER (scanout)); g_set_object (&onscreen_native->gbm.next_fb, META_DRM_BUFFER (scanout));
ensure_crtc_modes (onscreen); ensure_crtc_modes (onscreen);
meta_onscreen_native_flip_crtcs (onscreen, meta_onscreen_native_flip_crtcs (onscreen);
META_KMS_PAGE_FLIP_FLAG_NO_DISCARD_FEEDBACK);
kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (onscreen_native->crtc)); kms_crtc = meta_crtc_kms_get_kms_crtc (META_CRTC_KMS (onscreen_native->crtc));
kms_device = meta_kms_crtc_get_device (kms_crtc); kms_device = meta_kms_crtc_get_device (kms_crtc);