]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00277045-1 fix system reboot with video playback
authorXianzhong <b07117@freescale.com>
Wed, 28 Aug 2013 17:33:39 +0000 (01:33 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Mon, 16 Jun 2014 16:04:03 +0000 (18:04 +0200)
gpu virtual memory cannot be allocated for external use

this issue occurs in ARD board with 2G above memory address

Signed-off-by: Xianzhong <b07117@freescale.com>
Acked-by: Jason Liu
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c

index 12a534046a6e78aea34f2e609446fce93a01c1c5..e8563b771ff135cf2c16816b328c077108161bea 100644 (file)
@@ -731,6 +731,43 @@ _AllocateMemory_Retry:
             if (gcmIS_SUCCESS(status) || forceContiguous == gcvTRUE)
             {
                 /* Memory allocated. */
+                if(node && forceContiguous == gcvTRUE)
+                {
+                    gctUINT32 physAddr=0;
+                    gctUINT32 baseAddress = 0;
+
+                    gckOS_LockPages(Kernel->os,
+                                    node->Virtual.physical,
+                                    node->Virtual.bytes,
+                                    gcvFALSE,
+                                    &node->Virtual.logical,
+                                    &node->Virtual.pageCount);
+
+                    /* Convert logical address into a physical address. */
+                    gckOS_GetPhysicalAddress(Kernel->os, node->Virtual.logical, &physAddr);
+
+                    gckOS_UnlockPages(Kernel->os,
+                                      node->Virtual.physical,
+                                      node->Virtual.bytes,
+                                      node->Virtual.logical);
+
+                    gckOS_GetBaseAddress(Kernel->os, &baseAddress);
+
+                    gcmkASSERT(physAddr >= baseAddress);
+
+                    /* Subtract baseAddress to get a GPU address used for programming. */
+                    physAddr -= baseAddress;
+
+                    if((physAddr & 0x80000000) || ((physAddr + Bytes) & 0x80000000))
+                    {
+                        gckOS_Print("gpu virtual memory 0x%x cannot be allocated for external use !\n", physAddr);
+
+                        gckVIDMEM_Free(node);
+
+                        node = gcvNULL;
+                    }
+                }
+
                 break;
             }
         }