summaryrefslogtreecommitdiffstats
path: root/src/gbm/main
diff options
context:
space:
mode:
authorBen Widawsky <[email protected]>2016-12-02 11:00:00 -0800
committerBen Widawsky <[email protected]>2017-03-09 15:35:44 -0800
commitf9567ab435217a72cbae628336ead84dc0b2a803 (patch)
tree45c113a7efb39e1db06e418388d57fc4057b3cf6 /src/gbm/main
parent42eacddfc027dd8668956dd836b85e16bab4f9f4 (diff)
gbm: Export a getter for per plane handles
v2: Make the error return be -1 instead of 0 because I think 0 is actually valid. v3: Set errno to EINVAL when the specified plane is above the total planes. (Jason Ekstrand) Return the bo's handle if there is no image ie. for dumb images like cursor (Daniel) v4: - Add assertions about plane == 0 (Jason) - Add a comment about new restriction on planar dumb bo which is not an earlier patch in the series. - Correctly refactor from v2 in this patch; it ended up rebased into the wrong patch. Signed-off-by: Ben Widawsky <[email protected]> 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.c18
-rw-r--r--src/gbm/main/gbm.h3
-rw-r--r--src/gbm/main/gbmint.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index 37795175644..066ceffc0a3 100644
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -234,6 +234,24 @@ gbm_bo_get_plane_count(struct gbm_bo *bo)
return bo->gbm->bo_get_planes(bo);
}
+/** Get the handle for the specified plane of the buffer object
+ *
+ * This function gets the handle for any plane associated with the BO. When
+ * dealing with multi-planar formats, or formats which might have implicit
+ * planes based on different underlying hardware it is necessary for the client
+ * to be able to get this information to pass to the DRM.
+ *
+ * \param bo The buffer object
+ * \param plane the plane to get a handle for
+ *
+ * \sa gbm_bo_get_handle()
+ */
+GBM_EXPORT union gbm_bo_handle
+gbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane)
+{
+ return bo->gbm->bo_get_handle(bo, plane);
+}
+
/** 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
index 203a2363579..67548206c40 100644
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -318,6 +318,9 @@ gbm_bo_get_fd(struct gbm_bo *bo);
int
gbm_bo_get_plane_count(struct gbm_bo *bo);
+union gbm_bo_handle
+gbm_bo_get_handle_for_plane(struct gbm_bo *bo, int plane);
+
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
index c6a6701464a..0ec531d0991 100644
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -77,6 +77,7 @@ struct gbm_device {
int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data);
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);
void (*bo_destroy)(struct gbm_bo *bo);
struct gbm_surface *(*surface_create)(struct gbm_device *gbm,