Skip to content

Commit ac83edb

Browse files
peiyigu-intelintel-mediadev
authored andcommitted
[VP] Remove OCL FC Layer Select Restriction
remove unneed restrictions
1 parent f965c78 commit ac83edb

File tree

4 files changed

+135
-10
lines changed

4 files changed

+135
-10
lines changed

media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333

3434
namespace vp {
3535

36-
static MOS_STATUS IsChromaSamplingNeeded(bool &isChromaUpSamplingNeeded, bool &isChromaDownSamplingNeeded,
37-
VPHAL_SURFACE_TYPE surfType, int layerIndex,
38-
MOS_FORMAT inputFormat, MOS_FORMAT outputFormat);
39-
4036
bool PolicyFcHandler::s_forceNearestToBilinearIfBilinearExists = false;
4137

4238
VpFcFilter::VpFcFilter(PVP_MHWINTERFACE vpMhwInterface) :
@@ -467,7 +463,7 @@ MOS_STATUS VpFcFilter::CalculateScalingParams(VP_FC_LAYER *layer, VP_FC_LAYER *t
467463

468464
isChromaUpSamplingNeeded = false;
469465
isChromaDownSamplingNeeded = false;
470-
VP_PUBLIC_CHK_STATUS_RETURN(IsChromaSamplingNeeded(isChromaUpSamplingNeeded, isChromaDownSamplingNeeded,
466+
VP_PUBLIC_CHK_STATUS_RETURN(PolicyFcHandler::IsChromaSamplingNeeded(isChromaUpSamplingNeeded, isChromaDownSamplingNeeded,
471467
layer->surf->SurfType, layer->layerID,
472468
layer->surf->osSurface->Format, target->surf->osSurface->Format));
473469

@@ -831,7 +827,7 @@ MOS_STATUS PolicyFcHandler::UpdateFeaturePipe(VP_EXECUTE_CAPS caps, SwFilter &fe
831827
return MOS_STATUS_SUCCESS;
832828
}
833829

834-
bool IsInterlacedInputSupported(VP_SURFACE &input)
830+
bool PolicyFcHandler::IsInterlacedInputSupported(VP_SURFACE &input)
835831
{
836832
// The parameter YOffset of surface state should be
837833
// a multiple of 4 when the input is accessed in field mode.For interlaced NV12
@@ -840,7 +836,7 @@ bool IsInterlacedInputSupported(VP_SURFACE &input)
840836
return MOS_IS_ALIGNED(MOS_MIN((uint32_t)input.osSurface->dwHeight, (uint32_t)input.rcMaxSrc.bottom), 4) || input.osSurface->Format != Format_NV12;
841837
}
842838

843-
bool IsBobDiEnabled(SwFilterDeinterlace *di, VP_SURFACE &input)
839+
bool PolicyFcHandler::IsBobDiEnabled(SwFilterDeinterlace *di, VP_SURFACE &input)
844840
{
845841
if (nullptr == di || di->GetFilterEngineCaps().bEnabled == false)
846842
{
@@ -850,7 +846,7 @@ bool IsBobDiEnabled(SwFilterDeinterlace *di, VP_SURFACE &input)
850846
return IsInterlacedInputSupported(input);
851847
}
852848

853-
static MOS_STATUS IsChromaSamplingNeeded(bool &isChromaUpSamplingNeeded, bool &isChromaDownSamplingNeeded,
849+
MOS_STATUS PolicyFcHandler::IsChromaSamplingNeeded(bool &isChromaUpSamplingNeeded, bool &isChromaDownSamplingNeeded,
854850
VPHAL_SURFACE_TYPE surfType, int layerIndex,
855851
MOS_FORMAT inputFormat, MOS_FORMAT outputFormat)
856852
{
@@ -878,7 +874,7 @@ static MOS_STATUS IsChromaSamplingNeeded(bool &isChromaUpSamplingNeeded, bool &i
878874
return MOS_STATUS_SUCCESS;
879875
}
880876

881-
static MOS_STATUS Get3DSamplerScalingMode(VPHAL_SCALING_MODE &scalingMode, SwFilterSubPipe& pipe, int layerIndex, VP_SURFACE &input, VP_SURFACE &output)
877+
MOS_STATUS PolicyFcHandler::Get3DSamplerScalingMode(VPHAL_SCALING_MODE &scalingMode, SwFilterSubPipe &pipe, int layerIndex, VP_SURFACE &input, VP_SURFACE &output)
882878
{
883879
bool isChromaUpSamplingNeeded = false;
884880
bool isChromaDownSamplingNeeded = false;

media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,15 @@ class PolicyFcHandler : public PolicyFeatureHandler
182182
// false to use nearest or bilinear based on the requirement of each layer.
183183
static bool s_forceNearestToBilinearIfBilinearExists;
184184

185+
static MOS_STATUS IsChromaSamplingNeeded(bool &isChromaUpSamplingNeeded, bool &isChromaDownSamplingNeeded, VPHAL_SURFACE_TYPE surfType, int layerIndex, MOS_FORMAT inputFormat, MOS_FORMAT outputFormat);
186+
187+
protected:
188+
static bool IsBobDiEnabled(SwFilterDeinterlace *di, VP_SURFACE &input);
189+
static bool IsInterlacedInputSupported(VP_SURFACE &input);
190+
static MOS_STATUS Get3DSamplerScalingMode(VPHAL_SCALING_MODE &scalingMode, SwFilterSubPipe &pipe, int layerIndex, VP_SURFACE &input, VP_SURFACE &output);
191+
MOS_STATUS RemoveTransparentLayers(SwFilterPipe &featurePipe);
192+
185193
private:
186-
MOS_STATUS RemoveTransparentLayers(SwFilterPipe& featurePipe);
187194
virtual MOS_STATUS AddInputLayerForProcess(bool &bSkip, std::vector<int> &layerIndexes, VPHAL_SCALING_MODE &scalingMode, int index, VP_SURFACE &input, SwFilterSubPipe& pipe, VP_SURFACE &output, VP_EXECUTE_CAPS& caps);
188195

189196
PacketParamFactory<VpRenderFcParameter> m_PacketParamFactory;

media_softlet/agnostic/common/vp/hal/features/vp_ocl_fc_filter.cpp

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3772,4 +3772,122 @@ HwFilterParameter *PolicyOclFcHandler::CreateHwFilterParam(VP_EXECUTE_CAPS vpExe
37723772
return nullptr;
37733773
}
37743774
}
3775+
3776+
MOS_STATUS PolicyOclFcHandler::LayerSelectForProcess(std::vector<int> &layerIndexes, SwFilterPipe &featurePipe, VP_EXECUTE_CAPS &caps)
3777+
{
3778+
layerIndexes.clear();
3779+
int32_t resLayerCount = VP_COMP_MAX_LAYERS;
3780+
3781+
VP_PUBLIC_CHK_STATUS_RETURN(RemoveTransparentLayers(featurePipe));
3782+
3783+
bool skip = false;
3784+
VP_SURFACE *output = featurePipe.GetSurface(false, 0);
3785+
bool bilinearInUseFor3DSampler = false;
3786+
VP_PUBLIC_CHK_NULL_RETURN(output);
3787+
3788+
for (uint32_t i = 0; i < featurePipe.GetSurfaceCount(true); ++i)
3789+
{
3790+
VPHAL_SCALING_MODE scalingMode = VPHAL_SCALING_NEAREST;
3791+
VP_SURFACE *input = featurePipe.GetSurface(true, i);
3792+
SwFilterSubPipe *subpipe = featurePipe.GetSwFilterSubPipe(true, i);
3793+
VP_PUBLIC_CHK_NULL_RETURN(input);
3794+
VP_PUBLIC_CHK_NULL_RETURN(subpipe);
3795+
VP_PUBLIC_CHK_STATUS_RETURN(AddInputLayerForProcess(skip, layerIndexes, scalingMode, i, *input, *subpipe, *output, caps, resLayerCount));
3796+
if (skip)
3797+
{
3798+
break;
3799+
}
3800+
3801+
if (VPHAL_SCALING_BILINEAR == scalingMode)
3802+
{
3803+
bilinearInUseFor3DSampler = true;
3804+
}
3805+
}
3806+
3807+
// Use bilinear for layers, which is using nearest.
3808+
if (s_forceNearestToBilinearIfBilinearExists && bilinearInUseFor3DSampler)
3809+
{
3810+
for (uint32_t i = 0; i < layerIndexes.size(); ++i)
3811+
{
3812+
SwFilterSubPipe *subpipe = featurePipe.GetSwFilterSubPipe(true, layerIndexes[i]);
3813+
VP_PUBLIC_CHK_NULL_RETURN(subpipe);
3814+
SwFilterScaling *scaling = dynamic_cast<SwFilterScaling *>(subpipe->GetSwFilter(FeatureType::FeatureTypeScaling));
3815+
if (scaling && VPHAL_SCALING_NEAREST == scaling->GetSwFilterParams().scalingMode)
3816+
{
3817+
scaling->GetSwFilterParams().scalingMode = VPHAL_SCALING_BILINEAR;
3818+
VP_PUBLIC_NORMALMESSAGE("Scaling Info: Force nearest to bilinear for layer %d (%d)", layerIndexes[i], i);
3819+
MT_LOG3(MT_VP_HAL_FC_SCALINGINFO, MT_NORMAL, MT_VP_HAL_FC_LAYER, layerIndexes[i], MT_VP_HAL_SCALING_MODE, VPHAL_SCALING_NEAREST, MT_VP_HAL_SCALING_MODE_FORCE, VPHAL_SCALING_BILINEAR);
3820+
}
3821+
}
3822+
}
3823+
3824+
// No procamp in target being used.
3825+
return MOS_STATUS_SUCCESS;
3826+
}
3827+
3828+
MOS_STATUS PolicyOclFcHandler::AddInputLayerForProcess(bool &bSkip, std::vector<int> &layerIndexes, VPHAL_SCALING_MODE &scalingMode, int index, VP_SURFACE &input, SwFilterSubPipe &pipe, VP_SURFACE &output, VP_EXECUTE_CAPS &caps, int32_t &resLayerCount)
3829+
{
3830+
//Legacy FC has lots of limitations.
3831+
//Procamp Luma key layer limitation, sampler limitation
3832+
//OCL FC doesn't have these limitations
3833+
bSkip = false;
3834+
--resLayerCount;
3835+
3836+
SwFilterScaling *scaling = dynamic_cast<SwFilterScaling *>(pipe.GetSwFilter(FeatureType::FeatureTypeScaling));
3837+
SwFilterDeinterlace *di = dynamic_cast<SwFilterDeinterlace *>(pipe.GetSwFilter(FeatureType::FeatureTypeDi));
3838+
VPHAL_SAMPLE_TYPE sampleType = input.SampleType;
3839+
3840+
VP_PUBLIC_CHK_NULL_RETURN(scaling);
3841+
3842+
scalingMode = scaling->GetSwFilterParams().scalingMode;
3843+
//Disable AVS scaling mode
3844+
if (VPHAL_SCALING_AVS == scalingMode)
3845+
{
3846+
scalingMode = VPHAL_SCALING_BILINEAR;
3847+
}
3848+
3849+
if (!IsInterlacedInputSupported(input))
3850+
{
3851+
sampleType = SAMPLE_PROGRESSIVE;
3852+
//Disable DI
3853+
if (di && di->IsFeatureEnabled(caps))
3854+
{
3855+
di->GetFilterEngineCaps().bEnabled = false;
3856+
}
3857+
//Disable Iscaling
3858+
if (scaling->IsFeatureEnabled(caps) &&
3859+
ISCALING_NONE != scaling->GetSwFilterParams().interlacedScalingType)
3860+
{
3861+
scaling->GetSwFilterParams().interlacedScalingType = ISCALING_NONE;
3862+
}
3863+
}
3864+
VP_PUBLIC_CHK_STATUS_RETURN(Get3DSamplerScalingMode(scalingMode, pipe, layerIndexes.size(), input, output));
3865+
3866+
if (resLayerCount < 0)
3867+
{
3868+
//Multipass
3869+
bSkip = true;
3870+
VP_PUBLIC_NORMALMESSAGE("Scaling Info: layer %d is not selected. layers %d",
3871+
index,
3872+
resLayerCount);
3873+
return MOS_STATUS_SUCCESS;
3874+
}
3875+
3876+
VP_PUBLIC_NORMALMESSAGE("Scaling Info: scalingMode %d is selected for layer %d", scalingMode, index);
3877+
MT_LOG2(MT_VP_HAL_FC_SCALINGINFO, MT_NORMAL, MT_VP_HAL_FC_LAYER, index, MT_VP_HAL_SCALING_MODE, scalingMode);
3878+
3879+
// Append source to compositing operation
3880+
scaling->GetSwFilterParams().scalingMode = scalingMode;
3881+
3882+
if (di)
3883+
{
3884+
di->GetSwFilterParams().sampleTypeInput = sampleType;
3885+
}
3886+
3887+
input.SampleType = sampleType;
3888+
layerIndexes.push_back(index);
3889+
3890+
return MOS_STATUS_SUCCESS;
3891+
}
3892+
37753893
} // namespace vp

media_softlet/agnostic/common/vp/hal/features/vp_ocl_fc_filter.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,11 @@ class PolicyOclFcHandler : public PolicyFcHandler
397397
return VpRenderOclFcParameter::Create(*fcParam);
398398
}
399399

400+
virtual MOS_STATUS LayerSelectForProcess(std::vector<int> &layerIndexes, SwFilterPipe &featurePipe, VP_EXECUTE_CAPS &caps) override;
401+
400402
private:
403+
MOS_STATUS AddInputLayerForProcess(bool &bSkip, std::vector<int> &layerIndexes, VPHAL_SCALING_MODE &scalingMode, int index, VP_SURFACE &input, SwFilterSubPipe &pipe, VP_SURFACE &output, VP_EXECUTE_CAPS &caps, int32_t &resLayers);
404+
401405
PacketParamFactory<VpRenderOclFcParameter> m_PacketOclParamFactory;
402406

403407
MEDIA_CLASS_DEFINE_END(vp__PolicyOclFcHandler)

0 commit comments

Comments
 (0)