| 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 render_copy.h |
| 24 |
//! \brief header file of render copy base functions |
| 25 |
//! \details define render copy basic API |
| 26 |
//! |
| 27 |
#ifndef __MEDIA_RENDER_COPY_H__ |
| 28 |
#define __MEDIA_RENDER_COPY_H__ |
| 29 |
|
| 30 |
#include <stdint.h> |
| 31 |
#include "mos_os_specific.h" |
| 32 |
#include "media_copy_common.h" |
| 33 |
#include "media_interfaces_mhw.h" |
| 34 |
#include "hal_kerneldll_next.h" |
| 35 |
#include "mhw_render.h" |
| 36 |
#include "mos_defs.h" |
| 37 |
#include "mos_os.h" |
| 38 |
#include "mos_resource_defs.h" |
| 39 |
#include "renderhal.h" |
| 40 |
#include "umKmInc/UmKmDmaPerfTimer.h" |
| 41 |
#include "vp_common.h" |
| 42 |
#include "vphal.h" |
| 43 |
class MhwCpInterface; |
| 44 |
class MhwInterfaces; |
| 45 |
|
| 46 |
const VphalSseuSetting VpDefaultSSEUTable[baseKernelMaxNumID] = |
| 47 |
{// Slice Sub-Slice EU Rsvd(freq) |
| 48 |
{2, 3, 8, 0}, |
| 49 |
}; |
| 50 |
|
| 51 |
// Kernel Params --------------------------------------------------------------- |
| 52 |
const RENDERHAL_KERNEL_PARAM g_rendercopy_KernelParam[RENDER_COPY_NUM] = |
| 53 |
{ |
| 54 |
///* GRF_Count |
| 55 |
// | BT_Count |
| 56 |
// | | Sampler_Count |
| 57 |
// | | | Thread_Count |
| 58 |
// | | | | GRF_Start_Register |
| 59 |
// | | | | | CURBE_Length |
| 60 |
// | | | | | | block_width |
| 61 |
// | | | | | | | block_height |
| 62 |
// | | | | | | | | blocks_x |
| 63 |
// | | | | | | | | | blocks_y |
| 64 |
// | | | | | | | | | |*/ |
| 65 |
{4, 34, 0, RENDER_COPY_THREADS_MAX, 0, 0, 64, 8, 1, 1}, // CopyKernel_1D_to_2D_NV12 |
| 66 |
{4, 34, 0, RENDER_COPY_THREADS_MAX, 0, 0, 64, 8, 1, 1}, // CopyKernel_2D_to_1D_NV12 |
| 67 |
{4, 34, 0, RENDER_COPY_THREADS_MAX, 0, 0, 64, 8, 1, 1}, // CopyKernel_2D_to_2D_NV12 |
| 68 |
{4, 34, 0, RENDER_COPY_THREADS_MAX, 0, 0, 64, 8, 1, 1}, // CopyKernel_1D_to_2D_Planar |
| 69 |
{4, 34, 0, RENDER_COPY_THREADS_MAX, 0, 0, 64, 8, 1, 1}, // CopyKernel_2D_to_1D_Planar |
| 70 |
{4, 34, 0, RENDER_COPY_THREADS_MAX, 0, 0, 64, 8, 1, 1}, // CopyKernel_2D_to_2D_Planar |
| 71 |
{4, 34, 0, RENDER_COPY_THREADS_MAX, 0, 0, 64, 8, 1, 1}, // CopyKernel_1D_to_2D_Packed |
| 72 |
{4, 34, 0, RENDER_COPY_THREADS_MAX, 0, 0, 64, 8, 1, 1}, // CopyKernel_2D_to_1D_Packed |
| 73 |
{4, 34, 0, RENDER_COPY_THREADS_MAX, 0, 0, 64, 8, 1, 1}, // CopyKernel_2D_to_2D_Packed |
| 74 |
}; |
| 75 |
|
| 76 |
typedef struct _RENDER_COPY_CACHE_CNTL |
| 77 |
{ |
| 78 |
bool bL3CachingEnabled; |
| 79 |
VPHAL_MEMORY_OBJECT_CONTROL SourceSurfMemObjCtl; |
| 80 |
VPHAL_MEMORY_OBJECT_CONTROL TargetSurfMemObjCtl; |
| 81 |
|
| 82 |
}RENDER_COPY_CACHE_CNTL, *PRENDER_COPY_CACHE_CNTL; |
| 83 |
|
| 84 |
typedef struct _MEDIACOPY_RENDER_DATA |
| 85 |
{ |
| 86 |
int32_t iBlocksX; |
| 87 |
int32_t iBlocksY; |
| 88 |
int32_t iBindingTable; |
| 89 |
int32_t iMediaID;; |
| 90 |
PRENDERHAL_MEDIA_STATE pMediaState; |
| 91 |
|
| 92 |
// Kernel Information |
| 93 |
PRENDERHAL_KERNEL_PARAM pKernelParam; //!< Kernel Parameter |
| 94 |
Kdll_CacheEntry KernelEntry; //!< Kernel Entry |
| 95 |
int32_t iCurbeLength; |
| 96 |
int32_t iInlineLength; |
| 97 |
|
| 98 |
// Perf |
| 99 |
VPHAL_PERFTAG PerfTag; |
| 100 |
RENDER_COPY_CACHE_CNTL SurfMemObjCtl; |
| 101 |
|
| 102 |
// Debug parameters |
| 103 |
char* pKernelName; //!< Kernel Used for current rendering |
| 104 |
int32_t iCurbeOffset; //!< The offset of curbe data |
| 105 |
} MEDIACOPY_RENDER_DATA, *PMEDIACOPY_RENDER_DATA; |
| 106 |
|
| 107 |
class RenderCopyState |
| 108 |
{ |
| 109 |
public: |
| 110 |
RenderCopyState(PMOS_INTERFACE osInterface, MhwInterfaces *mhwInterfaces); |
| 111 |
|
| 112 |
virtual ~RenderCopyState(); |
| 113 |
|
| 114 |
//! |
| 115 |
//! \brief RenderCopyState initialize |
| 116 |
//! \details Initialize the RenderCopyState, create BLT context. |
| 117 |
//! \return MOS_STATUS |
| 118 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 119 |
//! |
| 120 |
virtual MOS_STATUS Initialize(); |
| 121 |
|
| 122 |
//! |
| 123 |
//! \brief GetBytesPerPixel |
| 124 |
//! \details Get Bytes Per each pixel for different format |
| 125 |
//! \param Formate |
| 126 |
//! [in] Surface's Format |
| 127 |
//! \return int32_t |
| 128 |
//! Return the numb for Byte |
| 129 |
//! |
| 130 |
int32_t GetBytesPerPixelPerPlane(MOS_FORMAT Format); |
| 131 |
|
| 132 |
//! |
| 133 |
//! \brief Get kernel ID |
| 134 |
//! \details choose the kernel ID for each loop. |
| 135 |
//! \return MOS_STATUS |
| 136 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 137 |
//! |
| 138 |
MOS_STATUS GetCurentKernelID(); |
| 139 |
|
| 140 |
//! |
| 141 |
//! \brief Render copy omputer walker setup |
| 142 |
//! \details Computer walker setup for render copy |
| 143 |
//! \param PMHW_WALKER_PARAMS pWalkerParams |
| 144 |
//! [in/out] Pointer to Walker params |
| 145 |
//! \return MOS_STATUS |
| 146 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 147 |
//! |
| 148 |
virtual MOS_STATUS RenderCopyComputerWalker( |
| 149 |
PMHW_GPGPU_WALKER_PARAMS pWalkerParams); |
| 150 |
|
| 151 |
//! |
| 152 |
//! \brief setup surface states |
| 153 |
//! \details Setup surface states for fast 1toN |
| 154 |
|
| 155 |
//! \return MOS_STATUS |
| 156 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 157 |
//! |
| 158 |
MOS_STATUS SetupSurfaceStates(); |
| 159 |
|
| 160 |
MOS_STATUS LoadStaticData(int32_t *piCurbeOffset); |
| 161 |
|
| 162 |
protected: |
| 163 |
|
| 164 |
//! |
| 165 |
//! \brief Submit command |
| 166 |
//! \details Submit render command |
| 167 |
//! \return MOS_STATUS |
| 168 |
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed |
| 169 |
//! |
| 170 |
virtual MOS_STATUS SubmitCMD( ); |
| 171 |
|
| 172 |
public: |
| 173 |
PMOS_INTERFACE m_osInterface = nullptr; |
| 174 |
MhwInterfaces *m_mhwInterfaces = nullptr; |
| 175 |
MhwRenderInterface *m_renderInterface = nullptr; |
| 176 |
RENDERHAL_INTERFACE_LEGACY *m_renderHal = nullptr; |
| 177 |
MhwCpInterface *m_cpInterface = nullptr; |
| 178 |
void *m_pKernelBin = nullptr; |
| 179 |
Kdll_State *m_pKernelDllState = nullptr;//!< Kernel DLL state |
| 180 |
|
| 181 |
volatile RENDERCOPY_KERNELID m_currKernelId = KERNEL_CopyKernel_1D_to_2D_NV12; |
| 182 |
MOS_RESOURCE m_KernelResource = {}; //!<Graphics memory for Kernel acces s |
| 183 |
MEDIACOPY_RENDER_DATA m_RenderData = {}; |
| 184 |
VPHAL_SURFACE m_Source = {}; |
| 185 |
VPHAL_SURFACE m_Target = {}; |
| 186 |
bool m_bNullHwRenderCopy = false; |
| 187 |
}; |
| 188 |
|
| 189 |
#endif // __MEDIA_RENDER_COPY_H__ |