From 421d4ec03917d13cc4449832275ac3c25e00acf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Tue, 15 Jan 2013 13:58:57 +0200 Subject: gralloc: new function to query the gem handle of buffer_handle_t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function can be used from Mesa instead of having to expose the whole gralloc_drm_handle_t structure. Change-Id: I1aa5368b21e588d5d711c1005fff2a5296e143a0 Signed-off-by: Tapani Pälli --- gralloc_drm.c | 6 ++++++ gralloc_drm.h | 1 + 2 files changed, 7 insertions(+) diff --git a/gralloc_drm.c b/gralloc_drm.c index 63b5217..cf0fe84 100644 --- a/gralloc_drm.c +++ b/gralloc_drm.c @@ -348,6 +348,12 @@ buffer_handle_t gralloc_drm_bo_get_handle(struct gralloc_drm_bo_t *bo, int *stri return &bo->handle->base; } +int gralloc_drm_get_gem_handle(buffer_handle_t _handle) +{ + struct gralloc_drm_handle_t *handle = gralloc_drm_handle(_handle); + return (handle) ? handle->name : 0; +} + /* * Lock a bo. XXX thread-safety? */ diff --git a/gralloc_drm.h b/gralloc_drm.h index 716173a..6c13138 100644 --- a/gralloc_drm.h +++ b/gralloc_drm.h @@ -120,6 +120,7 @@ void gralloc_drm_bo_decref(struct gralloc_drm_bo_t *bo); struct gralloc_drm_bo_t *gralloc_drm_bo_from_handle(buffer_handle_t handle); buffer_handle_t gralloc_drm_bo_get_handle(struct gralloc_drm_bo_t *bo, int *stride); +int gralloc_drm_get_gem_handle(buffer_handle_t handle); int gralloc_drm_bo_lock(struct gralloc_drm_bo_t *bo, int x, int y, int w, int h, int enable_write, void **addr); void gralloc_drm_bo_unlock(struct gralloc_drm_bo_t *bo); -- cgit v1.1