diff options
author | Ben Widawsky <[email protected]> | 2016-10-26 13:36:42 -0700 |
---|---|---|
committer | Ben Widawsky <[email protected]> | 2017-03-09 15:35:44 -0800 |
commit | 7f6209e46f8de409f182931e0ca23bb64f1a8e39 (patch) | |
tree | c947ec4f9a4cdffa9d7add21992ecc413c7ef686 /src/gbm/main | |
parent | ed4cf2440d87b512f9dcf7cfc3f408c151854af9 (diff) |
gbm: Export a per plane getter for stride
v2: Preserve legacy behavior when plane is 0 (Jason Ekstrand)
EINVAL when input plane is greater than total planes (Jason Ekstrand)
Don't leak the image after fromPlanar (Daniel)
Move bo->image check below plane count preventing bad index succeeding (Daniel)
v3: Fix DRIimage leak (using Jason's recommended change)
Make plane 0 return planar stride. This might break legacy behavior (Jason)
v4: Move bogus hunk for get_handle_for_plane to the right patch (Jason)
Fix error handling path to be cleaner (Jason)
v5: Add assert for dumb BOs to make sure plane == 0 (Jason)
Signed-off-by: Ben Widawsky <[email protected]>
Reviewed-by: Eric Engestrom <[email protected]> (v1)
Reviewed-by: Jason Ekstrand <[email protected]>
Acked-by: Daniel Stone <[email protected]>
Diffstat (limited to 'src/gbm/main')
-rw-r--r-- | src/gbm/main/gbm.c | 15 | ||||
-rw-r--r-- | src/gbm/main/gbm.h | 3 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c index 7462e90c4c5..0a9f0bef7ee 100644 --- a/src/gbm/main/gbm.c +++ b/src/gbm/main/gbm.c @@ -165,7 +165,20 @@ gbm_bo_get_height(struct gbm_bo *bo) GBM_EXPORT uint32_t gbm_bo_get_stride(struct gbm_bo *bo) { - return bo->gbm->bo_get_stride(bo, 0); + return gbm_bo_get_stride_for_plane(bo, 0); +} + +/** Get the stride for the given plane + * + * \param bo The buffer object + * \param plane for which you want the stride + * + * \sa gbm_bo_get_stride() + */ +GBM_EXPORT uint32_t +gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane) +{ + return bo->gbm->bo_get_stride(bo, plane); } /** Get the format of the buffer object diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h index 67548206c40..1719c5312a5 100644 --- a/src/gbm/main/gbm.h +++ b/src/gbm/main/gbm.h @@ -304,6 +304,9 @@ uint32_t gbm_bo_get_stride(struct gbm_bo *bo); uint32_t +gbm_bo_get_stride_for_plane(struct gbm_bo *bo, int plane); + +uint32_t gbm_bo_get_format(struct gbm_bo *bo); struct gbm_device * |