diff options
Diffstat (limited to 'recipes-kernel/linux/linux-wandboard-3.0.35')
8 files changed, 3555 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-wandboard-3.0.35/0001-ENGR00255688-4.6.9p11.1-gpu-GPU-Kernel-driver-integr.patch b/recipes-kernel/linux/linux-wandboard-3.0.35/0001-ENGR00255688-4.6.9p11.1-gpu-GPU-Kernel-driver-integr.patch new file mode 100644 index 0000000..9c7cd44 --- /dev/null +++ b/recipes-kernel/linux/linux-wandboard-3.0.35/0001-ENGR00255688-4.6.9p11.1-gpu-GPU-Kernel-driver-integr.patch | |||
@@ -0,0 +1,1040 @@ | |||
1 | From 46e3a6de5adb9379f9d6eef2c038c2f18637d407 Mon Sep 17 00:00:00 2001 | ||
2 | From: Loren Huang <b02279@freescale.com> | ||
3 | Date: Mon, 25 Mar 2013 15:43:57 +0800 | ||
4 | Subject: [PATCH 1/6] ENGR00255688 4.6.9p11.1 [gpu]GPU Kernel driver | ||
5 | integration | ||
6 | |||
7 | 4.6.9p11.1 GPU kernel driver integration | ||
8 | Cherry pick from imx_3.0.35 | ||
9 | |||
10 | Upstream-Status: Backport [3.5.7-1.0.0] | ||
11 | |||
12 | Signed-off-by: Loren Huang <b02279@freescale.com> | ||
13 | Acked-by: Lily Zhang | ||
14 | --- | ||
15 | drivers/mxc/gpu-viv/Kbuild | 2 +- | ||
16 | .../arch/XAQ2/hal/kernel/gc_hal_kernel_context.c | 2 +- | ||
17 | .../arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | 7 +- | ||
18 | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h | 2 +- | ||
19 | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | 53 ++++-- | ||
20 | .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c | 5 +- | ||
21 | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c | 178 ++++++++++++--------- | ||
22 | .../hal/kernel/gc_hal_kernel_video_memory.c | 3 +- | ||
23 | .../gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h | 13 +- | ||
24 | drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h | 25 +++ | ||
25 | .../mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | 35 ++++ | ||
26 | .../mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h | 2 +- | ||
27 | .../hal/os/linux/kernel/gc_hal_kernel_driver.c | 2 +- | ||
28 | .../hal/os/linux/kernel/gc_hal_kernel_linux.h | 6 + | ||
29 | .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | 82 +++++++++- | ||
30 | 15 files changed, 304 insertions(+), 113 deletions(-) | ||
31 | |||
32 | diff --git a/drivers/mxc/gpu-viv/Kbuild b/drivers/mxc/gpu-viv/Kbuild | ||
33 | index 0b18a7b..93b1259 100644 | ||
34 | --- a/drivers/mxc/gpu-viv/Kbuild | ||
35 | +++ b/drivers/mxc/gpu-viv/Kbuild | ||
36 | @@ -1,6 +1,6 @@ | ||
37 | ############################################################################## | ||
38 | # | ||
39 | -# Copyright (C) 2005 - 2012 by Vivante Corp. | ||
40 | +# Copyright (C) 2005 - 2013 by Vivante Corp. | ||
41 | # | ||
42 | # This program is free software; you can redistribute it and/or modify | ||
43 | # it under the terms of the GNU General Public License as published by | ||
44 | 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 | ||
45 | index 22e1f27..24003e7 100644 | ||
46 | --- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c | ||
47 | +++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_context.c | ||
48 | @@ -471,7 +471,7 @@ _InitializeContextBuffer( | ||
49 | index += _SwitchPipe(Context, index, gcvPIPE_3D); | ||
50 | |||
51 | /* Current context pointer. */ | ||
52 | -#if gcdDEBUG | ||
53 | +#if gcdDEBUG | ||
54 | index += _State(Context, index, 0x03850 >> 2, 0x00000000, 1, gcvFALSE, gcvFALSE); | ||
55 | #endif | ||
56 | |||
57 | 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 | ||
58 | index a87259e..3829999 100644 | ||
59 | --- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | ||
60 | +++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | ||
61 | @@ -232,7 +232,8 @@ _IdentifyHardware( | ||
62 | } | ||
63 | |||
64 | /* Exception for GC1000, revision 5035 & GC800, revision 4612 */ | ||
65 | - if (((Identity->chipModel == gcv1000) && (Identity->chipRevision == 0x5035)) | ||
66 | + if (((Identity->chipModel == gcv1000) && ((Identity->chipRevision == 0x5035) | ||
67 | + || (Identity->chipRevision == 0x5036))) | ||
68 | || ((Identity->chipModel == gcv800) && (Identity->chipRevision == 0x4612))) | ||
69 | { | ||
70 | Identity->superTileMode = 1; | ||
71 | @@ -751,7 +752,7 @@ gckHARDWARE_Construct( | ||
72 | /* Initialize the fast clear. */ | ||
73 | gcmkONERROR(gckHARDWARE_SetFastClear(hardware, -1, -1)); | ||
74 | |||
75 | -#if !gcdENABLE_128B_MERGE | ||
76 | +#if !gcdENABLE_128B_MERGE | ||
77 | |||
78 | 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)))))))) | ||
79 | { | ||
80 | @@ -1027,7 +1028,7 @@ gckHARDWARE_InitializeHardware( | ||
81 | 0x00424, | ||
82 | baseAddress)); | ||
83 | |||
84 | -#if !VIVANTE_PROFILER | ||
85 | +#if !VIVANTE_PROFILER | ||
86 | { | ||
87 | gctUINT32 data; | ||
88 | |||
89 | diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h | ||
90 | index 1da80b7..5896e93 100644 | ||
91 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h | ||
92 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.h | ||
93 | @@ -186,7 +186,7 @@ typedef struct _gcsDATABASE | ||
94 | gctUINT64 idle; | ||
95 | |||
96 | /* Pointer to database. */ | ||
97 | - gcsDATABASE_RECORD_PTR list; | ||
98 | + gcsDATABASE_RECORD_PTR list[48]; | ||
99 | |||
100 | #if gcdSECURE_USER | ||
101 | /* Secure cache. */ | ||
102 | 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 | ||
103 | index 1fb18fb..bc5f083 100644 | ||
104 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | ||
105 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | ||
106 | @@ -26,6 +26,9 @@ | ||
107 | /******************************************************************************* | ||
108 | ***** Private fuctions ********************************************************/ | ||
109 | |||
110 | +#define _GetSlot(database, x) \ | ||
111 | + (gctUINT32)(((gcmPTR_TO_UINT64(x) >> 7) % gcmCOUNTOF(database->list))) | ||
112 | + | ||
113 | /******************************************************************************* | ||
114 | ** gckKERNEL_NewDatabase | ||
115 | ** | ||
116 | @@ -56,6 +59,7 @@ gckKERNEL_NewDatabase( | ||
117 | gcsDATABASE_PTR database; | ||
118 | gctBOOL acquired = gcvFALSE; | ||
119 | gctSIZE_T slot; | ||
120 | + gcsDATABASE_PTR existingDatabase; | ||
121 | |||
122 | gcmkHEADER_ARG("Kernel=0x%x ProcessID=%d", Kernel, ProcessID); | ||
123 | |||
124 | @@ -63,6 +67,21 @@ gckKERNEL_NewDatabase( | ||
125 | gcmkONERROR(gckOS_AcquireMutex(Kernel->os, Kernel->db->dbMutex, gcvINFINITE)); | ||
126 | acquired = gcvTRUE; | ||
127 | |||
128 | + /* Compute the hash for the database. */ | ||
129 | + slot = ProcessID % gcmCOUNTOF(Kernel->db->db); | ||
130 | + | ||
131 | + /* Walk the hash list. */ | ||
132 | + for (existingDatabase = Kernel->db->db[slot]; | ||
133 | + existingDatabase != gcvNULL; | ||
134 | + existingDatabase = existingDatabase->next) | ||
135 | + { | ||
136 | + if (existingDatabase->processID == ProcessID) | ||
137 | + { | ||
138 | + /* One process can't be added twice. */ | ||
139 | + gcmkONERROR(gcvSTATUS_NOT_SUPPORTED); | ||
140 | + } | ||
141 | + } | ||
142 | + | ||
143 | if (Kernel->db->freeDatabase != gcvNULL) | ||
144 | { | ||
145 | /* Allocate a database from the free list. */ | ||
146 | @@ -81,9 +100,6 @@ gckKERNEL_NewDatabase( | ||
147 | database = pointer; | ||
148 | } | ||
149 | |||
150 | - /* Compute the hash for the database. */ | ||
151 | - slot = ProcessID % gcmCOUNTOF(Kernel->db->db); | ||
152 | - | ||
153 | /* Insert the database into the hash. */ | ||
154 | database->next = Kernel->db->db[slot]; | ||
155 | Kernel->db->db[slot] = database; | ||
156 | @@ -350,6 +366,7 @@ static gceSTATUS | ||
157 | gckKERNEL_NewRecord( | ||
158 | IN gckKERNEL Kernel, | ||
159 | IN gcsDATABASE_PTR Database, | ||
160 | + IN gctUINT32 Slot, | ||
161 | OUT gcsDATABASE_RECORD_PTR * Record | ||
162 | ) | ||
163 | { | ||
164 | @@ -383,8 +400,8 @@ gckKERNEL_NewRecord( | ||
165 | } | ||
166 | |||
167 | /* Insert the record in the database. */ | ||
168 | - record->next = Database->list; | ||
169 | - Database->list = record; | ||
170 | + record->next = Database->list[Slot]; | ||
171 | + Database->list[Slot] = record; | ||
172 | |||
173 | /* Release the database mutex. */ | ||
174 | gcmkONERROR(gckOS_ReleaseMutex(Kernel->os, Kernel->db->dbMutex)); | ||
175 | @@ -449,6 +466,7 @@ gckKERNEL_DeleteRecord( | ||
176 | gceSTATUS status; | ||
177 | gctBOOL acquired = gcvFALSE; | ||
178 | gcsDATABASE_RECORD_PTR record, previous; | ||
179 | + gctUINT32 slot = _GetSlot(Database, Data); | ||
180 | |||
181 | gcmkHEADER_ARG("Kernel=0x%x Database=0x%x Type=%d Data=0x%x", | ||
182 | Kernel, Database, Type, Data); | ||
183 | @@ -458,8 +476,9 @@ gckKERNEL_DeleteRecord( | ||
184 | gckOS_AcquireMutex(Kernel->os, Kernel->db->dbMutex, gcvINFINITE)); | ||
185 | acquired = gcvTRUE; | ||
186 | |||
187 | + | ||
188 | /* Scan the database for this record. */ | ||
189 | - for (record = Database->list, previous = gcvNULL; | ||
190 | + for (record = Database->list[slot], previous = gcvNULL; | ||
191 | record != gcvNULL; | ||
192 | record = record->next | ||
193 | ) | ||
194 | @@ -490,7 +509,7 @@ gckKERNEL_DeleteRecord( | ||
195 | /* Remove record from database. */ | ||
196 | if (previous == gcvNULL) | ||
197 | { | ||
198 | - Database->list = record->next; | ||
199 | + Database->list[slot] = record->next; | ||
200 | } | ||
201 | else | ||
202 | { | ||
203 | @@ -557,6 +576,7 @@ gckKERNEL_FindRecord( | ||
204 | gceSTATUS status; | ||
205 | gctBOOL acquired = gcvFALSE; | ||
206 | gcsDATABASE_RECORD_PTR record; | ||
207 | + gctUINT32 slot = _GetSlot(Database, Data); | ||
208 | |||
209 | gcmkHEADER_ARG("Kernel=0x%x Database=0x%x Type=%d Data=0x%x", | ||
210 | Kernel, Database, Type, Data); | ||
211 | @@ -567,7 +587,7 @@ gckKERNEL_FindRecord( | ||
212 | acquired = gcvTRUE; | ||
213 | |||
214 | /* Scan the database for this record. */ | ||
215 | - for (record = Database->list; | ||
216 | + for (record = Database->list[slot]; | ||
217 | record != gcvNULL; | ||
218 | record = record->next | ||
219 | ) | ||
220 | @@ -642,6 +662,7 @@ gckKERNEL_CreateProcessDB( | ||
221 | { | ||
222 | gceSTATUS status; | ||
223 | gcsDATABASE_PTR database = gcvNULL; | ||
224 | + gctUINT32 i; | ||
225 | |||
226 | gcmkHEADER_ARG("Kernel=0x%x ProcessID=%d", Kernel, ProcessID); | ||
227 | |||
228 | @@ -668,7 +689,11 @@ gckKERNEL_CreateProcessDB( | ||
229 | database->mapUserMemory.bytes = 0; | ||
230 | database->mapUserMemory.maxBytes = 0; | ||
231 | database->mapUserMemory.totalBytes = 0; | ||
232 | - database->list = gcvNULL; | ||
233 | + | ||
234 | + for (i = 0; i < gcmCOUNTOF(database->list); i++) | ||
235 | + { | ||
236 | + database->list[i] = gcvNULL; | ||
237 | + } | ||
238 | |||
239 | #if gcdSECURE_USER | ||
240 | { | ||
241 | @@ -848,7 +873,7 @@ gckKERNEL_AddProcessDB( | ||
242 | gcmkONERROR(gckKERNEL_FindDatabase(Kernel, ProcessID, gcvFALSE, &database)); | ||
243 | |||
244 | /* Create a new record in the database. */ | ||
245 | - gcmkONERROR(gckKERNEL_NewRecord(Kernel, database, &record)); | ||
246 | + gcmkONERROR(gckKERNEL_NewRecord(Kernel, database, _GetSlot(database, Pointer), &record)); | ||
247 | |||
248 | /* Initialize the record. */ | ||
249 | record->kernel = Kernel; | ||
250 | @@ -1086,6 +1111,7 @@ gckKERNEL_DestroyProcessDB( | ||
251 | gctPHYS_ADDR physical; | ||
252 | gcuVIDMEM_NODE_PTR node; | ||
253 | gckKERNEL kernel = Kernel; | ||
254 | + gctUINT32 i; | ||
255 | |||
256 | gcmkHEADER_ARG("Kernel=0x%x ProcessID=%d", Kernel, ProcessID); | ||
257 | |||
258 | @@ -1126,8 +1152,11 @@ gckKERNEL_DestroyProcessDB( | ||
259 | ProcessID); | ||
260 | } | ||
261 | |||
262 | + for(i = 0; i < gcmCOUNTOF(database->list); i++) | ||
263 | + { | ||
264 | + | ||
265 | /* Walk all records. */ | ||
266 | - for (record = database->list; record != gcvNULL; record = next) | ||
267 | + for (record = database->list[i]; record != gcvNULL; record = next) | ||
268 | { | ||
269 | /* Next next record. */ | ||
270 | next = record->next; | ||
271 | @@ -1293,6 +1322,8 @@ gckKERNEL_DestroyProcessDB( | ||
272 | gcvNULL)); | ||
273 | } | ||
274 | |||
275 | + } | ||
276 | + | ||
277 | /* Delete the database. */ | ||
278 | gcmkONERROR(gckKERNEL_DeleteDatabase(Kernel, database)); | ||
279 | |||
280 | 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 | ||
281 | index f78d096..217f7f1 100644 | ||
282 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c | ||
283 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_event.c | ||
284 | @@ -959,6 +959,8 @@ gckEVENT_AddList( | ||
285 | record->kernel = Event->kernel; | ||
286 | #endif | ||
287 | |||
288 | + gcmkONERROR(__RemoveRecordFromProcessDB(Event, record)); | ||
289 | + | ||
290 | /* Acquire the mutex. */ | ||
291 | gcmkONERROR(gckOS_AcquireMutex(Event->os, Event->eventListMutex, gcvINFINITE)); | ||
292 | acquired = gcvTRUE; | ||
293 | @@ -1539,9 +1541,6 @@ gckEVENT_Submit( | ||
294 | gcmkONERROR(gckOS_ReleaseMutex(Event->os, Event->eventListMutex)); | ||
295 | acquired = gcvFALSE; | ||
296 | |||
297 | - gcmkONERROR(__RemoveRecordFromProcessDB(Event, | ||
298 | - Event->queues[id].head)); | ||
299 | - | ||
300 | #if gcdNULL_DRIVER | ||
301 | /* Notify immediately on infinite hardware. */ | ||
302 | gcmkONERROR(gckEVENT_Interrupt(Event, 1 << id)); | ||
303 | 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 | ||
304 | index 0c71e28..43c9297 100644 | ||
305 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c | ||
306 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c | ||
307 | @@ -97,6 +97,43 @@ static gcsMirrorPageTable_PTR mirrorPageTable = gcvNULL; | ||
308 | static gctPOINTER mirrorPageTableMutex = gcvNULL; | ||
309 | #endif | ||
310 | |||
311 | +static void | ||
312 | +_WritePageEntry( | ||
313 | + IN gctUINT32_PTR PageEntry, | ||
314 | + IN gctUINT32 EntryValue | ||
315 | + ) | ||
316 | +{ | ||
317 | + static gctUINT16 data = 0xff00; | ||
318 | + | ||
319 | + if (*(gctUINT8 *)&data == 0xff) | ||
320 | + { | ||
321 | + *PageEntry = gcmSWAB32(EntryValue); | ||
322 | + } | ||
323 | + else | ||
324 | + { | ||
325 | + *PageEntry = EntryValue; | ||
326 | + } | ||
327 | +} | ||
328 | + | ||
329 | +static gctUINT32 | ||
330 | +_ReadPageEntry( | ||
331 | + IN gctUINT32_PTR PageEntry | ||
332 | + ) | ||
333 | +{ | ||
334 | + static gctUINT16 data = 0xff00; | ||
335 | + gctUINT32 entryValue; | ||
336 | + | ||
337 | + if (*(gctUINT8 *)&data == 0xff) | ||
338 | + { | ||
339 | + entryValue = *PageEntry; | ||
340 | + return gcmSWAB32(entryValue); | ||
341 | + } | ||
342 | + else | ||
343 | + { | ||
344 | + return *PageEntry; | ||
345 | + } | ||
346 | +} | ||
347 | + | ||
348 | static gceSTATUS | ||
349 | _FillPageTable( | ||
350 | IN gctUINT32_PTR PageTable, | ||
351 | @@ -108,7 +145,7 @@ _FillPageTable( | ||
352 | |||
353 | for (i = 0; i < PageCount; i++) | ||
354 | { | ||
355 | - PageTable[i] = EntryValue; | ||
356 | + _WritePageEntry(PageTable + i, EntryValue); | ||
357 | } | ||
358 | |||
359 | return gcvSTATUS_OK; | ||
360 | @@ -132,16 +169,16 @@ _Link( | ||
361 | gctUINT32_PTR pageTable = Mmu->pageTableLogical; | ||
362 | |||
363 | /* Dispatch on node type. */ | ||
364 | - switch (gcmENTRY_TYPE(pageTable[Index])) | ||
365 | + switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[Index]))) | ||
366 | { | ||
367 | case gcvMMU_SINGLE: | ||
368 | /* Set single index. */ | ||
369 | - pageTable[Index] = (Next << 8) | gcvMMU_SINGLE; | ||
370 | + _WritePageEntry(&pageTable[Index], (Next << 8) | gcvMMU_SINGLE); | ||
371 | break; | ||
372 | |||
373 | case gcvMMU_FREE: | ||
374 | /* Set index. */ | ||
375 | - pageTable[Index + 1] = Next; | ||
376 | + _WritePageEntry(&pageTable[Index + 1], Next); | ||
377 | break; | ||
378 | |||
379 | default: | ||
380 | @@ -167,13 +204,13 @@ _AddFree( | ||
381 | if (Count == 1) | ||
382 | { | ||
383 | /* Initialize a single page node. */ | ||
384 | - pageTable[Node] = (~((1U<<8)-1)) | gcvMMU_SINGLE; | ||
385 | + _WritePageEntry(pageTable + Node, (~((1U<<8)-1)) | gcvMMU_SINGLE); | ||
386 | } | ||
387 | else | ||
388 | { | ||
389 | /* Initialize the node. */ | ||
390 | - pageTable[Node + 0] = (Count << 8) | gcvMMU_FREE; | ||
391 | - pageTable[Node + 1] = ~0U; | ||
392 | + _WritePageEntry(pageTable + Node + 0, (Count << 8) | gcvMMU_FREE); | ||
393 | + _WritePageEntry(pageTable + Node + 1, ~0U); | ||
394 | } | ||
395 | |||
396 | /* Append the node. */ | ||
397 | @@ -196,7 +233,7 @@ _Collect( | ||
398 | for (i = 0; i < Mmu->pageTableEntries; ++i) | ||
399 | { | ||
400 | /* Dispatch based on type of page. */ | ||
401 | - switch (gcmENTRY_TYPE(pageTable[i])) | ||
402 | + switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[i]))) | ||
403 | { | ||
404 | case gcvMMU_USED: | ||
405 | /* Used page, so close any open node. */ | ||
406 | @@ -229,10 +266,10 @@ _Collect( | ||
407 | } | ||
408 | |||
409 | /* Advance the count. */ | ||
410 | - count += pageTable[i] >> 8; | ||
411 | + count += _ReadPageEntry(&pageTable[i]) >> 8; | ||
412 | |||
413 | /* Advance the index into the page table. */ | ||
414 | - i += (pageTable[i] >> 8) - 1; | ||
415 | + i += (_ReadPageEntry(&pageTable[i]) >> 8) - 1; | ||
416 | break; | ||
417 | |||
418 | default: | ||
419 | @@ -341,19 +378,20 @@ _FillFlatMapping( | ||
420 | gcmkONERROR(gcvSTATUS_NOT_ALIGNED); | ||
421 | } | ||
422 | |||
423 | - *(Mmu->mtlbLogical + mStart) | ||
424 | - = stlb->physBase | ||
425 | - /* 64KB page size */ | ||
426 | - | (1 << 2) | ||
427 | - /* Ignore exception */ | ||
428 | - | (0 << 1) | ||
429 | - /* Present */ | ||
430 | - | (1 << 0); | ||
431 | + _WritePageEntry(Mmu->mtlbLogical + mStart, | ||
432 | + stlb->physBase | ||
433 | + /* 64KB page size */ | ||
434 | + | (1 << 2) | ||
435 | + /* Ignore exception */ | ||
436 | + | (0 << 1) | ||
437 | + /* Present */ | ||
438 | + | (1 << 0) | ||
439 | + ); | ||
440 | #if gcdMMU_TABLE_DUMP | ||
441 | gckOS_Print("%s(%d): insert MTLB[%d]: %08x\n", | ||
442 | __FUNCTION__, __LINE__, | ||
443 | mStart, | ||
444 | - *(Mmu->mtlbLogical + mStart)); | ||
445 | + _ReadPageEntry(Mmu->mtlbLogical + mStart)); | ||
446 | #endif | ||
447 | |||
448 | stlb->mtlbIndex = mStart; | ||
449 | @@ -368,12 +406,12 @@ _FillFlatMapping( | ||
450 | while (sStart <= last) | ||
451 | { | ||
452 | gcmkASSERT(!(start & gcdMMU_PAGE_64K_MASK)); | ||
453 | - *(stlb->logical + sStart) = _SetPage(start); | ||
454 | + _WritePageEntry(stlb->logical + sStart, _SetPage(start)); | ||
455 | #if gcdMMU_TABLE_DUMP | ||
456 | gckOS_Print("%s(%d): insert STLB[%d]: %08x\n", | ||
457 | __FUNCTION__, __LINE__, | ||
458 | sStart, | ||
459 | - *(stlb->logical + sStart)); | ||
460 | + _ReadPageEntry(stlb->logical + sStart)); | ||
461 | #endif | ||
462 | /* next page. */ | ||
463 | start += gcdMMU_PAGE_64K_SIZE; | ||
464 | @@ -428,7 +466,7 @@ OnError: | ||
465 | if (pre->mtlbEntryNum != 0) | ||
466 | { | ||
467 | gcmkASSERT(pre->mtlbEntryNum == 1); | ||
468 | - *(Mmu->mtlbLogical + pre->mtlbIndex) = 0; | ||
469 | + _WritePageEntry(Mmu->mtlbLogical + pre->mtlbIndex, 0); | ||
470 | } | ||
471 | |||
472 | gcmkVERIFY_OK(gcmkOS_SAFE_FREE(Mmu->os, pre)); | ||
473 | @@ -493,8 +531,8 @@ _SetupDynamicSpace( | ||
474 | |||
475 | /* Initilization. */ | ||
476 | pageTable = Mmu->pageTableLogical; | ||
477 | - pageTable[0] = (Mmu->pageTableEntries << 8) | gcvMMU_FREE; | ||
478 | - pageTable[1] = ~0U; | ||
479 | + _WritePageEntry(pageTable, (Mmu->pageTableEntries << 8) | gcvMMU_FREE); | ||
480 | + _WritePageEntry(pageTable + 1, ~0U); | ||
481 | Mmu->heapList = 0; | ||
482 | Mmu->freeNodes = gcvFALSE; | ||
483 | |||
484 | @@ -509,18 +547,20 @@ _SetupDynamicSpace( | ||
485 | /* Map to Master TLB. */ | ||
486 | for (; i < gcdMMU_MTLB_ENTRY_NUM; i++) | ||
487 | { | ||
488 | - Mmu->mtlbLogical[i] = physical | ||
489 | - /* 4KB page size */ | ||
490 | - | (0 << 2) | ||
491 | - /* Ignore exception */ | ||
492 | - | (0 << 1) | ||
493 | - /* Present */ | ||
494 | - | (1 << 0); | ||
495 | + _WritePageEntry(Mmu->mtlbLogical + i, | ||
496 | + physical | ||
497 | + /* 4KB page size */ | ||
498 | + | (0 << 2) | ||
499 | + /* Ignore exception */ | ||
500 | + | (0 << 1) | ||
501 | + /* Present */ | ||
502 | + | (1 << 0) | ||
503 | + ); | ||
504 | #if gcdMMU_TABLE_DUMP | ||
505 | gckOS_Print("%s(%d): insert MTLB[%d]: %08x\n", | ||
506 | __FUNCTION__, __LINE__, | ||
507 | i, | ||
508 | - *(Mmu->mtlbLogical + i)); | ||
509 | + _ReadPageEntry(Mmu->mtlbLogical + i)); | ||
510 | #endif | ||
511 | physical += gcdMMU_STLB_4K_SIZE; | ||
512 | } | ||
513 | @@ -645,18 +685,11 @@ _Construct( | ||
514 | pageTable = mmu->pageTableLogical; | ||
515 | |||
516 | #if gcdMMU_CLEAR_VALUE | ||
517 | - { | ||
518 | - gctUINT32 i; | ||
519 | - | ||
520 | - for (i = 0; i < mmu->pageTableEntries; ++i) | ||
521 | - { | ||
522 | - pageTable[i] = gcdMMU_CLEAR_VALUE; | ||
523 | - } | ||
524 | - } | ||
525 | + _FillPageTable(pageTable, mmu->pageTableEntries, gcdMMU_CLEAR_VALUE); | ||
526 | #endif | ||
527 | |||
528 | - pageTable[0] = (mmu->pageTableEntries << 8) | gcvMMU_FREE; | ||
529 | - pageTable[1] = ~0U; | ||
530 | + _WritePageEntry(pageTable, (mmu->pageTableEntries << 8) | gcvMMU_FREE); | ||
531 | + _WritePageEntry(pageTable + 1, ~0U); | ||
532 | mmu->heapList = 0; | ||
533 | mmu->freeNodes = gcvFALSE; | ||
534 | |||
535 | @@ -797,7 +830,7 @@ _Destroy( | ||
536 | if (pre->mtlbEntryNum != 0) | ||
537 | { | ||
538 | gcmkASSERT(pre->mtlbEntryNum == 1); | ||
539 | - *(Mmu->mtlbLogical + pre->mtlbIndex) = 0; | ||
540 | + _WritePageEntry(Mmu->mtlbLogical + pre->mtlbIndex, 0); | ||
541 | #if gcdMMU_TABLE_DUMP | ||
542 | gckOS_Print("%s(%d): clean MTLB[%d]\n", | ||
543 | __FUNCTION__, __LINE__, | ||
544 | @@ -1044,7 +1077,7 @@ _AllocatePages( | ||
545 | for (index = Mmu->heapList; !gotIt && (index < Mmu->pageTableEntries);) | ||
546 | { | ||
547 | /* Check the node type. */ | ||
548 | - switch (gcmENTRY_TYPE(pageTable[index])) | ||
549 | + switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[index]))) | ||
550 | { | ||
551 | case gcvMMU_SINGLE: | ||
552 | /* Single odes are valid if we only need 1 page. */ | ||
553 | @@ -1056,13 +1089,13 @@ _AllocatePages( | ||
554 | { | ||
555 | /* Move to next node. */ | ||
556 | previous = index; | ||
557 | - index = pageTable[index] >> 8; | ||
558 | + index = _ReadPageEntry(&pageTable[index]) >> 8; | ||
559 | } | ||
560 | break; | ||
561 | |||
562 | case gcvMMU_FREE: | ||
563 | /* Test if the node has enough space. */ | ||
564 | - if (PageCount <= (pageTable[index] >> 8)) | ||
565 | + if (PageCount <= (_ReadPageEntry(&pageTable[index]) >> 8)) | ||
566 | { | ||
567 | gotIt = gcvTRUE; | ||
568 | } | ||
569 | @@ -1070,7 +1103,7 @@ _AllocatePages( | ||
570 | { | ||
571 | /* Move to next node. */ | ||
572 | previous = index; | ||
573 | - index = pageTable[index + 1]; | ||
574 | + index = _ReadPageEntry(&pageTable[index + 1]); | ||
575 | } | ||
576 | break; | ||
577 | |||
578 | @@ -1099,36 +1132,36 @@ _AllocatePages( | ||
579 | } | ||
580 | } | ||
581 | |||
582 | - switch (gcmENTRY_TYPE(pageTable[index])) | ||
583 | + switch (gcmENTRY_TYPE(_ReadPageEntry(&pageTable[index]))) | ||
584 | { | ||
585 | case gcvMMU_SINGLE: | ||
586 | /* Unlink single node from free list. */ | ||
587 | gcmkONERROR( | ||
588 | - _Link(Mmu, previous, pageTable[index] >> 8)); | ||
589 | + _Link(Mmu, previous, _ReadPageEntry(&pageTable[index]) >> 8)); | ||
590 | break; | ||
591 | |||
592 | case gcvMMU_FREE: | ||
593 | /* Check how many pages will be left. */ | ||
594 | - left = (pageTable[index] >> 8) - PageCount; | ||
595 | + left = (_ReadPageEntry(&pageTable[index]) >> 8) - PageCount; | ||
596 | switch (left) | ||
597 | { | ||
598 | case 0: | ||
599 | /* The entire node is consumed, just unlink it. */ | ||
600 | gcmkONERROR( | ||
601 | - _Link(Mmu, previous, pageTable[index + 1])); | ||
602 | + _Link(Mmu, previous, _ReadPageEntry(&pageTable[index + 1]))); | ||
603 | break; | ||
604 | |||
605 | case 1: | ||
606 | /* One page will remain. Convert the node to a single node and | ||
607 | ** advance the index. */ | ||
608 | - pageTable[index] = (pageTable[index + 1] << 8) | gcvMMU_SINGLE; | ||
609 | + _WritePageEntry(&pageTable[index], (_ReadPageEntry(&pageTable[index + 1]) << 8) | gcvMMU_SINGLE); | ||
610 | index ++; | ||
611 | break; | ||
612 | |||
613 | default: | ||
614 | /* Enough pages remain for a new node. However, we will just adjust | ||
615 | ** the size of the current node and advance the index. */ | ||
616 | - pageTable[index] = (left << 8) | gcvMMU_FREE; | ||
617 | + _WritePageEntry(&pageTable[index], (left << 8) | gcvMMU_FREE); | ||
618 | index += left; | ||
619 | break; | ||
620 | } | ||
621 | @@ -1232,35 +1265,32 @@ _FreePages( | ||
622 | #if gcdMMU_CLEAR_VALUE | ||
623 | if (Mmu->hardware->mmuVersion == 0) | ||
624 | { | ||
625 | - gctUINT32 i; | ||
626 | - | ||
627 | - for (i = 0; i < PageCount; ++i) | ||
628 | - { | ||
629 | - pageTable[i] = gcdMMU_CLEAR_VALUE; | ||
630 | - } | ||
631 | + _FillPageTable(pageTable, PageCount, gcdMMU_CLEAR_VALUE); | ||
632 | } | ||
633 | #endif | ||
634 | |||
635 | if (PageCount == 1) | ||
636 | { | ||
637 | /* Single page node. */ | ||
638 | - pageTable[0] = (~((1U<<8)-1)) | gcvMMU_SINGLE | ||
639 | + _WritePageEntry(pageTable, | ||
640 | + (~((1U<<8)-1)) | gcvMMU_SINGLE | ||
641 | #if gcdUSE_MMU_EXCEPTION | ||
642 | - /* Enable exception */ | ||
643 | - | (1 << 1) | ||
644 | + /* Enable exception */ | ||
645 | + | 1 << 1 | ||
646 | #endif | ||
647 | - ; | ||
648 | + ); | ||
649 | } | ||
650 | else | ||
651 | { | ||
652 | /* Mark the node as free. */ | ||
653 | - pageTable[0] = (PageCount << 8) | gcvMMU_FREE | ||
654 | + _WritePageEntry(pageTable, | ||
655 | + (PageCount << 8) | gcvMMU_FREE | ||
656 | #if gcdUSE_MMU_EXCEPTION | ||
657 | - /* Enable exception */ | ||
658 | - | (1 << 1) | ||
659 | + /* Enable exception */ | ||
660 | + | 1 << 1 | ||
661 | #endif | ||
662 | - ; | ||
663 | - pageTable[1] = ~0U; | ||
664 | + ); | ||
665 | + _WritePageEntry(pageTable + 1, ~0U); | ||
666 | |||
667 | #if gcdUSE_MMU_EXCEPTION | ||
668 | /* Enable exception */ | ||
669 | @@ -1509,12 +1539,8 @@ gckMMU_SetPage( | ||
670 | data = _SetPage(PageAddress); | ||
671 | } | ||
672 | |||
673 | - if (Mmu->hardware->bigEndian) | ||
674 | - { | ||
675 | - data = gcmSWAB32(data); | ||
676 | - } | ||
677 | + _WritePageEntry(PageEntry, data); | ||
678 | |||
679 | - *PageEntry = data; | ||
680 | #if gcdMIRROR_PAGETABLE | ||
681 | for (i = 0; i < mirrorPageTable->reference; i++) | ||
682 | { | ||
683 | @@ -1526,11 +1552,11 @@ gckMMU_SetPage( | ||
684 | |||
685 | if (mmu->hardware->mmuVersion == 0) | ||
686 | { | ||
687 | - *pageEntry = PageAddress; | ||
688 | + _WritePageEntry(pageEntry, PageAddress); | ||
689 | } | ||
690 | else | ||
691 | { | ||
692 | - *pageEntry = _SetPage(PageAddress); | ||
693 | + _WritePageEntry(pageEntry, _SetPage(PageAddress)); | ||
694 | } | ||
695 | } | ||
696 | |||
697 | @@ -1734,7 +1760,7 @@ gckMMU_DumpPageTableEntry( | ||
698 | * gcdMMU_STLB_4K_ENTRY_NUM | ||
699 | + stlb; | ||
700 | |||
701 | - gcmkPRINT(" Page table entry = 0x%08X", pageTable[index]); | ||
702 | + gcmkPRINT(" Page table entry = 0x%08X", _ReadPageEntry(pageTable + index)); | ||
703 | } | ||
704 | |||
705 | gcmkFOOTER_NO(); | ||
706 | 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 | ||
707 | index d49aa64..8a442a2 100644 | ||
708 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c | ||
709 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c | ||
710 | @@ -1027,7 +1027,8 @@ gckVIDMEM_AllocateLinear( | ||
711 | ) | ||
712 | { | ||
713 | /* The left memory is for small memory.*/ | ||
714 | - gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | ||
715 | + status = gcvSTATUS_OUT_OF_MEMORY; | ||
716 | + goto OnError; | ||
717 | } | ||
718 | #endif | ||
719 | |||
720 | 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 | ||
721 | index 496276e..06eea79 100644 | ||
722 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h | ||
723 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_eglplatform.h | ||
724 | @@ -227,7 +227,8 @@ gcoOS_GetDisplayInfoEx( | ||
725 | ); | ||
726 | |||
727 | gceSTATUS | ||
728 | -gcoOS_GetNextDisplayInfoEx( | ||
729 | +gcoOS_GetNextDisplayInfoExByIndex( | ||
730 | + IN gctINT Index, | ||
731 | IN HALNativeDisplayType Display, | ||
732 | IN HALNativeWindowType Window, | ||
733 | IN gctUINT DisplayInfoSize, | ||
734 | @@ -274,15 +275,15 @@ gcoOS_SetDisplayVirtualEx( | ||
735 | |||
736 | gceSTATUS | ||
737 | gcoOS_SetSwapInterval( | ||
738 | - IN HALNativeDisplayType Display, | ||
739 | - IN gctINT Interval | ||
740 | + IN HALNativeDisplayType Display, | ||
741 | + IN gctINT Interval | ||
742 | ); | ||
743 | |||
744 | gceSTATUS | ||
745 | gcoOS_GetSwapInterval( | ||
746 | - IN HALNativeDisplayType Display, | ||
747 | - IN gctINT_PTR Min, | ||
748 | - IN gctINT_PTR Max | ||
749 | + IN HALNativeDisplayType Display, | ||
750 | + IN gctINT_PTR Min, | ||
751 | + IN gctINT_PTR Max | ||
752 | ); | ||
753 | |||
754 | gceSTATUS | ||
755 | 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 | ||
756 | index d441d1d..249b61b 100644 | ||
757 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h | ||
758 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h | ||
759 | @@ -1430,6 +1430,16 @@ typedef enum _gceTEXTURE_FACE | ||
760 | } | ||
761 | gceTEXTURE_FACE; | ||
762 | |||
763 | +#if gcdFORCE_MIPMAP | ||
764 | +typedef enum | ||
765 | +{ | ||
766 | + gcvForceMipDisabled = 0, | ||
767 | + gcvForceMipEnable = 1, | ||
768 | + gcvForceMipGenerated = 2, | ||
769 | + gcvForceMipNever = 3, | ||
770 | +}gceFORCE_MIPMAP; | ||
771 | +#endif | ||
772 | + | ||
773 | typedef struct _gcsTEXTURE | ||
774 | { | ||
775 | /* Addressing modes. */ | ||
776 | @@ -1446,6 +1456,10 @@ typedef struct _gcsTEXTURE | ||
777 | gceTEXTURE_FILTER mipFilter; | ||
778 | gctUINT anisoFilter; | ||
779 | gctBOOL forceTopLevel; | ||
780 | + gctBOOL autoMipmap; | ||
781 | +#if gcdFORCE_MIPMAP | ||
782 | + gceFORCE_MIPMAP forceMipmap; | ||
783 | +#endif | ||
784 | /* Level of detail. */ | ||
785 | gctFIXED_POINT lodBias; | ||
786 | gctFIXED_POINT lodMin; | ||
787 | @@ -1479,7 +1493,18 @@ gceSTATUS | ||
788 | gcoTEXTURE_Destroy( | ||
789 | IN gcoTEXTURE Texture | ||
790 | ); | ||
791 | +#if gcdFORCE_MIPMAP | ||
792 | +gceSTATUS | ||
793 | +gcoTEXTURE_DestroyForceMipmap( | ||
794 | + IN gcoTEXTURE Texture | ||
795 | + ); | ||
796 | |||
797 | +gceSTATUS | ||
798 | +gcoTEXTURE_GetMipLevels( | ||
799 | + IN gcoTEXTURE Texture, | ||
800 | + OUT gctINT * levels | ||
801 | + ); | ||
802 | +#endif | ||
803 | /* Replace a mipmap in gcoTEXTURE object. */ | ||
804 | gceSTATUS | ||
805 | gcoTEXTURE_ReplaceMipMap( | ||
806 | 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 | ||
807 | index 86e9133..afe83d0 100644 | ||
808 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | ||
809 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | ||
810 | @@ -114,6 +114,30 @@ | ||
811 | #define COMMAND_PROCESSOR_VERSION 1 | ||
812 | |||
813 | /* | ||
814 | + gcdDUMP_KEY | ||
815 | + | ||
816 | + Set this to a string that appears in 'cat /proc/<pid>/cmdline'. E.g. 'camera'. | ||
817 | + HAL will create dumps for the processes matching this key. | ||
818 | +*/ | ||
819 | +#ifndef gcdDUMP_KEY | ||
820 | +# define gcdDUMP_KEY "process" | ||
821 | +#endif | ||
822 | + | ||
823 | +/* | ||
824 | + gcdDUMP_PATH | ||
825 | + | ||
826 | + The dump file location. Some processes cannot write to the sdcard. | ||
827 | + Try apps' data dir, e.g. /data/data/com.android.launcher | ||
828 | +*/ | ||
829 | +#ifndef gcdDUMP_PATH | ||
830 | +#if defined(ANDROID) | ||
831 | +# define gcdDUMP_PATH "/mnt/sdcard/" | ||
832 | +#else | ||
833 | +# define gcdDUMP_PATH "./" | ||
834 | +#endif | ||
835 | +#endif | ||
836 | + | ||
837 | +/* | ||
838 | gcdDUMP | ||
839 | |||
840 | When set to 1, a dump of all states and memory uploads, as well as other | ||
841 | @@ -342,6 +366,17 @@ | ||
842 | #endif | ||
843 | |||
844 | /* | ||
845 | + gcdUSER_HEAP_ALLOCATOR | ||
846 | + | ||
847 | + Set to 1 to enable user mode heap allocator for fast memory allocation | ||
848 | + and destroying. Otherwise, memory allocation/destroying in user mode | ||
849 | + will be directly managed by system. Only for linux for now. | ||
850 | +*/ | ||
851 | +#ifndef gcdUSER_HEAP_ALLOCATOR | ||
852 | +# define gcdUSER_HEAP_ALLOCATOR 1 | ||
853 | +#endif | ||
854 | + | ||
855 | +/* | ||
856 | gcdHEAP_SIZE | ||
857 | |||
858 | Set the allocation size for the internal heaps. Each time a heap is | ||
859 | 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 | ||
860 | index 2881604..808fde0 100644 | ||
861 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h | ||
862 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h | ||
863 | @@ -28,7 +28,7 @@ | ||
864 | |||
865 | #define gcvVERSION_PATCH 9 | ||
866 | |||
867 | -#define gcvVERSION_BUILD 1210 | ||
868 | +#define gcvVERSION_BUILD 4651 | ||
869 | |||
870 | #define gcvVERSION_DATE __DATE__ | ||
871 | |||
872 | 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 | ||
873 | index 4e3819c..2ed3d0e 100644 | ||
874 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | ||
875 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | ||
876 | @@ -663,7 +663,7 @@ static int drv_mmap( | ||
877 | |||
878 | #if !gcdPAGED_MEMORY_CACHEABLE | ||
879 | vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); | ||
880 | - vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND; | ||
881 | + vma->vm_flags |= gcdVM_FLAGS; | ||
882 | #endif | ||
883 | vma->vm_pgoff = 0; | ||
884 | |||
885 | 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 | ||
886 | index 9c0bcd5..3c148f6 100644 | ||
887 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h | ||
888 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h | ||
889 | @@ -73,6 +73,12 @@ | ||
890 | |||
891 | #define GetPageCount(size, offset) ((((size) + ((offset) & ~PAGE_CACHE_MASK)) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT) | ||
892 | |||
893 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION (3,7,0) | ||
894 | +#define gcdVM_FLAGS (VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_DONTDUMP) | ||
895 | +#else | ||
896 | +#define gcdVM_FLAGS (VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED) | ||
897 | +#endif | ||
898 | + | ||
899 | static inline gctINT | ||
900 | GetOrder( | ||
901 | IN gctINT numPages | ||
902 | 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 | ||
903 | index c07ded8..9c2bae6 100644 | ||
904 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | ||
905 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | ||
906 | @@ -869,6 +869,60 @@ _UnmapUserLogical( | ||
907 | #endif | ||
908 | } | ||
909 | |||
910 | +gceSTATUS | ||
911 | +_QueryProcessPageTable( | ||
912 | + IN gctPOINTER Logical, | ||
913 | + OUT gctUINT32 * Address | ||
914 | + ) | ||
915 | +{ | ||
916 | + spinlock_t *lock; | ||
917 | + gctUINTPTR_T logical = (gctUINTPTR_T)Logical; | ||
918 | + pgd_t *pgd; | ||
919 | + pud_t *pud; | ||
920 | + pmd_t *pmd; | ||
921 | + pte_t *pte; | ||
922 | + | ||
923 | + if (!current->mm) | ||
924 | + { | ||
925 | + return gcvSTATUS_NOT_FOUND; | ||
926 | + } | ||
927 | + | ||
928 | + pgd = pgd_offset(current->mm, logical); | ||
929 | + if (pgd_none(*pgd) || pgd_bad(*pgd)) | ||
930 | + { | ||
931 | + return gcvSTATUS_NOT_FOUND; | ||
932 | + } | ||
933 | + | ||
934 | + pud = pud_offset(pgd, logical); | ||
935 | + if (pud_none(*pud) || pud_bad(*pud)) | ||
936 | + { | ||
937 | + return gcvSTATUS_NOT_FOUND; | ||
938 | + } | ||
939 | + | ||
940 | + pmd = pmd_offset(pud, logical); | ||
941 | + if (pmd_none(*pmd) || pmd_bad(*pmd)) | ||
942 | + { | ||
943 | + return gcvSTATUS_NOT_FOUND; | ||
944 | + } | ||
945 | + | ||
946 | + pte = pte_offset_map_lock(current->mm, pmd, logical, &lock); | ||
947 | + if (!pte) | ||
948 | + { | ||
949 | + return gcvSTATUS_NOT_FOUND; | ||
950 | + } | ||
951 | + | ||
952 | + if (!pte_present(*pte)) | ||
953 | + { | ||
954 | + pte_unmap_unlock(pte, lock); | ||
955 | + return gcvSTATUS_NOT_FOUND; | ||
956 | + } | ||
957 | + | ||
958 | + *Address = (pte_pfn(*pte) << PAGE_SHIFT) | (logical & ~PAGE_MASK); | ||
959 | + pte_unmap_unlock(pte, lock); | ||
960 | + | ||
961 | + return gcvSTATUS_OK; | ||
962 | +} | ||
963 | + | ||
964 | /******************************************************************************* | ||
965 | ** | ||
966 | ** gckOS_Construct | ||
967 | @@ -1106,6 +1160,9 @@ _CreateKernelVirtualMapping( | ||
968 | numPages, | ||
969 | 0, | ||
970 | PAGE_KERNEL); | ||
971 | + | ||
972 | + /* Trigger a page fault. */ | ||
973 | + memset(addr, 0, numPages * PAGE_SIZE); | ||
974 | } | ||
975 | #else | ||
976 | struct page ** pages; | ||
977 | @@ -1136,6 +1193,9 @@ _CreateKernelVirtualMapping( | ||
978 | /* ioremap() can't work on system memory since 2.6.38. */ | ||
979 | addr = vmap(pages, numPages, 0, gcmkNONPAGED_MEMROY_PROT(PAGE_KERNEL)); | ||
980 | |||
981 | + /* Trigger a page fault. */ | ||
982 | + memset(addr, 0, numPages * PAGE_SIZE); | ||
983 | + | ||
984 | if (free) | ||
985 | { | ||
986 | kfree(pages); | ||
987 | @@ -1540,7 +1600,7 @@ gckOS_MapMemory( | ||
988 | #else | ||
989 | #if !gcdPAGED_MEMORY_CACHEABLE | ||
990 | mdlMap->vma->vm_page_prot = gcmkPAGED_MEMROY_PROT(mdlMap->vma->vm_page_prot); | ||
991 | - mdlMap->vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED; | ||
992 | + mdlMap->vma->vm_flags |= gcdVM_FLAGS; | ||
993 | # endif | ||
994 | mdlMap->vma->vm_pgoff = 0; | ||
995 | |||
996 | @@ -1987,7 +2047,7 @@ gckOS_AllocateNonPagedMemory( | ||
997 | } | ||
998 | #else | ||
999 | mdlMap->vma->vm_page_prot = gcmkNONPAGED_MEMROY_PROT(mdlMap->vma->vm_page_prot); | ||
1000 | - mdlMap->vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_RESERVED; | ||
1001 | + mdlMap->vma->vm_flags |= gcdVM_FLAGS; | ||
1002 | mdlMap->vma->vm_pgoff = 0; | ||
1003 | |||
1004 | if (remap_pfn_range(mdlMap->vma, | ||
1005 | @@ -2367,12 +2427,18 @@ gckOS_GetPhysicalAddress( | ||
1006 | gcmkVERIFY_OBJECT(Os, gcvOBJ_OS); | ||
1007 | gcmkVERIFY_ARGUMENT(Address != gcvNULL); | ||
1008 | |||
1009 | - /* Get current process ID. */ | ||
1010 | - processID = _GetProcessID(); | ||
1011 | + /* Query page table of current process first. */ | ||
1012 | + status = _QueryProcessPageTable(Logical, Address); | ||
1013 | |||
1014 | - /* Route through other function. */ | ||
1015 | - gcmkONERROR( | ||
1016 | - gckOS_GetPhysicalAddressProcess(Os, Logical, processID, Address)); | ||
1017 | + if (gcmIS_ERROR(status)) | ||
1018 | + { | ||
1019 | + /* Get current process ID. */ | ||
1020 | + processID = _GetProcessID(); | ||
1021 | + | ||
1022 | + /* Route through other function. */ | ||
1023 | + gcmkONERROR( | ||
1024 | + gckOS_GetPhysicalAddressProcess(Os, Logical, processID, Address)); | ||
1025 | + } | ||
1026 | |||
1027 | /* Success. */ | ||
1028 | gcmkFOOTER_ARG("*Address=0x%08x", *Address); | ||
1029 | @@ -4139,7 +4205,7 @@ gckOS_LockPages( | ||
1030 | return gcvSTATUS_OUT_OF_RESOURCES; | ||
1031 | } | ||
1032 | |||
1033 | - mdlMap->vma->vm_flags |= VM_RESERVED; | ||
1034 | + mdlMap->vma->vm_flags |= gcdVM_FLAGS; | ||
1035 | #if !gcdPAGED_MEMORY_CACHEABLE | ||
1036 | if (Cacheable == gcvFALSE) | ||
1037 | { | ||
1038 | -- | ||
1039 | 1.8.3.2 | ||
1040 | |||
diff --git a/recipes-kernel/linux/linux-wandboard-3.0.35/0002-ENGR00265465-gpu-Add-global-value-for-minimum-3D-clo.patch b/recipes-kernel/linux/linux-wandboard-3.0.35/0002-ENGR00265465-gpu-Add-global-value-for-minimum-3D-clo.patch new file mode 100644 index 0000000..5725ab7 --- /dev/null +++ b/recipes-kernel/linux/linux-wandboard-3.0.35/0002-ENGR00265465-gpu-Add-global-value-for-minimum-3D-clo.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From 2df4dba8faa9a781a5a1c6c09d646d2b692c9a0c Mon Sep 17 00:00:00 2001 | ||
2 | From: Loren Huang <b02279@freescale.com> | ||
3 | Date: Tue, 4 Jun 2013 15:08:15 +0800 | ||
4 | Subject: [PATCH 2/6] ENGR00265465 gpu:Add global value for minimum 3D clock | ||
5 | export | ||
6 | |||
7 | Add global value gpu3DMinClock so that minimum 3D clock can be change by user. | ||
8 | When gpu min clock is too low, it may cause IPU starvation issue in certain case. | ||
9 | Use echo x > /sys/module/galcore/parameters/gpu3DMinClock to change it. | ||
10 | |||
11 | Cherry-pick from 3.0.35 branch. | ||
12 | |||
13 | Upstream-Status: Backport [3.5.7-1.0.0] | ||
14 | |||
15 | Signed-off-by: Loren Huang <b02279@freescale.com> | ||
16 | Acked-by: Lily Zhang | ||
17 | --- | ||
18 | drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | 6 +++++- | ||
19 | drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | 3 +++ | ||
20 | 2 files changed, 8 insertions(+), 1 deletion(-) | ||
21 | |||
22 | 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 | ||
23 | index 3829999..ebd36fe 100644 | ||
24 | --- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | ||
25 | +++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | ||
26 | @@ -36,6 +36,7 @@ typedef struct _gcsiDEBUG_REGISTERS | ||
27 | } | ||
28 | gcsiDEBUG_REGISTERS; | ||
29 | |||
30 | +extern int gpu3DMinClock; | ||
31 | /******************************************************************************\ | ||
32 | ********************************* Support Code ********************************* | ||
33 | \******************************************************************************/ | ||
34 | @@ -4630,7 +4631,10 @@ gckHARDWARE_GetFscaleValue( | ||
35 | ) | ||
36 | { | ||
37 | *FscaleValue = Hardware->powerOnFscaleVal; | ||
38 | - *MinFscaleValue = 1; | ||
39 | + if ((gpu3DMinClock > 0) && (gpu3DMinClock <= 64) && (Hardware->core == gcvCORE_MAJOR)) | ||
40 | + *MinFscaleValue = gpu3DMinClock; | ||
41 | + else | ||
42 | + *MinFscaleValue = 1; | ||
43 | *MaxFscaleValue = 64; | ||
44 | |||
45 | return gcvSTATUS_OK; | ||
46 | 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 | ||
47 | index 2ed3d0e..64cace1 100644 | ||
48 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | ||
49 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | ||
50 | @@ -146,6 +146,9 @@ module_param(logFileSize,uint, 0644); | ||
51 | static int showArgs = 0; | ||
52 | module_param(showArgs, int, 0644); | ||
53 | |||
54 | +int gpu3DMinClock = 0; | ||
55 | +module_param(gpu3DMinClock, int, 0644); | ||
56 | + | ||
57 | #if ENABLE_GPU_CLOCK_BY_DRIVER | ||
58 | unsigned long coreClock = 156000000; | ||
59 | module_param(coreClock, ulong, 0644); | ||
60 | -- | ||
61 | 1.8.3.2 | ||
62 | |||
diff --git a/recipes-kernel/linux/linux-wandboard-3.0.35/0003-ENGR00261814-4-gpu-use-new-PU-power-on-off-interface.patch b/recipes-kernel/linux/linux-wandboard-3.0.35/0003-ENGR00261814-4-gpu-use-new-PU-power-on-off-interface.patch new file mode 100644 index 0000000..23a415d --- /dev/null +++ b/recipes-kernel/linux/linux-wandboard-3.0.35/0003-ENGR00261814-4-gpu-use-new-PU-power-on-off-interface.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 1579de9397783ab5321c80f1e76661653ef38ccd Mon Sep 17 00:00:00 2001 | ||
2 | From: Robin Gong <b38343@freescale.com> | ||
3 | Date: Thu, 9 May 2013 11:45:55 +0800 | ||
4 | Subject: [PATCH 3/6] ENGR00261814-4 gpu: use new PU power on/off interface | ||
5 | |||
6 | use new PU power on/off interface in GPU driver | ||
7 | |||
8 | Upstream-Status: Backport [3.5.7-1.0.0] | ||
9 | |||
10 | Signed-off-by: Robin Gong <b38343@freescale.com> | ||
11 | Acked-by: Lily Zhang | ||
12 | --- | ||
13 | .../mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | 16 +++++++++++++--- | ||
14 | 1 file changed, 13 insertions(+), 3 deletions(-) | ||
15 | |||
16 | 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 | ||
17 | index 9c2bae6..dfbc699 100644 | ||
18 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | ||
19 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | ||
20 | @@ -6819,8 +6819,13 @@ gckOS_SetGPUPower( | ||
21 | } | ||
22 | if((Power == gcvTRUE) && (oldPowerState == gcvFALSE)) | ||
23 | { | ||
24 | - if(!IS_ERR(Os->device->gpu_regulator)) | ||
25 | - regulator_enable(Os->device->gpu_regulator); | ||
26 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) | ||
27 | + if(!IS_ERR(Os->device->gpu_regulator)) | ||
28 | + regulator_enable(Os->device->gpu_regulator); | ||
29 | +#else | ||
30 | + imx_gpc_power_up_pu(true); | ||
31 | +#endif | ||
32 | + | ||
33 | #ifdef CONFIG_PM | ||
34 | pm_runtime_get_sync(Os->device->pmdev); | ||
35 | #endif | ||
36 | @@ -6930,8 +6935,13 @@ gckOS_SetGPUPower( | ||
37 | #ifdef CONFIG_PM | ||
38 | pm_runtime_put_sync(Os->device->pmdev); | ||
39 | #endif | ||
40 | + | ||
41 | +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) | ||
42 | if(!IS_ERR(Os->device->gpu_regulator)) | ||
43 | - regulator_disable(Os->device->gpu_regulator); | ||
44 | + regulator_disable(Os->device->gpu_regulator); | ||
45 | +#else | ||
46 | + imx_gpc_power_up_pu(false); | ||
47 | +#endif | ||
48 | } | ||
49 | /* TODO: Put your code here. */ | ||
50 | gcmkFOOTER_NO(); | ||
51 | -- | ||
52 | 1.8.3.2 | ||
53 | |||
diff --git a/recipes-kernel/linux/linux-wandboard-3.0.35/0004-ENGR00264288-1-GPU-Integrate-4.6.9p12-release-kernel.patch b/recipes-kernel/linux/linux-wandboard-3.0.35/0004-ENGR00264288-1-GPU-Integrate-4.6.9p12-release-kernel.patch new file mode 100644 index 0000000..08ca88a --- /dev/null +++ b/recipes-kernel/linux/linux-wandboard-3.0.35/0004-ENGR00264288-1-GPU-Integrate-4.6.9p12-release-kernel.patch | |||
@@ -0,0 +1,2006 @@ | |||
1 | From c090a0238315094d245de2503b6f9a5bce0bda03 Mon Sep 17 00:00:00 2001 | ||
2 | From: Loren Huang <b02279@freescale.com> | ||
3 | Date: Mon, 27 May 2013 17:45:48 +0800 | ||
4 | Subject: [PATCH 4/6] ENGR00264288-1 [GPU]Integrate 4.6.9p12 release kernel | ||
5 | part code | ||
6 | |||
7 | Integrate 4.6.9p12 release kernel part code. | ||
8 | Cherry-pick from 3.0.35 branch. | ||
9 | |||
10 | Upstream-Status: Backport [3.5.7-1.0.0] | ||
11 | |||
12 | Signed-off-by: Loren Huang <b02279@freescale.com> | ||
13 | Acked-by: Lily Zhang | ||
14 | --- | ||
15 | .../GC350/hal/kernel/gc_hal_kernel_hardware_vg.c | 63 +++- | ||
16 | .../GC350/hal/kernel/gc_hal_kernel_hardware_vg.h | 2 + | ||
17 | .../arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | 174 ++++++++--- | ||
18 | .../arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h | 2 + | ||
19 | drivers/mxc/gpu-viv/config | 1 - | ||
20 | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c | 329 +++++++-------------- | ||
21 | .../mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c | 6 +- | ||
22 | .../gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c | 14 +- | ||
23 | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | 6 +- | ||
24 | drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c | 119 +++++++- | ||
25 | .../hal/kernel/gc_hal_kernel_video_memory.c | 3 + | ||
26 | drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h | 6 + | ||
27 | drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h | 34 +-- | ||
28 | .../mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h | 20 +- | ||
29 | drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h | 35 ++- | ||
30 | drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h | 62 +--- | ||
31 | drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h | 7 - | ||
32 | .../mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | 31 +- | ||
33 | .../mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h | 2 +- | ||
34 | drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h | 6 + | ||
35 | .../hal/os/linux/kernel/gc_hal_kernel_device.c | 13 + | ||
36 | .../hal/os/linux/kernel/gc_hal_kernel_device.h | 1 + | ||
37 | .../hal/os/linux/kernel/gc_hal_kernel_driver.c | 10 +- | ||
38 | .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | 74 +++-- | ||
39 | .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h | 3 + | ||
40 | 25 files changed, 574 insertions(+), 449 deletions(-) | ||
41 | |||
42 | 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 | ||
43 | index 4a6010d..70c2cd6 100644 | ||
44 | --- a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c | ||
45 | +++ b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.c | ||
46 | @@ -217,7 +217,6 @@ _IdentifyHardware( | ||
47 | return status; | ||
48 | } | ||
49 | |||
50 | -#if gcdPOWER_MANAGEMENT | ||
51 | static gctTHREADFUNCRESULT gctTHREADFUNCTYPE | ||
52 | _TimeIdleThread( | ||
53 | gctTHREADFUNCPARAMETER ThreadParameter | ||
54 | @@ -262,8 +261,6 @@ _TimeIdleThread( | ||
55 | } | ||
56 | return 0; | ||
57 | } | ||
58 | -#endif | ||
59 | - | ||
60 | |||
61 | /******************************************************************************\ | ||
62 | ****************************** gckVGHARDWARE API code ***************************** | ||
63 | @@ -309,6 +306,7 @@ gckVGHARDWARE_Construct( | ||
64 | do | ||
65 | { | ||
66 | gcmkERR_BREAK(gckOS_SetGPUPower(Os, gcvCORE_VG, gcvTRUE, gcvTRUE)); | ||
67 | + | ||
68 | status = _ResetGPU(Os); | ||
69 | |||
70 | if (status != gcvSTATUS_OK) | ||
71 | @@ -368,14 +366,17 @@ gckVGHARDWARE_Construct( | ||
72 | |||
73 | gcmkERR_BREAK(gckOS_CreateMutex(Os, &hardware->powerMutex)); | ||
74 | gcmkERR_BREAK(gckOS_CreateSignal(Os, gcvFALSE, &hardware->idleSignal)); | ||
75 | -#if gcdPOWER_MANAGEMENT | ||
76 | + | ||
77 | + /* Enable power management by default. */ | ||
78 | + hardware->powerManagement = gcvTRUE; | ||
79 | + | ||
80 | gcmkERR_BREAK(gckOS_StartThread( | ||
81 | hardware->os, | ||
82 | _TimeIdleThread, | ||
83 | hardware, | ||
84 | &hardware->timeIdleThread | ||
85 | )); | ||
86 | -#endif | ||
87 | + | ||
88 | /* Return pointer to the gckVGHARDWARE object. */ | ||
89 | *Hardware = hardware; | ||
90 | |||
91 | @@ -395,6 +396,8 @@ gckVGHARDWARE_Construct( | ||
92 | gcmkVERIFY_OK(gckOS_Free(Os, hardware)); | ||
93 | } | ||
94 | |||
95 | + gcmkVERIFY_OK(gckOS_SetGPUPower(Os, gcvCORE_VG, gcvFALSE, gcvFALSE)); | ||
96 | + | ||
97 | gcmkFOOTER(); | ||
98 | /* Return the status. */ | ||
99 | return status; | ||
100 | @@ -425,11 +428,10 @@ gckVGHARDWARE_Destroy( | ||
101 | /* Verify the arguments. */ | ||
102 | gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); | ||
103 | |||
104 | -#if gcdPOWER_MANAGEMENT | ||
105 | Hardware->killThread = gcvTRUE; | ||
106 | gcmkVERIFY_OK(gckOS_Signal(Hardware->os, Hardware->idleSignal, gcvTRUE)); | ||
107 | gcmkVERIFY_OK(gckOS_StopThread(Hardware->os, Hardware->timeIdleThread)); | ||
108 | -#endif | ||
109 | + | ||
110 | /* Mark the object as unknown. */ | ||
111 | Hardware->object.type = gcvOBJ_UNKNOWN; | ||
112 | |||
113 | @@ -1432,7 +1434,6 @@ gckVGHARDWARE_ReadInterrupt( | ||
114 | return status; | ||
115 | } | ||
116 | |||
117 | -#if gcdPOWER_MANAGEMENT | ||
118 | static gceSTATUS _CommandStall( | ||
119 | gckVGHARDWARE Hardware) | ||
120 | { | ||
121 | @@ -1477,7 +1478,6 @@ static gceSTATUS _CommandStall( | ||
122 | /* Return the status. */ | ||
123 | return status; | ||
124 | } | ||
125 | -#endif | ||
126 | |||
127 | /******************************************************************************* | ||
128 | ** | ||
129 | @@ -1500,7 +1500,6 @@ gckVGHARDWARE_SetPowerManagementState( | ||
130 | IN gceCHIPPOWERSTATE State | ||
131 | ) | ||
132 | { | ||
133 | -#if gcdPOWER_MANAGEMENT | ||
134 | gceSTATUS status; | ||
135 | gckVGCOMMAND command = gcvNULL; | ||
136 | gckOS os; | ||
137 | @@ -1600,6 +1599,12 @@ gckVGHARDWARE_SetPowerManagementState( | ||
138 | command = Hardware->kernel->command; | ||
139 | gcmkVERIFY_OBJECT(command, gcvOBJ_COMMAND); | ||
140 | |||
141 | + if (Hardware->powerManagement == gcvFALSE) | ||
142 | + { | ||
143 | + gcmkFOOTER_NO(); | ||
144 | + return gcvSTATUS_OK; | ||
145 | + } | ||
146 | + | ||
147 | /* Start profiler. */ | ||
148 | gcmkPROFILE_INIT(freq, time); | ||
149 | |||
150 | @@ -1914,10 +1919,6 @@ OnError: | ||
151 | /* Return the status. */ | ||
152 | gcmkFOOTER(); | ||
153 | return status; | ||
154 | -#else /* gcdPOWER_MANAGEMENT */ | ||
155 | - /* Do nothing */ | ||
156 | - return gcvSTATUS_OK; | ||
157 | -#endif | ||
158 | } | ||
159 | |||
160 | /******************************************************************************* | ||
161 | @@ -1955,6 +1956,40 @@ gckVGHARDWARE_QueryPowerManagementState( | ||
162 | return gcvSTATUS_OK; | ||
163 | } | ||
164 | |||
165 | +/******************************************************************************* | ||
166 | +** | ||
167 | +** gckVGHARDWARE_SetPowerManagement | ||
168 | +** | ||
169 | +** Configure GPU power management function. | ||
170 | +** Only used in driver initialization stage. | ||
171 | +** | ||
172 | +** INPUT: | ||
173 | +** | ||
174 | +** gckVGHARDWARE Harwdare | ||
175 | +** Pointer to an gckHARDWARE object. | ||
176 | +** | ||
177 | +** gctBOOL PowerManagement | ||
178 | +** Power Mangement State. | ||
179 | +** | ||
180 | +*/ | ||
181 | +gceSTATUS | ||
182 | +gckVGHARDWARE_SetPowerManagement( | ||
183 | + IN gckVGHARDWARE Hardware, | ||
184 | + IN gctBOOL PowerManagement | ||
185 | + ) | ||
186 | +{ | ||
187 | + gcmkHEADER_ARG("Hardware=0x%x", Hardware); | ||
188 | + | ||
189 | + /* Verify the arguments. */ | ||
190 | + gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); | ||
191 | + | ||
192 | + Hardware->powerManagement = PowerManagement; | ||
193 | + | ||
194 | + /* Success. */ | ||
195 | + gcmkFOOTER_NO(); | ||
196 | + return gcvSTATUS_OK; | ||
197 | +} | ||
198 | + | ||
199 | gceSTATUS | ||
200 | gckVGHARDWARE_SetPowerOffTimeout( | ||
201 | IN gckVGHARDWARE Hardware, | ||
202 | 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 | ||
203 | index 83a603e..16b81ae 100644 | ||
204 | --- a/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.h | ||
205 | +++ b/drivers/mxc/gpu-viv/arch/GC350/hal/kernel/gc_hal_kernel_hardware_vg.h | ||
206 | @@ -66,6 +66,8 @@ struct _gckVGHARDWARE | ||
207 | gctTHREAD timeIdleThread; | ||
208 | gctBOOL killThread; | ||
209 | gctPOINTER pageTableDirty; | ||
210 | + | ||
211 | + gctBOOL powerManagement; | ||
212 | }; | ||
213 | |||
214 | #endif /* __gc_hal_kernel_hardware_h_ */ | ||
215 | 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 | ||
216 | index ebd36fe..00f3839 100644 | ||
217 | --- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | ||
218 | +++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c | ||
219 | @@ -176,6 +176,7 @@ _IdentifyHardware( | ||
220 | Identity->chipMinorFeatures1 = 0; | ||
221 | Identity->chipMinorFeatures2 = 0; | ||
222 | Identity->chipMinorFeatures3 = 0; | ||
223 | + Identity->chipMinorFeatures4 = 0; | ||
224 | } | ||
225 | else | ||
226 | { | ||
227 | @@ -207,13 +208,20 @@ _IdentifyHardware( | ||
228 | gckOS_ReadRegisterEx(Os, Core, | ||
229 | 0x00088, | ||
230 | &Identity->chipMinorFeatures3)); | ||
231 | + | ||
232 | + /* Read chip minor featuress register #4. */ | ||
233 | + gcmkONERROR( | ||
234 | + gckOS_ReadRegisterEx(Os, Core, | ||
235 | + 0x00094, | ||
236 | + &Identity->chipMinorFeatures4)); | ||
237 | } | ||
238 | else | ||
239 | { | ||
240 | - /* Chip doesn't has minor features register #1 or 2 or 3. */ | ||
241 | + /* Chip doesn't has minor features register #1 or 2 or 3 or 4. */ | ||
242 | Identity->chipMinorFeatures1 = 0; | ||
243 | Identity->chipMinorFeatures2 = 0; | ||
244 | Identity->chipMinorFeatures3 = 0; | ||
245 | + Identity->chipMinorFeatures4 = 0; | ||
246 | } | ||
247 | } | ||
248 | |||
249 | @@ -234,14 +242,14 @@ _IdentifyHardware( | ||
250 | |||
251 | /* Exception for GC1000, revision 5035 & GC800, revision 4612 */ | ||
252 | if (((Identity->chipModel == gcv1000) && ((Identity->chipRevision == 0x5035) | ||
253 | - || (Identity->chipRevision == 0x5036))) | ||
254 | + || (Identity->chipRevision == 0x5036) | ||
255 | + || (Identity->chipRevision == 0x5037))) | ||
256 | || ((Identity->chipModel == gcv800) && (Identity->chipRevision == 0x4612))) | ||
257 | { | ||
258 | Identity->superTileMode = 1; | ||
259 | } | ||
260 | |||
261 | |||
262 | - | ||
263 | /* Disable HZ when EZ is present for older chips. */ | ||
264 | 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)))))))) | ||
265 | { | ||
266 | @@ -285,6 +293,10 @@ _IdentifyHardware( | ||
267 | "Identity: chipMinorFeatures3=0x%08X", | ||
268 | Identity->chipMinorFeatures3); | ||
269 | |||
270 | + gcmkTRACE_ZONE(gcvLEVEL_INFO, gcvZONE_HARDWARE, | ||
271 | + "Identity: chipMinorFeatures4=0x%08X", | ||
272 | + Identity->chipMinorFeatures4); | ||
273 | + | ||
274 | /*************************************************************************** | ||
275 | ** Get chip specs. | ||
276 | */ | ||
277 | @@ -576,7 +588,6 @@ OnError: | ||
278 | return status; | ||
279 | } | ||
280 | |||
281 | -#if gcdPOWER_MANAGEMENT | ||
282 | static gceSTATUS | ||
283 | _IsGPUPresent( | ||
284 | IN gckHARDWARE Hardware | ||
285 | @@ -631,7 +642,6 @@ OnError: | ||
286 | gcmkFOOTER(); | ||
287 | return status; | ||
288 | } | ||
289 | -#endif | ||
290 | |||
291 | /******************************************************************************\ | ||
292 | ****************************** gckHARDWARE API code ***************************** | ||
293 | @@ -708,6 +718,7 @@ gckHARDWARE_Construct( | ||
294 | |||
295 | case gcv300: | ||
296 | case gcv320: | ||
297 | + case gcv420: | ||
298 | hardware->type = gcvHARDWARE_2D; | ||
299 | /*set outstanding limit*/ | ||
300 | gcmkONERROR(gckOS_ReadRegisterEx(Os, Core, 0x00414, &axi_ot)); | ||
301 | @@ -795,6 +806,9 @@ gckHARDWARE_Construct( | ||
302 | hardware->linkQueue.count = 0; | ||
303 | #endif | ||
304 | |||
305 | + /* Enable power management by default. */ | ||
306 | + hardware->powerManagement = gcvTRUE; | ||
307 | + | ||
308 | /* Return pointer to the gckHARDWARE object. */ | ||
309 | *Hardware = hardware; | ||
310 | |||
311 | @@ -1404,6 +1418,7 @@ gckHARDWARE_QueryChipIdentity( | ||
312 | Identity->chipMinorFeatures1 = Hardware->identity.chipMinorFeatures1; | ||
313 | Identity->chipMinorFeatures2 = Hardware->identity.chipMinorFeatures2; | ||
314 | Identity->chipMinorFeatures3 = Hardware->identity.chipMinorFeatures3; | ||
315 | + Identity->chipMinorFeatures4 = Hardware->identity.chipMinorFeatures4; | ||
316 | |||
317 | /* Return chip specs. */ | ||
318 | Identity->streamCount = Hardware->identity.streamCount; | ||
319 | @@ -3129,7 +3144,7 @@ gckHARDWARE_FlushMMU( | ||
320 | | ((((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))); | ||
321 | |||
322 | buffer[9] | ||
323 | - = (((((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))) ); | ||
324 | + = (((((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)))); | ||
325 | |||
326 | /* Arm the PE-FE Semaphore. */ | ||
327 | buffer[10] | ||
328 | @@ -3660,7 +3675,7 @@ typedef enum | ||
329 | } | ||
330 | gcePOWER_FLAGS; | ||
331 | |||
332 | -#if gcmIS_DEBUG(gcdDEBUG_TRACE) && gcdPOWER_MANAGEMENT | ||
333 | +#if gcmIS_DEBUG(gcdDEBUG_TRACE) | ||
334 | static gctCONST_STRING | ||
335 | _PowerEnum(gceCHIPPOWERSTATE State) | ||
336 | { | ||
337 | @@ -3709,7 +3724,6 @@ gckHARDWARE_SetPowerManagementState( | ||
338 | IN gceCHIPPOWERSTATE State | ||
339 | ) | ||
340 | { | ||
341 | -#if gcdPOWER_MANAGEMENT | ||
342 | gceSTATUS status; | ||
343 | gckCOMMAND command = gcvNULL; | ||
344 | gckOS os; | ||
345 | @@ -3841,6 +3855,12 @@ gckHARDWARE_SetPowerManagementState( | ||
346 | command = Hardware->kernel->command; | ||
347 | gcmkVERIFY_OBJECT(command, gcvOBJ_COMMAND); | ||
348 | |||
349 | + if (Hardware->powerManagement == gcvFALSE) | ||
350 | + { | ||
351 | + gcmkFOOTER_NO(); | ||
352 | + return gcvSTATUS_OK; | ||
353 | + } | ||
354 | + | ||
355 | /* Start profiler. */ | ||
356 | gcmkPROFILE_INIT(freq, time); | ||
357 | |||
358 | @@ -4491,10 +4511,6 @@ OnError: | ||
359 | /* Return the status. */ | ||
360 | gcmkFOOTER(); | ||
361 | return status; | ||
362 | -#else /* gcdPOWER_MANAGEMENT */ | ||
363 | - /* Do nothing */ | ||
364 | - return gcvSTATUS_OK; | ||
365 | -#endif | ||
366 | } | ||
367 | |||
368 | /******************************************************************************* | ||
369 | @@ -4532,6 +4548,40 @@ gckHARDWARE_QueryPowerManagementState( | ||
370 | return gcvSTATUS_OK; | ||
371 | } | ||
372 | |||
373 | +/******************************************************************************* | ||
374 | +** | ||
375 | +** gckHARDWARE_SetPowerManagement | ||
376 | +** | ||
377 | +** Configure GPU power management function. | ||
378 | +** Only used in driver initialization stage. | ||
379 | +** | ||
380 | +** INPUT: | ||
381 | +** | ||
382 | +** gckHARDWARE Harwdare | ||
383 | +** Pointer to an gckHARDWARE object. | ||
384 | +** | ||
385 | +** gctBOOL PowerManagement | ||
386 | +** Power Mangement State. | ||
387 | +** | ||
388 | +*/ | ||
389 | +gceSTATUS | ||
390 | +gckHARDWARE_SetPowerManagement( | ||
391 | + IN gckHARDWARE Hardware, | ||
392 | + IN gctBOOL PowerManagement | ||
393 | + ) | ||
394 | +{ | ||
395 | + gcmkHEADER_ARG("Hardware=0x%x", Hardware); | ||
396 | + | ||
397 | + /* Verify the arguments. */ | ||
398 | + gcmkVERIFY_OBJECT(Hardware, gcvOBJ_HARDWARE); | ||
399 | + | ||
400 | + Hardware->powerManagement = PowerManagement; | ||
401 | + | ||
402 | + /* Success. */ | ||
403 | + gcmkFOOTER_NO(); | ||
404 | + return gcvSTATUS_OK; | ||
405 | +} | ||
406 | + | ||
407 | #if gcdENABLE_FSCALE_VAL_ADJUST | ||
408 | gceSTATUS | ||
409 | gckHARDWARE_SetFscaleValue( | ||
410 | @@ -4767,6 +4817,21 @@ OnError: | ||
411 | GC_DEBUG_SIGNALS_##block##_Address, \ | ||
412 | &profiler->data)) | ||
413 | |||
414 | +#define gcmkREAD_DEBUG_REGISTER_N(control, block, index, data) \ | ||
415 | + gcmkONERROR(\ | ||
416 | + gckOS_WriteRegisterEx(Hardware->os, \ | ||
417 | + Hardware->core, \ | ||
418 | + GC_DEBUG_CONTROL##control##_Address, \ | ||
419 | + gcmSETFIELD(0, \ | ||
420 | + GC_DEBUG_CONTROL##control, \ | ||
421 | + block, \ | ||
422 | + index))); \ | ||
423 | + gcmkONERROR(\ | ||
424 | + gckOS_ReadRegisterEx(Hardware->os, \ | ||
425 | + Hardware->core, \ | ||
426 | + GC_DEBUG_SIGNALS_##block##_Address, \ | ||
427 | + &data)) | ||
428 | + | ||
429 | #define gcmkRESET_DEBUG_REGISTER(control, block) \ | ||
430 | gcmkONERROR(\ | ||
431 | gckOS_WriteRegisterEx(Hardware->os, \ | ||
432 | @@ -4857,6 +4922,9 @@ gckHARDWARE_QueryProfileRegisters( | ||
433 | { | ||
434 | gceSTATUS status; | ||
435 | gcsPROFILER_COUNTERS * profiler = Counters; | ||
436 | + gctUINT i, clock; | ||
437 | + gctUINT32 colorKilled, colorDrawn, depthKilled, depthDrawn; | ||
438 | + gctUINT32 totalRead, totalWrite; | ||
439 | |||
440 | gcmkHEADER_ARG("Hardware=0x%x Counters=0x%x", Hardware, Counters); | ||
441 | |||
442 | @@ -4867,16 +4935,6 @@ gckHARDWARE_QueryProfileRegisters( | ||
443 | gcmkONERROR( | ||
444 | gckOS_ReadRegisterEx(Hardware->os, | ||
445 | Hardware->core, | ||
446 | - 0x00040, | ||
447 | - &profiler->gpuTotalRead64BytesPerFrame)); | ||
448 | - gcmkONERROR( | ||
449 | - gckOS_ReadRegisterEx(Hardware->os, | ||
450 | - Hardware->core, | ||
451 | - 0x00044, | ||
452 | - &profiler->gpuTotalWrite64BytesPerFrame)); | ||
453 | - gcmkONERROR( | ||
454 | - gckOS_ReadRegisterEx(Hardware->os, | ||
455 | - Hardware->core, | ||
456 | 0x00438, | ||
457 | &profiler->gpuCyclesCounter)); | ||
458 | |||
459 | @@ -4892,8 +4950,63 @@ gckHARDWARE_QueryProfileRegisters( | ||
460 | 0x0007C, | ||
461 | &profiler->gpuIdleCyclesCounter)); | ||
462 | |||
463 | - if(Reset){ | ||
464 | |||
465 | + /* Read clock control register. */ | ||
466 | + gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, | ||
467 | + Hardware->core, | ||
468 | + 0x00000, | ||
469 | + &clock)); | ||
470 | + | ||
471 | + profiler->gpuTotalRead64BytesPerFrame = 0; | ||
472 | + profiler->gpuTotalWrite64BytesPerFrame = 0; | ||
473 | + profiler->pe_pixel_count_killed_by_color_pipe = 0; | ||
474 | + profiler->pe_pixel_count_killed_by_depth_pipe = 0; | ||
475 | + profiler->pe_pixel_count_drawn_by_color_pipe = 0; | ||
476 | + profiler->pe_pixel_count_drawn_by_depth_pipe = 0; | ||
477 | + | ||
478 | + /* Walk through all avaiable pixel pipes. */ | ||
479 | + for (i = 0; i < Hardware->identity.pixelPipes; ++i) | ||
480 | + { | ||
481 | + /* Select proper pipe. */ | ||
482 | + gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, | ||
483 | + Hardware->core, | ||
484 | + 0x00000, | ||
485 | + ((((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))))); | ||
486 | + | ||
487 | + /* BW */ | ||
488 | + gcmkONERROR( | ||
489 | + gckOS_ReadRegisterEx(Hardware->os, | ||
490 | + Hardware->core, | ||
491 | + 0x00040, | ||
492 | + &totalRead)); | ||
493 | + gcmkONERROR( | ||
494 | + gckOS_ReadRegisterEx(Hardware->os, | ||
495 | + Hardware->core, | ||
496 | + 0x00044, | ||
497 | + &totalWrite)); | ||
498 | + | ||
499 | + profiler->gpuTotalRead64BytesPerFrame += totalRead; | ||
500 | + profiler->gpuTotalWrite64BytesPerFrame += totalWrite; | ||
501 | + | ||
502 | + /* PE */ | ||
503 | + 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)); | ||
504 | + 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)); | ||
505 | + 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)); | ||
506 | + 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)); | ||
507 | + | ||
508 | + profiler->pe_pixel_count_killed_by_color_pipe += colorKilled; | ||
509 | + profiler->pe_pixel_count_killed_by_depth_pipe += depthKilled; | ||
510 | + profiler->pe_pixel_count_drawn_by_color_pipe += colorDrawn; | ||
511 | + profiler->pe_pixel_count_drawn_by_depth_pipe += depthDrawn; | ||
512 | + } | ||
513 | + | ||
514 | + /* Reset clock control register. */ | ||
515 | + gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os, | ||
516 | + Hardware->core, | ||
517 | + 0x00000, | ||
518 | + clock)); | ||
519 | + | ||
520 | + if(Reset){ | ||
521 | /* Reset counters. */ | ||
522 | gcmkONERROR( | ||
523 | gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x0003C, 1)); | ||
524 | @@ -4903,19 +5016,10 @@ gckHARDWARE_QueryProfileRegisters( | ||
525 | gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00438, 0)); | ||
526 | gcmkONERROR( | ||
527 | gckOS_WriteRegisterEx(Hardware->os, Hardware->core, 0x00078, 0)); | ||
528 | - } | ||
529 | - /* PE */ | ||
530 | - 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))) )); | ||
531 | -gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &profiler->pe_pixel_count_killed_by_color_pipe)); | ||
532 | - 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))) )); | ||
533 | -gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &profiler->pe_pixel_count_killed_by_depth_pipe)); | ||
534 | - 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))) )); | ||
535 | -gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &profiler->pe_pixel_count_drawn_by_color_pipe)); | ||
536 | - 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))) )); | ||
537 | -gcmkONERROR(gckOS_ReadRegisterEx(Hardware->os, Hardware->core, 0x00454, &profiler->pe_pixel_count_drawn_by_depth_pipe)); | ||
538 | - 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))) )); | ||
539 | + 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))) )); | ||
540 | 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))) | ||
541 | -)); } | ||
542 | +)); | ||
543 | + } | ||
544 | |||
545 | /* SH */ | ||
546 | 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))) )); | ||
547 | 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 | ||
548 | index 517b35c..37226b7 100644 | ||
549 | --- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h | ||
550 | +++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.h | ||
551 | @@ -90,6 +90,8 @@ struct _gckHARDWARE | ||
552 | #if gcdLINK_QUEUE_SIZE | ||
553 | struct _gckLINKQUEUE linkQueue; | ||
554 | #endif | ||
555 | + | ||
556 | + gctBOOL powerManagement; | ||
557 | }; | ||
558 | |||
559 | gceSTATUS | ||
560 | diff --git a/drivers/mxc/gpu-viv/config b/drivers/mxc/gpu-viv/config | ||
561 | index 1196efa..cdd143e 100644 | ||
562 | --- a/drivers/mxc/gpu-viv/config | ||
563 | +++ b/drivers/mxc/gpu-viv/config | ||
564 | @@ -22,7 +22,6 @@ | ||
565 | ARCH_TYPE ?= arm | ||
566 | SDK_DIR ?= $(AQROOT)/build/sdk | ||
567 | USE_3D_VG ?= 1 | ||
568 | -USE_POWER_MANAGEMENT ?= 1 | ||
569 | FORCE_ALL_VIDEO_MEMORY_CACHED ?= 0 | ||
570 | NONPAGED_MEMORY_CACHEABLE ?= 0 | ||
571 | NONPAGED_MEMORY_BUFFERABLE ?= 1 | ||
572 | diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c | ||
573 | index 7964585..b7b0d28 100644 | ||
574 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c | ||
575 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c | ||
576 | @@ -904,9 +904,6 @@ gckKERNEL_Dispatch( | ||
577 | gctSIGNAL signal; | ||
578 | #endif | ||
579 | |||
580 | - gcsDATABASE_RECORD record; | ||
581 | - gctPOINTER data; | ||
582 | - | ||
583 | gcmkHEADER_ARG("Kernel=0x%x FromUser=%d Interface=0x%x", | ||
584 | Kernel, FromUser, Interface); | ||
585 | |||
586 | @@ -1940,249 +1937,133 @@ gckKERNEL_Dispatch( | ||
587 | #endif | ||
588 | |||
589 | case gcvHAL_GET_SHARED_INFO: | ||
590 | - bytes = (gctSIZE_T) Interface->u.GetSharedInfo.size; | ||
591 | - | ||
592 | - if (Interface->u.GetSharedInfo.dataId != 0) | ||
593 | + if (Interface->u.GetSharedInfo.data == gcvNULL) | ||
594 | { | ||
595 | - gcmkONERROR(gckKERNEL_FindProcessDB(Kernel, | ||
596 | - Interface->u.GetSharedInfo.pid, | ||
597 | - 0, | ||
598 | - gcvDB_SHARED_INFO, | ||
599 | - gcmINT2PTR(Interface->u.GetSharedInfo.dataId), | ||
600 | - &record)); | ||
601 | - | ||
602 | - /* find a record in db, check size */ | ||
603 | - if (record.bytes != bytes) | ||
604 | - { | ||
605 | - /* Size change is not allowed */ | ||
606 | - gcmkONERROR(gcvSTATUS_INVALID_DATA); | ||
607 | - } | ||
608 | - | ||
609 | - /* fetch data */ | ||
610 | - gcmkONERROR(gckOS_CopyToUserData( | ||
611 | - Kernel->os, | ||
612 | - record.physical, | ||
613 | - gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.data), | ||
614 | - bytes | ||
615 | - )); | ||
616 | - | ||
617 | + gcmkONERROR(gcvSTATUS_INVALID_ARGUMENT); | ||
618 | } | ||
619 | - | ||
620 | - if ((node = gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.node)) != gcvNULL) | ||
621 | + else | ||
622 | { | ||
623 | - switch (Interface->u.GetSharedInfo.infoType) | ||
624 | - { | ||
625 | - case gcvVIDMEM_INFO_GENERIC: | ||
626 | - { /* Generic data stored */ | ||
627 | - if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) | ||
628 | - { | ||
629 | - data = &node->VidMem.sharedInfo; | ||
630 | - | ||
631 | - } | ||
632 | - else | ||
633 | - { | ||
634 | - data = &node->Virtual.sharedInfo; | ||
635 | - } | ||
636 | + gctUINT32 pid = Interface->u.GetSharedInfo.pid; | ||
637 | + gctUINT32 dataId = Interface->u.GetSharedInfo.dataId; | ||
638 | + gctSIZE_T bytes = Interface->u.GetSharedInfo.bytes; | ||
639 | + gctPOINTER data = Interface->u.GetSharedInfo.data; | ||
640 | + gcsDATABASE_RECORD record; | ||
641 | |||
642 | - gcmkONERROR(gckOS_CopyToUserData( | ||
643 | - Kernel->os, | ||
644 | - data, | ||
645 | - gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.nodeData), | ||
646 | - sizeof(gcsVIDMEM_NODE_SHARED_INFO) | ||
647 | - )); | ||
648 | - } | ||
649 | - break; | ||
650 | - | ||
651 | - case gcvVIDMEM_INFO_DIRTY_RECTANGLE: | ||
652 | - { /* Dirty rectangle stored */ | ||
653 | - gcsVIDMEM_NODE_SHARED_INFO *storedSharedInfo; | ||
654 | - gcsVIDMEM_NODE_SHARED_INFO alignedSharedInfo; | ||
655 | - | ||
656 | - if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) | ||
657 | - { | ||
658 | - storedSharedInfo = &node->VidMem.sharedInfo; | ||
659 | - } | ||
660 | - else | ||
661 | - { | ||
662 | - storedSharedInfo = &node->Virtual.sharedInfo; | ||
663 | - } | ||
664 | - | ||
665 | - /* Stored shared info holds the unaligned dirty rectangle. | ||
666 | - Align it first. */ | ||
667 | - | ||
668 | - /* Hardware requires 64-byte aligned address, and 16x4 pixel aligned rectsize. | ||
669 | - We simply align to 32 pixels which covers both 16- and 32-bpp formats. */ | ||
670 | - | ||
671 | - /* Make sure we have a legit rectangle. */ | ||
672 | - gcmkASSERT((storedSharedInfo->RectSize.width != 0) && (storedSharedInfo->RectSize.height != 0)); | ||
673 | - | ||
674 | - alignedSharedInfo.SrcOrigin.x = gcmALIGN_BASE(storedSharedInfo->SrcOrigin.x, 32); | ||
675 | - alignedSharedInfo.RectSize.width = gcmALIGN((storedSharedInfo->RectSize.width + (storedSharedInfo->SrcOrigin.x - alignedSharedInfo.SrcOrigin.x)), 16); | ||
676 | - | ||
677 | - alignedSharedInfo.SrcOrigin.y = gcmALIGN_BASE(storedSharedInfo->SrcOrigin.y, 4); | ||
678 | - alignedSharedInfo.RectSize.height = gcmALIGN((storedSharedInfo->RectSize.height + (storedSharedInfo->SrcOrigin.y - alignedSharedInfo.SrcOrigin.y)), 4); | ||
679 | - | ||
680 | - gcmkONERROR(gckOS_CopyToUserData( | ||
681 | - Kernel->os, | ||
682 | - &alignedSharedInfo, | ||
683 | - gcmUINT64_TO_PTR(Interface->u.GetSharedInfo.nodeData), | ||
684 | - sizeof(gcsVIDMEM_NODE_SHARED_INFO) | ||
685 | - )); | ||
686 | - | ||
687 | - gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_KERNEL, | ||
688 | - "Node = %p, unaligned rectangle (l=%d, t=%d, w=%d, h=%d) aligned to (l=%d, t=%d, w=%d, h=%d)", node, | ||
689 | - storedSharedInfo->SrcOrigin.x, storedSharedInfo->SrcOrigin.y, | ||
690 | - storedSharedInfo->RectSize.width, storedSharedInfo->RectSize.height, | ||
691 | - alignedSharedInfo.SrcOrigin.x, alignedSharedInfo.SrcOrigin.y, | ||
692 | - alignedSharedInfo.RectSize.width, alignedSharedInfo.RectSize.height); | ||
693 | + /* Find record. */ | ||
694 | + gcmkONERROR( | ||
695 | + gckKERNEL_FindProcessDB(Kernel, | ||
696 | + pid, | ||
697 | + 0, | ||
698 | + gcvDB_SHARED_INFO, | ||
699 | + gcmINT2PTR(dataId), | ||
700 | + &record)); | ||
701 | + | ||
702 | + /* Check memory size. */ | ||
703 | + if (bytes < record.bytes) | ||
704 | + { | ||
705 | + /* Insufficient memory to hold shared data. */ | ||
706 | + gcmkONERROR(gcvSTATUS_INVALID_ARGUMENT); | ||
707 | + } | ||
708 | |||
709 | - /* Rectangle */ | ||
710 | - storedSharedInfo->SrcOrigin.x = | ||
711 | - storedSharedInfo->SrcOrigin.y = | ||
712 | - storedSharedInfo->RectSize.width = | ||
713 | - storedSharedInfo->RectSize.height = 0; | ||
714 | - } | ||
715 | - break; | ||
716 | - } | ||
717 | + /* Copy to user. */ | ||
718 | + status = gckOS_CopyToUserData(Kernel->os, | ||
719 | + record.physical, | ||
720 | + data, | ||
721 | + record.bytes); | ||
722 | + | ||
723 | + /* | ||
724 | + * Remove from process db. | ||
725 | + * Every time when shared info is taken, the record is erased in | ||
726 | + * kernel side. | ||
727 | + */ | ||
728 | + gcmkVERIFY_OK( | ||
729 | + gckKERNEL_RemoveProcessDB(Kernel, | ||
730 | + pid, | ||
731 | + gcvDB_SHARED_INFO, | ||
732 | + gcmINT2PTR(dataId))); | ||
733 | + /* Free existed data. */ | ||
734 | + gcmkVERIFY_OK( | ||
735 | + gckOS_FreeMemory(Kernel->os, record.physical)); | ||
736 | } | ||
737 | break; | ||
738 | |||
739 | case gcvHAL_SET_SHARED_INFO: | ||
740 | - bytes = (gctSIZE_T) Interface->u.SetSharedInfo.size; | ||
741 | - | ||
742 | - if (Interface->u.SetSharedInfo.dataId != 0) | ||
743 | { | ||
744 | - status = gckKERNEL_FindProcessDB(Kernel, processID, 0, | ||
745 | - gcvDB_SHARED_INFO, | ||
746 | - gcmINT2PTR(Interface->u.SetSharedInfo.dataId), | ||
747 | - &record); | ||
748 | - | ||
749 | - if (status == gcvSTATUS_INVALID_DATA) | ||
750 | - { | ||
751 | - /* private data has not been created yet */ | ||
752 | - /* Note: we count on DestoryProcessDB to free it */ | ||
753 | - gcmkONERROR(gckOS_AllocateMemory( | ||
754 | - Kernel->os, | ||
755 | - bytes, | ||
756 | - &data | ||
757 | - )); | ||
758 | - | ||
759 | - gcmkONERROR( | ||
760 | - gckKERNEL_AddProcessDB(Kernel, processID, | ||
761 | - gcvDB_SHARED_INFO, | ||
762 | - gcmINT2PTR(Interface->u.SetSharedInfo.dataId), | ||
763 | - data, | ||
764 | - bytes | ||
765 | - )); | ||
766 | - } | ||
767 | - else | ||
768 | + gctUINT32 dataId = Interface->u.SetSharedInfo.dataId; | ||
769 | + gctPOINTER data = Interface->u.SetSharedInfo.data; | ||
770 | + gctUINT32 bytes = Interface->u.SetSharedInfo.bytes; | ||
771 | + gctPOINTER memory = gcvNULL; | ||
772 | + gcsDATABASE_RECORD record; | ||
773 | + | ||
774 | + if (gcmIS_SUCCESS(gckKERNEL_FindProcessDB(Kernel, | ||
775 | + processID, | ||
776 | + 0, | ||
777 | + gcvDB_SHARED_INFO, | ||
778 | + gcmINT2PTR(dataId), | ||
779 | + &record))) | ||
780 | { | ||
781 | - /* bail on other errors */ | ||
782 | - gcmkONERROR(status); | ||
783 | - | ||
784 | - /* find a record in db, check size */ | ||
785 | - if (record.bytes != bytes) | ||
786 | + /* Find a record with the same id. */ | ||
787 | + if (bytes != record.bytes) | ||
788 | { | ||
789 | - /* Size change is not allowed */ | ||
790 | - gcmkONERROR(gcvSTATUS_INVALID_DATA); | ||
791 | + /* Remove from process db. */ | ||
792 | + gcmkVERIFY_OK( | ||
793 | + gckKERNEL_RemoveProcessDB(Kernel, | ||
794 | + processID, | ||
795 | + gcvDB_SHARED_INFO, | ||
796 | + gcmINT2PTR(dataId))); | ||
797 | + | ||
798 | + /* Free existed data. */ | ||
799 | + gcmkVERIFY_OK( | ||
800 | + gckOS_FreeMemory(Kernel->os, record.physical)); | ||
801 | } | ||
802 | - | ||
803 | - /* get storage address */ | ||
804 | - data = record.physical; | ||
805 | - } | ||
806 | - | ||
807 | - gcmkONERROR(gckOS_CopyFromUserData( | ||
808 | - Kernel->os, | ||
809 | - data, | ||
810 | - gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.data), | ||
811 | - bytes | ||
812 | - )); | ||
813 | - } | ||
814 | - | ||
815 | - if ((node = gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.node)) != gcvNULL) | ||
816 | - { | ||
817 | - switch (Interface->u.SetSharedInfo.infoType) | ||
818 | + else | ||
819 | { | ||
820 | - case gcvVIDMEM_INFO_GENERIC: | ||
821 | - { /* Generic data stored */ | ||
822 | - if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) | ||
823 | - { | ||
824 | - data = &node->VidMem.sharedInfo; | ||
825 | - } | ||
826 | - else | ||
827 | - { | ||
828 | - data = &node->Virtual.sharedInfo; | ||
829 | - } | ||
830 | - | ||
831 | - gcmkONERROR(gckOS_CopyFromUserData( | ||
832 | - Kernel->os, | ||
833 | - data, | ||
834 | - gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.nodeData), | ||
835 | - sizeof(gcsVIDMEM_NODE_SHARED_INFO) | ||
836 | - )); | ||
837 | - } | ||
838 | - break; | ||
839 | + /* Re-use allocated memory. */ | ||
840 | + memory = record.physical; | ||
841 | + } | ||
842 | + } | ||
843 | |||
844 | - case gcvVIDMEM_INFO_DIRTY_RECTANGLE: | ||
845 | - { /* Dirty rectangle stored */ | ||
846 | - gcsVIDMEM_NODE_SHARED_INFO newSharedInfo; | ||
847 | - gcsVIDMEM_NODE_SHARED_INFO *currentSharedInfo; | ||
848 | - gctINT dirtyX, dirtyY, right, bottom; | ||
849 | - | ||
850 | - /* Expand the dirty rectangle stored in the node to include the rectangle passed in. */ | ||
851 | - gcmkONERROR(gckOS_CopyFromUserData( | ||
852 | - Kernel->os, | ||
853 | - &newSharedInfo, | ||
854 | - gcmUINT64_TO_PTR(Interface->u.SetSharedInfo.nodeData), | ||
855 | - gcmSIZEOF(gcsVIDMEM_NODE_SHARED_INFO) | ||
856 | - )); | ||
857 | - | ||
858 | - if (node->VidMem.memory->object.type == gcvOBJ_VIDMEM) | ||
859 | - { | ||
860 | - currentSharedInfo = &node->VidMem.sharedInfo; | ||
861 | - } | ||
862 | - else | ||
863 | - { | ||
864 | - currentSharedInfo = &node->Virtual.sharedInfo; | ||
865 | - } | ||
866 | + if ((data == gcvNULL) || (bytes == 0)) | ||
867 | + { | ||
868 | + /* Nothing to record. */ | ||
869 | + break; | ||
870 | + } | ||
871 | |||
872 | - gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_KERNEL, "Node = %p Stored rectangle (l=%d, t=%d, w=%d, h=%d)", node, | ||
873 | - currentSharedInfo->SrcOrigin.x, currentSharedInfo->SrcOrigin.y, | ||
874 | - currentSharedInfo->RectSize.width, currentSharedInfo->RectSize.height); | ||
875 | + if (bytes > 1024) | ||
876 | + { | ||
877 | + /* Limite data size. */ | ||
878 | + gcmkONERROR(gcvSTATUS_TOO_COMPLEX); | ||
879 | + } | ||
880 | |||
881 | - gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_KERNEL, "To combine with (l=%d, t=%d, w=%d, h=%d)", | ||
882 | - newSharedInfo.SrcOrigin.x, newSharedInfo.SrcOrigin.y, | ||
883 | - newSharedInfo.RectSize.width, newSharedInfo.RectSize.height); | ||
884 | + if (memory == gcvNULL) | ||
885 | + { | ||
886 | + /* Allocate memory for holding shared data. */ | ||
887 | + gcmkONERROR( | ||
888 | + gckOS_AllocateMemory(Kernel->os, bytes, &memory)); | ||
889 | |||
890 | - if ((currentSharedInfo->RectSize.width == 0) || (currentSharedInfo->RectSize.height == 0)) | ||
891 | - { /* Setting it for the first time */ | ||
892 | - currentSharedInfo->SrcOrigin.x = newSharedInfo.SrcOrigin.x; | ||
893 | - currentSharedInfo->SrcOrigin.y = newSharedInfo.SrcOrigin.y; | ||
894 | - currentSharedInfo->RectSize.width = newSharedInfo.RectSize.width; | ||
895 | - currentSharedInfo->RectSize.height = newSharedInfo.RectSize.height; | ||
896 | - } | ||
897 | - else | ||
898 | - { | ||
899 | - /* Expand the stored rectangle to include newly locked rectangle */ | ||
900 | - dirtyX = (newSharedInfo.SrcOrigin.x < currentSharedInfo->SrcOrigin.x) ? newSharedInfo.SrcOrigin.x : currentSharedInfo->SrcOrigin.x; | ||
901 | - right = gcmMAX((currentSharedInfo->SrcOrigin.x + currentSharedInfo->RectSize.width), (newSharedInfo.SrcOrigin.x + newSharedInfo.RectSize.width)); | ||
902 | - currentSharedInfo->RectSize.width = right - dirtyX; | ||
903 | - currentSharedInfo->SrcOrigin.x = dirtyX; | ||
904 | - | ||
905 | - dirtyY = (newSharedInfo.SrcOrigin.y < currentSharedInfo->SrcOrigin.y) ? newSharedInfo.SrcOrigin.y : currentSharedInfo->SrcOrigin.y; | ||
906 | - bottom = gcmMAX((currentSharedInfo->SrcOrigin.y + currentSharedInfo->RectSize.height), (newSharedInfo.SrcOrigin.y + newSharedInfo.RectSize.height)); | ||
907 | - currentSharedInfo->RectSize.height = bottom - dirtyY; | ||
908 | - currentSharedInfo->SrcOrigin.y = dirtyY; | ||
909 | - } | ||
910 | + /* Add to process db. */ | ||
911 | + status = gckKERNEL_AddProcessDB(Kernel, | ||
912 | + processID, | ||
913 | + gcvDB_SHARED_INFO, | ||
914 | + gcmINT2PTR(dataId), | ||
915 | + memory, | ||
916 | + bytes); | ||
917 | |||
918 | - gcmkTRACE_ZONE(gcvLEVEL_VERBOSE, gcvZONE_KERNEL, "Combined rectangle (l=%d, t=%d, w=%d, h=%d)", | ||
919 | - currentSharedInfo->SrcOrigin.x, currentSharedInfo->SrcOrigin.y, | ||
920 | - currentSharedInfo->RectSize.width, currentSharedInfo->RectSize.height); | ||
921 | - } | ||
922 | + if (gcmIS_ERROR(status)) | ||
923 | + { | ||
924 | + /* Failed to add process db. Free allocated memory. */ | ||
925 | + gcmkVERIFY_OK(gckOS_FreeMemory(Kernel->os, memory)); | ||
926 | break; | ||
927 | } | ||
928 | - } | ||
929 | + } | ||
930 | |||
931 | + /* Copy shared data to kernel memory. */ | ||
932 | + gcmkONERROR( | ||
933 | + gckOS_CopyFromUserData(Kernel->os, | ||
934 | + memory, | ||
935 | + data, | ||
936 | + bytes)); | ||
937 | + } | ||
938 | break; | ||
939 | |||
940 | case gcvHAL_SET_FSCALE_VALUE: | ||
941 | 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 | ||
942 | index 66ce0d1..9ee9ea1 100644 | ||
943 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c | ||
944 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c | ||
945 | @@ -2047,14 +2047,14 @@ gckCOMMAND_Commit( | ||
946 | EventQueue = nextEventRecord; | ||
947 | } | ||
948 | |||
949 | -#if gcdPOWER_MANAGEMENT | ||
950 | - if (Command->kernel->eventObj->queueHead == gcvNULL) | ||
951 | + if (Command->kernel->eventObj->queueHead == gcvNULL | ||
952 | + && Command->kernel->hardware->powerManagement == gcvTRUE | ||
953 | + ) | ||
954 | { | ||
955 | /* Commit done event by which work thread knows all jobs done. */ | ||
956 | gcmkVERIFY_OK( | ||
957 | gckEVENT_CommitDone(Command->kernel->eventObj, gcvKERNEL_PIXEL)); | ||
958 | } | ||
959 | -#endif | ||
960 | |||
961 | /* Submit events. */ | ||
962 | status = gckEVENT_Submit(Command->kernel->eventObj, gcvTRUE, gcvFALSE); | ||
963 | 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 | ||
964 | index 9685a5d..76c1c10 100644 | ||
965 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c | ||
966 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command_vg.c | ||
967 | @@ -1234,7 +1234,6 @@ _EventHandler_BusError( | ||
968 | return gcvSTATUS_OK; | ||
969 | } | ||
970 | |||
971 | -#if gcdPOWER_MANAGEMENT | ||
972 | /******************************************************************************\ | ||
973 | ****************************** Power Stall Handler ******************************* | ||
974 | \******************************************************************************/ | ||
975 | @@ -1250,7 +1249,6 @@ _EventHandler_PowerStall( | ||
976 | Kernel->command->powerStallSignal, | ||
977 | gcvTRUE); | ||
978 | } | ||
979 | -#endif | ||
980 | |||
981 | /******************************************************************************\ | ||
982 | ******************************** Task Routines ********************************* | ||
983 | @@ -1965,15 +1963,12 @@ gcmDECLARE_INTERRUPT_HANDLER(COMMAND, 0) | ||
984 | ); | ||
985 | } | ||
986 | } | ||
987 | -#if gcdPOWER_MANAGEMENT | ||
988 | else | ||
989 | { | ||
990 | - | ||
991 | status = gckVGHARDWARE_SetPowerManagementState( | ||
992 | Kernel->command->hardware, gcvPOWER_IDLE_BROADCAST | ||
993 | ); | ||
994 | } | ||
995 | -#endif | ||
996 | |||
997 | /* Break out of the loop. */ | ||
998 | break; | ||
999 | @@ -2848,7 +2843,7 @@ gckVGCOMMAND_Construct( | ||
1000 | _EventHandler_BusError | ||
1001 | )); | ||
1002 | |||
1003 | -#if gcdPOWER_MANAGEMENT | ||
1004 | + | ||
1005 | command->powerStallInt = 30; | ||
1006 | /* Enable the interrupt. */ | ||
1007 | gcmkERR_BREAK(gckVGINTERRUPT_Enable( | ||
1008 | @@ -2856,7 +2851,6 @@ gckVGCOMMAND_Construct( | ||
1009 | &command->powerStallInt, | ||
1010 | _EventHandler_PowerStall | ||
1011 | )); | ||
1012 | -#endif | ||
1013 | |||
1014 | /*********************************************************************** | ||
1015 | ** Task management initialization. | ||
1016 | @@ -3419,7 +3413,6 @@ gckVGCOMMAND_Commit( | ||
1017 | gcvINFINITE | ||
1018 | )); | ||
1019 | |||
1020 | -#if gcdPOWER_MANAGEMENT | ||
1021 | status = gckVGHARDWARE_SetPowerManagementState( | ||
1022 | Command->hardware, gcvPOWER_ON_AUTO); | ||
1023 | |||
1024 | @@ -3447,7 +3440,7 @@ gckVGCOMMAND_Commit( | ||
1025 | |||
1026 | break; | ||
1027 | } | ||
1028 | -#endif | ||
1029 | + | ||
1030 | gcmkERR_BREAK(_FlushMMU(Command)); | ||
1031 | |||
1032 | do | ||
1033 | @@ -3676,10 +3669,9 @@ gckVGCOMMAND_Commit( | ||
1034 | } | ||
1035 | while (gcvFALSE); | ||
1036 | |||
1037 | -#if gcdPOWER_MANAGEMENT | ||
1038 | gcmkVERIFY_OK(gckOS_ReleaseSemaphore( | ||
1039 | Command->os, Command->powerSemaphore)); | ||
1040 | -#endif | ||
1041 | + | ||
1042 | /* Release the mutex. */ | ||
1043 | gcmkCHECK_STATUS(gckOS_ReleaseMutex( | ||
1044 | Command->os, | ||
1045 | 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 | ||
1046 | index bc5f083..673d4f7 100644 | ||
1047 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | ||
1048 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_db.c | ||
1049 | @@ -1303,9 +1303,9 @@ gckKERNEL_DestroyProcessDB( | ||
1050 | gcmPTR2INT(record->data), status); | ||
1051 | break; | ||
1052 | |||
1053 | - case gcvDB_SHARED_INFO: | ||
1054 | - status = gckOS_FreeMemory(Kernel->os, record->physical); | ||
1055 | - break; | ||
1056 | + case gcvDB_SHARED_INFO: | ||
1057 | + status = gckOS_FreeMemory(Kernel->os, record->physical); | ||
1058 | + break; | ||
1059 | |||
1060 | default: | ||
1061 | gcmkTRACE_ZONE(gcvLEVEL_ERROR, gcvZONE_DATABASE, | ||
1062 | 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 | ||
1063 | index 43c9297..c7f67c7 100644 | ||
1064 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c | ||
1065 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_mmu.c | ||
1066 | @@ -97,6 +97,14 @@ static gcsMirrorPageTable_PTR mirrorPageTable = gcvNULL; | ||
1067 | static gctPOINTER mirrorPageTableMutex = gcvNULL; | ||
1068 | #endif | ||
1069 | |||
1070 | +typedef struct _gcsDynamicSpaceNode * gcsDynamicSpaceNode_PTR; | ||
1071 | +typedef struct _gcsDynamicSpaceNode | ||
1072 | +{ | ||
1073 | + gctUINT32 start; | ||
1074 | + gctINT32 entries; | ||
1075 | +} | ||
1076 | +gcsDynamicSpaceNode; | ||
1077 | + | ||
1078 | static void | ||
1079 | _WritePageEntry( | ||
1080 | IN gctUINT32_PTR PageEntry, | ||
1081 | @@ -482,30 +490,117 @@ OnError: | ||
1082 | } | ||
1083 | |||
1084 | static gceSTATUS | ||
1085 | +_FindDynamicSpace( | ||
1086 | + IN gckMMU Mmu, | ||
1087 | + OUT gcsDynamicSpaceNode_PTR *Array, | ||
1088 | + OUT gctINT * Size | ||
1089 | + ) | ||
1090 | +{ | ||
1091 | + gceSTATUS status = gcvSTATUS_OK; | ||
1092 | + gctPOINTER pointer = gcvNULL; | ||
1093 | + gcsDynamicSpaceNode_PTR array = gcvNULL; | ||
1094 | + gctINT size = 0; | ||
1095 | + gctINT i = 0, nodeStart = -1, nodeEntries = 0; | ||
1096 | + | ||
1097 | + /* Allocate memory for the array. */ | ||
1098 | + gcmkONERROR(gckOS_Allocate(Mmu->os, | ||
1099 | + gcmSIZEOF(*array) * (gcdMMU_MTLB_ENTRY_NUM / 2), | ||
1100 | + &pointer)); | ||
1101 | + | ||
1102 | + array = (gcsDynamicSpaceNode_PTR)pointer; | ||
1103 | + | ||
1104 | + /* Loop all the entries. */ | ||
1105 | + while (i < gcdMMU_MTLB_ENTRY_NUM) | ||
1106 | + { | ||
1107 | + if (!Mmu->mtlbLogical[i]) | ||
1108 | + { | ||
1109 | + if (nodeStart < 0) | ||
1110 | + { | ||
1111 | + /* This is the first entry of the dynamic space. */ | ||
1112 | + nodeStart = i; | ||
1113 | + nodeEntries = 1; | ||
1114 | + } | ||
1115 | + else | ||
1116 | + { | ||
1117 | + /* Other entries of the dynamic space. */ | ||
1118 | + nodeEntries++; | ||
1119 | + } | ||
1120 | + } | ||
1121 | + else if (nodeStart >= 0) | ||
1122 | + { | ||
1123 | + /* Save the previous node. */ | ||
1124 | + array[size].start = nodeStart; | ||
1125 | + array[size].entries = nodeEntries; | ||
1126 | + size++; | ||
1127 | + | ||
1128 | + /* Reset the start. */ | ||
1129 | + nodeStart = -1; | ||
1130 | + nodeEntries = 0; | ||
1131 | + } | ||
1132 | + | ||
1133 | + i++; | ||
1134 | + } | ||
1135 | + | ||
1136 | + /* Save the previous node. */ | ||
1137 | + if (nodeStart >= 0) | ||
1138 | + { | ||
1139 | + array[size].start = nodeStart; | ||
1140 | + array[size].entries = nodeEntries; | ||
1141 | + size++; | ||
1142 | + } | ||
1143 | + | ||
1144 | +#if gcdMMU_TABLE_DUMP | ||
1145 | + for (i = 0; i < size; i++) | ||
1146 | + { | ||
1147 | + gckOS_Print("%s(%d): [%d]: start=%d, entries=%d.\n", | ||
1148 | + __FUNCTION__, __LINE__, | ||
1149 | + i, | ||
1150 | + array[i].start, | ||
1151 | + array[i].entries); | ||
1152 | + } | ||
1153 | +#endif | ||
1154 | + | ||
1155 | + *Array = array; | ||
1156 | + *Size = size; | ||
1157 | + | ||
1158 | + return gcvSTATUS_OK; | ||
1159 | + | ||
1160 | +OnError: | ||
1161 | + if (pointer != gcvNULL) | ||
1162 | + { | ||
1163 | + gckOS_Free(Mmu->os, pointer); | ||
1164 | + } | ||
1165 | + | ||
1166 | + return status; | ||
1167 | +} | ||
1168 | + | ||
1169 | +static gceSTATUS | ||
1170 | _SetupDynamicSpace( | ||
1171 | IN gckMMU Mmu | ||
1172 | ) | ||
1173 | { | ||
1174 | gceSTATUS status; | ||
1175 | - gctINT i; | ||
1176 | + gcsDynamicSpaceNode_PTR nodeArray = gcvNULL; | ||
1177 | + gctINT i, nodeArraySize = 0; | ||
1178 | gctUINT32 physical; | ||
1179 | - gctINT numEntries; | ||
1180 | + gctINT numEntries = 0; | ||
1181 | gctUINT32_PTR pageTable; | ||
1182 | gctBOOL acquired = gcvFALSE; | ||
1183 | |||
1184 | - /* find the start of dynamic address space. */ | ||
1185 | - for (i = 0; i < gcdMMU_MTLB_ENTRY_NUM; i++) | ||
1186 | + /* Find all the dynamic address space. */ | ||
1187 | + gcmkONERROR(_FindDynamicSpace(Mmu, &nodeArray, &nodeArraySize)); | ||
1188 | + | ||
1189 | + /* TODO: We only use the largest one for now. */ | ||
1190 | + for (i = 0; i < nodeArraySize; i++) | ||
1191 | { | ||
1192 | - if (!Mmu->mtlbLogical[i]) | ||
1193 | + if (nodeArray[i].entries > numEntries) | ||
1194 | { | ||
1195 | - break; | ||
1196 | + Mmu->dynamicMappingStart = nodeArray[i].start; | ||
1197 | + numEntries = nodeArray[i].entries; | ||
1198 | } | ||
1199 | } | ||
1200 | |||
1201 | - Mmu->dynamicMappingStart = i; | ||
1202 | - | ||
1203 | - /* Number of entries in Master TLB for dynamic mapping. */ | ||
1204 | - numEntries = gcdMMU_MTLB_ENTRY_NUM - i; | ||
1205 | + gckOS_Free(Mmu->os, (gctPOINTER)nodeArray); | ||
1206 | |||
1207 | Mmu->pageTableSize = numEntries * 4096; | ||
1208 | |||
1209 | @@ -545,7 +640,9 @@ _SetupDynamicSpace( | ||
1210 | acquired = gcvTRUE; | ||
1211 | |||
1212 | /* Map to Master TLB. */ | ||
1213 | - for (; i < gcdMMU_MTLB_ENTRY_NUM; i++) | ||
1214 | + for (i = (gctINT)Mmu->dynamicMappingStart; | ||
1215 | + i < (gctINT)Mmu->dynamicMappingStart + numEntries; | ||
1216 | + i++) | ||
1217 | { | ||
1218 | _WritePageEntry(Mmu->mtlbLogical + i, | ||
1219 | physical | ||
1220 | 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 | ||
1221 | index 8a442a2..8b8bbdc 100644 | ||
1222 | --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c | ||
1223 | +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_video_memory.c | ||
1224 | @@ -2144,6 +2144,9 @@ gckVIDMEM_Unlock( | ||
1225 | |||
1226 | if (!Node->Virtual.contiguous | ||
1227 | && (Node->Virtual.lockeds[Kernel->core] == 1) | ||
1228 | +#if gcdENABLE_VG | ||
1229 | + && (Kernel->vg == gcvNULL) | ||
1230 | +#endif | ||
1231 | ) | ||
1232 | { | ||
1233 | if (Type == gcvSURF_BITMAP) | ||
1234 | diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h | ||
1235 | index 7077412..4406d7e 100644 | ||
1236 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h | ||
1237 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal.h | ||
1238 | @@ -2072,6 +2072,12 @@ gckHARDWARE_QueryPowerManagementState( | ||
1239 | OUT gceCHIPPOWERSTATE* State | ||
1240 | ); | ||
1241 | |||
1242 | +gceSTATUS | ||
1243 | +gckHARDWARE_SetPowerManagement( | ||
1244 | + IN gckHARDWARE Hardware, | ||
1245 | + IN gctBOOL PowerManagement | ||
1246 | + ); | ||
1247 | + | ||
1248 | #if gcdENABLE_FSCALE_VAL_ADJUST | ||
1249 | gceSTATUS | ||
1250 | gckHARDWARE_SetFscaleValue( | ||
1251 | 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 | ||
1252 | index ac86399..44689b0 100644 | ||
1253 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h | ||
1254 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h | ||
1255 | @@ -74,7 +74,6 @@ typedef struct _gcsSYNC_CONTEXT * gcsSYNC_CONTEXT_PTR; | ||
1256 | /******************************************************************************\ | ||
1257 | ******************************* Process local storage ************************* | ||
1258 | \******************************************************************************/ | ||
1259 | - | ||
1260 | typedef struct _gcsPLS * gcsPLS_PTR; | ||
1261 | typedef struct _gcsPLS | ||
1262 | { | ||
1263 | @@ -107,6 +106,7 @@ typedef struct _gcsPLS | ||
1264 | |||
1265 | /* Reference count for destructor. */ | ||
1266 | gcsATOM_PTR reference; | ||
1267 | + gctBOOL bKFS; | ||
1268 | #if gcdUSE_NPOT_PATCH | ||
1269 | gctBOOL bNeedSupportNP2Texture; | ||
1270 | #endif | ||
1271 | @@ -123,7 +123,7 @@ extern gcsPLS gcPLS; | ||
1272 | typedef struct _gcsTLS * gcsTLS_PTR; | ||
1273 | |||
1274 | typedef void (* gctTLS_DESTRUCTOR) ( | ||
1275 | - gcsTLS_PTR TLS | ||
1276 | + gcsTLS_PTR | ||
1277 | ); | ||
1278 | |||
1279 | typedef struct _gcsTLS | ||
1280 | @@ -658,8 +658,6 @@ gcoHAL_QueryChipFeature( | ||
1281 | IN gceFEATURE Feature); | ||
1282 | |||
1283 | #endif | ||
1284 | - | ||
1285 | - | ||
1286 | /******************************************************************************\ | ||
1287 | ********************************** gcoOS Object ********************************* | ||
1288 | \******************************************************************************/ | ||
1289 | @@ -1775,20 +1773,6 @@ gcoSURF_QueryVidMemNode( | ||
1290 | OUT gctUINT_PTR Bytes | ||
1291 | ); | ||
1292 | |||
1293 | -/* Set usage attribute of a surface. */ | ||
1294 | -gceSTATUS | ||
1295 | -gcoSURF_SetUsage( | ||
1296 | - IN gcoSURF Surface, | ||
1297 | - IN gceSURF_USAGE Usage | ||
1298 | - ); | ||
1299 | - | ||
1300 | -/* Return usage attribute of a surface. */ | ||
1301 | -gceSTATUS | ||
1302 | -gcoSURF_QueryUsage( | ||
1303 | - IN gcoSURF Surface, | ||
1304 | - OUT gceSURF_USAGE *Usage | ||
1305 | - ); | ||
1306 | - | ||
1307 | /* Set the color type of the surface. */ | ||
1308 | gceSTATUS | ||
1309 | gcoSURF_SetColorType( | ||
1310 | @@ -1975,6 +1959,14 @@ gcoSURF_SetWindow( | ||
1311 | IN gctUINT Height | ||
1312 | ); | ||
1313 | |||
1314 | +/* Set width/height alignment of the surface directly and calculate stride/size. This is only for dri backend now. Please be careful before use. */ | ||
1315 | +gceSTATUS | ||
1316 | +gcoSURF_SetAlignment( | ||
1317 | + IN gcoSURF Surface, | ||
1318 | + IN gctUINT Width, | ||
1319 | + IN gctUINT Height | ||
1320 | + ); | ||
1321 | + | ||
1322 | /* Increase reference count of the surface. */ | ||
1323 | gceSTATUS | ||
1324 | gcoSURF_ReferenceSurface( | ||
1325 | @@ -2009,6 +2001,12 @@ gcoSURF_SetOffset( | ||
1326 | ); | ||
1327 | |||
1328 | gceSTATUS | ||
1329 | +gcoSURF_GetOffset( | ||
1330 | + IN gcoSURF Surface, | ||
1331 | + OUT gctUINT *Offset | ||
1332 | + ); | ||
1333 | + | ||
1334 | +gceSTATUS | ||
1335 | gcoSURF_NODE_Cache( | ||
1336 | IN gcsSURF_NODE_PTR Node, | ||
1337 | IN gctPOINTER Logical, | ||
1338 | 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 | ||
1339 | index 4a0870f..8693c37 100644 | ||
1340 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h | ||
1341 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_compiler.h | ||
1342 | @@ -36,12 +36,16 @@ extern "C" { | ||
1343 | #endif | ||
1344 | |||
1345 | #ifndef GC_ENABLE_LOADTIME_OPT | ||
1346 | -#define GC_ENABLE_LOADTIME_OPT 1 | ||
1347 | +#define GC_ENABLE_LOADTIME_OPT 1 | ||
1348 | #endif | ||
1349 | |||
1350 | #define TEMP_OPT_CONSTANT_TEXLD_COORD 1 | ||
1351 | |||
1352 | -#define TEMP_SHADER_PATCH 1 | ||
1353 | +#define TEMP_SHADER_PATCH 1 | ||
1354 | + | ||
1355 | +#define ADD_PRE_ROTATION_TO_VS 0 | ||
1356 | + | ||
1357 | +#define TEMP_INLINE_ALL_EXPANSION 1 | ||
1358 | /******************************* IR VERSION ******************/ | ||
1359 | #define gcdSL_IR_VERSION gcmCC('\0','\0','\0','\1') | ||
1360 | |||
1361 | @@ -683,6 +687,13 @@ typedef enum _gceSHADER_FLAGS | ||
1362 | gcvSHADER_USE_ALPHA_KILL = 0x100, | ||
1363 | #endif | ||
1364 | |||
1365 | +#if ADD_PRE_ROTATION_TO_VS | ||
1366 | + gcvSHADER_VS_PRE_ROTATION = 0x200, | ||
1367 | +#endif | ||
1368 | + | ||
1369 | +#if TEMP_INLINE_ALL_EXPANSION | ||
1370 | + gcvSHADER_INLINE_ALL_EXPANSION = 0x200, | ||
1371 | +#endif | ||
1372 | } | ||
1373 | gceSHADER_FLAGS; | ||
1374 | |||
1375 | @@ -771,10 +782,15 @@ typedef enum _gceSHADER_OPTIMIZATION | ||
1376 | /* optimize varying packing */ | ||
1377 | gcvOPTIMIZATION_VARYINGPACKING = 1 << 22, | ||
1378 | |||
1379 | +#if TEMP_INLINE_ALL_EXPANSION | ||
1380 | + gcvOPTIMIZATION_INLINE_ALL_EXPANSION = 1 << 23, | ||
1381 | +#endif | ||
1382 | + | ||
1383 | /* Full optimization. */ | ||
1384 | /* Note that gcvOPTIMIZATION_LOAD_SW_WORKAROUND is off. */ | ||
1385 | gcvOPTIMIZATION_FULL = 0x7FFFFFFF & | ||
1386 | ~gcvOPTIMIZATION_LOAD_SW_WORKAROUND & | ||
1387 | + ~gcvOPTIMIZATION_INLINE_ALL_EXPANSION & | ||
1388 | ~gcvOPTIMIZATION_POWER_OPTIMIZATION, | ||
1389 | |||
1390 | /* Optimization Unit Test flag. */ | ||
1391 | 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 | ||
1392 | index 028bbd1..b056c52 100644 | ||
1393 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h | ||
1394 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h | ||
1395 | @@ -210,6 +210,9 @@ typedef struct _gcsHAL_QUERY_CHIP_IDENTITY | ||
1396 | /* Supported minor feature 3 fields. */ | ||
1397 | gctUINT32 chipMinorFeatures3; | ||
1398 | |||
1399 | + /* Supported minor feature 4 fields. */ | ||
1400 | + gctUINT32 chipMinorFeatures4; | ||
1401 | + | ||
1402 | /* Number of streams supported. */ | ||
1403 | gctUINT32 streamCount; | ||
1404 | |||
1405 | @@ -929,30 +932,30 @@ typedef struct _gcsHAL_INTERFACE | ||
1406 | |||
1407 | struct _gcsHAL_GET_SHARED_INFO | ||
1408 | { | ||
1409 | + /* Process id. */ | ||
1410 | IN gctUINT32 pid; | ||
1411 | + | ||
1412 | + /* Data id. */ | ||
1413 | IN gctUINT32 dataId; | ||
1414 | - /* gcuVIDMEM_NODE_PTR */ | ||
1415 | - IN gctUINT64 node; | ||
1416 | - /* gctUINT8_PTR */ | ||
1417 | - OUT gctUINT64 data; | ||
1418 | - /* fix size. gctUINT8_PTR*/ | ||
1419 | - OUT gctUINT64 nodeData; | ||
1420 | - gctUINT64 size; | ||
1421 | - IN gceVIDMEM_NODE_SHARED_INFO_TYPE infoType; | ||
1422 | + | ||
1423 | + /* Data size. */ | ||
1424 | + IN gctSIZE_T bytes; | ||
1425 | + | ||
1426 | + /* Pointer to save the shared data. */ | ||
1427 | + OUT gctPOINTER data; | ||
1428 | } | ||
1429 | GetSharedInfo; | ||
1430 | |||
1431 | struct _gcsHAL_SET_SHARED_INFO | ||
1432 | { | ||
1433 | + /* Data id. */ | ||
1434 | IN gctUINT32 dataId; | ||
1435 | - /* gcuVIDMEM_NODE_PTR */ | ||
1436 | - IN gctUINT64 node; | ||
1437 | - /* gctUINT8_PTR */ | ||
1438 | - IN gctUINT64 data; | ||
1439 | - /* gctUINT8_PTR */ | ||
1440 | - IN gctUINT64 nodeData; | ||
1441 | - IN gctUINT64 size; | ||
1442 | - IN gceVIDMEM_NODE_SHARED_INFO_TYPE infoType; | ||
1443 | + | ||
1444 | + /* Data to be shared. */ | ||
1445 | + IN gctPOINTER data; | ||
1446 | + | ||
1447 | + /* Data size. */ | ||
1448 | + IN gctSIZE_T bytes; | ||
1449 | } | ||
1450 | SetSharedInfo; | ||
1451 | |||
1452 | 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 | ||
1453 | index 249b61b..8481375 100644 | ||
1454 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h | ||
1455 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_engine.h | ||
1456 | @@ -323,50 +323,6 @@ gcoSURF_Resolve( | ||
1457 | IN gcoSURF DestSurface | ||
1458 | ); | ||
1459 | |||
1460 | -/* Export the render target. */ | ||
1461 | -gceSTATUS | ||
1462 | -gcoSURF_ExportRenderTarget( | ||
1463 | - IN gcoSURF SrcSurface | ||
1464 | -); | ||
1465 | - | ||
1466 | -/* Import the render target. */ | ||
1467 | -gceSTATUS | ||
1468 | -gcoSURF_ImportRenderTarget( | ||
1469 | - IN gctUINT32 Pid, | ||
1470 | - IN gcoSURF SrcSurface | ||
1471 | -); | ||
1472 | - | ||
1473 | -/* Save the Resolve info to kernel. */ | ||
1474 | -gceSTATUS | ||
1475 | -gcoSURF_PrepareRemoteResolveRect( | ||
1476 | - IN gcoSURF SrcSurface, | ||
1477 | - IN gcsPOINT_PTR SrcOrigin, | ||
1478 | - IN gcsPOINT_PTR DestOrigin, | ||
1479 | - IN gcsPOINT_PTR RectSize | ||
1480 | - ); | ||
1481 | - | ||
1482 | -/* Resolve using the rectangle info previously saved in the vid mem node. */ | ||
1483 | -gceSTATUS | ||
1484 | -gcoSURF_ResolveFromStoredRect( | ||
1485 | - IN gcoSURF SrcSurface, | ||
1486 | - IN gcoSURF DestSurface | ||
1487 | - ); | ||
1488 | - | ||
1489 | -/* Using the info that Process Pid saved to do resolve. */ | ||
1490 | -gceSTATUS | ||
1491 | -gcoSURF_RemoteResolveRect( | ||
1492 | - IN gcoSURF SrcSurface, | ||
1493 | - IN gcoSURF DestSurface, | ||
1494 | - IN gctBOOL *resolveDiscarded | ||
1495 | - ); | ||
1496 | - | ||
1497 | -/* Return the "resolve submitted indicator" signal. */ | ||
1498 | -gceSTATUS | ||
1499 | -gcoSURF_GetRTSignal( | ||
1500 | - IN gcoSURF RTSurface, | ||
1501 | - OUT gctSIGNAL * resolveSubmittedSignal | ||
1502 | - ); | ||
1503 | - | ||
1504 | /* Resolve rectangular area of a surface. */ | ||
1505 | gceSTATUS | ||
1506 | gcoSURF_ResolveRect( | ||
1507 | @@ -1684,6 +1640,12 @@ gcoTEXTURE_IsRenderable( | ||
1508 | ); | ||
1509 | |||
1510 | gceSTATUS | ||
1511 | +gcoTEXTURE_IsRenderableEx( | ||
1512 | + IN gcoTEXTURE Texture, | ||
1513 | + IN gctUINT Level | ||
1514 | + ); | ||
1515 | + | ||
1516 | +gceSTATUS | ||
1517 | gcoTEXTURE_IsComplete( | ||
1518 | IN gcoTEXTURE Texture, | ||
1519 | IN gctINT MaxLevel | ||
1520 | @@ -2028,21 +1990,15 @@ gceSTATUS | ||
1521 | gcoHAL_GetSharedInfo( | ||
1522 | IN gctUINT32 Pid, | ||
1523 | IN gctUINT32 DataId, | ||
1524 | - OUT gctUINT8_PTR Data, | ||
1525 | IN gctSIZE_T Bytes, | ||
1526 | - IN gctUINT64 Node, | ||
1527 | - OUT gctUINT8_PTR NodeData, | ||
1528 | - IN gceVIDMEM_NODE_SHARED_INFO_TYPE SharedInfoType | ||
1529 | + OUT gctPOINTER Data | ||
1530 | ); | ||
1531 | |||
1532 | gceSTATUS | ||
1533 | gcoHAL_SetSharedInfo( | ||
1534 | IN gctUINT32 DataId, | ||
1535 | - IN gctUINT8_PTR Data, | ||
1536 | - IN gctSIZE_T Bytes, | ||
1537 | - IN gctUINT64 Node, | ||
1538 | - IN gctUINT8_PTR NodeData, | ||
1539 | - IN gceVIDMEM_NODE_SHARED_INFO_TYPE SharedInfoType | ||
1540 | + IN gctPOINTER Data, | ||
1541 | + IN gctSIZE_T Bytes | ||
1542 | ); | ||
1543 | |||
1544 | #ifdef __cplusplus | ||
1545 | diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h | ||
1546 | index cf6b425..a1d9ae5 100644 | ||
1547 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h | ||
1548 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_enum.h | ||
1549 | @@ -181,13 +181,6 @@ typedef enum _gceCACHEOPERATION | ||
1550 | } | ||
1551 | gceCACHEOPERATION; | ||
1552 | |||
1553 | -typedef enum _gceVIDMEM_NODE_SHARED_INFO_TYPE | ||
1554 | -{ | ||
1555 | - gcvVIDMEM_INFO_GENERIC, | ||
1556 | - gcvVIDMEM_INFO_DIRTY_RECTANGLE | ||
1557 | -} | ||
1558 | -gceVIDMEM_NODE_SHARED_INFO_TYPE; | ||
1559 | - | ||
1560 | /* Surface types. */ | ||
1561 | typedef enum _gceSURF_TYPE | ||
1562 | { | ||
1563 | 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 | ||
1564 | index afe83d0..9e2a8db 100644 | ||
1565 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | ||
1566 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_options.h | ||
1567 | @@ -391,15 +391,6 @@ | ||
1568 | #endif | ||
1569 | |||
1570 | /* | ||
1571 | - gcdPOWER_MANAGEMENT | ||
1572 | - | ||
1573 | - This define enables the power management code. | ||
1574 | -*/ | ||
1575 | -#ifndef gcdPOWER_MANAGEMENT | ||
1576 | -# define gcdPOWER_MANAGEMENT 1 | ||
1577 | -#endif | ||
1578 | - | ||
1579 | -/* | ||
1580 | gcdPOWER_SUSNPEND_WHEN_IDLE | ||
1581 | |||
1582 | Set to 1 to make GPU enter gcvPOWER_SUSPEND when idle detected, | ||
1583 | @@ -428,7 +419,7 @@ | ||
1584 | If the value is 0, no timeout will be checked for. | ||
1585 | */ | ||
1586 | #ifndef gcdGPU_TIMEOUT | ||
1587 | -# if gcdFPGA_BUILD | ||
1588 | +#if gcdFPGA_BUILD | ||
1589 | # define gcdGPU_TIMEOUT 0 | ||
1590 | # else | ||
1591 | # define gcdGPU_TIMEOUT 20000 | ||
1592 | @@ -726,31 +717,13 @@ | ||
1593 | |||
1594 | Support swap with a specific rectangle. | ||
1595 | |||
1596 | - Set the rectangle with eglSetSwapRectangleANDROID api. | ||
1597 | + Set the rectangle with eglSetSwapRectangleVIV api. | ||
1598 | */ | ||
1599 | #ifndef gcdSUPPORT_SWAP_RECTANGLE | ||
1600 | # define gcdSUPPORT_SWAP_RECTANGLE 0 | ||
1601 | #endif | ||
1602 | |||
1603 | /* | ||
1604 | - gcdDEFER_RESOLVES | ||
1605 | - | ||
1606 | - Support deferred resolves for 3D apps. | ||
1607 | -*/ | ||
1608 | -#ifndef gcdDEFER_RESOLVES | ||
1609 | -# define gcdDEFER_RESOLVES 0 | ||
1610 | -#endif | ||
1611 | - | ||
1612 | -/* | ||
1613 | - gcdCOPYBLT_OPTIMIZATION | ||
1614 | - | ||
1615 | - Combine dirty areas resulting from Android's copyBlt. | ||
1616 | -*/ | ||
1617 | -#ifndef gcdCOPYBLT_OPTIMIZATION | ||
1618 | -# define gcdCOPYBLT_OPTIMIZATION 0 | ||
1619 | -#endif | ||
1620 | - | ||
1621 | -/* | ||
1622 | gcdGPU_LINEAR_BUFFER_ENABLED | ||
1623 | |||
1624 | Use linear buffer for GPU apps so HWC can do 2D composition. | ||
1625 | 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 | ||
1626 | index 808fde0..03cb4d6 100644 | ||
1627 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h | ||
1628 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_version.h | ||
1629 | @@ -28,7 +28,7 @@ | ||
1630 | |||
1631 | #define gcvVERSION_PATCH 9 | ||
1632 | |||
1633 | -#define gcvVERSION_BUILD 4651 | ||
1634 | +#define gcvVERSION_BUILD 6622 | ||
1635 | |||
1636 | #define gcvVERSION_DATE __DATE__ | ||
1637 | |||
1638 | diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h | ||
1639 | index 5ff0281..2a910e8 100644 | ||
1640 | --- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h | ||
1641 | +++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_vg.h | ||
1642 | @@ -552,6 +552,12 @@ gckVGHARDWARE_QueryPowerManagementState( | ||
1643 | ); | ||
1644 | |||
1645 | gceSTATUS | ||
1646 | +gckVGHARDWARE_SetPowerManagement( | ||
1647 | + IN gckVGHARDWARE Hardware, | ||
1648 | + IN gctBOOL PowerManagement | ||
1649 | + ); | ||
1650 | + | ||
1651 | +gceSTATUS | ||
1652 | gckVGHARDWARE_SetPowerOffTimeout( | ||
1653 | IN gckVGHARDWARE Hardware, | ||
1654 | IN gctUINT32 Timeout | ||
1655 | diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c | ||
1656 | index 7168f0e..168987a 100644 | ||
1657 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c | ||
1658 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.c | ||
1659 | @@ -304,6 +304,7 @@ gckGALDEVICE_Construct( | ||
1660 | IN gctINT Signal, | ||
1661 | IN gctUINT LogFileSize, | ||
1662 | IN struct device *pdev, | ||
1663 | + IN gctINT PowerManagement, | ||
1664 | OUT gckGALDEVICE *Device | ||
1665 | ) | ||
1666 | { | ||
1667 | @@ -538,6 +539,9 @@ gckGALDEVICE_Construct( | ||
1668 | device->kernels[gcvCORE_MAJOR]->hardware, FastClear, Compression | ||
1669 | )); | ||
1670 | |||
1671 | + gcmkONERROR(gckHARDWARE_SetPowerManagement( | ||
1672 | + device->kernels[gcvCORE_MAJOR]->hardware, PowerManagement | ||
1673 | + )); | ||
1674 | |||
1675 | #if COMMAND_PROCESSOR_VERSION == 1 | ||
1676 | /* Start the command queue. */ | ||
1677 | @@ -593,6 +597,10 @@ gckGALDEVICE_Construct( | ||
1678 | device | ||
1679 | )); | ||
1680 | |||
1681 | + gcmkONERROR(gckHARDWARE_SetPowerManagement( | ||
1682 | + device->kernels[gcvCORE_2D]->hardware, PowerManagement | ||
1683 | + )); | ||
1684 | + | ||
1685 | #if COMMAND_PROCESSOR_VERSION == 1 | ||
1686 | /* Start the command queue. */ | ||
1687 | gcmkONERROR(gckCOMMAND_Start(device->kernels[gcvCORE_2D]->command)); | ||
1688 | @@ -624,6 +632,11 @@ gckGALDEVICE_Construct( | ||
1689 | device->coreMapping[gcvHARDWARE_VG] = gcvCORE_VG; | ||
1690 | } | ||
1691 | |||
1692 | + | ||
1693 | + gcmkONERROR(gckVGHARDWARE_SetPowerManagement( | ||
1694 | + device->kernels[gcvCORE_VG]->vg->hardware, | ||
1695 | + PowerManagement | ||
1696 | + )); | ||
1697 | #endif | ||
1698 | } | ||
1699 | else | ||
1700 | diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h | ||
1701 | index 460f022..d488fc8 100644 | ||
1702 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h | ||
1703 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_device.h | ||
1704 | @@ -169,6 +169,7 @@ gceSTATUS gckGALDEVICE_Construct( | ||
1705 | IN gctINT Signal, | ||
1706 | IN gctUINT LogFileSize, | ||
1707 | IN struct device *pdev, | ||
1708 | + IN gctINT PowerManagement, | ||
1709 | OUT gckGALDEVICE *Device | ||
1710 | ); | ||
1711 | |||
1712 | 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 | ||
1713 | index 64cace1..183000d 100644 | ||
1714 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | ||
1715 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | ||
1716 | @@ -131,6 +131,9 @@ module_param(fastClear, int, 0644); | ||
1717 | static int compression = -1; | ||
1718 | module_param(compression, int, 0644); | ||
1719 | |||
1720 | +static int powerManagement = 1; | ||
1721 | +module_param(powerManagement, int, 0644); | ||
1722 | + | ||
1723 | static int signal = 48; | ||
1724 | module_param(signal, int, 0644); | ||
1725 | |||
1726 | @@ -781,6 +784,9 @@ static int drv_init(struct device *pdev) | ||
1727 | } | ||
1728 | #endif | ||
1729 | |||
1730 | + printk(KERN_INFO "Galcore version %d.%d.%d.%d\n", | ||
1731 | + gcvVERSION_MAJOR, gcvVERSION_MINOR, gcvVERSION_PATCH, gcvVERSION_BUILD); | ||
1732 | + | ||
1733 | if (showArgs) | ||
1734 | { | ||
1735 | printk("galcore options:\n"); | ||
1736 | @@ -810,7 +816,8 @@ static int drv_init(struct device *pdev) | ||
1737 | printk(" signal = %d\n", signal); | ||
1738 | printk(" baseAddress = 0x%08lX\n", baseAddress); | ||
1739 | printk(" physSize = 0x%08lX\n", physSize); | ||
1740 | - printk(" logFileSize = %d KB \n", logFileSize); | ||
1741 | + printk(" logFileSize = %d KB \n", logFileSize); | ||
1742 | + printk(" powerManagement = %d\n", powerManagement); | ||
1743 | #if ENABLE_GPU_CLOCK_BY_DRIVER | ||
1744 | printk(" coreClock = %lu\n", coreClock); | ||
1745 | #endif | ||
1746 | @@ -833,6 +840,7 @@ static int drv_init(struct device *pdev) | ||
1747 | bankSize, fastClear, compression, baseAddress, physSize, signal, | ||
1748 | logFileSize, | ||
1749 | pdev, | ||
1750 | + powerManagement, | ||
1751 | &device | ||
1752 | )); | ||
1753 | |||
1754 | 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 | ||
1755 | index dfbc699..6a0295d 100644 | ||
1756 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | ||
1757 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c | ||
1758 | @@ -55,6 +55,7 @@ const char * _PLATFORM = "\n\0$PLATFORM$Linux$\n"; | ||
1759 | #endif | ||
1760 | |||
1761 | #define USER_SIGNAL_TABLE_LEN_INIT 64 | ||
1762 | +#define gcdSUPPRESS_OOM_MESSAGE 1 | ||
1763 | |||
1764 | #define MEMORY_LOCK(os) \ | ||
1765 | gcmkVERIFY_OK(gckOS_AcquireMutex( \ | ||
1766 | @@ -85,6 +86,12 @@ const char * _PLATFORM = "\n\0$PLATFORM$Linux$\n"; | ||
1767 | #define gcmkNONPAGED_MEMROY_PROT(x) pgprot_noncached(x) | ||
1768 | #endif | ||
1769 | |||
1770 | +#if gcdSUPPRESS_OOM_MESSAGE | ||
1771 | +#define gcdNOWARN __GFP_NOWARN | ||
1772 | +#else | ||
1773 | +#define gcdNOWARN 0 | ||
1774 | +#endif | ||
1775 | + | ||
1776 | #define gcdINFINITE_TIMEOUT (60 * 1000) | ||
1777 | #define gcdDETECT_TIMEOUT 0 | ||
1778 | #define gcdDETECT_DMA_ADDRESS 1 | ||
1779 | @@ -261,7 +268,7 @@ _CreateMdl( | ||
1780 | |||
1781 | gcmkHEADER_ARG("ProcessID=%d", ProcessID); | ||
1782 | |||
1783 | - mdl = (PLINUX_MDL)kzalloc(sizeof(struct _LINUX_MDL), GFP_KERNEL | __GFP_NOWARN); | ||
1784 | + mdl = (PLINUX_MDL)kzalloc(sizeof(struct _LINUX_MDL), GFP_KERNEL | gcdNOWARN); | ||
1785 | if (mdl == gcvNULL) | ||
1786 | { | ||
1787 | gcmkFOOTER_NO(); | ||
1788 | @@ -322,7 +329,7 @@ _CreateMdlMap( | ||
1789 | |||
1790 | gcmkHEADER_ARG("Mdl=0x%X ProcessID=%d", Mdl, ProcessID); | ||
1791 | |||
1792 | - mdlMap = (PLINUX_MDL_MAP)kmalloc(sizeof(struct _LINUX_MDL_MAP), GFP_KERNEL | __GFP_NOWARN); | ||
1793 | + mdlMap = (PLINUX_MDL_MAP)kmalloc(sizeof(struct _LINUX_MDL_MAP), GFP_KERNEL | gcdNOWARN); | ||
1794 | if (mdlMap == gcvNULL) | ||
1795 | { | ||
1796 | gcmkFOOTER_NO(); | ||
1797 | @@ -481,7 +488,7 @@ _NonContiguousAlloc( | ||
1798 | |||
1799 | size = NumPages * sizeof(struct page *); | ||
1800 | |||
1801 | - pages = kmalloc(size, GFP_KERNEL | __GFP_NOWARN); | ||
1802 | + pages = kmalloc(size, GFP_KERNEL | gcdNOWARN); | ||
1803 | |||
1804 | if (!pages) | ||
1805 | { | ||
1806 | @@ -496,7 +503,7 @@ _NonContiguousAlloc( | ||
1807 | |||
1808 | for (i = 0; i < NumPages; i++) | ||
1809 | { | ||
1810 | - p = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | __GFP_NOWARN); | ||
1811 | + p = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | gcdNOWARN); | ||
1812 | |||
1813 | if (!p) | ||
1814 | { | ||
1815 | @@ -762,7 +769,7 @@ _AllocateIntegerId( | ||
1816 | int result; | ||
1817 | |||
1818 | again: | ||
1819 | - if (idr_pre_get(&Database->idr, GFP_KERNEL | __GFP_NOWARN) == 0) | ||
1820 | + if (idr_pre_get(&Database->idr, GFP_KERNEL | gcdNOWARN) == 0) | ||
1821 | { | ||
1822 | return gcvSTATUS_OUT_OF_MEMORY; | ||
1823 | } | ||
1824 | @@ -954,7 +961,7 @@ gckOS_Construct( | ||
1825 | gcmkVERIFY_ARGUMENT(Os != gcvNULL); | ||
1826 | |||
1827 | /* Allocate the gckOS object. */ | ||
1828 | - os = (gckOS) kmalloc(gcmSIZEOF(struct _gckOS), GFP_KERNEL | __GFP_NOWARN); | ||
1829 | + os = (gckOS) kmalloc(gcmSIZEOF(struct _gckOS), GFP_KERNEL | gcdNOWARN); | ||
1830 | |||
1831 | if (os == gcvNULL) | ||
1832 | { | ||
1833 | @@ -1171,7 +1178,7 @@ _CreateKernelVirtualMapping( | ||
1834 | |||
1835 | if (Mdl->contiguous) | ||
1836 | { | ||
1837 | - pages = kmalloc(sizeof(struct page *) * numPages, GFP_KERNEL | __GFP_NOWARN); | ||
1838 | + pages = kmalloc(sizeof(struct page *) * numPages, GFP_KERNEL | gcdNOWARN); | ||
1839 | |||
1840 | if (!pages) | ||
1841 | { | ||
1842 | @@ -1385,7 +1392,7 @@ gckOS_AllocateMemory( | ||
1843 | } | ||
1844 | else | ||
1845 | { | ||
1846 | - memory = (gctPOINTER) kmalloc(Bytes, GFP_KERNEL | __GFP_NOWARN); | ||
1847 | + memory = (gctPOINTER) kmalloc(Bytes, GFP_KERNEL | gcdNOWARN); | ||
1848 | } | ||
1849 | |||
1850 | if (memory == gcvNULL) | ||
1851 | @@ -1904,7 +1911,7 @@ gckOS_AllocateNonPagedMemory( | ||
1852 | addr = dma_alloc_coherent(gcvNULL, | ||
1853 | mdl->numPages * PAGE_SIZE, | ||
1854 | &mdl->dmaHandle, | ||
1855 | - GFP_KERNEL | __GFP_NOWARN); | ||
1856 | + GFP_KERNEL | gcdNOWARN); | ||
1857 | } | ||
1858 | #else | ||
1859 | size = mdl->numPages * PAGE_SIZE; | ||
1860 | @@ -1915,7 +1922,7 @@ gckOS_AllocateNonPagedMemory( | ||
1861 | if (page == gcvNULL) | ||
1862 | #endif | ||
1863 | { | ||
1864 | - page = alloc_pages(GFP_KERNEL | __GFP_NOWARN, order); | ||
1865 | + page = alloc_pages(GFP_KERNEL | gcdNOWARN, order); | ||
1866 | } | ||
1867 | |||
1868 | if (page == gcvNULL) | ||
1869 | @@ -3848,6 +3855,9 @@ gckOS_AllocatePagedMemoryEx( | ||
1870 | gctSIZE_T bytes; | ||
1871 | gctBOOL locked = gcvFALSE; | ||
1872 | gceSTATUS status; | ||
1873 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
1874 | + gctPOINTER addr = gcvNULL; | ||
1875 | +#endif | ||
1876 | |||
1877 | gcmkHEADER_ARG("Os=0x%X Contiguous=%d Bytes=%lu", Os, Contiguous, Bytes); | ||
1878 | |||
1879 | @@ -3873,13 +3883,27 @@ gckOS_AllocatePagedMemoryEx( | ||
1880 | { | ||
1881 | /* Get contiguous pages, and suppress warning (stack dump) from kernel when | ||
1882 | we run out of memory. */ | ||
1883 | - mdl->u.contiguousPages = | ||
1884 | - alloc_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY, GetOrder(numPages)); | ||
1885 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
1886 | + addr = | ||
1887 | + alloc_pages_exact(numPages * PAGE_SIZE, GFP_KERNEL | gcdNOWARN | __GFP_NORETRY); | ||
1888 | |||
1889 | + mdl->u.contiguousPages = addr | ||
1890 | + ? virt_to_page(addr) | ||
1891 | + : gcvNULL; | ||
1892 | + | ||
1893 | + mdl->exact = gcvTRUE; | ||
1894 | +#else | ||
1895 | + mdl->u.contiguousPages = | ||
1896 | + alloc_pages(GFP_KERNEL | gcdNOWARN | __GFP_NORETRY, GetOrder(numPages)); | ||
1897 | +#endif | ||
1898 | if (mdl->u.contiguousPages == gcvNULL) | ||
1899 | { | ||
1900 | mdl->u.contiguousPages = | ||
1901 | - alloc_pages(GFP_KERNEL | __GFP_HIGHMEM | __GFP_NOWARN, GetOrder(numPages)); | ||
1902 | + alloc_pages(GFP_KERNEL | __GFP_HIGHMEM | gcdNOWARN, GetOrder(numPages)); | ||
1903 | + | ||
1904 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
1905 | + mdl->exact = gcvFALSE; | ||
1906 | +#endif | ||
1907 | } | ||
1908 | } | ||
1909 | else | ||
1910 | @@ -4024,7 +4048,16 @@ gckOS_FreePagedMemory( | ||
1911 | |||
1912 | if (mdl->contiguous) | ||
1913 | { | ||
1914 | - __free_pages(mdl->u.contiguousPages, GetOrder(mdl->numPages)); | ||
1915 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
1916 | + if (mdl->exact == gcvTRUE) | ||
1917 | + { | ||
1918 | + free_pages_exact(page_address(mdl->u.contiguousPages), mdl->numPages * PAGE_SIZE); | ||
1919 | + } | ||
1920 | + else | ||
1921 | +#endif | ||
1922 | + { | ||
1923 | + __free_pages(mdl->u.contiguousPages, GetOrder(mdl->numPages)); | ||
1924 | + } | ||
1925 | } | ||
1926 | else | ||
1927 | { | ||
1928 | @@ -4859,7 +4892,7 @@ gckOS_MapUserPointer( | ||
1929 | gcmkVERIFY_ARGUMENT(Size > 0); | ||
1930 | gcmkVERIFY_ARGUMENT(KernelPointer != gcvNULL); | ||
1931 | |||
1932 | - buf = kmalloc(Size, GFP_KERNEL | __GFP_NOWARN); | ||
1933 | + buf = kmalloc(Size, GFP_KERNEL | gcdNOWARN); | ||
1934 | if (buf == gcvNULL) | ||
1935 | { | ||
1936 | gcmkTRACE( | ||
1937 | @@ -5274,7 +5307,7 @@ OnError: | ||
1938 | MEMORY_MAP_LOCK(Os); | ||
1939 | |||
1940 | /* Allocate the Info struct. */ | ||
1941 | - info = (gcsPageInfo_PTR)kmalloc(sizeof(gcsPageInfo), GFP_KERNEL | __GFP_NOWARN); | ||
1942 | + info = (gcsPageInfo_PTR)kmalloc(sizeof(gcsPageInfo), GFP_KERNEL | gcdNOWARN); | ||
1943 | |||
1944 | if (info == gcvNULL) | ||
1945 | { | ||
1946 | @@ -5283,7 +5316,7 @@ OnError: | ||
1947 | } | ||
1948 | |||
1949 | /* Allocate the array of page addresses. */ | ||
1950 | - pages = (struct page **)kmalloc(pageCount * sizeof(struct page *), GFP_KERNEL | __GFP_NOWARN); | ||
1951 | + pages = (struct page **)kmalloc(pageCount * sizeof(struct page *), GFP_KERNEL | gcdNOWARN); | ||
1952 | |||
1953 | if (pages == gcvNULL) | ||
1954 | { | ||
1955 | @@ -6502,7 +6535,7 @@ gckOS_CreateSemaphore( | ||
1956 | gcmkVERIFY_ARGUMENT(Semaphore != gcvNULL); | ||
1957 | |||
1958 | /* Allocate the semaphore structure. */ | ||
1959 | - sem = (struct semaphore *)kmalloc(gcmSIZEOF(struct semaphore), GFP_KERNEL | __GFP_NOWARN); | ||
1960 | + sem = (struct semaphore *)kmalloc(gcmSIZEOF(struct semaphore), GFP_KERNEL | gcdNOWARN); | ||
1961 | if (sem == gcvNULL) | ||
1962 | { | ||
1963 | gcmkONERROR(gcvSTATUS_OUT_OF_MEMORY); | ||
1964 | @@ -6942,6 +6975,7 @@ gckOS_SetGPUPower( | ||
1965 | #else | ||
1966 | imx_gpc_power_up_pu(false); | ||
1967 | #endif | ||
1968 | + | ||
1969 | } | ||
1970 | /* TODO: Put your code here. */ | ||
1971 | gcmkFOOTER_NO(); | ||
1972 | @@ -7255,7 +7289,7 @@ gckOS_CreateSignal( | ||
1973 | gcmkVERIFY_ARGUMENT(Signal != gcvNULL); | ||
1974 | |||
1975 | /* Create an event structure. */ | ||
1976 | - signal = (gcsSIGNAL_PTR) kmalloc(sizeof(gcsSIGNAL), GFP_KERNEL | __GFP_NOWARN); | ||
1977 | + signal = (gcsSIGNAL_PTR) kmalloc(sizeof(gcsSIGNAL), GFP_KERNEL | gcdNOWARN); | ||
1978 | |||
1979 | if (signal == gcvNULL) | ||
1980 | { | ||
1981 | @@ -8000,7 +8034,7 @@ gckOS_CreateSemaphoreVG( | ||
1982 | do | ||
1983 | { | ||
1984 | /* Allocate the semaphore structure. */ | ||
1985 | - newSemaphore = (struct semaphore *)kmalloc(gcmSIZEOF(struct semaphore), GFP_KERNEL | __GFP_NOWARN); | ||
1986 | + newSemaphore = (struct semaphore *)kmalloc(gcmSIZEOF(struct semaphore), GFP_KERNEL | gcdNOWARN); | ||
1987 | if (newSemaphore == gcvNULL) | ||
1988 | { | ||
1989 | gcmkERR_BREAK(gcvSTATUS_OUT_OF_MEMORY); | ||
1990 | diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h | ||
1991 | index e970477..006632c 100644 | ||
1992 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h | ||
1993 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.h | ||
1994 | @@ -54,6 +54,9 @@ typedef struct _LINUX_MDL | ||
1995 | gctINT numPages; | ||
1996 | gctINT pagedMem; | ||
1997 | gctBOOL contiguous; | ||
1998 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) | ||
1999 | + gctBOOL exact; | ||
2000 | +#endif | ||
2001 | dma_addr_t dmaHandle; | ||
2002 | PLINUX_MDL_MAP maps; | ||
2003 | struct _LINUX_MDL * prev; | ||
2004 | -- | ||
2005 | 1.8.3.2 | ||
2006 | |||
diff --git a/recipes-kernel/linux/linux-wandboard-3.0.35/0005-ENGR00264275-GPU-Correct-suspend-resume-calling-afte.patch b/recipes-kernel/linux/linux-wandboard-3.0.35/0005-ENGR00264275-GPU-Correct-suspend-resume-calling-afte.patch new file mode 100644 index 0000000..fa937e4 --- /dev/null +++ b/recipes-kernel/linux/linux-wandboard-3.0.35/0005-ENGR00264275-GPU-Correct-suspend-resume-calling-afte.patch | |||
@@ -0,0 +1,61 @@ | |||
1 | From a845abe4589366d3e37b5a646be6337984074b28 Mon Sep 17 00:00:00 2001 | ||
2 | From: Loren HUANG <b02279@freescale.com> | ||
3 | Date: Wed, 22 May 2013 17:21:30 +0800 | ||
4 | Subject: [PATCH 5/6] ENGR00264275 [GPU]Correct suspend/resume calling after | ||
5 | adding runtime pm. | ||
6 | |||
7 | After enabling runtime pm the suspend/resume entry is changed. | ||
8 | |||
9 | -Add new entry for suspend/resume in runtime pm frame work. | ||
10 | -Add static define for all runtime pm function. | ||
11 | |||
12 | Upstream-Status: Backport [3.5.7-1.0.0] | ||
13 | |||
14 | Signed-off-by: Loren HUANG <b02279@freescale.com> | ||
15 | Acked-by: Lily Zhang | ||
16 | --- | ||
17 | .../gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | 16 ++++++++++++++-- | ||
18 | 1 file changed, 14 insertions(+), 2 deletions(-) | ||
19 | |||
20 | 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 | ||
21 | index 183000d..3632a6c 100644 | ||
22 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | ||
23 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | ||
24 | @@ -1252,20 +1252,32 @@ static const struct of_device_id mxs_gpu_dt_ids[] = { | ||
25 | MODULE_DEVICE_TABLE(of, mxs_gpu_dt_ids); | ||
26 | |||
27 | #ifdef CONFIG_PM | ||
28 | -int gpu_runtime_suspend(struct device *dev) | ||
29 | +static int gpu_runtime_suspend(struct device *dev) | ||
30 | { | ||
31 | release_bus_freq(BUS_FREQ_HIGH); | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | -int gpu_runtime_resume(struct device *dev) | ||
36 | +static int gpu_runtime_resume(struct device *dev) | ||
37 | { | ||
38 | request_bus_freq(BUS_FREQ_HIGH); | ||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | +static int gpu_system_suspend(struct device *dev) | ||
43 | +{ | ||
44 | + pm_message_t state={0}; | ||
45 | + return gpu_suspend(to_platform_device(dev), state); | ||
46 | +} | ||
47 | + | ||
48 | +static int gpu_system_resume(struct device *dev) | ||
49 | +{ | ||
50 | + return gpu_resume(to_platform_device(dev)); | ||
51 | +} | ||
52 | + | ||
53 | static const struct dev_pm_ops gpu_pm_ops = { | ||
54 | SET_RUNTIME_PM_OPS(gpu_runtime_suspend, gpu_runtime_resume, NULL) | ||
55 | + SET_SYSTEM_SLEEP_PM_OPS(gpu_system_suspend, gpu_system_resume) | ||
56 | }; | ||
57 | #endif | ||
58 | #endif | ||
59 | -- | ||
60 | 1.8.3.2 | ||
61 | |||
diff --git a/recipes-kernel/linux/linux-wandboard-3.0.35/0006-ENGR00265130-gpu-Correct-section-mismatch-in-gpu-ker.patch b/recipes-kernel/linux/linux-wandboard-3.0.35/0006-ENGR00265130-gpu-Correct-section-mismatch-in-gpu-ker.patch new file mode 100644 index 0000000..43407a1 --- /dev/null +++ b/recipes-kernel/linux/linux-wandboard-3.0.35/0006-ENGR00265130-gpu-Correct-section-mismatch-in-gpu-ker.patch | |||
@@ -0,0 +1,60 @@ | |||
1 | From 376d63e9b981118f83646a836ce6626e541de1a3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Loren HUANG <b02279@freescale.com> | ||
3 | Date: Fri, 31 May 2013 18:29:58 +0800 | ||
4 | Subject: [PATCH 6/6] ENGR00265130 gpu:Correct section mismatch in gpu kernel | ||
5 | driver | ||
6 | |||
7 | -Remove the __devinit for suspend/resume function. | ||
8 | -Replace __devinit to __devexit for remove function. | ||
9 | |||
10 | Upstream-Status: Backport [3.5.7-1.0.0] | ||
11 | |||
12 | Signed-off-by: Loren HUANG <b02279@freescale.com> | ||
13 | Acked-by: Lily Zhang | ||
14 | --- | ||
15 | drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | 8 ++++---- | ||
16 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
17 | |||
18 | 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 | ||
19 | index 3632a6c..9d9dc57 100644 | ||
20 | --- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | ||
21 | +++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c | ||
22 | @@ -1111,7 +1111,7 @@ static int __devinit gpu_probe(struct platform_device *pdev) | ||
23 | return ret; | ||
24 | } | ||
25 | |||
26 | -static int __devinit gpu_remove(struct platform_device *pdev) | ||
27 | +static int __devexit gpu_remove(struct platform_device *pdev) | ||
28 | { | ||
29 | gcmkHEADER(); | ||
30 | #if gcdENABLE_FSCALE_VAL_ADJUST | ||
31 | @@ -1123,7 +1123,7 @@ static int __devinit gpu_remove(struct platform_device *pdev) | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | -static int __devinit gpu_suspend(struct platform_device *dev, pm_message_t state) | ||
36 | +static int gpu_suspend(struct platform_device *dev, pm_message_t state) | ||
37 | { | ||
38 | gceSTATUS status; | ||
39 | gckGALDEVICE device; | ||
40 | @@ -1173,7 +1173,7 @@ static int __devinit gpu_suspend(struct platform_device *dev, pm_message_t state | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | -static int __devinit gpu_resume(struct platform_device *dev) | ||
45 | +static int gpu_resume(struct platform_device *dev) | ||
46 | { | ||
47 | gceSTATUS status; | ||
48 | gckGALDEVICE device; | ||
49 | @@ -1284,7 +1284,7 @@ static const struct dev_pm_ops gpu_pm_ops = { | ||
50 | |||
51 | static struct platform_driver gpu_driver = { | ||
52 | .probe = gpu_probe, | ||
53 | - .remove = gpu_remove, | ||
54 | + .remove = __devexit_p(gpu_remove), | ||
55 | |||
56 | .suspend = gpu_suspend, | ||
57 | .resume = gpu_resume, | ||
58 | -- | ||
59 | 1.8.3.2 | ||
60 | |||
diff --git a/recipes-kernel/linux/linux-wandboard-3.0.35/defconfig b/recipes-kernel/linux/linux-wandboard-3.0.35/defconfig new file mode 100644 index 0000000..dae399a --- /dev/null +++ b/recipes-kernel/linux/linux-wandboard-3.0.35/defconfig | |||
@@ -0,0 +1,242 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_LOCALVERSION="-wandboard+yocto" | ||
3 | CONFIG_DEFAULT_HOSTNAME="wandboard" | ||
4 | # CONFIG_SWAP is not set | ||
5 | CONFIG_SYSVIPC=y | ||
6 | CONFIG_FHANDLE=y | ||
7 | CONFIG_LOG_BUF_SHIFT=14 | ||
8 | CONFIG_CGROUPS=y | ||
9 | CONFIG_BLK_DEV_INITRD=y | ||
10 | CONFIG_EMBEDDED=y | ||
11 | CONFIG_PERF_EVENTS=y | ||
12 | # CONFIG_VM_EVENT_COUNTERS is not set | ||
13 | CONFIG_MODULES=y | ||
14 | CONFIG_MODULE_FORCE_LOAD=y | ||
15 | CONFIG_MODULE_UNLOAD=y | ||
16 | CONFIG_MODVERSIONS=y | ||
17 | # CONFIG_BLK_DEV_BSG is not set | ||
18 | CONFIG_ARCH_MXC=y | ||
19 | CONFIG_ARCH_MX6=y | ||
20 | CONFIG_FORCE_MAX_ZONEORDER=14 | ||
21 | CONFIG_MACH_WANDBOARD=y | ||
22 | CONFIG_EXPANSION_FWBADAPT=y | ||
23 | CONFIG_IMX_PCIE=y | ||
24 | CONFIG_USB_EHCI_ARC_H1=y | ||
25 | CONFIG_USB_FSL_ARC_OTG=y | ||
26 | CONFIG_CLK_DEBUG=y | ||
27 | CONFIG_DMA_ZONE_SIZE=184 | ||
28 | CONFIG_ARM_THUMBEE=y | ||
29 | # CONFIG_SWP_EMULATE is not set | ||
30 | CONFIG_ARM_ERRATA_743622=y | ||
31 | CONFIG_ARM_ERRATA_751472=y | ||
32 | CONFIG_ARM_ERRATA_754322=y | ||
33 | CONFIG_ARM_ERRATA_764369=y | ||
34 | CONFIG_NO_HZ=y | ||
35 | CONFIG_HIGH_RES_TIMERS=y | ||
36 | CONFIG_SMP=y | ||
37 | CONFIG_PREEMPT=y | ||
38 | CONFIG_AEABI=y | ||
39 | # CONFIG_OABI_COMPAT is not set | ||
40 | CONFIG_HIGHMEM=y | ||
41 | CONFIG_COMPACTION=y | ||
42 | CONFIG_KSM=y | ||
43 | CONFIG_ZBOOT_ROM_TEXT=0x0 | ||
44 | CONFIG_ZBOOT_ROM_BSS=0x0 | ||
45 | CONFIG_CMDLINE="noinitrd console=ttymxc0,115200" | ||
46 | CONFIG_CPU_FREQ=y | ||
47 | CONFIG_CPU_FREQ_STAT_DETAILS=y | ||
48 | CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y | ||
49 | CONFIG_CPU_FREQ_GOV_PERFORMANCE=y | ||
50 | CONFIG_CPU_FREQ_GOV_POWERSAVE=y | ||
51 | CONFIG_CPU_FREQ_GOV_USERSPACE=y | ||
52 | CONFIG_CPU_FREQ_GOV_ONDEMAND=y | ||
53 | CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y | ||
54 | CONFIG_CPU_FREQ_IMX=y | ||
55 | CONFIG_VFP=y | ||
56 | CONFIG_NEON=y | ||
57 | CONFIG_PM_RUNTIME=y | ||
58 | CONFIG_PM_DEBUG=y | ||
59 | CONFIG_APM_EMULATION=y | ||
60 | CONFIG_NET=y | ||
61 | CONFIG_PACKET=y | ||
62 | CONFIG_UNIX=y | ||
63 | CONFIG_INET=y | ||
64 | CONFIG_IP_MULTICAST=y | ||
65 | CONFIG_IP_PNP=y | ||
66 | CONFIG_IP_PNP_DHCP=y | ||
67 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
68 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
69 | # CONFIG_INET_XFRM_MODE_BEET is not set | ||
70 | # CONFIG_INET_DIAG is not set | ||
71 | # CONFIG_IPV6 is not set | ||
72 | CONFIG_NETFILTER=y | ||
73 | CONFIG_BT=y | ||
74 | CONFIG_BT_L2CAP=y | ||
75 | CONFIG_BT_SCO=y | ||
76 | CONFIG_BT_RFCOMM=y | ||
77 | CONFIG_BT_BNEP=y | ||
78 | CONFIG_BT_BNEP_MC_FILTER=y | ||
79 | CONFIG_BT_HIDP=y | ||
80 | CONFIG_BT_HCIBTUSB=m | ||
81 | CONFIG_BT_HCIUART=y | ||
82 | CONFIG_BT_HCIUART_H4=y | ||
83 | CONFIG_CFG80211=y | ||
84 | # CONFIG_CFG80211_DEFAULT_PS is not set | ||
85 | # CONFIG_WIRELESS_EXT_SYSFS is not set | ||
86 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
87 | CONFIG_DEVTMPFS=y | ||
88 | CONFIG_DEVTMPFS_MOUNT=y | ||
89 | CONFIG_CONNECTOR=y | ||
90 | CONFIG_BLK_DEV_LOOP=y | ||
91 | CONFIG_MISC_DEVICES=y | ||
92 | # CONFIG_SCSI_PROC_FS is not set | ||
93 | CONFIG_BLK_DEV_SD=y | ||
94 | # CONFIG_SCSI_LOWLEVEL is not set | ||
95 | CONFIG_ATA=y | ||
96 | CONFIG_SATA_AHCI_PLATFORM=y | ||
97 | # CONFIG_ATA_SFF is not set | ||
98 | CONFIG_NETDEVICES=y | ||
99 | CONFIG_NET_ETHERNET=y | ||
100 | CONFIG_FEC_NAPI=y | ||
101 | # CONFIG_NETDEV_1000 is not set | ||
102 | # CONFIG_NETDEV_10000 is not set | ||
103 | CONFIG_BRCMFMAC=m | ||
104 | CONFIG_BRCMDBG=y | ||
105 | CONFIG_HOSTAP=y | ||
106 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | ||
107 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1280 | ||
108 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=720 | ||
109 | CONFIG_INPUT_EVDEV=y | ||
110 | # CONFIG_INPUT_MOUSE is not set | ||
111 | CONFIG_INPUT_TOUCHSCREEN=y | ||
112 | CONFIG_TOUCHSCREEN_PRISM=y | ||
113 | CONFIG_INPUT_MISC=y | ||
114 | # CONFIG_SERIO_SERPORT is not set | ||
115 | CONFIG_VT_HW_CONSOLE_BINDING=y | ||
116 | CONFIG_SERIAL_IMX=y | ||
117 | CONFIG_SERIAL_IMX_CONSOLE=y | ||
118 | CONFIG_HW_RANDOM=y | ||
119 | CONFIG_MXS_VIIM=y | ||
120 | CONFIG_I2C=y | ||
121 | CONFIG_I2C_CHARDEV=y | ||
122 | CONFIG_I2C_IMX=y | ||
123 | CONFIG_SPI=y | ||
124 | CONFIG_SPI_IMX=y | ||
125 | CONFIG_GPIO_SYSFS=y | ||
126 | # CONFIG_HWMON is not set | ||
127 | CONFIG_WATCHDOG=y | ||
128 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
129 | CONFIG_IMX2_WDT=y | ||
130 | CONFIG_REGULATOR=y | ||
131 | CONFIG_REGULATOR_DUMMY=y | ||
132 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | ||
133 | CONFIG_MEDIA_SUPPORT=y | ||
134 | CONFIG_VIDEO_DEV=y | ||
135 | # CONFIG_RC_CORE is not set | ||
136 | # CONFIG_MEDIA_TUNER_CUSTOMISE is not set | ||
137 | CONFIG_VIDEO_MXC_CAMERA=m | ||
138 | CONFIG_MXC_CAMERA_OV5640_MIPI=m | ||
139 | CONFIG_MXC_IPU_DEVICE_QUEUE_SDC=m | ||
140 | CONFIG_USB_VIDEO_CLASS=m | ||
141 | # CONFIG_USB_GSPCA is not set | ||
142 | # CONFIG_RADIO_ADAPTERS is not set | ||
143 | CONFIG_DRM=m | ||
144 | CONFIG_DRM_VIVANTE=m | ||
145 | CONFIG_FB=y | ||
146 | CONFIG_FB_MXC_LDB=y | ||
147 | CONFIG_FB_MXC_HDMI=y | ||
148 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
149 | CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | ||
150 | CONFIG_FONTS=y | ||
151 | CONFIG_FONT_8x16=y | ||
152 | CONFIG_FONT_10x18=y | ||
153 | CONFIG_SOUND=y | ||
154 | CONFIG_SND=y | ||
155 | # CONFIG_SND_DRIVERS is not set | ||
156 | # CONFIG_SND_PCI is not set | ||
157 | CONFIG_SND_USB_AUDIO=y | ||
158 | CONFIG_SND_SOC=y | ||
159 | CONFIG_SND_IMX_SOC=y | ||
160 | CONFIG_SND_SOC_IMX_SGTL5000=y | ||
161 | CONFIG_SND_SOC_IMX_SPDIF=y | ||
162 | CONFIG_SND_SOC_IMX_HDMI=y | ||
163 | CONFIG_HIDRAW=y | ||
164 | CONFIG_USB=y | ||
165 | CONFIG_USB_DEVICEFS=y | ||
166 | # CONFIG_USB_DEVICE_CLASS is not set | ||
167 | CONFIG_USB_EHCI_HCD=y | ||
168 | CONFIG_USB_EHCI_ARC=y | ||
169 | CONFIG_USB_EHCI_ROOT_HUB_TT=y | ||
170 | CONFIG_USB_ACM=m | ||
171 | CONFIG_USB_STORAGE=y | ||
172 | CONFIG_USB_GADGET=y | ||
173 | CONFIG_USB_GADGET_VBUS_DRAW=100 | ||
174 | CONFIG_USB_ETH=m | ||
175 | CONFIG_USB_FILE_STORAGE=m | ||
176 | CONFIG_USB_MASS_STORAGE=m | ||
177 | CONFIG_USB_G_SERIAL=m | ||
178 | CONFIG_USB_CDC_COMPOSITE=m | ||
179 | CONFIG_USB_GPIO_VBUS=y | ||
180 | CONFIG_USB_ULPI=y | ||
181 | CONFIG_MMC=y | ||
182 | CONFIG_MMC_UNSAFE_RESUME=y | ||
183 | CONFIG_MMC_CLKGATE=y | ||
184 | CONFIG_MMC_SDHCI=y | ||
185 | CONFIG_MMC_SDHCI_PLTFM=y | ||
186 | CONFIG_MMC_SDHCI_ESDHC_IMX=y | ||
187 | CONFIG_RTC_CLASS=y | ||
188 | CONFIG_RTC_DRV_SNVS=y | ||
189 | CONFIG_DMADEVICES=y | ||
190 | CONFIG_MXC_PXP_V2=y | ||
191 | CONFIG_IMX_SDMA=y | ||
192 | CONFIG_MXC_IPU=y | ||
193 | CONFIG_MXC_SSI=y | ||
194 | # CONFIG_MXC_HMP4E is not set | ||
195 | # CONFIG_MXC_HWEVENT is not set | ||
196 | CONFIG_MXC_ASRC=y | ||
197 | CONFIG_MXC_GPU_VIV=y | ||
198 | CONFIG_MXC_MIPI_CSI2=y | ||
199 | CONFIG_EXT2_FS=y | ||
200 | CONFIG_EXT3_FS=y | ||
201 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | ||
202 | CONFIG_EXT4_FS=y | ||
203 | CONFIG_AUTOFS4_FS=m | ||
204 | CONFIG_MSDOS_FS=y | ||
205 | CONFIG_VFAT_FS=y | ||
206 | CONFIG_TMPFS=y | ||
207 | # CONFIG_MISC_FILESYSTEMS is not set | ||
208 | CONFIG_NFS_FS=y | ||
209 | CONFIG_NFS_V3=y | ||
210 | CONFIG_NFS_V4=y | ||
211 | CONFIG_NFS_V4_1=y | ||
212 | CONFIG_ROOT_NFS=y | ||
213 | CONFIG_PARTITION_ADVANCED=y | ||
214 | CONFIG_EFI_PARTITION=y | ||
215 | CONFIG_NLS_CODEPAGE_437=y | ||
216 | CONFIG_NLS_ASCII=y | ||
217 | CONFIG_NLS_ISO8859_1=y | ||
218 | CONFIG_NLS_UTF8=y | ||
219 | CONFIG_PRINTK_TIME=y | ||
220 | CONFIG_FRAME_WARN=4096 | ||
221 | CONFIG_MAGIC_SYSRQ=y | ||
222 | CONFIG_DEBUG_FS=y | ||
223 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
224 | # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set | ||
225 | CONFIG_CRYPTO_TEST=m | ||
226 | CONFIG_CRYPTO_CCM=y | ||
227 | CONFIG_CRYPTO_GCM=y | ||
228 | CONFIG_CRYPTO_CBC=y | ||
229 | CONFIG_CRYPTO_CTS=y | ||
230 | CONFIG_CRYPTO_LRW=y | ||
231 | CONFIG_CRYPTO_PCBC=y | ||
232 | CONFIG_CRYPTO_XTS=y | ||
233 | CONFIG_CRYPTO_DES=y | ||
234 | CONFIG_CRYPTO_DEFLATE=y | ||
235 | CONFIG_CRYPTO_LZO=y | ||
236 | # CONFIG_CRYPTO_ANSI_CPRNG is not set | ||
237 | CONFIG_CRYPTO_DEV_FSL_CAAM=y | ||
238 | CONFIG_CRYPTO_DEV_FSL_CAAM_SM=y | ||
239 | CONFIG_CRYPTO_DEV_FSL_CAAM_SM_TEST=y | ||
240 | CONFIG_CRYPTO_DEV_FSL_CAAM_SECVIO=y | ||
241 | CONFIG_CRC_CCITT=m | ||
242 | CONFIG_AVERAGE=y | ||
diff --git a/recipes-kernel/linux/linux-wandboard-3.0.35/drm-vivante-Add-00-sufix-in-returned-bus-Id.patch b/recipes-kernel/linux/linux-wandboard-3.0.35/drm-vivante-Add-00-sufix-in-returned-bus-Id.patch new file mode 100644 index 0000000..815d02c --- /dev/null +++ b/recipes-kernel/linux/linux-wandboard-3.0.35/drm-vivante-Add-00-sufix-in-returned-bus-Id.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From b37a944f55a5010bd08297a63db0275540922f32 Mon Sep 17 00:00:00 2001 | ||
2 | From: Otavio Salvador <otavio@ossystems.com.br> | ||
3 | Date: Thu, 22 Aug 2013 16:31:29 -0300 | ||
4 | Subject: [PATCH] drm/vivante: Add ":00" sufix in returned bus Id | ||
5 | |||
6 | This makes the 3.0.35 compatible with a Xorg driver build for 3.5.7 or | ||
7 | newer kernels. | ||
8 | |||
9 | Upstream-Status: Inapropriate [embedded specific] | ||
10 | |||
11 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
12 | --- | ||
13 | drivers/gpu/drm/vivante/vivante_drv.c | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/drivers/gpu/drm/vivante/vivante_drv.c b/drivers/gpu/drm/vivante/vivante_drv.c | ||
17 | index 4224608..cea360d 100644 | ||
18 | --- a/drivers/gpu/drm/vivante/vivante_drv.c | ||
19 | +++ b/drivers/gpu/drm/vivante/vivante_drv.c | ||
20 | @@ -55,7 +55,7 @@ | ||
21 | |||
22 | #include "drm_pciids.h" | ||
23 | |||
24 | -static char platformdevicename[] = "Vivante GCCore"; | ||
25 | +static char platformdevicename[] = "Vivante GCCore:00"; | ||
26 | static struct platform_device *pplatformdev; | ||
27 | |||
28 | static struct drm_driver driver = { | ||
29 | -- | ||
30 | 1.8.4.rc1 | ||
31 | |||