ecore_drm2: Implicitly set buffer busy status when flipping

This simplifies other code that shouldn't need to deal with this.
This commit is contained in:
Derek Foreman 2016-09-02 15:24:24 -05:00
parent 794798f559
commit ce7991b993
3 changed files with 9 additions and 30 deletions

View File

@ -235,7 +235,10 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
if (!output->enabled) return -1;
if (output->next)
WRN("Fb reused too soon, tearing may be visible");
{
output->next->busy = EINA_FALSE;
output->next = NULL;
}
if ((!output->current) ||
(output->current->stride != fb->stride))
@ -266,10 +269,13 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
DBG("Pageflip Failed for Crtc %u on Connector %u: %m",
output->crtc_id, output->conn_id);
output->next = fb;
fb->busy = EINA_TRUE;
return ret;
}
if (output->current) output->current->busy = EINA_FALSE;
output->current = fb;
fb->busy = EINA_TRUE;
return 0;
}

View File

@ -634,14 +634,11 @@ _cb_pageflip(int fd EINA_UNUSED, unsigned int frame EINA_UNUSED, unsigned int se
{
Ecore_Evas *ee;
Ecore_Evas_Engine_Drm_Data *edata;
Ecore_Drm2_Fb *current, *next;
Ecore_Drm2_Fb *next;
ee = data;
edata = ee->engine.data;
current = ecore_drm2_output_current_fb_get(edata->output);
if (current) ecore_drm2_fb_busy_set(current, EINA_FALSE);
next = ecore_drm2_output_next_fb_get(edata->output);
if (next)
{

View File

@ -8,43 +8,19 @@
#define GREEN_MASK 0x00ff00
#define BLUE_MASK 0x0000ff
Outbuf_Fb *
_outbuf_fb_find(Outbuf *ob, Ecore_Drm2_Fb *key)
{
int i;
for (i = 0; i < ob->priv.num; i++)
if (key == ob->priv.ofb[i].fb) return &ob->priv.ofb[i];
return NULL;
}
static void
_outbuf_buffer_swap(Outbuf *ob, Eina_Rectangle *rects, unsigned int count)
{
/* Ecore_Drm2_Plane *plane; */
Outbuf_Fb *ofb, *next_ofb;
Ecore_Drm2_Fb *next;
Outbuf_Fb *ofb;
ofb = ob->priv.draw;
if (!ofb) return;
/* If there's a next buffer set, we just dump it back into
* the available buffers and it becomes a dropped frame
*/
next = ecore_drm2_output_next_fb_get(ob->priv.output);
if (next)
{
next_ofb = _outbuf_fb_find(ob, next);
ecore_drm2_fb_busy_set(next_ofb->fb, EINA_FALSE);
ecore_drm2_output_next_fb_set(ob->priv.output, NULL);
}
ecore_drm2_fb_dirty(ofb->fb, rects, count);
if (ecore_drm2_fb_flip(ofb->fb, ob->priv.output) == 0)
ob->priv.display = ofb;
ecore_drm2_fb_busy_set(ofb->fb, EINA_TRUE);
ofb->drawn = EINA_TRUE;
ofb->age = 0;