From 9dedaddf2dd550ea3b3d87e5f698e5fd4eab2161 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Mon, 28 Jan 2019 14:45:23 -0500 Subject: [PATCH] ecore-drm2: Support multiple gpus during vblank Summary: When we try to calculate a drm vblank type, we should take into account the output's pipe value which is used to determine if we are using multiple gpus (if so, we need to use the high_crtc_mask. Reviewers: ManMower Reviewed By: ManMower Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7803 --- src/lib/ecore_drm2/ecore_drm2_outputs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c index 8cebea513b..293a78eec2 100644 --- a/src/lib/ecore_drm2/ecore_drm2_outputs.c +++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c @@ -925,6 +925,20 @@ _output_destroy(Ecore_Drm2_Device *dev EINA_UNUSED, Ecore_Drm2_Output *output) free(output); } +/* this function is used to indicate if we are in a multi-gpu situation + * and need to calculate vblank sync with high crtc mask */ +static unsigned int +_output_vblank_pipe(Ecore_Drm2_Output *output) +{ + if (output->pipe > 1) + return ((output->pipe << DRM_VBLANK_HIGH_CRTC_SHIFT) & + DRM_VBLANK_HIGH_CRTC_MASK); + else if (output->pipe > 0) + return DRM_VBLANK_SECONDARY; + else + return 0; +} + EAPI Eina_Bool ecore_drm2_outputs_create(Ecore_Drm2_Device *device) { @@ -1619,6 +1633,7 @@ ecore_drm2_output_blanktime_get(Ecore_Drm2_Output *output, int sequence, long *s memset(&v, 0, sizeof(v)); v.request.type = DRM_VBLANK_RELATIVE; + v.request.type |= _output_vblank_pipe(output); v.request.sequence = sequence; ret = sym_drmWaitVBlank(output->fd, &v); success = (ret == 0) && (v.reply.tval_sec > 0 || v.reply.tval_usec > 0);