refactor: Use release helper for adjusting depth
Related-To: NEO-8295, HSD-14019991753 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
parent
7cb92dad25
commit
44b3f18567
|
@ -108,7 +108,9 @@ void ImageHw<GfxFamily>::setImageArg(void *memory, bool setAsMediaBlockImage, ui
|
|||
appendSurfaceStateDepthParams(surfaceState, gmm);
|
||||
EncodeSurfaceState<GfxFamily>::appendImageCompressionParams(surfaceState, graphicsAllocation, gmmHelper, isImageFromBuffer(),
|
||||
this->plane);
|
||||
EncodeSurfaceState<GfxFamily>::adjustDepthLimitations(surfaceState, minArrayElement, renderTargetViewExtent, depth, mipCount, is3DUAVOrRTV);
|
||||
auto releaseHelper = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getReleaseHelper();
|
||||
|
||||
EncodeSurfaceState<GfxFamily>::adjustDepthLimitations(surfaceState, minArrayElement, renderTargetViewExtent, depth, mipCount, is3DUAVOrRTV, releaseHelper);
|
||||
appendSurfaceStateParams(surfaceState, rootDeviceIndex, useGlobalAtomics);
|
||||
appendSurfaceStateExt(surfaceState);
|
||||
}
|
||||
|
|
|
@ -538,7 +538,7 @@ void EncodeSurfaceState<Family>::appendParamsForImageFromBuffer(R_SURFACE_STATE
|
|||
}
|
||||
|
||||
template <typename Family>
|
||||
void EncodeSurfaceState<Family>::adjustDepthLimitations(R_SURFACE_STATE *surfaceState, uint32_t minArrayElement, uint32_t renderTargetViewExtent, uint32_t depth, uint32_t mipCount, bool is3DUavOrRtv) {
|
||||
void EncodeSurfaceState<Family>::adjustDepthLimitations(R_SURFACE_STATE *surfaceState, uint32_t minArrayElement, uint32_t renderTargetViewExtent, uint32_t depth, uint32_t mipCount, bool is3DUavOrRtv, ReleaseHelper *releaseHelper) {
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
|
|
|
@ -15,6 +15,7 @@ class GmmHelper;
|
|||
class GraphicsAllocation;
|
||||
class IndirectHeap;
|
||||
class LinearStream;
|
||||
class ReleaseHelper;
|
||||
struct EncodeSurfaceStateArgs;
|
||||
struct HardwareInfo;
|
||||
struct PipeControlArgs;
|
||||
|
@ -59,7 +60,7 @@ struct EncodeSurfaceState {
|
|||
static void setFlagsForMediaCompression(R_SURFACE_STATE *surfaceState, Gmm *gmm);
|
||||
static void disableCompressionFlags(R_SURFACE_STATE *surfaceState);
|
||||
static void appendParamsForImageFromBuffer(R_SURFACE_STATE *surfaceState);
|
||||
static void adjustDepthLimitations(R_SURFACE_STATE *surfaceState, uint32_t minArrayElement, uint32_t renderTargetViewExtent, uint32_t depth, uint32_t mipCount, bool is3DUavOrRtv);
|
||||
static void adjustDepthLimitations(R_SURFACE_STATE *surfaceState, uint32_t minArrayElement, uint32_t renderTargetViewExtent, uint32_t depth, uint32_t mipCount, bool is3DUavOrRtv, ReleaseHelper *releaseHelper);
|
||||
};
|
||||
|
||||
} // namespace NEO
|
|
@ -38,6 +38,7 @@ class ReleaseHelper {
|
|||
virtual bool getMediaFrequencyTileIndex(uint32_t &tileIndex) const = 0;
|
||||
virtual bool isResolvingSubDeviceIDNeeded() const = 0;
|
||||
virtual bool isCachingOnCpuAvailable() const = 0;
|
||||
virtual bool shouldAdjustDepth() const = 0;
|
||||
virtual std::optional<GfxMemoryAllocationMethod> getPreferredAllocationMethod(AllocationType allocationType) const = 0;
|
||||
|
||||
protected:
|
||||
|
@ -63,9 +64,10 @@ class ReleaseHelperHw : public ReleaseHelper {
|
|||
bool getMediaFrequencyTileIndex(uint32_t &tileIndex) const override;
|
||||
bool isResolvingSubDeviceIDNeeded() const override;
|
||||
bool isCachingOnCpuAvailable() const override;
|
||||
bool shouldAdjustDepth() const override;
|
||||
std::optional<GfxMemoryAllocationMethod> getPreferredAllocationMethod(AllocationType allocationType) const override;
|
||||
|
||||
private:
|
||||
protected:
|
||||
ReleaseHelperHw(HardwareIpVersion hardwareIpVersion) : ReleaseHelper(hardwareIpVersion) {}
|
||||
};
|
||||
|
||||
|
|
|
@ -67,4 +67,9 @@ template <ReleaseType releaseType>
|
|||
std::optional<GfxMemoryAllocationMethod> ReleaseHelperHw<releaseType>::getPreferredAllocationMethod(AllocationType allocationType) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
template <ReleaseType releaseType>
|
||||
bool ReleaseHelperHw<releaseType>::shouldAdjustDepth() const {
|
||||
return false;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
|
|
@ -303,8 +303,12 @@ HWTEST_F(CommandEncoderTests, givenSurfaceStateWhenAdjustDepthLimitationsCalledT
|
|||
uint32_t renderTargetViewExtent = 1;
|
||||
uint32_t originalDepth = 10;
|
||||
uint32_t mipCount = 1;
|
||||
|
||||
MockExecutionEnvironment mockExecutionEnvironment{};
|
||||
auto releaseHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getReleaseHelper();
|
||||
|
||||
ss.setDepth(originalDepth);
|
||||
auto origSS = ss;
|
||||
EncodeSurfaceState<FamilyType>::adjustDepthLimitations(&ss, minArrayElement, renderTargetViewExtent, originalDepth, mipCount, true);
|
||||
EncodeSurfaceState<FamilyType>::adjustDepthLimitations(&ss, minArrayElement, renderTargetViewExtent, originalDepth, mipCount, true, releaseHelper);
|
||||
EXPECT_EQ(memcmp(&ss, &origSS, sizeof(typename FamilyType::RENDER_SURFACE_STATE)), 0);
|
||||
}
|
||||
|
|
|
@ -45,4 +45,8 @@ TEST_F(ReleaseHelper1255Tests, whenGettingMediaFrequencyTileIndexThenFalseIsRetu
|
|||
|
||||
TEST_F(ReleaseHelper1255Tests, whenGettingPreferredAllocationMethodThenNoPreferenceIsReturned) {
|
||||
whenGettingPreferredAllocationMethodThenNoPreferenceIsReturned();
|
||||
}
|
||||
|
||||
TEST_F(ReleaseHelper1255Tests, whenShouldAdjustCalledThenFalseReturned) {
|
||||
whenShouldAdjustCalledThenFalseReturned();
|
||||
}
|
|
@ -45,4 +45,8 @@ TEST_F(ReleaseHelper1256Tests, whenGettingMediaFrequencyTileIndexThenFalseIsRetu
|
|||
|
||||
TEST_F(ReleaseHelper1256Tests, whenGettingPreferredAllocationMethodThenNoPreferenceIsReturned) {
|
||||
whenGettingPreferredAllocationMethodThenNoPreferenceIsReturned();
|
||||
}
|
||||
|
||||
TEST_F(ReleaseHelper1256Tests, whenShouldAdjustCalledThenFalseReturned) {
|
||||
whenShouldAdjustCalledThenFalseReturned();
|
||||
}
|
|
@ -45,4 +45,8 @@ TEST_F(ReleaseHelper1257Tests, whenGettingMediaFrequencyTileIndexThenFalseIsRetu
|
|||
|
||||
TEST_F(ReleaseHelper1257Tests, whenGettingPreferredAllocationMethodThenNoPreferenceIsReturned) {
|
||||
whenGettingPreferredAllocationMethodThenNoPreferenceIsReturned();
|
||||
}
|
||||
|
||||
TEST_F(ReleaseHelper1257Tests, whenShouldAdjustCalledThenFalseReturned) {
|
||||
whenShouldAdjustCalledThenFalseReturned();
|
||||
}
|
|
@ -85,4 +85,23 @@ void ReleaseHelperTestsBase::whenCheckPreferredAllocationMethodThenAllocateByKmd
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReleaseHelperTestsBase::whenShouldAdjustCalledThenTrueReturned() {
|
||||
for (auto &revision : getRevisions()) {
|
||||
ipVersion.revision = revision;
|
||||
releaseHelper = ReleaseHelper::create(ipVersion);
|
||||
ASSERT_NE(nullptr, releaseHelper);
|
||||
|
||||
EXPECT_TRUE(releaseHelper->shouldAdjustDepth());
|
||||
}
|
||||
}
|
||||
void ReleaseHelperTestsBase::whenShouldAdjustCalledThenFalseReturned() {
|
||||
for (auto &revision : getRevisions()) {
|
||||
ipVersion.revision = revision;
|
||||
releaseHelper = ReleaseHelper::create(ipVersion);
|
||||
ASSERT_NE(nullptr, releaseHelper);
|
||||
|
||||
EXPECT_FALSE(releaseHelper->shouldAdjustDepth());
|
||||
}
|
||||
}
|
|
@ -26,6 +26,8 @@ struct ReleaseHelperTestsBase : public ::testing::Test {
|
|||
void whenGettingMaxPreferredSlmSizeThenSizeIsNotModified();
|
||||
void whenGettingMediaFrequencyTileIndexThenOneIsReturned();
|
||||
void whenCheckPreferredAllocationMethodThenAllocateByKmdIsReturnedExceptTagBufferAndTimestapPacketTagBuffer();
|
||||
void whenShouldAdjustCalledThenTrueReturned();
|
||||
void whenShouldAdjustCalledThenFalseReturned();
|
||||
|
||||
virtual std::vector<uint32_t> getRevisions() = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue