Vulkan: Ensure swapchain gets enough images for MAILBOX.

The Vulkan specification for MAILBOX allows for a swapchain to be
created with 3 images, assuming 1 "current image": one image is
displayed, and the app can ping-pong between the other 2.
MAILBOX mode is the equivalent of eglSwapInterval(0).
The platform swapchain code always added min_undequeued_buffers-1
(i.e. normally 1) to what the app requested for MAILBOX.

Apps often request the advertised minimum of 2.  However, a SF and HWC
change, some time ago, resulted in HWC displaying 1 image, SF latching
another image, and the app blocked ~30% of the time.  This equates to
a "current image" count of 2, breaking MAILBOX with 3 images.  Nobody
noticed this until ANGLE discovered that the glmark2 composite score
decreased when it only asked for minimum (2) images (per the spec).

Analysis determined that 4 images are needed in order to get the
ping-pong semantics of MAILBOX, and to not slow down benchmarks.  When
this was tried, glmark2's composite score increased by 30%.

In talking with the SF team, we realized what happened.  The agreement
is that we need to ensure that the Vulkan swapchain code needs to
ensure that the swapchain has at least 4 images (in the normal case)
when MAILBOX is enabled.  This CL still honors min_undequeued_buffers,
for cases when it's higher than the normal 2 for MAILBOX.

Bug: b/132806469
Test: Run glmark2 with ANGLE
Change-Id: I152f61f318236fd4718895aec7188135ee849f46
1 file changed