return fd;
}
+static int
+get_number_planes(struct gbm_dri_device *dri, __DRIimage *image)
+{
+ int num_planes = 0;
+
+ /* Dumb buffers are single-plane only. */
+ if (!image)
+ return 1;
+
+ dri->image->queryImage(image, __DRI_IMAGE_ATTRIB_NUM_PLANES, &num_planes);
+
+ if (num_planes <= 0)
+ num_planes = 1;
+
+ return num_planes;
+}
+
+static int
+gbm_dri_bo_get_planes(struct gbm_bo *_bo)
+{
+ struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm);
+ struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
+
+ return get_number_planes(dri, bo->image);
+}
+
static void
gbm_dri_bo_destroy(struct gbm_bo *_bo)
{
dri->base.base.is_format_supported = gbm_dri_is_format_supported;
dri->base.base.bo_write = gbm_dri_bo_write;
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_destroy = gbm_dri_bo_destroy;
dri->base.base.destroy = dri_destroy;
dri->base.base.surface_create = gbm_dri_surface_create;
return bo->gbm->bo_get_fd(bo);
}
+/** Get the number of planes for the given bo.
+ *
+ * \param bo The buffer object
+ * \return The number of planes
+ */
+GBM_EXPORT int
+gbm_bo_get_plane_count(struct gbm_bo *bo)
+{
+ return bo->gbm->bo_get_planes(bo);
+}
/** Write data into the buffer object
*
int
gbm_bo_get_fd(struct gbm_bo *bo);
+int
+gbm_bo_get_plane_count(struct gbm_bo *bo);
+
int
gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
void (*bo_unmap)(struct gbm_bo *bo, void *map_data);
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);
void (*bo_destroy)(struct gbm_bo *bo);
struct gbm_surface *(*surface_create)(struct gbm_device *gbm,