From 1a3d791b5de5c5b9dbae70a779a1a400743755c1 Mon Sep 17 00:00:00 2001 From: Lily Ouyang Date: Thu, 23 Jun 2016 13:48:26 +0800 Subject: Check whether the size be supported by HWC. Fall back to GLES if the size isn't be supported. Bug: 29267608 BZ: IMINAN-50487 Change-Id: I542d29556d2e082c7e7630e0023bf660126b2094 Signed-off-by: Lily Ouyang --- moorefield_hdmi/ips/anniedale/PlaneCapabilities.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/moorefield_hdmi/ips/anniedale/PlaneCapabilities.cpp b/moorefield_hdmi/ips/anniedale/PlaneCapabilities.cpp index a7fbe48..54b4aee 100755 --- a/moorefield_hdmi/ips/anniedale/PlaneCapabilities.cpp +++ b/moorefield_hdmi/ips/anniedale/PlaneCapabilities.cpp @@ -25,6 +25,9 @@ #define SPRITE_PLANE_MAX_STRIDE_TILED 16384 #define SPRITE_PLANE_MAX_STRIDE_LINEAR 16384 +#define SPRITE_PLANE_MAX_WIDTH 4096 +#define SPRITE_PLANE_MAX_HEIGHT 4096 + #define OVERLAY_PLANE_MAX_STRIDE_PACKED 4096 #define OVERLAY_PLANE_MAX_STRIDE_LINEAR 8192 @@ -173,6 +176,14 @@ bool PlaneCapabilities::isScalingSupported(int planeType, HwcLayer *hwcLayer) dstH = dest.bottom - dest.top; if (planeType == DisplayPlane::PLANE_SPRITE || planeType == DisplayPlane::PLANE_PRIMARY) { + if ((dstW - 1) <= 0 || (dstH - 1) <= 0 || + (dstW - 1) >= SPRITE_PLANE_MAX_WIDTH || + (dstH - 1) >= SPRITE_PLANE_MAX_HEIGHT) { + // Should check size in isSizeSupported(). + DLOGTRACE("invalid destination size: %d x %d, fall back to GLES", dstW, dstH); + return false; + } + // no scaling is supported return ((srcW == dstW) && (srcH == dstH)) ? true : false; -- cgit v1.2.3