]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_statistics.h
gpu: vivante: Update driver from Freescale 3.10.53-1.1-ga BSP
[karo-tx-linux.git] / drivers / mxc / gpu-viv / hal / kernel / inc / gc_hal_statistics.h
1 /****************************************************************************
2 *
3 *    Copyright (C) 2005 - 2014 by Vivante Corp.
4 *
5 *    This program is free software; you can redistribute it and/or modify
6 *    it under the terms of the GNU General Public License as published by
7 *    the Free Software Foundation; either version 2 of the license, or
8 *    (at your option) any later version.
9 *
10 *    This program is distributed in the hope that it will be useful,
11 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *    GNU General Public License for more details.
14 *
15 *    You should have received a copy of the GNU General Public License
16 *    along with this program; if not write to the Free Software
17 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 *****************************************************************************/
20
21
22 #ifndef __gc_hal_statistics_h_
23 #define __gc_hal_statistics_h_
24
25
26 #define VIV_STAT_ENABLE_STATISTICS              0
27
28 /*  Toal number of frames for which the frame time is accounted. We have storage
29     to keep frame times for last this many frames.
30 */
31 #define VIV_STAT_FRAME_BUFFER_SIZE              30
32
33
34 /*
35     Total number of frames sampled for a mode. This means
36
37     # of frames for HZ Current  : VIV_STAT_EARLY_Z_SAMPLE_FRAMES
38     # of frames for HZ Switched : VIV_STAT_EARLY_Z_SAMPLE_FRAMES
39   +
40   --------------------------------------------------------
41                                 : (2 * VIV_STAT_EARLY_Z_SAMPLE_FRAMES) frames needed
42
43     IMPORTANT: This total must be smaller than VIV_STAT_FRAME_BUFFER_SIZE
44 */
45 #define VIV_STAT_EARLY_Z_SAMPLE_FRAMES          7
46 #define VIV_STAT_EARLY_Z_LATENCY_FRAMES         2
47
48 /* Multiplication factor for previous Hz off mode. Make it more than 1.0 to advertise HZ on.*/
49 #define VIV_STAT_EARLY_Z_FACTOR                 (1.05f)
50
51 /* Defines the statistical data keys monitored by the statistics module */
52 typedef enum _gceSTATISTICS
53 {
54     gcvFRAME_FPS        =   1,
55 }
56 gceSTATISTICS;
57
58 /* HAL statistics information. */
59 typedef struct _gcsSTATISTICS_EARLYZ
60 {
61     gctUINT                     switchBackCount;
62     gctUINT                     nextCheckPoint;
63     gctBOOL                     disabled;
64 }
65 gcsSTATISTICS_EARLYZ;
66
67
68 /* HAL statistics information. */
69 typedef struct _gcsSTATISTICS
70 {
71     gctUINT64                   frameTime[VIV_STAT_FRAME_BUFFER_SIZE];
72     gctUINT64                   previousFrameTime;
73     gctUINT                     frame;
74     gcsSTATISTICS_EARLYZ        earlyZ;
75 }
76 gcsSTATISTICS;
77
78
79 /* Add a frame based data into current statistics. */
80 void
81 gcfSTATISTICS_AddData(
82     IN gceSTATISTICS Key,
83     IN gctUINT Value
84     );
85
86 /* Marks the frame end and triggers statistical calculations and decisions.*/
87 void
88 gcfSTATISTICS_MarkFrameEnd (
89     void
90     );
91
92 /* Sets whether the dynmaic HZ is disabled or not .*/
93 void
94 gcfSTATISTICS_DisableDynamicEarlyZ (
95     IN gctBOOL Disabled
96     );
97
98 #endif /*__gc_hal_statistics_h_ */
99