drm_hwcomposer: fix pre comp regions during protected playback

During protected video playback an issue could happen when there are layers
below the protected video surface. The current logic in protected plane
provisioning logic includes all layers below the protected layer in precomp
plane in order to draw holes in these. However, when there are other layers in
place, in particular one that has blending (ex. PREMULT). For example:

Layers: count=3
  [0] blending[a=255]=NONE display_frame[x/y/w/h]=0/125/2560/1438
  [1] protected blending[a=255]=NONE display_frame[x/y/w/h]=0/181/2560/1438
  [2] blending[a=255]=PREMULT display_frame[x/y/w/h]=0/0/2560/1800
Planes: count=3
  [0] plane=17 type=LAYER source_layer=1
  [1] plane=22 type=LAYER source_layer=2
  [2] plane=23 type=PRECOMP source_layer=0
Squash Regions: count=0
Pre-Comp Regions: count=0

In this case, layer[0] is below protected surface (layer[1]). This causes
issues because precomp plane is setup to be on the highest z-order all the
time, and any time it isn't it expects any layers with higher z-order will
obscure some contents of the precomp layer. But in this case the layer on top
(layer[2]) has blending enabled (PREMULT) and is transparent so expectation is
that layer[0] is also rendered and blended with layer[2].

By merging any layer that is of higher z-order (layer[2] in example) to precomp
plane, all these layers can be handled during pre composition.

Bug: 36879178
Change-Id: I9b63b37fef0ae828c4a781e0d1da264d8a3d7a76
3 files changed