diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2016-01-22 14:50:47 -0600 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2016-02-18 15:50:15 -0500 |
commit | 6e1c7065d7578221efccf70772cfb3fde643eb64 (patch) | |
tree | f0381e35229be9dd382db8d91016ca66afa7df28 | |
parent | f10b3f79a20f767924870c814e12303866525ccd (diff) | |
download | efl-6e1c7065d7578221efccf70772cfb3fde643eb64.tar.gz |
gl-drm: revise page flip logic
We can't really drive this buffer unlocking from the page flip handler for
a lot of ugly reasons. This will be better in the future when evas
supports multiple target buffers. For now let's cut this down and keep
2 buffers locked at all times.
This gets drm-gl to work without massive tearing artifacts.
@fix
-rw-r--r-- | src/modules/evas/engines/gl_drm/evas_outbuf.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/src/modules/evas/engines/gl_drm/evas_outbuf.c b/src/modules/evas/engines/gl_drm/evas_outbuf.c index 65a47f58ae..2bd6dc584b 100644 --- a/src/modules/evas/engines/gl_drm/evas_outbuf.c +++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c @@ -89,44 +89,31 @@ _evas_outbuf_fb_get(Ecore_Drm_Device *dev, struct gbm_bo *bo) } static void -_evas_outbuf_cb_pageflip(void *data) -{ - Outbuf *ob; - Ecore_Drm_Fb *fb; - struct gbm_bo *bo; - - if (!(ob = data)) return; - - bo = ob->priv.bo[ob->priv.curr]; - if (!bo) return; - - fb = _evas_outbuf_fb_get(ob->info->info.dev, bo); - if (fb) fb->pending_flip = EINA_FALSE; - - gbm_surface_release_buffer(ob->surface, bo); - - ob->priv.last = ob->priv.curr; - ob->priv.curr = (ob->priv.curr + 1) % ob->priv.num; -} - -static void _evas_outbuf_buffer_swap(Outbuf *ob, Eina_Rectangle *rects, unsigned int count) { Ecore_Drm_Fb *fb; - ob->priv.bo[ob->priv.curr] = gbm_surface_lock_front_buffer(ob->surface); - if (!ob->priv.bo[ob->priv.curr]) + /* Repulsive hack: Right now we don't actually have a proper way to retire + * buffers because the ticker and the flip handler are out of sync, the + * flip handler is per output, fbs are submit to multiple outputs and may + * be denied (and re-queued) by any output they're supposed to be on. + * This will all be magically fixed when evas supports multiple target + * regions, but until then we do this: + * always have 2 buffers locked + */ + if (ob->priv.bo[1]) gbm_surface_release_buffer(ob->surface, ob->priv.bo[1]); + ob->priv.bo[1] = ob->priv.bo[0]; + ob->priv.bo[0] = gbm_surface_lock_front_buffer(ob->surface); + if (!ob->priv.bo[0]) { WRN("Could not lock front buffer"); return; } - - fb = _evas_outbuf_fb_get(ob->info->info.dev, ob->priv.bo[ob->priv.curr]); + fb = _evas_outbuf_fb_get(ob->info->info.dev, ob->priv.bo[0]); if (fb) { ecore_drm_fb_dirty(fb, rects, count); - ecore_drm_fb_set(ob->info->info.dev, fb); - ecore_drm_fb_send(ob->info->info.dev, fb, _evas_outbuf_cb_pageflip, ob); + ecore_drm_fb_send(ob->info->info.dev, fb, NULL, NULL); } } |