ecore_drm2: Refactor common code from non-atomic path

We'll need to perform all this for atomic operations as well.
This commit is contained in:
Derek Foreman 2017-04-28 11:27:10 -05:00
parent 8d72a2cf46
commit 89630ddeb1
1 changed files with 25 additions and 24 deletions

View File

@ -378,27 +378,6 @@ _fb_flip(Ecore_Drm2_Output *output)
fb = output->prep.fb;
if (output->pending.fb)
{
if (output->next.fb) _release_buffer(output, output->next.fb);
output->next.fb = fb;
if (output->next.fb) output->next.fb->busy = EINA_TRUE;
return 0;
}
if (!fb) fb = output->next.fb;
/* So we can generate a tick by flipping to the current fb */
if (!fb) fb = output->current.fb;
if (output->next.fb)
{
output->next.fb->busy = EINA_FALSE;
output->next.fb = NULL;
}
/* If we don't have an fb to set by now, BAIL! */
if (!fb) return -1;
if ((!output->current.fb) ||
(output->current.fb->strides[0] != fb->strides[0]))
{
@ -477,9 +456,6 @@ _fb_flip(Ecore_Drm2_Output *output)
return 0;
}
output->pending.fb = fb;
output->pending.fb->busy = EINA_TRUE;
return 0;
}
@ -493,6 +469,27 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
if (!output->enabled) return -1;
if (output->pending.fb)
{
if (output->next.fb) _release_buffer(output, output->next.fb);
output->next.fb = fb;
if (output->next.fb) output->next.fb->busy = EINA_TRUE;
return 0;
}
if (!fb) fb = output->next.fb;
/* So we can generate a tick by flipping to the current fb */
if (!fb) fb = output->current.fb;
if (output->next.fb)
{
output->next.fb->busy = EINA_FALSE;
output->next.fb = NULL;
}
/* If we don't have an fb to set by now, BAIL! */
if (!fb) return -1;
output->prep.fb = fb;
if (_ecore_drm2_use_atomic)
@ -500,6 +497,10 @@ ecore_drm2_fb_flip(Ecore_Drm2_Fb *fb, Ecore_Drm2_Output *output)
else
ret = _fb_flip(output);
output->pending.fb = fb;
output->pending.fb->busy = EINA_TRUE;
output->prep.fb = NULL;
return ret;
}