diff options
author | Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> | 2011-12-14 12:00:07 +0200 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2012-01-16 13:45:28 +0000 |
commit | 60c672551894c921ab1d5c8b19372120b0ffd3c2 (patch) | |
tree | 266732e253f85e9e3708ee6c797f3ca7b255332a /src | |
parent | d0ef353eb2a1f4ef3eaac9898cf251ee596ad65c (diff) |
gbm: add a release_buffer callback to dri backend
This adds a mechanism for the egl platform code to be notified when
the user releases a bo created from a surface.
Diffstat (limited to 'src')
-rw-r--r-- | src/gbm/backends/dri/gbm_dri.c | 8 | ||||
-rw-r--r-- | src/gbm/backends/dri/gbm_driint.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index d6ac956aef..1a08a35429 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -444,6 +444,7 @@ gbm_dri_surface_get_bo(struct gbm_surface *_surf) if (bo == NULL) return NULL; + bo->dri_buffer = dri_buffer; bo->base.base.gbm = _surf->gbm; bo->base.base.width = _surf->width; bo->base.base.height = _surf->height; @@ -465,6 +466,13 @@ gbm_dri_surface_get_bo(struct gbm_surface *_surf) static void gbm_dri_surface_release_bo(struct gbm_surface *_surf, struct gbm_bo *_bo) { + struct gbm_dri_surface *surf = gbm_dri_surface(_surf); + struct gbm_dri_bo *bo = gbm_dri_bo(_bo); + + if (surf->release_buffer && bo->dri_buffer) + surf->release_buffer(surf, bo->dri_buffer, surf->dri_private); + + bo->dri_buffer = NULL; } static void diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h index 8853251b04..3551be3921 100644 --- a/src/gbm/backends/dri/gbm_driint.h +++ b/src/gbm/backends/dri/gbm_driint.h @@ -72,12 +72,14 @@ struct gbm_dri_bo { struct gbm_drm_bo base; __DRIimage *image; + __DRIbuffer *dri_buffer; }; struct gbm_dri_surface { struct gbm_surface base; __DRIbuffer *(*get_front_buffer)(struct gbm_dri_surface *, void *); + void (*release_buffer)(struct gbm_dri_surface *, __DRIbuffer *, void *); void *dri_private; }; |