summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuden <luden@ghostmail.com>2016-04-20 21:22:06 +0000
committerDániel Járai <jaraidaniel@gmail.com>2016-04-22 11:08:55 -0700
commitc0ab422014daa616c39215703da43209f5ef55c3 (patch)
tree9bb2ceeb2ce02520391a7a39e347ceb5d393b953
parenta70a064a8d6759faf115ef454715deba09d775df (diff)
downloadhardware_ti_omap4-c0ab422014daa616c39215703da43209f5ef55c3.zip
hardware_ti_omap4-c0ab422014daa616c39215703da43209f5ef55c3.tar.gz
hardware_ti_omap4-c0ab422014daa616c39215703da43209f5ef55c3.tar.bz2
camera: fix large tiler memory leakages
This should fix large (>10M) tiler memory leakages that often occur when the camera is closed. There are still smaller leaks left (several 4K pages per run), but these are much less damaging. Change-Id: Icc442407d357eeff4a1bce9edeff0f186f5646d1
-rw-r--r--camera/ANativeWindowDisplayAdapter.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/camera/ANativeWindowDisplayAdapter.cpp b/camera/ANativeWindowDisplayAdapter.cpp
index 396e6d4..fae87a1 100644
--- a/camera/ANativeWindowDisplayAdapter.cpp
+++ b/camera/ANativeWindowDisplayAdapter.cpp
@@ -403,6 +403,8 @@ int ANativeWindowDisplayAdapter::disableDisplay(bool cancel_buffer)
}
else
{
+ CAMHAL_LOGEA("disableDisplay: resetting mANativeWindow to NULL");
+ returnBuffersToWindow();
mANativeWindow = NULL;
// Clear the frames with camera adapter map
mFramesWithCameraAdapterMap.clear();
@@ -475,6 +477,7 @@ CameraBuffer* ANativeWindowDisplayAdapter::allocateBufferList(int width, int hei
if ( NO_INIT == err ) {
CAMHAL_LOGEA("Preview surface abandoned!");
+ returnBuffersToWindow();
mANativeWindow = NULL;
}
@@ -489,6 +492,7 @@ CameraBuffer* ANativeWindowDisplayAdapter::allocateBufferList(int width, int hei
if ( NO_INIT == err ) {
CAMHAL_LOGEA("Preview surface abandoned!");
+ returnBuffersToWindow();
mANativeWindow = NULL;
}
@@ -510,6 +514,7 @@ CameraBuffer* ANativeWindowDisplayAdapter::allocateBufferList(int width, int hei
if ( NO_INIT == err ) {
CAMHAL_LOGEA("Preview surface abandoned!");
+ returnBuffersToWindow();
mANativeWindow = NULL;
}
@@ -542,6 +547,7 @@ CameraBuffer* ANativeWindowDisplayAdapter::allocateBufferList(int width, int hei
if ( NO_INIT == err ) {
CAMHAL_LOGEA("Preview surface abandoned!");
+ returnBuffersToWindow();
mANativeWindow = NULL;
}
@@ -595,6 +601,7 @@ CameraBuffer* ANativeWindowDisplayAdapter::allocateBufferList(int width, int hei
if ( NO_INIT == err ) {
CAMHAL_LOGEA("Preview surface abandoned!");
+ returnBuffersToWindow();
mANativeWindow = NULL;
}
@@ -712,6 +719,7 @@ status_t ANativeWindowDisplayAdapter::minUndequeueableBuffers(int& undequeueable
if ( NO_INIT == ret ) {
CAMHAL_LOGEA("Preview surface abandoned!");
+ returnBuffersToWindow();
mANativeWindow = NULL;
}
@@ -793,6 +801,7 @@ status_t ANativeWindowDisplayAdapter::returnBuffersToWindow()
ret = mANativeWindow->cancel_buffer(mANativeWindow, handle);
if ( NO_INIT == ret ) {
CAMHAL_LOGEA("Preview surface abandoned!");
+ returnBuffersToWindow();
mANativeWindow = NULL;
return ret;
} else if ( NO_ERROR != ret ) {
@@ -1145,6 +1154,7 @@ bool ANativeWindowDisplayAdapter::handleFrameReturn()
if ( NO_INIT == err ) {
CAMHAL_LOGEA("Preview surface abandoned!");
+ returnBuffersToWindow();
mANativeWindow = NULL;
}
@@ -1157,6 +1167,7 @@ bool ANativeWindowDisplayAdapter::handleFrameReturn()
if ( NO_INIT == err ) {
CAMHAL_LOGEA("Preview surface abandoned!");
+ returnBuffersToWindow();
mANativeWindow = NULL;
}