diff options
author | Derek Foreman <derekf@osg.samsung.com> | 2016-09-07 21:25:32 -0500 |
---|---|---|
committer | Derek Foreman <derekf@osg.samsung.com> | 2016-09-07 22:39:50 -0500 |
commit | 231b3b2bcf74f3f3e44dce57a5a9937e1cfa3d24 (patch) | |
tree | 0f90dcfb88fefd421a1f38756daed9fd9d91a95b | |
parent | 46fd699d9bc71e5e271692adb6a11b5d61277f45 (diff) | |
download | efl-231b3b2bcf74f3f3e44dce57a5a9937e1cfa3d24.tar.gz |
drm: Improve next buffer selection algorithm
When triple buffering it's possible that we'll only need two buffers at
a time for long durations. When we finally call upon a third buffer it
hasn't been used recently enough to do a partial redraw.
By picking the oldest available buffer when multiple buffers are free we
can increase the likelihood of doing partial redraws.
-rw-r--r-- | src/modules/evas/engines/drm/evas_outbuf.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/modules/evas/engines/drm/evas_outbuf.c b/src/modules/evas/engines/drm/evas_outbuf.c index a8ef04e129..adddf7bcff 100644 --- a/src/modules/evas/engines/drm/evas_outbuf.c +++ b/src/modules/evas/engines/drm/evas_outbuf.c @@ -235,15 +235,23 @@ _outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth) static Outbuf_Fb * _outbuf_fb_wait(Outbuf *ob) { - int i = 0; + int i = 0, best = -1, best_age = -1; + /* We pick the oldest available buffer to avoid using the same two + * repeatedly and then having the third be stale when we need it + */ for (i = 0; i < ob->priv.num; i++) { if (&ob->priv.ofb[i] == ob->priv.display) continue; if (ecore_drm2_fb_busy_get(ob->priv.ofb[i].fb)) continue; - if (ob->priv.ofb[i].valid) return &(ob->priv.ofb[i]); + if (ob->priv.ofb[i].valid && (ob->priv.ofb[i].age > best_age)) + { + best = i; + best_age = ob->priv.ofb[i].age; + } } + if (best >= 0) return &(ob->priv.ofb[best]); return NULL; } |