minigbm: i915: Allow protected allocations
Allow allocations with BO_USE_PROTECTED.
Moreover, disallow mapping of such BOs, as for GBM/Gralloc API callers
it should not be mappable and considered as metadata alone, without
usable content.
BUG=b:64323695
TEST=emerge-eve arc-cros-gralloc
Change-Id: I1dd1846a2042f97eee2fcc7581a91a60854e62cc
Reviewed-on: https://chromium-review.googlesource.com/607808
Commit-Ready: Pawel Osciak <posciak@chromium.org>
Tested-by: Pawel Osciak <posciak@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
diff --git a/drv.c b/drv.c
index 3ea46e6..3ccf16e 100644
--- a/drv.c
+++ b/drv.c
@@ -396,6 +396,8 @@
assert(x + width <= drv_bo_get_width(bo));
assert(y + height <= drv_bo_get_height(bo));
assert(BO_MAP_READ_WRITE & map_flags);
+ /* No CPU access for protected buffers. */
+ assert(!(bo->use_flags & BO_USE_PROTECTED));
pthread_mutex_lock(&bo->drv->driver_lock);
@@ -470,6 +472,7 @@
int ret = 0;
assert(data);
assert(data->refcount >= 0);
+ assert(!(bo->use_flags & BO_USE_PROTECTED));
if (bo->drv->backend->bo_flush)
ret = bo->drv->backend->bo_flush(bo, data);