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/drv.h b/drv.h
index d96b30d..a42b23e 100644
--- a/drv.h
+++ b/drv.h
@@ -39,6 +39,12 @@
#define BO_USE_RENDERSCRIPT (1ull << 16)
#define BO_USE_TEXTURE (1ull << 17)
+/* Read-Write permissions for drv_bo_map() flags */
+#define BO_TRANSFER_NONE 0
+#define BO_TRANSFER_READ (1 << 0)
+#define BO_TRANSFER_WRITE (1 << 1)
+#define BO_TRANSFER_READ_WRITE (BO_TRANSFER_READ | BO_TRANSFER_WRITE)
+
/* This is our extension to <drm_fourcc.h>. We need to make sure we don't step
* on the namespace of already defined formats, which can be done by using invalid
* fourcc codes.