MGS-3778 [#imx-989] fix GPU performance regression with 6.2.4.p1
authorXianzhong <xianzhong.li@nxp.com>
Thu, 29 Mar 2018 11:46:42 +0000 (19:46 +0800)
committerHaibo Chen <haibo.chen@nxp.com>
Thu, 12 Apr 2018 10:46:38 +0000 (18:46 +0800)
the original patch will skip CMA memory allocation with CMA_LIMIT flag,
that enforces GPU memory allocation from virtual pool with MMU mapping,
then both 2D and 3D performance will have performance regression on i.MX6.

Revert "6.2.4.p1-0044-CL142820-check-flag-match-even-try-to-allocate-from-"

This reverts commit 8a8cbf389ad56dc49685ea078698087be867655a.

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
(cherry picked from commit 951e42c0ec05d4cdaf739eadd5fd40c2b8321b10)

drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c

index 2f16d6d..457fc6b 100644 (file)
@@ -1122,21 +1122,14 @@ AllocateMemory:
             if (gcmIS_SUCCESS(status))
             {
                 /* Allocate memory. */
-                if ((Flag & videoMemory->capability) != Flag)
-                {
-                    status = gcvSTATUS_NOT_SUPPORTED;
-
-                    gcmkFATAL("%s(%d): Reject alloc because VIDMEM (pool=%d) caps=0x%x cannot meet required Flag=0x%x",
-                              __FUNCTION__, __LINE__, pool, videoMemory->capability, Flag);
-                }
 #if defined(gcdLINEAR_SIZE_LIMIT)
                 /* 512 KB */
-                else if (Bytes > gcdLINEAR_SIZE_LIMIT)
+                if (Bytes > gcdLINEAR_SIZE_LIMIT)
                 {
                     status = gcvSTATUS_OUT_OF_MEMORY;
                 }
-#endif
                 else
+#endif
                 {
                     hasFastPools = gcvTRUE;
                     status = gckVIDMEM_AllocateLinear(Kernel,
index f5d23bd..438ca88 100644 (file)
@@ -1080,9 +1080,6 @@ struct _gckVIDMEM
     gctSIZE_T                   freeBytes;
     gctSIZE_T                   minFreeBytes;
 
-    /* caps inherit from its allocator, ~0u if allocator was not applicable. */
-    gctUINT32                   capability;
-
     /* Mapping for each type of surface. */
     gctINT                      mapping[gcvSURF_NUM_TYPES];
 
index 2fcc52c..49adff0 100644 (file)
@@ -435,7 +435,6 @@ gckVIDMEM_Construct(
     memory->bytes        = heapBytes;
     memory->freeBytes    = heapBytes;
     memory->minFreeBytes = heapBytes;
-    memory->capability   = ~0u;
     memory->threshold    = Threshold;
     memory->mutex        = gcvNULL;
 
index 020cba9..c69dd5c 100644 (file)
@@ -54,7 +54,6 @@
 
 
 #include "gc_hal_kernel_linux.h"
-#include "gc_hal_kernel_allocator.h"
 #include <linux/pagemap.h>
 #include <linux/seq_file.h>
 #include <linux/mman.h>
@@ -853,8 +852,6 @@ _SetupVidMem(
 
                     if (gcmIS_SUCCESS(status))
                     {
-                        gckALLOCATOR allocator = ((PLINUX_MDL)device->contiguousPhysical)->allocator;
-                        device->contiguousVidMem->capability = allocator->capability | gcvALLOC_FLAG_MEMLIMIT;
                         device->contiguousVidMem->physical = device->contiguousPhysical;
                         device->contiguousBase = physAddr;
                         break;
@@ -899,8 +896,6 @@ _SetupVidMem(
             }
             else
             {
-                gckALLOCATOR allocator;
-
                 gcmkONERROR(gckOS_RequestReservedMemory(
                     device->os, ContiguousBase, ContiguousSize,
                     "galcore contiguous memory",
@@ -908,8 +903,6 @@ _SetupVidMem(
                     &device->contiguousPhysical
                     ));
 
-                allocator = ((PLINUX_MDL)device->contiguousPhysical)->allocator;
-                device->contiguousVidMem->capability = allocator->capability | gcvALLOC_FLAG_MEMLIMIT;
                 device->contiguousVidMem->physical = device->contiguousPhysical;
                 device->requestedContiguousBase = ContiguousBase;
                 device->requestedContiguousSize = ContiguousSize;