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/helpers.h b/helpers.h
index b42a3c2..dc1a7c0 100644
--- a/helpers.h
+++ b/helpers.h
@@ -16,7 +16,7 @@
 int drv_dumb_bo_destroy(struct bo *bo);
 int drv_gem_bo_destroy(struct bo *bo);
 int drv_prime_bo_import(struct bo *bo, struct drv_import_fd_data *data);
-void *drv_dumb_bo_map(struct bo *bo, struct map_info *data, size_t plane);
+void *drv_dumb_bo_map(struct bo *bo, struct map_info *data, size_t plane, int prot);
 uintptr_t drv_get_reference_count(struct driver *drv, struct bo *bo, size_t plane);
 void drv_increment_reference_count(struct driver *drv, struct bo *bo, size_t plane);
 void drv_decrement_reference_count(struct driver *drv, struct bo *bo, size_t plane);