forked from enlightenment/efl
ecore_drm2: Add ecore_drm2_output_fb_release way to force buffer release
Adds an api to attempt to release an fb from an output. This will try to first free any queued but not display buffers, which may harmlessly give us a render target. However, if that fails it will try to get buffers that have been sent to scanout, which can lead to tearing.
This commit is contained in:
parent
30d14779a6
commit
21ad56aa32
|
@ -824,6 +824,20 @@ EAPI void ecore_drm2_output_user_data_set(Ecore_Drm2_Output *o, void *data);
|
|||
*/
|
||||
EAPI void ecore_drm2_output_release_handler_set(Ecore_Drm2_Output *output, Ecore_Drm2_Release_Handler handler, void *data);
|
||||
|
||||
/**
|
||||
* Try to force a framebuffer release for an output
|
||||
*
|
||||
* This tries to release the next, pending, or current buffer from
|
||||
* the output. If successful there will be a release callback to
|
||||
* the registered handler, and the fb will no longer be flagged busy.
|
||||
*
|
||||
* @param output The output to force release
|
||||
*
|
||||
* @ingroup Ecore_Drm2_Output_Group
|
||||
* @since 1.19
|
||||
*/
|
||||
EAPI void ecore_drm2_output_fb_release(Ecore_Drm2_Output *o);
|
||||
|
||||
/**
|
||||
* Get the Framebuffer's gbm buffer object
|
||||
*
|
||||
|
|
|
@ -328,6 +328,35 @@ ecore_drm2_fb_busy_set(Ecore_Drm2_Fb *fb, Eina_Bool busy)
|
|||
fb->busy = busy;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_drm2_output_fb_release(Ecore_Drm2_Output *o)
|
||||
{
|
||||
if (o->next)
|
||||
{
|
||||
_release_buffer(o, o->next);
|
||||
o->next = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
WRN("Buffer release request when no next buffer");
|
||||
/* If we have to release these we're going to see tearing.
|
||||
* Try to reclaim in decreasing order of visual awfulness
|
||||
*/
|
||||
if (o->current)
|
||||
{
|
||||
_release_buffer(o, o->current);
|
||||
o->current = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (o->pending)
|
||||
{
|
||||
_release_buffer(o, o->pending);
|
||||
o->pending = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void *
|
||||
ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *f)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue