Plumb buffer map permissions through gbm.
Map read/write permissions were being ignored by minigbm. This can
cause segfaults or failed mappings if the device FD permissions are not
rw.
Also adds bounds checking in tegra.c for tile/untile transfers.
BUG=chromium:737328
TEST=cyan, nyan graphicsSanity with read only on device
Change-Id: I8fccaed4e908cda3ff7d7cf451d0ad75d65039e6
Reviewed-on: https://chromium-review.googlesource.com/556980
Commit-Ready: Joe Kniss <djmk@google.com>
Tested-by: Joe Kniss <djmk@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
diff --git a/vc4.c b/vc4.c
index 99896b9..c797bd9 100644
--- a/vc4.c
+++ b/vc4.c
@@ -62,7 +62,7 @@
return 0;
}
-static void *vc4_bo_map(struct bo *bo, struct map_info *data, size_t plane)
+static void *vc4_bo_map(struct bo *bo, struct map_info *data, size_t plane, int prot)
{
int ret;
struct drm_vc4_mmap_bo bo_map;
@@ -77,9 +77,7 @@
}
data->length = bo->total_size;
-
- return mmap(0, bo->total_size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->drv->fd,
- bo_map.offset);
+ return mmap(0, bo->total_size, prot, MAP_SHARED, bo->drv->fd, bo_map.offset);
}
struct backend backend_vc4 = {