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);
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))
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;
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)
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(
#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:
/***************************************************************************\
************************ Default Allocator **********************************
\***************************************************************************/
-#define C_MAX_PAGENUM (50*1024)
static gceSTATUS
_DefaultAlloc(
IN gckALLOCATOR Allocator,
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
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);
}
}
}
- printk(" requested contiguousBase = 0x%08X\n", device->requestedContiguousBase);
-
return gcvSTATUS_OK;
OnError:
return status;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,9,0)
/* Parent timeline. */
struct sync_timeline * timeline;
-#else
+# else
struct fence *fence;
-#endif
+# endif
#endif
}
gcsSIGNAL;
#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)
#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));
#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);
#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
{
sync_timeline_signal(timeline);
}
-#else
+# else
if (fence)
{
fence_signal(fence);
fence_put(fence);
}
-#endif
+# endif
#endif
/* Success. */
return status;
}
-#else /* v4.9.0 */
+# else /* v4.9.0 */
gceSTATUS
gckOS_CreateSyncTimeline(
return status;
}
-#endif /* v4.9.0 */
+# endif /* v4.9.0 */
#endif
#if gcdSECURITY
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