[Mesa-dev] [PATCH 7/9 v2] gbm: add handle2(buffer region name)

Zhao Halley halley.zhao at intel.com
Tue Jun 5 10:08:50 CEST 2012


---
 src/gbm/backends/dri/gbm_dri.c |    6 +++++-
 src/gbm/main/gbm.c             |   14 ++++++++++++++
 src/gbm/main/gbm.h             |    3 +++
 src/gbm/main/gbmint.h          |    1 +
 4 files changed, 23 insertions(+), 1 deletions(-)
 mode change 100644 => 100755 src/gbm/main/gbm.c
 mode change 100644 => 100755 src/gbm/main/gbm.h
 mode change 100644 => 100755 src/gbm/main/gbmint.h

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 32cde66..383a5a5 100755
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -389,6 +389,8 @@ gbm_dri_bo_create_from_egl_image(struct gbm_device *gbm,
                           (int *) &bo->base.base.pitch);
    dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_FORMAT,
 			  &dri_format);
+   dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_NAME,
+                          (uint32_t *) &bo->base.base.handle2.u32);
 
    bo->base.base.format = gbm_dri_to_gbm_format(dri_format);
 
@@ -457,7 +459,9 @@ gbm_dri_bo_create(struct gbm_device *gbm,
                           &bo->base.base.handle.s32);
    dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE,
                           (int *) &bo->base.base.pitch);
-
+   dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_NAME,
+                          (uint32_t *) &bo->base.base.handle2.u32);
+   		
    return &bo->base.base;
 }
 
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
old mode 100644
new mode 100755
index 3994f86..f445bb1
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -231,6 +231,20 @@ gbm_bo_get_handle(struct gbm_bo *bo)
    return bo->handle;
 }
 
+/** Get handle2 (buffer region name) of the buffer object
+ *
+ * This is stored in the platform generic union gbm_bo_handle type. However
+ * the format of this handle is platform specific.
+ *
+ * \param bo The buffer object
+ * \return Returns the handle of the allocated buffer object
+ */
+GBM_EXPORT union gbm_bo_handle
+gbm_bo_get_handle2(struct gbm_bo *bo)
+{
+   return bo->handle2;
+}
+
 /** Write data into the buffer object
  *
  * If the buffer object was created with the GBM_BO_USE_WRITE flag,
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
old mode 100644
new mode 100755
index af5dc5a..b7a2ffa
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -254,6 +254,9 @@ gbm_bo_get_device(struct gbm_bo *bo);
 union gbm_bo_handle
 gbm_bo_get_handle(struct gbm_bo *bo);
 
+union gbm_bo_handle
+gbm_bo_get_handle2(struct gbm_bo *bo);
+
 int
 gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
 
diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
old mode 100644
new mode 100755
index 8eb8671..5e48e89
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -95,6 +95,7 @@ struct gbm_bo {
    uint32_t pitch;
    uint32_t format;
    union gbm_bo_handle  handle;
+   union gbm_bo_handle  handle2;
    void *user_data;
    void (*destroy_user_data)(struct gbm_bo *, void *);
 };
-- 
1.7.5.4



More information about the mesa-dev mailing list