minigbm: drv_bo_flush --> drv_bo_flush_or_unmap
There's no flush or invalidate mechnaism with the DRI interface,
so we'll have to support mapping and unmapping.
BUG=b:72972511
TEST=gbmtest passes in CQ
Change-Id: If3aef651f8549544ed4ed499e17f7f99c597974c
Reviewed-on: https://chromium-review.googlesource.com/990892
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-by: Joe Kniss <djmk@google.com>
Reviewed-by: Satyajit Sahu <satyajit.sahu@amd.com>
diff --git a/cros_gralloc/cros_gralloc_buffer.cc b/cros_gralloc/cros_gralloc_buffer.cc
index 40a2083..0301af1 100644
--- a/cros_gralloc/cros_gralloc_buffer.cc
+++ b/cros_gralloc/cros_gralloc_buffer.cc
@@ -90,7 +90,7 @@
if (!--lockcount_) {
if (lock_data_[0]) {
- drv_bo_flush(bo_, lock_data_[0]);
+ drv_bo_flush_or_unmap(bo_, lock_data_[0]);
lock_data_[0] = nullptr;
}
}
diff --git a/drv.c b/drv.c
index c7ac816..8970d4c 100644
--- a/drv.c
+++ b/drv.c
@@ -466,9 +466,7 @@
int drv_bo_unmap(struct bo *bo, struct mapping *mapping)
{
uint32_t i;
- int ret = drv_bo_flush(bo, mapping);
- if (ret)
- return ret;
+ int ret = 0;
pthread_mutex_lock(&bo->drv->driver_lock);
@@ -507,7 +505,7 @@
return ret;
}
-int drv_bo_flush(struct bo *bo, struct mapping *mapping)
+int drv_bo_flush_or_unmap(struct bo *bo, struct mapping *mapping)
{
int ret = 0;
@@ -519,6 +517,8 @@
if (bo->drv->backend->bo_flush)
ret = bo->drv->backend->bo_flush(bo, mapping);
+ else
+ ret = drv_bo_unmap(bo, mapping);
return ret;
}
diff --git a/drv.h b/drv.h
index 2271a9f..09aa33f 100644
--- a/drv.h
+++ b/drv.h
@@ -130,7 +130,7 @@
int drv_bo_invalidate(struct bo *bo, struct mapping *mapping);
-int drv_bo_flush(struct bo *bo, struct mapping *mapping);
+int drv_bo_flush_or_unmap(struct bo *bo, struct mapping *mapping);
uint32_t drv_bo_get_width(struct bo *bo);
diff --git a/gbm.c b/gbm.c
index 25b4fa0..a720461 100644
--- a/gbm.c
+++ b/gbm.c
@@ -249,7 +249,7 @@
PUBLIC void gbm_bo_unmap(struct gbm_bo *bo, void *map_data)
{
assert(bo);
- drv_bo_flush(bo->bo, map_data);
+ drv_bo_flush_or_unmap(bo->bo, map_data);
}
PUBLIC uint32_t gbm_bo_get_width(struct gbm_bo *bo)