]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00217633 Add force contiguous memory pool in gpu driver
authorRichard Liu <r66033@freescale.com>
Thu, 26 Jul 2012 02:59:12 +0000 (10:59 +0800)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:12:31 +0000 (14:12 +0200)
Add force contiguous memory pool in gpu driver

Signed-off-by: Richard Liu <r66033@freescale.com>
Acked-by: Lily Zhang
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h
drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h

index 4d16d182b23174b650650f275a29cce2df8e201d..b14bf79c038a92ed127d0725b4bdf18609423f53 100644 (file)
@@ -464,6 +464,7 @@ _AllocateMemory(
     gctINT loopCount;
     gcuVIDMEM_NODE_PTR node = gcvNULL;
     gctBOOL tileStatusInVirtual;
+    gctBOOL forceContiguous = gcvFALSE;
 
     gcmkHEADER_ARG("Kernel=0x%x *Pool=%d Bytes=%lu Alignment=%lu Type=%d",
                    Kernel, *Pool, Bytes, Alignment, Type);
@@ -474,6 +475,8 @@ _AllocateMemory(
     /* Get initial pool. */
     switch (pool = *Pool)
     {
+    case gcvPOOL_DEFAULT_FORCE_CONTIGUOUS:
+        forceContiguous = gcvTRUE;
     case gcvPOOL_DEFAULT:
     case gcvPOOL_LOCAL:
         pool      = gcvPOOL_LOCAL_INTERNAL;
@@ -489,6 +492,12 @@ _AllocateMemory(
         loopCount = (gctINT) gcvPOOL_NUMBER_OF_POOLS;
         break;
 
+    case gcvPOOL_DEFAULT_FORCE_CONTIGUOUS_CACHEABLE:
+        pool      = gcvPOOL_CONTIGUOUS;
+        loopCount = 1;
+        forceContiguous = gcvTRUE;
+        break;
+
     default:
         loopCount = 1;
         break;
@@ -510,7 +519,7 @@ _AllocateMemory(
         if (pool == gcvPOOL_CONTIGUOUS)
         {
 #if gcdCONTIGUOUS_SIZE_LIMIT
-            if (Bytes > gcdCONTIGUOUS_SIZE_LIMIT)
+            if (Bytes > gcdCONTIGUOUS_SIZE_LIMIT && forceContiguous == gcvFALSE)
             {
                 status = gcvSTATUS_OUT_OF_MEMORY;
             }
@@ -521,7 +530,7 @@ _AllocateMemory(
                 status = gckVIDMEM_ConstructVirtual(Kernel, gcvTRUE, Bytes, &node);
             }
 
-            if (gcmIS_SUCCESS(status))
+            if (gcmIS_SUCCESS(status) || forceContiguous == gcvTRUE)
             {
                 /* Memory allocated. */
                 break;
index d0298eed15e90e8436529e59126a5f4a1d378969..85b41312f7723c06ca7dd5c1920d95df55e9bdc1 100644 (file)
@@ -159,6 +159,8 @@ typedef enum _gcePOOL
     gcvPOOL_VIRTUAL,
     gcvPOOL_USER,
     gcvPOOL_CONTIGUOUS,
+    gcvPOOL_DEFAULT_FORCE_CONTIGUOUS,
+    gcvPOOL_DEFAULT_FORCE_CONTIGUOUS_CACHEABLE,
 
     gcvPOOL_NUMBER_OF_POOLS
 }
index 27fbf5689340f8f65b4eb398aefeea9a4403f8e4..d1ddd004dc3ca6f7b7f45245d908b77534caf9d6 100644 (file)
         limited by gcdCONTIGUOUS_SIZE_LIMIT.
  */
 #ifndef gcdCONTIGUOUS_SIZE_LIMIT
-#   define gcdCONTIGUOUS_SIZE_LIMIT             4096
+#   define gcdCONTIGUOUS_SIZE_LIMIT             0
 #endif
 
 /*  gcdALPHA_KILL_IN_SHADER