fix blitter programming for media compression on xe hpg platforms
- when destination surface is media compressed then disable compression bit - rename command field CompressionType->ControlSurfaceType - program this field only on Xe Hpg platforms Related-To: NEO-7415 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
d0fd7c1667
commit
ab265bca93
|
@ -63,8 +63,7 @@ void BlitCommandsHelper<Family>::appendColorDepth(const BlitProperties &blitProp
|
|||
template <>
|
||||
void BlitCommandsHelper<Family>::getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch,
|
||||
GMM_TILE_TYPE &tileType, uint32_t &mipTailLod, uint32_t &compressionDetails,
|
||||
uint32_t &compressionType, const RootDeviceEnvironment &rootDeviceEnvironment,
|
||||
GMM_YUV_PLANE_ENUM plane) {
|
||||
const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane) {
|
||||
if (allocation.getDefaultGmm()) {
|
||||
auto gmmResourceInfo = allocation.getDefaultGmm()->gmmResourceInfo.get();
|
||||
if (!gmmResourceInfo->getResourceFlags()->Info.Linear) {
|
||||
|
@ -95,12 +94,11 @@ void BlitCommandsHelper<Family>::appendBlitCommandsForImages(const BlitPropertie
|
|||
auto dstRowPitch = static_cast<uint32_t>(blitProperties.dstRowPitch);
|
||||
uint32_t mipTailLod = 0;
|
||||
auto compressionDetails = 0u;
|
||||
auto compressionType = 0u;
|
||||
|
||||
getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, tileType, mipTailLod, compressionDetails,
|
||||
compressionType, rootDeviceEnvironment, blitProperties.srcPlane);
|
||||
rootDeviceEnvironment, blitProperties.srcPlane);
|
||||
getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, tileType, mipTailLod, compressionDetails,
|
||||
compressionType, rootDeviceEnvironment, blitProperties.dstPlane);
|
||||
rootDeviceEnvironment, blitProperties.dstPlane);
|
||||
|
||||
blitCmd.setSourcePitch(srcRowPitch);
|
||||
blitCmd.setDestinationPitch(dstRowPitch);
|
||||
|
|
|
@ -3351,7 +3351,7 @@ struct XY_BLOCK_COPY_BLT {
|
|||
uint32_t DestinationPitch : BITFIELD_RANGE(0, 17);
|
||||
uint32_t DestinationAuxiliarysurfacemode : BITFIELD_RANGE(18, 20);
|
||||
uint32_t DestinationMOCS : BITFIELD_RANGE(21, 27);
|
||||
uint32_t DestinationCompressionType : BITFIELD_RANGE(28, 28);
|
||||
uint32_t DestinationControlSurfaceType : BITFIELD_RANGE(28, 28);
|
||||
uint32_t DestinationCompressionEnable : BITFIELD_RANGE(29, 29);
|
||||
uint32_t DestinationTiling : BITFIELD_RANGE(30, 31);
|
||||
|
||||
|
@ -3381,7 +3381,7 @@ struct XY_BLOCK_COPY_BLT {
|
|||
uint32_t SourcePitch : BITFIELD_RANGE(0, 17);
|
||||
uint32_t SourceAuxiliarysurfacemode : BITFIELD_RANGE(18, 20);
|
||||
uint32_t SourceMOCS : BITFIELD_RANGE(21, 27);
|
||||
uint32_t SourceCompressionType : BITFIELD_RANGE(28, 28);
|
||||
uint32_t SourceControlSurfaceType : BITFIELD_RANGE(28, 28);
|
||||
uint32_t SourceCompressionEnable : BITFIELD_RANGE(29, 29);
|
||||
uint32_t SourceTiling : BITFIELD_RANGE(30, 31);
|
||||
|
||||
|
@ -3497,9 +3497,9 @@ struct XY_BLOCK_COPY_BLT {
|
|||
AUXILIARY_SURFACE_MODE_AUX_CCS_E = 5,
|
||||
};
|
||||
|
||||
enum COMPRESSION_TYPE {
|
||||
COMPRESSION_TYPE_3D_COMPRESSION = 0,
|
||||
COMPRESSION_TYPE_MEDIA_COMPRESSION = 1,
|
||||
enum CONTROL_SURFACE_TYPE {
|
||||
CONTROL_SURFACE_TYPE_3D = 0,
|
||||
CONTROL_SURFACE_TYPE_MEDIA = 1,
|
||||
};
|
||||
|
||||
enum COMPRESSION_ENABLE {
|
||||
|
@ -3619,12 +3619,12 @@ struct XY_BLOCK_COPY_BLT {
|
|||
return (TheStructure.Common.DestinationMOCS);
|
||||
}
|
||||
|
||||
inline void setDestinationCompressionType(const COMPRESSION_TYPE value) {
|
||||
TheStructure.Common.DestinationCompressionType = value;
|
||||
inline void setDestinationControlSurfaceType(const CONTROL_SURFACE_TYPE value) {
|
||||
TheStructure.Common.DestinationControlSurfaceType = value;
|
||||
}
|
||||
|
||||
inline COMPRESSION_TYPE getDestinationCompressionType() const {
|
||||
return static_cast<COMPRESSION_TYPE>(TheStructure.Common.DestinationCompressionType);
|
||||
inline CONTROL_SURFACE_TYPE getDestinationControlSurfaceType() const {
|
||||
return static_cast<CONTROL_SURFACE_TYPE>(TheStructure.Common.DestinationControlSurfaceType);
|
||||
}
|
||||
|
||||
inline void setDestinationCompressionEnable(const COMPRESSION_ENABLE value) {
|
||||
|
@ -3747,12 +3747,12 @@ struct XY_BLOCK_COPY_BLT {
|
|||
return (TheStructure.Common.SourceMOCS);
|
||||
}
|
||||
|
||||
inline void setSourceCompressionType(const COMPRESSION_TYPE value) {
|
||||
TheStructure.Common.SourceCompressionType = value;
|
||||
inline void setSourceControlSurfaceType(const CONTROL_SURFACE_TYPE value) {
|
||||
TheStructure.Common.SourceControlSurfaceType = value;
|
||||
}
|
||||
|
||||
inline COMPRESSION_TYPE getSourceCompressionType() const {
|
||||
return static_cast<COMPRESSION_TYPE>(TheStructure.Common.SourceCompressionType);
|
||||
inline CONTROL_SURFACE_TYPE getSourceControlSurfaceType() const {
|
||||
return static_cast<CONTROL_SURFACE_TYPE>(TheStructure.Common.SourceControlSurfaceType);
|
||||
}
|
||||
|
||||
inline void setSourceCompressionEnable(const COMPRESSION_ENABLE value) {
|
||||
|
@ -4089,7 +4089,7 @@ struct XY_FAST_COLOR_BLT {
|
|||
uint32_t DestinationPitch : BITFIELD_RANGE(0, 17);
|
||||
uint32_t DestinationAuxiliarysurfacemode : BITFIELD_RANGE(18, 20);
|
||||
uint32_t DestinationMOCS : BITFIELD_RANGE(21, 27);
|
||||
uint32_t DestinationCompressionType : BITFIELD_RANGE(28, 28);
|
||||
uint32_t DestinationControlSurfaceType : BITFIELD_RANGE(28, 28);
|
||||
uint32_t DestinationCompressionEnable : BITFIELD_RANGE(29, 29);
|
||||
uint32_t DestinationTiling : BITFIELD_RANGE(30, 31);
|
||||
|
||||
|
@ -4190,9 +4190,9 @@ struct XY_FAST_COLOR_BLT {
|
|||
DESTINATION_CLEAR_VALUE_ENABLE_ENABLE = 1,
|
||||
};
|
||||
|
||||
enum DESTINATION_COMPRESSION_TYPE {
|
||||
DESTINATION_COMPRESSION_TYPE_3D_COMPRESSION = 0,
|
||||
DESTINATION_COMPRESSION_TYPE_MEDIA_COMPRESSION = 1,
|
||||
enum DESTINATION_CONTROL_SURFACE_TYPE {
|
||||
DESTINATION_CONTROL_SURFACE_TYPE_3D = 0,
|
||||
DESTINATION_CONTROL_SURFACE_TYPE_MEDIA = 1,
|
||||
};
|
||||
|
||||
enum DESTINATION_COMPRESSION_ENABLE {
|
||||
|
@ -4304,12 +4304,12 @@ struct XY_FAST_COLOR_BLT {
|
|||
return (TheStructure.Common.DestinationMOCS);
|
||||
}
|
||||
|
||||
inline void setDestinationCompressionType(const DESTINATION_COMPRESSION_TYPE value) {
|
||||
TheStructure.Common.DestinationCompressionType = value;
|
||||
inline void setDestinationControlSurfaceType(const DESTINATION_CONTROL_SURFACE_TYPE value) {
|
||||
TheStructure.Common.DestinationControlSurfaceType = value;
|
||||
}
|
||||
|
||||
inline DESTINATION_COMPRESSION_TYPE getDestinationCompressionType() const {
|
||||
return static_cast<DESTINATION_COMPRESSION_TYPE>(TheStructure.Common.DestinationCompressionType);
|
||||
inline DESTINATION_CONTROL_SURFACE_TYPE getDestinationControlSurfaceType() const {
|
||||
return static_cast<DESTINATION_CONTROL_SURFACE_TYPE>(TheStructure.Common.DestinationControlSurfaceType);
|
||||
}
|
||||
|
||||
inline void setDestinationCompressionEnable(const DESTINATION_COMPRESSION_ENABLE value) {
|
||||
|
|
|
@ -61,6 +61,7 @@ struct BlitCommandsHelper {
|
|||
static void appendBlitCommandsMemCopy(const BlitProperties &blitProperties, typename GfxFamily::XY_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
static void appendBlitCommandsBlockCopy(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
static void appendBlitCommandsForImages(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment, uint32_t &srcSlicePitch, uint32_t &dstSlicePitch);
|
||||
static void adjustControlSurfaceType(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd);
|
||||
static void appendExtraMemoryProperties(typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
static void appendExtraMemoryProperties(typename GfxFamily::XY_COLOR_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
template <typename T = typename GfxFamily::XY_BLOCK_COPY_BLT>
|
||||
|
@ -72,7 +73,7 @@ struct BlitCommandsHelper {
|
|||
static void appendSliceOffsets(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, uint32_t sliceIndex, const RootDeviceEnvironment &rootDeviceEnvironment, uint32_t srcSlicePitch, uint32_t dstSlicePitch);
|
||||
static void appendBaseAddressOffset(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const uint32_t originalSliceIndex, const bool isSource);
|
||||
static void getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch, GMM_TILE_TYPE &tileType,
|
||||
uint32_t &mipTailLod, uint32_t &compressionDetails, uint32_t &compressionType,
|
||||
uint32_t &mipTailLod, uint32_t &compressionDetails,
|
||||
const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane);
|
||||
static void dispatchDebugPauseCommands(LinearStream &commandStream, uint64_t debugPauseStateGPUAddress, DebugPauseState confirmationTrigger,
|
||||
DebugPauseState waitCondition, RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
|
|
|
@ -545,4 +545,7 @@ size_t BlitCommandsHelper<GfxFamily>::getWaCmdsSize(const BlitPropertiesContaine
|
|||
return 0;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void BlitCommandsHelper<GfxFamily>::adjustControlSurfaceType(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -76,8 +76,7 @@ void BlitCommandsHelper<GfxFamily>::appendSliceOffsets(const BlitProperties &bli
|
|||
template <typename GfxFamily>
|
||||
void BlitCommandsHelper<GfxFamily>::getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch,
|
||||
GMM_TILE_TYPE &tileType, uint32_t &mipTailLod, uint32_t &compressionDetails,
|
||||
uint32_t &compressionType, const RootDeviceEnvironment &rootDeviceEnvironment,
|
||||
GMM_YUV_PLANE_ENUM plane) {
|
||||
const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane) {
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
|
|
@ -260,8 +260,7 @@ void BlitCommandsHelper<GfxFamily>::appendColorDepth(const BlitProperties &blitP
|
|||
template <typename GfxFamily>
|
||||
void BlitCommandsHelper<GfxFamily>::getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch,
|
||||
GMM_TILE_TYPE &tileType, uint32_t &mipTailLod, uint32_t &compressionDetails,
|
||||
uint32_t &compressionType, const RootDeviceEnvironment &rootDeviceEnvironment,
|
||||
GMM_YUV_PLANE_ENUM plane) {
|
||||
const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane) {
|
||||
using XY_BLOCK_COPY_BLT = typename GfxFamily::XY_BLOCK_COPY_BLT;
|
||||
|
||||
if (allocation.getDefaultGmm()) {
|
||||
|
@ -283,17 +282,14 @@ void BlitCommandsHelper<GfxFamily>::getBlitAllocationProperties(const GraphicsAl
|
|||
if (resInfo.MediaCompressed) {
|
||||
compressionDetails = gmmClientContext->getMediaSurfaceStateCompressionFormat(gmmResourceInfo->getResourceFormat());
|
||||
EncodeWA<GfxFamily>::adjustCompressionFormatForPlanarImage(compressionDetails, plane);
|
||||
compressionType = XY_BLOCK_COPY_BLT::COMPRESSION_TYPE::COMPRESSION_TYPE_MEDIA_COMPRESSION;
|
||||
} else if (resInfo.RenderCompressed) {
|
||||
compressionDetails = gmmClientContext->getSurfaceStateCompressionFormat(gmmResourceInfo->getResourceFormat());
|
||||
compressionType = XY_BLOCK_COPY_BLT::COMPRESSION_TYPE::COMPRESSION_TYPE_3D_COMPRESSION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void BlitCommandsHelper<GfxFamily>::appendBlitCommandsForImages(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment, uint32_t &srcSlicePitch, uint32_t &dstSlicePitch) {
|
||||
using COMPRESSION_TYPE = typename GfxFamily::XY_BLOCK_COPY_BLT::COMPRESSION_TYPE;
|
||||
auto srcTileType = GMM_NOT_TILED;
|
||||
auto dstTileType = GMM_NOT_TILED;
|
||||
auto srcAllocation = blitProperties.srcAllocation;
|
||||
|
@ -306,13 +302,11 @@ void BlitCommandsHelper<GfxFamily>::appendBlitCommandsForImages(const BlitProper
|
|||
auto dstMipTailLod = 0u;
|
||||
auto srcCompressionFormat = blitCmd.getSourceCompressionFormat();
|
||||
auto dstCompressionFormat = blitCmd.getDestinationCompressionFormat();
|
||||
auto srcCompressionType = static_cast<uint32_t>(blitCmd.getSourceCompressionType());
|
||||
auto dstCompressionType = static_cast<uint32_t>(blitCmd.getDestinationCompressionType());
|
||||
|
||||
getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, srcTileType, srcMipTailLod, srcCompressionFormat,
|
||||
srcCompressionType, rootDeviceEnvironment, blitProperties.srcPlane);
|
||||
rootDeviceEnvironment, blitProperties.srcPlane);
|
||||
getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, dstTileType, dstMipTailLod, dstCompressionFormat,
|
||||
dstCompressionType, rootDeviceEnvironment, blitProperties.dstPlane);
|
||||
rootDeviceEnvironment, blitProperties.dstPlane);
|
||||
|
||||
srcSlicePitch = std::max(srcSlicePitch, srcRowPitch * srcQPitch);
|
||||
dstSlicePitch = std::max(dstSlicePitch, dstRowPitch * dstQPitch);
|
||||
|
@ -331,11 +325,10 @@ void BlitCommandsHelper<GfxFamily>::appendBlitCommandsForImages(const BlitProper
|
|||
blitCmd.setDestinationSurfaceDepth(static_cast<uint32_t>(blitProperties.dstSize.z));
|
||||
blitCmd.setSourceCompressionFormat(srcCompressionFormat);
|
||||
blitCmd.setDestinationCompressionFormat(dstCompressionFormat);
|
||||
blitCmd.setSourceCompressionType(static_cast<COMPRESSION_TYPE>(srcCompressionType));
|
||||
blitCmd.setDestinationCompressionType(static_cast<COMPRESSION_TYPE>(dstCompressionType));
|
||||
|
||||
appendTilingType(srcTileType, dstTileType, blitCmd);
|
||||
appendClearColor(blitProperties, blitCmd);
|
||||
adjustControlSurfaceType(blitProperties, blitCmd);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
|
|
@ -43,6 +43,35 @@ MemoryCompressionState CommandStreamReceiverHw<Family>::getMemoryCompressionStat
|
|||
return memoryCompressionState;
|
||||
}
|
||||
|
||||
template <>
|
||||
void BlitCommandsHelper<Family>::adjustControlSurfaceType(const BlitProperties &blitProperties, typename Family::XY_BLOCK_COPY_BLT &blitCmd) {
|
||||
using CONTROL_SURFACE_TYPE = typename Family::XY_BLOCK_COPY_BLT::CONTROL_SURFACE_TYPE;
|
||||
using COMPRESSION_ENABLE = typename Family::XY_BLOCK_COPY_BLT::COMPRESSION_ENABLE;
|
||||
auto srcAllocation = blitProperties.srcAllocation;
|
||||
|
||||
if (srcAllocation->getDefaultGmm()) {
|
||||
auto gmmResourceInfo = srcAllocation->getDefaultGmm()->gmmResourceInfo.get();
|
||||
auto resInfo = gmmResourceInfo->getResourceFlags()->Info;
|
||||
if (resInfo.MediaCompressed) {
|
||||
blitCmd.setSourceControlSurfaceType(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_MEDIA);
|
||||
} else if (resInfo.RenderCompressed) {
|
||||
blitCmd.setSourceControlSurfaceType(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_3D);
|
||||
}
|
||||
}
|
||||
|
||||
auto dstAllocation = blitProperties.dstAllocation;
|
||||
if (dstAllocation->getDefaultGmm()) {
|
||||
auto gmmResourceInfo = dstAllocation->getDefaultGmm()->gmmResourceInfo.get();
|
||||
auto resInfo = gmmResourceInfo->getResourceFlags()->Info;
|
||||
if (resInfo.MediaCompressed) {
|
||||
blitCmd.setDestinationControlSurfaceType(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_MEDIA);
|
||||
blitCmd.setDestinationCompressionEnable(COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE);
|
||||
} else if (resInfo.RenderCompressed) {
|
||||
blitCmd.setDestinationControlSurfaceType(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_3D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template class CommandStreamReceiverHw<Family>;
|
||||
template struct BlitCommandsHelper<Family>;
|
||||
template void BlitCommandsHelper<Family>::appendColorDepth<typename Family::XY_BLOCK_COPY_BLT>(const BlitProperties &blitProperties, typename Family::XY_BLOCK_COPY_BLT &blitCmd);
|
||||
|
|
|
@ -548,10 +548,9 @@ HWTEST2_F(BlitTests, givenGen9AndGetBlitAllocationPropertiesThenCorrectValuesAre
|
|||
auto expectedtileType = tileType;
|
||||
auto expectedMipTailLod = mipTailLod;
|
||||
auto compressionDetails = 0u;
|
||||
auto compressionType = 0u;
|
||||
|
||||
NEO::BlitCommandsHelper<FamilyType>::getBlitAllocationProperties(alloc, pitch, qPitch, tileType, mipTailLod, compressionDetails,
|
||||
compressionType, pDevice->getRootDeviceEnvironment(),
|
||||
pDevice->getRootDeviceEnvironment(),
|
||||
GMM_YUV_PLANE_ENUM::GMM_NO_PLANE);
|
||||
|
||||
EXPECT_EQ(expectedPitch, pitch);
|
||||
|
@ -705,4 +704,4 @@ HWTEST_F(BlitTests, givenPlatformWhenCallingDispatchPreBlitCommandThenNoneMiFlus
|
|||
auto estimatedSizeWithNode = BlitCommandsHelper<FamilyType>::estimateBlitCommandsSize(
|
||||
blitPropertiesContainer2, false, true, false, false, pDevice->getRootDeviceEnvironment());
|
||||
EXPECT_NE(estimatedSizeWithoutNode, estimatedSizeWithNode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -591,85 +591,6 @@ HWTEST2_F(BlitTests, givenResourcesWithoutGmmsWhenAppendSurfaceTypeThenSurfaceTy
|
|||
EXPECT_EQ(bltCmd.getDestinationSurfaceType(), dstSurfaceType);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenGmmParamsWhenGetBlitAllocationPropertiesIsCalledThenCompressionFormatIsSet, IsXeHpCore) {
|
||||
std::tuple<bool, bool, bool> params[]{
|
||||
{false, false, false},
|
||||
{false, true, true},
|
||||
{true, false, true}};
|
||||
|
||||
for (auto &[mediaCompressed, renderCompressed, compressionExpected] : params) {
|
||||
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmHelper());
|
||||
auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
auto &resInfo = resourceInfo->getResourceFlags()->Info;
|
||||
resInfo.MediaCompressed = mediaCompressed;
|
||||
resInfo.RenderCompressed = renderCompressed;
|
||||
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
mockAllocationSrc.setGmm(gmm.get(), 0);
|
||||
BlitProperties properties = {};
|
||||
properties.srcAllocation = &mockAllocationSrc;
|
||||
uint32_t qPitch = static_cast<uint32_t>(properties.copySize.y);
|
||||
GMM_TILE_TYPE tileType = GMM_NOT_TILED;
|
||||
uint32_t mipTailLod = 0;
|
||||
uint32_t compressionFormat = 0;
|
||||
uint32_t compressionType = 0;
|
||||
auto rowPitch = static_cast<uint32_t>(properties.srcRowPitch);
|
||||
BlitCommandsHelper<FamilyType>::getBlitAllocationProperties(*properties.srcAllocation, rowPitch, qPitch, tileType, mipTailLod,
|
||||
compressionFormat, compressionType, pDevice->getRootDeviceEnvironment(),
|
||||
GMM_YUV_PLANE_ENUM::GMM_NO_PLANE);
|
||||
|
||||
if (compressionExpected) {
|
||||
EXPECT_GT(compressionFormat, 0u);
|
||||
} else {
|
||||
EXPECT_EQ(compressionFormat, 0u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenGmmParamsWhenGetBlitAllocationPropertiesIsCalledThenCompressionTypeIsSet, IsWithinXeGfxFamily) {
|
||||
using COMPRESSION_TYPE = typename FamilyType::XY_BLOCK_COPY_BLT::COMPRESSION_TYPE;
|
||||
constexpr uint32_t undefinedCompressionType = 0x888;
|
||||
constexpr uint32_t mediaCompressionType = static_cast<uint32_t>(COMPRESSION_TYPE::COMPRESSION_TYPE_MEDIA_COMPRESSION);
|
||||
constexpr uint32_t renderCompressionType = static_cast<uint32_t>(COMPRESSION_TYPE::COMPRESSION_TYPE_3D_COMPRESSION);
|
||||
|
||||
std::tuple<bool, bool, bool> params[]{
|
||||
{false, false, false},
|
||||
{false, true, true},
|
||||
{true, false, true}};
|
||||
|
||||
for (auto &[mediaCompressed, renderCompressed, compressionExpected] : params) {
|
||||
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmHelper());
|
||||
auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
auto &resInfo = resourceInfo->getResourceFlags()->Info;
|
||||
resInfo.MediaCompressed = mediaCompressed;
|
||||
resInfo.RenderCompressed = renderCompressed;
|
||||
MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY,
|
||||
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
|
||||
MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);
|
||||
mockAllocationSrc.setGmm(gmm.get(), 0);
|
||||
BlitProperties properties = {};
|
||||
properties.srcAllocation = &mockAllocationSrc;
|
||||
uint32_t qPitch = static_cast<uint32_t>(properties.copySize.y);
|
||||
GMM_TILE_TYPE tileType = GMM_NOT_TILED;
|
||||
uint32_t mipTailLod = 0;
|
||||
uint32_t compressionFormat = 0;
|
||||
uint32_t compressionType = undefinedCompressionType;
|
||||
auto rowPitch = static_cast<uint32_t>(properties.srcRowPitch);
|
||||
BlitCommandsHelper<FamilyType>::getBlitAllocationProperties(*properties.srcAllocation, rowPitch, qPitch, tileType, mipTailLod,
|
||||
compressionFormat, compressionType, pDevice->getRootDeviceEnvironment(),
|
||||
GMM_YUV_PLANE_ENUM::GMM_NO_PLANE);
|
||||
|
||||
if (!compressionExpected) {
|
||||
EXPECT_EQ(compressionType, undefinedCompressionType);
|
||||
} else if (mediaCompressed) {
|
||||
EXPECT_EQ(compressionType, mediaCompressionType);
|
||||
} else {
|
||||
EXPECT_EQ(compressionType, renderCompressionType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenPlaneWhenGetBlitAllocationPropertiesIsCalledThenCompressionFormatIsProperlyAdjusted, CompressionParamsSupportedMatcher) {
|
||||
struct {
|
||||
uint8_t returnedCompressionFormat;
|
||||
|
@ -711,14 +632,12 @@ HWTEST2_F(BlitTests, givenPlaneWhenGetBlitAllocationPropertiesIsCalledThenCompre
|
|||
GMM_TILE_TYPE tileType = GMM_NOT_TILED;
|
||||
uint32_t mipTailLod = 0;
|
||||
uint32_t compressionFormat = 0;
|
||||
uint32_t compressionType = 0;
|
||||
auto rowPitch = static_cast<uint32_t>(properties.srcRowPitch);
|
||||
|
||||
for (auto &testInput : testInputs) {
|
||||
gmmClientContext->compressionFormatToReturn = testInput.returnedCompressionFormat;
|
||||
BlitCommandsHelper<FamilyType>::getBlitAllocationProperties(*properties.srcAllocation, rowPitch, qPitch, tileType, mipTailLod,
|
||||
compressionFormat, compressionType,
|
||||
pDevice->getRootDeviceEnvironment(), testInput.plane);
|
||||
compressionFormat, pDevice->getRootDeviceEnvironment(), testInput.plane);
|
||||
|
||||
EXPECT_EQ(testInput.expectedCompressionFormat, compressionFormat);
|
||||
}
|
||||
|
@ -962,7 +881,8 @@ HWTEST2_F(BlitTests, givenLinearResourceInfoWithNotZeroPitchWhenAppendImageComma
|
|||
EXPECT_NE(bltCmd.getSourcePitch(), gmm->gmmResourceInfo->getRenderPitch());
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenCompressionInfoWhenAppendImageCommandsThenCorrectPropertiesAreSet, IsXeHpOrXeHpgCore) {
|
||||
HWTEST2_F(BlitTests, givenCompressionInfoWhenAppendImageCommandsThenCorrectPropertiesAreSet, IsXeHpgCore) {
|
||||
using COMPRESSION_ENABLE = typename FamilyType::XY_BLOCK_COPY_BLT::COMPRESSION_ENABLE;
|
||||
auto verifyCompressionFormat = [](bool mediaCompressed, bool renderCompressed, uint32_t compressionFormat) {
|
||||
if (mediaCompressed || renderCompressed) {
|
||||
EXPECT_GT(compressionFormat, 0u);
|
||||
|
@ -971,16 +891,16 @@ HWTEST2_F(BlitTests, givenCompressionInfoWhenAppendImageCommandsThenCorrectPrope
|
|||
}
|
||||
};
|
||||
|
||||
auto verifyCompressionType = [](bool mediaCompressed, bool renderCompressed, uint32_t compressionType) {
|
||||
using COMPRESSION_TYPE = typename FamilyType::XY_BLOCK_COPY_BLT::COMPRESSION_TYPE;
|
||||
constexpr auto mediaCompressionType = static_cast<uint32_t>(COMPRESSION_TYPE::COMPRESSION_TYPE_MEDIA_COMPRESSION);
|
||||
constexpr auto renderCompressionType = static_cast<uint32_t>(COMPRESSION_TYPE::COMPRESSION_TYPE_3D_COMPRESSION);
|
||||
auto verifyControlSurfaceType = [](bool mediaCompressed, bool renderCompressed, uint32_t controlSurfaceType) {
|
||||
using CONTROL_SURFACE_TYPE = typename FamilyType::XY_BLOCK_COPY_BLT::CONTROL_SURFACE_TYPE;
|
||||
constexpr auto mediaControlSurfaceType = static_cast<uint32_t>(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_MEDIA);
|
||||
constexpr auto renderControlSurfaceType = static_cast<uint32_t>(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_3D);
|
||||
if (mediaCompressed) {
|
||||
EXPECT_EQ(compressionType, mediaCompressionType);
|
||||
EXPECT_EQ(controlSurfaceType, mediaControlSurfaceType);
|
||||
} else if (renderCompressed) {
|
||||
EXPECT_EQ(compressionType, renderCompressionType);
|
||||
EXPECT_EQ(controlSurfaceType, renderControlSurfaceType);
|
||||
} else {
|
||||
EXPECT_EQ(compressionType, 0u);
|
||||
EXPECT_EQ(controlSurfaceType, 0u);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1019,14 +939,22 @@ HWTEST2_F(BlitTests, givenCompressionInfoWhenAppendImageCommandsThenCorrectPrope
|
|||
mockAllocationDst.setGmm(gmmDst.get(), 0);
|
||||
properties.dstAllocation = &mockAllocationDst;
|
||||
auto bltCmd = FamilyType::cmdInitXyBlockCopyBlt;
|
||||
bltCmd.setDestinationCompressionEnable(COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
bltCmd.setSourceCompressionEnable(COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForImages(properties, bltCmd, pDevice->getRootDeviceEnvironment(),
|
||||
srcSlicePitch, dstSlicePitch);
|
||||
|
||||
verifyCompressionFormat(mediaCompressedSrc, renderCompressedSrc, bltCmd.getSourceCompressionFormat());
|
||||
verifyCompressionFormat(mediaCompressedDst, renderCompressedDst, bltCmd.getDestinationCompressionFormat());
|
||||
|
||||
verifyCompressionType(mediaCompressedSrc, renderCompressedSrc, bltCmd.getSourceCompressionType());
|
||||
verifyCompressionType(mediaCompressedDst, renderCompressedDst, bltCmd.getDestinationCompressionType());
|
||||
verifyControlSurfaceType(mediaCompressedSrc, renderCompressedSrc, bltCmd.getSourceControlSurfaceType());
|
||||
verifyControlSurfaceType(mediaCompressedDst, renderCompressedDst, bltCmd.getDestinationControlSurfaceType());
|
||||
EXPECT_EQ(bltCmd.getSourceCompressionEnable(), COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
if (mediaCompressedDst) {
|
||||
EXPECT_EQ(bltCmd.getDestinationCompressionEnable(), COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE);
|
||||
} else {
|
||||
EXPECT_EQ(bltCmd.getDestinationCompressionEnable(), COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1405,4 +1333,4 @@ HWTEST2_F(BlitTests, givenDispatchDummyBlitWhenForceDummyBlitWaDisabledThenAddit
|
|||
BlitCommandsHelper<FamilyType>::dispatchDummyBlit(stream, waArgsWhenBcs);
|
||||
EXPECT_EQ(expectedSize, stream.getUsed());
|
||||
EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue