xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/common/renderhal/renderhal_dsh.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2015-2017, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file      renderhal_dsh.h
24 //! \brief         This module defines render engine state heap management functions based     on dynamic state heap (DSH) infrastructure, rather than static state heap.
25 //!
26 #ifndef __RENDERHAL_DSH_H__
27 #define __RENDERHAL_DSH_H__
28 
29 #include "mhw_state_heap.h"
30 #include "heap.h"
31 
32 // Absolute max number of interface descriptors
33 #define RENDERHAL_DSH_MAX_MEDIA_IDs 16
34 
35 // Media dynamic state pool increment
36 #define RENDERHAL_DSH_DYN_STATE_INC 16
37 
38 // Kernel allocation pool increment
39 #define RENDERHAL_DSH_KRN_ALLOC_INC 16
40 
41 typedef struct _RENDERHAL_REGION
42 {
43     int32_t                 iCount;             // Total Object count
44     int32_t                 iCurrent;           // Current Object count
45     uint32_t                dwOffset;           // Region offset (from Media State Base)
46     uint32_t                dwSize;             // Region size
47 } RENDERHAL_REGION;
48 
49 // Forward declarations
50 typedef struct _RENDERHAL_KRN_ALLOCATION *PRENDERHAL_KRN_ALLOCATION;
51 typedef struct _RENDERHAL_INTERFACE      *PRENDERHAL_INTERFACE;
52 
53 typedef struct _RENDERHAL_DYNAMIC_STATE *PRENDERHAL_DYNAMIC_STATE;
54 
55 typedef struct _RENDERHAL_DYNAMIC_STATE
56 {
57     // Memory block associated with the media state
58     MemoryBlock                 memoryBlock;                                  // block associated with the Media State
59 
60     // Dynamic media state regions
61     uint32_t                    dwSizeSamplers;                                 // Total samplers size per MediaID
62     RENDERHAL_REGION            Curbe;                                          // CURBE data
63     RENDERHAL_REGION            MediaID;                                        // Media Interface Descriptors
64     RENDERHAL_REGION            Sampler3D;                                      // 3D Sampler states (also sampler base)
65     RENDERHAL_REGION            SamplerAVS;                                     // AVS Sampler states
66     RENDERHAL_REGION            SamplerConv;                                    // Conv Sampler states
67     RENDERHAL_REGION            SamplerMisc;                                    // Misc (VA) Sampler states
68     RENDERHAL_REGION            SamplerInd;                                     // Indirect Sampler states
69     RENDERHAL_REGION            Table8x8;                                       // AVS Sampler 8x8 tables
70     RENDERHAL_REGION            Performance;                                    // Performance collection
71 
72     // State allocations
73     int32_t                     iMaxScratchSpacePerThread;                      // Max per thread scratch space reported by JITTER
74     uint32_t                    dwScratchSpace;                                 // Size of scratch space needed
75     uint32_t                    scratchSpaceOffset;                             // Offset to scratch space which is relative to General State Base Address
76     int32_t                     iCurrentBindingTable;                           // Current binding table
77     int32_t                     iCurrentSurfaceState;                           // Current surface state
78     PRENDERHAL_KRN_ALLOCATION   pKrnAllocations[RENDERHAL_DSH_MAX_MEDIA_IDs];   // Media Kernel Allocations (1:1 mapping with Media IDs)
79 } RENDERHAL_DYNAMIC_STATE, *PRENDERHAL_DYNAMIC_STATE;
80 
81 //---------------------------
82 // Dynamic State Heap Objects
83 //---------------------------
84 typedef struct _RENDERHAL_DYN_HEAP_SETTINGS
85 {
86     // Dynamic State Heap Settings
87     uint32_t                dwDshInitialSize;
88     uint32_t                dwDshSizeIncrement;
89     uint32_t                dwDshMaximumSize;
90 
91     // Instruction Heap Settings
92     uint32_t                dwIshInitialSize;
93     uint32_t                dwIshSizeIncrement;
94     uint32_t                dwIshMaximumSize;
95 
96     // Media State settings
97     int32_t                 iMinMediaStates;
98     int32_t                 iMaxMediaStates;
99 
100     // Kernel State settings
101     int32_t                 iMinKernels;
102     int32_t                 iMaxKernels;
103 } RENDERHAL_DYN_HEAP_SETTINGS, *PRENDERHAL_DYN_HEAP_SETTINGS;
104 
105 #endif // __RENDERHAL_DSH_H__
106