summaryrefslogtreecommitdiff
path: root/drivers/mxc/gpu-viv/hal/os/linux
diff options
context:
space:
mode:
authorYa Zhou <ya.zhou@nxp.com>2018-10-24 02:08:48 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:34:45 +0800
commitccad629ec9a445c552a095b5c957fdc1140f6c77 (patch)
treee3e68deca864da044862bdac6220bfe075895970 /drivers/mxc/gpu-viv/hal/os/linux
parent27094c3354216734c507472fd428d33342290bf5 (diff)
MGS-4010 [#imx-919] Vulkan test met gpu hang on wayland
These case will generate a huge command object, which was divided into 33 Command Buffers to commit. It will introduce a context switch within a command object. So add a mutex to avoid the Context switch. Date: 23th Otc,2018 Signed-off-by Ya Zhou <ya.zhou@nxp.com>
Diffstat (limited to 'drivers/mxc/gpu-viv/hal/os/linux')
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h1
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c20
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h
index 185485cf310b..42322007b409 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h
@@ -177,6 +177,7 @@ typedef struct _gcsHAL_PRIVATE_DATA
* closes it.
*/
gctUINT32 pidOpen;
+ gctBOOL isLocked;
}
gcsHAL_PRIVATE_DATA, * gcsHAL_PRIVATE_DATA_PTR;
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
index 39beea7cfd29..615939827730 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
@@ -388,6 +388,7 @@ static int drv_open(
data->device = galDevice;
data->pidOpen = _GetProcessID();
+ data->isLocked = gcvFALSE;
/* Attached the process. */
for (i = 0; i < gcdMAX_GPU_COUNT; i++)
@@ -475,6 +476,13 @@ static int drv_release(
gcmkONERROR(gcvSTATUS_INVALID_ARGUMENT);
}
+ if (data->isLocked)
+ {
+ /* Release the mutex. */
+ gcmkONERROR(gckOS_ReleaseMutex(gcvNULL, device->device->commitMutex));
+ data->isLocked = gcvFALSE;
+ }
+
/* A process gets detached. */
for (i = 0; i < gcdMAX_GPU_COUNT; i++)
{
@@ -610,6 +618,18 @@ static long drv_ioctl(
gcmkONERROR(gcvSTATUS_INVALID_ARGUMENT);
}
+ if (iface.command == gcvHAL_DEVICE_MUTEX)
+ {
+ if (iface.u.DeviceMutex.isMutexLocked == gcvTRUE)
+ {
+ data->isLocked = gcvTRUE;
+ }
+ else
+ {
+ data->isLocked = gcvFALSE;
+ }
+ }
+
status = gckDEVICE_Dispatch(device->device, &iface);
/* Redo system call after pending signal is handled. */