From 95a00b8e496839c4976259692fb7c308f7a850dc Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 7 Sep 2016 21:31:08 -0500 Subject: [PATCH] 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. --- src/modules/evas/engines/drm/evas_engine.c | 2 +- src/modules/evas/engines/drm/evas_engine.h | 3 +++ src/modules/evas/engines/drm/evas_outbuf.c | 24 +++++++++++++++++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/modules/evas/engines/drm/evas_engine.c b/src/modules/evas/engines/drm/evas_engine.c index e28037d..d712093 100644 --- a/src/modules/evas/engines/drm/evas_engine.c +++ b/src/modules/evas/engines/drm/evas_engine.c @@ -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; diff --git a/src/modules/evas/engines/drm/evas_engine.h b/src/modules/evas/engines/drm/evas_engine.h index 94ddcf4..3a5c3c2 100644 --- a/src/modules/evas/engines/drm/evas_engine.h +++ b/src/modules/evas/engines/drm/evas_engine.h @@ -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 diff --git a/src/modules/evas/engines/drm/evas_outbuf.c b/src/modules/evas/engines/drm/evas_outbuf.c index b62d952..01394d0 100644 --- a/src/modules/evas/engines/drm/evas_outbuf.c +++ b/src/modules/evas/engines/drm/evas_outbuf.c @@ -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++; } +} + +void +_outbuf_redraws_clear(Outbuf *ob) +{ + if (!ob->priv.rect_count) return; - /* force a buffer swap */ - _outbuf_buffer_swap(ob, r, n); + _outbuf_buffer_swap(ob, ob->priv.rects, ob->priv.rect_count); + free(ob->priv.rects); + ob->priv.rect_count = 0; } -- 2.7.4