diff options
author | Loren Huang <b02279@freescale.com> | 2011-12-02 17:06:39 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-07-20 13:18:26 +0800 |
commit | af61c1cbd841bad548065c7d1a4c34a5bb605946 (patch) | |
tree | df03ba6118b46290782b065a597e3e08e0a7aadb /drivers/mxc/gpu-viv/arch | |
parent | 8422071096e8d30383a7ef512997ca71aa143338 (diff) |
ENGR00163719 Upgrade to 4.6.3
Signed-off-by: Loren Huang <b02279@freescale.com>
Acked-by: Lily Zhang
Diffstat (limited to 'drivers/mxc/gpu-viv/arch')
3 files changed, 117 insertions, 27 deletions
diff --git a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c index 2b5e9ece7fc3..20c79b88806f 100644 --- a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c +++ b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c @@ -1792,7 +1792,7 @@ gckVGHARDWARE_SetPowerManagementState( gcmkONERROR(gckOS_ReleaseSemaphore(os, Hardware->idleSemaphore)); } /* Reset power off time */ - gcmkONERROR(gckOS_GetTicks(¤tTime)); + gcmkVERIFY_OK(gckOS_GetTicks(¤tTime)); Hardware->powerOffTime = currentTime + Hardware->powerOffTimeout; if (commitMutex) diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c index dbf8680cf9d3..f1b4dd099cec 100644 --- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c +++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c @@ -67,6 +67,14 @@ gcvFALSE, gcvFALSE \ ) +#define _STATE_MIRROR(reg, mirror) \ + _StateMirror(\ + Context, \ + reg ## _Address >> 2, \ + reg ## _Count, \ + mirror ## _Address >> 2 \ + ) + #define _STATE_HINT(reg) \ _State(\ Context, index, \ @@ -353,6 +361,32 @@ _State( /* Return number of slots required. */ return Size; } + +static gctSIZE_T +_StateMirror( + IN gckCONTEXT Context, + IN gctUINT32 Address, + IN gctSIZE_T Size, + IN gctUINT32 AddressMirror + ) +{ + gctSIZE_T i; + + /* Process when buffer is set. */ + if (Context->buffer != gcvNULL) + { + /* Walk all states. */ + for (i = 0; i < Size; i++) + { + /* Copy the mapping address. */ + Context->map[Address + i].index = + Context->map[AddressMirror + i].index; + } + } + + /* Return the number of required maps. */ + return Size; +} #endif static gceSTATUS @@ -565,7 +599,7 @@ _InitializeContextBuffer( index += _State(Context, index, 0x0091C >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); index += _CLOSE_RANGE(); - if (Context->hardware->identity.instructionCount >= 2048) + if (Context->hardware->identity.instructionCount > 1024) { /* New Shader instruction memory. */ index += _State(Context, index, 0x0085C >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); @@ -579,7 +613,7 @@ _InitializeContextBuffer( index += _CLOSE_RANGE(); } } - else if (Context->hardware->identity.instructionCount >= 1024) + else if (Context->hardware->identity.instructionCount > 256) { /* VX instruction memory. */ for (i = 0; i < 4096; i += 1024) @@ -588,11 +622,7 @@ _InitializeContextBuffer( index += _CLOSE_RANGE(); } - for (i = 0; i < 4096; i += 1024) - { - index += _State(Context, index, (0x08000 >> 2) + i, 0x00000000, 1024, gcvFALSE, gcvFALSE); - index += _CLOSE_RANGE(); - } + index += _StateMirror(Context, (0x08000 >> 2), 4096, 0x0C000 >> 2); } /* Store the index of the "XD" entry. */ diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c index fe6c1a93bfe6..0ceced9754bb 100644 --- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c +++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c @@ -715,15 +715,15 @@ gckHARDWARE_InitializeHardware( 0x00418, baseAddress)); -#ifndef VIVANTE_NO_3D gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, - 0x00420, + 0x00428, baseAddress)); +#ifndef VIVANTE_NO_3D gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, - 0x00428, + 0x00420, baseAddress)); gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, @@ -3684,6 +3684,22 @@ gckHARDWARE_SetPowerManagementState( Hardware->powerMutex, gcvINFINITE)); mutexAcquired = gcvTRUE; + + /* chipPowerState may be changed by external world during the time + ** we give up powerMutex, so updating flag now is necessary. */ + flag = flags[Hardware->chipPowerState][State]; + + if (flag == 0) + { + gcmkONERROR(gckOS_ReleaseSemaphore(os, Hardware->globalSemaphore)); + globalAcquired = gcvFALSE; + + gcmkONERROR(gckOS_ReleaseMutex(os, Hardware->powerMutex)); + mutexAcquired = gcvFALSE; + + gcmkFOOTER_NO(); + return gcvSTATUS_OK; + } } else { @@ -3695,6 +3711,40 @@ gckHARDWARE_SetPowerManagementState( gcmkONERROR(gckOS_ReleaseSemaphore(os, Hardware->globalSemaphore)); globalAcquired = gcvFALSE; } + else + { + if (State == gcvPOWER_OFF || State == gcvPOWER_SUSPEND || State == gcvPOWER_IDLE) + { + /* Acquire the global semaphore if it has not been acquired. */ + status = gckOS_TryAcquireSemaphore(os, Hardware->globalSemaphore); + if (status == gcvSTATUS_OK) + { + globalAcquired = gcvTRUE; + } + else if (status != gcvSTATUS_TIMEOUT) + { + /* Other errors. */ + gcmkONERROR(status); + } + /* Ignore gcvSTATUS_TIMEOUT and leave globalAcquired as gcvFALSE. + ** gcvSTATUS_TIMEOUT means global semaphore has already + ** been acquired before this operation, so even if we fail, + ** we should not release it in our error handling. It should be + ** released by the next successful global gcvPOWER_ON. */ + } + + /* Global power management can't be aborted, so sync with + ** proceeding last commit. */ + if (flag & gcvPOWER_FLAG_ACQUIRE) + { + /* Acquire the power management semaphore. */ + gcmkONERROR(gckOS_AcquireSemaphore(os, command->powerSemaphore)); + acquired = gcvTRUE; + + /* avoid acquiring again. */ + flag &= ~gcvPOWER_FLAG_ACQUIRE; + } + } if (flag & (gcvPOWER_FLAG_INITIALIZE | gcvPOWER_FLAG_CLOCK_ON)) { @@ -3714,15 +3764,20 @@ gckHARDWARE_SetPowerManagementState( gctBOOL idle; gctINT32 atomValue; - /* Check commit atom. */ - gcmkONERROR(gckOS_AtomGet(os, command->atomCommit, &atomValue)); - - if (atomValue > 0) + /* For global operation, all pending commits have already been + ** blocked by globalSemaphore or powerSemaphore.*/ + if (!global) { - /* Commits are pending - abort power management. */ - status = broadcast ? gcvSTATUS_CHIP_NOT_READY - : gcvSTATUS_MORE_DATA; - goto OnError; + /* Check commit atom. */ + gcmkONERROR(gckOS_AtomGet(os, command->atomCommit, &atomValue)); + + if (atomValue > 0) + { + /* Commits are pending - abort power management. */ + status = broadcast ? gcvSTATUS_CHIP_NOT_READY + : gcvSTATUS_MORE_DATA; + goto OnError; + } } if (broadcast) @@ -3780,13 +3835,6 @@ gckHARDWARE_SetPowerManagementState( /* Acquire the power management semaphore. */ gcmkONERROR(gckOS_AcquireSemaphore(os, command->powerSemaphore)); acquired = gcvTRUE; - - if (global) - { - /* Acquire the global semaphore. */ - gcmkONERROR(gckOS_AcquireSemaphore(os, Hardware->globalSemaphore)); - globalAcquired = gcvTRUE; - } } if (flag & gcvPOWER_FLAG_STOP) @@ -3796,7 +3844,7 @@ gckHARDWARE_SetPowerManagementState( /* Stop the Isr. */ gcmkONERROR(Hardware->stopIsr(Hardware->isrContext)); - } + } /* Get time until stopped. */ gcmkPROFILE_QUERY(time, stopTime); @@ -3883,6 +3931,18 @@ gckHARDWARE_SetPowerManagementState( if (global) { + /* Verify global semaphore has been acquired already before + ** we release it. + ** If it was acquired, gckOS_TryAcquireSemaphore will return + ** gcvSTATUS_TIMEOUT and we release it. Otherwise, global + ** semaphore will be acquried now, but it still is released + ** immediately. */ + status = gckOS_TryAcquireSemaphore(os, Hardware->globalSemaphore); + if (status != gcvSTATUS_TIMEOUT) + { + gcmkONERROR(status); + } + /* Release the global semaphore. */ gcmkONERROR(gckOS_ReleaseSemaphore(os, Hardware->globalSemaphore)); globalAcquired = gcvFALSE; |