summaryrefslogtreecommitdiff
path: root/drivers/mxc/gpu-viv/hal/kernel
diff options
context:
space:
mode:
authorLarry Li <b20787@freescale.com>2012-06-12 17:11:45 +0800
committerJason Liu <r64343@freescale.com>2012-07-20 13:38:44 +0800
commitc6cd7b018da381a33ea934a4d9e00b63fed5fa50 (patch)
tree857b699002ef17665cf5d43e5e2ef726694793e9 /drivers/mxc/gpu-viv/hal/kernel
parentb829a6c66e6bab87ef456ffcac3ffc3df82e4533 (diff)
ENGR00213170-2 [MX6SL] Enable GPU driver
Use allocated GPU resource to enable GPU. Memroy address on imx6sl board starts from 0x80000000 and GC320 can access [baseAddress, baseAddress + 2G) only without MMU. So to make GC320 work, baseAddres must be set to 0x80000000, and all address sent to GC320 must be a offset to baseAddress. GC355 doesn't need this baseAddress, that means it needs a real physcial adress, rather than the offset to baseAddress. Original code always change phsysical address to 'offset' before use it, no matter it is used by GC355 or GC320, so only one of them can work. Solution is to move address adjustion to arch specific part. So each core can get what it wants. Signed-off-by: Larry Li <b20787@freescale.com> Acked-by: Lily Zhang
Diffstat (limited to 'drivers/mxc/gpu-viv/hal/kernel')
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c
index 89a86a8486a7..3cf63e27af63 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c
+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c
@@ -1603,7 +1603,7 @@ _NeedVirtualMapping(
#endif
{
/* For cores which can't access all physical address. */
- gcmkONERROR(gckOS_GetPhysicalAddress(Kernel->os,
+ gcmkONERROR(gckHARDWARE_ConvertLogical(Kernel->hardware,
Node->Virtual.logical,
&phys));
@@ -1663,6 +1663,7 @@ gckVIDMEM_Lock(
gctBOOL locked = gcvFALSE;
gckOS os = gcvNULL;
gctBOOL needMapping;
+ gctUINT32 baseAddress;
gcmkHEADER_ARG("Node=0x%x", Node);
@@ -1698,6 +1699,19 @@ gckVIDMEM_Lock(
*Address = Node->VidMem.physical;
#endif
+#if gcdENABLE_VG
+ if (Kernel->vg == gcvNULL)
+#endif
+ {
+ if (Kernel->hardware->mmuVersion == 0)
+ {
+ /* Convert physical to GPU address for old mmu. */
+ gcmkONERROR(gckOS_GetBaseAddress(Kernel->os, &baseAddress));
+ gcmkASSERT(*Address > baseAddress);
+ *Address -= baseAddress;
+ }
+ }
+
gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_VIDMEM,
"Locked node 0x%x (%d) @ 0x%08X",
Node,
@@ -1755,10 +1769,21 @@ gckVIDMEM_Lock(
if (needMapping == gcvFALSE)
{
- /* Get physical address directly */
- gcmkONERROR(gckOS_GetPhysicalAddress(os,
- Node->Virtual.logical,
- &Node->Virtual.addresses[Kernel->core]));
+#if gcdENABLE_VG
+ if (Kernel->vg != gcvNULL)
+ {
+ /* Get physical address directly */
+ gcmkONERROR(gckVGHARDWARE_ConvertLogical(Kernel->vg->hardware,
+ Node->Virtual.logical,
+ &Node->Virtual.addresses[Kernel->core]));
+ }
+ else
+#endif
+ {
+ gcmkONERROR(gckHARDWARE_ConvertLogical(Kernel->hardware,
+ Node->Virtual.logical,
+ &Node->Virtual.addresses[Kernel->core]));
+ }
}
else
{