| 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 vphal_render_hdr_3dlut_g12.h |
| 24 |
//! \brief Common interface and structure used in HDR (3DLUT generation) for GEN12 |
| 25 |
//! \details Common interface and structure used in HDR (3DLUT generation) for GEN12 Fixed Function Vebox 3DLut |
| 26 |
//! |
| 27 |
#ifndef __VPHAL_RENDER_HDR_3DLUT_G12_H__ |
| 28 |
#define __VPHAL_RENDER_HDR_3DLUT_G12_H__ |
| 29 |
|
| 30 |
#if !EMUL |
| 31 |
#include "vphal_common.h" |
| 32 |
#include "vphal_mdf_wrapper.h" |
| 33 |
#include "vphal_render_hdr_g11.h" |
| 34 |
|
| 35 |
class Hdr3DLutCmRenderG12 : public VPCmRenderer |
| 36 |
{ |
| 37 |
public: |
| 38 |
struct Hdr3DLutPayload |
| 39 |
{ |
| 40 |
VpCmSurfaceHolder<CmBuffer> *hdr3DLutSurface; |
| 41 |
VpCmSurfaceHolder<CmSurface2D> *hdrCoefSurface; |
| 42 |
uint16_t hdr3DLutSurfaceWidth; |
| 43 |
uint16_t hdr3DLutSurfaceHeight; |
| 44 |
}; |
| 45 |
|
| 46 |
Hdr3DLutCmRenderG12(uint32_t *kernelBinary, uint32_t kernelSize, CmContext *cmContext); |
| 47 |
Hdr3DLutCmRenderG12(const Hdr3DLutCmRenderG12&) = delete; |
| 48 |
Hdr3DLutCmRenderG12& operator=(const Hdr3DLutCmRenderG12&) = delete; |
| 49 |
virtual ~Hdr3DLutCmRenderG12(); |
| 50 |
|
| 51 |
private: |
| 52 |
virtual void AttachPayload(void *payload); |
| 53 |
virtual CmKernel *GetKernelToRun(std::string &name); |
| 54 |
virtual void GetThreadSpaceDimension(int &tsWidth, int &tsHeight, int &tsColor); |
| 55 |
virtual void PrepareKernel(CmKernel *kernel); |
| 56 |
|
| 57 |
CmProgram *m_cmProgram = nullptr; |
| 58 |
CmKernel *m_cmKernel = nullptr; |
| 59 |
Hdr3DLutPayload *m_cmPayload = nullptr; |
| 60 |
}; |
| 61 |
|
| 62 |
class Hdr3DLutGeneratorG12 |
| 63 |
{ |
| 64 |
public: |
| 65 |
explicit Hdr3DLutGeneratorG12(PRENDERHAL_INTERFACE vphalRenderer, uint32_t *kernelBinary, uint32_t kernelSize); |
| 66 |
Hdr3DLutGeneratorG12(const Hdr3DLutGeneratorG12 &) = delete; |
| 67 |
Hdr3DLutGeneratorG12 &operator=(const Hdr3DLutGeneratorG12 &) = delete; |
| 68 |
virtual ~Hdr3DLutGeneratorG12(); |
| 69 |
|
| 70 |
void Render(const uint32_t maxDLL, const uint32_t maxCLL, const VPHAL_HDR_MODE hdrMode, const PVPHAL_SURFACE p3DLutSurface); |
| 71 |
bool IsObjectVaild(); |
| 72 |
|
| 73 |
private: |
| 74 |
void AllocateResources(); |
| 75 |
void FreeResources(); |
| 76 |
|
| 77 |
void InitCoefSurface(const uint32_t maxDLL, const uint32_t maxCLL, const VPHAL_HDR_MODE hdrMode); |
| 78 |
void Init3DLutSurface(); |
| 79 |
|
| 80 |
EventManager *m_eventManager = nullptr; |
| 81 |
|
| 82 |
PRENDERHAL_INTERFACE m_renderHal = nullptr; |
| 83 |
VpCmSurfaceHolder<CmBuffer> *m_hdr3DLutSurface = nullptr; |
| 84 |
VpCmSurfaceHolder<CmSurface2D> *m_hdrCoefSurface = nullptr; |
| 85 |
Hdr3DLutCmRenderG12 *m_hdr3DLutCmRender = nullptr; |
| 86 |
float *m_hdrcoefBuffer = nullptr; |
| 87 |
uint8_t *m_hdr3DLutSysBuffer = nullptr; |
| 88 |
CmContext *m_cmContext = nullptr; |
| 89 |
|
| 90 |
bool m_bHdr3DLutInit = false; |
| 91 |
uint32_t m_savedMaxDLL = 1000; |
| 92 |
uint32_t m_savedMaxCLL = 4000; |
| 93 |
VPHAL_HDR_MODE m_savedHdrMode = VPHAL_HDR_MODE_NONE; |
| 94 |
|
| 95 |
// Default to 65^3 |
| 96 |
const uint32_t m_segSize = 65; |
| 97 |
const uint32_t m_mulSize = 128; |
| 98 |
const uint32_t m_lutSizeInBytes = m_segSize * m_segSize * m_mulSize * 4 * 2; |
| 99 |
|
| 100 |
uint32_t* m_kernelBinary = nullptr; |
| 101 |
uint32_t m_kernelSize = 0; |
| 102 |
}; |
| 103 |
#else |
| 104 |
#include "vphal_render_hdr.h" |
| 105 |
class Hdr3DLutGeneratorG12 |
| 106 |
{ |
| 107 |
public: |
| 108 |
explicit Hdr3DLutGeneratorG12(PRENDERHAL_INTERFACE vphalRenderer, uint32_t* kernelBinary, uint32_t kernelSize) |
| 109 |
{ |
| 110 |
MOS_UNUSED(vphalRenderer); |
| 111 |
MOS_UNUSED(kernelBinary); |
| 112 |
MOS_UNUSED(kernelSize); |
| 113 |
}; |
| 114 |
|
| 115 |
Hdr3DLutGeneratorG12(const Hdr3DLutGeneratorG12 &) = delete; |
| 116 |
Hdr3DLutGeneratorG12 &operator=(const Hdr3DLutGeneratorG12 &) = delete; |
| 117 |
virtual ~Hdr3DLutGeneratorG12() {}; |
| 118 |
|
| 119 |
void Render(const uint32_t maxDLL, const uint32_t maxCLL, const VPHAL_HDR_MODE hdrMode, const PVPHAL_SURFACE p3DLutSurface) |
| 120 |
{ |
| 121 |
return ; |
| 122 |
}; |
| 123 |
bool IsObjectVaild() { return true; }; |
| 124 |
}; |
| 125 |
#endif |
| 126 |
#endif // __VPHAL_RENDER_HDR_G12_H__ |