From fc37d4a70096c9707ce3425aa2c89262c773e581 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Wed, 2 Jan 2019 11:05:07 -0500 Subject: [PATCH] ecore-drm2: Pass output as data to drmModePageFlip and drmModeAtomicCommit In order to support per-output ticking, the drmModePageFlip and drmModeAtomicCommit functions need to pass the actual Output as data to the pageflip callback so that the pageflip callback function can pass the proper rectangle to ecore_evas_animator_tick Differential Revision: https://phab.enlightenment.org/D7678 --- src/lib/ecore_drm2/ecore_drm2_fb.c | 6 +++--- src/lib/ecore_drm2/ecore_drm2_outputs.c | 4 ++-- src/modules/ecore_evas/engines/drm/ecore_evas_drm.c | 13 +++++++++---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c index 4e26fd7..33c0e27 100644 --- a/src/lib/ecore_drm2/ecore_drm2_fb.c +++ b/src/lib/ecore_drm2/ecore_drm2_fb.c @@ -411,7 +411,7 @@ _fb_atomic_flip_test(Ecore_Drm2_Output *output) } ret = - sym_drmModeAtomicCommit(output->fd, req, flags, NULL); + sym_drmModeAtomicCommit(output->fd, req, flags, output); if (ret < 0) goto err; /* clear any previous request */ @@ -447,7 +447,7 @@ _fb_atomic_flip(Ecore_Drm2_Output *output) res = sym_drmModeAtomicCommit(output->fd, output->prep.atomic_req, flags, - output->user_data); + output); if (res < 0) { ERR("Failed Atomic Commit: %m"); @@ -499,7 +499,7 @@ _fb_flip(Ecore_Drm2_Output *output) static Eina_Bool bugged_about_bug = EINA_FALSE; repeat = EINA_FALSE; ret = sym_drmModePageFlip(fb->fd, output->crtc_id, fb->id, - DRM_MODE_PAGE_FLIP_EVENT, output->user_data); + DRM_MODE_PAGE_FLIP_EVENT, output); /* Some drivers (RPI - looking at you) are broken and produce * flip events before they are ready for another flip, so be * a little robust in the face of badness and try a few times diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c index e39f26a..928a16c 100644 --- a/src/lib/ecore_drm2/ecore_drm2_outputs.c +++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c @@ -1291,7 +1291,7 @@ _output_mode_atomic_set(Ecore_Drm2_Output *output, Ecore_Drm2_Output_Mode *mode) } ret = sym_drmModeAtomicCommit(output->fd, req, DRM_MODE_ATOMIC_ALLOW_MODESET, - output->user_data); + output); if (ret < 0) { ERR("Failed to commit atomic Mode: %m"); @@ -1538,7 +1538,7 @@ ecore_drm2_output_rotation_set(Ecore_Drm2_Output *output, int rotation) if (res < 0) goto err; res = sym_drmModeAtomicCommit(output->fd, req, flags, - output->user_data); + output); if (res < 0) goto err; else diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c index d300484..2c3909b 100644 --- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c +++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c @@ -718,27 +718,32 @@ static void _cb_pageflip(int fd EINA_UNUSED, unsigned int frame EINA_UNUSED, unsigned int sec, unsigned int usec, void *data) { Ecore_Evas *ee; + Ecore_Drm2_Output *output; Ecore_Evas_Engine_Drm_Data *edata; int ret; - ee = data; + output = data; + + ee = ecore_drm2_output_user_data_get(output); + if (!ee) return; + edata = ee->engine.data; - ret = ecore_drm2_fb_flip_complete(edata->output); + ret = ecore_drm2_fb_flip_complete(output); if (edata->ticking) { int x, y, w, h; double t = (double)sec + ((double)usec / 1000000); - ecore_drm2_output_info_get(edata->output, &x, &y, &w, &h, NULL); + ecore_drm2_output_info_get(output, &x, &y, &w, &h, NULL); if (!edata->once) t = ecore_time_get(); ecore_evas_animator_tick(ee, &(Eina_Rectangle){x, y, w, h}, t - edata->offset); } else if (ret) - ecore_drm2_fb_flip(NULL, edata->output); + ecore_drm2_fb_flip(NULL, output); } static void -- 2.7.4