From 5d7ba53247cd1418ddafc6cb7e80c8e031c706a6 Mon Sep 17 00:00:00 2001 From: Richard Liu Date: Thu, 26 Jul 2012 10:59:12 +0800 Subject: [PATCH] ENGR00217633 Add force contiguous memory pool in gpu driver Add force contiguous memory pool in gpu driver Signed-off-by: Richard Liu Acked-by: Lily Zhang --- drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c | 13 +++++++++++-- drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h | 2 ++ drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | 2 +- 3 files changed, 14 insertions(+), 3 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 4d16d182b231..b14bf79c038a 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c @@ -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; diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h index d0298eed15e9..85b41312f772 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h @@ -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 } diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h index 27fbf5689340..d1ddd004dc3c 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h @@ -765,7 +765,7 @@ limited by gcdCONTIGUOUS_SIZE_LIMIT. */ #ifndef gcdCONTIGUOUS_SIZE_LIMIT -# define gcdCONTIGUOUS_SIZE_LIMIT 4096 +# define gcdCONTIGUOUS_SIZE_LIMIT 0 #endif /* gcdALPHA_KILL_IN_SHADER -- 2.39.5