File: GmmTextureExt.h

package info (click to toggle)
intel-gmmlib 20.4.1%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,524 kB
  • sloc: cpp: 52,910; ansic: 5,587; makefile: 6
file content (226 lines) | stat: -rw-r--r-- 7,961 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/*==============================================================================
Copyright(c) 2017 Intel Corporation

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files(the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and / or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
============================================================================*/
#pragma once


#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/

// Set packing alignment
#pragma pack(push, 8)

#define GMM_MAX_MIPMAP      15
#define GMM_MAX_MMC_INDEX   64

//===========================================================================
// typedef:
//        GMM_PLANAR_OFFSET_INFO
//
// Description:
//     This structure stores the offset address of each level
//---------------------------------------------------------------------------
typedef struct GMM_PLANAR_OFFSET_INFO_REC
{
    GMM_GFX_SIZE_T     ArrayQPitch;
    GMM_GFX_SIZE_T     X[GMM_MAX_PLANE];
    GMM_GFX_SIZE_T     Y[GMM_MAX_PLANE];
    struct
    {
        GMM_GFX_SIZE_T     Height[GMM_MAX_PLANE];
    } UnAligned;
    uint32_t            NoOfPlanes;
    bool                IsTileAlignedPlanes;
}GMM_PLANAR_OFFSET_INFO;

//===========================================================================
// typedef:
//        GMM_2D_TEXTURE_OFFSET_INFO
//
// Description:
//     This structure stores the offset address of each level
//---------------------------------------------------------------------------
typedef struct GMM_2D_TEXTURE_OFFSET_INFO_REC
{
    GMM_GFX_SIZE_T              ArrayQPitchLock;
    GMM_GFX_SIZE_T              ArrayQPitchRender;
    GMM_GFX_SIZE_T              Offset[GMM_MAX_MIPMAP];
}GMM_2D_TEXTURE_OFFSET_INFO_T;

//===========================================================================
// typedef:
//        GMM_3D_TEXTURE_OFFSET_INFO
//
// Description:
//     This structure stores the offset address of each level
//---------------------------------------------------------------------------
typedef struct GMM_3D_TEXTURE_OFFSET_INFO_REC
{
    GMM_GFX_SIZE_T     Mip0SlicePitch;
    GMM_GFX_SIZE_T     Offset[GMM_MAX_MIPMAP];
}GMM_3D_TEXTURE_OFFSET_INFO_T;

//===========================================================================
// typedef:
//        GMM_OFFSET_INFO
//
// Description:
//     This structure stores the offset address of each level
//---------------------------------------------------------------------------
typedef struct GMM_OFFSET_INFO_REC
{
    union
    {
        GMM_3D_TEXTURE_OFFSET_INFO_T    Texture3DOffsetInfo;
        GMM_2D_TEXTURE_OFFSET_INFO_T    Texture2DOffsetInfo;
        GMM_PLANAR_OFFSET_INFO          Plane;
    };
}GMM_OFFSET_INFO, GMM_OFFSET_INFO_T;

//===========================================================================
// typedef:
//        GMM_TEXTURE_CALC
//
// Description:
//     This struct is used to texture calculator.
//     Forward Declaration: Defined in GmmGenXXTextureCalc*.h
//---------------------------------------------------------------------------
#ifdef __cplusplus
namespace GmmLib
{
    class GmmTextureCalc;
}

typedef GmmLib::GmmTextureCalc GMM_TEXTURE_CALC;
#else
struct GmmTextureCalc;
typedef struct GmmTextureCalc GMM_TEXTURE_CALC;
#endif

//===========================================================================
// typedef:
//      GMM_TEXTURE_INFO_REC
//
// Description:
//      This structure used to request mipmap offset information
//---------------------------------------------------------------------------
typedef struct GMM_TEXTURE_INFO_REC
{
     // Input ----------------------------------
    GMM_RESOURCE_TYPE       Type;
    GMM_RESOURCE_FORMAT     Format;
    uint32_t                BitsPerPixel;
    GMM_RESOURCE_FLAG       Flags;

    uint64_t                BaseWidth;
    uint32_t                BaseHeight;
    uint32_t                Depth;
    uint32_t                MaxLod;
    uint32_t                ArraySize;
    uint32_t                CpTag;

    struct{
        GMM_RESOURCE_USAGE_TYPE Usage;
    }                       CachePolicy;

    GMM_RESOURCE_MSAA_INFO  MSAA;

    // Output ---------------------------------
    GMM_RESOURCE_ALIGNMENT  Alignment;

    uint8_t                 MmcMode[GMM_MAX_MMC_INDEX];
    uint8_t                 MmcHint[GMM_MAX_MMC_INDEX];

    GMM_GFX_SIZE_T          Pitch;
    GMM_GFX_SIZE_T          OverridePitch;   // VirtualPadding

    GMM_GFX_SIZE_T          Size;            // For AuxSurf Size = CCS + CC + Padding
    GMM_GFX_SIZE_T          CCSize;          // 4kb => 128 bit Float + 32bit Native RT + Padding. Usage : Gpu.IndirectClearColor
    GMM_GFX_SIZE_T          UnpaddedSize;    // Unpadded CCS Size for Flags.Gpu.UnifiedAuxSurface only
    GMM_GFX_SIZE_T          SizeReportToOS;  // For Non-aligned ESM

    GMM_OFFSET_INFO         OffsetInfo;      // (X,Y) offsets to each mipmap/plane
    GMM_TILE_MODE           TileMode;
    uint32_t                CCSModeAlign;    // For AUX_CCS, TexAlign.CCSEx index derived from main surface tiling
    uint32_t                LegacyFlags;

    GMM_S3D_INFO            S3d;

    #if(LHDM)
        D3DDDIFORMAT        MsFormat;

    #endif

    struct{
        uint32_t               Seg1    : 8;
        uint32_t               Evict   : 8;
    }                   SegmentOverride; // Used for tuning the Vista driver

    uint32_t               MaximumRenamingListLength;

    #if(_DEBUG || _RELEASE_INTERNAL)
        PLATFORM        Platform;
    #else
        PLATFORM        __Platform; // Do not use--For size preservation only.
    #endif

    struct{
        uint8_t          IsGmmAllocated;
        uint8_t          IsPageAligned;
    }                   ExistingSysMem;
}GMM_TEXTURE_INFO;

//***************************************************************************
//
//                      GMM_TEXTURE API
//
//***************************************************************************
#if(defined(__GMM_KMD__))
GMM_STATUS GmmTexAlloc(GMM_TEXTURE_INFO* pTexInfo);
GMM_STATUS GmmTexLinearCCS(GMM_TEXTURE_INFO* pTexInfo, GMM_TEXTURE_INFO *pAuxTexInfo);
#endif
GMM_STATUS GmmTexGetMipMapOffset(GMM_TEXTURE_INFO* pTexInfo, GMM_REQ_OFFSET_INFO* pReqInfo);

#define GMM_ISNOT_TILED(TileInfo) ((TileInfo).LogicalSize == 0)
#define GMM_IS_TILED(TileInfo)    ((TileInfo).LogicalSize > 0)
#define GMM_CLEAR_TILEINFO(TileInfo)            \
{                                               \
        (TileInfo).LogicalSize = 0;             \
        (TileInfo).LogicalTileHeight = 0;       \
        (TileInfo).LogicalTileWidth = 0;        \
        (TileInfo).MaxPitch = 0;                \
}

#define GMM_IS_4KB_TILE(Flags)  ((Flags).Info.TiledY)
#define GMM_IS_64KB_TILE(Flags) (Flags.Info.TiledYs)

#define GMM_SET_4KB_TILE(Flags, Value) ((Flags).Info.TiledY = (Value))
#define GMM_SET_64KB_TILE(Flags, Value) ((Flags).Info.TiledYs = (Value))
#define GMM_SET_4KB_TILE_MODE(TileMode) (TileMode = LEGACY_TILE_Y)
#define GMM_IS_TILEY (pClientContext->GetSkuTable().FtrTileY)

// Reset packing alignment to project default
#pragma pack(pop)

#ifdef __cplusplus
}
#endif /*__cplusplus*/