void MTKPP_Init(void) { int i; struct { MTKPP_ID uid; MTKPP_BUFFERTYPE type; int data_size; int line_size; } MTKPP_TABLE[] = { {MTKPP_ID_FW, MTKPP_BUFFERTYPE_QUEUEBUFFER, 248 * 1024, 1 * 1024}, /* 256 KB */ {MTKPP_ID_SYNC, MTKPP_BUFFERTYPE_RINGBUFFER, 56 * 1024, 1 * 1024}, /* 64 KB */ }; for (i = 0; i < MTKPP_ID_SIZE; ++i) { if (i != MTKPP_TABLE[i].uid) { _MTKPP_DEBUG_LOG("%s: index(%d) != tabel_uid(%d)", __func__, i, MTKPP_TABLE[i].uid); goto err_out; } g_MTKPPdata[i] = MTKPP_AllocStruct(MTKPP_TABLE[i].type); if (g_MTKPPdata[i] == NULL) { _MTKPP_DEBUG_LOG("%s: alloc struct fail: flags = %d", __func__, MTKPP_TABLE[i].type); goto err_out; } if (MTKPP_TABLE[i].data_size > 0) { MTKPP_AllocData(g_MTKPPdata[i], MTKPP_TABLE[i].data_size, MTKPP_TABLE[i].line_size); MTKPP_CleanData(g_MTKPPdata[i]); } } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)) g_MTKPP_proc = proc_create("gpulog", 0, NULL, &g_MTKPP_proc_ops); #else g_MTKPP_proc = create_proc_entry("gpulog", 0, NULL); g_MTKPP_proc->proc_fops = &g_MTKPP_proc_ops; #endif #if defined(ENABLE_AEE_WHEN_LOCKUP) g_MTKPP_workqueue.psWorkQueue = alloc_ordered_workqueue("mwp", WQ_FREEZABLE | WQ_MEM_RECLAIM); INIT_WORK(&g_MTKPP_worker.sWork, MTKPP_WORKR_Handle); #endif g_init_done = 1; err_out: return; }
void MTKPP_4_SGXDumpDebugInfo_Aquire(void) { int i = 0; int allocate_size[] = { 1024 * 1024 * 4, // 4 MB 1024 * 1024 * 2, // 2 MB 1024 * 1024 * 1, // 1 MB 1024 * 512 // 512 KB }; MTK_PROC_PRINT_DATA *ppdata = g_MTKPPdata[MTKPP_ID_SGXDumpDebugInfo]; spin_lock_irqsave(&g_MTKPP_4_SGXDumpDebugInfo_lock, g_MTKPP_4_SGXDumpDebugInfo_irqflags); g_MTKPP_4_SGXDumpDebugInfo_current = (void *)current; /* try allocate by different size */ while (ppdata->data == NULL && i < ARRAY_SIZE(allocate_size)) { MTKPP_AllocData(ppdata, allocate_size[i++], 1024 * 64); if (ppdata->data != NULL) { MTKPP_CleanData(ppdata); break; } } if (ppdata->data == NULL) { PVR_DPF((PVR_DBG_ERROR, "%s: fail to allocate 512 KB for gpulog", __func__)); } /* print for reocrding start time */ MTKPP_PrintQueueBuffer2(ppdata, "=== start ==="); }
void MTKPP_Init(void) { int i; struct { MTKPP_ID uid; MTKPP_BUFFERTYPE type; int data_size; int max_line; } mtk_pp_register_tabls[] = { /* buffer is allocated in MTK_PP_4_SGXOSTimer_register */ {MTKPP_ID_SGXDumpDebugInfo, MTKPP_BUFFERTYPE_QUEUEBUFFER, 0, 0}, {MTKPP_ID_DEVMEM, MTKPP_BUFFERTYPE_RINGBUFFER, 1024 * 1024 * 2, 1024 * 64}, {MTKPP_ID_SYNC, MTKPP_BUFFERTYPE_RINGBUFFER, 1024 * 8, 128}, {MTKPP_ID_MUTEX, MTKPP_BUFFERTYPE_RINGBUFFER, 1024 * 32, 512}, }; for (i = 0; i < MTKPP_ID_SIZE; ++i) { if (i != mtk_pp_register_tabls[i].uid) { _MTKPP_DEBUG_LOG("%s: index(%d) != tabel_uid(%d)", __func__, i, mtk_pp_register_tabls[i].uid); goto err_out; } g_MTKPPdata[i] = MTKPP_AllocStruct(mtk_pp_register_tabls[i].type); if (g_MTKPPdata[i] == NULL) { _MTKPP_DEBUG_LOG("%s: alloc struct fail: flags = %d", __func__, mtk_pp_register_tabls[i].type); goto err_out; } if (mtk_pp_register_tabls[i].data_size > 0) { MTKPP_AllocData( g_MTKPPdata[i], mtk_pp_register_tabls[i].data_size, mtk_pp_register_tabls[i].max_line ); MTKPP_CleanData(g_MTKPPdata[i]); } } g_MTKPP_proc = create_proc_entry("gpulog", 0, NULL); g_MTKPP_proc->proc_fops = &g_MTKPP_proc_ops; g_MTKPP_4_SGXDumpDebugInfo_current = NULL; spin_lock_init(&g_MTKPP_4_SGXDumpDebugInfo_lock); #if defined(ENABLE_AEE_WHEN_LOCKUP) g_MTKPP_workqueue.psWorkQueue = alloc_ordered_workqueue("mwp", WQ_FREEZABLE | WQ_MEM_RECLAIM); INIT_WORK(&g_MTKPP_worker.sWork, MTKPP_WORKR_Handle); #endif return; err_out: return; }