summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2015-10-12 21:39:44 +0200
committerAndreas Schneider <asn@cryptomilk.org>2015-10-12 21:39:44 +0200
commitc95a62054afad39d8e4b0b169fd64c502b734413 (patch)
tree2d8d6722a902d5d324ad6823bb4deca08b872f7b
parentbb3166f5da4dd43bb03637668bc66e6227c24129 (diff)
downloadandroid_hardware_samsung_slsi_exynos5430-c95a62054afad39d8e4b0b169fd64c502b734413.tar.gz
android_hardware_samsung_slsi_exynos5430-c95a62054afad39d8e4b0b169fd64c502b734413.tar.xz
android_hardware_samsung_slsi_exynos5430-c95a62054afad39d8e4b0b169fd64c502b734413.zip
gralloc: Add some better debug output
-rwxr-xr-xinclude/gralloc_priv.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/gralloc_priv.h b/include/gralloc_priv.h
index 1e51f31..01a6e4a 100755
--- a/include/gralloc_priv.h
+++ b/include/gralloc_priv.h
@@ -156,6 +156,28 @@ struct private_handle_t {
static int validate(const native_handle* h) {
const private_handle_t* hnd = (const private_handle_t*)h;
+
+#if 0
+ if (!h) {
+ ALOGE("invalid gralloc handle (NULL)");
+ } else if (h->version != sizeof(native_handle)) {
+ ALOGE("invalid gralloc handle (at %p) - version=%lu (expected=%lu)",
+ reinterpret_cast<void *>(const_cast<native_handle *>(h)),
+ (unsigned long)h->version,
+ (unsigned long)sizeof(native_handle));
+ } else if (hnd->numInts + hnd->numFds != sNumInts + sNumFds) {
+ ALOGE("invalid gralloc handle (at %p) - "
+ "hnd->numInts(%d) + hnd->numFds(%d) != sNumInts(%d) + sNumFds(%d)",
+ reinterpret_cast<void *>(const_cast<native_handle *>(h)),
+ hnd->numInts, hnd->numFds, sNumInts, sNumFds);
+ } else if (hnd->magic != sMagic) {
+ ALOGE("invalid gralloc handle (at %p) - "
+ "hnd->magic(%x) != sMagic(%x)",
+ reinterpret_cast<void *>(const_cast<native_handle *>(h)),
+ hnd->magic, sMagic);
+ }
+#endif
+
if (!h || h->version != sizeof(native_handle) ||
hnd->numInts + hnd->numFds != sNumInts + sNumFds ||
hnd->magic != sMagic)