X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=drv.c;h=636cd07f1b8985b19795ff2bde2932171e058947;hb=25ff66748d4b08e7059aad06d967128681838fd4;hp=e5e0be66ac0209b8dc8eda8832858b6f3f5a7449;hpb=cfd96315f8956d2bc647f7fcb774cdf1af91bf90;p=android-x86%2Fexternal-minigbm.git diff --git a/drv.c b/drv.c index e5e0be6..636cd07 100644 --- a/drv.c +++ b/drv.c @@ -54,6 +54,9 @@ extern const struct backend backend_radeon; #ifdef DRV_ROCKCHIP extern const struct backend backend_rockchip; #endif +#ifdef DRV_SYNAPTICS +extern const struct backend backend_synaptics; +#endif #ifdef DRV_TEGRA extern const struct backend backend_tegra; #endif @@ -104,6 +107,9 @@ static const struct backend *drv_get_backend(int fd) #ifdef DRV_ROCKCHIP &backend_rockchip, #endif +#ifdef DRV_SYNAPTICS + &backend_synaptics, +#endif #ifdef DRV_TEGRA &backend_tegra, #endif @@ -111,7 +117,7 @@ static const struct backend *drv_get_backend(int fd) #ifdef DRV_VC4 &backend_vc4, #endif - &backend_vgem, &backend_virtio_gpu, + &backend_vgem, &backend_virtio_gpu, }; for (i = 0; i < ARRAY_SIZE(backend_list); i++) { @@ -278,11 +284,8 @@ struct bo *drv_bo_create(struct driver *drv, uint32_t width, uint32_t height, ui if (drv->backend->bo_compute_metadata) { ret = drv->backend->bo_compute_metadata(bo, width, height, format, use_flags, NULL, 0); - if (!is_test_alloc && ret == 0) { + if (!is_test_alloc && ret == 0) ret = drv->backend->bo_create_from_metadata(bo); - if (ret == 0) - return bo; - } } else if (!is_test_alloc) { ret = drv->backend->bo_create(bo, width, height, format, use_flags); } @@ -555,6 +558,21 @@ int drv_bo_invalidate(struct bo *bo, struct mapping *mapping) return ret; } +int drv_bo_flush(struct bo *bo, struct mapping *mapping) +{ + int ret = 0; + + assert(mapping); + assert(mapping->vma); + assert(mapping->refcount > 0); + assert(mapping->vma->refcount > 0); + + if (bo->drv->backend->bo_flush) + ret = bo->drv->backend->bo_flush(bo, mapping); + + return ret; +} + int drv_bo_flush_or_unmap(struct bo *bo, struct mapping *mapping) { int ret = 0; @@ -645,6 +663,11 @@ uint32_t drv_bo_get_format(struct bo *bo) return bo->meta.format; } +size_t drv_bo_get_total_size(struct bo *bo) +{ + return bo->meta.total_size; +} + uint32_t drv_resolve_format(struct driver *drv, uint32_t format, uint64_t use_flags) { if (drv->backend->resolve_format) @@ -688,3 +711,17 @@ void drv_log_prefix(const char *prefix, const char *file, int line, const char * #endif va_end(args); } + +int drv_resource_info(struct bo *bo, uint32_t strides[DRV_MAX_PLANES], + uint32_t offsets[DRV_MAX_PLANES]) +{ + for (uint32_t plane = 0; plane < bo->meta.num_planes; plane++) { + strides[plane] = bo->meta.strides[plane]; + offsets[plane] = bo->meta.offsets[plane]; + } + + if (bo->drv->backend->resource_info) + return bo->drv->backend->resource_info(bo, strides, offsets); + + return 0; +}