xref: /aosp_15_r20/external/intel-media-driver/media_softlet/agnostic/common/hw/vdbox/mhw_vdbox_huc_cmdpar.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 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     mhw_vdbox_huc_cmdpar.h
24 //! \brief    MHW command parameters
25 //! \details
26 //!
27 
28 #ifndef __MHW_VDBOX_HUC_CMDPAR_H__
29 #define __MHW_VDBOX_HUC_CMDPAR_H__
30 
31 
32 #include "mhw_vdbox_cmdpar.h"
33 #include "encode_utils.h"
34 #include "mhw_vdbox_huc_def.h"
35 
36 namespace mhw
37 {
38 namespace vdbox
39 {
40 namespace huc
41 {
42 
_MHW_PAR_T(HUC_PIPE_MODE_SELECT)43 struct _MHW_PAR_T(HUC_PIPE_MODE_SELECT)
44 {
45     uint32_t mode                       = 0;
46     uint32_t mediaSoftResetCounterValue = 0;
47     bool     streamOutEnabled           = false;
48     bool     disableProtectionSetting   = false;
49 };
50 
51 
_MHW_PAR_T(HUC_IND_OBJ_BASE_ADDR_STATE)52 struct _MHW_PAR_T(HUC_IND_OBJ_BASE_ADDR_STATE)
53 {
54     PMOS_RESOURCE DataBuffer            = nullptr;
55     uint32_t      DataOffset            = 0;
56     uint32_t      DataSize              = 0;
57     PMOS_RESOURCE StreamOutObjectBuffer = nullptr;
58     uint32_t      StreamOutObjectOffset = 0;
59     uint32_t      StreamOutObjectSize   = 0;
60 };
61 
_MHW_PAR_T(HUC_STREAM_OBJECT)62 struct _MHW_PAR_T(HUC_STREAM_OBJECT)
63 {
64     uint32_t IndirectStreamInDataLength      = 0;
65     uint32_t IndirectStreamInStartAddress    = 0;
66     bool     HucProcessing = false;
67     uint32_t IndirectStreamOutStartAddress   = 0;
68     uint8_t  StreamOut                       = 0;
69     uint8_t  HucBitstreamEnable              = 0;
70     uint8_t  EmulationPreventionByteRemoval  = 0;
71     uint8_t  StartCodeSearchEngine           = 0;
72     uint8_t  Drmlengthmode                   = 0;
73     uint8_t  StartCodeByte2                  = 0;
74     uint8_t  StartCodeByte1                  = 0;
75     uint8_t  StartCodeByte0                  = 0;
76 };
77 
_MHW_PAR_T(HUC_IMEM_STATE)78 struct _MHW_PAR_T(HUC_IMEM_STATE)
79 {
80     uint32_t      kernelWopcmOffset    = 0;  // 32KB-aligned kernel offset in WOPCM
81     uint32_t      kernelDescriptor     = 0;  // kernel descriptor
82     PMOS_RESOURCE hucBinaryImageBuffer = nullptr;
83 };
84 
_MHW_PAR_T(HUC_DMEM_STATE)85 struct _MHW_PAR_T(HUC_DMEM_STATE)
86 {
87     HuCFunction   function      = BRC_INIT;
88     uint8_t       passNum       = 0;
89     uint8_t       currentPass   = 0;
90     uint32_t      dataLength    = 0;        // length in bytes of the HUC data. Must be in increments of 64B
91     uint32_t      dmemOffset    = 0;        // DMEM offset in the HuC Kernel. This is different for ViperOS vs GEMS.
92     PMOS_RESOURCE hucDataSource = nullptr;  // resource for HuC data source
93 };
94 
_MHW_PAR_T(HUC_VIRTUAL_ADDR_STATE)95 struct _MHW_PAR_T(HUC_VIRTUAL_ADDR_STATE)
96 {
97     HuCFunction                 function = BRC_INIT;
98 
99     MHW_VDBOX_HUC_REGION_PARAMS regionParams[16];
100 };
101 
_MHW_PAR_T(HUC_START)102 struct _MHW_PAR_T(HUC_START)
103 {
104     bool lastStreamObject = true;
105 };
106 
107 }  // namespace huc
108 }  // namespace vdbox
109 }  // namespace mhw
110 
111 #endif  // __MHW_VDBOX_HUC_CMDPAR_H__
112