Skip to content

Commit f601ee6

Browse files
MicroYYintel-mediadev
authored andcommitted
[Media Common] [MCPY] [PDVT-SH] Set ColorDepth per GMM bpp value and adjust corresponding destination right
1. packed YUV format, dst right should be divided by block width 2. interleaved chroma bpp is double of luma bpp
1 parent a6c6a22 commit f601ee6

File tree

1 file changed

+43
-37
lines changed

1 file changed

+43
-37
lines changed

media_softlet/agnostic/common/shared/mediacopy/media_blt_copy_next.cpp

+43-37
Original file line numberDiff line numberDiff line change
@@ -745,13 +745,16 @@ MOS_STATUS BltStateNext::SetupBltCopyParam(
745745
uint32_t inputBitsPerPixel = inputSurface->pGmmResInfo->GetBitsPerPixel();
746746
uint32_t outputBitsPerPixel = outputSurface->pGmmResInfo->GetBitsPerPixel();
747747
uint32_t BitsPerPixel = 8;
748+
uint32_t blockWidth = 1;
748749
if (inputSurface->TileType != MOS_TILE_LINEAR)
749750
{
750751
BitsPerPixel = inputBitsPerPixel;
752+
blockWidth = inputSurface->pGmmResInfo->GetCompressionBlockWidth();
751753
}
752754
else if (outputSurface->TileType != MOS_TILE_LINEAR)
753755
{
754756
BitsPerPixel = outputBitsPerPixel;
757+
blockWidth = outputSurface->pGmmResInfo->GetCompressionBlockWidth();
755758
}
756759
else
757760
{
@@ -766,22 +769,30 @@ MOS_STATUS BltStateNext::SetupBltCopyParam(
766769
pMhwBltParams->dwColorDepth = GetBlkCopyColorDepth(outputSurface->pGmmResInfo->GetResourceFormat(), BitsPerPixel);
767770
pMhwBltParams->dwDstRight = std::min(inputWidth, outputWidth);
768771
pMhwBltParams->dwDstBottom = std::min(inputHeight, outputHeight);
769-
772+
if (ResDetails.Format == Format_YUY2 || ResDetails.Format == Format_Y210 || ResDetails.Format == Format_Y216)
773+
{
774+
// packed YUV, dst right should be devided by blockwidth
775+
// YUY2_2x1, 32 bit per element, 2 element width
776+
// YUY2, 16 bit per element, 1 element width
777+
pMhwBltParams->dwDstRight /= blockWidth;
778+
}
770779
// The 2nd and 3nd layer.
771780
if (planeNum == TWO_PLANES || planeNum == THREE_PLANES)
772781
{
773-
int bytePerTexelScaling = GetBytesPerTexelScaling(ResDetails.Format);
774-
782+
int bytePerTexelScaling = GetBytesPerTexelScaling(ResDetails.Format);
775783
if (MCPY_PLANE_U == planeIndex || MCPY_PLANE_V == planeIndex)
776784
{
777-
pMhwBltParams->dwDstBottom = pMhwBltParams->dwDstBottom / bytePerTexelScaling;
778-
if (ResDetails.Format == Format_I420 || ResDetails.Format == Format_YV12)
779-
{
780-
pMhwBltParams->dwDstPitch = pMhwBltParams->dwDstPitch / 2;
781-
pMhwBltParams->dwSrcPitch = pMhwBltParams->dwSrcPitch / 2;
782-
pMhwBltParams->dwDstRight = pMhwBltParams->dwDstRight / 2;
783-
pMhwBltParams->dwDstBottom = pMhwBltParams->dwDstBottom / 2;
784-
}
785+
// bpp of interleved chroma plane is double of luma plane bpp
786+
pMhwBltParams->dwColorDepth = GetBlkCopyColorDepth(outputSurface->pGmmResInfo->GetResourceFormat(), BitsPerPixel * bytePerTexelScaling);
787+
pMhwBltParams->dwDstRight = pMhwBltParams->dwDstRight / bytePerTexelScaling;
788+
pMhwBltParams->dwDstBottom = pMhwBltParams->dwDstBottom / bytePerTexelScaling;
789+
if (ResDetails.Format == Format_I420 || ResDetails.Format == Format_YV12)
790+
{
791+
pMhwBltParams->dwDstPitch = pMhwBltParams->dwDstPitch / 2;
792+
pMhwBltParams->dwSrcPitch = pMhwBltParams->dwSrcPitch / 2;
793+
pMhwBltParams->dwDstRight = pMhwBltParams->dwDstRight / 2;
794+
pMhwBltParams->dwDstBottom = pMhwBltParams->dwDstBottom / 2;
795+
}
785796
}
786797
}
787798
pMhwBltParams->pSrcOsResource = inputSurface;
@@ -935,37 +946,32 @@ uint32_t BltStateNext::GetBlkCopyColorDepth(
935946
GMM_RESOURCE_FORMAT dstFormat,
936947
uint32_t BitsPerPixel)
937948
{
938-
if (dstFormat == GMM_FORMAT_YUY2_2x1 || dstFormat == GMM_FORMAT_Y216_TYPE || dstFormat == GMM_FORMAT_Y210)
939-
{// GMM_FORMAT_YUY2_2x1 32bpe 2x1 pixel blocks instead of 16bpp 1x1 block
940-
// GMM_FORMAT_Y216_TYPE/Y210 64bpe pixel blocks instead of 32bpp block.
941-
BitsPerPixel = BitsPerPixel / 2;
942-
}
943949
switch (BitsPerPixel)
944950
{
945-
case 16:
946-
switch (dstFormat)
947-
{
948-
case GMM_FORMAT_B5G5R5A1_UNORM:
949-
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_32BITCOLOR;
950-
default:
951-
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_16BITCOLOR;
952-
}
953-
case 32:
954-
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_32BITCOLOR;
955-
case 64:
956-
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_64BITCOLOR;
957-
case 96:
958-
MCPY_ASSERTMESSAGE("96 BitPerPixel support limimated as Linear format %d", dstFormat);
959-
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_96BITCOLOR_ONLYLINEARCASEISSUPPORTED;
960-
case 128:
961-
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_128BITCOLOR;
962-
case 8:
963-
default:
964-
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_8BITCOLOR;
951+
case 16:
952+
switch (dstFormat)
953+
{
954+
case GMM_FORMAT_B5G5R5A1_UNORM:
955+
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_32BITCOLOR;
956+
default:
957+
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_16BITCOLOR;
958+
}
959+
case 32:
960+
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_32BITCOLOR;
961+
case 64:
962+
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_64BITCOLOR;
963+
case 96:
964+
MCPY_ASSERTMESSAGE("96 BitPerPixel support limimated as Linear format %d", dstFormat);
965+
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_96BITCOLOR_ONLYLINEARCASEISSUPPORTED;
966+
case 128:
967+
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_128BITCOLOR;
968+
case 8:
969+
default:
970+
return mhw_blt_state::XY_BLOCK_COPY_BLT_CMD::COLOR_DEPTH_8BITCOLOR;
965971
}
966972
}
967973

968-
int BltStateNext::GetBytesPerTexelScaling(MOS_FORMAT format)
974+
int BltStateNext::GetBytesPerTexelScaling(MOS_FORMAT format)
969975
{
970976
int dstBytesPerTexel = 1;
971977
switch (format)

0 commit comments

Comments
 (0)