OSDN Git Service

cros_gralloc: Use entire graphics buffer if all-zeros access region is specified
authorMatthias Springer <springerm@google.com>
Mon, 3 Feb 2020 07:40:09 +0000 (16:40 +0900)
committerCommit Bot <commit-bot@chromium.org>
Fri, 14 Feb 2020 10:39:40 +0000 (10:39 +0000)
This is a requirement of gralloc and the graphics.mapper HAL in Android.

BUG=b:143924619
TEST=Photo capture in GCA succeeds and most camera CTS tests pass

Change-Id: Ic34a49aa7175c1c3b9f6c0738b5ab848e002b93d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2035207
Tested-by: Matthias Springer <springerm@chromium.org>
Commit-Queue: Matthias Springer <springerm@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Auto-Submit: Matthias Springer <springerm@chromium.org>

cros_gralloc/cros_gralloc_buffer.cc

index 0301af1..01d4038 100644 (file)
@@ -65,7 +65,18 @@ int32_t cros_gralloc_buffer::lock(const struct rectangle *rect, uint32_t map_fla
                        drv_bo_invalidate(bo_, lock_data_[0]);
                        vaddr = lock_data_[0]->vma->addr;
                } else {
-                       vaddr = drv_bo_map(bo_, rect, map_flags, &lock_data_[0], 0);
+                       struct rectangle r = *rect;
+
+                       if (!r.width && !r.height && !r.x && !r.y) {
+                               /*
+                                * Android IMapper.hal: An accessRegion of all-zeros means the
+                                * entire buffer.
+                                */
+                               r.width = drv_bo_get_width(bo_);
+                               r.height = drv_bo_get_height(bo_);
+                       }
+
+                       vaddr = drv_bo_map(bo_, &r, map_flags, &lock_data_[0], 0);
                }
 
                if (vaddr == MAP_FAILED) {