1 /*
2 * Copyright (c) 2017-2019, 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     codechal_encode_sw_scoreboard_g12.h
24 //! \brief    Gen12 class for SW socreboard init kernel.
25 //!
26 
27 #ifndef __CODECHAL_ENCODE_SW_SCOREBOARD_G12_H__
28 #define __CODECHAL_ENCODE_SW_SCOREBOARD_G12_H__
29 
30 #include "codechal_encode_sw_scoreboard.h"
31 
32 class CodechalEncodeSwScoreboardG12 : public CodechalEncodeSwScoreboard
33 {
34 public:
35     //!
36     //! \brief    SW scoreboard init kernel binding table
37     //!
38     enum KernelBTI
39     {
40         swScoreboardInitSurface = 0,
41         swScoreboardNumSurfaces = 1,
42     };
43 
44     //!
45     //! \brief    Get SW scoreboard init BT count
46     //!
47     //! \return   Number of BTI
48     //!
49     virtual uint8_t GetBTCount() override;
50 
51     //!
52     //! \brief    Initialize SW scoreboard init kernel state
53     //!
54     //! \return   MOS_STATUS
55     //!           MOS_STATUS_SUCCESS if success, else fail reason
56     //!
57     MOS_STATUS InitKernelState() override;
58 
59     //!
60     //! \brief    Constructor
61     //!
CodechalEncodeSwScoreboardG12(CodechalEncoderState * encoder)62     CodechalEncodeSwScoreboardG12(CodechalEncoderState* encoder) :
63         CodechalEncodeSwScoreboard(encoder) {}
64 
65     //!
66     //! \brief    Destructor
67     //!
~CodechalEncodeSwScoreboardG12()68     ~CodechalEncodeSwScoreboardG12() {};
69 
70 protected:
71     //!
72     //! \brief    SW scoreboard init kernel Curbe data
73     //!
74     struct CurbeData
75     {
76         // DW0
77         union
78         {
79             struct
80             {
81                 uint32_t   scoreboardWidth    : MOS_BITFIELD_RANGE( 0, 15);
82                 uint32_t   scoreboardHeight   : MOS_BITFIELD_RANGE(16, 31);
83             };
84             struct
85             {
86                 uint32_t   value;
87             };
88         } DW0;
89 
90         // DW1
91         union
92         {
93             struct
94             {
95                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
96             };
97             struct
98             {
99                 uint32_t   value;
100             };
101         } DW1;
102 
103         // DW2
104         union
105         {
106             struct
107             {
108                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
109             };
110             struct
111             {
112                 uint32_t   value;
113             };
114         } DW2;
115 
116         // DW3
117         union
118         {
119             struct
120             {
121                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
122             };
123             struct
124             {
125                 uint32_t   value;
126             };
127         } DW3;
128 
129         // DW4
130         union
131         {
132             struct
133             {
134                 uint32_t   dependencyPattern  : MOS_BITFIELD_RANGE( 0, 15);
135                 uint32_t   reserved           : MOS_BITFIELD_RANGE(16, 31);
136             };
137             struct
138             {
139                 uint32_t   value;
140             };
141         } DW4;
142 
143         // DW5
144         union
145         {
146             struct
147             {
148                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
149             };
150             struct
151             {
152                 uint32_t   value;
153             };
154         } DW5;
155 
156         // DW6
157         union
158         {
159             struct
160             {
161                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
162             };
163             struct
164             {
165                 uint32_t   value;
166             };
167         } DW6;
168 
169         // DW7
170         union
171         {
172             struct
173             {
174                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
175             };
176             struct
177             {
178                 uint32_t   value;
179             };
180         } DW7;
181 
182         // DW8
183         union
184         {
185             struct
186             {
187                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
188             };
189             struct
190             {
191                 uint32_t   value;
192             };
193         } DW8;
194 
195         // DW9
196         union
197         {
198             struct
199             {
200                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
201             };
202             struct
203             {
204                 uint32_t   value;
205             };
206         } DW9;
207 
208         // DW10
209         union
210         {
211             struct
212             {
213                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
214             };
215             struct
216             {
217                 uint32_t   value;
218             };
219         } DW10;
220 
221         // DW11
222         union
223         {
224             struct
225             {
226                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
227             };
228             struct
229             {
230                 uint32_t   value;
231             };
232         } DW11;
233 
234         // DW12
235         union
236         {
237             struct
238             {
239                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
240             };
241             struct
242             {
243                 uint32_t   value;
244             };
245         } DW12;
246 
247         // DW13
248         union
249         {
250             struct
251             {
252                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
253             };
254             struct
255             {
256                 uint32_t   value;
257             };
258         } DW13;
259 
260         // DW14
261         union
262         {
263             struct
264             {
265                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
266             };
267             struct
268             {
269                 uint32_t   value;
270             };
271         } DW14;
272 
273         // DW15
274         union
275         {
276             struct
277             {
278                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
279             };
280             struct
281             {
282                 uint32_t   value;
283             };
284         } DW15;
285 
286         // DW16
287         union
288         {
289             struct
290             {
291                 uint32_t   softwareScoreboard : MOS_BITFIELD_RANGE( 0, 31);
292             };
293             struct
294             {
295                 uint32_t   value;
296             };
297         } DW16;
298 
299         // DW17
300         union
301         {
302             struct
303             {
304                 uint32_t   reserved           : MOS_BITFIELD_RANGE( 0, 31);
305             };
306             struct
307             {
308                 uint32_t   value;
309             };
310         } DW17;
311 
312     };
313     C_ASSERT(MOS_BYTES_TO_DWORDS(sizeof(CurbeData)) == 18);
314 
315     //!
316     //! \brief    Setup Curbe
317     //!
318     //! \return   MOS_STATUS
319     //!           MOS_STATUS_SUCCESS if success, else fail reason
320     //!
321     virtual MOS_STATUS SetCurbe() override;
322 };
323 
324 #endif  // __CODECHAL_ENCODE_SW_SCOREBOARD_G12_H__
325