forked from enlightenment/efl
ecore_drm2: Add a page flip completion call
Add a function for ecore_evas_drm to call after a page flip happens so ecore_drm2 can track busy status for fbs itself (including for the fb that's currently being flipped to scanout) Also, call the completion function from ecore_evas_drm
This commit is contained in:
parent
33043ff1eb
commit
b4cbf860b9
|
@ -768,6 +768,9 @@ EAPI void ecore_drm2_fb_dirty(Ecore_Drm2_Fb *fb, Eina_Rectangle *rects, unsigned
|
|||
/**
|
||||
* Schedule a pageflip to the given Ecore_Drm2_Fb
|
||||
*
|
||||
* The caller is responsible for running a page flip handler
|
||||
* and calling ecore_drm2_fb_flip_complete() when it completes.
|
||||
*
|
||||
* @param fb
|
||||
* @param output
|
||||
*
|
||||
|
@ -778,6 +781,18 @@ EAPI void ecore_drm2_fb_dirty(Ecore_Drm2_Fb *fb, Eina_Rectangle *rects, unsigned
|
|||
*/
|
||||
EAPI int ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output);
|
||||
|
||||
/**
|
||||
* Must be called by a page flip handler when the flip completes.
|
||||
*
|
||||
* @param output
|
||||
*
|
||||
* @return Whether there's an undisplayed buffer still in the queue.
|
||||
*
|
||||
* @ingroup Ecore_Drm2_Fb_Group
|
||||
* @since 1.18
|
||||
*/
|
||||
EAPI Eina_Bool ecore_drm2_fb_flip_complete(Ecore_Drm2_Output *output);
|
||||
|
||||
/**
|
||||
* Return the Ecore_Drm2_Fb's busy status
|
||||
*
|
||||
|
|
|
@ -223,6 +223,19 @@ ecore_drm2_fb_dirty(Ecore_Drm2_Fb *fb, Eina_Rectangle *rects, unsigned int count
|
|||
#endif
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
ecore_drm2_fb_flip_complete(Ecore_Drm2_Output *output)
|
||||
{
|
||||
if (output->current) output->current->busy = EINA_FALSE;
|
||||
output->current = output->pending;
|
||||
output->pending = NULL;
|
||||
|
||||
/* In case they were the same buffer... */
|
||||
if (output->current) output->current->busy = EINA_TRUE;
|
||||
|
||||
return !!output->next;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
|
||||
{
|
||||
|
@ -233,6 +246,13 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
|
|||
|
||||
if (!output->enabled) return -1;
|
||||
|
||||
if (output->pending)
|
||||
{
|
||||
if (output->next) output->next->busy = EINA_FALSE;
|
||||
output->next = fb;
|
||||
if (output->next) output->next->busy = EINA_TRUE;
|
||||
return 0;
|
||||
}
|
||||
if (!fb) fb = output->next;
|
||||
|
||||
/* So we can generate a tick by flipping to the current fb */
|
||||
|
@ -262,7 +282,9 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (output->current) output->current->busy = EINA_FALSE;
|
||||
output->current = fb;
|
||||
output->current->busy = EINA_TRUE;
|
||||
output->next = NULL;
|
||||
|
||||
return 0;
|
||||
|
@ -284,9 +306,8 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (output->current) output->current->busy = EINA_FALSE;
|
||||
output->current = fb;
|
||||
fb->busy = EINA_TRUE;
|
||||
output->pending = fb;
|
||||
output->pending->busy = EINA_TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ struct _Ecore_Drm2_Output
|
|||
|
||||
drmModeCrtcPtr ocrtc;
|
||||
|
||||
Ecore_Drm2_Fb *current, *next;
|
||||
Ecore_Drm2_Fb *current, *next, *pending;
|
||||
|
||||
Eina_Matrix4 matrix, inverse;
|
||||
Ecore_Drm2_Transform transform;
|
||||
|
|
|
@ -639,6 +639,8 @@ _cb_pageflip(int fd EINA_UNUSED, unsigned int frame EINA_UNUSED, unsigned int se
|
|||
ee = data;
|
||||
edata = ee->engine.data;
|
||||
|
||||
ecore_drm2_fb_flip_complete(edata->output);
|
||||
|
||||
next = ecore_drm2_output_next_fb_get(edata->output);
|
||||
if (next)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue