From 82a40187e0edfab9f3f2058a4f580bd57252cbca Mon Sep 17 00:00:00 2001 From: Saurabh Shah Date: Sat, 25 Aug 2012 19:29:53 -0700 Subject: [PATCH] overlay: Remove OVASSERT from getFormatString utility Remove OVASSERT from getFormatString utility. OVASSERTS should happen only from critically wrong states of overlay. Just failing in this utility method would allow a fall back to GPU. Change-Id: I4467a750574ee90aee4fa2e0fbb041e7f386a63b --- liboverlay/overlayUtils.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/liboverlay/overlayUtils.h b/liboverlay/overlayUtils.h index 21d5521..a88c0d9 100644 --- a/liboverlay/overlayUtils.h +++ b/liboverlay/overlayUtils.h @@ -478,7 +478,7 @@ int getRotOutFmt(uint32_t format); * rotation is 90, 180 etc * It returns MDP related enum/define that match rot+flip*/ int getMdpOrient(eTransform rotation); -const char* getFormatString(uint32_t format); +const char* getFormatString(int format); const char* getStateString(eOverlayState state); // Cannot use HW_OVERLAY_MAGNIFICATION_LIMIT, since at the time @@ -579,7 +579,7 @@ inline bool isValidDest(eDest dest) return false; } -inline const char* getFormatString(uint32_t format){ +inline const char* getFormatString(int format){ static const char* const formats[] = { "MDP_RGB_565", "MDP_XRGB_8888", @@ -611,8 +611,10 @@ inline const char* getFormatString(uint32_t format){ "MDP_FB_FORMAT", "MDP_IMGTYPE_LIMIT2" }; - OVASSERT(format < sizeof(formats) / sizeof(formats[0]), - "getFormatString wrong fmt %d", format); + if(format < 0 || format >= (int)(sizeof(formats) / sizeof(formats[0]))) { + ALOGE("%s wrong fmt %d", __FUNCTION__, format); + return "Unsupported format"; + } return formats[format]; }