sf: vds: Selectively compose displays via HWC.

1. Replace static force copy flag with member variable

The decision to copy a virtual display using the WriteBack path will be
done when the display is created. We initialize the member variable to
false meaning all virtual display devices are composed via GLES.

2. Select which displays to compose based on sink usage flags

We should compose a display using HWC only if the sink usage contains
GRALLOC_USAGE_PRIVATE_WFD and GRALLOC_USAGE_HW_VIDEO_ENCODER flags.

If this condition is not met then the display is composed using GLES.
This means that GLES composes directly into the sink buffer and signals
the consumer. Furthermore, it is expected that any color conversion will
be handled on the consumer side.

3. Add debug hook for ScreenRecord use case

We add a debug hook which serves to by-pass the checks imposed by (2).
This is useful for debugging purposes and allows us to test VDS
end-to-end when WFD is not working on a particular build.

The debug hook is through the system property: debug.hwc.screenrecord

4. Update composition checks

-mFbProducerSlot is always at least 0 so there is no point in validating
 it when in advanceFrame().
-Release scratch buffers in onFrameCommitted as long as mFbProducerSlot
 is valid.

Change-Id: I2964e2f8d0b3e848895cdf4f41df8a5d2739ddad

Conflicts:
services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
Change-Id: I2d2fc152f14487c4f24dbfb210c81c21346bdbe3
3 files changed