xref: /aosp_15_r20/external/intel-media-driver/media_driver/agnostic/gen12/codec/hal/codechal_mmc_g12.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
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_mmc_g12.h
24 //! \brief    Defines the public interface for Gen12 CodecHal Media Memory Compression
25 //!
26 #ifndef __CODECHAL_MMC_G12_H__
27 #define __CODECHAL_MMC_G12_H__
28 
29 #include "codechal_mmc.h"
30 #include "codechal_decode_singlepipe_virtualengine.h"
31 
32 //! \class CodecHalMmcStateG12
33 //! \brief Gen12 common media memory compression state. This class defines the member fields
34 //!        functions etc used by Gen12 codec memory compression.
35 //!
36 class CodecHalMmcStateG12 : public CodecHalMmcState
37 {
38 public:
39 
40     //!
41     //! \brief    Constructor
42     //!
43     CodecHalMmcStateG12(
44         CodechalHwInterface    *hwInterface);
45 
46     //!
47     //! \brief    Destructor
48     //!
49     ~CodecHalMmcStateG12();
50 
51     MOS_STATUS SetSurfaceParams(
52         PCODECHAL_SURFACE_CODEC_PARAMS surfaceParams);
53 
54     MOS_STATUS SetSurfaceState(
55         PMHW_VDBOX_SURFACE_PARAMS surfaceStateParams,
56         PMOS_COMMAND_BUFFER cmdBuffer = nullptr);
57 
58     MOS_STATUS SendPrologCmd(
59         MhwMiInterface      *miInterface,
60         MOS_COMMAND_BUFFER  *cmdBuffer,
61         MOS_GPU_CONTEXT     gpuContext);
62 
63     MOS_STATUS ClearAuxSurf(
64         CodechalDecode *                                m_decodec,
65         MhwMiInterface *                                miInterface,
66         MOS_RESOURCE *                                  res,
67         PCODECHAL_DECODE_SINGLEPIPE_VIRTUALENGINE_STATE m_veState);
68 
69 
70 protected:
71 
72     void InitDecodeMmcEnable(
73         CodechalHwInterface    *hwInterface);
74 
75     void InitEncodeMmcEnable(
76         CodechalHwInterface    *hwInterface);
77 
78     bool m_mmcEnabledForComponent = false;   //!< Indicate if mmc is enabled for g12, maybe different for encode/decode instance.
79 
80     MOS_RESOURCE    auxBufForClear;          //!< Allocate buffer for clear aux table
81 };
82 
83 #endif  // __CODECHAL_MMC_G12_H__
84