mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 18:06:32 +08:00
refactor: add option to retrieve comp format from GMM
Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3f1e6a6092
commit
a31eef9bf5
@@ -278,6 +278,7 @@ class ProductHelper {
|
||||
virtual bool checkBcsForDirectSubmissionStop() const = 0;
|
||||
virtual bool shouldRegisterEnqueuedWalkerWithProfiling() const = 0;
|
||||
virtual bool isInterruptSupported() const = 0;
|
||||
virtual bool isCompressionFormatFromGmmRequired() const = 0;
|
||||
|
||||
virtual bool getStorageInfoLocalOnlyFlag(LocalMemAllocationMode usmDeviceAllocationMode, bool defaultValue) const = 0;
|
||||
virtual ~ProductHelper() = default;
|
||||
|
||||
@@ -1103,4 +1103,10 @@ template <PRODUCT_FAMILY gfxProduct>
|
||||
bool ProductHelperHw<gfxProduct>::isInterruptSupported() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
bool ProductHelperHw<gfxProduct>::isCompressionFormatFromGmmRequired() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -215,6 +215,7 @@ class ProductHelperHw : public ProductHelper {
|
||||
bool checkBcsForDirectSubmissionStop() const override;
|
||||
bool shouldRegisterEnqueuedWalkerWithProfiling() const override;
|
||||
bool isInterruptSupported() const override;
|
||||
bool isCompressionFormatFromGmmRequired() const override;
|
||||
|
||||
~ProductHelperHw() override = default;
|
||||
|
||||
|
||||
@@ -171,6 +171,10 @@ void BlitCommandsHelper<Family>::appendBlitCommandsMemCopy(const BlitProperties
|
||||
if (dstAllocation) {
|
||||
if (dstAllocation->isCompressionEnabled()) {
|
||||
compressionFormat = 2;
|
||||
if (rootDeviceEnvironment.getProductHelper().isCompressionFormatFromGmmRequired()) {
|
||||
auto resourceFormat = dstAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat();
|
||||
compressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +182,10 @@ void BlitCommandsHelper<Family>::appendBlitCommandsMemCopy(const BlitProperties
|
||||
if (srcAllocation) {
|
||||
if (srcAllocation->isCompressionEnabled()) {
|
||||
compressionFormat = 2;
|
||||
if (rootDeviceEnvironment.getProductHelper().isCompressionFormatFromGmmRequired()) {
|
||||
auto resourceFormat = srcAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat();
|
||||
compressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
|
||||
#include "shared/source/gmm_helper/resource_info.h"
|
||||
#include "shared/source/helpers/blit_properties.h"
|
||||
#include "shared/source/helpers/definitions/command_encoder_args.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
@@ -650,8 +652,6 @@ HWTEST2_F(BlitTests, givenXe3CoreWhenAppendBlitCommandsMemCopyIsCalledThenNothin
|
||||
HWTEST2_F(BlitTests, givenXe3CoreWhenDstGraphicAlloctionWhenAppendBlitCommandsMemCopyIsCalledThenCompressionChanged, IsXe3Core) {
|
||||
auto bltCmd = FamilyType::cmdInitXyCopyBlt;
|
||||
BlitProperties properties = {};
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
|
||||
uint32_t newCompressionFormat = 2;
|
||||
|
||||
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmHelper());
|
||||
@@ -663,6 +663,11 @@ HWTEST2_F(BlitTests, givenXe3CoreWhenDstGraphicAlloctionWhenAppendBlitCommandsMe
|
||||
properties.dstAllocation = &mockAllocation;
|
||||
properties.srcAllocation = nullptr;
|
||||
NEO::BlitCommandsHelper<FamilyType>::appendBlitCommandsMemCopy(properties, bltCmd, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
if (pDevice->getProductHelper().isCompressionFormatFromGmmRequired()) {
|
||||
auto resourceFormat = mockAllocation.getDefaultGmm()->gmmResourceInfo->getResourceFormat();
|
||||
newCompressionFormat = pDevice->getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
|
||||
}
|
||||
EXPECT_EQ(bltCmd.getCompressionFormat(), newCompressionFormat);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user