platformdrmgeneric: get the gralloc usage directly from the handle
There's no point in using a gralloc perform() op to retrieve the usage as
it is already stored in the handle like width, height, format, etc. So just
copy it to the hwc_drm_bo_t and get it directly.
Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
diff --git a/hwcutils.cpp b/hwcutils.cpp
index 0091575..53a7d82 100644
--- a/hwcutils.cpp
+++ b/hwcutils.cpp
@@ -159,12 +159,8 @@
if (ret)
return ret;
- ret = gralloc->perform(gralloc, GRALLOC_MODULE_PERFORM_GET_USAGE,
- handle.get(), &gralloc_buffer_usage);
- if (ret) {
- ALOGE("Failed to get usage for buffer %p (%d)", handle.get(), ret);
- return ret;
- }
+ gralloc_buffer_usage = buffer.operator->()->usage;
+
return 0;
}