[PATCH v2 09/11] gbm: add a release_buffer callback to dri backend
Ander Conselvan de Oliveira
ander.conselvan.de.oliveira at intel.com
Wed Jan 25 06:24:21 PST 2012
This adds a mechanism for the egl platform code to be notified when
the user releases a surface buffer that was previously locked with
gbm_surface_lock_front_buffer().
---
src/gbm/backends/dri/gbm_dri.c | 8 ++++++++
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 5ac86bc..8d39861 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -444,6 +444,7 @@ gbm_dri_surface_lock_front_buffer(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_lock_front_buffer(struct gbm_surface *_surf)
static void
gbm_dri_surface_release_buffer(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);
+
+ gbm_dri_bo_destroy(_bo);
}
static void
diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
index 8853251..3551be3 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;
};
--
1.7.4.1
More information about the wayland-devel
mailing list