OSDN Git Service

minigbm: drv_bo_flush --> drv_bo_flush_or_unmap
authorGurchetan Singh <gurchetansingh@chromium.org>
Thu, 29 Mar 2018 23:34:53 +0000 (16:34 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Fri, 6 Apr 2018 05:12:44 +0000 (22:12 -0700)
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>
cros_gralloc/cros_gralloc_buffer.cc
drv.c
drv.h
gbm.c

index 40a2083..0301af1 100644 (file)
@@ -90,7 +90,7 @@ int32_t cros_gralloc_buffer::unlock()
 
        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 (file)
--- a/drv.c
+++ b/drv.c
@@ -466,9 +466,7 @@ exact_match:
 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 @@ int drv_bo_invalidate(struct bo *bo, struct mapping *mapping)
        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 @@ int drv_bo_flush(struct bo *bo, struct mapping *mapping)
 
        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 (file)
--- a/drv.h
+++ b/drv.h
@@ -130,7 +130,7 @@ int drv_bo_unmap(struct bo *bo, struct mapping *mapping);
 
 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 (file)
--- a/gbm.c
+++ b/gbm.c
@@ -249,7 +249,7 @@ PUBLIC void *gbm_bo_map(struct gbm_bo *bo, uint32_t x, uint32_t y, uint32_t widt
 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)