diff options
author | Gurchetan Singh <gurchetansingh@chromium.org> | 2017-09-14 15:16:15 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-27 23:52:08 -0700 |
commit | 254dbb19c49fad4ab4f28b2d1f2982bd10bb7c0b (patch) | |
tree | bb9c56263641571588e79babcbf54dc7ac506764 | |
parent | 8e02e05537eab60fc39e2c660d41e43be2ac522b (diff) |
minigbm: flush buffer instead of unmapping
As an optimization, let's call:
- drv_bo_flush when calling (*unlock).
- drv_bo_flush during gbm_bo_unmap()
CL:441916 makes sure that the buffer is unmapped before the
buffer destroy ioctl is called, so we will not be leaking
mappings in any case.
BUG=chromium:764871
TEST=Android boots, 8 CTS tests, and Youtube app works on Eve
gbmtest, mmap_test -g
Change-Id: I429739a8c6435a434dac41ad125761364a3775d0
Reviewed-on: https://chromium-review.googlesource.com/668220
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
-rw-r--r-- | cros_gralloc/cros_gralloc_buffer.cc | 9 | ||||
-rw-r--r-- | gbm.c | 2 |
2 files changed, 4 insertions, 7 deletions
diff --git a/cros_gralloc/cros_gralloc_buffer.cc b/cros_gralloc/cros_gralloc_buffer.cc index cec68a5..710b78f 100644 --- a/cros_gralloc/cros_gralloc_buffer.cc +++ b/cros_gralloc/cros_gralloc_buffer.cc @@ -87,12 +87,9 @@ int32_t cros_gralloc_buffer::unlock() return -EINVAL; } - if (!--lockcount_) { - if (lock_data_[0]) { - drv_bo_unmap(bo_, lock_data_[0]); - lock_data_[0] = nullptr; - } - } + --lockcount_; + if (lock_data_[0]) + return drv_bo_flush(bo_, lock_data_[0]); return 0; } @@ -242,7 +242,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_unmap(bo->bo, map_data); + drv_bo_flush(bo->bo, map_data); } PUBLIC uint32_t gbm_bo_get_width(struct gbm_bo *bo) |