From: Derek Foreman Date: Fri, 16 Jun 2017 21:17:56 +0000 (-0500) Subject: ecore_drm2: Track number of times an fb is on scanout X-Git-Tag: upstream/1.20.0~455 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=69181cc9e84c680758ab7f7e531ebb356c40c4bf;p=platform%2Fupstream%2Fefl.git 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. --- diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c index 28154e5..d656ddc 100644 --- a/src/lib/ecore_drm2/ecore_drm2_fb.c +++ b/src/lib/ecore_drm2/ecore_drm2_fb.c @@ -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--; } } diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h index d387e90..4ec2147 100644 --- a/src/lib/ecore_drm2/ecore_drm2_private.h +++ b/src/lib/ecore_drm2/ecore_drm2_private.h @@ -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;