[Mesa-dev] [PATCH 06/32] gbm: Create a gbm_device getter for stride

Ben Widawsky ben at bwidawsk.net
Tue Jan 3 02:36:57 UTC 2017


This will be used so we can query information per plane.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
Acked-by: Daniel Stone <daniels at collabora.com>
---
 src/gbm/backends/dri/gbm_dri.c | 7 +++++++
 src/gbm/main/gbm.c             | 2 +-
 src/gbm/main/gbmint.h          | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index db7fa4b7b6..9b23299889 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -649,6 +649,12 @@ gbm_dri_bo_get_handle_for_plane(struct gbm_bo *_bo, int plane)
    return ret;
 }
 
+static uint32_t
+gbm_dri_bo_get_stride(struct gbm_bo *_bo, int plane)
+{
+   return _bo->stride;
+}
+
 static void
 gbm_dri_bo_destroy(struct gbm_bo *_bo)
 {
@@ -1108,6 +1114,7 @@ dri_device_create(int fd)
    dri->base.base.bo_get_fd = gbm_dri_bo_get_fd;
    dri->base.base.bo_get_planes = gbm_dri_bo_get_planes;
    dri->base.base.bo_get_handle = gbm_dri_bo_get_handle_for_plane;
+   dri->base.base.bo_get_stride = gbm_dri_bo_get_stride;
    dri->base.base.bo_destroy = gbm_dri_bo_destroy;
    dri->base.base.destroy = dri_destroy;
    dri->base.base.surface_create = gbm_dri_surface_create;
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index 066ceffc0a..7462e90c4c 100644
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -165,7 +165,7 @@ gbm_bo_get_height(struct gbm_bo *bo)
 GBM_EXPORT uint32_t
 gbm_bo_get_stride(struct gbm_bo *bo)
 {
-   return bo->stride;
+   return bo->gbm->bo_get_stride(bo, 0);
 }
 
 /** Get the format of the buffer object
diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
index 0ec531d099..26d18bab6b 100644
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -78,6 +78,7 @@ struct gbm_device {
    int (*bo_get_fd)(struct gbm_bo *bo);
    int (*bo_get_planes)(struct gbm_bo *bo);
    union gbm_bo_handle (*bo_get_handle)(struct gbm_bo *bo, int plane);
+   uint32_t (*bo_get_stride)(struct gbm_bo *bo, int plane);
    void (*bo_destroy)(struct gbm_bo *bo);
 
    struct gbm_surface *(*surface_create)(struct gbm_device *gbm,
-- 
2.11.0



More information about the mesa-dev mailing list