1 /*
2 * Copyright (c) 2019-2021, 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     decode_status_report_defs.h
24 //! \brief    Defines the common struture for decode status report
25 //! \details
26 //!
27 #ifndef __DECODE_STATUS_REPORT_DEFS_H__
28 #define __DECODE_STATUS_REPORT_DEFS_H__
29 
30 #include "mos_defs.h"
31 #include "codec_def_common.h"
32 #include "media_status_report.h"
33 
34 namespace decode
35 {
36 
37 enum CsEngineIdDef
38 {
39     // Instance ID
40     csInstanceIdVdbox0 = 0,
41     csInstanceIdVdbox1 = 1,
42     csInstanceIdVdbox2 = 2,
43     csInstanceIdVdbox3 = 3,
44     csInstanceIdVdbox4 = 4,
45     csInstanceIdVdbox5 = 5,
46     csInstanceIdVdbox6 = 6,
47     csInstanceIdVdbox7 = 7,
48     csInstanceIdMax,
49     // Class ID
50     classIdVideoEngine = 1,
51 };
52 
53 union CsEngineId
54 {
55     struct
56     {
57         uint32_t       classId            : 3;    //[0...4]
58         uint32_t       reservedFiled1     : 1;    //[0]
59         uint32_t       instanceId         : 6;    //[0...7]
60         uint32_t       reservedField2     : 22;   //[0]
61     } fields;
62     uint32_t            value;
63 };
64 
65 enum DecodeStatusReportType
66 {
67     statusReportGlobalCount = STATUS_REPORT_GLOBAL_COUNT,
68     statusReportMfx,
69 
70     //! \brief decode error status
71     DecErrorStatusOffset,
72 
73     //! \brief decode MB count
74     DecMBCountOffset,
75 
76     //! \brief decode frame CRC
77     DecFrameCrcOffset,
78 
79     //! \brief CS engine ID
80     CsEngineIdOffset_0,
81     CsEngineIdOffset_1,
82     CsEngineIdOffset_2,
83     CsEngineIdOffset_3,
84     CsEngineIdOffset_4,
85     CsEngineIdOffset_5,
86     CsEngineIdOffset_6,
87     CsEngineIdOffset_7,
88 
89     //! \brief MMIO HuCErrorStatus2
90     HucErrorStatus2Reg,
91 
92     //! \brief mask of MMIO HuCErrorStatus2
93     HucErrorStatus2Mask,
94 
95     //! \brief MMIO HuCErrorStatus
96     HucErrorStatusReg,
97     //! \brief mask of MMIO HuCErrorStatus
98     HucErrorStatusMask,
99 
100     statusReportRcs,
101     statusReportMaxNum
102 };
103 
104 struct DecodeStatusParameters
105 {
106     uint32_t           statusReportFeedbackNumber;
107     uint32_t           numberTilesInFrame;
108     uint16_t           pictureCodingType;
109     CODEC_PICTURE      currOriginalPic;
110     CODECHAL_FUNCTION  codecFunction;
111     uint8_t            numUsedVdbox;
112     PCODEC_REF_LIST    currRefList;
113     uint16_t           picWidthInMb;
114     uint16_t           frameFieldHeightInMb;
115     uint32_t           numSlices;
116     MOS_RESOURCE       currDecodedPicRes;
117 #if (_DEBUG || _RELEASE_INTERNAL)
118     MOS_RESOURCE      *sfcOutputPicRes;
119     MOS_RESOURCE      *histogramOutputBuf;
120     MOS_RESOURCE      *fgOutputPicRes;
121 #endif
122 };
123 
124 struct DecodeStatusMfx
125 {
126     //!< HW requires a QW aligned offset for data storage
127     uint32_t                status = 0;
128     //! \brief Value of MMIO decoding effor eStatus register
129     uint32_t                m_mmioErrorStatusReg = 0;
130     //! \brief Value of MMIO decoding MB error register
131     uint32_t                m_mmioMBCountReg = 0;
132     //! \brief Frame CRC related to current frames
133     uint32_t                m_mmioFrameCrcReg = 0;
134     //! \brief Value of MMIO CS Engine ID register for each BB
135     uint32_t                m_mmioCsEngineIdReg[csInstanceIdMax] = { 0 };
136     //! \brief Huc error for HEVC Fix Function, DWORD0: mask value, DWORD1: reg value
137     uint64_t                m_hucErrorStatus2 = 0;
138     //! \brief Huc error for HEVC Fix Function, DWORD0: mask value, DWORD1: reg value
139     uint64_t                m_hucErrorStatus = 0;
140 };
141 
142 struct DecodeStatusRcs
143 {
144     uint32_t                    status;
145     uint32_t                    pad;        //!< Pad
146 };
147 
148 }
149 
150 #endif