UDOO board support, recipe for UDOO KernelUnico 2013 maintaned by UDOO manufacturer
PATCH 1/1 UDOO board support, recipe for UDOO KernelUnico 2013 maintaned by UDOO manufacturer
From: Luca Simone Ronga <[email protected]>
Dear Freescale community,
here is the kernel recipe for the UDOO Board kernel branch maintained by SECO (KernelUnico 2013).
I wish to thank John Weber and Otavio Salvador for their useful comments. L.
--- ...8-4.6.9p11.1-gpu-GPU-Kernel-driver-integr.patch | 1040 ++++++++++ ...Fix-getrusage-related-build-failure-on-gl.patch | 43 + ...fix-memset-related-crashes-caused-by-rece.patch | 259 +++ ...5-gpu-Add-global-value-for-minimum-3D-clo.patch | 62 + .../0003-ARM-7670-1-fix-the-memset-fix.patch | 87 + ...4-4-gpu-use-new-PU-power-on-off-interface.patch | 53 + ...8-1-GPU-Integrate-4.6.9p12-release-kernel.patch | 2006 ++++++++++++++++++++ ...6-Fix-build-break-when-CONFIG_CLK_DEBUG-i.patch | 43 + ...5-GPU-Correct-suspend-resume-calling-afte.patch | 61 + ...0005-ENGR00271359-Add-Multi-touch-support.patch | 98 + .../0006-Add-support-for-DVI-monitors.patch | 227 +++ ...0-gpu-Correct-section-mismatch-in-gpu-ker.patch | 60 + ...6-board-mx6q_sabresd-Register-SDHC3-first.patch | 38 + recipes-kernel/linux/linux-udoo-3.0.35/defconfig | 246 +++ ...m-vivante-Add-00-sufix-in-returned-bus-Id.patch | 31 + ...-Rename-mxcfb_epdc_kernel.h-to-mxc_epdc.h.patch | 143 ++ recipes-kernel/linux/linux-udoo.inc | 17 + recipes-kernel/linux/linux-udoo_3.0.35.bb | 26 + 18 files changed, 4540 insertions(+) create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0001-ENGR00255688-4.6.9p11.1-gpu-GPU-Kernel-driver-integr.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0001-perf-tools-Fix-getrusage-related-build-failure-on-gl.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0002-ARM-7668-1-fix-memset-related-crashes-caused-by-rece.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0002-ENGR00265465-gpu-Add-global-value-for-minimum-3D-clo.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0003-ARM-7670-1-fix-the-memset-fix.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0003-ENGR00261814-4-gpu-use-new-PU-power-on-off-interface.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0004-ENGR00264288-1-GPU-Integrate-4.6.9p12-release-kernel.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0004-ENGR00271136-Fix-build-break-when-CONFIG_CLK_DEBUG-i.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0005-ENGR00264275-GPU-Correct-suspend-resume-calling-afte.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0005-ENGR00271359-Add-Multi-touch-support.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0006-Add-support-for-DVI-monitors.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0006-ENGR00265130-gpu-Correct-section-mismatch-in-gpu-ker.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/0007-ARM-mach-mx6-board-mx6q_sabresd-Register-SDHC3-first.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/defconfig create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/drm-vivante-Add-00-sufix-in-returned-bus-Id.patch create mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/epdc-Rename-mxcfb_epdc_kernel.h-to-mxc_epdc.h.patch create mode 100644 recipes-kernel/linux/linux-udoo.inc create mode 100644 recipes-kernel/linux/linux-udoo_3.0.35.bb
recipes-kernel/linux/linux-udoo-3.0.35/0001-ENGR00255688-4.6.9p11.1-gpu-GPU-Kernel-driver-integr.patch new file +1040 -0
@@ -0,0 +1,1040 @@ +From 46e3a6de5adb9379f9d6eef2c038c2f18637d407 Mon Sep 17 00:00:00 2001 +From: Loren Huang <[email protected]> +Date: Mon, 25 Mar 2013 15:43:57 +0800 +Subject: [PATCH 1/6] ENGR00255688 4.6.9p11.1 [gpu]GPU Kernel driver + integration + +4.6.9p11.1 GPU kernel driver integration +Cherry pick from imx_3.0.35 + +Upstream-Status: Backport [3.5.7-1.0.0] + +Signed-off-by: Loren Huang <[email protected]> +Acked-by: Lily Zhang +--- + drivers/mxc/gpu-viv/Kbuild | 2 +- + .../arch/XAQ2/hal/kernel/gc_hal_kernel_context.c | 2 +- + .../arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | 7 +- + drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h | 2 +- + drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | 53 ++++-- + .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c | 5 +- + drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c | 178 ++++++++++++--------- + .../hal/kernel/gc_hal_kernel_video_memory.c | 3 +- + .../gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h | 13 +- + drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h | 25 +++ + .../mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | 35 ++++ + .../mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h | 2 +- + .../hal/os/linux/kernel/gc_hal_kernel_driver.c | 2 +- + .../hal/os/linux/kernel/gc_hal_kernel_linux.h | 6 + + .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | 82 +++++++++- + 15 files changed, 304 insertions(+), 113 deletions(-) + +diff --git a/drivers/mxc/gpu-viv/Kbuild b/drivers/mxc/gpu-viv/Kbuild +index 0b18a7b..93b1259 100644 +--- a/drivers/mxc/gpu-viv/Kbuild ++++ b/drivers/mxc/gpu-viv/Kbuild +@@ -1,6 +1,6 @@ + ############################################################################## + # +-# Copyright (C) 2005 - 2012 by Vivante Corp. ++# Copyright (C) 2005 - 2013 by Vivante Corp. + # + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c +index 22e1f27..24003e7 100644 +--- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c ++++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c +@@ -471,7 +471,7 @@ _InitializeContextBuffer( + index += _SwitchPipe(Context, index, gcvPIPE_3D); + + /* Current context pointer. */ +-#if gcdDEBUG ++#if gcdDEBUG + index += _State(Context, index, 0x03850 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); + #endif + +diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c +index a87259e..3829999 100644 +--- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c ++++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c +@@ -232,7 +232,8 @@ _IdentifyHardware( + } + + /* Exception for GC1000, revision 5035 & GC800, revision 4612 */ +- if (((Identity->chipModel == gcv1000) && (Identity->chipRevision == 0x5035)) ++ if (((Identity->chipModel == gcv1000) && ((Identity->chipRevision == 0x5035) ++ || (Identity->chipRevision == 0x5036))) + || ((Identity->chipModel == gcv800) && (Identity->chipRevision == 0x4612))) + { + Identity->superTileMode = 1; +@@ -751,7 +752,7 @@ gckHARDWARE_Construct( + /* Initialize the fast clear. */ + gcmkONERROR(gckHARDWARE_SetFastClear(hardware, -1, -1)); + +-#if !gcdENABLE_128B_MERGE ++#if !gcdENABLE_128B_MERGE + + if (((((gctUINT32) (hardware->identity.chipMinorFeatures2)) >> (0 ? 21:21) & ((gctUINT32) ((((1 ? 21:21) - (0 ? 21:21) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:21) - (0 ? 21:21) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 21:21) - (0 ? 21:21) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:21) - (0 ? 21:21) + 1)))))))) + { +@@ -1027,7 +1028,7 @@ gckHARDWARE_InitializeHardware( + 0x00424, + baseAddress)); + +-#if !VIVANTE_PROFILER ++#if !VIVANTE_PROFILER + { + gctUINT32 data; + +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h +index 1da80b7..5896e93 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h +@@ -186,7 +186,7 @@ typedef struct _gcsDATABASE + gctUINT64 idle; + + /* Pointer to database. */ +- gcsDATABASE_RECORD_PTR list; ++ gcsDATABASE_RECORD_PTR list[48]; + + #if gcdSECURE_USER + /* Secure cache. */ +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c +index 1fb18fb..bc5f083 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c +@@ -26,6 +26,9 @@ + /******************************************************************************* + ***** Private fuctions ********************************************************/ + ++#define _GetSlot(database, x) \ ++ (gctUINT32)(((gcmPTR_TO_UINT64(x) >> 7) % gcmCOUNTOF(database->list))) ++ + /******************************************************************************* + ** gckKERNEL_NewDatabase + ** +@@ -56,6 +59,7 @@ gckKERNEL_NewDatabase( + gcsDATABASE_PTR database; + gctBOOL acquired = gcvFALSE; + gctSIZE_T slot; ++ gcsDATABASE_PTR existingDatabase; + + gcmkHEADER_ARG("Kernel=0x%x ProcessID=%d", Kernel, ProcessID); + +@@ -63,6 +67,21 @@ gckKERNEL_NewDatabase( + gcmkONERROR(gckOS_AcquireMutex(Kernel->os, Kernel->db->dbMutex, gcvINFINITE)); + acquired = gcvTRUE; + ++ /* Compute the hash for the database. */ ++ slot = ProcessID % gcmCOUNTOF(Kernel->db->db); ++ ++ /* Walk the hash list. */ ++ for (existingDatabase = Kernel->db->db[slot]; ++ existingDatabase != gcvNULL; ++ existingDatabase = existingDatabase->next) ++ { ++ if (existingDatabase->processID == ProcessID) ++ { ++ /* One process can't be added twice. */ ++ gcmkONERROR(gcvSTATUS_NOT_SUPPORTED); ++ } ++ } ++ + if (Kernel->db->freeDatabase != gcvNULL) + { + /* Allocate a database from the free list. */ +@@ -81,9 +100,6 @@ gckKERNEL_NewDatabase( + database = pointer; + } + +- /* Compute the hash for the database. */ +- slot = ProcessID % gcmCOUNTOF(Kernel->db->db); +- + /* Insert the database into the hash. */ + database->next = Kernel->db->db[slot]; + Kernel->db->db[slot] = database; +@@ -350,6 +366,7 @@ static gceSTATUS + gckKERNEL_NewRecord( + IN gckKERNEL Kernel, + IN gcsDATABASE_PTR Database, ++ IN gctUINT32 Slot, + OUT gcsDATABASE_RECORD_PTR * Record + ) + { +@@ -383,8 +400,8 @@ gckKERNEL_NewRecord( + } + + /* Insert the record in the database. */ +- record->next = Database->list; +- Database->list = record; ++ record->next = Database->list[Slot]; ++ Database->list[Slot] = record; + + /* Release the database mutex. */ + gcmkONERROR(gckOS_ReleaseMutex(Kernel->os, Kernel->db->dbMutex)); +@@ -449,6 +466,7 @@ gckKERNEL_DeleteRecord( + gceSTATUS status; + gctBOOL acquired = gcvFALSE; + gcsDATABASE_RECORD_PTR record, previous; ++ gctUINT32 slot = _GetSlot(Database, Data); + + gcmkHEADER_ARG("Kernel=0x%x Database=0x%x Type=%d Data=0x%x", + Kernel, Database, Type, Data); +@@ -458,8 +476,9 @@ gckKERNEL_DeleteRecord( + gckOS_AcquireMutex(Kernel->os, Kernel->db->dbMutex, gcvINFINITE)); + acquired = gcvTRUE; + ++ + /* Scan the database for this record. */ +- for (record = Database->list, previous = gcvNULL; ++ for (record = Database->list[slot], previous = gcvNULL; + record != gcvNULL; + record = record->next + ) +@@ -490,7 +509,7 @@ gckKERNEL_DeleteRecord( + /* Remove record from database. */ + if (previous == gcvNULL) + { +- Database->list = record->next; ++ Database->list[slot] = record->next; + } + else + { +@@ -557,6 +576,7 @@ gckKERNEL_FindRecord( + gceSTATUS status; + gctBOOL acquired = gcvFALSE; + gcsDATABASE_RECORD_PTR record; ++ gctUINT32 slot = _GetSlot(Database, Data); + + gcmkHEADER_ARG("Kernel=0x%x Database=0x%x Type=%d Data=0x%x", + Kernel, Database, Type, Data); +@@ -567,7 +587,7 @@ gckKERNEL_FindRecord( + acquired = gcvTRUE; + + /* Scan the database for this record. */ +- for (record = Database->list; ++ for (record = Database->list[slot]; + record != gcvNULL; + record = record->next + ) +@@ -642,6 +662,7 @@ gckKERNEL_CreateProcessDB( + { + gceSTATUS status; + gcsDATABASE_PTR database = gcvNULL; ++ gctUINT32 i; + + gcmkHEADER_ARG("Kernel=0x%x ProcessID=%d", Kernel, ProcessID); + +@@ -668,7 +689,11 @@ gckKERNEL_CreateProcessDB( + database->mapUserMemory.bytes = 0; + database->mapUserMemory.maxBytes = 0; + database->mapUserMemory.totalBytes = 0; +- database->list = gcvNULL; ++ ++ for (i = 0; i < gcmCOUNTOF(database->list); i++) ++ { ++ database->list[i] = gcvNULL; ++ } + + #if gcdSECURE_USER + { +@@ -848,7 +873,7 @@ gckKERNEL_AddProcessDB( + gcmkONERROR(gckKERNEL_FindDatabase(Kernel, ProcessID, gcvFALSE, &database)); + + /* Create a new record in the database. */ +- gcmkONERROR(gckKERNEL_NewRecord(Kernel, database, &record)); ++ gcmkONERROR(gckKERNEL_NewRecord(Kernel, database, _GetSlot(database, Pointer), &record)); + + /* Initialize the record. */ + record->kernel = Kernel; +@@ -1086,6 +1111,7 @@ gckKERNEL_DestroyProcessDB( + gctPHYS_ADDR physical; + gcuVIDMEM_NODE_PTR node; + gckKERNEL kernel = Kernel; ++ gctUINT32 i; + + gcmkHEADER_ARG("Kernel=0x%x ProcessID=%d", Kernel, ProcessID); + +@@ -1126,8 +1152,11 @@ gckKERNEL_DestroyProcessDB( + ProcessID); + } + ++ for(i = 0; i < gcmCOUNTOF(database->list); i++) ++ { ++ + /* Walk all records. */ +- for (record = database->list; record != gcvNULL; record = next) ++ for (record = database->list[i]; record != gcvNULL; record = next) + { + /* Next next record. */ + next = record->next; +@@ -1293,6 +1322,8 @@ gckKERNEL_DestroyProcessDB( + gcvNULL)); + } + ++ } ++ + /* Delete the database. */ + gcmkONERROR(gckKERNEL_DeleteDatabase(Kernel, database)); + +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c +index f78d096..217f7f1 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c +@@ -959,6 +959,8 @@ gckEVENT_AddList( + record->kernel = Event->kernel; + #endif + ++ gcmkONERROR(__RemoveRecordFromProcessDB(Event, record)); ++ + /* Acquire the mutex. */ + gcmkONERROR(gckOS_AcquireMutex(Event->os, Event->eventListMutex, gcvINFINITE)); + acquired = gcvTRUE; +@@ -1539,9 +1541,6 @@ gckEVENT_Submit( + gcmkONERROR(gckOS_ReleaseMutex(Event->os, Event->eventListMutex)); + acquired = gcvFALSE; + +- gcmkONERROR(__RemoveRecordFromProcessDB(Event, +- Event->queues[id].head)); +- + #if gcdNULL_DRIVER + /* Notify immediately on infinite hardware. */ + gcmkONERROR(gckEVENT_Interrupt(Event, 1 << id)); +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c +index 0c71e28..43c9297 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c +@@ -97,6 +97,43 @@ static gcsMirrorPageTable_PTR mirrorPageTable = gcvNULL; + static gctPOINTER mirrorPageTableMutex = gcvNULL; + #endif + ++static void ++_WritePageEntry( ++ IN gctUINT32_PTR PageEntry, ++ IN gctUINT32 EntryValue ++ ) ++{ ++ static gctUINT16 data = 0xff00; ++ ++ if (*(gctUINT8 *)&data == 0xff) ++ { ++ *PageEntry = gcmSWAB32(EntryValue); ++ } ++ else ++ { ++ *PageEntry = EntryValue; ++ } ++} ++ ++static gctUINT32 ++_ReadPageEntry( ++ IN gctUINT32_PTR PageEntry ++ ) ++{ ++ static gctUINT16 data = 0xff00; ++ gctUINT32 entryValue; ++ ++ if (*(gctUINT8 *)&data == 0xff) ++ { ++ entryValue = *PageEntry; ++ return gcmSWAB32(entryValue); ++ } ++ else ++ { ++ return *PageEntry; ++ } ++} ++ + static gceSTATUS + _FillPageTable( + IN gctUINT32_PTR PageTable, +@@ -108,7 +145,7 @@ _FillPageTable( + + for (i = 0; i < PageCount; i++) + { +- PageTable[i] = EntryValue; ++ _WritePageEntry(PageTable + i, EntryValue); + } + + return gcvSTATUS_OK; +@@ -132,16 +169,16 @@ _Link( + gctUINT32_PTR pageTable = Mmu->pageTableLogical; + + /* Dispatch on node type. */ +- switch (gcmENTRY_TYPE(pageTable[Index])) ++ switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[Index]))) + { + case gcvMMU_SINGLE: + /* Set single index. */ +- pageTable[Index] = (Next << 8) | gcvMMU_SINGLE; ++ _WritePageEntry(&pageTable[Index], (Next << 8) | gcvMMU_SINGLE); + break; + + case gcvMMU_FREE: + /* Set index. */ +- pageTable[Index + 1] = Next; ++ _WritePageEntry(&pageTable[Index + 1], Next); + break; + + default: +@@ -167,13 +204,13 @@ _AddFree( + if (Count == 1) + { + /* Initialize a single page node. */ +- pageTable[Node] = (~((1U<<8)-1)) | gcvMMU_SINGLE; ++ _WritePageEntry(pageTable + Node, (~((1U<<8)-1)) | gcvMMU_SINGLE); + } + else + { + /* Initialize the node. */ +- pageTable[Node + 0] = (Count << 8) | gcvMMU_FREE; +- pageTable[Node + 1] = ~0U; ++ _WritePageEntry(pageTable + Node + 0, (Count << 8) | gcvMMU_FREE); ++ _WritePageEntry(pageTable + Node + 1, ~0U); + } + + /* Append the node. */ +@@ -196,7 +233,7 @@ _Collect( + for (i = 0; i < Mmu->pageTableEntries; ++i) + { + /* Dispatch based on type of page. */ +- switch (gcmENTRY_TYPE(pageTable[i])) ++ switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[i]))) + { + case gcvMMU_USED: + /* Used page, so close any open node. */ +@@ -229,10 +266,10 @@ _Collect( + } + + /* Advance the count. */ +- count += pageTable[i] >> 8; ++ count += _ReadPageEntry(&pageTable[i]) >> 8; + + /* Advance the index into the page table. */ +- i += (pageTable[i] >> 8) - 1; ++ i += (_ReadPageEntry(&pageTable[i]) >> 8) - 1; + break; + + default: +@@ -341,19 +378,20 @@ _FillFlatMapping( + gcmkONERROR(gcvSTATUS_NOT_ALIGNED); + } + +- *(Mmu->mtlbLogical + mStart) +- = stlb->physBase +- /* 64KB page size */ +- | (1 << 2) +- /* Ignore exception */ +- | (0 << 1) +- /* Present */ +- | (1 << 0); ++ _WritePageEntry(Mmu->mtlbLogical + mStart, ++ stlb->physBase ++ /* 64KB page size */ ++ | (1 << 2) ++ /* Ignore exception */ ++ | (0 << 1) ++ /* Present */ ++ | (1 << 0) ++ ); + #if gcdMMU_TABLE_DUMP + gckOS_Print("%s(%d): insert MTLB[%d]: %08x\n", + __FUNCTION__, __LINE__, + mStart, +- *(Mmu->mtlbLogical + mStart)); ++ _ReadPageEntry(Mmu->mtlbLogical + mStart)); + #endif + + stlb->mtlbIndex = mStart; +@@ -368,12 +406,12 @@ _FillFlatMapping( + while (sStart <= last) + { + gcmkASSERT(!(start & gcdMMU_PAGE_64K_MASK)); +- *(stlb->logical + sStart) = _SetPage(start); ++ _WritePageEntry(stlb->logical + sStart, _SetPage(start)); + #if gcdMMU_TABLE_DUMP + gckOS_Print("%s(%d): insert STLB[%d]: %08x\n", + __FUNCTION__, __LINE__, + sStart, +- *(stlb->logical + sStart)); ++ _ReadPageEntry(stlb->logical + sStart)); + #endif + /* next page. */ + start += gcdMMU_PAGE_64K_SIZE; +@@ -428,7 +466,7 @@ OnError: + if (pre->mtlbEntryNum != 0) + { + gcmkASSERT(pre->mtlbEntryNum == 1); +- *(Mmu->mtlbLogical + pre->mtlbIndex) = 0; ++ _WritePageEntry(Mmu->mtlbLogical + pre->mtlbIndex, 0); + } + + gcmkVERIFY_OK(gcmkOS_SAFE_FREE(Mmu->os, pre)); +@@ -493,8 +531,8 @@ _SetupDynamicSpace( + + /* Initilization. */ + pageTable = Mmu->pageTableLogical; +- pageTable[0] = (Mmu->pageTableEntries << 8) | gcvMMU_FREE; +- pageTable[1] = ~0U; ++ _WritePageEntry(pageTable, (Mmu->pageTableEntries << 8) | gcvMMU_FREE); ++ _WritePageEntry(pageTable + 1, ~0U); + Mmu->heapList = 0; + Mmu->freeNodes = gcvFALSE; + +@@ -509,18 +547,20 @@ _SetupDynamicSpace( + /* Map to Master TLB. */ + for (; i < gcdMMU_MTLB_ENTRY_NUM; i++) + { +- Mmu->mtlbLogical[i] = physical +- /* 4KB page size */ +- | (0 << 2) +- /* Ignore exception */ +- | (0 << 1) +- /* Present */ +- | (1 << 0); ++ _WritePageEntry(Mmu->mtlbLogical + i, ++ physical ++ /* 4KB page size */ ++ | (0 << 2) ++ /* Ignore exception */ ++ | (0 << 1) ++ /* Present */ ++ | (1 << 0) ++ ); + #if gcdMMU_TABLE_DUMP + gckOS_Print("%s(%d): insert MTLB[%d]: %08x\n", + __FUNCTION__, __LINE__, + i, +- *(Mmu->mtlbLogical + i)); ++ _ReadPageEntry(Mmu->mtlbLogical + i)); + #endif + physical += gcdMMU_STLB_4K_SIZE; + } +@@ -645,18 +685,11 @@ _Construct( + pageTable = mmu->pageTableLogical; + + #if gcdMMU_CLEAR_VALUE +- { +- gctUINT32 i; +- +- for (i = 0; i < mmu->pageTableEntries; ++i) +- { +- pageTable[i] = gcdMMU_CLEAR_VALUE; +- } +- } ++ _FillPageTable(pageTable, mmu->pageTableEntries, gcdMMU_CLEAR_VALUE); + #endif + +- pageTable[0] = (mmu->pageTableEntries << 8) | gcvMMU_FREE; +- pageTable[1] = ~0U; ++ _WritePageEntry(pageTable, (mmu->pageTableEntries << 8) | gcvMMU_FREE); ++ _WritePageEntry(pageTable + 1, ~0U); + mmu->heapList = 0; + mmu->freeNodes = gcvFALSE; + +@@ -797,7 +830,7 @@ _Destroy( + if (pre->mtlbEntryNum != 0) + { + gcmkASSERT(pre->mtlbEntryNum == 1); +- *(Mmu->mtlbLogical + pre->mtlbIndex) = 0; ++ _WritePageEntry(Mmu->mtlbLogical + pre->mtlbIndex, 0); + #if gcdMMU_TABLE_DUMP + gckOS_Print("%s(%d): clean MTLB[%d]\n", + __FUNCTION__, __LINE__, +@@ -1044,7 +1077,7 @@ _AllocatePages( + for (index = Mmu->heapList; !gotIt && (index < Mmu->pageTableEntries);) + { + /* Check the node type. */ +- switch (gcmENTRY_TYPE(pageTable[index])) ++ switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[index]))) + { + case gcvMMU_SINGLE: + /* Single odes are valid if we only need 1 page. */ +@@ -1056,13 +1089,13 @@ _AllocatePages( + { + /* Move to next node. */ + previous = index; +- index = pageTable[index] >> 8; ++ index = _ReadPageEntry(&pageTable[index]) >> 8; + } + break; + + case gcvMMU_FREE: + /* Test if the node has enough space. */ +- if (PageCount <= (pageTable[index] >> 8)) ++ if (PageCount <= (_ReadPageEntry(&pageTable[index]) >> 8)) + { + gotIt = gcvTRUE; + } +@@ -1070,7 +1103,7 @@ _AllocatePages( + { + /* Move to next node. */ + previous = index; +- index = pageTable[index + 1]; ++ index = _ReadPageEntry(&pageTable[index + 1]); + } + break; + +@@ -1099,36 +1132,36 @@ _AllocatePages( + } + } + +- switch (gcmENTRY_TYPE(pageTable[index])) ++ switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[index]))) + { + case gcvMMU_SINGLE: + /* Unlink single node from free list. */ + gcmkONERROR( +- _Link(Mmu, previous, pageTable[index] >> 8)); ++ _Link(Mmu, previous, _ReadPageEntry(&pageTable[index]) >> 8)); + break; + + case gcvMMU_FREE: + /* Check how many pages will be left. */ +- left = (pageTable[index] >> 8) - PageCount; ++ left = (_ReadPageEntry(&pageTable[index]) >> 8) - PageCount; + switch (left) + { + case 0: + /* The entire node is consumed, just unlink it. */ + gcmkONERROR( +- _Link(Mmu, previous, pageTable[index + 1])); ++ _Link(Mmu, previous, _ReadPageEntry(&pageTable[index + 1]))); + break; + + case 1: + /* One page will remain. Convert the node to a single node and + ** advance the index. */ +- pageTable[index] = (pageTable[index + 1] << 8) | gcvMMU_SINGLE; ++ _WritePageEntry(&pageTable[index], (_ReadPageEntry(&pageTable[index + 1]) << 8) | gcvMMU_SINGLE); + index ++; + break; + + default: + /* Enough pages remain for a new node. However, we will just adjust + ** the size of the current node and advance the index. */ +- pageTable[index] = (left << 8) | gcvMMU_FREE; ++ _WritePageEntry(&pageTable[index], (left << 8) | gcvMMU_FREE); + index += left; + break; + } +@@ -1232,35 +1265,32 @@ _FreePages( + #if gcdMMU_CLEAR_VALUE + if (Mmu->hardware->mmuVersion == 0) + { +- gctUINT32 i; +- +- for (i = 0; i < PageCount; ++i) +- { +- pageTable[i] = gcdMMU_CLEAR_VALUE; +- } ++ _FillPageTable(pageTable, PageCount, gcdMMU_CLEAR_VALUE); + } + #endif + + if (PageCount == 1) + { + /* Single page node. */ +- pageTable[0] = (~((1U<<8)-1)) | gcvMMU_SINGLE ++ _WritePageEntry(pageTable, ++ (~((1U<<8)-1)) | gcvMMU_SINGLE + #if gcdUSE_MMU_EXCEPTION +- /* Enable exception */ +- | (1 << 1) ++ /* Enable exception */ ++ | 1 << 1 + #endif +- ; ++ ); + } + else + { + /* Mark the node as free. */ +- pageTable[0] = (PageCount << 8) | gcvMMU_FREE ++ _WritePageEntry(pageTable, ++ (PageCount << 8) | gcvMMU_FREE + #if gcdUSE_MMU_EXCEPTION +- /* Enable exception */ +- | (1 << 1) ++ /* Enable exception */ ++ | 1 << 1 + #endif +- ; +- pageTable[1] = ~0U; ++ ); ++ _WritePageEntry(pageTable + 1, ~0U); + + #if gcdUSE_MMU_EXCEPTION + /* Enable exception */ +@@ -1509,12 +1539,8 @@ gckMMU_SetPage( + data = _SetPage(PageAddress); + } + +- if (Mmu->hardware->bigEndian) +- { +- data = gcmSWAB32(data); +- } ++ _WritePageEntry(PageEntry, data); + +- *PageEntry = data; + #if gcdMIRROR_PAGETABLE + for (i = 0; i < mirrorPageTable->reference; i++) + { +@@ -1526,11 +1552,11 @@ gckMMU_SetPage( + + if (mmu->hardware->mmuVersion == 0) + { +- *pageEntry = PageAddress; ++ _WritePageEntry(pageEntry, PageAddress); + } + else + { +- *pageEntry = _SetPage(PageAddress); ++ _WritePageEntry(pageEntry, _SetPage(PageAddress)); + } + } + +@@ -1734,7 +1760,7 @@ gckMMU_DumpPageTableEntry( + * gcdMMU_STLB_4K_ENTRY_NUM + + stlb; + +- gcmkPRINT(" Page table entry = 0x%08X", pageTable[index]); ++ gcmkPRINT(" Page table entry = 0x%08X", _ReadPageEntry(pageTable + index)); + } + + gcmkFOOTER_NO(); +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c +index d49aa64..8a442a2 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c +@@ -1027,7 +1027,8 @@ gckVIDMEM_AllocateLinear( + ) + { + /* The left memory is for small memory.*/ +- gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); ++ status = gcvSTATUS_OUT_OF_MEMORY; ++ goto OnError; + } + #endif + +diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h +index 496276e..06eea79 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h +@@ -227,7 +227,8 @@ gcoOS_GetDisplayInfoEx( + ); + + gceSTATUS +-gcoOS_GetNextDisplayInfoEx( ++gcoOS_GetNextDisplayInfoExByIndex( ++ IN gctINT Index, + IN HALNativeDisplayType Display, + IN HALNativeWindowType Window, + IN gctUINT DisplayInfoSize, +@@ -274,15 +275,15 @@ gcoOS_SetDisplayVirtualEx( + + gceSTATUS + gcoOS_SetSwapInterval( +- IN HALNativeDisplayType Display, +- IN gctINT Interval ++ IN HALNativeDisplayType Display, ++ IN gctINT Interval + ); + + gceSTATUS + gcoOS_GetSwapInterval( +- IN HALNativeDisplayType Display, +- IN gctINT_PTR Min, +- IN gctINT_PTR Max ++ IN HALNativeDisplayType Display, ++ IN gctINT_PTR Min, ++ IN gctINT_PTR Max + ); + + gceSTATUS +diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h +index d441d1d..249b61b 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h +@@ -1430,6 +1430,16 @@ typedef enum _gceTEXTURE_FACE + } + gceTEXTURE_FACE; + ++#if gcdFORCE_MIPMAP ++typedef enum ++{ ++ gcvForceMipDisabled = 0, ++ gcvForceMipEnable = 1, ++ gcvForceMipGenerated = 2, ++ gcvForceMipNever = 3, ++}gceFORCE_MIPMAP; ++#endif ++ + typedef struct _gcsTEXTURE + { + /* Addressing modes. */ +@@ -1446,6 +1456,10 @@ typedef struct _gcsTEXTURE + gceTEXTURE_FILTER mipFilter; + gctUINT anisoFilter; + gctBOOL forceTopLevel; ++ gctBOOL autoMipmap; ++#if gcdFORCE_MIPMAP ++ gceFORCE_MIPMAP forceMipmap; ++#endif + /* Level of detail. */ + gctFIXED_POINT lodBias; + gctFIXED_POINT lodMin; +@@ -1479,7 +1493,18 @@ gceSTATUS + gcoTEXTURE_Destroy( + IN gcoTEXTURE Texture + ); ++#if gcdFORCE_MIPMAP ++gceSTATUS ++gcoTEXTURE_DestroyForceMipmap( ++ IN gcoTEXTURE Texture ++ ); + ++gceSTATUS ++gcoTEXTURE_GetMipLevels( ++ IN gcoTEXTURE Texture, ++ OUT gctINT * levels ++ ); ++#endif + /* Replace a mipmap in gcoTEXTURE object. */ + gceSTATUS + gcoTEXTURE_ReplaceMipMap( +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 86e9133..afe83d0 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 +@@ -114,6 +114,30 @@ + #define COMMAND_PROCESSOR_VERSION 1 + + /* ++ gcdDUMP_KEY ++ ++ Set this to a string that appears in 'cat /proc/<pid>/cmdline'. E.g. 'camera'. ++ HAL will create dumps for the processes matching this key. ++*/ ++#ifndef gcdDUMP_KEY ++# define gcdDUMP_KEY "process" ++#endif ++ ++/* ++ gcdDUMP_PATH ++ ++ The dump file location. Some processes cannot write to the sdcard. ++ Try apps' data dir, e.g. /data/data/com.android.launcher ++*/ ++#ifndef gcdDUMP_PATH ++#if defined(ANDROID) ++# define gcdDUMP_PATH "/mnt/sdcard/" ++#else ++# define gcdDUMP_PATH "./" ++#endif ++#endif ++ ++/* + gcdDUMP + + When set to 1, a dump of all states and memory uploads, as well as other +@@ -342,6 +366,17 @@ + #endif + + /* ++ gcdUSER_HEAP_ALLOCATOR ++ ++ Set to 1 to enable user mode heap allocator for fast memory allocation ++ and destroying. Otherwise, memory allocation/destroying in user mode ++ will be directly managed by system. Only for linux for now. ++*/ ++#ifndef gcdUSER_HEAP_ALLOCATOR ++# define gcdUSER_HEAP_ALLOCATOR 1 ++#endif ++ ++/* + gcdHEAP_SIZE + + Set the allocation size for the internal heaps. Each time a heap is +diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h +index 2881604..808fde0 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h +@@ -28,7 +28,7 @@ + + #define gcvVERSION_PATCH 9 + +-#define gcvVERSION_BUILD 1210 ++#define gcvVERSION_BUILD 4651 + + #define gcvVERSION_DATE __DATE__ + +diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c +index 4e3819c..2ed3d0e 100644 +--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c ++++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c +@@ -663,7 +663,7 @@ static int drv_mmap( + + #if !gcdPAGED_MEMORY_CACHEABLE + vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); +- vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND; ++ vma->vm_flags |= gcdVM_FLAGS; + #endif + vma->vm_pgoff = 0; + +diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h +index 9c0bcd5..3c148f6 100644 +--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h ++++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h +@@ -73,6 +73,12 @@ + + #define GetPageCount(size, offset) ((((size) + ((offset) & ~PAGE_CACHE_MASK)) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION (3,7,0) ++#define gcdVM_FLAGS (VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_DONTDUMP) ++#else ++#define gcdVM_FLAGS (VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED) ++#endif ++ + static inline gctINT + GetOrder( + IN gctINT numPages +diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +index c07ded8..9c2bae6 100644 +--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c ++++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +@@ -869,6 +869,60 @@ _UnmapUserLogical( + #endif + } + ++gceSTATUS ++_QueryProcessPageTable( ++ IN gctPOINTER Logical, ++ OUT gctUINT32 * Address ++ ) ++{ ++ spinlock_t *lock; ++ gctUINTPTR_T logical = (gctUINTPTR_T)Logical; ++ pgd_t *pgd; ++ pud_t *pud; ++ pmd_t *pmd; ++ pte_t *pte; ++ ++ if (!current->mm) ++ { ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ pgd = pgd_offset(current->mm, logical); ++ if (pgd_none(*pgd) || pgd_bad(*pgd)) ++ { ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ pud = pud_offset(pgd, logical); ++ if (pud_none(*pud) || pud_bad(*pud)) ++ { ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ pmd = pmd_offset(pud, logical); ++ if (pmd_none(*pmd) || pmd_bad(*pmd)) ++ { ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ pte = pte_offset_map_lock(current->mm, pmd, logical, &lock); ++ if (!pte) ++ { ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ if (!pte_present(*pte)) ++ { ++ pte_unmap_unlock(pte, lock); ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ *Address = (pte_pfn(*pte) << PAGE_SHIFT) | (logical & ~PAGE_MASK); ++ pte_unmap_unlock(pte, lock); ++ ++ return gcvSTATUS_OK; ++} ++ + /******************************************************************************* + ** + ** gckOS_Construct +@@ -1106,6 +1160,9 @@ _CreateKernelVirtualMapping( + numPages, + 0, + PAGE_KERNEL); ++ ++ /* Trigger a page fault. */ ++ memset(addr, 0, numPages * PAGE_SIZE); + } + #else + struct page ** pages; +@@ -1136,6 +1193,9 @@ _CreateKernelVirtualMapping( + /* ioremap() can't work on system memory since 2.6.38. */ + addr = vmap(pages, numPages, 0, gcmkNONPAGED_MEMROY_PROT(PAGE_KERNEL)); + ++ /* Trigger a page fault. */ ++ memset(addr, 0, numPages * PAGE_SIZE); ++ + if (free) + { + kfree(pages); +@@ -1540,7 +1600,7 @@ gckOS_MapMemory( + #else + #if !gcdPAGED_MEMORY_CACHEABLE + mdlMap->vma->vm_page_prot = gcmkPAGED_MEMROY_PROT(mdlMap->vma->vm_page_prot); +- mdlMap->vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED; ++ mdlMap->vma->vm_flags |= gcdVM_FLAGS; + # endif + mdlMap->vma->vm_pgoff = 0; + +@@ -1987,7 +2047,7 @@ gckOS_AllocateNonPagedMemory( + } + #else + mdlMap->vma->vm_page_prot = gcmkNONPAGED_MEMROY_PROT(mdlMap->vma->vm_page_prot); +- mdlMap->vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED; ++ mdlMap->vma->vm_flags |= gcdVM_FLAGS; + mdlMap->vma->vm_pgoff = 0; + + if (remap_pfn_range(mdlMap->vma, +@@ -2367,12 +2427,18 @@ gckOS_GetPhysicalAddress( + gcmkVERIFY_OBJECT(Os, gcvOBJ_OS); + gcmkVERIFY_ARGUMENT(Address != gcvNULL); + +- /* Get current process ID. */ +- processID = _GetProcessID(); ++ /* Query page table of current process first. */ ++ status = _QueryProcessPageTable(Logical, Address); + +- /* Route through other function. */ +- gcmkONERROR( +- gckOS_GetPhysicalAddressProcess(Os, Logical, processID, Address)); ++ if (gcmIS_ERROR(status)) ++ { ++ /* Get current process ID. */ ++ processID = _GetProcessID(); ++ ++ /* Route through other function. */ ++ gcmkONERROR( ++ gckOS_GetPhysicalAddressProcess(Os, Logical, processID, Address)); ++ } + + /* Success. */ + gcmkFOOTER_ARG("*Address=0x%08x", *Address); +@@ -4139,7 +4205,7 @@ gckOS_LockPages( + return gcvSTATUS_OUT_OF_RESOURCES; + } + +- mdlMap->vma->vm_flags |= VM_RESERVED; ++ mdlMap->vma->vm_flags |= gcdVM_FLAGS; + #if !gcdPAGED_MEMORY_CACHEABLE + if (Cacheable == gcvFALSE) + { +-- +1.8.3.2 +
recipes-kernel/linux/linux-udoo-3.0.35/0001-perf-tools-Fix-getrusage-related-build-failure-on-gl.patch new file +43 -0
43 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0002-ARM-7668-1-fix-memset-related-crashes-caused-by-rece.patch new file +259 -0
259 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0002-ENGR00265465-gpu-Add-global-value-for-minimum-3D-clo.patch new file +62 -0
62 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0003-ARM-7670-1-fix-the-memset-fix.patch new file +87 -0
87 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0003-ENGR00261814-4-gpu-use-new-PU-power-on-off-interface.patch new file +53 -0
53 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0004-ENGR00264288-1-GPU-Integrate-4.6.9p12-release-kernel.patch new file +2006 -0
1,456 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0004-ENGR00271136-Fix-build-break-when-CONFIG_CLK_DEBUG-i.patch new file +43 -0
43 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0005-ENGR00264275-GPU-Correct-suspend-resume-calling-afte.patch new file +61 -0
61 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0005-ENGR00271359-Add-Multi-touch-support.patch new file +98 -0
98 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0006-Add-support-for-DVI-monitors.patch new file +227 -0
227 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0006-ENGR00265130-gpu-Correct-section-mismatch-in-gpu-ker.patch new file +60 -0
60 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/0007-ARM-mach-mx6-board-mx6q_sabresd-Register-SDHC3-first.patch new file +38 -0
Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/defconfig new file +246 -0
246 lines not on this page · raw message
recipes-kernel/linux/linux-udoo-3.0.35/drm-vivante-Add-00-sufix-in-returned-bus-Id.patch new file +31 -0
Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/epdc-Rename-mxcfb_epdc_kernel.h-to-mxc_epdc.h.patch new file +143 -0
143 lines not on this page · raw message
recipes-kernel/linux/linux-udoo.inc new file +17 -0
Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo_3.0.35.bb new file +26 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.10.4
Part of the diff is not shown here. View the raw message.
Quoted 9 lines · Luca Simone Ronga
From: Luca Simone Ronga <[email protected]>
Dear Freescale community,
here is the kernel recipe for the UDOO Board kernel branch maintained by SECO (KernelUnico 2013).
I wish to thank John Weber and Otavio Salvador for their useful comments. L.
Could you, please, format your commit log and commit subject?
You can use other commits to get the format.
Please, let me know if you need help
I have not participated on discussion about these new recipes, but it looks like so much patch added in SRC_URI. Was new git repository suggested?
Please, see more comments inline, in linux bb file
recipes-kernel/linux/linux-udoo_3.0.35.bb
Quoted 4,664 lines
Signed-off-by Luca Simone Ronga <[email protected]>--- ...8-4.6.9p11.1-gpu-GPU-Kernel-driver-integr.patch | 1040 ++++++++++ ...Fix-getrusage-related-build-failure-on-gl.patch | 43 + ...fix-memset-related-crashes-caused-by-rece.patch | 259 +++ ...5-gpu-Add-global-value-for-minimum-3D-clo.patch | 62 + .../0003-ARM-7670-1-fix-the-memset-fix.patch | 87 + ...4-4-gpu-use-new-PU-power-on-off-interface.patch | 53 + ...8-1-GPU-Integrate-4.6.9p12-release-kernel.patch | 2006 ++++++++++++++++++++ ...6-Fix-build-break-when-CONFIG_CLK_DEBUG-i.patch | 43 + ...5-GPU-Correct-suspend-resume-calling-afte.patch | 61 + ...0005-ENGR00271359-Add-Multi-touch-support.patch | 98 + .../0006-Add-support-for-DVI-monitors.patch | 227 +++ ...0-gpu-Correct-section-mismatch-in-gpu-ker.patch | 60 + ...6-board-mx6q_sabresd-Register-SDHC3-first.patch | 38 + recipes-kernel/linux/linux-udoo-3.0.35/defconfig | 246 +++ ...m-vivante-Add-00-sufix-in-returned-bus-Id.patch | 31 + ...-Rename-mxcfb_epdc_kernel.h-to-mxc_epdc.h.patch | 143 ++ recipes-kernel/linux/linux-udoo.inc | 17 + recipes-kernel/linux/linux-udoo_3.0.35.bb | 26 + 18 files changed, 4540 insertions(+)create mode 100644
recipes-kernel/linux/linux-udoo-3.0.35/0001-ENGR00255688-4.6.9p11.1-gpu-GPU-Kernel-driver-integr.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0001-perf-tools-Fix-getrusage-related-build-failure-on-gl.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0002-ARM-7668-1-fix-memset-related-crashes-caused-by-rece.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0002-ENGR00265465-gpu-Add-global-value-for-minimum-3D-clo.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0003-ARM-7670-1-fix-the-memset-fix.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0003-ENGR00261814-4-gpu-use-new-PU-power-on-off-interface.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0004-ENGR00264288-1-GPU-Integrate-4.6.9p12-release-kernel.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0004-ENGR00271136-Fix-build-break-when-CONFIG_CLK_DEBUG-i.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0005-ENGR00264275-GPU-Correct-suspend-resume-calling-afte.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0005-ENGR00271359-Add-Multi-touch-support.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0006-Add-support-for-DVI-monitors.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0006-ENGR00265130-gpu-Correct-section-mismatch-in-gpu-ker.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/0007-ARM-mach-mx6-board-mx6q_sabresd-Register-SDHC3-first.patchcreate mode 100644 recipes-kernel/linux/linux-udoo-3.0.35/defconfig
create mode 100644recipes-kernel/linux/linux-udoo-3.0.35/drm-vivante-Add-00-sufix-in-returned-bus-Id.patchcreate mode 100644recipes-kernel/linux/linux-udoo-3.0.35/epdc-Rename-mxcfb_epdc_kernel.h-to-mxc_epdc.h.patchcreate mode 100644 recipes-kernel/linux/linux-udoo.inc
create mode 100644 recipes-kernel/linux/linux-udoo_3.0.35.bbrecipes-kernel/linux/linux-udoo-3.0.35/0001-ENGR00255688-4.6.9p11.1-gpu-GPU-Kernel-driver-integr.patch new file +1040
-0@@ -0,0 +1,1040 @@ +From 46e3a6de5adb9379f9d6eef2c038c2f18637d407 Mon Sep 17 00:00:00 2001 +From: Loren Huang <[email protected]> +Date: Mon, 25 Mar 2013 15:43:57 +0800 +Subject: [PATCH 1/6] ENGR00255688 4.6.9p11.1 [gpu]GPU Kernel driver + integration + +4.6.9p11.1 GPU kernel driver integration +Cherry pick from imx_3.0.35 + +Upstream-Status: Backport [3.5.7-1.0.0] + +Signed-off-by: Loren Huang <[email protected]> +Acked-by: Lily Zhang +--- + drivers/mxc/gpu-viv/Kbuild | 2 +- + .../arch/XAQ2/hal/kernel/gc_hal_kernel_context.c | 2 +- + .../arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | 7 +- + drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h | 2 +- + drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | 53 ++++-- + .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c | 5 +- + drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c | 178 ++++++++++++--------- + .../hal/kernel/gc_hal_kernel_video_memory.c | 3 +- + .../gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h | 13 +- + drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h | 25 +++ + .../mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | 35 ++++ + .../mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h | 2 +- + .../hal/os/linux/kernel/gc_hal_kernel_driver.c | 2 +- + .../hal/os/linux/kernel/gc_hal_kernel_linux.h | 6 + + .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | 82 +++++++++- + 15 files changed, 304 insertions(+), 113 deletions(-) + +diff --git a/drivers/mxc/gpu-viv/Kbuild b/drivers/mxc/gpu-viv/Kbuild +index 0b18a7b..93b1259 100644 +--- a/drivers/mxc/gpu-viv/Kbuild ++++ b/drivers/mxc/gpu-viv/Kbuild +@@ -1,6 +1,6 @@ + ############################################################################## + # +-# Copyright (C) 2005 - 2012 by Vivante Corp. ++# Copyright (C) 2005 - 2013 by Vivante Corp. + # + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by +diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c +index 22e1f27..24003e7 100644 +--- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c ++++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c +@@ -471,7 +471,7 @@ _InitializeContextBuffer( + index += _SwitchPipe(Context, index, gcvPIPE_3D); + + /* Current context pointer. */ +-#if gcdDEBUG ++#if gcdDEBUG + index += _State(Context, index, 0x03850 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); + #endif + +diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c +index a87259e..3829999 100644 +--- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c ++++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c +@@ -232,7 +232,8 @@ _IdentifyHardware( + } + + /* Exception for GC1000, revision 5035 & GC800, revision 4612 */ +- if (((Identity->chipModel == gcv1000) && (Identity->chipRevision == 0x5035)) ++ if (((Identity->chipModel == gcv1000) && ((Identity->chipRevision == 0x5035) ++ || (Identity->chipRevision == 0x5036))) + || ((Identity->chipModel == gcv800) && (Identity->chipRevision == 0x4612))) + { + Identity->superTileMode = 1; +@@ -751,7 +752,7 @@ gckHARDWARE_Construct( + /* Initialize the fast clear. */ + gcmkONERROR(gckHARDWARE_SetFastClear(hardware, -1, -1)); + +-#if !gcdENABLE_128B_MERGE ++#if !gcdENABLE_128B_MERGE + + if (((((gctUINT32) (hardware->identity.chipMinorFeatures2)) >> (0 ? 21:21) & ((gctUINT32) ((((1 ? 21:21) - (0 ? 21:21) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:21) - (0 ? 21:21) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 21:21) - (0 ? 21:21) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 21:21) - (0 ? 21:21) + 1)))))))) + { +@@ -1027,7 +1028,7 @@ gckHARDWARE_InitializeHardware( + 0x00424, + baseAddress)); + +-#if !VIVANTE_PROFILER ++#if !VIVANTE_PROFILER + { + gctUINT32 data; + +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h +index 1da80b7..5896e93 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h +@@ -186,7 +186,7 @@ typedef struct _gcsDATABASE + gctUINT64 idle; + + /* Pointer to database. */ +- gcsDATABASE_RECORD_PTR list; ++ gcsDATABASE_RECORD_PTR list[48]; + + #if gcdSECURE_USER + /* Secure cache. */ +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c +index 1fb18fb..bc5f083 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c +@@ -26,6 +26,9 @@ + /******************************************************************************* + ***** Private fuctions ********************************************************/ + ++#define _GetSlot(database, x) \ ++ (gctUINT32)(((gcmPTR_TO_UINT64(x) >> 7) % gcmCOUNTOF(database->list))) ++ + /******************************************************************************* + ** gckKERNEL_NewDatabase + ** +@@ -56,6 +59,7 @@ gckKERNEL_NewDatabase( + gcsDATABASE_PTR database; + gctBOOL acquired = gcvFALSE; + gctSIZE_T slot; ++ gcsDATABASE_PTR existingDatabase; + + gcmkHEADER_ARG("Kernel=0x%x ProcessID=%d", Kernel, ProcessID); + +@@ -63,6 +67,21 @@ gckKERNEL_NewDatabase( + gcmkONERROR(gckOS_AcquireMutex(Kernel->os, Kernel->db->dbMutex, gcvINFINITE)); + acquired = gcvTRUE; + ++ /* Compute the hash for the database. */ ++ slot = ProcessID % gcmCOUNTOF(Kernel->db->db); ++ ++ /* Walk the hash list. */ ++ for (existingDatabase = Kernel->db->db[slot]; ++ existingDatabase != gcvNULL; ++ existingDatabase = existingDatabase->next) ++ { ++ if (existingDatabase->processID == ProcessID) ++ { ++ /* One process can't be added twice. */ ++ gcmkONERROR(gcvSTATUS_NOT_SUPPORTED); ++ } ++ } ++ + if (Kernel->db->freeDatabase != gcvNULL) + { + /* Allocate a database from the free list. */ +@@ -81,9 +100,6 @@ gckKERNEL_NewDatabase( + database = pointer; + } + +- /* Compute the hash for the database. */ +- slot = ProcessID % gcmCOUNTOF(Kernel->db->db); +- + /* Insert the database into the hash. */ + database->next = Kernel->db->db[slot]; + Kernel->db->db[slot] = database; +@@ -350,6 +366,7 @@ static gceSTATUS + gckKERNEL_NewRecord( + IN gckKERNEL Kernel, + IN gcsDATABASE_PTR Database, ++ IN gctUINT32 Slot, + OUT gcsDATABASE_RECORD_PTR * Record + ) + { +@@ -383,8 +400,8 @@ gckKERNEL_NewRecord( + } + + /* Insert the record in the database. */ +- record->next = Database->list; +- Database->list = record; ++ record->next = Database->list[Slot]; ++ Database->list[Slot] = record; + + /* Release the database mutex. */ + gcmkONERROR(gckOS_ReleaseMutex(Kernel->os, Kernel->db->dbMutex)); +@@ -449,6 +466,7 @@ gckKERNEL_DeleteRecord( + gceSTATUS status; + gctBOOL acquired = gcvFALSE; + gcsDATABASE_RECORD_PTR record, previous; ++ gctUINT32 slot = _GetSlot(Database, Data); + + gcmkHEADER_ARG("Kernel=0x%x Database=0x%x Type=%d Data=0x%x", + Kernel, Database, Type, Data); +@@ -458,8 +476,9 @@ gckKERNEL_DeleteRecord( + gckOS_AcquireMutex(Kernel->os, Kernel->db->dbMutex, gcvINFINITE)); + acquired = gcvTRUE; + ++ + /* Scan the database for this record. */ +- for (record = Database->list, previous = gcvNULL; ++ for (record = Database->list[slot], previous = gcvNULL; + record != gcvNULL; + record = record->next + ) +@@ -490,7 +509,7 @@ gckKERNEL_DeleteRecord( + /* Remove record from database. */ + if (previous == gcvNULL) + { +- Database->list = record->next; ++ Database->list[slot] = record->next; + } + else + { +@@ -557,6 +576,7 @@ gckKERNEL_FindRecord( + gceSTATUS status; + gctBOOL acquired = gcvFALSE; + gcsDATABASE_RECORD_PTR record; ++ gctUINT32 slot = _GetSlot(Database, Data); + + gcmkHEADER_ARG("Kernel=0x%x Database=0x%x Type=%d Data=0x%x", + Kernel, Database, Type, Data); +@@ -567,7 +587,7 @@ gckKERNEL_FindRecord( + acquired = gcvTRUE; + + /* Scan the database for this record. */ +- for (record = Database->list; ++ for (record = Database->list[slot]; + record != gcvNULL; + record = record->next + ) +@@ -642,6 +662,7 @@ gckKERNEL_CreateProcessDB( + { + gceSTATUS status; + gcsDATABASE_PTR database = gcvNULL; ++ gctUINT32 i; + + gcmkHEADER_ARG("Kernel=0x%x ProcessID=%d", Kernel, ProcessID); + +@@ -668,7 +689,11 @@ gckKERNEL_CreateProcessDB( + database->mapUserMemory.bytes = 0; + database->mapUserMemory.maxBytes = 0; + database->mapUserMemory.totalBytes = 0; +- database->list = gcvNULL; ++ ++ for (i = 0; i < gcmCOUNTOF(database->list); i++) ++ { ++ database->list[i] = gcvNULL; ++ } + + #if gcdSECURE_USER + { +@@ -848,7 +873,7 @@ gckKERNEL_AddProcessDB( + gcmkONERROR(gckKERNEL_FindDatabase(Kernel, ProcessID, gcvFALSE, &database)); + + /* Create a new record in the database. */ +- gcmkONERROR(gckKERNEL_NewRecord(Kernel, database, &record)); ++ gcmkONERROR(gckKERNEL_NewRecord(Kernel, database, _GetSlot(database, Pointer), &record)); + + /* Initialize the record. */ + record->kernel = Kernel; +@@ -1086,6 +1111,7 @@ gckKERNEL_DestroyProcessDB( + gctPHYS_ADDR physical; + gcuVIDMEM_NODE_PTR node; + gckKERNEL kernel = Kernel; ++ gctUINT32 i; + + gcmkHEADER_ARG("Kernel=0x%x ProcessID=%d", Kernel, ProcessID); + +@@ -1126,8 +1152,11 @@ gckKERNEL_DestroyProcessDB( + ProcessID); + } + ++ for(i = 0; i < gcmCOUNTOF(database->list); i++) ++ { ++ + /* Walk all records. */ +- for (record = database->list; record != gcvNULL; record = next) ++ for (record = database->list[i]; record != gcvNULL; record = next) + { + /* Next next record. */ + next = record->next; +@@ -1293,6 +1322,8 @@ gckKERNEL_DestroyProcessDB( + gcvNULL)); + } + ++ } ++ + /* Delete the database. */ + gcmkONERROR(gckKERNEL_DeleteDatabase(Kernel, database)); + +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c +index f78d096..217f7f1 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c +@@ -959,6 +959,8 @@ gckEVENT_AddList( + record->kernel = Event->kernel; + #endif + ++ gcmkONERROR(__RemoveRecordFromProcessDB(Event, record)); ++ + /* Acquire the mutex. */ + gcmkONERROR(gckOS_AcquireMutex(Event->os, Event->eventListMutex, gcvINFINITE)); + acquired = gcvTRUE; +@@ -1539,9 +1541,6 @@ gckEVENT_Submit( + gcmkONERROR(gckOS_ReleaseMutex(Event->os, Event->eventListMutex)); + acquired = gcvFALSE; + +- gcmkONERROR(__RemoveRecordFromProcessDB(Event, +- Event->queues[id].head)); +- + #if gcdNULL_DRIVER + /* Notify immediately on infinite hardware. */ + gcmkONERROR(gckEVENT_Interrupt(Event, 1 << id)); +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c +index 0c71e28..43c9297 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c +@@ -97,6 +97,43 @@ static gcsMirrorPageTable_PTR mirrorPageTable = gcvNULL; + static gctPOINTER mirrorPageTableMutex = gcvNULL; + #endif + ++static void ++_WritePageEntry( ++ IN gctUINT32_PTR PageEntry, ++ IN gctUINT32 EntryValue ++ ) ++{ ++ static gctUINT16 data = 0xff00; ++ ++ if (*(gctUINT8 *)&data == 0xff) ++ { ++ *PageEntry = gcmSWAB32(EntryValue); ++ } ++ else ++ { ++ *PageEntry = EntryValue; ++ } ++} ++ ++static gctUINT32 ++_ReadPageEntry( ++ IN gctUINT32_PTR PageEntry ++ ) ++{ ++ static gctUINT16 data = 0xff00; ++ gctUINT32 entryValue; ++ ++ if (*(gctUINT8 *)&data == 0xff) ++ { ++ entryValue = *PageEntry; ++ return gcmSWAB32(entryValue); ++ } ++ else ++ { ++ return *PageEntry; ++ } ++} ++ + static gceSTATUS + _FillPageTable( + IN gctUINT32_PTR PageTable, +@@ -108,7 +145,7 @@ _FillPageTable( + + for (i = 0; i < PageCount; i++) + { +- PageTable[i] = EntryValue; ++ _WritePageEntry(PageTable + i, EntryValue); + } + + return gcvSTATUS_OK; +@@ -132,16 +169,16 @@ _Link( + gctUINT32_PTR pageTable = Mmu->pageTableLogical; + + /* Dispatch on node type. */ +- switch (gcmENTRY_TYPE(pageTable[Index])) ++ switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[Index]))) + { + case gcvMMU_SINGLE: + /* Set single index. */ +- pageTable[Index] = (Next << 8) | gcvMMU_SINGLE; ++ _WritePageEntry(&pageTable[Index], (Next << 8) | gcvMMU_SINGLE); + break; + + case gcvMMU_FREE: + /* Set index. */ +- pageTable[Index + 1] = Next; ++ _WritePageEntry(&pageTable[Index + 1], Next); + break; + + default: +@@ -167,13 +204,13 @@ _AddFree( + if (Count == 1) + { + /* Initialize a single page node. */ +- pageTable[Node] = (~((1U<<8)-1)) | gcvMMU_SINGLE; ++ _WritePageEntry(pageTable + Node, (~((1U<<8)-1)) | gcvMMU_SINGLE); + } + else + { + /* Initialize the node. */ +- pageTable[Node + 0] = (Count << 8) | gcvMMU_FREE; +- pageTable[Node + 1] = ~0U; ++ _WritePageEntry(pageTable + Node + 0, (Count << 8) | gcvMMU_FREE); ++ _WritePageEntry(pageTable + Node + 1, ~0U); + } + + /* Append the node. */ +@@ -196,7 +233,7 @@ _Collect( + for (i = 0; i < Mmu->pageTableEntries; ++i) + { + /* Dispatch based on type of page. */ +- switch (gcmENTRY_TYPE(pageTable[i])) ++ switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[i]))) + { + case gcvMMU_USED: + /* Used page, so close any open node. */ +@@ -229,10 +266,10 @@ _Collect( + } + + /* Advance the count. */ +- count += pageTable[i] >> 8; ++ count += _ReadPageEntry(&pageTable[i]) >> 8; + + /* Advance the index into the page table. */ +- i += (pageTable[i] >> 8) - 1; ++ i += (_ReadPageEntry(&pageTable[i]) >> 8) - 1; + break; + + default: +@@ -341,19 +378,20 @@ _FillFlatMapping( + gcmkONERROR(gcvSTATUS_NOT_ALIGNED); + } + +- *(Mmu->mtlbLogical + mStart) +- = stlb->physBase +- /* 64KB page size */ +- | (1 << 2) +- /* Ignore exception */ +- | (0 << 1) +- /* Present */ +- | (1 << 0); ++ _WritePageEntry(Mmu->mtlbLogical + mStart, ++ stlb->physBase ++ /* 64KB page size */ ++ | (1 << 2) ++ /* Ignore exception */ ++ | (0 << 1) ++ /* Present */ ++ | (1 << 0) ++ ); + #if gcdMMU_TABLE_DUMP + gckOS_Print("%s(%d): insert MTLB[%d]: %08x\n", + __FUNCTION__, __LINE__, + mStart, +- *(Mmu->mtlbLogical + mStart)); ++ _ReadPageEntry(Mmu->mtlbLogical + mStart)); + #endif + + stlb->mtlbIndex = mStart; +@@ -368,12 +406,12 @@ _FillFlatMapping( + while (sStart <= last) + { + gcmkASSERT(!(start & gcdMMU_PAGE_64K_MASK)); +- *(stlb->logical + sStart) = _SetPage(start); ++ _WritePageEntry(stlb->logical + sStart, _SetPage(start)); + #if gcdMMU_TABLE_DUMP + gckOS_Print("%s(%d): insert STLB[%d]: %08x\n", + __FUNCTION__, __LINE__, + sStart, +- *(stlb->logical + sStart)); ++ _ReadPageEntry(stlb->logical + sStart)); + #endif + /* next page. */ + start += gcdMMU_PAGE_64K_SIZE; +@@ -428,7 +466,7 @@ OnError: + if (pre->mtlbEntryNum != 0) + { + gcmkASSERT(pre->mtlbEntryNum == 1); +- *(Mmu->mtlbLogical + pre->mtlbIndex) = 0; ++ _WritePageEntry(Mmu->mtlbLogical + pre->mtlbIndex, 0); + } + + gcmkVERIFY_OK(gcmkOS_SAFE_FREE(Mmu->os, pre)); +@@ -493,8 +531,8 @@ _SetupDynamicSpace( + + /* Initilization. */ + pageTable = Mmu->pageTableLogical; +- pageTable[0] = (Mmu->pageTableEntries << 8) | gcvMMU_FREE; +- pageTable[1] = ~0U; ++ _WritePageEntry(pageTable, (Mmu->pageTableEntries << 8) | gcvMMU_FREE); ++ _WritePageEntry(pageTable + 1, ~0U); + Mmu->heapList = 0; + Mmu->freeNodes = gcvFALSE; + +@@ -509,18 +547,20 @@ _SetupDynamicSpace( + /* Map to Master TLB. */ + for (; i < gcdMMU_MTLB_ENTRY_NUM; i++) + { +- Mmu->mtlbLogical[i] = physical +- /* 4KB page size */ +- | (0 << 2) +- /* Ignore exception */ +- | (0 << 1) +- /* Present */ +- | (1 << 0); ++ _WritePageEntry(Mmu->mtlbLogical + i, ++ physical ++ /* 4KB page size */ ++ | (0 << 2) ++ /* Ignore exception */ ++ | (0 << 1) ++ /* Present */ ++ | (1 << 0) ++ ); + #if gcdMMU_TABLE_DUMP + gckOS_Print("%s(%d): insert MTLB[%d]: %08x\n", + __FUNCTION__, __LINE__, + i, +- *(Mmu->mtlbLogical + i)); ++ _ReadPageEntry(Mmu->mtlbLogical + i)); + #endif + physical += gcdMMU_STLB_4K_SIZE; + } +@@ -645,18 +685,11 @@ _Construct( + pageTable = mmu->pageTableLogical; + + #if gcdMMU_CLEAR_VALUE +- { +- gctUINT32 i; +- +- for (i = 0; i < mmu->pageTableEntries; ++i) +- { +- pageTable[i] = gcdMMU_CLEAR_VALUE; +- } +- } ++ _FillPageTable(pageTable, mmu->pageTableEntries, gcdMMU_CLEAR_VALUE); + #endif + +- pageTable[0] = (mmu->pageTableEntries << 8) | gcvMMU_FREE; +- pageTable[1] = ~0U; ++ _WritePageEntry(pageTable, (mmu->pageTableEntries << 8) | gcvMMU_FREE); ++ _WritePageEntry(pageTable + 1, ~0U); + mmu->heapList = 0; + mmu->freeNodes = gcvFALSE; + +@@ -797,7 +830,7 @@ _Destroy( + if (pre->mtlbEntryNum != 0) + { + gcmkASSERT(pre->mtlbEntryNum == 1); +- *(Mmu->mtlbLogical + pre->mtlbIndex) = 0; ++ _WritePageEntry(Mmu->mtlbLogical + pre->mtlbIndex, 0); + #if gcdMMU_TABLE_DUMP + gckOS_Print("%s(%d): clean MTLB[%d]\n", + __FUNCTION__, __LINE__, +@@ -1044,7 +1077,7 @@ _AllocatePages( + for (index = Mmu->heapList; !gotIt && (index < Mmu->pageTableEntries);) + { + /* Check the node type. */ +- switch (gcmENTRY_TYPE(pageTable[index])) ++ switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[index]))) + { + case gcvMMU_SINGLE: + /* Single odes are valid if we only need 1 page. */ +@@ -1056,13 +1089,13 @@ _AllocatePages( + { + /* Move to next node. */ + previous = index; +- index = pageTable[index] >> 8; ++ index = _ReadPageEntry(&pageTable[index]) >> 8; + } + break; + + case gcvMMU_FREE: + /* Test if the node has enough space. */ +- if (PageCount <= (pageTable[index] >> 8)) ++ if (PageCount <= (_ReadPageEntry(&pageTable[index]) >> 8)) + { + gotIt = gcvTRUE; + } +@@ -1070,7 +1103,7 @@ _AllocatePages( + { + /* Move to next node. */ + previous = index; +- index = pageTable[index + 1]; ++ index = _ReadPageEntry(&pageTable[index + 1]); + } + break; + +@@ -1099,36 +1132,36 @@ _AllocatePages( + } + } + +- switch (gcmENTRY_TYPE(pageTable[index])) ++ switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[index]))) + { + case gcvMMU_SINGLE: + /* Unlink single node from free list. */ + gcmkONERROR( +- _Link(Mmu, previous, pageTable[index] >> 8)); ++ _Link(Mmu, previous, _ReadPageEntry(&pageTable[index]) >> 8)); + break; + + case gcvMMU_FREE: + /* Check how many pages will be left. */ +- left = (pageTable[index] >> 8) - PageCount; ++ left = (_ReadPageEntry(&pageTable[index]) >> 8) - PageCount; + switch (left) + { + case 0: + /* The entire node is consumed, just unlink it. */ + gcmkONERROR( +- _Link(Mmu, previous, pageTable[index + 1])); ++ _Link(Mmu, previous, _ReadPageEntry(&pageTable[index + 1]))); + break; + + case 1: + /* One page will remain. Convert the node to a single node and + ** advance the index. */ +- pageTable[index] = (pageTable[index + 1] << 8) | gcvMMU_SINGLE; ++ _WritePageEntry(&pageTable[index], (_ReadPageEntry(&pageTable[index + 1]) << 8) | gcvMMU_SINGLE); + index ++; + break; + + default: + /* Enough pages remain for a new node. However, we will just adjust + ** the size of the current node and advance the index. */ +- pageTable[index] = (left << 8) | gcvMMU_FREE; ++ _WritePageEntry(&pageTable[index], (left << 8) | gcvMMU_FREE); + index += left; + break; + } +@@ -1232,35 +1265,32 @@ _FreePages( + #if gcdMMU_CLEAR_VALUE + if (Mmu->hardware->mmuVersion == 0) + { +- gctUINT32 i; +- +- for (i = 0; i < PageCount; ++i) +- { +- pageTable[i] = gcdMMU_CLEAR_VALUE; +- } ++ _FillPageTable(pageTable, PageCount, gcdMMU_CLEAR_VALUE); + } + #endif + + if (PageCount == 1) + { + /* Single page node. */ +- pageTable[0] = (~((1U<<8)-1)) | gcvMMU_SINGLE ++ _WritePageEntry(pageTable, ++ (~((1U<<8)-1)) | gcvMMU_SINGLE + #if gcdUSE_MMU_EXCEPTION +- /* Enable exception */ +- | (1 << 1) ++ /* Enable exception */ ++ | 1 << 1 + #endif +- ; ++ ); + } + else + { + /* Mark the node as free. */ +- pageTable[0] = (PageCount << 8) | gcvMMU_FREE ++ _WritePageEntry(pageTable, ++ (PageCount << 8) | gcvMMU_FREE + #if gcdUSE_MMU_EXCEPTION +- /* Enable exception */ +- | (1 << 1) ++ /* Enable exception */ ++ | 1 << 1 + #endif +- ; +- pageTable[1] = ~0U; ++ ); ++ _WritePageEntry(pageTable + 1, ~0U); + + #if gcdUSE_MMU_EXCEPTION + /* Enable exception */ +@@ -1509,12 +1539,8 @@ gckMMU_SetPage( + data = _SetPage(PageAddress); + } + +- if (Mmu->hardware->bigEndian) +- { +- data = gcmSWAB32(data); +- } ++ _WritePageEntry(PageEntry, data); + +- *PageEntry = data; + #if gcdMIRROR_PAGETABLE + for (i = 0; i < mirrorPageTable->reference; i++) + { +@@ -1526,11 +1552,11 @@ gckMMU_SetPage( + + if (mmu->hardware->mmuVersion == 0) + { +- *pageEntry = PageAddress; ++ _WritePageEntry(pageEntry, PageAddress); + } + else + { +- *pageEntry = _SetPage(PageAddress); ++ _WritePageEntry(pageEntry, _SetPage(PageAddress)); + } + } + +@@ -1734,7 +1760,7 @@ gckMMU_DumpPageTableEntry( + * gcdMMU_STLB_4K_ENTRY_NUM + + stlb; + +- gcmkPRINT(" Page table entry = 0x%08X", pageTable[index]); ++ gcmkPRINT(" Page table entry = 0x%08X", _ReadPageEntry(pageTable + index)); + } + + gcmkFOOTER_NO(); +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c +index d49aa64..8a442a2 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c +@@ -1027,7 +1027,8 @@ gckVIDMEM_AllocateLinear( + ) + { + /* The left memory is for small memory.*/ +- gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); ++ status = gcvSTATUS_OUT_OF_MEMORY; ++ goto OnError; + } + #endif + +diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h +index 496276e..06eea79 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h +@@ -227,7 +227,8 @@ gcoOS_GetDisplayInfoEx( + ); + + gceSTATUS +-gcoOS_GetNextDisplayInfoEx( ++gcoOS_GetNextDisplayInfoExByIndex( ++ IN gctINT Index, + IN HALNativeDisplayType Display, + IN HALNativeWindowType Window, + IN gctUINT DisplayInfoSize, +@@ -274,15 +275,15 @@ gcoOS_SetDisplayVirtualEx( + + gceSTATUS + gcoOS_SetSwapInterval( +- IN HALNativeDisplayType Display, +- IN gctINT Interval ++ IN HALNativeDisplayType Display, ++ IN gctINT Interval + ); + + gceSTATUS + gcoOS_GetSwapInterval( +- IN HALNativeDisplayType Display, +- IN gctINT_PTR Min, +- IN gctINT_PTR Max ++ IN HALNativeDisplayType Display, ++ IN gctINT_PTR Min, ++ IN gctINT_PTR Max + ); + + gceSTATUS +diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h +index d441d1d..249b61b 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h +@@ -1430,6 +1430,16 @@ typedef enum _gceTEXTURE_FACE + } + gceTEXTURE_FACE; + ++#if gcdFORCE_MIPMAP ++typedef enum ++{ ++ gcvForceMipDisabled = 0, ++ gcvForceMipEnable = 1, ++ gcvForceMipGenerated = 2, ++ gcvForceMipNever = 3, ++}gceFORCE_MIPMAP; ++#endif ++ + typedef struct _gcsTEXTURE + { + /* Addressing modes. */ +@@ -1446,6 +1456,10 @@ typedef struct _gcsTEXTURE + gceTEXTURE_FILTER mipFilter; + gctUINT anisoFilter; + gctBOOL forceTopLevel; ++ gctBOOL autoMipmap; ++#if gcdFORCE_MIPMAP ++ gceFORCE_MIPMAP forceMipmap; ++#endif + /* Level of detail. */ + gctFIXED_POINT lodBias; + gctFIXED_POINT lodMin; +@@ -1479,7 +1493,18 @@ gceSTATUS + gcoTEXTURE_Destroy( + IN gcoTEXTURE Texture + ); ++#if gcdFORCE_MIPMAP ++gceSTATUS ++gcoTEXTURE_DestroyForceMipmap( ++ IN gcoTEXTURE Texture ++ ); + ++gceSTATUS ++gcoTEXTURE_GetMipLevels( ++ IN gcoTEXTURE Texture, ++ OUT gctINT * levels ++ ); ++#endif + /* Replace a mipmap in gcoTEXTURE object. */ + gceSTATUS + gcoTEXTURE_ReplaceMipMap( +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 86e9133..afe83d0 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 +@@ -114,6 +114,30 @@ + #define COMMAND_PROCESSOR_VERSION 1 + + /* ++ gcdDUMP_KEY ++ ++ Set this to a string that appears in 'cat /proc/<pid>/cmdline'. E.g. 'camera'. ++ HAL will create dumps for the processes matching this key. ++*/ ++#ifndef gcdDUMP_KEY ++# define gcdDUMP_KEY "process" ++#endif ++ ++/* ++ gcdDUMP_PATH ++ ++ The dump file location. Some processes cannot write to the sdcard. ++ Try apps' data dir, e.g. /data/data/com.android.launcher ++*/ ++#ifndef gcdDUMP_PATH ++#if defined(ANDROID) ++# define gcdDUMP_PATH "/mnt/sdcard/" ++#else ++# define gcdDUMP_PATH "./" ++#endif ++#endif ++ ++/* + gcdDUMP + + When set to 1, a dump of all states and memory uploads, as well as other +@@ -342,6 +366,17 @@ + #endif + + /* ++ gcdUSER_HEAP_ALLOCATOR ++ ++ Set to 1 to enable user mode heap allocator for fast memory allocation ++ and destroying. Otherwise, memory allocation/destroying in user mode ++ will be directly managed by system. Only for linux for now. ++*/ ++#ifndef gcdUSER_HEAP_ALLOCATOR ++# define gcdUSER_HEAP_ALLOCATOR 1 ++#endif ++ ++/* + gcdHEAP_SIZE + + Set the allocation size for the internal heaps. Each time a heap is +diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h +index 2881604..808fde0 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h +@@ -28,7 +28,7 @@ + + #define gcvVERSION_PATCH 9 + +-#define gcvVERSION_BUILD 1210 ++#define gcvVERSION_BUILD 4651 + + #define gcvVERSION_DATE __DATE__ + +diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c +index 4e3819c..2ed3d0e 100644 +--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c ++++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c +@@ -663,7 +663,7 @@ static int drv_mmap( + + #if !gcdPAGED_MEMORY_CACHEABLE + vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); +- vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND; ++ vma->vm_flags |= gcdVM_FLAGS; + #endif + vma->vm_pgoff = 0; + +diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h +index 9c0bcd5..3c148f6 100644 +--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h ++++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h +@@ -73,6 +73,12 @@ + + #define GetPageCount(size, offset) ((((size) + ((offset) & ~PAGE_CACHE_MASK)) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION (3,7,0) ++#define gcdVM_FLAGS (VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_DONTDUMP) ++#else ++#define gcdVM_FLAGS (VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED) ++#endif ++ + static inline gctINT + GetOrder( + IN gctINT numPages +diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +index c07ded8..9c2bae6 100644 +--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c ++++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +@@ -869,6 +869,60 @@ _UnmapUserLogical( + #endif + } + ++gceSTATUS ++_QueryProcessPageTable( ++ IN gctPOINTER Logical, ++ OUT gctUINT32 * Address ++ ) ++{ ++ spinlock_t *lock; ++ gctUINTPTR_T logical = (gctUINTPTR_T)Logical; ++ pgd_t *pgd; ++ pud_t *pud; ++ pmd_t *pmd; ++ pte_t *pte; ++ ++ if (!current->mm) ++ { ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ pgd = pgd_offset(current->mm, logical); ++ if (pgd_none(*pgd) || pgd_bad(*pgd)) ++ { ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ pud = pud_offset(pgd, logical); ++ if (pud_none(*pud) || pud_bad(*pud)) ++ { ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ pmd = pmd_offset(pud, logical); ++ if (pmd_none(*pmd) || pmd_bad(*pmd)) ++ { ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ pte = pte_offset_map_lock(current->mm, pmd, logical, &lock); ++ if (!pte) ++ { ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ if (!pte_present(*pte)) ++ { ++ pte_unmap_unlock(pte, lock); ++ return gcvSTATUS_NOT_FOUND; ++ } ++ ++ *Address = (pte_pfn(*pte) << PAGE_SHIFT) | (logical & ~PAGE_MASK); ++ pte_unmap_unlock(pte, lock); ++ ++ return gcvSTATUS_OK; ++} ++ + /******************************************************************************* + ** + ** gckOS_Construct +@@ -1106,6 +1160,9 @@ _CreateKernelVirtualMapping( + numPages, + 0, + PAGE_KERNEL); ++ ++ /* Trigger a page fault. */ ++ memset(addr, 0, numPages * PAGE_SIZE); + } + #else + struct page ** pages; +@@ -1136,6 +1193,9 @@ _CreateKernelVirtualMapping( + /* ioremap() can't work on system memory since 2.6.38. */ + addr = vmap(pages, numPages, 0, gcmkNONPAGED_MEMROY_PROT(PAGE_KERNEL)); + ++ /* Trigger a page fault. */ ++ memset(addr, 0, numPages * PAGE_SIZE); ++ + if (free) + { + kfree(pages); +@@ -1540,7 +1600,7 @@ gckOS_MapMemory( + #else + #if !gcdPAGED_MEMORY_CACHEABLE + mdlMap->vma->vm_page_prot = gcmkPAGED_MEMROY_PROT(mdlMap->vma->vm_page_prot); +- mdlMap->vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED; ++ mdlMap->vma->vm_flags |= gcdVM_FLAGS; + # endif + mdlMap->vma->vm_pgoff = 0; + +@@ -1987,7 +2047,7 @@ gckOS_AllocateNonPagedMemory( + } + #else + mdlMap->vma->vm_page_prot = gcmkNONPAGED_MEMROY_PROT(mdlMap->vma->vm_page_prot); +- mdlMap->vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED; ++ mdlMap->vma->vm_flags |= gcdVM_FLAGS; + mdlMap->vma->vm_pgoff = 0; + + if (remap_pfn_range(mdlMap->vma, +@@ -2367,12 +2427,18 @@ gckOS_GetPhysicalAddress( + gcmkVERIFY_OBJECT(Os, gcvOBJ_OS); + gcmkVERIFY_ARGUMENT(Address != gcvNULL); + +- /* Get current process ID. */ +- processID = _GetProcessID(); ++ /* Query page table of current process first. */ ++ status = _QueryProcessPageTable(Logical, Address); + +- /* Route through other function. */ +- gcmkONERROR( +- gckOS_GetPhysicalAddressProcess(Os, Logical, processID, Address)); ++ if (gcmIS_ERROR(status)) ++ { ++ /* Get current process ID. */ ++ processID = _GetProcessID(); ++ ++ /* Route through other function. */ ++ gcmkONERROR( ++ gckOS_GetPhysicalAddressProcess(Os, Logical, processID, Address)); ++ } + + /* Success. */ + gcmkFOOTER_ARG("*Address=0x%08x", *Address); +@@ -4139,7 +4205,7 @@ gckOS_LockPages( + return gcvSTATUS_OUT_OF_RESOURCES; + } + +- mdlMap->vma->vm_flags |= VM_RESERVED; ++ mdlMap->vma->vm_flags |= gcdVM_FLAGS; + #if !gcdPAGED_MEMORY_CACHEABLE + if (Cacheable == gcvFALSE) + { +-- +1.8.3.2 +recipes-kernel/linux/linux-udoo-3.0.35/0001-perf-tools-Fix-getrusage-related-build-failure-on-gl.patch new file +43
-0@@ -0,0 +1,43 @@ +From 503daf4789dd23e4dc1e16c256de0c163fc2bf87 Mon Sep 17 00:00:00 2001 +From: Markus Trippelsdorf <[email protected]> +Date: Wed, 4 Apr 2012 10:45:27 +0200 +Subject: [PATCH] perf tools: Fix getrusage() related build failure on glibc + trunk +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Organization: O.S. Systems Software LTDA. + +On a system running glibc trunk perf doesn't build: + + CC builtin-sched.o +builtin-sched.c: In function ‘get_cpu_usage_nsec_parent’: builtin-sched.c:399:16: error: storage size of ‘ru’ isn’t known builtin-sched.c:403:2: error: implicit declaration of function ‘getrusage’ [-Werror=implicit-function-declaration] + [...] + +Fix it by including sys/resource.h. + +Upstream-Status: Pending + +Signed-off-by: Markus Trippelsdorf <[email protected]> +Cc: Peter Zijlstra <[email protected]> +Link: http://lkml.kernel.org/r/20120404084527.GA294@x4 +Signed-off-by: Ingo Molnar <[email protected]> +--- + tools/perf/builtin-sched.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c +index dcfe887..3632c2f 100644 +--- a/tools/perf/builtin-sched.c ++++ b/tools/perf/builtin-sched.c +@@ -14,6 +14,7 @@ + #include "util/debug.h" + + #include <sys/prctl.h> ++#include <sys/resource.h> + + #include <semaphore.h> + #include <pthread.h> +-- +1.8.4.rc3 +recipes-kernel/linux/linux-udoo-3.0.35/0002-ARM-7668-1-fix-memset-related-crashes-caused-by-rece.patch new file +259
-0@@ -0,0 +1,259 @@ +From 2235b85f1c76d98b5f1e160cbd0a61a84c15e125 Mon Sep 17 00:00:00 2001 +From: Ivan Djelic <[email protected]> +Date: Wed, 6 Mar 2013 20:09:27 +0100 +Subject: [PATCH] ARM: 7668/1: fix memset-related crashes caused by recent GCC + (4.7.2) optimizations +Organization: O.S. Systems Software LTDA. + +Recent GCC versions (e.g. GCC-4.7.2) perform optimizations based on +assumptions about the implementation of memset and similar functions. +The current ARM optimized memset code does not return the value of +its first argument, as is usually expected from standard implementations. + +For instance in the following function: + +void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter) +{ + memset(waiter, MUTEX_DEBUG_INIT, sizeof(*waiter)); + waiter->magic = waiter; + INIT_LIST_HEAD(&waiter->list); +} + +compiled as: + +800554d0 <debug_mutex_lock_common>: +800554d0: e92d4008 push {r3, lr} +800554d4: e1a00001 mov r0, r1 +800554d8: e3a02010 mov r2, #16 ; 0x10 +800554dc: e3a01011 mov r1, #17 ; 0x11 +800554e0: eb04426e bl 80165ea0 <memset> +800554e4: e1a03000 mov r3, r0 +800554e8: e583000c str r0, [r3, #12] +800554ec: e5830000 str r0, [r3] +800554f0: e5830004 str r0, [r3, #4] +800554f4: e8bd8008 pop {r3, pc} + +GCC assumes memset returns the value of pointer 'waiter' in register r0; causing +register/memory corruptions. + +This patch fixes the return value of the assembly version of memset. +It adds a 'mov' instruction and merges an additional load+store into +existing load/store instructions. +For ease of review, here is a breakdown of the patch into 4 simple steps: + +Step 1 +====== +Perform the following substitutions: +ip -> r8, then +r0 -> ip, +and insert 'mov ip, r0' as the first statement of the function. +At this point, we have a memset() implementation returning the proper result, +but corrupting r8 on some paths (the ones that were using ip). + +Step 2 +====== +Make sure r8 is saved and restored when (! CALGN(1)+0) == 1: + +save r8: +- str lr, [sp, #-4]! ++ stmfd sp!, {r8, lr} + +and restore r8 on both exit paths: +- ldmeqfd sp!, {pc} @ Now <64 bytes to go. ++ ldmeqfd sp!, {r8, pc} @ Now <64 bytes to go. +(...) + tst r2, #16 + stmneia ip!, {r1, r3, r8, lr} +- ldr lr, [sp], #4 ++ ldmfd sp!, {r8, lr} + +Step 3 +====== +Make sure r8 is saved and restored when (! CALGN(1)+0) == 0: + +save r8: +- stmfd sp!, {r4-r7, lr} ++ stmfd sp!, {r4-r8, lr} + +and restore r8 on both exit paths: + bgt 3b +- ldmeqfd sp!, {r4-r7, pc} ++ ldmeqfd sp!, {r4-r8, pc} +(...) + tst r2, #16 + stmneia ip!, {r4-r7} +- ldmfd sp!, {r4-r7, lr} ++ ldmfd sp!, {r4-r8, lr} + +Step 4 +====== +Rewrite register list "r4-r7, r8" as "r4-r8". + +Upstream-Status: Pending + +Signed-off-by: Ivan Djelic <[email protected]> +Reviewed-by: Nicolas Pitre <[email protected]> +Signed-off-by: Dirk Behme <[email protected]> +Signed-off-by: Russell King <[email protected]> +(cherry picked from commit 455bd4c430b0c0a361f38e8658a0d6cb469942b5) +--- + arch/arm/lib/memset.S | 85 ++++++++++++++++++++++++++------------------------- + 1 file changed, 44 insertions(+), 41 deletions(-) + +diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S +index 650d592..d912e73 100644 +--- a/arch/arm/lib/memset.S ++++ b/arch/arm/lib/memset.S +@@ -19,9 +19,9 @@ + 1: subs r2, r2, #4 @ 1 do we have enough + blt 5f @ 1 bytes to align with? + cmp r3, #2 @ 1 +- strltb r1, [r0], #1 @ 1 +- strleb r1, [r0], #1 @ 1 +- strb r1, [r0], #1 @ 1 ++ strltb r1, [ip], #1 @ 1 ++ strleb r1, [ip], #1 @ 1 ++ strb r1, [ip], #1 @ 1 + add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) + /* + * The pointer is now aligned and the length is adjusted. Try doing the +@@ -29,10 +29,14 @@ + */ + + ENTRY(memset) +- ands r3, r0, #3 @ 1 unaligned? ++/* ++ * Preserve the contents of r0 for the return value. ++ */ ++ mov ip, r0 ++ ands r3, ip, #3 @ 1 unaligned? + bne 1b @ 1 + /* +- * we know that the pointer in r0 is aligned to a word boundary. ++ * we know that the pointer in ip is aligned to a word boundary. + */ + orr r1, r1, r1, lsl #8 + orr r1, r1, r1, lsl #16 +@@ -43,29 +47,28 @@ ENTRY(memset) + #if ! CALGN(1)+0 + + /* +- * We need an extra register for this loop - save the return address and +- * use the LR ++ * We need 2 extra registers for this loop - use r8 and the LR + */ +- str lr, [sp, #-4]! +- mov ip, r1 ++ stmfd sp!, {r8, lr} ++ mov r8, r1 + mov lr, r1 + + 2: subs r2, r2, #64 +- stmgeia r0!, {r1, r3, ip, lr} @ 64 bytes at a time. +- stmgeia r0!, {r1, r3, ip, lr} +- stmgeia r0!, {r1, r3, ip, lr} +- stmgeia r0!, {r1, r3, ip, lr} ++ stmgeia ip!, {r1, r3, r8, lr} @ 64 bytes at a time. ++ stmgeia ip!, {r1, r3, r8, lr} ++ stmgeia ip!, {r1, r3, r8, lr} ++ stmgeia ip!, {r1, r3, r8, lr} + bgt 2b +- ldmeqfd sp!, {pc} @ Now <64 bytes to go. ++ ldmeqfd sp!, {r8, pc} @ Now <64 bytes to go. + /* + * No need to correct the count; we're only testing bits from now on + */ + tst r2, #32 +- stmneia r0!, {r1, r3, ip, lr} +- stmneia r0!, {r1, r3, ip, lr} ++ stmneia ip!, {r1, r3, r8, lr} ++ stmneia ip!, {r1, r3, r8, lr} + tst r2, #16 +- stmneia r0!, {r1, r3, ip, lr} +- ldr lr, [sp], #4 ++ stmneia ip!, {r1, r3, r8, lr} ++ ldmfd sp!, {r8, lr} + + #else + +@@ -74,54 +77,54 @@ ENTRY(memset) + * whole cache lines at once. + */ + +- stmfd sp!, {r4-r7, lr} ++ stmfd sp!, {r4-r8, lr} + mov r4, r1 + mov r5, r1 + mov r6, r1 + mov r7, r1 +- mov ip, r1 ++ mov r8, r1 + mov lr, r1 + + cmp r2, #96 +- tstgt r0, #31 ++ tstgt ip, #31 + ble 3f + +- and ip, r0, #31 +- rsb ip, ip, #32 +- sub r2, r2, ip +- movs ip, ip, lsl #(32 - 4) +- stmcsia r0!, {r4, r5, r6, r7} +- stmmiia r0!, {r4, r5} +- tst ip, #(1 << 30) +- mov ip, r1 +- strne r1, [r0], #4 ++ and r8, ip, #31 ++ rsb r8, r8, #32 ++ sub r2, r2, r8 ++ movs r8, r8, lsl #(32 - 4) ++ stmcsia ip!, {r4, r5, r6, r7} ++ stmmiia ip!, {r4, r5} ++ tst r8, #(1 << 30) ++ mov r8, r1 ++ strne r1, [ip], #4 + + 3: subs r2, r2, #64 +- stmgeia r0!, {r1, r3-r7, ip, lr} +- stmgeia r0!, {r1, r3-r7, ip, lr} ++ stmgeia ip!, {r1, r3-r8, lr} ++ stmgeia ip!, {r1, r3-r8, lr} + bgt 3b +- ldmeqfd sp!, {r4-r7, pc} ++ ldmeqfd sp!, {r4-r8, pc} + + tst r2, #32 +- stmneia r0!, {r1, r3-r7, ip, lr} ++ stmneia ip!, {r1, r3-r8, lr} + tst r2, #16 +- stmneia r0!, {r4-r7} +- ldmfd sp!, {r4-r7, lr} ++ stmneia ip!, {r4-r7} ++ ldmfd sp!, {r4-r8, lr} + + #endif + + 4: tst r2, #8 +- stmneia r0!, {r1, r3} ++ stmneia ip!, {r1, r3} + tst r2, #4 +- strne r1, [r0], #4 ++ strne r1, [ip], #4 + /* + * When we get here, we've got less than 4 bytes to zero. We + * may have an unaligned pointer as well. + */ + 5: tst r2, #2 +- strneb r1, [r0], #1 +- strneb r1, [r0], #1 ++ strneb r1, [ip], #1 ++ strneb r1, [ip], #1 + tst r2, #1 +- strneb r1, [r0], #1 ++ strneb r1, [ip], #1 + mov pc, lr + ENDPROC(memset) +-- +1.8.4.rc3 +recipes-kernel/linux/linux-udoo-3.0.35/0002-ENGR00265465-gpu-Add-global-value-for-minimum-3D-clo.patch new file +62
-0@@ -0,0 +1,62 @@ +From 2df4dba8faa9a781a5a1c6c09d646d2b692c9a0c Mon Sep 17 00:00:00 2001 +From: Loren Huang <[email protected]> +Date: Tue, 4 Jun 2013 15:08:15 +0800 +Subject: [PATCH 2/6] ENGR00265465 gpu:Add global value for minimum 3D clock + export + +Add global value gpu3DMinClock so that minimum 3D clock can be change by user. +When gpu min clock is too low, it may cause IPU starvation issue in certain case. +Use echo x > /sys/module/galcore/parameters/gpu3DMinClock to change it. + +Cherry-pick from 3.0.35 branch. + +Upstream-Status: Backport [3.5.7-1.0.0] + +Signed-off-by: Loren Huang <[email protected]> +Acked-by: Lily Zhang +--- + drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | 6 +++++- + drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | 3 +++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c +index 3829999..ebd36fe 100644 +--- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c ++++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c +@@ -36,6 +36,7 @@ typedef struct _gcsiDEBUG_REGISTERS + } + gcsiDEBUG_REGISTERS; + ++extern int gpu3DMinClock; + /******************************************************************************\ + ********************************* Support Code ********************************* + \******************************************************************************/ +@@ -4630,7 +4631,10 @@ gckHARDWARE_GetFscaleValue( + ) + { + *FscaleValue = Hardware->powerOnFscaleVal; +- *MinFscaleValue = 1; ++ if ((gpu3DMinClock > 0) && (gpu3DMinClock <= 64) && (Hardware->core == gcvCORE_MAJOR)) ++ *MinFscaleValue = gpu3DMinClock; ++ else ++ *MinFscaleValue = 1; + *MaxFscaleValue = 64; + + return gcvSTATUS_OK; +diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c +index 2ed3d0e..64cace1 100644 +--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c ++++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c +@@ -146,6 +146,9 @@ module_param(logFileSize,uint, 0644); + static int showArgs = 0; + module_param(showArgs, int, 0644); + ++int gpu3DMinClock = 0; ++module_param(gpu3DMinClock, int, 0644); ++ + #if ENABLE_GPU_CLOCK_BY_DRIVER + unsigned long coreClock = 156000000; + module_param(coreClock, ulong, 0644); +-- +1.8.3.2 +recipes-kernel/linux/linux-udoo-3.0.35/0003-ARM-7670-1-fix-the-memset-fix.patch new file +87
-0@@ -0,0 +1,87 @@ +From 2ba23fa6c4128febaaf57fe184420a7111caa237 Mon Sep 17 00:00:00 2001 +From: Nicolas Pitre <[email protected]> +Date: Tue, 12 Mar 2013 13:00:42 +0100 +Subject: [PATCH] ARM: 7670/1: fix the memset fix +Organization: O.S. Systems Software LTDA. + +Commit 455bd4c430b0 ("ARM: 7668/1: fix memset-related crashes caused by +recent GCC (4.7.2) optimizations") attempted to fix a compliance issue +with the memset return value. However the memset itself became broken +by that patch for misaligned pointers. + +This fixes the above by branching over the entry code from the +misaligned fixup code to avoid reloading the original pointer. + +Also, because the function entry alignment is wrong in the Thumb mode +compilation, that fixup code is moved to the end. + +While at it, the entry instructions are slightly reworked to help dual +issue pipelines. + +Upstream-Status: Pending + +Signed-off-by: Nicolas Pitre <[email protected]> +Tested-by: Alexander Holler <[email protected]> +Signed-off-by: Russell King <[email protected]> +(cherry picked from commit 418df63adac56841ef6b0f1fcf435bc64d4ed177) +--- + arch/arm/lib/memset.S | 33 +++++++++++++-------------------- + 1 file changed, 13 insertions(+), 20 deletions(-) + +diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S +index d912e73..94b0650 100644 +--- a/arch/arm/lib/memset.S ++++ b/arch/arm/lib/memset.S +@@ -14,31 +14,15 @@ + + .text + .align 5 +- .word 0 +- +-1: subs r2, r2, #4 @ 1 do we have enough +- blt 5f @ 1 bytes to align with? +- cmp r3, #2 @ 1 +- strltb r1, [ip], #1 @ 1 +- strleb r1, [ip], #1 @ 1 +- strb r1, [ip], #1 @ 1 +- add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) +-/* +- * The pointer is now aligned and the length is adjusted. Try doing the +- * memset again. +- */ + + ENTRY(memset) +-/* +- * Preserve the contents of r0 for the return value. +- */ +- mov ip, r0 +- ands r3, ip, #3 @ 1 unaligned? +- bne 1b @ 1 ++ ands r3, r0, #3 @ 1 unaligned? ++ mov ip, r0 @ preserve r0 as return value ++ bne 6f @ 1 + /* + * we know that the pointer in ip is aligned to a word boundary. + */ +- orr r1, r1, r1, lsl #8 ++1: orr r1, r1, r1, lsl #8 + orr r1, r1, r1, lsl #16 + mov r3, r1 + cmp r2, #16 +@@ -127,4 +111,13 @@ ENTRY(memset) + tst r2, #1 + strneb r1, [ip], #1 + mov pc, lr ++ ++6: subs r2, r2, #4 @ 1 do we have enough ++ blt 5b @ 1 bytes to align with? ++ cmp r3, #2 @ 1 ++ strltb r1, [ip], #1 @ 1 ++ strleb r1, [ip], #1 @ 1 ++ strb r1, [ip], #1 @ 1 ++ add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) ++ b 1b + ENDPROC(memset) +-- +1.8.4.rc3 +recipes-kernel/linux/linux-udoo-3.0.35/0003-ENGR00261814-4-gpu-use-new-PU-power-on-off-interface.patch new file +53
-0@@ -0,0 +1,53 @@ +From 1579de9397783ab5321c80f1e76661653ef38ccd Mon Sep 17 00:00:00 2001 +From: Robin Gong <[email protected]> +Date: Thu, 9 May 2013 11:45:55 +0800 +Subject: [PATCH 3/6] ENGR00261814-4 gpu: use new PU power on/off interface + +use new PU power on/off interface in GPU driver + +Upstream-Status: Backport [3.5.7-1.0.0] + +Signed-off-by: Robin Gong <[email protected]> +Acked-by: Lily Zhang +--- + .../mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +index 9c2bae6..dfbc699 100644 +--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c ++++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c +@@ -6819,8 +6819,13 @@ gckOS_SetGPUPower( + } + if((Power == gcvTRUE) && (oldPowerState == gcvFALSE)) + { +- if(!IS_ERR(Os->device->gpu_regulator)) +- regulator_enable(Os->device->gpu_regulator); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) ++ if(!IS_ERR(Os->device->gpu_regulator)) ++ regulator_enable(Os->device->gpu_regulator); ++#else ++ imx_gpc_power_up_pu(true); ++#endif ++ + #ifdef CONFIG_PM + pm_runtime_get_sync(Os->device->pmdev); + #endif +@@ -6930,8 +6935,13 @@ gckOS_SetGPUPower( + #ifdef CONFIG_PM + pm_runtime_put_sync(Os->device->pmdev); + #endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) + if(!IS_ERR(Os->device->gpu_regulator)) +- regulator_disable(Os->device->gpu_regulator); ++ regulator_disable(Os->device->gpu_regulator); ++#else ++ imx_gpc_power_up_pu(false); ++#endif + } + /* TODO: Put your code here. */ + gcmkFOOTER_NO(); +-- +1.8.3.2 +recipes-kernel/linux/linux-udoo-3.0.35/0004-ENGR00264288-1-GPU-Integrate-4.6.9p12-release-kernel.patch new file +2006
-0@@ -0,0 +1,2006 @@ +From c090a0238315094d245de2503b6f9a5bce0bda03 Mon Sep 17 00:00:00 2001 +From: Loren Huang <[email protected]> +Date: Mon, 27 May 2013 17:45:48 +0800 +Subject: [PATCH 4/6] ENGR00264288-1 [GPU]Integrate 4.6.9p12 release kernel + part code + +Integrate 4.6.9p12 release kernel part code. +Cherry-pick from 3.0.35 branch. + +Upstream-Status: Backport [3.5.7-1.0.0] + +Signed-off-by: Loren Huang <[email protected]> +Acked-by: Lily Zhang +--- + .../GC350/hal/kernel/gc_hal_kernel_hardware_vg.c | 63 +++- + .../GC350/hal/kernel/gc_hal_kernel_hardware_vg.h | 2 + + .../arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | 174 ++++++++--- + .../arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h | 2 + + drivers/mxc/gpu-viv/config | 1 - + drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c | 329 +++++++-------------- + .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c | 6 +- + .../gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c | 14 +- + drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | 6 +- + drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c | 119 +++++++- + .../hal/kernel/gc_hal_kernel_video_memory.c | 3 + + drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h | 6 + + drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h | 34 +-- + .../mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h | 20 +- + drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h | 35 ++- + drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h | 62 +--- + drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h | 7 - + .../mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | 31 +- + .../mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h | 2 +- + drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h | 6 + + .../hal/os/linux/kernel/gc_hal_kernel_device.c | 13 + + .../hal/os/linux/kernel/gc_hal_kernel_device.h | 1 + + .../hal/os/linux/kernel/gc_hal_kernel_driver.c | 10 +- + .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | 74 +++-- + .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h | 3 + + 25 files changed, 574 insertions(+), 449 deletions(-) + +diff --git a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c +index 4a6010d..70c2cd6 100644 +--- a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c ++++ b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c +@@ -217,7 +217,6 @@ _IdentifyHardware( + return status; + } + +-#if gcdPOWER_MANAGEMENT + static gctTHREADFUNCRESULT gctTHREADFUNCTYPE + _TimeIdleThread( + gctTHREADFUNCPARAMETER ThreadParameter +@@ -262,8 +261,6 @@ _TimeIdleThread( + } + return 0; + } +-#endif +- + + /******************************************************************************\ + ****************************** gckVGHARDWARE API code ***************************** +@@ -309,6 +306,7 @@ gckVGHARDWARE_Construct( + do + { + gcmkERR_BREAK(gckOS_SetGPUPower(Os, gcvCORE_VG, gcvTRUE, gcvTRUE)); ++ + status = _ResetGPU(Os); + + if (status != gcvSTATUS_OK) +@@ -368,14 +366,17 @@ gckVGHARDWARE_Construct( + + gcmkERR_BREAK(gckOS_CreateMutex(Os, &hardware->powerMutex)); + gcmkERR_BREAK(gckOS_CreateSignal(Os, gcvFALSE, &hardware->idleSignal)); +-#if gcdPOWER_MANAGEMENT ++ ++ /* Enable power management by default. */ ++ hardware->powerManagement = gcvTRUE; ++ + gcmkERR_BREAK(gckOS_StartThread( + hardware->os, + _TimeIdleThread, + hardware, + &hardware->timeIdleThread + )); +-#endif ++ + /* Return pointer to the gckVGHARDWARE object. */ + *Hardware = hardware; + +@@ -395,6 +396,8 @@ gckVGHARDWARE_Construct( + gcmkVERIFY_OK(gckOS_Free(Os, hardware)); + } + ++ gcmkVERIFY_OK(gckOS_SetGPUPower(Os, gcvCORE_VG, gcvFALSE, gcvFALSE)); ++ + gcmkFOOTER(); + /* Return the status. */ + return status; +@@ -425,11 +428,10 @@ gckVGHARDWARE_Destroy( + /* Verify the arguments. */ + gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); + +-#if gcdPOWER_MANAGEMENT + Hardware->killThread = gcvTRUE; + gcmkVERIFY_OK(gckOS_Signal(Hardware->os, Hardware->idleSignal, gcvTRUE)); + gcmkVERIFY_OK(gckOS_StopThread(Hardware->os, Hardware->timeIdleThread)); +-#endif ++ + /* Mark the object as unknown. */ + Hardware->object.type = gcvOBJ_UNKNOWN; + +@@ -1432,7 +1434,6 @@ gckVGHARDWARE_ReadInterrupt( + return status; + } + +-#if gcdPOWER_MANAGEMENT + static gceSTATUS _CommandStall( + gckVGHARDWARE Hardware) + { +@@ -1477,7 +1478,6 @@ static gceSTATUS _CommandStall( + /* Return the status. */ + return status; + } +-#endif + + /******************************************************************************* + ** +@@ -1500,7 +1500,6 @@ gckVGHARDWARE_SetPowerManagementState( + IN gceCHIPPOWERSTATE State + ) + { +-#if gcdPOWER_MANAGEMENT + gceSTATUS status; + gckVGCOMMAND command = gcvNULL; + gckOS os; +@@ -1600,6 +1599,12 @@ gckVGHARDWARE_SetPowerManagementState( + command = Hardware->kernel->command; + gcmkVERIFY_OBJECT(command, gcvOBJ_COMMAND); + ++ if (Hardware->powerManagement == gcvFALSE) ++ { ++ gcmkFOOTER_NO(); ++ return gcvSTATUS_OK; ++ } ++ + /* Start profiler. */ + gcmkPROFILE_INIT(freq, time); + +@@ -1914,10 +1919,6 @@ OnError: + /* Return the status. */ + gcmkFOOTER(); + return status; +-#else /* gcdPOWER_MANAGEMENT */ +- /* Do nothing */ +- return gcvSTATUS_OK; +-#endif + } + + /******************************************************************************* +@@ -1955,6 +1956,40 @@ gckVGHARDWARE_QueryPowerManagementState( + return gcvSTATUS_OK; + } + ++/******************************************************************************* ++** ++** gckVGHARDWARE_SetPowerManagement ++** ++** Configure GPU power management function. ++** Only used in driver initialization stage. ++** ++** INPUT: ++** ++** gckVGHARDWARE Harwdare ++** Pointer to an gckHARDWARE object. ++** ++** gctBOOL PowerManagement ++** Power Mangement State. ++** ++*/ ++gceSTATUS ++gckVGHARDWARE_SetPowerManagement( ++ IN gckVGHARDWARE Hardware, ++ IN gctBOOL PowerManagement ++ ) ++{ ++ gcmkHEADER_ARG("Hardware=0x%x", Hardware); ++ ++ /* Verify the arguments. */ ++ gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); ++ ++ Hardware->powerManagement = PowerManagement; ++ ++ /* Success. */ ++ gcmkFOOTER_NO(); ++ return gcvSTATUS_OK; ++} ++ + gceSTATUS + gckVGHARDWARE_SetPowerOffTimeout( + IN gckVGHARDWARE Hardware, +diff --git a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.h b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.h +index 83a603e..16b81ae 100644 +--- a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.h ++++ b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.h +@@ -66,6 +66,8 @@ struct _gckVGHARDWARE + gctTHREAD timeIdleThread; + gctBOOL killThread; + gctPOINTER pageTableDirty; ++ ++ gctBOOL powerManagement; + }; + + #endif /* __gc_hal_kernel_hardware_h_ */ +diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c +index ebd36fe..00f3839 100644 +--- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c ++++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c +@@ -176,6 +176,7 @@ _IdentifyHardware( + Identity->chipMinorFeatures1 = 0; + Identity->chipMinorFeatures2 = 0; + Identity->chipMinorFeatures3 = 0; ++ Identity->chipMinorFeatures4 = 0; + } + else + { +@@ -207,13 +208,20 @@ _IdentifyHardware( + gckOS_ReadRegisterEx(Os, Core, + 0x00088, + &Identity->chipMinorFeatures3)); ++ ++ /* Read chip minor featuress register #4. */ ++ gcmkONERROR( ++ gckOS_ReadRegisterEx(Os, Core, ++ 0x00094, ++ &Identity->chipMinorFeatures4)); + } + else + { +- /* Chip doesn't has minor features register #1 or 2 or 3. */ ++ /* Chip doesn't has minor features register #1 or 2 or 3 or 4. */ + Identity->chipMinorFeatures1 = 0; + Identity->chipMinorFeatures2 = 0; + Identity->chipMinorFeatures3 = 0; ++ Identity->chipMinorFeatures4 = 0; + } + } + +@@ -234,14 +242,14 @@ _IdentifyHardware( + + /* Exception for GC1000, revision 5035 & GC800, revision 4612 */ + if (((Identity->chipModel == gcv1000) && ((Identity->chipRevision == 0x5035) +- || (Identity->chipRevision == 0x5036))) ++ || (Identity->chipRevision == 0x5036) ++ || (Identity->chipRevision == 0x5037))) + || ((Identity->chipModel == gcv800) && (Identity->chipRevision == 0x4612))) + { + Identity->superTileMode = 1; + } + + +- + /* Disable HZ when EZ is present for older chips. */ + if (!((((gctUINT32) (Identity->chipFeatures)) >> (0 ? 16:16) & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1)))))) == (0x1 & ((gctUINT32) ((((1 ? 16:16) - (0 ? 16:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 16:16) - (0 ? 16:16) + 1)))))))) + { +@@ -285,6 +293,10 @@ _IdentifyHardware( + "Identity: chipMinorFeatures3=0x%08X", + Identity->chipMinorFeatures3); + ++ gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, ++ "Identity: chipMinorFeatures4=0x%08X", ++ Identity->chipMinorFeatures4); ++ + /*************************************************************************** + ** Get chip specs. + */ +@@ -576,7 +588,6 @@ OnError: + return status; + } + +-#if gcdPOWER_MANAGEMENT + static gceSTATUS + _IsGPUPresent( + IN gckHARDWARE Hardware +@@ -631,7 +642,6 @@ OnError: + gcmkFOOTER(); + return status; + } +-#endif + + /******************************************************************************\ + ****************************** gckHARDWARE API code ***************************** +@@ -708,6 +718,7 @@ gckHARDWARE_Construct( + + case gcv300: + case gcv320: ++ case gcv420: + hardware->type = gcvHARDWARE_2D; + /*set outstanding limit*/ + gcmkONERROR(gckOS_ReadRegisterEx(Os, Core, 0x00414, &axi_ot)); +@@ -795,6 +806,9 @@ gckHARDWARE_Construct( + hardware->linkQueue.count = 0; + #endif + ++ /* Enable power management by default. */ ++ hardware->powerManagement = gcvTRUE; ++ + /* Return pointer to the gckHARDWARE object. */ + *Hardware = hardware; + +@@ -1404,6 +1418,7 @@ gckHARDWARE_QueryChipIdentity( + Identity->chipMinorFeatures1 = Hardware->identity.chipMinorFeatures1; + Identity->chipMinorFeatures2 = Hardware->identity.chipMinorFeatures2; + Identity->chipMinorFeatures3 = Hardware->identity.chipMinorFeatures3; ++ Identity->chipMinorFeatures4 = Hardware->identity.chipMinorFeatures4; + + /* Return chip specs. */ + Identity->streamCount = Hardware->identity.streamCount; +@@ -3129,7 +3144,7 @@ gckHARDWARE_FlushMMU( + | ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 25:16) - (0 ? 25:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 25:16) - (0 ? 25:16) + 1))))))) << (0 ? 25:16))); + + buffer[9] +- = (((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) & ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))) ); ++ = (((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) | (((gctUINT32) (0x1 & ((gctUINT32) ((((1 ? 4:4) - (0 ? 4:4) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 4:4) - (0 ? 4:4) + 1))))))) << (0 ? 4:4))) & ((((gctUINT32) (~0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7))) | (((gctUINT32) (0x0 & ((gctUINT32) ((((1 ? 7:7) - (0 ? 7:7) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 7:7) - (0 ? 7:7) + 1))))))) << (0 ? 7:7)))); + + /* Arm the PE-FE Semaphore. */ + buffer[10] +@@ -3660,7 +3675,7 @@ typedef enum + } + gcePOWER_FLAGS; + +-#if gcmIS_DEBUG(gcdDEBUG_TRACE) && gcdPOWER_MANAGEMENT ++#if gcmIS_DEBUG(gcdDEBUG_TRACE) + static gctCONST_STRING + _PowerEnum(gceCHIPPOWERSTATE State) + { +@@ -3709,7 +3724,6 @@ gckHARDWARE_SetPowerManagementState( + IN gceCHIPPOWERSTATE State + ) + { +-#if gcdPOWER_MANAGEMENT + gceSTATUS status; + gckCOMMAND command = gcvNULL; + gckOS os; +@@ -3841,6 +3855,12 @@ gckHARDWARE_SetPowerManagementState( + command = Hardware->kernel->command; + gcmkVERIFY_OBJECT(command, gcvOBJ_COMMAND); + ++ if (Hardware->powerManagement == gcvFALSE) ++ { ++ gcmkFOOTER_NO(); ++ return gcvSTATUS_OK; ++ } ++ + /* Start profiler. */ + gcmkPROFILE_INIT(freq, time); + +@@ -4491,10 +4511,6 @@ OnError: + /* Return the status. */ + gcmkFOOTER(); + return status; +-#else /* gcdPOWER_MANAGEMENT */ +- /* Do nothing */ +- return gcvSTATUS_OK; +-#endif + } + + /******************************************************************************* +@@ -4532,6 +4548,40 @@ gckHARDWARE_QueryPowerManagementState( + return gcvSTATUS_OK; + } + ++/******************************************************************************* ++** ++** gckHARDWARE_SetPowerManagement ++** ++** Configure GPU power management function. ++** Only used in driver initialization stage. ++** ++** INPUT: ++** ++** gckHARDWARE Harwdare ++** Pointer to an gckHARDWARE object. ++** ++** gctBOOL PowerManagement ++** Power Mangement State. ++** ++*/ ++gceSTATUS ++gckHARDWARE_SetPowerManagement( ++ IN gckHARDWARE Hardware, ++ IN gctBOOL PowerManagement ++ ) ++{ ++ gcmkHEADER_ARG("Hardware=0x%x", Hardware); ++ ++ /* Verify the arguments. */ ++ gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); ++ ++ Hardware->powerManagement = PowerManagement; ++ ++ /* Success. */ ++ gcmkFOOTER_NO(); ++ return gcvSTATUS_OK; ++} ++ + #if gcdENABLE_FSCALE_VAL_ADJUST + gceSTATUS + gckHARDWARE_SetFscaleValue( +@@ -4767,6 +4817,21 @@ OnError: + GC_DEBUG_SIGNALS_##block##_Address, \ + &profiler->data)) + ++#define gcmkREAD_DEBUG_REGISTER_N(control, block, index, data) \ ++ gcmkONERROR(\ ++ gckOS_WriteRegisterEx(Hardware->os, \ ++ Hardware->core, \ ++ GC_DEBUG_CONTROL##control##_Address, \ ++ gcmSETFIELD(0, \ ++ GC_DEBUG_CONTROL##control, \ ++ block, \ ++ index))); \ ++ gcmkONERROR(\ ++ gckOS_ReadRegisterEx(Hardware->os, \ ++ Hardware->core, \ ++ GC_DEBUG_SIGNALS_##block##_Address, \ ++ &data)) ++ + #define gcmkRESET_DEBUG_REGISTER(control, block) \ + gcmkONERROR(\ + gckOS_WriteRegisterEx(Hardware->os, \ +@@ -4857,6 +4922,9 @@ gckHARDWARE_QueryProfileRegisters( + { + gceSTATUS status; + gcsPROFILER_COUNTERS * profiler = Counters; ++ gctUINT i, clock; ++ gctUINT32 colorKilled, colorDrawn, depthKilled, depthDrawn; ++ gctUINT32 totalRead, totalWrite; + + gcmkHEADER_ARG("Hardware=0x%x Counters=0x%x", Hardware, Counters); + +@@ -4867,16 +4935,6 @@ gckHARDWARE_QueryProfileRegisters( + gcmkONERROR( + gckOS_ReadRegisterEx(Hardware->os, + Hardware->core, +- 0x00040, +- &profiler->gpuTotalRead64BytesPerFrame)); +- gcmkONERROR( +- gckOS_ReadRegisterEx(Hardware->os, +- Hardware->core, +- 0x00044, +- &profiler->gpuTotalWrite64BytesPerFrame)); +- gcmkONERROR( +- gckOS_ReadRegisterEx(Hardware->os, +- Hardware->core, + 0x00438, + &profiler->gpuCyclesCounter)); + +@@ -4892,8 +4950,63 @@ gckHARDWARE_QueryProfileRegisters( + 0x0007C, + &profiler->gpuIdleCyclesCounter)); + +- if(Reset){ + ++ /* Read clock control register. */ ++ gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, ++ Hardware->core, ++ 0x00000, ++ &clock)); ++ ++ profiler->gpuTotalRead64BytesPerFrame = 0; ++ profiler->gpuTotalWrite64BytesPerFrame = 0; ++ profiler->pe_pixel_count_killed_by_color_pipe = 0; ++ profiler->pe_pixel_count_killed_by_depth_pipe = 0; ++ profiler->pe_pixel_count_drawn_by_color_pipe = 0; ++ profiler->pe_pixel_count_drawn_by_depth_pipe = 0; ++ ++ /* Walk through all avaiable pixel pipes. */ ++ for (i = 0; i < Hardware->identity.pixelPipes; ++i) ++ { ++ /* Select proper pipe. */ ++ gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, ++ Hardware->core, ++ 0x00000, ++ ((((gctUINT32) (clock)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:20) - (0 ? 23:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:20) - (0 ? 23:20) + 1))))))) << (0 ? 23:20))) | (((gctUINT32) ((gctUINT32) (i) & ((gctUINT32) ((((1 ? 23:20) - (0 ? 23:20) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:20) - (0 ? 23:20) + 1))))))) << (0 ? 23:20))))); ++ ++ /* BW */ ++ gcmkONERROR( ++ gckOS_ReadRegisterEx(Hardware->os, ++ Hardware->core, ++ 0x00040, ++ &totalRead)); ++ gcmkONERROR( ++ gckOS_ReadRegisterEx(Hardware->os, ++ Hardware->core, ++ 0x00044, ++ &totalWrite)); ++ ++ profiler->gpuTotalRead64BytesPerFrame += totalRead; ++ profiler->gpuTotalWrite64BytesPerFrame += totalWrite; ++ ++ /* PE */ ++ gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16)))));gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &colorKilled)); ++ gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16)))));gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &depthKilled)); ++ gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (2) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16)))));gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &colorDrawn)); ++ gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (3) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16)))));gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &depthDrawn)); ++ ++ profiler->pe_pixel_count_killed_by_color_pipe += colorKilled; ++ profiler->pe_pixel_count_killed_by_depth_pipe += depthKilled; ++ profiler->pe_pixel_count_drawn_by_color_pipe += colorDrawn; ++ profiler->pe_pixel_count_drawn_by_depth_pipe += depthDrawn; ++ } ++ ++ /* Reset clock control register. */ ++ gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, ++ Hardware->core, ++ 0x00000, ++ clock)); ++ ++ if(Reset){ + /* Reset counters. */ + gcmkONERROR( + gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x0003C, 1)); +@@ -4903,19 +5016,10 @@ gckHARDWARE_QueryProfileRegisters( + gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00438, 0)); + gcmkONERROR( + gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00078, 0)); +- } +- /* PE */ +- gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) )); +-gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &profiler->pe_pixel_count_killed_by_color_pipe)); +- gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) )); +-gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &profiler->pe_pixel_count_killed_by_depth_pipe)); +- gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (2) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) )); +-gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &profiler->pe_pixel_count_drawn_by_color_pipe)); +- gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (3) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) )); +-gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &profiler->pe_pixel_count_drawn_by_depth_pipe)); +- if(Reset){ gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (15) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) )); ++ gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (15) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) )); + gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ? 23:16) - (0 ? 23:16) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 23:16) - (0 ? 23:16) + 1))))))) << (0 ? 23:16))) +-)); } ++)); ++ } + + /* SH */ + gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00470, ((((gctUINT32) (0)) & ~(((gctUINT32) (((gctUINT32) ((((1 ? 31:24) - (0 ? 31:24) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:24) - (0 ? 31:24) + 1))))))) << (0 ? 31:24))) | (((gctUINT32) ((gctUINT32) (7) & ((gctUINT32) ((((1 ? 31:24) - (0 ? 31:24) + 1) == 32) ? ~0 : (~(~0 << ((1 ? 31:24) - (0 ? 31:24) + 1))))))) << (0 ? 31:24))) )); +diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h +index 517b35c..37226b7 100644 +--- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h ++++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h +@@ -90,6 +90,8 @@ struct _gckHARDWARE + #if gcdLINK_QUEUE_SIZE + struct _gckLINKQUEUE linkQueue; + #endif ++ ++ gctBOOL powerManagement; + }; + + gceSTATUS +diff --git a/drivers/mxc/gpu-viv/config b/drivers/mxc/gpu-viv/config +index 1196efa..cdd143e 100644 +--- a/drivers/mxc/gpu-viv/config ++++ b/drivers/mxc/gpu-viv/config +@@ -22,7 +22,6 @@ + ARCH_TYPE ?= arm + SDK_DIR ?= $(AQROOT)/build/sdk + USE_3D_VG ?= 1 +-USE_POWER_MANAGEMENT ?= 1 + FORCE_ALL_VIDEO_MEMORY_CACHED ?= 0 + NONPAGED_MEMORY_CACHEABLE ?= 0 + NONPAGED_MEMORY_BUFFERABLE ?= 1 +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 7964585..b7b0d28 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c +@@ -904,9 +904,6 @@ gckKERNEL_Dispatch( + gctSIGNAL signal; + #endif + +- gcsDATABASE_RECORD record; +- gctPOINTER data; +- + gcmkHEADER_ARG("Kernel=0x%x FromUser=%d Interface=0x%x", + Kernel, FromUser, Interface); + +@@ -1940,249 +1937,133 @@ gckKERNEL_Dispatch( + #endif + + case gcvHAL_GET_SHARED_INFO: +- bytes = (gctSIZE_T) Interface->u.GetSharedInfo.size; +- +- if (Interface->u.GetSharedInfo.dataId != 0) ++ if (Interface->u.GetSharedInfo.data == gcvNULL) + { +- gcmkONERROR(gckKERNEL_FindProcessDB(Kernel, +- Interface->u.GetSharedInfo.pid, +- 0, +- gcvDB_SHARED_INFO, +- gcmINT2PTR(Interface->u.GetSharedInfo.dataId), +- &record)); +- +- /* find a record in db, check size */ +- if (record.bytes != bytes) +- { +- /* Size change is not allowed */ +- gcmkONERROR(gcvSTATUS_INVALID_DATA); +- } +- +- /* fetch data */ +- gcmkONERROR(gckOS_CopyToUserData( +- Kernel->os, +- record.physical, +- gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.data), +- bytes +- )); +- ++ gcmkONERROR(gcvSTATUS_INVALID_ARGUMENT); + } +- +- if ((node = gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.node)) != gcvNULL) ++ else + { +- switch (Interface->u.GetSharedInfo.infoType) +- { +- case gcvVIDMEM_INFO_GENERIC: +- { /* Generic data stored */ +- if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) +- { +- data = &node->VidMem.sharedInfo; +- +- } +- else +- { +- data = &node->Virtual.sharedInfo; +- } ++ gctUINT32 pid = Interface->u.GetSharedInfo.pid; ++ gctUINT32 dataId = Interface->u.GetSharedInfo.dataId; ++ gctSIZE_T bytes = Interface->u.GetSharedInfo.bytes; ++ gctPOINTER data = Interface->u.GetSharedInfo.data; ++ gcsDATABASE_RECORD record; + +- gcmkONERROR(gckOS_CopyToUserData( +- Kernel->os, +- data, +- gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.nodeData), +- sizeof(gcsVIDMEM_NODE_SHARED_INFO) +- )); +- } +- break; +- +- case gcvVIDMEM_INFO_DIRTY_RECTANGLE: +- { /* Dirty rectangle stored */ +- gcsVIDMEM_NODE_SHARED_INFO *storedSharedInfo; +- gcsVIDMEM_NODE_SHARED_INFO alignedSharedInfo; +- +- if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) +- { +- storedSharedInfo = &node->VidMem.sharedInfo; +- } +- else +- { +- storedSharedInfo = &node->Virtual.sharedInfo; +- } +- +- /* Stored shared info holds the unaligned dirty rectangle. +- Align it first. */ +- +- /* Hardware requires 64-byte aligned address, and 16x4 pixel aligned rectsize. +- We simply align to 32 pixels which covers both 16- and 32-bpp formats. */ +- +- /* Make sure we have a legit rectangle. */ +- gcmkASSERT((storedSharedInfo->RectSize.width != 0) && (storedSharedInfo->RectSize.height != 0)); +- +- alignedSharedInfo.SrcOrigin.x = gcmALIGN_BASE(storedSharedInfo->SrcOrigin.x, 32); +- alignedSharedInfo.RectSize.width = gcmALIGN((storedSharedInfo->RectSize.width + (storedSharedInfo->SrcOrigin.x - alignedSharedInfo.SrcOrigin.x)), 16); +- +- alignedSharedInfo.SrcOrigin.y = gcmALIGN_BASE(storedSharedInfo->SrcOrigin.y, 4); +- alignedSharedInfo.RectSize.height = gcmALIGN((storedSharedInfo->RectSize.height + (storedSharedInfo->SrcOrigin.y - alignedSharedInfo.SrcOrigin.y)), 4); +- +- gcmkONERROR(gckOS_CopyToUserData( +- Kernel->os, +- &alignedSharedInfo, +- gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.nodeData), +- sizeof(gcsVIDMEM_NODE_SHARED_INFO) +- )); +- +- gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_KERNEL, +- "Node = %p, unaligned rectangle (l=%d, t=%d, w=%d, h=%d) aligned to (l=%d, t=%d, w=%d, h=%d)", node, +- storedSharedInfo->SrcOrigin.x, storedSharedInfo->SrcOrigin.y, +- storedSharedInfo->RectSize.width, storedSharedInfo->RectSize.height, +- alignedSharedInfo.SrcOrigin.x, alignedSharedInfo.SrcOrigin.y, +- alignedSharedInfo.RectSize.width, alignedSharedInfo.RectSize.height); ++ /* Find record. */ ++ gcmkONERROR( ++ gckKERNEL_FindProcessDB(Kernel, ++ pid, ++ 0, ++ gcvDB_SHARED_INFO, ++ gcmINT2PTR(dataId), ++ &record)); ++ ++ /* Check memory size. */ ++ if (bytes < record.bytes) ++ { ++ /* Insufficient memory to hold shared data. */ ++ gcmkONERROR(gcvSTATUS_INVALID_ARGUMENT); ++ } + +- /* Rectangle */ +- storedSharedInfo->SrcOrigin.x = +- storedSharedInfo->SrcOrigin.y = +- storedSharedInfo->RectSize.width = +- storedSharedInfo->RectSize.height = 0; +- } +- break; +- } ++ /* Copy to user. */ ++ status = gckOS_CopyToUserData(Kernel->os, ++ record.physical, ++ data, ++ record.bytes); ++ ++ /* ++ * Remove from process db. ++ * Every time when shared info is taken, the record is erased in ++ * kernel side. ++ */ ++ gcmkVERIFY_OK( ++ gckKERNEL_RemoveProcessDB(Kernel, ++ pid, ++ gcvDB_SHARED_INFO, ++ gcmINT2PTR(dataId))); ++ /* Free existed data. */ ++ gcmkVERIFY_OK( ++ gckOS_FreeMemory(Kernel->os, record.physical)); + } + break; + + case gcvHAL_SET_SHARED_INFO: +- bytes = (gctSIZE_T) Interface->u.SetSharedInfo.size; +- +- if (Interface->u.SetSharedInfo.dataId != 0) + { +- status = gckKERNEL_FindProcessDB(Kernel, processID, 0, +- gcvDB_SHARED_INFO, +- gcmINT2PTR(Interface->u.SetSharedInfo.dataId), +- &record); +- +- if (status == gcvSTATUS_INVALID_DATA) +- { +- /* private data has not been created yet */ +- /* Note: we count on DestoryProcessDB to free it */ +- gcmkONERROR(gckOS_AllocateMemory( +- Kernel->os, +- bytes, +- &data +- )); +- +- gcmkONERROR( +- gckKERNEL_AddProcessDB(Kernel, processID, +- gcvDB_SHARED_INFO, +- gcmINT2PTR(Interface->u.SetSharedInfo.dataId), +- data, +- bytes +- )); +- } +- else ++ gctUINT32 dataId = Interface->u.SetSharedInfo.dataId; ++ gctPOINTER data = Interface->u.SetSharedInfo.data; ++ gctUINT32 bytes = Interface->u.SetSharedInfo.bytes; ++ gctPOINTER memory = gcvNULL; ++ gcsDATABASE_RECORD record; ++ ++ if (gcmIS_SUCCESS(gckKERNEL_FindProcessDB(Kernel, ++ processID, ++ 0, ++ gcvDB_SHARED_INFO, ++ gcmINT2PTR(dataId), ++ &record))) + { +- /* bail on other errors */ +- gcmkONERROR(status); +- +- /* find a record in db, check size */ +- if (record.bytes != bytes) ++ /* Find a record with the same id. */ ++ if (bytes != record.bytes) + { +- /* Size change is not allowed */ +- gcmkONERROR(gcvSTATUS_INVALID_DATA); ++ /* Remove from process db. */ ++ gcmkVERIFY_OK( ++ gckKERNEL_RemoveProcessDB(Kernel, ++ processID, ++ gcvDB_SHARED_INFO, ++ gcmINT2PTR(dataId))); ++ ++ /* Free existed data. */ ++ gcmkVERIFY_OK( ++ gckOS_FreeMemory(Kernel->os, record.physical)); + } +- +- /* get storage address */ +- data = record.physical; +- } +- +- gcmkONERROR(gckOS_CopyFromUserData( +- Kernel->os, +- data, +- gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.data), +- bytes +- )); +- } +- +- if ((node = gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.node)) != gcvNULL) +- { +- switch (Interface->u.SetSharedInfo.infoType) ++ else + { +- case gcvVIDMEM_INFO_GENERIC: +- { /* Generic data stored */ +- if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) +- { +- data = &node->VidMem.sharedInfo; +- } +- else +- { +- data = &node->Virtual.sharedInfo; +- } +- +- gcmkONERROR(gckOS_CopyFromUserData( +- Kernel->os, +- data, +- gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.nodeData), +- sizeof(gcsVIDMEM_NODE_SHARED_INFO) +- )); +- } +- break; ++ /* Re-use allocated memory. */ ++ memory = record.physical; ++ } ++ } + +- case gcvVIDMEM_INFO_DIRTY_RECTANGLE: +- { /* Dirty rectangle stored */ +- gcsVIDMEM_NODE_SHARED_INFO newSharedInfo; +- gcsVIDMEM_NODE_SHARED_INFO *currentSharedInfo; +- gctINT dirtyX, dirtyY, right, bottom; +- +- /* Expand the dirty rectangle stored in the node to include the rectangle passed in. */ +- gcmkONERROR(gckOS_CopyFromUserData( +- Kernel->os, +- &newSharedInfo, +- gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.nodeData), +- gcmSIZEOF(gcsVIDMEM_NODE_SHARED_INFO) +- )); +- +- if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) +- { +- currentSharedInfo = &node->VidMem.sharedInfo; +- } +- else +- { +- currentSharedInfo = &node->Virtual.sharedInfo; +- } ++ if ((data == gcvNULL) || (bytes == 0)) ++ { ++ /* Nothing to record. */ ++ break; ++ } + +- gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_KERNEL, "Node = %p Stored rectangle (l=%d, t=%d, w=%d, h=%d)", node, +- currentSharedInfo->SrcOrigin.x, currentSharedInfo->SrcOrigin.y, +- currentSharedInfo->RectSize.width, currentSharedInfo->RectSize.height); ++ if (bytes > 1024) ++ { ++ /* Limite data size. */ ++ gcmkONERROR(gcvSTATUS_TOO_COMPLEX); ++ } + +- gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_KERNEL, "To combine with (l=%d, t=%d, w=%d, h=%d)", +- newSharedInfo.SrcOrigin.x, newSharedInfo.SrcOrigin.y, +- newSharedInfo.RectSize.width, newSharedInfo.RectSize.height); ++ if (memory == gcvNULL) ++ { ++ /* Allocate memory for holding shared data. */ ++ gcmkONERROR( ++ gckOS_AllocateMemory(Kernel->os, bytes, &memory)); + +- if ((currentSharedInfo->RectSize.width == 0) || (currentSharedInfo->RectSize.height == 0)) +- { /* Setting it for the first time */ +- currentSharedInfo->SrcOrigin.x = newSharedInfo.SrcOrigin.x; +- currentSharedInfo->SrcOrigin.y = newSharedInfo.SrcOrigin.y; +- currentSharedInfo->RectSize.width = newSharedInfo.RectSize.width; +- currentSharedInfo->RectSize.height = newSharedInfo.RectSize.height; +- } +- else +- { +- /* Expand the stored rectangle to include newly locked rectangle */ +- dirtyX = (newSharedInfo.SrcOrigin.x < currentSharedInfo->SrcOrigin.x) ? newSharedInfo.SrcOrigin.x : currentSharedInfo->SrcOrigin.x; +- right = gcmMAX((currentSharedInfo->SrcOrigin.x + currentSharedInfo->RectSize.width), (newSharedInfo.SrcOrigin.x + newSharedInfo.RectSize.width)); +- currentSharedInfo->RectSize.width = right - dirtyX; +- currentSharedInfo->SrcOrigin.x = dirtyX; +- +- dirtyY = (newSharedInfo.SrcOrigin.y < currentSharedInfo->SrcOrigin.y) ? newSharedInfo.SrcOrigin.y : currentSharedInfo->SrcOrigin.y; +- bottom = gcmMAX((currentSharedInfo->SrcOrigin.y + currentSharedInfo->RectSize.height), (newSharedInfo.SrcOrigin.y + newSharedInfo.RectSize.height)); +- currentSharedInfo->RectSize.height = bottom - dirtyY; +- currentSharedInfo->SrcOrigin.y = dirtyY; +- } ++ /* Add to process db. */ ++ status = gckKERNEL_AddProcessDB(Kernel, ++ processID, ++ gcvDB_SHARED_INFO, ++ gcmINT2PTR(dataId), ++ memory, ++ bytes); + +- gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_KERNEL, "Combined rectangle (l=%d, t=%d, w=%d, h=%d)", +- currentSharedInfo->SrcOrigin.x, currentSharedInfo->SrcOrigin.y, +- currentSharedInfo->RectSize.width, currentSharedInfo->RectSize.height); +- } ++ if (gcmIS_ERROR(status)) ++ { ++ /* Failed to add process db. Free allocated memory. */ ++ gcmkVERIFY_OK(gckOS_FreeMemory(Kernel->os, memory)); + break; + } +- } ++ } + ++ /* Copy shared data to kernel memory. */ ++ gcmkONERROR( ++ gckOS_CopyFromUserData(Kernel->os, ++ memory, ++ data, ++ bytes)); ++ } + break; + + case gcvHAL_SET_FSCALE_VALUE: +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c +index 66ce0d1..9ee9ea1 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c +@@ -2047,14 +2047,14 @@ gckCOMMAND_Commit( + EventQueue = nextEventRecord; + } + +-#if gcdPOWER_MANAGEMENT +- if (Command->kernel->eventObj->queueHead == gcvNULL) ++ if (Command->kernel->eventObj->queueHead == gcvNULL ++ && Command->kernel->hardware->powerManagement == gcvTRUE ++ ) + { + /* Commit done event by which work thread knows all jobs done. */ + gcmkVERIFY_OK( + gckEVENT_CommitDone(Command->kernel->eventObj, gcvKERNEL_PIXEL)); + } +-#endif + + /* Submit events. */ + status = gckEVENT_Submit(Command->kernel->eventObj, gcvTRUE, gcvFALSE); +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c +index 9685a5d..76c1c10 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c +@@ -1234,7 +1234,6 @@ _EventHandler_BusError( + return gcvSTATUS_OK; + } + +-#if gcdPOWER_MANAGEMENT + /******************************************************************************\ + ****************************** Power Stall Handler ******************************* + \******************************************************************************/ +@@ -1250,7 +1249,6 @@ _EventHandler_PowerStall( + Kernel->command->powerStallSignal, + gcvTRUE); + } +-#endif + + /******************************************************************************\ + ******************************** Task Routines ********************************* +@@ -1965,15 +1963,12 @@ gcmDECLARE_INTERRUPT_HANDLER(COMMAND, 0) + ); + } + } +-#if gcdPOWER_MANAGEMENT + else + { +- + status = gckVGHARDWARE_SetPowerManagementState( + Kernel->command->hardware, gcvPOWER_IDLE_BROADCAST + ); + } +-#endif + + /* Break out of the loop. */ + break; +@@ -2848,7 +2843,7 @@ gckVGCOMMAND_Construct( + _EventHandler_BusError + )); + +-#if gcdPOWER_MANAGEMENT ++ + command->powerStallInt = 30; + /* Enable the interrupt. */ + gcmkERR_BREAK(gckVGINTERRUPT_Enable( +@@ -2856,7 +2851,6 @@ gckVGCOMMAND_Construct( + &command->powerStallInt, + _EventHandler_PowerStall + )); +-#endif + + /*********************************************************************** + ** Task management initialization. +@@ -3419,7 +3413,6 @@ gckVGCOMMAND_Commit( + gcvINFINITE + )); + +-#if gcdPOWER_MANAGEMENT + status = gckVGHARDWARE_SetPowerManagementState( + Command->hardware, gcvPOWER_ON_AUTO); + +@@ -3447,7 +3440,7 @@ gckVGCOMMAND_Commit( + + break; + } +-#endif ++ + gcmkERR_BREAK(_FlushMMU(Command)); + + do +@@ -3676,10 +3669,9 @@ gckVGCOMMAND_Commit( + } + while (gcvFALSE); + +-#if gcdPOWER_MANAGEMENT + gcmkVERIFY_OK(gckOS_ReleaseSemaphore( + Command->os, Command->powerSemaphore)); +-#endif ++ + /* Release the mutex. */ + gcmkCHECK_STATUS(gckOS_ReleaseMutex( + Command->os, +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c +index bc5f083..673d4f7 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c +@@ -1303,9 +1303,9 @@ gckKERNEL_DestroyProcessDB( + gcmPTR2INT(record->data), status); + break; + +- case gcvDB_SHARED_INFO: +- status = gckOS_FreeMemory(Kernel->os, record->physical); +- break; ++ case gcvDB_SHARED_INFO: ++ status = gckOS_FreeMemory(Kernel->os, record->physical); ++ break; + + default: + gcmkTRACE_ZONE(gcvLEVEL_ERROR, gcvZONE_DATABASE, +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c +index 43c9297..c7f67c7 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c +@@ -97,6 +97,14 @@ static gcsMirrorPageTable_PTR mirrorPageTable = gcvNULL; + static gctPOINTER mirrorPageTableMutex = gcvNULL; + #endif + ++typedef struct _gcsDynamicSpaceNode * gcsDynamicSpaceNode_PTR; ++typedef struct _gcsDynamicSpaceNode ++{ ++ gctUINT32 start; ++ gctINT32 entries; ++} ++gcsDynamicSpaceNode; ++ + static void + _WritePageEntry( + IN gctUINT32_PTR PageEntry, +@@ -482,30 +490,117 @@ OnError: + } + + static gceSTATUS ++_FindDynamicSpace( ++ IN gckMMU Mmu, ++ OUT gcsDynamicSpaceNode_PTR *Array, ++ OUT gctINT * Size ++ ) ++{ ++ gceSTATUS status = gcvSTATUS_OK; ++ gctPOINTER pointer = gcvNULL; ++ gcsDynamicSpaceNode_PTR array = gcvNULL; ++ gctINT size = 0; ++ gctINT i = 0, nodeStart = -1, nodeEntries = 0; ++ ++ /* Allocate memory for the array. */ ++ gcmkONERROR(gckOS_Allocate(Mmu->os, ++ gcmSIZEOF(*array) * (gcdMMU_MTLB_ENTRY_NUM / 2), ++ &pointer)); ++ ++ array = (gcsDynamicSpaceNode_PTR)pointer; ++ ++ /* Loop all the entries. */ ++ while (i < gcdMMU_MTLB_ENTRY_NUM) ++ { ++ if (!Mmu->mtlbLogical[i]) ++ { ++ if (nodeStart < 0) ++ { ++ /* This is the first entry of the dynamic space. */ ++ nodeStart = i; ++ nodeEntries = 1; ++ } ++ else ++ { ++ /* Other entries of the dynamic space. */ ++ nodeEntries++; ++ } ++ } ++ else if (nodeStart >= 0) ++ { ++ /* Save the previous node. */ ++ array[size].start = nodeStart; ++ array[size].entries = nodeEntries; ++ size++; ++ ++ /* Reset the start. */ ++ nodeStart = -1; ++ nodeEntries = 0; ++ } ++ ++ i++; ++ } ++ ++ /* Save the previous node. */ ++ if (nodeStart >= 0) ++ { ++ array[size].start = nodeStart; ++ array[size].entries = nodeEntries; ++ size++; ++ } ++ ++#if gcdMMU_TABLE_DUMP ++ for (i = 0; i < size; i++) ++ { ++ gckOS_Print("%s(%d): [%d]: start=%d, entries=%d.\n", ++ __FUNCTION__, __LINE__, ++ i, ++ array[i].start, ++ array[i].entries); ++ } ++#endif ++ ++ *Array = array; ++ *Size = size; ++ ++ return gcvSTATUS_OK; ++ ++OnError: ++ if (pointer != gcvNULL) ++ { ++ gckOS_Free(Mmu->os, pointer); ++ } ++ ++ return status; ++} ++ ++static gceSTATUS + _SetupDynamicSpace( + IN gckMMU Mmu + ) + { + gceSTATUS status; +- gctINT i; ++ gcsDynamicSpaceNode_PTR nodeArray = gcvNULL; ++ gctINT i, nodeArraySize = 0; + gctUINT32 physical; +- gctINT numEntries; ++ gctINT numEntries = 0; + gctUINT32_PTR pageTable; + gctBOOL acquired = gcvFALSE; + +- /* find the start of dynamic address space. */ +- for (i = 0; i < gcdMMU_MTLB_ENTRY_NUM; i++) ++ /* Find all the dynamic address space. */ ++ gcmkONERROR(_FindDynamicSpace(Mmu, &nodeArray, &nodeArraySize)); ++ ++ /* TODO: We only use the largest one for now. */ ++ for (i = 0; i < nodeArraySize; i++) + { +- if (!Mmu->mtlbLogical[i]) ++ if (nodeArray[i].entries > numEntries) + { +- break; ++ Mmu->dynamicMappingStart = nodeArray[i].start; ++ numEntries = nodeArray[i].entries; + } + } + +- Mmu->dynamicMappingStart = i; +- +- /* Number of entries in Master TLB for dynamic mapping. */ +- numEntries = gcdMMU_MTLB_ENTRY_NUM - i; ++ gckOS_Free(Mmu->os, (gctPOINTER)nodeArray); + + Mmu->pageTableSize = numEntries * 4096; + +@@ -545,7 +640,9 @@ _SetupDynamicSpace( + acquired = gcvTRUE; + + /* Map to Master TLB. */ +- for (; i < gcdMMU_MTLB_ENTRY_NUM; i++) ++ for (i = (gctINT)Mmu->dynamicMappingStart; ++ i < (gctINT)Mmu->dynamicMappingStart + numEntries; ++ i++) + { + _WritePageEntry(Mmu->mtlbLogical + i, + physical +diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c +index 8a442a2..8b8bbdc 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c ++++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c +@@ -2144,6 +2144,9 @@ gckVIDMEM_Unlock( + + if (!Node->Virtual.contiguous + && (Node->Virtual.lockeds[Kernel->core] == 1) ++#if gcdENABLE_VG ++ && (Kernel->vg == gcvNULL) ++#endif + ) + { + if (Type == gcvSURF_BITMAP) +diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h +index 7077412..4406d7e 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h +@@ -2072,6 +2072,12 @@ gckHARDWARE_QueryPowerManagementState( + OUT gceCHIPPOWERSTATE* State + ); + ++gceSTATUS ++gckHARDWARE_SetPowerManagement( ++ IN gckHARDWARE Hardware, ++ IN gctBOOL PowerManagement ++ ); ++ + #if gcdENABLE_FSCALE_VAL_ADJUST + gceSTATUS + gckHARDWARE_SetFscaleValue( +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 ac86399..44689b0 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 +@@ -74,7 +74,6 @@ typedef struct _gcsSYNC_CONTEXT * gcsSYNC_CONTEXT_PTR; + /******************************************************************************\ + ******************************* Process local storage ************************* + \******************************************************************************/ +- + typedef struct _gcsPLS * gcsPLS_PTR; + typedef struct _gcsPLS + { +@@ -107,6 +106,7 @@ typedef struct _gcsPLS + + /* Reference count for destructor. */ + gcsATOM_PTR reference; ++ gctBOOL bKFS; + #if gcdUSE_NPOT_PATCH + gctBOOL bNeedSupportNP2Texture; + #endif +@@ -123,7 +123,7 @@ extern gcsPLS gcPLS; + typedef struct _gcsTLS * gcsTLS_PTR; + + typedef void (* gctTLS_DESTRUCTOR) ( +- gcsTLS_PTR TLS ++ gcsTLS_PTR + ); + + typedef struct _gcsTLS +@@ -658,8 +658,6 @@ gcoHAL_QueryChipFeature( + IN gceFEATURE Feature); + + #endif +- +- + /******************************************************************************\ + ********************************** gcoOS Object ********************************* + \******************************************************************************/ +@@ -1775,20 +1773,6 @@ gcoSURF_QueryVidMemNode( + OUT gctUINT_PTR Bytes + ); + +-/* Set usage attribute of a surface. */ +-gceSTATUS +-gcoSURF_SetUsage( +- IN gcoSURF Surface, +- IN gceSURF_USAGE Usage +- ); +- +-/* Return usage attribute of a surface. */ +-gceSTATUS +-gcoSURF_QueryUsage( +- IN gcoSURF Surface, +- OUT gceSURF_USAGE *Usage +- ); +- + /* Set the color type of the surface. */ + gceSTATUS + gcoSURF_SetColorType( +@@ -1975,6 +1959,14 @@ gcoSURF_SetWindow( + IN gctUINT Height + ); + ++/* Set width/height alignment of the surface directly and calculate stride/size. This is only for dri backend now. Please be careful before use. */ ++gceSTATUS ++gcoSURF_SetAlignment( ++ IN gcoSURF Surface, ++ IN gctUINT Width, ++ IN gctUINT Height ++ ); ++ + /* Increase reference count of the surface. */ + gceSTATUS + gcoSURF_ReferenceSurface( +@@ -2009,6 +2001,12 @@ gcoSURF_SetOffset( + ); + + gceSTATUS ++gcoSURF_GetOffset( ++ IN gcoSURF Surface, ++ OUT gctUINT *Offset ++ ); ++ ++gceSTATUS + gcoSURF_NODE_Cache( + IN gcsSURF_NODE_PTR Node, + IN gctPOINTER Logical, +diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h +index 4a0870f..8693c37 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h +@@ -36,12 +36,16 @@ extern "C" { + #endif + + #ifndef GC_ENABLE_LOADTIME_OPT +-#define GC_ENABLE_LOADTIME_OPT 1 ++#define GC_ENABLE_LOADTIME_OPT 1 + #endif + + #define TEMP_OPT_CONSTANT_TEXLD_COORD 1 + +-#define TEMP_SHADER_PATCH 1 ++#define TEMP_SHADER_PATCH 1 ++ ++#define ADD_PRE_ROTATION_TO_VS 0 ++ ++#define TEMP_INLINE_ALL_EXPANSION 1 + /******************************* IR VERSION ******************/ + #define gcdSL_IR_VERSION gcmCC('\0','\0','\0','\1') + +@@ -683,6 +687,13 @@ typedef enum _gceSHADER_FLAGS + gcvSHADER_USE_ALPHA_KILL = 0x100, + #endif + ++#if ADD_PRE_ROTATION_TO_VS ++ gcvSHADER_VS_PRE_ROTATION = 0x200, ++#endif ++ ++#if TEMP_INLINE_ALL_EXPANSION ++ gcvSHADER_INLINE_ALL_EXPANSION = 0x200, ++#endif + } + gceSHADER_FLAGS; + +@@ -771,10 +782,15 @@ typedef enum _gceSHADER_OPTIMIZATION + /* optimize varying packing */ + gcvOPTIMIZATION_VARYINGPACKING = 1 << 22, + ++#if TEMP_INLINE_ALL_EXPANSION ++ gcvOPTIMIZATION_INLINE_ALL_EXPANSION = 1 << 23, ++#endif ++ + /* Full optimization. */ + /* Note that gcvOPTIMIZATION_LOAD_SW_WORKAROUND is off. */ + gcvOPTIMIZATION_FULL = 0x7FFFFFFF & + ~gcvOPTIMIZATION_LOAD_SW_WORKAROUND & ++ ~gcvOPTIMIZATION_INLINE_ALL_EXPANSION & + ~gcvOPTIMIZATION_POWER_OPTIMIZATION, + + /* Optimization Unit Test flag. */ +diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h +index 028bbd1..b056c52 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h +@@ -210,6 +210,9 @@ typedef struct _gcsHAL_QUERY_CHIP_IDENTITY + /* Supported minor feature 3 fields. */ + gctUINT32 chipMinorFeatures3; + ++ /* Supported minor feature 4 fields. */ ++ gctUINT32 chipMinorFeatures4; ++ + /* Number of streams supported. */ + gctUINT32 streamCount; + +@@ -929,30 +932,30 @@ typedef struct _gcsHAL_INTERFACE + + struct _gcsHAL_GET_SHARED_INFO + { ++ /* Process id. */ + IN gctUINT32 pid; ++ ++ /* Data id. */ + IN gctUINT32 dataId; +- /* gcuVIDMEM_NODE_PTR */ +- IN gctUINT64 node; +- /* gctUINT8_PTR */ +- OUT gctUINT64 data; +- /* fix size. gctUINT8_PTR*/ +- OUT gctUINT64 nodeData; +- gctUINT64 size; +- IN gceVIDMEM_NODE_SHARED_INFO_TYPE infoType; ++ ++ /* Data size. */ ++ IN gctSIZE_T bytes; ++ ++ /* Pointer to save the shared data. */ ++ OUT gctPOINTER data; + } + GetSharedInfo; + + struct _gcsHAL_SET_SHARED_INFO + { ++ /* Data id. */ + IN gctUINT32 dataId; +- /* gcuVIDMEM_NODE_PTR */ +- IN gctUINT64 node; +- /* gctUINT8_PTR */ +- IN gctUINT64 data; +- /* gctUINT8_PTR */ +- IN gctUINT64 nodeData; +- IN gctUINT64 size; +- IN gceVIDMEM_NODE_SHARED_INFO_TYPE infoType; ++ ++ /* Data to be shared. */ ++ IN gctPOINTER data; ++ ++ /* Data size. */ ++ IN gctSIZE_T bytes; + } + SetSharedInfo; + +diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h +index 249b61b..8481375 100644 +--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h ++++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h +@@ -323,50 +323,6 @@ gcoSURF_Resolve(Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/0004-ENGR00271136-Fix-build-break-when-CONFIG_CLK_DEBUG-i.patch new file +43
-0Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/0005-ENGR00264275-GPU-Correct-suspend-resume-calling-afte.patch new file +61
-0Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/0005-ENGR00271359-Add-Multi-touch-support.patch new file +98
-0Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/0006-Add-support-for-DVI-monitors.patch new file +227
-0Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/0006-ENGR00265130-gpu-Correct-section-mismatch-in-gpu-ker.patch new file +60
-0Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/0007-ARM-mach-mx6-board-mx6q_sabresd-Register-SDHC3-first.patch new file +38
-0Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/defconfig new file +246
-0Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/drm-vivante-Add-00-sufix-in-returned-bus-Id.patch new file +31
-0Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo-3.0.35/epdc-Rename-mxcfb_epdc_kernel.h-to-mxc_epdc.h.patch new file +143
-0Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo.inc new file +17
-0Lines of this file are not shown. View the raw message.
recipes-kernel/linux/linux-udoo_3.0.35.bb new file +1
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
I'm not sure it was adapted from linux-imx.inc, or from linux-imx_${PV}.bb instead.
Copyright here should be 2013 only, it's a new file being created.
Quoted 26 lines
recipes-kernel/linux/linux-udoo_3.0.35.bb new file +25
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
Daiane
Part of the diff is not shown here. View the raw message.
Quoted 17 lines · Daiane Angolini
Quoted 11 lines · Luca Simone Ronga
From: Luca Simone Ronga <[email protected]>
Dear Freescale community,
here is the kernel recipe for the UDOO Board kernel branch maintained by SECO
(KernelUnico 2013).
I wish to thank John Weber and Otavio Salvador for their useful comments. L.Could you, please, format your commit log and commit subject?
You can use other commits to get the format.
Quoted 7 lines
Please, let me know if you need help
I have not participated on discussion about these new recipes, but it looks like so much patch added in
SRC_URI. Was new git repository suggested?Please, see more comments inline, in linux bb file
Besides those comments please name the recipe as linux-udoo.
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750