forked from enlightenment/efl
evas_drm: replace outbuf fb array with a list
Summary: This is just a step towards making it a variable length. ref T7099 Depends on D6562 Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric, #committers, zmike Tags: #efl Maniphest Tasks: T7099 Differential Revision: https://phab.enlightenment.org/D6563
This commit is contained in:
parent
f783163ca5
commit
5d30f2b0b3
|
@ -63,7 +63,8 @@ struct _Outbuf
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int num;
|
int num;
|
||||||
Outbuf_Fb *ofb[MAX_BUFFERS], *draw;
|
Eina_List *fb_list;
|
||||||
|
Outbuf_Fb *draw;
|
||||||
Ecore_Drm2_Output *output;
|
Ecore_Drm2_Output *output;
|
||||||
Ecore_Drm2_Plane *plane;
|
Ecore_Drm2_Plane *plane;
|
||||||
Eina_List *pending;
|
Eina_List *pending;
|
||||||
|
|
|
@ -118,7 +118,7 @@ _outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
|
||||||
WRN("Failed to create framebuffer %d", i);
|
WRN("Failed to create framebuffer %d", i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ob->priv.ofb[i] = ofb;
|
ob->priv.fb_list = eina_list_append(ob->priv.fb_list, ofb);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ob;
|
return ob;
|
||||||
|
@ -127,7 +127,7 @@ _outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
|
||||||
void
|
void
|
||||||
_outbuf_free(Outbuf *ob)
|
_outbuf_free(Outbuf *ob)
|
||||||
{
|
{
|
||||||
int i = 0;
|
Outbuf_Fb *ofb;
|
||||||
|
|
||||||
while (ob->priv.pending)
|
while (ob->priv.pending)
|
||||||
{
|
{
|
||||||
|
@ -154,8 +154,8 @@ _outbuf_free(Outbuf *ob)
|
||||||
|
|
||||||
_outbuf_flush(ob, NULL, NULL, EVAS_RENDER_MODE_UNDEF);
|
_outbuf_flush(ob, NULL, NULL, EVAS_RENDER_MODE_UNDEF);
|
||||||
|
|
||||||
for (i = 0; i < ob->priv.num; i++)
|
EINA_LIST_FREE(ob->priv.fb_list, ofb)
|
||||||
_outbuf_fb_destroy(ob->priv.ofb[i]);
|
_outbuf_fb_destroy(ofb);
|
||||||
|
|
||||||
free(ob);
|
free(ob);
|
||||||
}
|
}
|
||||||
|
@ -222,8 +222,8 @@ _outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth)
|
||||||
ob->format = format;
|
ob->format = format;
|
||||||
ob->rotation = rotation;
|
ob->rotation = rotation;
|
||||||
|
|
||||||
for (i = 0; i < ob->priv.num; i++)
|
EINA_LIST_FREE(ob->priv.fb_list, ofb)
|
||||||
_outbuf_fb_destroy(ob->priv.ofb[i]);
|
_outbuf_fb_destroy(ofb);
|
||||||
|
|
||||||
if ((ob->rotation == 0) || (ob->rotation == 180))
|
if ((ob->rotation == 0) || (ob->rotation == 180))
|
||||||
{
|
{
|
||||||
|
@ -245,7 +245,7 @@ _outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth)
|
||||||
WRN("Failed to create framebuffer %d", i);
|
WRN("Failed to create framebuffer %d", i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ob->priv.ofb[i] = ofb;
|
ob->priv.fb_list = eina_list_append(ob->priv.fb_list, ofb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: idle flush */
|
/* TODO: idle flush */
|
||||||
|
@ -254,29 +254,31 @@ _outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth)
|
||||||
static Outbuf_Fb *
|
static Outbuf_Fb *
|
||||||
_outbuf_fb_wait(Outbuf *ob)
|
_outbuf_fb_wait(Outbuf *ob)
|
||||||
{
|
{
|
||||||
int i = 0, best = -1, best_age = -1;
|
Eina_List *l;
|
||||||
|
Outbuf_Fb *ofb, *best = NULL;
|
||||||
|
int best_age = -1;
|
||||||
|
|
||||||
/* We pick the oldest available buffer to avoid using the same two
|
/* We pick the oldest available buffer to avoid using the same two
|
||||||
* repeatedly and then having the third be stale when we need it
|
* repeatedly and then having the third be stale when we need it
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < ob->priv.num; i++)
|
EINA_LIST_FOREACH(ob->priv.fb_list, l, ofb)
|
||||||
{
|
{
|
||||||
if (ecore_drm2_fb_busy_get(ob->priv.ofb[i]->fb)) continue;
|
if (ecore_drm2_fb_busy_get(ofb->fb)) continue;
|
||||||
if (ob->priv.ofb[i]->valid && (ob->priv.ofb[i]->age > best_age))
|
if (ofb->valid && (ofb->age > best_age))
|
||||||
{
|
{
|
||||||
best = i;
|
best = ofb;
|
||||||
best_age = ob->priv.ofb[i]->age;
|
best_age = best->age;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (best >= 0) return ob->priv.ofb[best];
|
return best;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_outbuf_fb_assign(Outbuf *ob)
|
_outbuf_fb_assign(Outbuf *ob)
|
||||||
{
|
{
|
||||||
int i;
|
Outbuf_Fb *ofb;
|
||||||
|
Eina_List *l;
|
||||||
|
|
||||||
ob->priv.draw = _outbuf_fb_wait(ob);
|
ob->priv.draw = _outbuf_fb_wait(ob);
|
||||||
while (!ob->priv.draw)
|
while (!ob->priv.draw)
|
||||||
|
@ -285,15 +287,15 @@ _outbuf_fb_assign(Outbuf *ob)
|
||||||
ob->priv.draw = _outbuf_fb_wait(ob);
|
ob->priv.draw = _outbuf_fb_wait(ob);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ob->priv.num; i++)
|
EINA_LIST_FOREACH(ob->priv.fb_list, l, ofb)
|
||||||
{
|
{
|
||||||
if ((ob->priv.ofb[i]->valid) && (ob->priv.ofb[i]->drawn))
|
if ((ofb->valid) && (ofb->drawn))
|
||||||
{
|
{
|
||||||
ob->priv.ofb[i]->age++;
|
ofb->age++;
|
||||||
if (ob->priv.ofb[i]->age > 4)
|
if (ofb->age > 4)
|
||||||
{
|
{
|
||||||
ob->priv.ofb[i]->age = 0;
|
ofb->age = 0;
|
||||||
ob->priv.ofb[i]->drawn = EINA_FALSE;
|
ofb->drawn = EINA_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue