return (uint32_t)stride;
}
-static int64_t
+static uint32_t
gbm_dri_bo_get_offset(struct gbm_bo *_bo, int plane)
{
struct gbm_dri_device *dri = gbm_dri_device(_bo->gbm);
struct gbm_dri_bo *bo = gbm_dri_bo(_bo);
int offset = 0;
- if (!dri->image || dri->image->base.version < 13 || !dri->image->fromPlanar) {
- errno = ENOSYS;
- return -1;
- }
+ /* These error cases do not actually return an error code, as the user
+ * will also fail to obtain the handle/FD from the BO. In that case, the
+ * offset is irrelevant, as they have no buffer to offset into, so
+ * returning 0 is harmless.
+ */
+ if (!dri->image || dri->image->base.version < 13 || !dri->image->fromPlanar)
+ return 0;
- if (plane >= get_number_planes(dri, bo->image)) {
- errno = EINVAL;
- return -2;
- }
+ if (plane >= get_number_planes(dri, bo->image))
+ return 0;
/* Dumb images have no offset */
if (bo->image == NULL) {
* \param bo The buffer object
* \return The offset
*/
-GBM_EXPORT int64_t
+GBM_EXPORT uint32_t
gbm_bo_get_offset(struct gbm_bo *bo, int plane)
{
return bo->gbm->bo_get_offset(bo, plane);
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);
- int64_t (*bo_get_offset)(struct gbm_bo *bo, int plane);
+ uint32_t (*bo_get_offset)(struct gbm_bo *bo, int plane);
uint64_t (*bo_get_modifier)(struct gbm_bo *bo);
void (*bo_destroy)(struct gbm_bo *bo);