1 /*
2 * Copyright (c) 2021-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     capstable_data_linux_definition.h
24 //! \brief    This file defines the data structure for MediaCapsTableLinux.
25 //!
26 
27 #ifndef __CAPSTABLE_DATA_LINUX_DEFINITION_H__
28 #define __CAPSTABLE_DATA_LINUX_DEFINITION_H__
29 
30 #include "va/va.h"
31 #include "media_libva_util_next.h"
32 
33 #include "hwinfo_linux.h"
34 #include "linux_system_info.h"
35 #include "media_ddi_decode_const.h"
36 #include "media_ddi_encode_const.h"
37 #include "media_libva_caps_factory.h"
38 
39 //!
40 //! \struct  VASurfaceAttribInfo
41 //! \brief  parameters to construct VA Surface Attribute
42 //!
43 struct VASurfaceAttribInfo
44 {
45     VASurfaceAttribType type1;
46     uint32_t            flags;
47     VAGenericValue      value;
48 };
49 
50 //!
51 //! \struct ComponentData
52 //! \brief  component specific data for ConfigLinux
53 //!
54 struct ComponentData
55 {
56     union
57     {
58         struct // Encode usage
59         {
60             uint32_t rcMode;      //!< RateControl Mode
61             uint32_t feiFunction; //!< Fei Function
62         };
63         struct // Decode usage
64         {
65             uint32_t sliceMode;   //!< Decode slice mode
66             uint32_t encryptType; //!< Decode entrypoint Type
67             uint32_t processType; //!< Decode processing Type
68         };
69         struct // Cp usage
70         {
71             uint32_t sessionMode;   //!< Session mode
72             uint32_t sessionType;   //!< Session type
73             uint32_t algorithm;     //!< Algorithm
74             uint32_t blockSize;     //!< Block size
75             uint32_t counterMode;   //!< Counter mode
76             uint32_t sampleType;    //!< Sample type
77             uint32_t usage;         //!< Usage
78         };
79     } data;
80 
ComponentDataComponentData81     ComponentData()
82     {
83         data.sessionMode = data.sessionType = data.algorithm = data.blockSize = data.counterMode = data.sampleType = data.usage = 0;
84     }
ComponentDataComponentData85     ComponentData(uint32_t rcMode, uint32_t feiFunction)
86     {
87         data.rcMode = rcMode; data.feiFunction = feiFunction;
88     }
ComponentDataComponentData89     ComponentData(uint32_t sessionMode, uint32_t sessionType, uint32_t algorithm, uint32_t blockSize, uint32_t counterMode, uint32_t sampleType, uint32_t usage)
90     {
91         data.sessionMode = sessionMode; data.sessionType = sessionType; data.algorithm = algorithm; data.blockSize = blockSize;
92         data.counterMode = counterMode; data.sampleType  = sampleType;  data.usage     = usage;
93     }
ComponentDataComponentData94     ComponentData(uint32_t sliceMode, uint32_t encryptType, uint32_t processType)
95     {
96         data.sliceMode = sliceMode; data.encryptType = encryptType; data.processType = processType;
97     }
98 };
99 
100 typedef std::vector<VASurfaceAttribInfo>  ProfileSurfaceAttribInfo;
101 typedef std::vector<ComponentData>        ConfigDataList;
102 typedef std::vector<VAConfigAttrib>       AttribList;
103 
104 struct EntrypointData
105 {
106     const AttribList                *attribList;
107     const ConfigDataList            *configDataList;
108     const ProfileSurfaceAttribInfo  *surfaceAttrib;
109 };
110 
111 typedef std::map<const VAEntrypoint, const EntrypointData*>   EntrypointMap;
112 typedef std::map<const VAProfile,    const EntrypointMap*>    ProfileMap;
113 typedef std::map<const uint32_t,     const VAImageFormat*>    ImgTable;
114 
115 struct CapsData
116 {
117     const ProfileMap   *profileMap;
118     const ImgTable     *imgTbl;
119 };
120 
121 #endif //__CAPSTABLE_DATA_LINUX_DEFINITION_H__
122