summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c28
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h7
2 files changed, 35 insertions, 0 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 6726a88695e9..9251dfa2e664 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
@@ -149,6 +149,7 @@ gctCONST_STRING _DispatchText[] =
gcmDEFINE2TEXT(gcvHAL_GET_VIDEO_MEMORY_FD),
gcmDEFINE2TEXT(gcvHAL_CONFIG_POWER_MANAGEMENT),
gcmDEFINE2TEXT(gcvHAL_WRAP_USER_MEMORY),
+ gcmDEFINE2TEXT(gcvHAL_RELEASE_USER_MEMORY),
gcmDEFINE2TEXT(gcvHAL_WAIT_FENCE),
#if gcdDEC_ENABLE_AHB
gcmDEFINE2TEXT(gcvHAL_DEC300_READ),
@@ -3199,6 +3200,33 @@ gckKERNEL_Dispatch(
0));
break;
+ case gcvHAL_RELEASE_USER_MEMORY:
+ {
+ gckVIDMEM_NODE nodeObject;
+ gctBOOL asynchronous = gcvFALSE;
+ gctUINT32 node = Interface->u.ReleaseUserMemory.node;
+
+ gcmkONERROR(gckKERNEL_RemoveProcessDB(Kernel,
+ processID,
+ gcvDB_VIDEO_MEMORY_LOCKED,
+ gcmINT2PTR(node)));
+
+ gcmkONERROR(gckKERNEL_ReleaseVideoMemory( Kernel, processID, node));
+
+ gcmkONERROR(gckVIDMEM_HANDLE_Lookup(Kernel, processID, node, &nodeObject));
+
+ gcmkONERROR(gckVIDMEM_Unlock(Kernel, nodeObject, gcvSURF_BITMAP, &asynchronous));
+ if (gcvTRUE == asynchronous)
+ {
+ gcmkONERROR(gckCOMMAND_Stall(Kernel->command, gcvFALSE));
+ gcmkVERIFY_OK(gckVIDMEM_Unlock(Kernel, nodeObject, gcvSURF_BITMAP, gcvNULL));
+ }
+
+ gcmkONERROR(gckVIDMEM_NODE_Dereference(Kernel, nodeObject));
+ }
+
+ break;
+
case gcvHAL_WAIT_FENCE:
gcmkONERROR(gckKERNEL_WaitFence(
Kernel,
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h
index 7a41b0a5a854..f2c5cb3cfcdf 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h
+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h
@@ -235,6 +235,7 @@ typedef enum _gceHAL_COMMAND_CODES
/* Wrap a user memory into a video memory node. */
gcvHAL_WRAP_USER_MEMORY,
+ gcvHAL_RELEASE_USER_MEMORY,
/* Wait until GPU finishes access to a resource. */
gcvHAL_WAIT_FENCE,
@@ -1268,6 +1269,12 @@ typedef struct _gcsHAL_INTERFACE
}
WrapUserMemory;
+ struct _gcsHAL_RELEASE_USER_MEMORY
+ {
+ IN gctUINT32 node;
+ }
+ ReleaseUserMemory;
+
struct _gcsHAL_WAIT_FENCE
{
IN gctUINT32 handle;