summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorLuden <luden@ghostmail.com>2016-04-20 21:22:06 +0000
committerZiyan <jaraidaniel@gmail.com>2016-07-26 09:51:16 +0200
commitb3450cc177fb8b7541449bd1f28f59c0f3ab8fe0 (patch)
treeaa4e2689043c04c8bfd561ff9818f06f9264ed95 /camera
parent9b41ba64bd071f1cfd988701ddd99ee5d01e6ab7 (diff)
downloaddevice_samsung_tuna-b3450cc177fb8b7541449bd1f28f59c0f3ab8fe0.zip
device_samsung_tuna-b3450cc177fb8b7541449bd1f28f59c0f3ab8fe0.tar.gz
device_samsung_tuna-b3450cc177fb8b7541449bd1f28f59c0f3ab8fe0.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
Diffstat (limited to 'camera')
-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;
}