Implement OpenGL readback via access to private HAL data

On Adreno 330, reading back a GL texture that is bound to an EGLImage
and native Android window buffer will lead to artifacts. Some rows in
the image data will occasionally be null.

To work around this issue, access the underlying buffer data directly
from GPU to CPU memory. For this to work, access to internal HAL data
structures is required; therefore this patch is highly
platform-specific.

This issue affects all CtsUiRenderingTestCases that use
Bitmap.Config.HARDWARE, testBitmapConfigFromHardwareToHardware being the
minimal example amongst them.

[The following fix is squashed into the commit here]

Check transforms params in EGLImage readback workaround

The workaround does currently not implement texture transformation,
neither via transformation matrix, nor via scaling defined via different
sizes of source rect, source GraphicBuffer and destination bitmap. Fall
back to the default implementation in all those cases.

[Squashed commit:
  Change-Id: I6157fcd7cb9d93f94cb088ff1dc50dab760e766d]
  (cherry picked from commit 9f98001400bd8ccbe087de91566d3af1f7b13a68)]

Port to Android 10:
* Adapt to refactored common Readback implementation. Currently the
  workaround is not applied for copyLayerInto on layers, which doesn't
  seem to be relevant anyway.

Issue: FP2P-425
Issue: FP2P-452
Issue: FP2A10-13
Test: adb shell setprop hwui.private_hal_readback 1
Test: run cts -m CtsUiRenderingTestCases
  -t android.uirendering.cts.testclasses.HardwareBitmapTests#testBitmapConfigFromHardwareToHardware
Test: run cts -m CtsViewTestCases -t android.view.cts.PixelCopyTest
Test: run cts -m CtsViewTestCases -t android.view.cts.TextureViewCameraTest
Change-Id: I9aeb21b12367dea428253cdb9cc2319692e5f329
(cherry picked from commit 46f7a11019bc0ba4a737dc1873e0e97a83491504)
1 file changed