1 /*===================== begin_copyright_notice ==================================
2 
3 # Copyright (c) 2020-2021, Intel Corporation
4 
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
11 
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 # OTHER DEALINGS IN THE SOFTWARE.
22 
23 ======================= end_copyright_notice ==================================*/
24 //!
25 //! \file     codechal_kernel_olp_mdf_xe_xpm.h
26 //! \brief    Implements the MDF OLP kernel for Xe_XPM VC1.
27 //! \details  Implements the MDF OLP kernel for Xe_XPM VC1.
28 //!
29 
30 #ifndef __CODECHAL_KERNEL_OLP_MDF_XE_XPM_H__
31 #define __CODECHAL_KERNEL_OLP_MDF_XE_XPM_H__
32 
33 #include "codechal_decoder.h"
34 #include "codechal_kernel_base.h"
35 
36 union OLPFlags
37 {
38     struct
39     {
40         unsigned short Profile              :MOS_BITFIELD_BIT(0);
41         unsigned short RangeExpansion       :MOS_BITFIELD_BIT(1);
42         unsigned short HorizontalUpscaling  :MOS_BITFIELD_BIT(2);
43         unsigned short VerticalUpscaling    :MOS_BITFIELD_BIT(3);
44         unsigned short Unused1              :MOS_BITFIELD_BIT(4);
45         unsigned short Interlace            :MOS_BITFIELD_BIT(5);
46         unsigned short Unused2              :MOS_BITFIELD_RANGE(6, 7);
47         unsigned short RangeMapUV           :MOS_BITFIELD_RANGE(8, 10);
48         unsigned short RangeMapUVFlag       :MOS_BITFIELD_BIT(11);
49         unsigned short RangeMapY            :MOS_BITFIELD_RANGE(12, 14);
50         unsigned short RangeMapYFlag        :MOS_BITFIELD_BIT(15);
51     };
52     unsigned short value;
53 };
54 
55 struct OLPCurbe
56 {
57     unsigned int   rsvd;
58     unsigned short width;
59     unsigned short height;
60     OLPFlags       olpflags;
61     unsigned short cmp_flag;
62     unsigned short rsvd1;
63 };
64 
65 
66 //!
67 //! \class CodechalKernelOlpMdf
68 //! \brief This class defines the member fields, functions etc used by MDF OLP kernel.
69 //!
70 class CodechalKernelOlpMdf
71 {
72 public:
CodechalKernelOlpMdf()73     CodechalKernelOlpMdf() {};
~CodechalKernelOlpMdf()74     virtual ~CodechalKernelOlpMdf() {}
75     virtual MOS_STATUS Init(PMOS_INTERFACE osInterface);
76     MOS_STATUS UnInit();
77 
78     MOS_STATUS Execute(PMOS_SURFACE src, uint16_t *srcMemory_object_control, PMOS_SURFACE dst, uint16_t *dstMemory_object_control, uint16_t flags);
79 
80 protected:
81     MOS_STATUS SetupSurfaces(PMOS_SURFACE src, uint16_t *srcMemory_object_control, PMOS_SURFACE dst, uint16_t *dstMemory_object_control);
82     MOS_STATUS SetKernelArgs(uint16_t flags, bool uv);
83 
84 protected:
85     PMOS_INTERFACE      m_osInterface = nullptr;
86     CmDevice            *m_cmDevice = nullptr;
87     CmQueue             *m_cmQueue = nullptr;
88     CmTask              *m_cmTask = nullptr;
89     CmProgram           *m_cmProgram = nullptr;
90     CmKernel            *m_cmKernels[2] = { nullptr, };
91     CmThreadGroupSpace  *m_threadGroupSpaces[2] = { nullptr, };
92 
93     CmSurface2D         *m_cmSurfSrc = nullptr;
94     CmSurface2D         *m_cmSurfDst = nullptr;
95     SurfaceIndex        *m_srcYIndex = nullptr;
96     SurfaceIndex        *m_srcUVIndex = nullptr;
97     SurfaceIndex        *m_dstYIndex = nullptr;
98     SurfaceIndex        *m_dstUVIndex = nullptr;
99 
100     bool                 m_SingleTaskPhase = false;
101 };
102 
103 #endif // __CODECHAL_KERNEL_OLP_MDF_XE_XPM_H__