minigbm: pass in map flags to (*bo_map) callback
Some eagle-eyed observers have commented that we lose some
potentially useful information for the (*bo_map) callback when
we convert our map flags to page protection flags. Let's not
lose this information, so pass in the map flags. We can convert
to page protection flags using a helper function.
BUG=chromium:764871
TEST=Boot Android and play games on Eve
Change-Id: Ie2cf395109eb5a8de663dfb97a343d20ff0df30c
Reviewed-on: https://chromium-review.googlesource.com/691425
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
diff --git a/mediatek.c b/mediatek.c
index b999e28..8494c3d 100644
--- a/mediatek.c
+++ b/mediatek.c
@@ -78,7 +78,7 @@
return 0;
}
-static void *mediatek_bo_map(struct bo *bo, struct map_info *data, size_t plane, int prot)
+static void *mediatek_bo_map(struct bo *bo, struct map_info *data, size_t plane, uint32_t map_flags)
{
int ret;
struct drm_mtk_gem_map_off gem_map;
@@ -93,7 +93,8 @@
return MAP_FAILED;
}
- void *addr = mmap(0, bo->total_size, prot, MAP_SHARED, bo->drv->fd, gem_map.offset);
+ void *addr = mmap(0, bo->total_size, drv_get_prot(map_flags), MAP_SHARED, bo->drv->fd,
+ gem_map.offset);
data->length = bo->total_size;