diff options
| author | Lim Siew Hoon <siew.hoon.lim@intel.com> | 2023-09-15 15:02:54 +0800 |
|---|---|---|
| committer | Anuj Mittal <anuj.mittal@intel.com> | 2023-09-19 14:35:40 +0800 |
| commit | cc04677a2717be485bf9cecf4a3d48f8a1e601cc (patch) | |
| tree | 0f5695d5f6a407c9ae46f60010ca3c1c064208c4 | |
| parent | a89e233e302e35ba4bc7daaf26e9acf201fa4bf0 (diff) | |
| download | meta-intel-cc04677a2717be485bf9cecf4a3d48f8a1e601cc.tar.gz | |
intel-media-driver: Fix pixelation issue on multiple input direct write operation
https://github.com/intel/media-driver/issues/1716
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
3 files changed, 177 insertions, 0 deletions
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..0b72cc03 --- /dev/null +++ b/recipes-multimedia/libva/files/0001-Fix-FC-Corruption-When-Blending-without-Colorfill-in.patch | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | From ae912b6550af4808436fabc7cae3278a20a955b6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Gu_Peiyi <peiyi.gu@intel.com> | ||
| 3 | Date: Tue, 12 Sep 2023 15:06:17 +0800 | ||
| 4 | Subject: [PATCH] Fix FC Corruption When Blending without Colorfill in Legacy | ||
| 5 | Path | ||
| 6 | |||
| 7 | Fix fc will show corruption when alignedRect is bigger than DestYBottomRightLayer0/DestXBottomRightLayer0 and not set color fill | ||
| 8 | |||
| 9 | Upstream-Status: Backport [https://github.com/intel/media-driver/commit/197841a545b1eaf7f202e2d057a5a6395be46061] | ||
| 10 | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
| 11 | --- | ||
| 12 | .../common/vp/hal/vphal_render_composite.cpp | 40 +++++++++++++++++++ | ||
| 13 | .../common/vp/hal/vphal_render_composite.h | 9 +++++ | ||
| 14 | 2 files changed, 49 insertions(+) | ||
| 15 | |||
| 16 | diff --git a/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp b/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp | ||
| 17 | index dd5025f32..0b0b6c432 100644 | ||
| 18 | --- a/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp | ||
| 19 | +++ b/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp | ||
| 20 | @@ -1993,6 +1993,8 @@ MOS_STATUS CompositeState::RenderMultiPhase( | ||
| 21 | for (index = 0, phase = 0; (!bLastPhase); phase++) | ||
| 22 | { | ||
| 23 | bool disableAvsSampler = false; | ||
| 24 | + // AdjustParamsBasedOnFcLimit must be called before IsDisableAVSSampler in legacy path, or it will miss the AVS WA | ||
| 25 | + bool adjustParamBasedOnFcLimit = AdjustParamsBasedOnFcLimit(pcRenderParams); | ||
| 26 | VPHAL_COMPOSITE_PARAMS CompositeParams; | ||
| 27 | // Prepare compositing structure | ||
| 28 | ResetCompParams(&CompositeParams); | ||
| 29 | @@ -6103,6 +6105,44 @@ bool CompositeState::RenderBufferComputeWalker( | ||
| 30 | return bResult; | ||
| 31 | } | ||
| 32 | |||
| 33 | +//! | ||
| 34 | +//! \brief Adjust Params Based On Fc Limit | ||
| 35 | +//! \param [in,out] pCompParams | ||
| 36 | +//! Pointer to Composite parameters. | ||
| 37 | +//! \return bool | ||
| 38 | +//! | ||
| 39 | +bool CompositeState::AdjustParamsBasedOnFcLimit( | ||
| 40 | + PCVPHAL_RENDER_PARAMS pcRenderParam) | ||
| 41 | +{ | ||
| 42 | + //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. | ||
| 43 | + if (pcRenderParam->pColorFillParams == nullptr && | ||
| 44 | + pcRenderParam->uSrcCount == 1 && | ||
| 45 | + pcRenderParam->uDstCount == 1 && | ||
| 46 | + pcRenderParam->pSrc[0] != nullptr && | ||
| 47 | + pcRenderParam->pTarget[0] != nullptr) | ||
| 48 | + { | ||
| 49 | + if (pcRenderParam->pSrc[0]->rcDst.top >= pcRenderParam->pTarget[0]->rcDst.top && | ||
| 50 | + pcRenderParam->pSrc[0]->rcDst.left >= pcRenderParam->pTarget[0]->rcDst.left && | ||
| 51 | + pcRenderParam->pSrc[0]->rcDst.right <= pcRenderParam->pTarget[0]->rcDst.right && | ||
| 52 | + pcRenderParam->pSrc[0]->rcDst.bottom <= pcRenderParam->pTarget[0]->rcDst.bottom) | ||
| 53 | + { | ||
| 54 | + 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)", | ||
| 55 | + pcRenderParam->pTarget[0]->rcDst.left, | ||
| 56 | + pcRenderParam->pTarget[0]->rcDst.top, | ||
| 57 | + pcRenderParam->pTarget[0]->rcDst.right, | ||
| 58 | + pcRenderParam->pTarget[0]->rcDst.bottom, | ||
| 59 | + pcRenderParam->pSrc[0]->rcDst.left, | ||
| 60 | + pcRenderParam->pSrc[0]->rcDst.top, | ||
| 61 | + pcRenderParam->pSrc[0]->rcDst.right, | ||
| 62 | + pcRenderParam->pSrc[0]->rcDst.bottom); | ||
| 63 | + pcRenderParam->pTarget[0]->rcSrc = pcRenderParam->pSrc[0]->rcDst; | ||
| 64 | + pcRenderParam->pTarget[0]->rcDst = pcRenderParam->pSrc[0]->rcDst; | ||
| 65 | + return true; | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + return false; | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | //! | ||
| 72 | //! \brief Calculate Composite parameter and render data | ||
| 73 | //! \param [in] pCompParams | ||
| 74 | diff --git a/media_driver/agnostic/common/vp/hal/vphal_render_composite.h b/media_driver/agnostic/common/vp/hal/vphal_render_composite.h | ||
| 75 | index b3c2820c6..3838e89c0 100644 | ||
| 76 | --- a/media_driver/agnostic/common/vp/hal/vphal_render_composite.h | ||
| 77 | +++ b/media_driver/agnostic/common/vp/hal/vphal_render_composite.h | ||
| 78 | @@ -497,6 +497,15 @@ protected: | ||
| 79 | PVPHAL_RENDERING_DATA_COMPOSITE pRenderingData, | ||
| 80 | bool* pbColorfill); | ||
| 81 | |||
| 82 | + //! | ||
| 83 | + //! \brief Adjust Params Based On Fc Limit | ||
| 84 | + //! \param [in,out] PCVPHAL_RENDER_PARAMS | ||
| 85 | + //! Pointer to pcRenderParam parameters. | ||
| 86 | + //! \return bool | ||
| 87 | + //! | ||
| 88 | + bool AdjustParamsBasedOnFcLimit( | ||
| 89 | + PCVPHAL_RENDER_PARAMS pcRenderParam); | ||
| 90 | + | ||
| 91 | //! | ||
| 92 | //! \brief Set Sampler AVS parameters | ||
| 93 | //! \param [in] pRenderingData | ||
| 94 | -- | ||
| 95 | 2.40.1 | ||
| 96 | |||
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..620d0550 --- /dev/null +++ b/recipes-multimedia/libva/files/0001-Fix-FC-Corruption-When-Blending-without-Colorfill.patch | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | From 8da35f42a54ad63cbbe0362fc9dff37552d94c08 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Gu_Peiyi <peiyi.gu@intel.com> | ||
| 3 | Date: Wed, 6 Sep 2023 14:42:57 +0800 | ||
| 4 | Subject: [PATCH] Fix FC Corruption When Blending without Colorfill | ||
| 5 | |||
| 6 | Fix fc will show corruption when alignedRect is bigger than DestYBottomRightLayer0/DestXBottomRightLayer0 and not set color fill | ||
| 7 | |||
| 8 | Upstream-Status: Backport [https://github.com/intel/media-driver/commit/5cdd94ba90bcd8174f53af2a4e9a2f4bbca2533a] | ||
| 9 | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
| 10 | --- | ||
| 11 | .../common/vp/hal/features/vp_fc_filter.cpp | 35 +++++++++++++++++++ | ||
| 12 | .../common/vp/hal/features/vp_fc_filter.h | 2 ++ | ||
| 13 | 2 files changed, 37 insertions(+) | ||
| 14 | |||
| 15 | 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 | ||
| 16 | index 66e1ad8fb..5d741e80c 100644 | ||
| 17 | --- a/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.cpp | ||
| 18 | +++ b/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.cpp | ||
| 19 | @@ -213,9 +213,44 @@ MOS_STATUS VpFcFilter::InitCompParams(VP_COMPOSITE_PARAMS &compParams, SwFilterP | ||
| 20 | return MOS_STATUS_SUCCESS; | ||
| 21 | } | ||
| 22 | |||
| 23 | +MOS_STATUS VpFcFilter::AdjustParamsBasedOnFcLimit(VP_COMPOSITE_PARAMS &compParams) | ||
| 24 | +{ | ||
| 25 | + //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. | ||
| 26 | + if (compParams.pColorFillParams == nullptr && | ||
| 27 | + compParams.sourceCount == 1 && | ||
| 28 | + compParams.targetCount == 1 && | ||
| 29 | + compParams.target[0].surf != nullptr && | ||
| 30 | + compParams.source[0].surf != nullptr) | ||
| 31 | + { | ||
| 32 | + if (compParams.target[0].surf->rcDst.top <= compParams.source[0].surf->rcDst.top && | ||
| 33 | + compParams.target[0].surf->rcDst.left <= compParams.source[0].surf->rcDst.left && | ||
| 34 | + compParams.target[0].surf->rcDst.right >= compParams.source[0].surf->rcDst.right && | ||
| 35 | + compParams.target[0].surf->rcDst.bottom >= compParams.source[0].surf->rcDst.bottom) | ||
| 36 | + { | ||
| 37 | + 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)", | ||
| 38 | + compParams.target[0].surf->rcDst.left, | ||
| 39 | + compParams.target[0].surf->rcDst.top, | ||
| 40 | + compParams.target[0].surf->rcDst.right, | ||
| 41 | + compParams.target[0].surf->rcDst.bottom, | ||
| 42 | + compParams.source[0].surf->rcDst.left, | ||
| 43 | + compParams.source[0].surf->rcDst.top, | ||
| 44 | + compParams.source[0].surf->rcDst.right, | ||
| 45 | + compParams.source[0].surf->rcDst.bottom); | ||
| 46 | + compParams.target[0].surf->rcSrc = compParams.source[0].surf->rcDst; | ||
| 47 | + compParams.target[0].surf->rcDst = compParams.source[0].surf->rcDst; | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + return MOS_STATUS_SUCCESS; | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | + | ||
| 55 | MOS_STATUS VpFcFilter::CalculateCompParams(VP_COMPOSITE_PARAMS &compParams) | ||
| 56 | { | ||
| 57 | int layerCount = 0; | ||
| 58 | + | ||
| 59 | + VP_RENDER_CHK_STATUS_RETURN(AdjustParamsBasedOnFcLimit(compParams)); | ||
| 60 | + | ||
| 61 | for (uint32_t i = 0; i < compParams.sourceCount; ++i) | ||
| 62 | { | ||
| 63 | VP_FC_LAYER *layer = &compParams.source[i]; | ||
| 64 | 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 | ||
| 65 | index d64c22806..94c6a1dbc 100644 | ||
| 66 | --- a/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.h | ||
| 67 | +++ b/media_softlet/agnostic/common/vp/hal/features/vp_fc_filter.h | ||
| 68 | @@ -71,6 +71,8 @@ protected: | ||
| 69 | float &fStepX, float &fStepY); | ||
| 70 | MHW_SAMPLER_FILTER_MODE Get3DSamperFilterMode(VPHAL_SCALING_MODE scalingMode); | ||
| 71 | |||
| 72 | + MOS_STATUS AdjustParamsBasedOnFcLimit(VP_COMPOSITE_PARAMS &compParams); | ||
| 73 | + | ||
| 74 | SwFilterPipe *m_executedPipe = nullptr; | ||
| 75 | PRENDER_FC_PARAMS m_renderFcParams = nullptr; | ||
| 76 | |||
| 77 | -- | ||
| 78 | 2.40.1 | ||
| 79 | |||
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 \ | |||
| 27 | file://0002-Add-DRM-format-mappings-for-JPEG-decoder-output.patch \ | 27 | file://0002-Add-DRM-format-mappings-for-JPEG-decoder-output.patch \ |
| 28 | file://0003-Add-DRM-format-mappings-for-JPEG-output-to-softlet.patch \ | 28 | file://0003-Add-DRM-format-mappings-for-JPEG-output-to-softlet.patch \ |
| 29 | file://0004-Disable-vp9-padding-on-mtl.patch \ | 29 | file://0004-Disable-vp9-padding-on-mtl.patch \ |
| 30 | file://0001-Fix-FC-Corruption-When-Blending-without-Colorfill.patch \ | ||
| 31 | file://0001-Fix-FC-Corruption-When-Blending-without-Colorfill-in.patch \ | ||
| 30 | " | 32 | " |
| 31 | 33 | ||
| 32 | SRCREV = "cf942344b9e439d19873f1d47c0c890d7c63b6ad" | 34 | SRCREV = "cf942344b9e439d19873f1d47c0c890d7c63b6ad" |
