Release the surface texture object on allocation destruction.

Change-Id: I0eff42377a36d29cc64a1c23b8263e6f46b43523
diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp
index 3664053..cec99ed 100644
--- a/driver/rsdAllocation.cpp
+++ b/driver/rsdAllocation.cpp
@@ -391,6 +391,17 @@
         delete drv->readBackFBO;
         drv->readBackFBO = NULL;
     }
+
+    if ((alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_IO_OUTPUT) &&
+        (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT)) {
+
+        DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
+        ANativeWindow *nw = alloc->mHal.state.wndSurface;
+
+        GraphicBufferMapper &mapper = GraphicBufferMapper::get();
+        mapper.unlock(drv->wndBuffer->handle);
+        int32_t r = nw->queueBuffer(nw, drv->wndBuffer, -1);
+    }
 #endif
 
     free(drv);