https://github.com/intel/media-driver/issues/1716

Signed-off-by: Lim Siew Hoon <[email protected]>
---
 ...n-When-Blending-without-Colorfill-in.patch | 96 +++++++++++++++++++
 ...tion-When-Blending-without-Colorfill.patch | 79 +++++++++++++++
 .../libva/intel-media-driver_23.2.4.bb        |  2 +
 3 files changed, 177 insertions(+)
 create mode 100644 
recipes-multimedia/libva/files/0001-Fix-FC-Corruption-When-Blending-without-Colorfill-in.patch
 create mode 100644 
recipes-multimedia/libva/files/0001-Fix-FC-Corruption-When-Blending-without-Colorfill.patch

diff --git 
a/recipes-multimedia/libva/files/0001-Fix-FC-Corruption-When-Blending-without-Colorfill-in.patch
 
b/recipes-multimedia/libva/files/0001-Fix-FC-Corruption-When-Blending-without-Colorfill-in.patch
new file mode 100644
index 00000000..35051b20
--- /dev/null
+++ 
b/recipes-multimedia/libva/files/0001-Fix-FC-Corruption-When-Blending-without-Colorfill-in.patch
@@ -0,0 +1,96 @@
+From ae912b6550af4808436fabc7cae3278a20a955b6 Mon Sep 17 00:00:00 2001
+From: Gu_Peiyi <[email protected]>
+Date: Tue, 12 Sep 2023 15:06:17 +0800
+Subject: [PATCH] Fix FC Corruption When Blending without Colorfill in Legacy
+ Path
+
+Fix fc will show corruption when alignedRect is bigger than 
DestYBottomRightLayer0/DestXBottomRightLayer0 and not set color fill
+
+upstream status: backport
+https://github.com/intel/media-driver/commit/197841a545b1eaf7f202e2d057a5a6395be46061
+---
+ .../common/vp/hal/vphal_render_composite.cpp  | 40 +++++++++++++++++++
+ .../common/vp/hal/vphal_render_composite.h    |  9 +++++
+ 2 files changed, 49 insertions(+)
+
+diff --git a/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp 
b/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp
+index dd5025f32..0b0b6c432 100644
+--- a/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp
++++ b/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp
+@@ -1993,6 +1993,8 @@ MOS_STATUS CompositeState::RenderMultiPhase(
+     for (index = 0, phase = 0; (!bLastPhase); phase++)
+     {
+         bool                   disableAvsSampler = false;
++        // AdjustParamsBasedOnFcLimit must be called before 
IsDisableAVSSampler in legacy path, or it will miss the AVS WA
++        bool                   adjustParamBasedOnFcLimit = 
AdjustParamsBasedOnFcLimit(pcRenderParams);
+         VPHAL_COMPOSITE_PARAMS  CompositeParams;
+         // Prepare compositing structure
+         ResetCompParams(&CompositeParams);
+@@ -6103,6 +6105,44 @@ bool CompositeState::RenderBufferComputeWalker(
+     return bResult;
+ }
+ 
++//!
++//! \brief    Adjust Params Based On Fc Limit
++//! \param    [in,out] pCompParams
++//!           Pointer to Composite parameters.
++//! \return   bool
++//!
++bool CompositeState::AdjustParamsBasedOnFcLimit(
++    PCVPHAL_RENDER_PARAMS pcRenderParam)
++{
++    //The kernel is using the rectangle data to calculate mask. If the 
rectangle configuration does not comply to kernel requirement, the mask 
calculation will be incorrect and will see corruption.
++    if (pcRenderParam->pColorFillParams == nullptr &&
++        pcRenderParam->uSrcCount == 1 &&
++        pcRenderParam->uDstCount == 1 &&
++        pcRenderParam->pSrc[0] != nullptr &&
++        pcRenderParam->pTarget[0] != nullptr)
++    {
++         if (pcRenderParam->pSrc[0]->rcDst.top >= 
pcRenderParam->pTarget[0]->rcDst.top &&
++             pcRenderParam->pSrc[0]->rcDst.left >= 
pcRenderParam->pTarget[0]->rcDst.left &&
++             pcRenderParam->pSrc[0]->rcDst.right <= 
pcRenderParam->pTarget[0]->rcDst.right &&
++             pcRenderParam->pSrc[0]->rcDst.bottom <= 
pcRenderParam->pTarget[0]->rcDst.bottom)
++         {
++            VPHAL_RENDER_NORMALMESSAGE("Render Path : 1 Surface to 1 Surface 
FC Composition. ColorFill is Disabled. Output Dst is bigger than Input Dst. 
Will make Output Dst become Input Dst to Avoid FC Corruption. (%d %d %d %d) -> 
(%d %d %d %d)",
++                pcRenderParam->pTarget[0]->rcDst.left,
++                pcRenderParam->pTarget[0]->rcDst.top,
++                pcRenderParam->pTarget[0]->rcDst.right,
++                pcRenderParam->pTarget[0]->rcDst.bottom,
++                pcRenderParam->pSrc[0]->rcDst.left,
++                pcRenderParam->pSrc[0]->rcDst.top,
++                pcRenderParam->pSrc[0]->rcDst.right,
++                pcRenderParam->pSrc[0]->rcDst.bottom);
++            pcRenderParam->pTarget[0]->rcSrc = pcRenderParam->pSrc[0]->rcDst;
++            pcRenderParam->pTarget[0]->rcDst = pcRenderParam->pSrc[0]->rcDst;
++            return true;
++         }
++    }
++    return false;
++}
++
+ //!
+ //! \brief    Calculate Composite parameter and render data
+ //! \param    [in] pCompParams
+diff --git a/media_driver/agnostic/common/vp/hal/vphal_render_composite.h 
b/media_driver/agnostic/common/vp/hal/vphal_render_composite.h
+index b3c2820c6..3838e89c0 100644
+--- a/media_driver/agnostic/common/vp/hal/vphal_render_composite.h
++++ b/media_driver/agnostic/common/vp/hal/vphal_render_composite.h
+@@ -497,6 +497,15 @@ protected:
+         PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData,
+         bool*                           pbColorfill);
+ 
++    //!
++    //! \brief    Adjust Params Based On Fc Limit
++    //! \param    [in,out] PCVPHAL_RENDER_PARAMS
++    //!           Pointer to pcRenderParam parameters.
++    //! \return   bool
++    //!
++    bool AdjustParamsBasedOnFcLimit(
++        PCVPHAL_RENDER_PARAMS pcRenderParam);
++
+     //!
+     //! \brief    Set Sampler AVS parameters
+     //! \param    [in] pRenderingData
+-- 
+2.40.1
+
diff --git 
a/recipes-multimedia/libva/files/0001-Fix-FC-Corruption-When-Blending-without-Colorfill.patch
 
b/recipes-multimedia/libva/files/0001-Fix-FC-Corruption-When-Blending-without-Colorfill.patch
new file mode 100644
index 00000000..5baf4cb0
--- /dev/null
+++ 
b/recipes-multimedia/libva/files/0001-Fix-FC-Corruption-When-Blending-without-Colorfill.patch
@@ -0,0 +1,79 @@
+From 8da35f42a54ad63cbbe0362fc9dff37552d94c08 Mon Sep 17 00:00:00 2001
+From: Gu_Peiyi <[email protected]>
+Date: Wed, 6 Sep 2023 14:42:57 +0800
+Subject: [PATCH] Fix FC Corruption When Blending without Colorfill
+
+Fix fc will show corruption when alignedRect is bigger than 
DestYBottomRightLayer0/DestXBottomRightLayer0 and not set color fill
+
+upstream status: backport
+https://github.com/intel/media-driver/commit/5cdd94ba90bcd8174f53af2a4e9a2f4bbca2533a
+---
+ .../common/vp/hal/features/vp_fc_filter.cpp   | 35 +++++++++++++++++++
+ .../common/vp/hal/features/vp_fc_filter.h     |  2 ++
+ 2 files changed, 37 insertions(+)
+
+diff --git a/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.cpp 
b/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.cpp
+index 66e1ad8fb..5d741e80c 100644
+--- a/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.cpp
++++ b/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.cpp
+@@ -213,9 +213,44 @@ MOS_STATUS VpFcFilter::InitCompParams(VP_COMPOSITE_PARAMS 
&compParams, SwFilterP
+     return MOS_STATUS_SUCCESS;
+ }
+ 
++MOS_STATUS VpFcFilter::AdjustParamsBasedOnFcLimit(VP_COMPOSITE_PARAMS 
&compParams)
++{
++    //The kernel is using the rectangle data to calculate mask. If the 
rectangle configuration does not comply to kernel requirement, the mask 
calculation will be incorrect and will see corruption.
++    if (compParams.pColorFillParams == nullptr &&
++        compParams.sourceCount == 1 &&
++        compParams.targetCount == 1 &&
++        compParams.target[0].surf != nullptr &&
++        compParams.source[0].surf != nullptr)
++    {
++        if (compParams.target[0].surf->rcDst.top <= 
compParams.source[0].surf->rcDst.top &&
++            compParams.target[0].surf->rcDst.left <= 
compParams.source[0].surf->rcDst.left &&
++            compParams.target[0].surf->rcDst.right >= 
compParams.source[0].surf->rcDst.right &&
++            compParams.target[0].surf->rcDst.bottom >= 
compParams.source[0].surf->rcDst.bottom)
++        {
++            VP_RENDER_NORMALMESSAGE("Render Path : 1 Surface to 1 Surface FC 
Composition. ColorFill is Disabled. Output Dst is bigger than Input Dst. Will 
make Output Dst become Input Dst to Avoid FC Corruption. (%d %d %d %d) -> (%d 
%d %d %d)",
++                compParams.target[0].surf->rcDst.left,
++                compParams.target[0].surf->rcDst.top,
++                compParams.target[0].surf->rcDst.right,
++                compParams.target[0].surf->rcDst.bottom,
++                compParams.source[0].surf->rcDst.left,
++                compParams.source[0].surf->rcDst.top,
++                compParams.source[0].surf->rcDst.right,
++                compParams.source[0].surf->rcDst.bottom);
++            compParams.target[0].surf->rcSrc = 
compParams.source[0].surf->rcDst;
++            compParams.target[0].surf->rcDst = 
compParams.source[0].surf->rcDst;
++        }
++    }
++
++    return MOS_STATUS_SUCCESS;
++}
++
++
+ MOS_STATUS VpFcFilter::CalculateCompParams(VP_COMPOSITE_PARAMS &compParams)
+ {
+     int layerCount = 0;
++
++    VP_RENDER_CHK_STATUS_RETURN(AdjustParamsBasedOnFcLimit(compParams));
++
+     for (uint32_t i = 0; i < compParams.sourceCount; ++i)
+     {
+         VP_FC_LAYER *layer = &compParams.source[i];
+diff --git a/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.h 
b/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.h
+index d64c22806..94c6a1dbc 100644
+--- a/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.h
++++ b/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.h
+@@ -71,6 +71,8 @@ protected:
+         float &fStepX, float &fStepY);
+     MHW_SAMPLER_FILTER_MODE Get3DSamperFilterMode(VPHAL_SCALING_MODE 
scalingMode);
+ 
++    MOS_STATUS AdjustParamsBasedOnFcLimit(VP_COMPOSITE_PARAMS &compParams);
++
+     SwFilterPipe            *m_executedPipe = nullptr;
+     PRENDER_FC_PARAMS       m_renderFcParams = nullptr;
+ 
+-- 
+2.40.1
+
diff --git a/recipes-multimedia/libva/intel-media-driver_23.2.4.bb 
b/recipes-multimedia/libva/intel-media-driver_23.2.4.bb
index 1b94a6f6..a46f0467 100644
--- a/recipes-multimedia/libva/intel-media-driver_23.2.4.bb
+++ b/recipes-multimedia/libva/intel-media-driver_23.2.4.bb
@@ -27,6 +27,8 @@ SRC_URI = 
"git://github.com/intel/media-driver.git;protocol=https;nobranch=1 \
            file://0002-Add-DRM-format-mappings-for-JPEG-decoder-output.patch \
            
file://0003-Add-DRM-format-mappings-for-JPEG-output-to-softlet.patch \
            file://0004-Disable-vp9-padding-on-mtl.patch \
+           file://0001-Fix-FC-Corruption-When-Blending-without-Colorfill.patch 
\
+           
file://0001-Fix-FC-Corruption-When-Blending-without-Colorfill-in.patch \
           "
 
 SRCREV = "cf942344b9e439d19873f1d47c0c890d7c63b6ad"
-- 
2.40.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8099): 
https://lists.yoctoproject.org/g/meta-intel/message/8099
Mute This Topic: https://lists.yoctoproject.org/mt/101375553/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-intel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to