ecore-drm2: Add start of refcounting for FB objects

Small patch which starts to implement refcounting on framebuffer
objects. This will be needed so that we do not free FB objects while
they are on the screen.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-05-09 11:29:35 -04:00
parent 544cffaa19
commit af587c01cb
3 changed files with 8 additions and 1 deletions

View File

@ -35,6 +35,7 @@ ecore_drm2_fb_create(int fd, int width, int height, int depth, int bpp, unsigned
fb->bpp = bpp;
fb->depth = depth;
fb->format = format;
fb->ref = 1;
memset(&carg, 0, sizeof(drm_mode_create_dumb));
carg.bpp = bpp;
@ -113,6 +114,7 @@ ecore_drm2_fb_gbm_create(int fd, int width, int height, int depth, int bpp, unsi
fb->strides[0] = stride;
fb->sizes[0] = fb->strides[0] * fb->h;
fb->handles[0] = handle;
fb->ref = 1;
if (!_fb2_create(fb))
{
@ -228,6 +230,7 @@ ecore_drm2_fb_flip_complete(Ecore_Drm2_Output *output)
if (output->current.fb && (output->current.fb != output->pending.fb))
_release_buffer(output, &output->current);
output->current.fb = output->pending.fb;
output->pending.fb = NULL;
@ -615,6 +618,8 @@ ecore_drm2_fb_dmabuf_import(int fd, int width, int height, int depth, int bpp, u
fb->bpp = bpp;
fb->depth = depth;
fb->format = format;
fb->ref = 1;
memcpy(&fb->strides, strides, sizeof(fb->strides));
if (_fb2_create(fb)) return fb;

View File

@ -119,6 +119,8 @@ out:
return NULL;
}
fb->ref++;
DBG("FB %d assigned to Plane %d", fb->id, pstate->obj_id);
output->planes = eina_list_append(output->planes, plane);

View File

@ -695,6 +695,7 @@ struct _Ecore_Drm2_Fb
int fd;
int w, h;
int depth, bpp;
short ref;
uint32_t id, handles[4];
uint32_t strides[4], sizes[4];
uint32_t format;
@ -795,7 +796,6 @@ struct _Ecore_Drm2_Output
Eina_List *plane_states;
Eina_List *planes;
Eina_Bool connected : 1;
Eina_Bool primary : 1;
Eina_Bool cloned : 1;