Merge branch 'linux-linaro-lsk-v4.4-android' of git://git.linaro.org/kernel/linux...
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue_m / include / rgx_heaps.h
1 /*************************************************************************/ /*!
2 @File
3 @Title          RGX heap definitions
4 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @License        Dual MIT/GPLv2
6
7 The contents of this file are subject to the MIT license as set out below.
8
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18
19 Alternatively, the contents of this file may be used under the terms of
20 the GNU General Public License Version 2 ("GPL") in which case the provisions
21 of GPL are applicable instead of those above.
22
23 If you wish to allow use of your version of this file only under the terms of
24 GPL, and not to allow others to use your version of this file under the terms
25 of the MIT license, indicate your decision by deleting the provisions above
26 and replace them with the notice and other provisions required by GPL as set
27 out in the file called "GPL-COPYING" included in this distribution. If you do
28 not delete the provisions above, a recipient may use your version of this file
29 under the terms of either the MIT license or GPL.
30
31 This License is also included in this distribution in the file called
32 "MIT-COPYING".
33
34 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
35 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
36 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
38 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 */ /**************************************************************************/
42
43 #if !defined(__RGX_HEAPS_H__)
44 #define __RGX_HEAPS_H__
45
46 #include "km/rgxdefs_km.h"
47
48 /* RGX Heap IDs, note: not all heaps are available to clients */
49 /* N.B.  Old heap identifiers are deprecated now that the old memory
50    management is. New heap identifiers should be suitably renamed */
51 #define RGX_UNDEFINED_HEAP_ID                                   (~0LU)          /*!< RGX Undefined Heap ID */
52 #define RGX_GENERAL_HEAP_ID                                             0               /*!< RGX General Heap ID */
53 #define RGX_PDSCODEDATA_HEAP_ID                                 1               /*!< RGX PDS Code/Data Heap ID */
54 //#define RGX_3DPARAMETERS_HEAP_ID                              2               /*!< RGX 3D Parameters Heap ID */
55 #define RGX_USCCODE_HEAP_ID                                             2               /*!< RGX USC Code Heap ID */
56 #define RGX_FIRMWARE_HEAP_ID                                    3               /*!< RGX Firmware Heap ID */
57 #define RGX_TQ3DPARAMETERS_HEAP_ID                              4               /*!< RGX Firmware Heap ID */
58 #define RGX_BIF_TILING_HEAP_1_ID                                5                               /*!< RGX BIF Tiling Heap 1 ID */
59 #define RGX_BIF_TILING_HEAP_2_ID                                6                               /*!< RGX BIF Tiling Heap 2 ID */
60 #define RGX_BIF_TILING_HEAP_3_ID                                7                               /*!< RGX BIF Tiling Heap 3 ID */
61 #define RGX_BIF_TILING_HEAP_4_ID                                8                               /*!< RGX BIF Tiling Heap 4 ID */
62 #define RGX_HWBRN37200_HEAP_ID                                  9                               /*!< RGX HWBRN37200 */
63 #define RGX_DOPPLER_HEAP_ID                                             10                              /*!< Doppler Heap ID */
64 #define RGX_DOPPLER_OVERFLOW_HEAP_ID                    11                              /*!< Doppler Overflow Heap ID */
65
66 /* FIXME: work out what this ought to be.  In the old days it was
67    typically bigger than it needed to be.  Is the correct thing
68    "max + 1" ?? */
69 #define RGX_MAX_HEAP_ID         (RGX_DOPPLER_OVERFLOW_HEAP_ID + 1)              /*!< Max Valid Heap ID */
70
71 /*
72   Identify heaps by their names
73 */
74 #define RGX_GENERAL_HEAP_IDENT                  "General"               /*!< RGX General Heap Identifier */
75 #define RGX_PDSCODEDATA_HEAP_IDENT              "PDS Code and Data"     /*!< RGX PDS Code/Data Heap Identifier */
76 #define RGX_USCCODE_HEAP_IDENT                  "USC Code"              /*!< RGX USC Code Heap Identifier */
77 #define RGX_TQ3DPARAMETERS_HEAP_IDENT   "TQ3DParameters"        /*!< RGX TQ 3D Parameters Heap Identifier */
78 #define RGX_BIF_TILING_HEAP_1_IDENT         "BIF Tiling Heap l"     /*!< RGX BIF Tiling Heap 1 identifier */
79 #define RGX_BIF_TILING_HEAP_2_IDENT         "BIF Tiling Heap 2"     /*!< RGX BIF Tiling Heap 2 identifier */
80 #define RGX_BIF_TILING_HEAP_3_IDENT         "BIF Tiling Heap 3"     /*!< RGX BIF Tiling Heap 3 identifier */
81 #define RGX_BIF_TILING_HEAP_4_IDENT         "BIF Tiling Heap 4"     /*!< RGX BIF Tiling Heap 4 identifier */
82 #define RGX_DOPPLER_HEAP_IDENT                  "Doppler"                               /*!< Doppler Heap Identifier */
83 #define RGX_DOPPLER_OVERFLOW_HEAP_IDENT "Doppler Overflow"                              /*!< Doppler Heap Identifier */
84
85 /* BIF tiling heaps have specific buffer requirements based on their XStride
86  * configuration. This is detailed in the BIF tiling documentation and ensures
87  * that the bits swapped by the BIF tiling algorithm do not result in addresses
88  * outside the allocated buffer. The representation here reflects the diagram
89  * in the BIF tiling documentation.
90  * XStride is defined for a platform in sysconfig.h, but the resulting alignment
91  * can be queried through the PVRSRVGetHeapLog2ImportAlignment() API.
92  */
93 #define RGX_BIF_TILING_HEAP_STRIDE_LOG2_FROM_XSTRIDE(X)        (X+1+8)
94 #define RGX_BIF_TILING_HEAP_ALIGN_LOG2_FROM_XSTRIDE(X)       (4+X+1+8)
95 #define RGX_BIF_TILING_HEAP_STRIDE_LOG2_FROM_ALIGN_LOG2(A)       (A-4)
96
97 #endif /* __RGX_HEAPS_H__ */
98