Commit 1d540db76d9028af90d181f509eeb918a7cb6e41

Authored by Xianzhong
1 parent 22adb879b2

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)

Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff

drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c
... ... @@ -1872,14 +1872,6 @@
1872 1872 /* Verify the arguments. */
1873 1873 gcmkVERIFY_OBJECT(Command, gcvOBJ_COMMAND);
1874 1874  
1875   -#if !gcdNULL_DRIVER
1876   - gcmkONERROR(_ProcessUserCommandBufferList(
1877   - Command,
1878   - CommandBuffer,
1879   - &lastCommandBuffer
1880   - ));
1881   -#endif
1882   -
1883 1875 #if gcdPROCESS_ADDRESS_SPACE
1884 1876 gcmkONERROR(gckKERNEL_GetProcessMMU(Command->kernel, &mmu));
1885 1877  
... ... @@ -1893,6 +1885,14 @@
1893 1885 /* Acquire the command queue. */
1894 1886 gcmkONERROR(gckCOMMAND_EnterCommit(Command, gcvFALSE));
1895 1887 commitEntered = gcvTRUE;
  1888 +
  1889 +#if !gcdNULL_DRIVER
  1890 + gcmkONERROR(_ProcessUserCommandBufferList(
  1891 + Command,
  1892 + CommandBuffer,
  1893 + &lastCommandBuffer
  1894 + ));
  1895 +#endif
1896 1896  
1897 1897 /* Acquire the context switching mutex. */
1898 1898 gcmkONERROR(gckOS_AcquireMutex(