Dedicate a special caching slot for the layer override buffer

By using a special caching slot, this avoids import/freeBuffer churn in
the composer process which can occur when a layer is no longer using an
override buffer. Previously the layer's buffer would have been cached by
a previous setBuffer call, but since the override buffer was clobbering
a caching slot, replacing the override buffer requires re-importing the
buffer.

To resolve this, increase the size of the hwc buffer cache so it's ever
so slightly less tied to buffer queue sizes, which allows for room for
the override buffer which improves caching hit rate. On devices that
don't have layer caching turned on, this is a functional no-op because
those devices will never use the additional caching slot.

Bug: 185570241
Test: libcompositionengine_test
Test: Perfetto trace of opening and closing calculator app shows fewer
import/free buffers in the composer process

Change-Id: I219b1a1f6a31c5405736cb06d4921f300fe4a3ee
diff --git a/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp b/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp
index cedc333..f95382d 100644
--- a/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/HwcBufferCache.cpp
@@ -36,7 +36,7 @@
                                   sp<GraphicBuffer>* outBuffer) {
     // default is 0
     if (slot == BufferQueue::INVALID_BUFFER_SLOT || slot < 0 ||
-        slot >= BufferQueue::NUM_BUFFER_SLOTS) {
+        slot >= static_cast<int32_t>(kMaxLayerBufferCount)) {
         *outSlot = 0;
     } else {
         *outSlot = static_cast<uint32_t>(slot);