summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-06-16 16:17:56 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-06-23 08:15:41 -0500
commit69181cc9e84c680758ab7f7e531ebb356c40c4bf (patch)
tree8ed42b5b48d9f640b98cbee6b80c6455ada9e197
parentbc8b11bd7853b349e311a4b05db76d3525c85189 (diff)
downloadefl-69181cc9e84c680758ab7f7e531ebb356c40c4bf.tar.gz
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.
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_fb.c13
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_private.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c
index 28154e567e..d656ddc5bb 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 d387e90f42..4ec2147e76 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;