+ ATOMIC_UNLOCK(&drv->driver_lock);
+
+ return bo;
+}
+
+struct bo *drv_bo_create_with_modifiers(struct driver *drv, uint32_t width, uint32_t height,
+ uint32_t format, const uint64_t *modifiers, uint32_t count)
+{
+ int ret;
+ size_t plane;
+ struct bo *bo;
+
+ if (!drv->backend->bo_create_with_modifiers) {
+ errno = ENOENT;
+ return NULL;
+ }
+
+ bo = drv_bo_new(drv, width, height, format, BO_USE_NONE);
+
+ if (!bo)
+ return NULL;
+
+ ret = drv->backend->bo_create_with_modifiers(bo, width, height, format, modifiers, count);
+
+ if (ret) {
+ free(bo);
+ return NULL;
+ }
+
+ ATOMIC_LOCK(&drv->driver_lock);
+
+ for (plane = 0; plane < bo->num_planes; plane++) {
+ if (plane > 0)
+ assert(bo->offsets[plane] >= bo->offsets[plane - 1]);
+
+ drv_increment_reference_count(drv, bo, plane);
+ }
+
+ ATOMIC_UNLOCK(&drv->driver_lock);