ee_drm: Get page flips out of the render thread

Now that we have redraws_clear exposed through software generic, we can
use that to do the final buffer swap from the main thread instead of doing
it in outbuf_flush which runs from the render thread.

This becomes more important later when other call sites in the main thread
will perform buffer flips.
This commit is contained in:
Derek Foreman 2016-09-07 21:31:08 -05:00
parent 79409757c6
commit 95a00b8e49
3 changed files with 22 additions and 9 deletions

View File

@ -32,7 +32,7 @@ _render_engine_setup(Evas_Engine_Info_Drm *info, int w, int h)
_outbuf_update_region_free,
NULL,
_outbuf_flush,
NULL,
_outbuf_redraws_clear,
_outbuf_free,
ob->w, ob->h))
goto init_err;

View File

@ -61,6 +61,8 @@ struct _Outbuf
Outbuf_Fb ofb[4], *draw, *display;
Ecore_Drm2_Output *output;
Eina_List *pending;
Eina_Rectangle *rects;
unsigned int rect_count;
} priv;
Eina_Bool alpha : 1;
@ -76,5 +78,6 @@ void *_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx,
void _outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h);
void _outbuf_update_region_free(Outbuf *ob, RGBA_Image *update);
void _outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode);
void _outbuf_redraws_clear(Outbuf *ob);
#endif

View File

@ -494,17 +494,20 @@ _outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects EINA_UNUSED, Evas_Render_Mode rend
{
Eina_Rectangle *r;
RGBA_Image *img;
unsigned int n = 0, i = 0;
unsigned int i = 0;
if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return;
if (ob->priv.rect_count) free(ob->priv.rects);
/* get number of pending writes */
n = eina_list_count(ob->priv.pending);
if (n == 0) return;
ob->priv.rect_count = eina_list_count(ob->priv.pending);
if (ob->priv.rect_count == 0) return;
/* allocate rectangles */
r = alloca(n * sizeof(Eina_Rectangle));
if (!r) return;
ob->priv.rects = malloc(ob->priv.rect_count * sizeof(Eina_Rectangle));
if (!ob->priv.rects) return;
r = ob->priv.rects;
/* loop the pending writes */
EINA_LIST_FREE(ob->priv.pending, img)
@ -562,7 +565,14 @@ _outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects EINA_UNUSED, Evas_Render_Mode rend
i++;
}
/* force a buffer swap */
_outbuf_buffer_swap(ob, r, n);
}
void
_outbuf_redraws_clear(Outbuf *ob)
{
if (!ob->priv.rect_count) return;
_outbuf_buffer_swap(ob, ob->priv.rects, ob->priv.rect_count);
free(ob->priv.rects);
ob->priv.rect_count = 0;
}