hwc: Use layerIndex while populating hw layers
Use layerIndex instead of dpy while populating layers from the layer
list of each display.
Change-Id: I6bb4401482afc859447b58fcb6c5daa11a23fcd8
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 154fb4e..0396c91 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -132,19 +132,21 @@
if(ctx->mRotMgr->getNumActiveSessions() == 0)
Overlay::setDMAMode(Overlay::DMA_LINE_MODE);
- for(int i = 0; i < numDisplays; i++) {
- hwc_display_contents_1_t *list = displays[i];
+ for(int dpy = 0; dpy < numDisplays; dpy++) {
+ hwc_display_contents_1_t *list = displays[dpy];
if (LIKELY(list && list->numHwLayers > 0)) {
- for(size_t j = 0; j < list->numHwLayers; j++) {
- if(list->hwLayers[j].compositionType != HWC_FRAMEBUFFER_TARGET)
+ for(size_t layerIndex = 0; layerIndex < list->numHwLayers;
+ layerIndex++) {
+ if(list->hwLayers[layerIndex].compositionType !=
+ HWC_FRAMEBUFFER_TARGET)
{
- hwc_layer_1_t const* layer = &list->hwLayers[i];
+ hwc_layer_1_t const* layer = &list->hwLayers[layerIndex];
private_handle_t *hnd = (private_handle_t *)layer->handle;
/* If a video layer requires rotation, set the DMA state
* to BLOCK_MODE */
- if (UNLIKELY(isYuvBuffer(hnd)) && canUseRotator(ctx,i) &&
+ if (UNLIKELY(isYuvBuffer(hnd)) && canUseRotator(ctx, dpy) &&
(layer->transform & HWC_TRANSFORM_ROT_90)) {
if(not ctx->mOverlay->isDMAMultiplexingSupported()) {
if(ctx->mOverlay->isPipeTypeAttached(
@@ -155,7 +157,7 @@
}
}
}
- if(i) {
+ if(dpy) {
/* Uncomment the below code for testing purpose.
Assuming the orientation value is in terms of HAL_TRANSFORM,
this needs mapping to HAL, if its in different convention */