summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXianzhong <b07117@freescale.com>2014-08-01 18:44:20 +0800
committerguoyin.chen <guoyin.chen@freescale.com>2014-08-06 10:07:59 +0800
commit5701fd97c35ef77658476ae8cf221f1f5883bd2a (patch)
treec2e129632271efd2f3b5c73668b1c95aa9f534bf
parent081c167e5bbd7232c1164c605a00f2ab218b9846 (diff)
ENGR00325794 [#1087] fix video memory mutex sharing issue
the root cause is video memory mutex is not global variable, it will cause video memory managment problem with mixed 2D/3D/VG. kernel panic with multiple instances stress test running glesx_viv.sh. Date: Jul 31, 2014 Signed-off-by: Xianzhong <b07117@freescale.com> Acked-by: Jason Liu Conflicts: drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c3
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h7
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h2
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c19
4 files changed, 29 insertions, 2 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 e757caf34e26..f17ae3f6a778 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
@@ -405,7 +405,7 @@ gckKERNEL_Construct(
gcmkONERROR(gckKERNEL_SecurityOpen(kernel, kernel->core, &kernel->securityChannel));
#endif
/* Construct a video memory mutex. */
- gcmkONERROR(gckOS_CreateMutex(Os, &kernel->vidmemMutex));
+ gcmkONERROR(gckOS_GetVideoMemoryMutex(Os, &kernel->vidmemMutex));
/* Return pointer to the gckKERNEL object. */
*Kernel = kernel;
@@ -633,7 +633,6 @@ gckKERNEL_Destroy(
#if gcdSECURITY
gcmkVERIFY_OK(gckKERNEL_SecurityClose(Kernel->securityChannel));
#endif
- gcmkVERIFY_OK(gckOS_DeleteMutex(Kernel->os, Kernel->vidmemMutex));
/* Mark the gckKERNEL object as unknown. */
Kernel->object.type = gcvOBJ_UNKNOWN;
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h
index 02d00140f81e..b4743b3e27f5 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h
+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h
@@ -1560,6 +1560,13 @@ gckOS_StopTimer(
IN gctPOINTER Timer
);
+/* Get the global video memory mutex. */
+gceSTATUS
+gckOS_GetVideoMemoryMutex(
+ IN gckOS Os,
+ OUT gctPOINTER *Mutex
+ );
+
/******************************************************************************\
********************************* gckHEAP Object ********************************
\******************************************************************************/
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h
index 88fbf7da5f2c..1dc29a3f7a6d 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h
@@ -222,6 +222,8 @@ struct _gckOS
/* External clock states. */
gctBOOL clockStates[gcdMAX_GPU_COUNT];
+
+ gctPOINTER vidmemMutex;
};
typedef struct _gcsSIGNAL * gcsSIGNAL_PTR;
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
index 9184e9bbd43a..89fe678f89c8 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
@@ -917,6 +917,9 @@ gckOS_Construct(
gckOS_ImportAllocators(os);
+ /* Construct a video memory mutex. */
+ gcmkONERROR(gckOS_CreateMutex(os, &os->vidmemMutex));
+
/* Return pointer to the gckOS object. */
*Os = os;
@@ -1029,6 +1032,9 @@ gckOS_Destroy(
/* Destroy debug lock mutex. */
gcmkVERIFY_OK(gckOS_DeleteMutex(Os, Os->debugLock));
+ /* Destroy video memory mutex. */
+ gcmkVERIFY_OK(gckOS_DeleteMutex(Os, Os->vidmemMutex));
+
/* Wait for all works done. */
flush_workqueue(Os->workqueue);
@@ -9035,3 +9041,16 @@ gckOS_GPUPhysicalToCPUPhysical(
return gcvSTATUS_OK;
}
+gceSTATUS
+gckOS_GetVideoMemoryMutex(
+ IN gckOS Os,
+ OUT gctPOINTER *Mutex
+ )
+{
+ gcmkHEADER_ARG("Mutex=x%X", Mutex);
+
+ *Mutex = Os->vidmemMutex;
+
+ gcmkFOOTER_NO();
+ return gcvSTATUS_OK;
+}