minigbm: More sophisticated gbm_bo_map/gbm_bo_unmap
We previously added the gbm_bo_map/gbm_bo_unmap (see CL:393927)
entry points since we wanted to do driver-specific detiling during
screenshot capture tests. We ignored most the parameters and mapped
the entire buffer. This CL adds the ability to:
1) Return the starting address within a byte given a specific x, y
in the buffer.
2) Handle the case where there are more than one kernel buffers
per buffer object. Currently, only the Exynos driver would use
this capability.
BUG=chromium:653284
TEST=Ran cros_gralloc with modified code
CQ-DEPEND=CL:393927
Change-Id: I19d75d2f16489c0184e96305fb643f18477e1cdb
Reviewed-on: https://chromium-review.googlesource.com/395066
Commit-Ready: Gurchetan Singh <[email protected]>
Tested-by: Gurchetan Singh <[email protected]>
Reviewed-by: Stéphane Marchesin <[email protected]>
diff --git a/i915.c b/i915.c
index d25cbf7..4df5879 100644
--- a/i915.c
+++ b/i915.c
@@ -185,7 +185,7 @@
return 0;
}
-static void *i915_bo_map(struct bo *bo)
+static void *i915_bo_map(struct bo *bo, struct map_info *data, size_t plane)
{
int ret;
struct drm_i915_gem_mmap_gtt gem_map;
@@ -199,6 +199,8 @@
return MAP_FAILED;
}
+ data->length = bo->total_size;
+
return mmap(0, bo->total_size, PROT_READ | PROT_WRITE, MAP_SHARED,
bo->drv->fd, gem_map.offset);
}