From 6cc99540a0c8b2a5c84c2ff160aa30e7c17817e7 Mon Sep 17 00:00:00 2001 From: AndreyLarionov Date: Wed, 19 Jun 2019 10:35:35 +0800 Subject: [PATCH] [Encode] Changed rules for AYUV & Y410 reconstructed surfaces allocation This is allow to enable 8k encoding (8192x8192) Change-Id: I773d8652bd8f0f4a507b788c5904eac5d08e262f --- .../agnostic/common/hw/vdbox/mhw_vdbox_hcp_generic.h | 9 +++++++++ .../agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_g11_X.cpp | 2 +- .../agnostic/gen11/hw/vdbox/mhw_vdbox_vdenc_g11_X.h | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/media_driver/agnostic/common/hw/vdbox/mhw_vdbox_hcp_generic.h b/media_driver/agnostic/common/hw/vdbox/mhw_vdbox_hcp_generic.h index 8daf5d56ae..bb2cb75866 100644 --- a/media_driver/agnostic/common/hw/vdbox/mhw_vdbox_hcp_generic.h +++ b/media_driver/agnostic/common/hw/vdbox/mhw_vdbox_hcp_generic.h @@ -115,6 +115,15 @@ class MhwVdboxHcpInterfaceGeneric : public MhwVdboxHcpInterface cmd.DW1.SurfaceId = params->ucSurfaceStateId; cmd.DW1.SurfacePitchMinus1 = params->psSurface->dwPitch - 1; + /* Handling of reconstructed surface is different for Y410 & AYUV formats */ + if ((params->ucSurfaceStateId != CODECHAL_HCP_SRC_SURFACE_ID) && + (params->psSurface->Format == Format_Y410)) + cmd.DW1.SurfacePitchMinus1 = params->psSurface->dwPitch / 2 - 1; + + if ((params->ucSurfaceStateId != CODECHAL_HCP_SRC_SURFACE_ID) && + (params->psSurface->Format == Format_AYUV)) + cmd.DW1.SurfacePitchMinus1 = params->psSurface->dwPitch / 4 - 1; + cmd.DW2.YOffsetForUCbInPixel = params->psSurface->UPlaneOffset.iYOffset; MHW_MI_CHK_STATUS(Mos_AddCommand(cmdBuffer, &cmd, cmd.byteSize)); diff --git a/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_g11_X.cpp b/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_g11_X.cpp index aa632a8de3..f2feaadc2e 100644 --- a/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_g11_X.cpp +++ b/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_g11_X.cpp @@ -1309,7 +1309,7 @@ MOS_STATUS MhwVdboxHcpInterfaceG11::AddHcpEncodeSurfaceStateCmd( mhw_vdbox_hcp_g11_X::HCP_SURFACE_STATE_CMD *cmd = (mhw_vdbox_hcp_g11_X::HCP_SURFACE_STATE_CMD*)cmdBuffer->pCmdPtr; - MHW_MI_CHK_STATUS(MhwVdboxHcpInterfaceGeneric::AddHcpDecodeSurfaceStateCmd(cmdBuffer, params)); + MHW_MI_CHK_STATUS(MhwVdboxHcpInterfaceGeneric::AddHcpEncodeSurfaceStateCmd(cmdBuffer, params)); bool surf10bit= (params->psSurface->Format == Format_P010) || (params->psSurface->Format == Format_P210) || diff --git a/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_vdenc_g11_X.h b/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_vdenc_g11_X.h index 4809803b3b..044095a913 100644 --- a/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_vdenc_g11_X.h +++ b/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_vdenc_g11_X.h @@ -1070,6 +1070,13 @@ class MhwVdboxVdencInterfaceG11 : public MhwVdboxVdencInterfaceGenericpsSurface->dwPitch / 2 - 1; + /* AYUV Reconstructed format handling */ + if (cmd.Dwords25.DW1.SurfaceFormat == vdencSurfaceFormatAyuvVariant) + cmd.Dwords25.DW1.SurfacePitch = params->psSurface->dwPitch / 4 - 1; + cmd.Dwords25.DW2.YOffsetForUCb = params->dwReconSurfHeight; cmd.Dwords25.DW3.YOffsetForVCr = params->dwReconSurfHeight << 1; }