summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorStan Iliev <stani@google.com>2020-07-16 17:03:27 -0400
committerStan Iliev <stani@google.com>2020-07-16 23:40:13 +0000
commit6b8abeba401a674e37ecb291319abc0494b31c1d (patch)
tree4cda7b8a41564715cb1b77329dad5d5a228d1343 /libs
parent274ce4442a822efa8ec3b86468c77049eec67762 (diff)
Fix TextureView calling eglCreateImage with a destructed buffer
Fix an issue with hardware buffer passed from the SurfaceTexture being destroyed before an SkImage is created. This CL is matched by a change in frameworks/native I2e025e683052168546f2e271a20a857b1e556b64. Test: Ran TextureView CTS tests and a few apps that use TextureView. Test: Fix verified by partner Mediatek Bug: 160930384 Bug: 152781833 Bug: 153045874 Bug: 156047948 Bug: 160514803 Bug: 155545635 Bug: 155171712 Change-Id: I4d121f087fc842ce317745e7b7e2656f80a52b7d (cherry picked from commit d125b447d7e1c29cb97f59aa58fd6bff8769a19f)
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/DeferredLayerUpdater.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/libs/hwui/DeferredLayerUpdater.cpp b/libs/hwui/DeferredLayerUpdater.cpp
index 5a50245a3765..67d8c07e61de 100644
--- a/libs/hwui/DeferredLayerUpdater.cpp
+++ b/libs/hwui/DeferredLayerUpdater.cpp
@@ -149,6 +149,9 @@ void DeferredLayerUpdater::apply() {
sk_sp<SkImage> layerImage = mImageSlots[slot].createIfNeeded(
hardwareBuffer, dataspace, newContent,
mRenderState.getRenderThread().getGrContext());
+ // unref to match the ref added by ASurfaceTexture_dequeueBuffer. eglCreateImageKHR
+ // (invoked by createIfNeeded) will add a ref to the AHardwareBuffer.
+ AHardwareBuffer_release(hardwareBuffer);
if (layerImage.get()) {
SkMatrix textureTransform;
mat4(transformMatrix).copyTo(textureTransform);