cros_gralloc: Add perform action for getting the modifier
BUG=b:145579089, b:79682290
TEST=arc++ apps using non-linear format layouts
Change-Id: I9d71852b52b984d89428a07fad5c82d61150e8a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2316523
Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Kristian H. Kristensen <hoegsberg@chromium.org>
diff --git a/cros_gralloc/gralloc0/gralloc0.cc b/cros_gralloc/gralloc0/gralloc0.cc
index 98ce8c6..2a7b87f 100644
--- a/cros_gralloc/gralloc0/gralloc0.cc
+++ b/cros_gralloc/gralloc0/gralloc0.cc
@@ -31,6 +31,7 @@
GRALLOC_DRM_GET_FORMAT,
GRALLOC_DRM_GET_DIMENSIONS,
GRALLOC_DRM_GET_BACKING_STORE,
+ GRALLOC_DRM_GET_MODIFIER,
};
// clang-format on
@@ -261,6 +262,7 @@
va_list args;
int32_t *out_format, ret;
uint64_t *out_store;
+ uint64_t *out_modifier;
buffer_handle_t handle;
uint32_t *out_width, *out_height, *out_stride;
uint32_t strides[DRV_MAX_PLANES] = { 0, 0, 0, 0 };
@@ -272,6 +274,7 @@
case GRALLOC_DRM_GET_FORMAT:
case GRALLOC_DRM_GET_DIMENSIONS:
case GRALLOC_DRM_GET_BACKING_STORE:
+ case GRALLOC_DRM_GET_MODIFIER:
break;
default:
return -EINVAL;
@@ -316,6 +319,10 @@
out_store = va_arg(args, uint64_t *);
ret = mod->driver->get_backing_store(handle, out_store);
break;
+ case GRALLOC_DRM_GET_MODIFIER:
+ out_modifier = va_arg(args, uint64_t *);
+ *out_modifier = hnd->format_modifier;
+ break;
default:
ret = -EINVAL;
}