RK3368 GPU version Rogue M 1.28
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / include / rgx_common.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          RGX Common Types and Defines Header
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description    Common types and definitions for RGX software
6 @License        Dual MIT/GPLv2
7
8 The contents of this file are subject to the MIT license as set out below.
9
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
23
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
31
32 This License is also included in this distribution in the file called
33 "MIT-COPYING".
34
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
43 #ifndef RGX_COMMON_H_
44 #define RGX_COMMON_H_
45
46 #if defined (__cplusplus)
47 extern "C" {
48 #endif
49
50 #include "img_defs.h"
51
52 /* Included to get the BVNC_KM_N defined and other feature defs */
53 #include "km/rgxdefs_km.h"
54
55 /*! This macro represents a mask of LSBs that must be zero on data structure
56  * sizes and offsets to ensure they are 8-byte granular on types shared between
57  * the FW and host driver */
58 #define RGX_FW_ALIGNMENT_LSB (7)
59
60 /*! Macro to test structure size alignment */
61 #define RGX_FW_STRUCT_SIZE_ASSERT(_a)   \
62         BLD_ASSERT((sizeof(_a)&RGX_FW_ALIGNMENT_LSB)==0, _a##struct_size)
63
64 /*! Macro to test structure member alignment */
65 #define RGX_FW_STRUCT_OFFSET_ASSERT(_a, _b)     \
66         BLD_ASSERT((offsetof(_a, _b)&RGX_FW_ALIGNMENT_LSB)==0, _a##struct_offset)
67
68
69 /*! The number of performance counters in each layout block */
70 #if defined(RGX_FEATURE_CLUSTER_GROUPING)
71 #define RGX_HWPERF_CNTRS_IN_BLK 6
72 #define RGX_HWPERF_CNTRS_IN_BLK_MIN 4
73 #else
74 #define RGX_HWPERF_CNTRS_IN_BLK 4
75 #define RGX_HWPERF_CNTRS_IN_BLK_MIN 4
76 #endif
77
78
79 /*! The master definition for data masters known to the firmware of RGX.
80  * The DM in a V1 HWPerf packet uses this definition. */
81 typedef enum _RGXFWIF_DM_
82 {
83         RGXFWIF_DM_GP                   = 0,
84         RGXFWIF_DM_2D                   = 1,
85         RGXFWIF_DM_TA                   = 2,
86         RGXFWIF_DM_3D                   = 3,
87         RGXFWIF_DM_CDM                  = 4,
88 #if defined(RGX_FEATURE_RAY_TRACING)
89         RGXFWIF_DM_RTU                  = 5,
90         RGXFWIF_DM_SHG                  = 6,
91 #endif
92         RGXFWIF_DM_LAST,
93
94         RGXFWIF_DM_FORCE_I32  = 0x7fffffff   /*!< Force enum to be at least 32-bits wide */
95 } RGXFWIF_DM;
96
97 #if defined(RGX_FEATURE_RAY_TRACING)
98 #define RGXFWIF_DM_MAX_MTS 8
99 #else
100 #define RGXFWIF_DM_MAX_MTS 6
101 #endif
102
103 #if defined(RGX_FEATURE_RAY_TRACING)
104 /* Maximum number of DM in use: GP, 2D, TA, 3D, CDM, SHG, RTU */
105 #define RGXFWIF_DM_MAX                  (7)
106 #else
107 #define RGXFWIF_DM_MAX                  (5)
108 #endif
109
110 /* Min/Max number of HW DMs (all but GP) */
111 #if defined(RGX_FEATURE_TLA)
112 #define RGXFWIF_HWDM_MIN                (1)
113 #else
114 #define RGXFWIF_HWDM_MIN                (2)
115 #endif
116 #define RGXFWIF_HWDM_MAX                (RGXFWIF_DM_MAX)
117
118 /*!
119  ******************************************************************************
120  * RGXFW Compiler alignment definitions
121  *****************************************************************************/
122 #if defined(__GNUC__)
123 #define RGXFW_ALIGN                     __attribute__ ((aligned (8)))
124 #elif defined(_MSC_VER)
125 #define RGXFW_ALIGN                     __declspec(align(8))
126 #pragma warning (disable : 4324)
127 #else
128 #error "Align MACROS need to be defined for this compiler"
129 #endif
130
131 /*!
132  ******************************************************************************
133  * Force 8-byte alignment for structures allocated uncached.
134  *****************************************************************************/
135 #define UNCACHED_ALIGN      RGXFW_ALIGN
136
137 #if defined (__cplusplus)
138 }
139 #endif
140
141 #endif /* RGX_COMMON_H_ */
142
143 /******************************************************************************
144  End of file
145 ******************************************************************************/
146