graphics_Gralloc: add additional perform test
GRALLOC_DRM_GET_BACKING_STORE returns an unique 64-bit ID for a
buffer. This is a described in gralloc1.h, and currently the
wayland_service in the ARC++ tree makes use of it.
BUG=none
TEST=./gralloctest perform passes
Change-Id: I9dc218bc868494f374c48ab53bef8dfaa87a43c0
Reviewed-on: https://chromium-review.googlesource.com/500649
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Po-Hsien Wang <pwang@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
diff --git a/client/site_tests/graphics_Gralloc/src/gralloctest.c b/client/site_tests/graphics_Gralloc/src/gralloctest.c
index fd92c20..42acac9 100644
--- a/client/site_tests/graphics_Gralloc/src/gralloctest.c
+++ b/client/site_tests/graphics_Gralloc/src/gralloctest.c
@@ -43,6 +43,7 @@
enum { GRALLOC_DRM_GET_STRIDE,
GRALLOC_DRM_GET_FORMAT,
GRALLOC_DRM_GET_DIMENSIONS,
+ GRALLOC_DRM_GET_BACKING_STORE,
};
/* See <system/graphics.h> for definitions. */
@@ -492,8 +493,9 @@
static int test_perform(struct gralloc_module_t *module,
struct alloc_device_t *device)
{
- struct gralloctest test;
+ struct gralloctest test, duplicate;
uint32_t stride, width, height;
+ uint64_t id1, id2;
int32_t format;
gralloctest_init(&test, 650, 408, HAL_PIXEL_FORMAT_BGRA_8888,
@@ -514,6 +516,20 @@
CHECK(width == test.w);
CHECK(height == test.h);
+ native_handle_t *native_handle = duplicate_buffer_handle(test.handle);
+ duplicate.handle = native_handle;
+
+ CHECK(module->perform(module, GRALLOC_DRM_GET_BACKING_STORE,
+ duplicate.handle, &id2));
+ CHECK(register_buffer(module, &duplicate));
+
+ CHECK(module->perform(module, GRALLOC_DRM_GET_BACKING_STORE,
+ test.handle, &id1) == 0);
+ CHECK(module->perform(module, GRALLOC_DRM_GET_BACKING_STORE,
+ duplicate.handle, &id2) == 0);
+ CHECK(id1 == id2);
+
+ CHECK(unregister_buffer(module, &duplicate));
CHECK(deallocate(device, &test));
return 1;