1 /*
2 * Copyright (c) 2022, 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      ddi_libva_decoder_specific.h
24 //! \brief     libva(and its extension) decoder head file
25 //!
26 
27 #ifndef __DDI_LIBVA_DECODER_SPECIFIC_H__
28 #define __DDI_LIBVA_DECODER_SPECIFIC_H__
29 
30 #include "media_libva.h"
31 #include "ddi_cp_interface_next.h"
32 #include "media_libva_cp_interface.h"
33 #include "ddi_vp_functions.h"
34 
35 namespace decode
36 {
37 
38 #define DDI_DECODE_SFC_MAX_WIDTH       4096
39 #define DDI_DECODE_SFC_MAX_HEIGHT      4096
40 #define DDI_DECODE_SFC_MIN_WIDTH       128
41 #define DDI_DECODE_SFC_MIN_HEIGHT      128
42 #define DDI_DECODE_HCP_SFC_MAX_WIDTH   (16*1024)
43 #define DDI_DECODE_HCP_SFC_MAX_HEIGHT  (16*1024)
44 //!
45 //! \struct DDI_DECODE_CONFIG_ATTR_NEXT
46 //! \brief  Ddi decode configuration attribute
47 //!
48 struct DDI_DECODE_CONFIG_ATTR_NEXT
49 {
50     VAProfile     profile;
51     VAEntrypoint  entrypoint;
52     uint32_t      uiDecSliceMode;
53     uint32_t      uiEncryptionType;
54     uint32_t      uiDecProcessingType;
55 };
56 
57 typedef struct DDI_DECODE_CONFIG_ATTR_NEXT *PDDI_DECODE_CONFIG_ATTR_NEXT;
58 
59 class DdiDecodeBase;
60 
61 //!
62 //! \struct DDI_DECODE_CONTEXT
63 //! \brief  Ddi decode context
64 //!
65 struct DDI_DECODE_CONTEXT
66 {
67     // Decoder data related with the specific codec
68     // The instance of DdiDecodeXXX. For example: DdiDecodeAvc, DdiDecodeJpeg
69     DdiDecodeBase                 *m_ddiDecodeNext;
70     // Decoder private data
71     DdiCpInterface                *pCpDdiInterface;
72     DdiCpInterfaceNext            *pCpDdiInterfaceNext;
73     DdiVpFunctions                *pVpDdiInterface;
74     // Parameters
75     CodechalDecodeParams          DecodeParams;
76     uint16_t                      wMode; // Get the info during hand shaking
77     Codechal                      *pCodecHal;
78     bool                          bShortFormatInUse;
79     bool                          bDecodeModeReported;
80     VASurfaceDecodeMBErrors       vaSurfDecErrOutput[2];
81     DDI_CODEC_RENDER_TARGET_TABLE RTtbl;
82     DDI_CODEC_COM_BUFFER_MGR      BufMgr;
83     PDDI_MEDIA_CONTEXT            pMediaCtx;
84     // Add a list to track DPB.
85     VASurfaceID                   RecListSurfaceID[CODEC_AVC_NUM_UNCOMPRESSED_SURFACE];
86     uint32_t                      dwSliceParamBufNum;
87     uint32_t                      dwSliceCtrlBufNum;
88     uint32_t                      uiDecProcessingType;
89 };
90 
91 typedef struct DDI_DECODE_CONTEXT *PDDI_DECODE_CONTEXT;
92 
GetDecContextFromPVOID(void * decCtx)93 static __inline PDDI_DECODE_CONTEXT GetDecContextFromPVOID (void *decCtx)
94 {
95     return (PDDI_DECODE_CONTEXT)decCtx;
96 }
97 } // namespace decode
98 #endif // __DDI_LIBVA_DECODER_SPECIFIC_H__
99