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
This commit is contained in:
Christopher Michael 2019-01-02 11:05:07 -05:00 committed by Derek Foreman
parent 1b7129cea0
commit 8079d6d38a
3 changed files with 14 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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