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
(cherry picked from commit bd9e66710bec76c16d8d45a6c1a4b58691a391a7)