ecore_drm2: Track number of times an fb is on scanout

The same fb can be placed in multiple hardware planes, we need to keep
track of the number of planes it's on at any time so we can send events
to a compositor in a later commit.
This commit is contained in:
Derek Foreman 2017-06-16 16:17:56 -05:00
parent bc8b11bd78
commit 69181cc9e8
2 changed files with 14 additions and 0 deletions

View File

@ -149,6 +149,9 @@ _ecore_drm2_fb_destroy(Ecore_Drm2_Fb *fb)
if (!fb->dead) ERR("Destroying an fb that hasn't been discarded");
if (fb->scanout_count)
ERR("Destroyed fb on scanout %d times.", fb->scanout_count);
if (fb->mmap) munmap(fb->mmap, fb->sizes[0]);
if (fb->id) sym_drmModeRmFB(fb->fd, fb->id);
@ -264,6 +267,7 @@ _ecore_drm2_fb_buffer_release(Ecore_Drm2_Output *output EINA_UNUSED, Ecore_Drm2_
EAPI Eina_Bool
ecore_drm2_fb_flip_complete(Ecore_Drm2_Output *output)
{
Eina_Bool plane_scanout;
Ecore_Drm2_Fb *fb;
EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
@ -284,13 +288,22 @@ ecore_drm2_fb_flip_complete(Ecore_Drm2_Output *output)
EINA_LIST_FOREACH_SAFE(output->planes, l, ll, plane)
{
fb = plane->fb;
if (!plane->dead)
{
/* First time this plane is scanned out */
if (!plane->scanout)
fb->scanout_count++;
plane->scanout = EINA_TRUE;
continue;
}
plane_scanout = plane->scanout;
output->planes = eina_list_remove_list(output->planes, l);
free(plane);
if (!plane_scanout) continue;
fb->scanout_count--;
}
}

View File

@ -154,6 +154,7 @@ struct _Ecore_Drm2_Fb
int w, h;
int depth, bpp;
short ref;
int scanout_count;
uint32_t id, handles[4];
uint32_t strides[4], sizes[4];
uint32_t format;