1 /****************************************************************************
3 * Copyright (C) 2005 - 2014 by Vivante Corp.
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.
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.
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.
19 *****************************************************************************/
22 #ifndef __gc_hal_statistics_h_
23 #define __gc_hal_statistics_h_
26 #define VIV_STAT_ENABLE_STATISTICS 0
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.
31 #define VIV_STAT_FRAME_BUFFER_SIZE 30
35 Total number of frames sampled for a mode. This means
37 # of frames for HZ Current : VIV_STAT_EARLY_Z_SAMPLE_FRAMES
38 # of frames for HZ Switched : VIV_STAT_EARLY_Z_SAMPLE_FRAMES
40 --------------------------------------------------------
41 : (2 * VIV_STAT_EARLY_Z_SAMPLE_FRAMES) frames needed
43 IMPORTANT: This total must be smaller than VIV_STAT_FRAME_BUFFER_SIZE
45 #define VIV_STAT_EARLY_Z_SAMPLE_FRAMES 7
46 #define VIV_STAT_EARLY_Z_LATENCY_FRAMES 2
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)
51 /* Defines the statistical data keys monitored by the statistics module */
52 typedef enum _gceSTATISTICS
58 /* HAL statistics information. */
59 typedef struct _gcsSTATISTICS_EARLYZ
61 gctUINT switchBackCount;
62 gctUINT nextCheckPoint;
68 /* HAL statistics information. */
69 typedef struct _gcsSTATISTICS
71 gctUINT64 frameTime[VIV_STAT_FRAME_BUFFER_SIZE];
72 gctUINT64 previousFrameTime;
74 gcsSTATISTICS_EARLYZ earlyZ;
79 /* Add a frame based data into current statistics. */
81 gcfSTATISTICS_AddData(
86 /* Marks the frame end and triggers statistical calculations and decisions.*/
88 gcfSTATISTICS_MarkFrameEnd (
92 /* Sets whether the dynmaic HZ is disabled or not .*/
94 gcfSTATISTICS_DisableDynamicEarlyZ (
98 #endif /*__gc_hal_statistics_h_ */