hwc: Process only MAX_NUM_LAYERS
If the incoming layer count exceeds MAX_NUM_LAYERS,
let surfaceflinger handle the list.
CRs-fixed: 456906
Change-Id: I53159104e5e714ba313d0196ca959f55c82e18ae
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index c2688b5..f657554 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -124,9 +124,8 @@
hwc_display_contents_1_t *list) {
hwc_context_t* ctx = (hwc_context_t*)(dev);
const int dpy = HWC_DISPLAY_PRIMARY;
- if (LIKELY(list && list->numHwLayers > 1) &&
- ctx->dpyAttr[dpy].isActive) {
-
+ if (LIKELY(list && list->numHwLayers > 1 &&
+ list->numHwLayers <= MAX_NUM_LAYERS) && ctx->dpyAttr[dpy].isActive) {
uint32_t last = list->numHwLayers - 1;
hwc_layer_1_t *fbLayer = &list->hwLayers[last];
if(fbLayer->handle) {
@@ -151,7 +150,8 @@
hwc_display_contents_1_t *list, int dpy) {
hwc_context_t* ctx = (hwc_context_t*)(dev);
- if (LIKELY(list && list->numHwLayers > 1) &&
+ if (LIKELY(list && list->numHwLayers > 1 &&
+ list->numHwLayers <= MAX_NUM_LAYERS) &&
ctx->dpyAttr[dpy].isActive &&
ctx->dpyAttr[dpy].connected) {
uint32_t last = list->numHwLayers - 1;