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 //!
24 //! \file     codechal_decode_vc1_g12.h
25 //! \brief    Defines the decode interface extension for Gen12 VC1.
26 //! \details  Defines all types, macros, and functions required by CodecHal for Gen12 VC1 decoding.
27 //!           Definitions are not externally facing.
28 //!
29 
30 #ifndef __CODECHAL_DECODER_VC1_G12_H__
31 #define __CODECHAL_DECODER_VC1_G12_H__
32 
33 #include "codechal_decode_vc1.h"
34 #include "codechal_decode_singlepipe_virtualengine.h"
35 
36 //!
37 //! \class CodechalDecodeVc1G12
38 //! \brief This class defines the member fields, functions etc used by Gen12 VC1 decoder.
39 //!
40 class CodechalDecodeVc1G12 : public CodechalDecodeVc1
41 {
42 public:
43     //!
44     //! \brief  Constructor
45     //! \param    [in] hwInterface
46     //!           Hardware interface
47     //! \param    [in] debugInterface
48     //!           Debug interface
49     //! \param    [in] standardInfo
50     //!           The information of decode standard for this instance
51     //!
52     CodechalDecodeVc1G12(
53         CodechalHwInterface   *hwInterface,
54         CodechalDebugInterface* debugInterface,
55         PCODECHAL_STANDARD_INFO standardInfo);
56 
57     //!
58     //! \brief    Copy constructor
59     //!
60     CodechalDecodeVc1G12(const CodechalDecodeVc1G12&) = delete;
61 
62     //!
63     //! \brief    Copy assignment operator
64     //!
65     CodechalDecodeVc1G12& operator=(const CodechalDecodeVc1G12&) = delete;
66 
67     ~CodechalDecodeVc1G12();
68 
69     MOS_STATUS AllocateStandard(
70         CodechalSetting *          settings) override;
71 
72     //!
73     //! \brief  Set states for each frame to prepare for GEN12 VC1 decode
74     //! \return MOS_STATUS
75     //!         MOS_STATUS_SUCCESS if success, else fail reason
76     //!
77     MOS_STATUS SetFrameStates() override;
78 
79     MOS_STATUS DecodeStateLevel() override;
80 
81     MOS_STATUS DecodePrimitiveLevelVLD() override;
82 
83     MOS_STATUS DecodePrimitiveLevelIT() override;
84 
85     MOS_STATUS InitMmcState() override;
86     void CalcRequestedSpace(
87         uint32_t &requestedSize,
88         uint32_t &additionalSizeNeeded,
89         uint32_t &requestedPatchListSize) override;
90 
91 protected:
92     MOS_STATUS HandleSkipFrame() override;
93 
94     virtual MOS_STATUS PerformVc1Olp();
95 
96     MOS_STATUS SetGpuCtxCreatOption(CodechalSetting *settings) override;
97 
98     PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE m_veState = nullptr;  //!< Sinlge pipe VirtualEngine
99     //! \Huc state level command buffer size is required
100     uint32_t m_HucStateCmdBufferSizeNeeded = 0;
101     //! \Huc state level patch list size is required
102     uint32_t m_HucPatchListSizeNeeded = 0;
103     //! \Record whether status reported
104     bool bOlpReported             = 0;
105     bool bSkipFrameReported       = 0;
106 };
107 #endif  // __CODECHAL_DECODER_VC1_G12_H__
108