summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXianzhong <xianzhong.li@nxp.com>2019-03-28 13:14:42 +0800
committerXianzhong <xianzhong.li@nxp.com>2019-03-29 14:55:41 +0800
commit1d540db76d9028af90d181f509eeb918a7cb6e41 (patch)
treecf91ef803bdf9f2658f55e9db030da0ba76da90a
parent22adb879b244d766158bb38b7e346d689da80d88 (diff)
MGS-4645-2 [#imx-1373] fix command object race condition risk
Vulkan driver has problem to commit command without device mutex, command object has race condition risk without mutex protection. move _ProcessUserCommandBufferList into command mutex region. Signed-off-by: Xianzhong <xianzhong.li@nxp.com> (cherry picked from commit 10120a64fd9342c8effd21eb62bc51f88f1493cb)
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c
index 5d3609fa9469..a5e81c229ed5 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c
+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c
@@ -1872,14 +1872,6 @@ gckCOMMAND_Commit(
/* Verify the arguments. */
gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
-#if !gcdNULL_DRIVER
- gcmkONERROR(_ProcessUserCommandBufferList(
- Command,
- CommandBuffer,
- &lastCommandBuffer
- ));
-#endif
-
#if gcdPROCESS_ADDRESS_SPACE
gcmkONERROR(gckKERNEL_GetProcessMMU(Command->kernel, &mmu));
@@ -1894,6 +1886,14 @@ gckCOMMAND_Commit(
gcmkONERROR(gckCOMMAND_EnterCommit(Command, gcvFALSE));
commitEntered = gcvTRUE;
+#if !gcdNULL_DRIVER
+ gcmkONERROR(_ProcessUserCommandBufferList(
+ Command,
+ CommandBuffer,
+ &lastCommandBuffer
+ ));
+#endif
+
/* Acquire the context switching mutex. */
gcmkONERROR(gckOS_AcquireMutex(
Command->os, Command->mutexContext, gcvINFINITE