xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/Xe_M/Xe_XPM/hw/mhw_utilities_xe_xpm.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*===================== begin_copyright_notice ==================================
2 
3 # Copyright (c) 2020-2021, Intel Corporation
4 
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
11 
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 # OTHER DEALINGS IN THE SOFTWARE.
22 
23 ======================= end_copyright_notice ==================================*/
24 //!
25 //! \file     mhw_utilities_xe_xpm.h
26 //! \brief    Defines common utility used for Xe_XPM
27 //!
28 
29 #ifndef __MHW_UTILITIES_XE_XPM_H__
30 #define __MHW_UTILITIES_XE_XPM_H__
31 
32 #include "mos_os.h"
33 
MosGetHWTileType(MOS_TILE_TYPE tileType,MOS_TILE_MODE_GMM tileModeGMM,bool gmmTileEnabled)34 static __inline uint32_t MosGetHWTileType(MOS_TILE_TYPE tileType, MOS_TILE_MODE_GMM tileModeGMM, bool gmmTileEnabled)
35 {
36     uint32_t tileMode = 0;
37 
38     if (gmmTileEnabled)
39     {
40         return tileModeGMM;
41     }
42 
43     switch (tileType)
44     {
45     case MOS_TILE_LINEAR:
46         tileMode = 0;
47         break;
48     case MOS_TILE_YS:
49         tileMode = 1;
50         break;
51     case MOS_TILE_X:
52         tileMode = 2;
53         break;
54     default:
55         tileMode = 3;
56         break;
57     }
58     return tileMode;
59 }
60 
61 #endif // __MHW_UTILITIES_XE_XPM_H__
62