Skip to content

Commit

Permalink
[VP] Separate FP16 and HDR Legacy Code and fix alpha perf issue
Browse files Browse the repository at this point in the history
Separate FP16 and HDR Legacy Code.
  • Loading branch information
VickyZengg authored and intel-mediadev committed Jul 15, 2024
1 parent 1b8f7b4 commit c6cadb7
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 14 deletions.
12 changes: 6 additions & 6 deletions media_common/agnostic/common/hw/mhw_vebox.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ typedef struct _MHW_VEBOX_MODE
uint32_t Hdr1DLutEnable : 1;
uint32_t Fp16ModeEnable : 1;
uint32_t Hdr1K1DLut : 1;
uint32_t : 7; // Reserved
uint32_t GamutExpansionPosition : 1;
uint32_t EotfPrecision : 1;
uint32_t BypassCcm : 1;
uint32_t BypassOetf : 1;
uint32_t : 3; // Reserved
} MHW_VEBOX_MODE, *PMHW_VEBOX_MODE;

typedef enum _MHW_VEBOX_ADDRESS_SHIFT
Expand Down Expand Up @@ -210,14 +214,10 @@ typedef struct _MHW_VEBOX_3D_LUT

typedef struct _MHW_VEBOX_FP16_INPUT
{
uint32_t GamutExpansionPosition : 1;
uint32_t EotfPrecision : 1;
uint32_t BypassCcm : 1;
uint32_t BypassOetf : 1;
uint32_t VeboxFp16InputEnable : 1;
uint32_t RgbSwapForFp16Input : 1;
uint32_t HdrGainFactor : 8;
uint32_t : 18; // Reserved
uint32_t : 22; // Reserved
} MHW_VEBOX_FP16_INPUT, *PMHW_VEBOX_FP16_INPUT;

//!
Expand Down
11 changes: 6 additions & 5 deletions media_softlet/agnostic/common/hw/mhw_vebox_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ class Impl : public Itf, public mhw::Impl
return MOS_STATUS_SUCCESS;
}

MOS_STATUS SetAlphaFromStateSelect(
PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams) override
{
return MOS_STATUS_SUCCESS;
}

MOS_STATUS SetVeboxLaceColorParams(
MHW_LACE_COLOR_CORRECTION *pLaceColorParams) override
{
Expand Down Expand Up @@ -940,11 +946,6 @@ class Impl : public Itf, public mhw::Impl
return MOS_STATUS_SUCCESS;
}

MOS_STATUS AddEOTFState(void *&surface, PMHW_1DLUT_PARAMS p1DLutParams) override
{
return MOS_STATUS_SUCCESS;
}

MOS_STATUS AddFP16State(PMHW_FP16_PARAMS pFP16Params) override
{
return MOS_STATUS_SUCCESS;
Expand Down
4 changes: 2 additions & 2 deletions media_softlet/agnostic/common/hw/mhw_vebox_itf.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class Itf

virtual MOS_STATUS SetDisableHistogram(PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams) = 0;

virtual MOS_STATUS SetAlphaFromStateSelect(PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams) = 0;

virtual MOS_STATUS SetVeboxLaceColorParams(MHW_LACE_COLOR_CORRECTION *pLaceColorParams) = 0;

virtual MOS_STATUS SetVeboxIecpAceState(PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams) = 0;
Expand Down Expand Up @@ -110,8 +112,6 @@ class Itf

virtual MOS_STATUS Add1DLutState(void *&surface, PMHW_1DLUT_PARAMS p1DLutParams) = 0;

virtual MOS_STATUS AddEOTFState(void *&surface, PMHW_1DLUT_PARAMS p1DLutParams) = 0;

virtual MOS_STATUS AddFP16State(PMHW_FP16_PARAMS pFP16Params) = 0;

_VEBOX_CMD_DEF(_MHW_CMD_ALL_DEF_FOR_ITF);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,13 @@ MOS_STATUS VpVeboxCmdPacket::SetupVebox3DLutForHDR(mhw::vebox::VEBOX_STATE_PAR &
pVeboxMode = &veboxStateCmdParams.VeboxMode;
pLUT3D = &veboxStateCmdParams.LUT3D;
p1DLutParams = &(pRenderData->GetIECPParams().s1DLutParams);

VP_RENDER_CHK_NULL_RETURN(pVeboxMode);
VP_RENDER_CHK_NULL_RETURN(p1DLutParams);
VP_RENDER_CHK_NULL_RETURN(pLUT3D);

pLUT3D->ArbitrationPriorityControl = 0;
pLUT3D->Lut3dEnable = true;

// Config 3DLut size to 65 for HDR10 usage.
pLUT3D->Lut3dSize = 2;
if (pRenderData->HDR3DLUT.uiLutSize == 33)
Expand All @@ -249,6 +253,18 @@ MOS_STATUS VpVeboxCmdPacket::SetupVebox3DLutForHDR(mhw::vebox::VEBOX_STATE_PAR &

veboxStateCmdParams.pVebox3DLookUpTables = &surf3DLut->osSurface->OsResource;

VP_RENDER_CHK_STATUS_RETURN(SetupHDRUnifiedForHDR(veboxStateCmdParams));

return MOS_STATUS_SUCCESS;
}

MOS_STATUS VpVeboxCmdPacket::SetupHDRUnifiedForHDR(mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams)
{
PMHW_VEBOX_MODE pVeboxMode = nullptr;

pVeboxMode = &veboxStateCmdParams.VeboxMode;

pVeboxMode->Hdr1K1DLut = true;
return MOS_STATUS_SUCCESS;
}

Expand Down Expand Up @@ -283,13 +299,17 @@ MOS_STATUS VpVeboxCmdPacket::SetupVeboxState(mhw::vebox::VEBOX_STATE_PAR& veboxS
VP_FUNC_CALL();

PMHW_VEBOX_MODE pVeboxMode = nullptr;
PMHW_FP16_PARAMS fp16Params = nullptr;

pVeboxMode = &veboxStateCmdParams.VeboxMode;
VP_RENDER_CHK_NULL_RETURN(pVeboxMode);

VpVeboxRenderData* pRenderData = GetLastExecRenderData();
VP_RENDER_CHK_NULL_RETURN(pRenderData);

fp16Params = &(pRenderData->GetIECPParams().fp16Params);
VP_RENDER_CHK_NULL_RETURN(fp16Params);

MOS_ZeroMemory(&veboxStateCmdParams, sizeof(veboxStateCmdParams));

// Always enable the global iecp to align with the legacy path.
Expand Down Expand Up @@ -338,6 +358,11 @@ MOS_STATUS VpVeboxCmdPacket::SetupVeboxState(mhw::vebox::VEBOX_STATE_PAR& veboxS
VP_RENDER_CHK_STATUS_RETURN(SetupHDRLuts(veboxStateCmdParams));
VP_RENDER_CHK_STATUS_RETURN(SetupDNTableForHVS(veboxStateCmdParams));

if (fp16Params->isActive == 1)
{
VP_RENDER_CHK_STATUS_RETURN(SetupVeboxFP16State(veboxStateCmdParams));
}

veboxStateCmdParams.bCmBuffer = false;

MHW_VEBOX_IECP_PARAMS& veboxIecpParams = pRenderData->GetIECPParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,14 @@ class VpVeboxCmdPacket : virtual public VpVeboxCmdPacketBase
virtual MOS_STATUS Add1DLutState(PVP_SURFACE &surface, PMHW_1DLUT_PARAMS p1DLutParams);
virtual MOS_STATUS SetupVebox3DLutForHDR(
mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams);
virtual MOS_STATUS SetupVeboxFP16State(mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams)
{
return MOS_STATUS_SUCCESS;
}

virtual MOS_STATUS SetupHDRUnifiedForHDR(
mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams);

virtual MOS_STATUS SetupVeboxExternal3DLutforHDR(
mhw::vebox::VEBOX_STATE_PAR &veboxStateCmdParams);

Expand Down

0 comments on commit c6cadb7

Please sign in to comment.