MGS-2832: gpu: integrate partial changes for 6.2.2
authorXianzhong <xianzhong.li@nxp.com>
Thu, 27 Apr 2017 11:44:33 +0000 (19:44 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:22:05 +0000 (15:22 -0500)
- gpu hang when enable the vprofiler on imx6qp
- gpu axi bus error with user surface mapping
- OpenCL driver issue for initialier failure
- GL benchmark performance optimization
- X11 and Android critical bug-fixing

Signed-off-by: Xianzhong <xianzhong.li@nxp.com>
drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c
drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator.c
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h
drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
drivers/mxc/gpu-viv/hal/os/linux/kernel/platform/freescale/gc_hal_kernel_platform_imx6.config

index bc02e02..e98cd90 100644 (file)
@@ -10765,6 +10765,7 @@ gckHARDWARE_UpdateContextNewProfile(
     gctUINT32 totalRead, totalWrite;
     gctUINT32 mc_axi_max_min_latency;
     gctUINT32 temp;
+    gckCOMMAND command = Hardware->kernel->command;
 
     gcmkHEADER_ARG("Hardware=0x%x Context=0x%x", Hardware, Context);
 
@@ -10772,6 +10773,11 @@ gckHARDWARE_UpdateContextNewProfile(
     gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE);
     gcmkVERIFY_OBJECT(Context, gcvOBJ_CONTEXT);
 
+    /* Acquire the context sequnence mutex. */
+    gcmkONERROR(gckOS_AcquireMutex(
+        command->os, command->mutexContextSeq, gcvINFINITE
+        ));
+
     chipModel = Hardware->identity.chipModel;
     chipRevision = Hardware->identity.chipRevision;
     if ((chipModel == gcv5000 && chipRevision == 0x5434) || (chipModel == gcv3000 && chipRevision == 0x5435))
@@ -11932,11 +11938,20 @@ gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00478,   ((((g
     gcmkUPDATE_PROFILE_DATA_PART2(l2_axi1_total_latency);
     gcmkUPDATE_PROFILE_DATA_PART2(l2_axi1_total_request_count);
 
+    gcmkVERIFY_OK(gckOS_ReleaseMutex(
+        command->os, command->mutexContextSeq
+        ));
+
     /* Success. */
     gcmkFOOTER_NO();
     return gcvSTATUS_OK;
 
 OnError:
+
+    gckOS_ReleaseMutex(
+        command->os, command->mutexContextSeq
+        );
+
     /* Return the status. */
     gcmkFOOTER();
     return status;
index 51b4274..59a4fcc 100644 (file)
@@ -2553,6 +2553,19 @@ gckCOMMAND_Commit(
     gcmkONERROR(gckCOMMAND_ExitCommit(Command, gcvFALSE));
     commitEntered = gcvFALSE;
 
+    if  ((Command->kernel->hardware->gpuProfiler == gcvTRUE) &&
+         (Command->kernel->profileEnable == gcvTRUE) &&
+         (Command->kernel->profileSyncMode == gcvTRUE))
+    {
+        gcmkONERROR(gckCOMMAND_Stall(Command, gcvTRUE));
+
+        if (Command->currContext)
+        {
+            gcmkONERROR(gckHARDWARE_UpdateContextNewProfile(
+                        hardware,
+                        Command->currContext));
+        }
+    }
 
     /* Loop while there are records in the queue. */
     while (EventQueue != gcvNULL)
@@ -2599,11 +2612,8 @@ gckCOMMAND_Commit(
         EventQueue = nextEventRecord;
     }
 
-    if ((Command->kernel->eventObj->queueHead == gcvNULL
+    if (Command->kernel->eventObj->queueHead == gcvNULL
       && Command->kernel->hardware->powerManagement == gcvTRUE)
-    || (Command->kernel->hardware->gpuProfiler == gcvTRUE
-      && Command->kernel->profileEnable == gcvTRUE)
-    )
     {
         /* Commit done event by which work thread knows all jobs done. */
         gcmkVERIFY_OK(
index 5927434..a848eb3 100644 (file)
@@ -2777,20 +2777,6 @@ gckEVENT_Notify(
 #endif
 
             case gcvHAL_COMMIT_DONE:
-                if (kernel->hardware->gpuProfiler == gcvTRUE
-                  && kernel->profileEnable == gcvTRUE
-                  && kernel->profileSyncMode == gcvTRUE
-                )
-                {
-                    /*gckHARDWARE_UpdateContextProfile(
-                        kernel->hardware,
-                        gcmUINT64_TO_PTR(record->info.u.CommitDone.context)
-                        );*/
-                    gckHARDWARE_UpdateContextNewProfile(
-                        kernel->hardware,
-                        gcmUINT64_TO_PTR(record->info.u.CommitDone.context)
-                        );
-                }
                 break;
 
             default:
index f855a9e..1e62d87 100644 (file)
@@ -502,7 +502,6 @@ static const struct file_operations default_fops = {
 /***************************************************************************\
 ************************ Default Allocator **********************************
 \***************************************************************************/
-#define C_MAX_PAGENUM  (50*1024)
 static gceSTATUS
 _DefaultAlloc(
     IN gckALLOCATOR Allocator,
@@ -514,7 +513,7 @@ _DefaultAlloc(
     gceSTATUS status;
     gctUINT i;
     gctBOOL contiguous = Flags & gcvALLOC_FLAG_CONTIGUOUS;
-#ifdef CONFIG_GPU_LOW_MEMORY_KILLER
+#ifdef gcdSYS_FREE_MEMORY_LIMIT
     struct sysinfo temsysinfo;
 #endif
 
@@ -523,12 +522,12 @@ _DefaultAlloc(
 
     gcmkHEADER_ARG("Mdl=%p NumPages=%zu Flags=0x%x", Mdl, NumPages, Flags);
 
-#ifdef CONFIG_GPU_LOW_MEMORY_KILLER
+#ifdef gcdSYS_FREE_MEMORY_LIMIT
     si_meminfo(&temsysinfo);
 
     if (Flags & gcvALLOC_FLAG_MEMLIMIT)
     {
-        if ( (temsysinfo.freeram < NumPages) || ((temsysinfo.freeram-NumPages) < C_MAX_PAGENUM) )
+        if ( (temsysinfo.freeram < NumPages) || ((temsysinfo.freeram-NumPages) < gcdSYS_FREE_MEMORY_LIMIT) )
         {
             gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY);
         }
index 718fa86..f192e22 100644 (file)
@@ -907,8 +907,6 @@ _SetupVidMem(
         }
     }
 
-    printk("  requested contiguousBase = 0x%08X\n", device->requestedContiguousBase);
-
     return gcvSTATUS_OK;
 OnError:
     return status;
index 92fb2e5..32233cc 100644 (file)
@@ -266,9 +266,9 @@ typedef struct _gcsSIGNAL
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)
     /* Parent timeline. */
     struct sync_timeline * timeline;
-#else
+#  else
     struct fence *fence;
-#endif
+#  endif
 #endif
 }
 gcsSIGNAL;
index e5c13d5..b348ac1 100644 (file)
@@ -74,8 +74,8 @@
 #endif
 
 #if gcdANDROID_NATIVE_FENCE_SYNC
-#include <linux/file.h>
-#include "gc_hal_kernel_sync.h"
+#  include <linux/file.h>
+#  include "gc_hal_kernel_sync.h"
 #endif
 
 #if defined(CONFIG_ARM) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
@@ -5682,9 +5682,9 @@ gckOS_CreateSignal(
 #if gcdANDROID_NATIVE_FENCE_SYNC
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)
     signal->timeline = gcvNULL;
-#else
+#  else
     signal->fence = gcvNULL;
-#endif
+#  endif
 #endif
 
     gcmkONERROR(_AllocateIntegerId(&Os->signalDB, signal, &signal->id));
@@ -5806,9 +5806,9 @@ gckOS_Signal(
 #if gcdANDROID_NATIVE_FENCE_SYNC
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)
     struct sync_timeline * timeline = gcvNULL;
-#else
+#  else
     struct fence * fence = gcvNULL;
-#endif
+#  endif
 #endif
 
     gcmkHEADER_ARG("Os=0x%X Signal=0x%X State=%d", Os, Signal, State);
@@ -5832,10 +5832,10 @@ gckOS_Signal(
 #if gcdANDROID_NATIVE_FENCE_SYNC
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)
         timeline = signal->timeline;
-#else
+#  else
         fence = signal->fence;
         signal->fence = NULL;
-#endif
+#  endif
 #endif
     }
     else
@@ -5858,13 +5858,13 @@ gckOS_Signal(
     {
         sync_timeline_signal(timeline);
     }
-#else
+#  else
     if (fence)
     {
         fence_signal(fence);
         fence_put(fence);
     }
-#endif
+#  endif
 #endif
 
     /* Success. */
@@ -7211,7 +7211,7 @@ OnError:
     return status;
 }
 
-#else /* v4.9.0 */
+#  else /* v4.9.0 */
 
 gceSTATUS
 gckOS_CreateSyncTimeline(
@@ -7398,7 +7398,7 @@ OnError:
     return status;
 }
 
-#endif /* v4.9.0 */
+#  endif /* v4.9.0 */
 #endif
 
 #if gcdSECURITY
index 481bc5f..edbabab 100644 (file)
@@ -22,5 +22,6 @@ CUSTOMER_ALLOCATOR_OBJS := $(ALLOCATOR_ARRAY_H_LOCATION)/gc_hal_kernel_allocator
 EXTRA_CFLAGS += -DCLASS_NAME=\"gpu_class\"
 
 EXTRA_CFLAGS += -DgcdGPU_2D_TIMEOUT=20000
+EXTRA_CFLAGS += -DgcdSYS_FREE_MEMORY_LIMIT=51200
 
 EXTRA_CFLAGS += -DNO_DMA_COHERENT=1