summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drv.c19
-rw-r--r--drv.h4
-rw-r--r--drv_priv.h1
3 files changed, 19 insertions, 5 deletions
diff --git a/drv.c b/drv.c
index b43b771..fab9958 100644
--- a/drv.c
+++ b/drv.c
@@ -411,10 +411,9 @@ success:
int drv_bo_unmap(struct bo *bo, struct map_info *data)
{
- int ret = 0;
-
- assert(data);
- assert(data->refcount >= 0);
+ int ret = drv_bo_flush(bo, data);
+ if (ret)
+ return ret;
pthread_mutex_lock(&bo->drv->driver_lock);
@@ -429,6 +428,18 @@ int drv_bo_unmap(struct bo *bo, struct map_info *data)
return ret;
}
+int drv_bo_flush(struct bo *bo, struct map_info *data)
+{
+ int ret = 0;
+ assert(data);
+ assert(data->refcount >= 0);
+
+ if (bo->drv->backend->bo_flush)
+ ret = bo->drv->backend->bo_flush(bo, data);
+
+ return ret;
+}
+
uint32_t drv_bo_get_width(struct bo *bo)
{
return bo->width;
diff --git a/drv.h b/drv.h
index e4678a1..f9a7a87 100644
--- a/drv.h
+++ b/drv.h
@@ -113,7 +113,9 @@ struct bo *drv_bo_import(struct driver *drv, struct drv_import_fd_data *data);
void *drv_bo_map(struct bo *bo, uint32_t x, uint32_t y, uint32_t width, uint32_t height,
uint32_t flags, struct map_info **map_data, size_t plane);
-int drv_bo_unmap(struct bo *bo, struct map_info *map_data);
+int drv_bo_unmap(struct bo *bo, struct map_info *data);
+
+int drv_bo_flush(struct bo *bo, struct map_info *data);
uint32_t drv_bo_get_width(struct bo *bo);
diff --git a/drv_priv.h b/drv_priv.h
index fed6c19..e7b2d25 100644
--- a/drv_priv.h
+++ b/drv_priv.h
@@ -77,6 +77,7 @@ struct backend {
int (*bo_import)(struct bo *bo, struct drv_import_fd_data *data);
void *(*bo_map)(struct bo *bo, struct map_info *data, size_t plane, int prot);
int (*bo_unmap)(struct bo *bo, struct map_info *data);
+ int (*bo_flush)(struct bo *bo, struct map_info *data);
uint32_t (*resolve_format)(uint32_t format, uint64_t usage);
};