Skip to content

android: Acquire ahardwarebuffer

David Stevens requested to merge dgstevens/mesa:acquire-ahardwarebuffer into master

This merge request fixes a non-compliance issue with ANDROID_get_native_client_buffer. The spec requires that AHardwareBuffers passed to eglGetNativeClientBufferANDROID are kept alive longer than any EGLImages to which they are bound. This merge request acquires a reference to an AHardwareBuffer while it is bound to an EGLImage.

Before this change, although the underlying buffer is retained, the AHardwareBuffer itself may be freed. This causes problems in the Android framework API level >=30, as DeferredLayerUpdater ends up using dangling pointers as cache keys, which can cause it to reuse stale images if the AHardwareBuffer memory gets reallocated as a new AHardwareBuffer.

Edited by David Stevens

Merge request reports