summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Liu <xuegang.liu@nxp.com>2017-12-21 04:26:48 +0800
committerXianzhong <xianzhong.li@nxp.com>2017-12-30 02:44:25 +0800
commit8e94e7b26de6dc808d4bbe81fa7376149cca1668 (patch)
treea37aca477d1d8fb4892ac5373950945cfef11cfa
parentea1566ef0164afea5f788816824d881bb9167b77 (diff)
MA-10617 [#imx-836] Fix CtsMediaTestCases module test uncompleted issue
CtsMediaTestCases module CTS test can't uncompleted due to native crash, the crash is due to memory leak in drm gralloc, when total leak reach to 4GB it will report mmap fail and cause CTS thread crash. Crash log: 12-02 08:14:51.982 1156 25401 E gralloc-viv: gralloc_vivante_lock#573: failed to mmap 12-02 08:14:51.982 1156 25401 E gralloc-viv: gralloc_lock#136: err=-25 12-02 08:14:51.982 1156 25401 E gralloc : gralloc_lock lock memory failed 12-02 08:14:51.982 1156 25401 W GraphicBufferMapper: lock(0xed4c2740, ...) failed: 5 12-02 08:14:51.982 1156 25401 F SoftwareRenderer: frameworks/av/media/libstagefright/ colorconversion/SoftwareRenderer.cpp:230 CHECK_EQ( 0,mapper.lock( buf->handle, GRALLOC_USAGE_SW_WRITE_OFTEN, bounds, &dst)) failed: 0 vs. 5 Dec. 20, 2017 Signed-off-by: Richard Liu <xuegang.liu@nxp.com> (cherry picked from commit d9fc48e209ae3df97fb2570fbaf49cc40677f74b)
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c51
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c2
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c9
3 files changed, 34 insertions, 28 deletions
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
index 20f45b44f35c..290336f38fb0 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
@@ -1594,39 +1594,38 @@ gckKERNEL_BottomHalfUnlockVideoMemory(
)
{
gceSTATUS status;
- gckVIDMEM_NODE BottomHalfUnlockNode = gcvNULL;
+ gckVIDMEM_NODE nodeObject = gcvNULL;
- do
- {
- /* Remove record from process db. */
- gcmkVERIFY_OK(gckKERNEL_RemoveProcessDB(
- Kernel,
- ProcessID,
- gcvDB_VIDEO_MEMORY_LOCKED,
- gcmINT2PTR(Node)));
+ /* Remove record from process db. */
+ gcmkVERIFY_OK(gckKERNEL_RemoveProcessDB(
+ Kernel,
+ ProcessID,
+ gcvDB_VIDEO_MEMORY_LOCKED,
+ gcmINT2PTR(Node)));
- gcmkERR_BREAK(gckVIDMEM_HANDLE_Lookup(
- Kernel,
- ProcessID,
- Node,
- &BottomHalfUnlockNode));
+ gcmkONERROR(gckVIDMEM_HANDLE_Lookup(
+ Kernel,
+ ProcessID,
+ Node,
+ &nodeObject));
- gckVIDMEM_HANDLE_Dereference(Kernel, ProcessID, Node);
+ gckVIDMEM_HANDLE_Dereference(Kernel, ProcessID, Node);
- /* Unlock video memory. */
- gcmkERR_BREAK(gckVIDMEM_Unlock(
- Kernel,
- BottomHalfUnlockNode,
- gcvSURF_TYPE_UNKNOWN,
- gcvNULL));
+ /* Unlock video memory. */
+ gcmkONERROR(gckVIDMEM_Unlock(
+ Kernel,
+ nodeObject,
+ gcvSURF_TYPE_UNKNOWN,
+ gcvNULL));
- gcmkERR_BREAK(gckVIDMEM_NODE_Dereference(
- Kernel,
- BottomHalfUnlockNode));
- }
- while (gcvFALSE);
+ gcmkONERROR(gckVIDMEM_NODE_Dereference(
+ Kernel,
+ nodeObject));
return gcvSTATUS_OK;
+
+OnError:
+ return status;
}
/*******************************************************************************
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c
index 057311661536..82c3471529fb 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c
+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c
@@ -2636,7 +2636,7 @@ gckVIDMEM_NODE_Allocate(
}
/* Reference is 1 by default . */
- gckVIDMEM_NODE_Reference(Kernel, node);
+ gckOS_AtomSet(os, node->reference, 1);
/* Create a handle to represent this node. */
gcmkONERROR(gckVIDMEM_HANDLE_Allocate(Kernel, node, &handle));
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c
index 8a667449b9c7..c194ee30f374 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_drm.c
@@ -286,7 +286,14 @@ static int viv_ioctl_gem_unlock(struct drm_device *drm, void *data,
}
viv_obj = container_of(gem_obj, struct viv_gem_object, base);
- gckOS_ZeroMemory(&iface, sizeof(iface));
+ memset(&iface, 0, sizeof(iface));
+ iface.command = gcvHAL_UNLOCK_VIDEO_MEMORY;
+ iface.hardwareType = gal_dev->device->defaultHwType;
+ iface.u.UnlockVideoMemory.node = (gctUINT64)viv_obj->node_handle;
+ iface.u.UnlockVideoMemory.type = gcvSURF_TYPE_UNKNOWN;
+ gcmkONERROR(gckDEVICE_Dispatch(gal_dev->device, &iface));
+
+ memset(&iface, 0, sizeof(iface));
iface.command = gcvHAL_BOTTOM_HALF_UNLOCK_VIDEO_MEMORY;
iface.hardwareType = gal_dev->device->defaultHwType;
iface.u.BottomHalfUnlockVideoMemory.node = (gctUINT64)viv_obj->node_handle;