onscreen/native: Pass damage rectangles when page flipping

This commit passes damage rectangles metadata to the (KMS) primary
plane.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1879>
This commit is contained in:
Piotr Lopatka 2021-09-03 20:01:59 +01:00
parent af0460d0ce
commit b328c8cc8b
3 changed files with 24 additions and 8 deletions

View File

@ -115,7 +115,7 @@ meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms,
hw_transform); hw_transform);
} }
void MetaKmsPlaneAssignment *
meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms, meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms,
MetaDrmBuffer *buffer, MetaDrmBuffer *buffer,
MetaKmsUpdate *kms_update) MetaKmsUpdate *kms_update)
@ -161,6 +161,8 @@ meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms,
dst_rect, dst_rect,
flags); flags);
meta_crtc_kms_apply_transform (crtc_kms, plane_assignment); meta_crtc_kms_apply_transform (crtc_kms, plane_assignment);
return plane_assignment;
} }
static GList * static GList *

View File

@ -48,9 +48,9 @@ void meta_crtc_kms_set_cursor_renderer_private (MetaCrtcKms *crtc_kms,
void meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms, void meta_crtc_kms_apply_transform (MetaCrtcKms *crtc_kms,
MetaKmsPlaneAssignment *kms_plane_assignment); MetaKmsPlaneAssignment *kms_plane_assignment);
void meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms, MetaKmsPlaneAssignment * meta_crtc_kms_assign_primary_plane (MetaCrtcKms *crtc_kms,
MetaDrmBuffer *buffer, MetaDrmBuffer *buffer,
MetaKmsUpdate *kms_update); MetaKmsUpdate *kms_update);
void meta_crtc_kms_set_mode (MetaCrtcKms *crtc_kms, void meta_crtc_kms_set_mode (MetaCrtcKms *crtc_kms,
MetaKmsUpdate *kms_update); MetaKmsUpdate *kms_update);

View File

@ -416,7 +416,9 @@ static void
meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen, meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
MetaRendererView *view, MetaRendererView *view,
MetaCrtc *crtc, MetaCrtc *crtc,
MetaKmsPageFlipListenerFlag flags) MetaKmsPageFlipListenerFlag flags,
const int *rectangles,
int n_rectangles)
{ {
MetaOnscreenNative *onscreen_native = META_ONSCREEN_NATIVE (onscreen); MetaOnscreenNative *onscreen_native = META_ONSCREEN_NATIVE (onscreen);
MetaRendererNative *renderer_native = onscreen_native->renderer_native; MetaRendererNative *renderer_native = onscreen_native->renderer_native;
@ -430,6 +432,7 @@ meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
MetaKmsUpdate *kms_update; MetaKmsUpdate *kms_update;
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state = NULL; MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state = NULL;
MetaDrmBuffer *buffer; MetaDrmBuffer *buffer;
MetaKmsPlaneAssignment *plane_assignment;
COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeFlipCrtcs, COGL_TRACE_BEGIN_SCOPED (MetaOnscreenNativeFlipCrtcs,
"Onscreen (flip CRTCs)"); "Onscreen (flip CRTCs)");
@ -456,8 +459,15 @@ meta_onscreen_native_flip_crtc (CoglOnscreen *onscreen,
buffer = secondary_gpu_state->gbm.next_fb; buffer = secondary_gpu_state->gbm.next_fb;
} }
meta_crtc_kms_assign_primary_plane (crtc_kms, buffer, kms_update); plane_assignment = meta_crtc_kms_assign_primary_plane (crtc_kms,
buffer,
kms_update);
if (rectangles != NULL && n_rectangles != 0)
{
meta_kms_plane_assignment_set_fb_damage (plane_assignment,
rectangles, n_rectangles);
}
break; break;
case META_RENDERER_NATIVE_MODE_SURFACELESS: case META_RENDERER_NATIVE_MODE_SURFACELESS:
g_assert_not_reached (); g_assert_not_reached ();
@ -1081,7 +1091,9 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
meta_onscreen_native_flip_crtc (onscreen, meta_onscreen_native_flip_crtc (onscreen,
onscreen_native->view, onscreen_native->view,
onscreen_native->crtc, onscreen_native->crtc,
META_KMS_PAGE_FLIP_LISTENER_FLAG_NONE); META_KMS_PAGE_FLIP_LISTENER_FLAG_NONE,
rectangles,
n_rectangles);
} }
else else
{ {
@ -1299,7 +1311,9 @@ meta_onscreen_native_direct_scanout (CoglOnscreen *onscreen,
meta_onscreen_native_flip_crtc (onscreen, meta_onscreen_native_flip_crtc (onscreen,
onscreen_native->view, onscreen_native->view,
onscreen_native->crtc, onscreen_native->crtc,
META_KMS_PAGE_FLIP_LISTENER_FLAG_DROP_ON_ERROR); META_KMS_PAGE_FLIP_LISTENER_FLAG_DROP_ON_ERROR,
NULL,
0);
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);