File: GmmPlatformExt.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 (289 lines) | stat: -rw-r--r-- 11,100 bytes parent folder | download
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
/*==============================================================================
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)

#ifndef __GMM_KMD__
#ifdef _WIN32
    #ifndef PHYSICAL_ADDRESS
    #define PHYSICAL_ADDRESS LARGE_INTEGER
    #endif
#endif
    #ifndef PAGE_SIZE
    #define PAGE_SIZE 4096
    #endif
#endif /*__GMM_KMD__*/

//===========================================================================
// typedef:
//        GMM_FORMAT_ENTRY
//
// Description:
//      This struct is used to describe each surface format in the
//      GMM_RESOURCE_FORMAT enum. Each surface format is desginated as a
//      supported format on the running platform, as well as if the format is
//      renderable.
//
//---------------------------------------------------------------------------
typedef struct GMM_FORMAT_ENTRY_REC
{
    struct
    {
        uint32_t               ASTC         : 1;
        uint32_t               Compressed   : 1;
        uint32_t               RenderTarget : 1;
        uint32_t               Supported    : 1;
    };
    struct
    {
        uint16_t                BitsPer;
        uint8_t                 Depth;
        uint8_t                 Height;
        uint8_t                 Width;
    }                       Element;
    GMM_SURFACESTATE_FORMAT SurfaceStateFormat;
    union {
        GMM_E2ECOMP_FORMAT      AuxL1eFormat;
        uint8_t                 CompressionFormat;
    } CompressionFormat;
}GMM_FORMAT_ENTRY;

//===========================================================================
// typedef:
//     GMM_TILE_MODE_ENUM
//
// Description:
//     Enumeration of supported tile modes.
//
//--------------------------------------------------------------------------
#define DEFINE_TILE_BPEs(TileName) \
    TILE_##TileName##_8bpe,        \
    TILE_##TileName##_16bpe,       \
    TILE_##TileName##_32bpe,       \
    TILE_##TileName##_64bpe,       \
    TILE_##TileName##_128bpe       \

typedef enum GMM_TILE_MODE_ENUM
{
    TILE_NONE,
    // Legacy Tile Modes
    LEGACY_TILE_X,
    LEGACY_TILE_Y,
    // Tile-W is a 64x64 tile swizzled
    // onto a 128x32 Tile-Y.
    // For allocation purposes Tile-W
    // can be treated like Tile-Y
    //     TILE_W

    // Tiled Resource Modes (SKL+)
    DEFINE_TILE_BPEs( YF_1D     ),
    DEFINE_TILE_BPEs( YS_1D     ),
    DEFINE_TILE_BPEs( YF_2D     ),
    DEFINE_TILE_BPEs( YF_2D_2X  ),
    DEFINE_TILE_BPEs( YF_2D_4X  ),
    DEFINE_TILE_BPEs( YF_2D_8X  ),
    DEFINE_TILE_BPEs( YF_2D_16X ),
    DEFINE_TILE_BPEs( YF_3D     ),
    DEFINE_TILE_BPEs( YS_2D     ),
    DEFINE_TILE_BPEs( YS_2D_2X  ),
    DEFINE_TILE_BPEs( YS_2D_4X  ),
    DEFINE_TILE_BPEs( YS_2D_8X  ),
    DEFINE_TILE_BPEs( YS_2D_16X ),
    DEFINE_TILE_BPEs( YS_3D     ),
    GMM_TILE_MODES
}GMM_TILE_MODE;

#undef DEFINE_TILE_BPEs

typedef struct __TEX_ALIGNMENT
{
    uint32_t Width;  // pixels
    uint32_t Height; // scanlines
    uint32_t Depth;  // pixels
} ALIGNMENT;

//===========================================================================
// typedef:
//        GMM_TEXTURE_ALIGN
//
// Description:
//      The following struct describes the texture mip map unit alignment
//      required for each map format. The alignment values are platform
//      dependent.
//
//---------------------------------------------------------------------------
typedef struct GMM_TEXTURE_ALIGN_REC
{
    ALIGNMENT Compressed, Depth, Depth_D16_UNORM_1x_4x_16x, Depth_D16_UNORM_2x_8x, SeparateStencil, YUV422, XAdapter, AllOther;

    struct
    {
        ALIGNMENT  Align;
        uint32_t      MaxPitchinTiles;
    } CCS;
}GMM_TEXTURE_ALIGN;

//===========================================================================
// typedef:
//        __GMM_BUFFER_TYPE_REC
//
// Description:
//     This structure represents a buffer type. Common buffer types are
//     Display buffers, Color buffers, Linear buffers and ring buffers.
//     Each buffer type has platform specific size, dimension  and alignment
//     restricions that are stored here.
//
//---------------------------------------------------------------------------
typedef struct __GMM_BUFFER_TYPE_REC
{
    uint32_t           Alignment;              // Base Address Alignment
    uint32_t           PitchAlignment;         // Pitch Alignment restriction.
    uint32_t           RenderPitchAlignment;   // Pitch Alignment for render surface
    uint32_t           LockPitchAlignment;     // Pitch Alignment for locked surface
    uint32_t           MinPitch;               // Minimum pitch
    GMM_GFX_SIZE_T     MaxPitch;               // Maximum pitch
    GMM_GFX_SIZE_T     MinAllocationSize;      // Minimum Allocation size requirement

    uint32_t           MinHeight;              // Mininum height in bytes
    GMM_GFX_SIZE_T     MinWidth;               // Minimum width in bytes
    uint32_t           MinDepth;               // Minimum depth  (only for volume)
    GMM_GFX_SIZE_T     MaxHeight;              // Maximum height in bytes
    GMM_GFX_SIZE_T     MaxWidth;               // Maximum Width in bytes
    uint32_t           MaxDepth;               // Maximum depth  (only for volume)
    uint32_t           MaxArraySize;
    uint8_t            NeedPow2LockAlignment;  // Locking surface need to be power of 2 aligned
} __GMM_BUFFER_TYPE;

//===========================================================================
// typedef:
//        __GMM_PLATFORM_RESOURCE
//
// Description:
//     This structure represents various platform specific restrictions for
//      - buffer types
//      - tile dimensions
//      - # of fences regisers platform supports
//      - # of addressable bits
//      - aperture size
//
//----------------------------------------------------------------------------
typedef struct __GMM_PLATFORM_RESOURCE_REC
{
    PLATFORM             Platform;
    //
    // Define memory type req., alignment, min allocation size;
    //
    __GMM_BUFFER_TYPE    Vertex;           // Vertex Buffer restrictions
    __GMM_BUFFER_TYPE    Index;            // Index Buffer restrictions
    __GMM_BUFFER_TYPE    Constant;         //
    __GMM_BUFFER_TYPE    StateDx9ConstantBuffer; // Dx9 Constant Buffer pool restrictions

    __GMM_BUFFER_TYPE    Texture2DSurface; // 2D texture surface
    __GMM_BUFFER_TYPE    Texture2DLinearSurface; // 2D Linear media surface
    __GMM_BUFFER_TYPE    Texture3DSurface; // 3D texture surface
    __GMM_BUFFER_TYPE    CubeSurface;      // cube texture surface
    __GMM_BUFFER_TYPE    BufferType;       // Buffer type surface

    __GMM_BUFFER_TYPE    Color;            // Color (Render Target) Buffer
    __GMM_BUFFER_TYPE    Depth;            // Depth Buffer Restriction
    __GMM_BUFFER_TYPE    Stencil;          // Stencil Buffer Restrictions
    __GMM_BUFFER_TYPE    HiZ;              // Hierarchical Depth Buffer Resrictions
    __GMM_BUFFER_TYPE    Stream;           //

    __GMM_BUFFER_TYPE    Video;            // Video Planar surface restrictions
    __GMM_BUFFER_TYPE    MotionComp;       // Motion Compensation buffer

    __GMM_BUFFER_TYPE    Overlay;          // Overlay Buffer
    __GMM_BUFFER_TYPE    Nndi;             // Non native display buffer restrictions
    __GMM_BUFFER_TYPE    ASyncFlipSurface; // ASync flip chain Buffers

    __GMM_BUFFER_TYPE    HardwareMBM;      // Buffer Restrictions

    __GMM_BUFFER_TYPE    InterlacedScan;   //
    __GMM_BUFFER_TYPE    TextApi;          //

    __GMM_BUFFER_TYPE    Linear;           // Linear(Generic) Buffer restrictions
    __GMM_BUFFER_TYPE    Cursor;           // Cursor surface restrictions
    __GMM_BUFFER_TYPE    NoRestriction;    // Motion Comp Buffer

    __GMM_BUFFER_TYPE    XAdapter;         // Cross adapter linear buffer restrictions

    GMM_TEXTURE_ALIGN    TexAlign;         // Alignment Units for Texture Maps

    //
    // various tile dimension based on platform
    //
    GMM_TILE_INFO        TileInfo[GMM_TILE_MODES];

    //
    // General platform Restriction
    //
    uint32_t                NumberFenceRegisters;
    uint32_t                MinFenceSize;               // 1 MB for Napa, 512 KB for Almador

    uint32_t                FenceLowBoundShift;
    uint32_t                FenceLowBoundMask;

    uint32_t                PageTableSteer;             // Default for page table steer register

    uint32_t                PagingBufferPrivateDataSize;
    uint32_t                MaxLod;
    uint32_t                FBCRequiredStolenMemorySize; // Stolen Memory size required for FBC

    GMM_FORMAT_ENTRY     FormatTable[GMM_RESOURCE_FORMATS];

    uint32_t                ResAllocTag[GMM_MAX_HW_RESOURCE_TYPE];  // uint32_t = 4 8-bit ASCII characters

    uint32_t                SurfaceStateYOffsetGranularity;
    uint32_t                SamplerFetchGranularityWidth;
    uint32_t                SamplerFetchGranularityHeight;

    int64_t                SurfaceMaxSize; // int64_t - Surface size is 64 bit for all configurations
    uint32_t                MaxGpuVirtualAddressBitsPerResource;
    uint32_t                MaxSLMSize;

    uint8_t                 HiZPixelsPerByte; //HiZ-Bpp is < 1, keep inverse
    uint64_t                ReconMaxHeight;
    uint64_t                ReconMaxWidth;
    uint8_t                 NoOfBitsSupported;                 // No of bits supported for System physcial address on GPU
    uint64_t                HighestAcceptablePhysicalAddress;  // Highest acceptable System physical Address
}__GMM_PLATFORM_RESOURCE, GMM_PLATFORM_INFO;

//***************************************************************************
//
//                      GMM_PLATFORM_INFO API
//
//***************************************************************************
uint32_t GMM_STDCALL GmmPlatformGetBppFromGmmResourceFormat(GMM_RESOURCE_FORMAT Format);

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

#ifdef __cplusplus
}
#endif /*__cplusplus*/