libhwcomposer: Enhance mixed mode composition.
While marking layers for cache, neglect the z-order when
possible, to improve the scope of mixed mode usage.
It is safe to neglect the z-order if a static layer
doesn't have any overlapping region with updating layers
in between static layer & contiguous static layers batch.
- if above layer doesn't have any overlapping with updating
layer in middle, push it to the batch.
- If above case fails, but layers below(existing batch) does not
have any overlapping region with the updating layer, bring the
batch to top and modify fb-zorder accordingly.
Change-Id: I4882a750d0a9a2e11272fcbb146202160673d04f
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 47afa85..225db5e 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -923,6 +923,13 @@
crop_b -= crop_h * bottomCutRatio;
}
+bool areLayersIntersecting(const hwc_layer_1_t* layer1,
+ const hwc_layer_1_t* layer2) {
+ hwc_rect_t irect = getIntersection(layer1->displayFrame,
+ layer2->displayFrame);
+ return isValidRect(irect);
+}
+
bool isValidRect(const hwc_rect& rect)
{
return ((rect.bottom > rect.top) && (rect.right > rect.left)) ;