[android-sdk/device-ti-proprietary-open.git] / omap5 / sgx_src / eurasia_km / services4 / srvkm / common / ttrace.c
1 /*************************************************************************/ /*!
2 @Title Timed Trace functions
3 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @License Dual MIT/GPLv2
6 The contents of this file are subject to the MIT license as set out below.
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 Alternatively, the contents of this file may be used under the terms of
19 the GNU General Public License Version 2 ("GPL") in which case the provisions
20 of GPL are applicable instead of those above.
22 If you wish to allow use of your version of this file only under the terms of
23 GPL, and not to allow others to use your version of this file under the terms
24 of the MIT license, indicate your decision by deleting the provisions above
25 and replace them with the notice and other provisions required by GPL as set
26 out in the file called "GPL-COPYING" included in this distribution. If you do
27 not delete the provisions above, a recipient may use your version of this file
28 under the terms of either the MIT license or GPL.
30 This License is also included in this distribution in the file called
31 "MIT-COPYING".
33 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
34 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
35 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
37 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
38 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
39 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40 */ /**************************************************************************/
41 #if defined (TTRACE)
43 #include "services_headers.h"
44 #include "ttrace.h"
46 #if defined(PVRSRV_NEED_PVR_DPF)
47 #define CHECKSIZE(n,m) \
48 if ((n & m) != n) \
49 PVR_DPF((PVR_DBG_ERROR,"Size check failed for " #m))
50 #else
51 #define CHECKSIZE(n,m)
52 #endif
54 #define TIME_TRACE_HASH_TABLE_SIZE 32
56 HASH_TABLE *g_psBufferTable;
57 IMG_UINT32 g_ui32HostUID;
58 IMG_HANDLE g_psTimer;
60 /* Trace buffer struct */
61 typedef struct
62 {
63 IMG_UINT32 ui32Woff; /* Offset to where next item will be written */
64 IMG_UINT32 ui32Roff; /* Offset to where to start reading from */
65 IMG_UINT32 ui32ByteCount; /* Number of bytes in buffer */
66 IMG_UINT8 ui8Data[0];
67 } sTimeTraceBuffer;
69 /*!
70 ******************************************************************************
72 @Function PVRSRVTimeTraceItemSize
74 @Description
76 Calculate the size of a trace item
78 @Input psTraceItem : Trace item
80 @Return size of trace item
82 ******************************************************************************/
83 static IMG_UINT32
84 PVRSRVTimeTraceItemSize(IMG_UINT32 *psTraceItem)
85 {
86 IMG_UINT32 ui32Size = PVRSRV_TRACE_ITEM_SIZE;
88 ui32Size += READ_HEADER(SIZE, psTraceItem[PVRSRV_TRACE_DATA_HEADER]);
90 return ui32Size;
91 }
93 /*!
94 ******************************************************************************
96 @Function PVRSRVTimeTraceAllocItem
98 @Description
100 Allocate a trace item from the buffer of the current process
102 @Output ppsTraceItem : Pointer to allocated trace item
104 @Input ui32Size : Size of data packet to be allocated
106 @Return none
108 ******************************************************************************/
109 static IMG_VOID
110 PVRSRVTimeTraceAllocItem(IMG_UINT32 **pui32Item, IMG_UINT32 ui32Size)
111 {
112 IMG_UINT32 ui32PID = OSGetCurrentProcessIDKM();
113 IMG_UINT32 ui32AllocOffset;
114 sTimeTraceBuffer *psBuffer = (sTimeTraceBuffer *) HASH_Retrieve(g_psBufferTable, (IMG_UINTPTR_T) ui32PID);
116 /* The caller only asks for extra data space */
117 ui32Size += PVRSRV_TRACE_ITEM_SIZE;
119 /* Always round to 32-bit */
120 ui32Size = ((ui32Size - 1) & (~0x3)) + 0x04;
122 if (!psBuffer)
123 {
124 PVRSRV_ERROR eError;
126 PVR_DPF((PVR_DBG_MESSAGE, "PVRSRVTimeTraceAllocItem: Creating buffer for PID %u", (IMG_UINT32) ui32PID));
127 eError = PVRSRVTimeTraceBufferCreate(ui32PID);
128 if (eError != PVRSRV_OK)
129 {
130 *pui32Item = IMG_NULL;
131 PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceAllocItem: Failed to create buffer"));
132 return;
133 }
135 psBuffer = (sTimeTraceBuffer *) HASH_Retrieve(g_psBufferTable, (IMG_UINTPTR_T) ui32PID);
136 if (psBuffer == IMG_NULL)
137 {
138 *pui32Item = NULL;
139 PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceAllocItem: Failed to retrieve buffer"));
140 return;
141 }
142 }
144 /* Can't allocate more then buffer size */
145 if (ui32Size >= TIME_TRACE_BUFFER_SIZE)
146 {
147 *pui32Item = NULL;
148 PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceAllocItem: Error trace item too large (%d)", ui32Size));
149 return;
150 }
152 /* FIXME: Enter critical section? */
154 /* Always ensure we have enough space to write a padding message */
155 if ((psBuffer->ui32Woff + ui32Size + PVRSRV_TRACE_ITEM_SIZE) > TIME_TRACE_BUFFER_SIZE)
156 {
157 IMG_UINT32 *ui32WriteEOB = (IMG_UINT32 *) &psBuffer->ui8Data[psBuffer->ui32Woff];
158 IMG_UINT32 ui32Remain = TIME_TRACE_BUFFER_SIZE - psBuffer->ui32Woff;
160 /* Not enough space at the end of the buffer, back to the start */
161 *ui32WriteEOB++ = WRITE_HEADER(GROUP, PVRSRV_TRACE_GROUP_PADDING);
162 *ui32WriteEOB++ = 0; /* Don't need timestamp */
163 *ui32WriteEOB++ = 0; /* Don't need UID */
164 *ui32WriteEOB = WRITE_HEADER(SIZE, (ui32Remain - PVRSRV_TRACE_ITEM_SIZE));
165 psBuffer->ui32ByteCount += ui32Remain;
166 psBuffer->ui32Woff = ui32AllocOffset = 0;
167 }
168 else
169 ui32AllocOffset = psBuffer->ui32Woff;
171 psBuffer->ui32Woff = psBuffer->ui32Woff + ui32Size;
172 psBuffer->ui32ByteCount += ui32Size;
174 /* This allocation will start overwritting past our read pointer, move the read pointer along */
175 while (psBuffer->ui32ByteCount > TIME_TRACE_BUFFER_SIZE)
176 {
177 IMG_UINT32 *psReadItem = (IMG_UINT32 *) &psBuffer->ui8Data[psBuffer->ui32Roff];
178 IMG_UINT32 ui32ReadSize;
180 ui32ReadSize = PVRSRVTimeTraceItemSize(psReadItem);
181 psBuffer->ui32Roff = (psBuffer->ui32Roff + ui32ReadSize) & (TIME_TRACE_BUFFER_SIZE - 1);
182 psBuffer->ui32ByteCount -= ui32ReadSize;
183 }
185 *pui32Item = (IMG_UINT32 *) &psBuffer->ui8Data[ui32AllocOffset];
186 /* FIXME: Exit critical section? */
187 }
189 /*!
190 ******************************************************************************
192 @Function PVRSRVTimeTraceBufferCreate
194 @Description
196 Create a trace buffer.
198 Note: We assume that this will only be called once per process.
200 @Input ui32PID : PID of the process that is creating the buffer
202 @Return none
204 ******************************************************************************/
205 PVRSRV_ERROR PVRSRVTimeTraceBufferCreate(IMG_UINT32 ui32PID)
206 {
207 sTimeTraceBuffer *psBuffer;
208 PVRSRV_ERROR eError = PVRSRV_OK;
210 eError = OSAllocMem(PVRSRV_PAGEABLE_SELECT,
211 sizeof(sTimeTraceBuffer) + TIME_TRACE_BUFFER_SIZE,
212 (IMG_VOID **)&psBuffer, IMG_NULL,
213 "Time Trace Buffer");
214 if (eError != PVRSRV_OK)
215 {
216 PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceBufferCreate: Error allocating trace buffer"));
217 return eError;
218 }
220 OSMemSet(psBuffer, 0, TIME_TRACE_BUFFER_SIZE);
222 if (!HASH_Insert(g_psBufferTable, (IMG_UINTPTR_T) ui32PID, (IMG_UINTPTR_T) psBuffer))
223 {
224 OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(sTimeTraceBuffer) + TIME_TRACE_BUFFER_SIZE,
225 psBuffer, NULL);
226 PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceBufferCreate: Error adding trace buffer to hash table"));
227 return PVRSRV_ERROR_OUT_OF_MEMORY;
228 }
230 return eError;
231 }
233 /*!
234 ******************************************************************************
236 @Function PVRSRVTimeTraceBufferDestroy
238 @Description
240 Destroy a trace buffer.
242 Note: We assume that this will only be called once per process.
244 @Input ui32PID : PID of the process that is creating the buffer
246 @Return none
248 ******************************************************************************/
249 PVRSRV_ERROR PVRSRVTimeTraceBufferDestroy(IMG_UINT32 ui32PID)
250 {
251 sTimeTraceBuffer *psBuffer;
253 #if defined(DUMP_TTRACE_BUFFERS_ON_EXIT)
254 PVRSRVDumpTimeTraceBuffers();
255 #endif
256 psBuffer = (sTimeTraceBuffer *) HASH_Retrieve(g_psBufferTable, (IMG_UINTPTR_T) ui32PID);
257 if (psBuffer)
258 {
259 OSFreeMem(PVRSRV_PAGEABLE_SELECT, sizeof(sTimeTraceBuffer) + TIME_TRACE_BUFFER_SIZE,
260 psBuffer, NULL);
261 HASH_Remove(g_psBufferTable, (IMG_UINTPTR_T) ui32PID);
262 return PVRSRV_OK;
263 }
265 PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceBufferDestroy: Can't find trace buffer in hash table"));
266 return PVRSRV_ERROR_INVALID_PARAMS;
267 }
269 /*!
270 ******************************************************************************
272 @Function PVRSRVTimeTraceInit
274 @Description
276 Initialise the timed trace subsystem.
278 @Return Error
280 ******************************************************************************/
281 PVRSRV_ERROR PVRSRVTimeTraceInit(IMG_VOID)
282 {
283 g_psBufferTable = HASH_Create(TIME_TRACE_HASH_TABLE_SIZE);
285 /* Create hash table to store the per process buffers in */
286 if (!g_psBufferTable)
287 {
288 PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceInit: Error creating hash table"));
289 return PVRSRV_ERROR_OUT_OF_MEMORY;
290 }
292 /* Create the kernel buffer */
293 PVRSRVTimeTraceBufferCreate(KERNEL_ID);
295 g_psTimer = OSFuncHighResTimerCreate();
297 if (!g_psTimer)
298 {
299 PVR_DPF((PVR_DBG_ERROR, "PVRSRVTimeTraceInit: Error creating timer"));
300 return PVRSRV_ERROR_INIT_FAILURE;
301 }
302 return PVRSRV_OK;
303 }
305 static PVRSRV_ERROR _PVRSRVTimeTraceBufferDestroy(IMG_UINTPTR_T hKey, IMG_UINTPTR_T hData)
306 {
307 PVR_UNREFERENCED_PARAMETER(hData);
308 PVR_DPF((PVR_DBG_MESSAGE, "_PVRSRVTimeTraceBufferDestroy: Destroying buffer for PID %u", (IMG_UINT32) hKey));
310 PVRSRVTimeTraceBufferDestroy(hKey);
311 return PVRSRV_OK;
312 }
314 /*!
315 ******************************************************************************
317 @Function PVRSRVTimeTraceDeinit
319 @Description
321 De-initialise the timed trace subsystem.
323 @Return Error
325 ******************************************************************************/
326 IMG_VOID PVRSRVTimeTraceDeinit(IMG_VOID)
327 {
328 PVRSRVTimeTraceBufferDestroy(KERNEL_ID);
329 /* Free any buffers the where created at alloc item time */
330 HASH_Iterate(g_psBufferTable, _PVRSRVTimeTraceBufferDestroy);
331 HASH_Delete(g_psBufferTable);
332 OSFuncHighResTimerDestroy(g_psTimer);
333 }
335 /*!
336 ******************************************************************************
338 @Function PVRSRVTimeTraceWriteHeader
340 @Description
342 Write the header for a trace item.
344 @Input pui32TraceItem : Pointer to trace item
346 @Input ui32Group : Trace item's group ID
348 @Input ui32Class : Trace item's class ID
350 @Input ui32Token : Trace item's ui32Token ID
352 @Input ui32Size : Trace item's data payload size
354 @Input ui32Type : Trace item's data type
356 @Input ui32Count : Trace item's data count
358 @Return Pointer to data payload space, or NULL if no data payload
360 ******************************************************************************/
361 #ifdef INLINE_IS_PRAGMA
362 #pragma inline(PVRSRVTimeTraceWriteHeader)
363 #endif
364 static INLINE IMG_VOID *PVRSRVTimeTraceWriteHeader(IMG_UINT32 *pui32TraceItem, IMG_UINT32 ui32Group,
365 IMG_UINT32 ui32Class, IMG_UINT32 ui32Token,
366 IMG_UINT32 ui32Size, IMG_UINT32 ui32Type,
367 IMG_UINT32 ui32Count)
368 {
369 /* Sanity check arg's */
370 CHECKSIZE(ui32Group, PVRSRV_TRACE_GROUP_MASK);
371 CHECKSIZE(ui32Class, PVRSRV_TRACE_CLASS_MASK);
372 CHECKSIZE(ui32Token, PVRSRV_TRACE_TOKEN_MASK);
374 CHECKSIZE(ui32Size, PVRSRV_TRACE_SIZE_MASK);
375 CHECKSIZE(ui32Type, PVRSRV_TRACE_TYPE_MASK);
376 CHECKSIZE(ui32Count, PVRSRV_TRACE_COUNT_MASK);
378 /* Trace header */
379 pui32TraceItem[PVRSRV_TRACE_HEADER] = WRITE_HEADER(GROUP, ui32Group);
380 pui32TraceItem[PVRSRV_TRACE_HEADER] |= WRITE_HEADER(CLASS, ui32Class);
381 pui32TraceItem[PVRSRV_TRACE_HEADER] |= WRITE_HEADER(TOKEN, ui32Token);
383 /* Data header */
384 pui32TraceItem[PVRSRV_TRACE_DATA_HEADER] = WRITE_HEADER(SIZE, ui32Size);
385 pui32TraceItem[PVRSRV_TRACE_DATA_HEADER] |= WRITE_HEADER(TYPE, ui32Type);
386 pui32TraceItem[PVRSRV_TRACE_DATA_HEADER] |= WRITE_HEADER(COUNT, ui32Count);
388 pui32TraceItem[PVRSRV_TRACE_TIMESTAMP] = OSFuncHighResTimerGetus(g_psTimer);
389 pui32TraceItem[PVRSRV_TRACE_HOSTUID] = g_ui32HostUID++;
391 return ui32Size?((IMG_VOID *) &pui32TraceItem[PVRSRV_TRACE_DATA_PAYLOAD]):NULL;
392 }
394 /*!
395 ******************************************************************************
397 @Function PVRSRVTimeTraceArray
399 @Description
401 Write trace item with an array of data
403 @Input ui32Group : Trace item's group ID
405 @Input ui32Class : Trace item's class ID
407 @Input ui32Token : Trace item's ui32Token ID
409 @Input ui32Size : Trace item's data payload size
411 @Input ui32Type : Trace item's data type
413 @Input ui32Count : Trace item's data count
415 @Input pui8Data : Pointer to data array
417 @Return Pointer to data payload space, or NULL if no data payload
419 ******************************************************************************/
420 IMG_VOID PVRSRVTimeTraceArray(IMG_UINT32 ui32Group, IMG_UINT32 ui32Class, IMG_UINT32 ui32Token,
421 IMG_UINT32 ui32Type, IMG_UINT32 ui32Count, IMG_UINT8 *pui8Data)
422 {
423 IMG_UINT32 *pui32TraceItem;
424 IMG_UINT32 ui32Size, ui32TypeSize;
425 IMG_UINT8 *ui8Ptr;
427 /* Only the 1st 4 sizes are for ui types, others are "special" */
428 switch (ui32Type)
429 {
430 case PVRSRV_TRACE_TYPE_UI8: ui32TypeSize = 1;
431 break;
432 case PVRSRV_TRACE_TYPE_UI16: ui32TypeSize = 2;
433 break;
434 case PVRSRV_TRACE_TYPE_UI32: ui32TypeSize = 4;
435 break;
436 case PVRSRV_TRACE_TYPE_UI64: ui32TypeSize = 8;
437 break;
438 default:
439 PVR_DPF((PVR_DBG_ERROR, "Unsupported size\n"));
440 return;
441 }
443 ui32Size = ui32TypeSize * ui32Count;
445 /* Allocate space from the buffer */
446 PVRSRVTimeTraceAllocItem(&pui32TraceItem, ui32Size);
448 if (!pui32TraceItem)
449 {
450 PVR_DPF((PVR_DBG_ERROR, "Can't find buffer\n"));
451 return;
452 }
454 ui8Ptr = PVRSRVTimeTraceWriteHeader(pui32TraceItem, ui32Group, ui32Class, ui32Token,
455 ui32Size, ui32Type, ui32Count);
457 if (ui8Ptr)
458 {
459 OSMemCopy(ui8Ptr, pui8Data, ui32Size);
460 }
461 }
463 /*!
464 ******************************************************************************
466 @Function PVRSRVTimeTraceSyncObject
468 @Description
470 Write trace item with a sync object
472 @Input ui32Group : Trace item's group ID
474 @Input ui32Token : Trace item's ui32Token ID
476 @Input psSync : Sync object
478 @Input ui8SyncOpp : Sync object operation
480 @Return None
482 ******************************************************************************/
483 IMG_VOID PVRSRVTimeTraceSyncObject(IMG_UINT32 ui32Group, IMG_UINT32 ui32Token,
484 PVRSRV_KERNEL_SYNC_INFO *psSync, IMG_UINT8 ui8SyncOp)
485 {
486 IMG_UINT32 *pui32TraceItem;
487 IMG_UINT32 *ui32Ptr;
488 IMG_UINT32 ui32Size = PVRSRV_TRACE_TYPE_SYNC_SIZE;
491 PVRSRVTimeTraceAllocItem(&pui32TraceItem, ui32Size);
493 if (!pui32TraceItem)
494 {
495 PVR_DPF((PVR_DBG_ERROR, "Can't find buffer\n"));
496 return;
497 }
499 ui32Ptr = PVRSRVTimeTraceWriteHeader(pui32TraceItem, ui32Group, PVRSRV_TRACE_CLASS_SYNC,
500 ui32Token, ui32Size, PVRSRV_TRACE_TYPE_SYNC, 1);
502 ui32Ptr[PVRSRV_TRACE_SYNC_UID] = psSync->ui32UID;
503 ui32Ptr[PVRSRV_TRACE_SYNC_WOP] = psSync->psSyncData->ui32WriteOpsPending;
504 ui32Ptr[PVRSRV_TRACE_SYNC_WOC] = psSync->psSyncData->ui32WriteOpsComplete;
505 ui32Ptr[PVRSRV_TRACE_SYNC_ROP] = psSync->psSyncData->ui32ReadOpsPending;
506 ui32Ptr[PVRSRV_TRACE_SYNC_ROC] = psSync->psSyncData->ui32ReadOpsComplete;
507 ui32Ptr[PVRSRV_TRACE_SYNC_RO2P] = psSync->psSyncData->ui32ReadOps2Pending;
508 ui32Ptr[PVRSRV_TRACE_SYNC_RO2C] = psSync->psSyncData->ui32ReadOps2Complete;
509 ui32Ptr[PVRSRV_TRACE_SYNC_WO_DEV_VADDR] = psSync->sWriteOpsCompleteDevVAddr.uiAddr;
510 ui32Ptr[PVRSRV_TRACE_SYNC_RO_DEV_VADDR] = psSync->sReadOpsCompleteDevVAddr.uiAddr;
511 ui32Ptr[PVRSRV_TRACE_SYNC_RO2_DEV_VADDR] = psSync->sReadOps2CompleteDevVAddr.uiAddr;
512 ui32Ptr[PVRSRV_TRACE_SYNC_OP] = ui8SyncOp;
513 }
515 /*!
516 ******************************************************************************
518 @Function PVRSRVDumpTimeTraceBuffer
520 @Description
522 Dump the contents of the trace buffer.
524 @Input hKey : Trace item's group ID
526 @Input hData : Trace item's ui32Token ID
528 @Return Error
530 ******************************************************************************/
531 static PVRSRV_ERROR PVRSRVDumpTimeTraceBuffer(IMG_UINTPTR_T hKey, IMG_UINTPTR_T hData)
532 {
533 sTimeTraceBuffer *psBuffer = (sTimeTraceBuffer *) hData;
534 IMG_UINT32 ui32ByteCount = psBuffer->ui32ByteCount;
535 IMG_UINT32 ui32Walker = psBuffer->ui32Roff;
536 IMG_UINT32 ui32Read, ui32LineLen, ui32EOL, ui32MinLine;
538 PVR_DPF((PVR_DBG_ERROR, "TTB for PID %u:\n", (IMG_UINT32) hKey));
540 while (ui32ByteCount)
541 {
542 IMG_UINT32 *pui32Buffer = (IMG_UINT32 *) &psBuffer->ui8Data[ui32Walker];
544 ui32LineLen = (ui32ByteCount/sizeof(IMG_UINT32));
545 ui32EOL = (TIME_TRACE_BUFFER_SIZE - ui32Walker)/sizeof(IMG_UINT32);
546 ui32MinLine = (ui32LineLen < ui32EOL)?ui32LineLen:ui32EOL;
548 if (ui32MinLine >= 4)
549 {
550 PVR_DPF((PVR_DBG_ERROR, "\t(TTB-%X) %08X %08X %08X %08X", ui32ByteCount,
551 pui32Buffer[0], pui32Buffer[1], pui32Buffer[2], pui32Buffer[3]));
552 ui32Read = 4 * sizeof(IMG_UINT32);
553 }
554 else if (ui32MinLine >= 3)
555 {
556 PVR_DPF((PVR_DBG_ERROR, "\t(TTB-%X) %08X %08X %08X", ui32ByteCount,
557 pui32Buffer[0], pui32Buffer[1], pui32Buffer[2]));
558 ui32Read = 3 * sizeof(IMG_UINT32);
559 }
560 else if (ui32MinLine >= 2)
561 {
562 PVR_DPF((PVR_DBG_ERROR, "\t(TTB-%X) %08X %08X", ui32ByteCount,
563 pui32Buffer[0], pui32Buffer[1]));
564 ui32Read = 2 * sizeof(IMG_UINT32);
565 }
566 else
567 {
568 PVR_DPF((PVR_DBG_ERROR, "\t(TTB-%X) %08X", ui32ByteCount,
569 pui32Buffer[0]));
570 ui32Read = sizeof(IMG_UINT32);
571 }
573 ui32Walker = (ui32Walker + ui32Read) & (TIME_TRACE_BUFFER_SIZE - 1);
574 ui32ByteCount -= ui32Read;
575 }
577 return PVRSRV_OK;
578 }
580 /*!
581 ******************************************************************************
583 @Function PVRSRVDumpTimeTraceBuffers
585 @Description
587 Dump the contents of all the trace buffers.
589 @Return None
591 ******************************************************************************/
592 IMG_VOID PVRSRVDumpTimeTraceBuffers(IMG_VOID)
593 {
594 HASH_Iterate(g_psBufferTable, PVRSRVDumpTimeTraceBuffer);
595 }
597 #endif /* TTRACE */