summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_drm/evas_outbuf.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2016-01-22 14:50:47 -0600
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-02-18 15:50:15 -0500
commit6e1c7065d7578221efccf70772cfb3fde643eb64 (patch)
treef0381e35229be9dd382db8d91016ca66afa7df28 /src/modules/evas/engines/gl_drm/evas_outbuf.c
parentf10b3f79a20f767924870c814e12303866525ccd (diff)
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
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/gl_drm/evas_outbuf.c41
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)
89} 89}
90 90
91static void 91static void
92_evas_outbuf_cb_pageflip(void *data)
93{
94 Outbuf *ob;
95 Ecore_Drm_Fb *fb;
96 struct gbm_bo *bo;
97
98 if (!(ob = data)) return;
99
100 bo = ob->priv.bo[ob->priv.curr];
101 if (!bo) return;
102
103 fb = _evas_outbuf_fb_get(ob->info->info.dev, bo);
104 if (fb) fb->pending_flip = EINA_FALSE;
105
106 gbm_surface_release_buffer(ob->surface, bo);
107
108 ob->priv.last = ob->priv.curr;
109 ob->priv.curr = (ob->priv.curr + 1) % ob->priv.num;
110}
111
112static void
113_evas_outbuf_buffer_swap(Outbuf *ob, Eina_Rectangle *rects, unsigned int count) 92_evas_outbuf_buffer_swap(Outbuf *ob, Eina_Rectangle *rects, unsigned int count)
114{ 93{
115 Ecore_Drm_Fb *fb; 94 Ecore_Drm_Fb *fb;
116 95
117 ob->priv.bo[ob->priv.curr] = gbm_surface_lock_front_buffer(ob->surface); 96 /* Repulsive hack: Right now we don't actually have a proper way to retire
118 if (!ob->priv.bo[ob->priv.curr]) 97 * buffers because the ticker and the flip handler are out of sync, the
98 * flip handler is per output, fbs are submit to multiple outputs and may
99 * be denied (and re-queued) by any output they're supposed to be on.
100 * This will all be magically fixed when evas supports multiple target
101 * regions, but until then we do this:
102 * always have 2 buffers locked
103 */
104 if (ob->priv.bo[1]) gbm_surface_release_buffer(ob->surface, ob->priv.bo[1]);
105 ob->priv.bo[1] = ob->priv.bo[0];
106 ob->priv.bo[0] = gbm_surface_lock_front_buffer(ob->surface);
107 if (!ob->priv.bo[0])
119 { 108 {
120 WRN("Could not lock front buffer"); 109 WRN("Could not lock front buffer");
121 return; 110 return;
122 } 111 }
123 112 fb = _evas_outbuf_fb_get(ob->info->info.dev, ob->priv.bo[0]);
124 fb = _evas_outbuf_fb_get(ob->info->info.dev, ob->priv.bo[ob->priv.curr]);
125 if (fb) 113 if (fb)
126 { 114 {
127 ecore_drm_fb_dirty(fb, rects, count); 115 ecore_drm_fb_dirty(fb, rects, count);
128 ecore_drm_fb_set(ob->info->info.dev, fb); 116 ecore_drm_fb_send(ob->info->info.dev, fb, NULL, NULL);
129 ecore_drm_fb_send(ob->info->info.dev, fb, _evas_outbuf_cb_pageflip, ob);
130 } 117 }
131} 118}
132 119