Skip to content

Commit 100f888

Browse files
Enable setting additional params for gen12lp image compression
Signed-off-by: Maciej Dziuban <[email protected]> Change-Id: I6228413938930f36c120523818649cde1a717cf2 Related-To: NEO-3564
1 parent d652e07 commit 100f888

20 files changed

+141
-22
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
dependenciesRevision='1b671f56c71786ef356de9b0c1d93ba18104e655-1314'
33
strategy='EQUAL'
44
allowedCD=263
5-
allowedF=5
5+
allowedF=7

core/gen12lp/hw_cmds_generated.inl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,8 @@ typedef struct tagRENDER_SURFACE_STATE {
17621762
uint64_t QuiltHeight : BITFIELD_RANGE(5, 9);
17631763
uint64_t ClearValueAddressEnable : BITFIELD_RANGE(10, 10);
17641764
uint64_t Reserved_331 : BITFIELD_RANGE(11, 63);
1765-
uint32_t Reserved_384;
1765+
uint32_t CompressionFormat : BITFIELD_RANGE(0, 4);
1766+
uint32_t Reserved_389 : BITFIELD_RANGE(5, 31);
17661767
uint32_t Reserved_416;
17671768
uint32_t Reserved_448;
17681769
uint32_t Reserved_480;
@@ -2749,6 +2750,13 @@ typedef struct tagRENDER_SURFACE_STATE {
27492750
return static_cast<MEMORY_COMPRESSION_MODE>(
27502751
TheStructure.Common.MemoryCompressionMode);
27512752
}
2753+
inline void setCompressionFormat(uint32_t compressionFormat) {
2754+
UNRECOVERABLE_IF(compressionFormat > 0x1F);
2755+
TheStructure.Common.CompressionFormat = compressionFormat;
2756+
}
2757+
inline uint32_t getCompressionFormat(void) const {
2758+
return TheStructure.Common.CompressionFormat;
2759+
}
27522760
inline void setSurfaceBaseAddress(const uint64_t value) {
27532761
TheStructure.Common.SurfaceBaseAddress = value;
27542762
}

runtime/gen12lp/helpers_gen12lp.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,16 @@ void setAdditionalPipelineSelectFields(void *pipelineSelectCmd,
4242
const PipelineSelectArgs &pipelineSelectArgs,
4343
const HardwareInfo &hwInfo) {}
4444

45+
bool isPageTableManagerSupported(const HardwareInfo &hwInfo) {
46+
return hwInfo.capabilityTable.ftrRenderCompressedBuffers || hwInfo.capabilityTable.ftrRenderCompressedImages;
47+
}
48+
49+
bool obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) {
50+
return false;
51+
}
52+
53+
void setAdditionalSurfaceStateParamsForImageCompression(Image &image, TGLLPFamily::RENDER_SURFACE_STATE *surfaceState) {
54+
}
55+
4556
} // namespace Gen12LPHelpers
4657
} // namespace NEO

runtime/gen12lp/helpers_gen12lp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#pragma once
99

10+
#include "runtime/gen12lp/hw_cmds_base.h"
11+
1012
#include "hw_info.h"
1113

1214
namespace AubMemDump {
@@ -18,6 +20,7 @@ namespace NEO {
1820
class CommandStreamReceiver;
1921
class GraphicsAllocation;
2022
struct PipelineSelectArgs;
23+
class Image;
2124

2225
namespace Gen12LPHelpers {
2326
bool hdcFlushForPipeControlBeforeStateBaseAddressRequired(PRODUCT_FAMILY productFamily);
@@ -31,5 +34,8 @@ void adjustAubGTTData(const CommandStreamReceiver &commandStreamReceiver, AubGTT
3134
void setAdditionalPipelineSelectFields(void *pipelineSelectCmd,
3235
const PipelineSelectArgs &pipelineSelectArgs,
3336
const HardwareInfo &hwInfo);
37+
bool isPageTableManagerSupported(const HardwareInfo &hwInfo);
38+
bool obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size);
39+
void setAdditionalSurfaceStateParamsForImageCompression(Image &image, typename TGLLPFamily::RENDER_SURFACE_STATE *surfaceState);
3440
} // namespace Gen12LPHelpers
3541
} // namespace NEO

runtime/gen12lp/hw_helper_gen12lp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ bool HwHelperHw<Family>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) const
4242

4343
template <>
4444
bool HwHelperHw<Family>::isPageTableManagerSupported(const HardwareInfo &hwInfo) const {
45-
return hwInfo.capabilityTable.ftrRenderCompressedBuffers || hwInfo.capabilityTable.ftrRenderCompressedImages;
45+
return Gen12LPHelpers::isPageTableManagerSupported(hwInfo);
4646
}
4747

4848
template <>
49-
bool HwHelperHw<Family>::obtainRenderBufferCompressionPreference(const size_t size) const {
50-
return false;
49+
bool HwHelperHw<Family>::obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) const {
50+
return Gen12LPHelpers::obtainRenderBufferCompressionPreference(hwInfo, size);
5151
}
5252

5353
template <>

runtime/gen12lp/image_gen12lp.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*
66
*/
77

8+
#include "runtime/gen12lp/helpers_gen12lp.h"
89
#include "runtime/gen12lp/hw_cmds.h"
910
#include "runtime/mem_obj/image.h"
1011
#include "runtime/mem_obj/image.inl"
@@ -35,6 +36,12 @@ void ImageHw<GfxFamily>::setSurfaceMemoryObjectControlStateIndexToMocsTable(void
3536

3637
surfaceState->setSurfaceMemoryObjectControlStateIndexToMocsTables(value);
3738
}
39+
40+
template <>
41+
void ImageHw<Family>::appendSurfaceStateParams(Family::RENDER_SURFACE_STATE *surfaceState) {
42+
Gen12LPHelpers::setAdditionalSurfaceStateParamsForImageCompression(*this, surfaceState);
43+
}
44+
3845
// clang-format off
3946
#include "runtime/mem_obj/image_tgllp_plus.inl"
4047
#include "runtime/mem_obj/image_factory_init.inl"

runtime/gmm_helper/client_context/gmm_client_context_base.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,13 @@ void GmmClientContextBase::destroyResInfoObject(GMM_RESOURCE_INFO *pResInfo) {
3434
GMM_CLIENT_CONTEXT *GmmClientContextBase::getHandle() const {
3535
return clientContext;
3636
}
37+
38+
uint8_t GmmClientContextBase::getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format) {
39+
return clientContext->GetSurfaceStateCompressionFormat(format);
40+
}
41+
42+
uint8_t GmmClientContextBase::getMediaSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format) {
43+
return clientContext->GetMediaSurfaceStateCompressionFormat(format);
44+
}
45+
3746
} // namespace NEO

runtime/gmm_helper/client_context/gmm_client_context_base.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class GmmClientContextBase {
2727
return std::make_unique<T>(clientType, gmmEntries);
2828
}
2929

30+
MOCKABLE_VIRTUAL uint8_t getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format);
31+
MOCKABLE_VIRTUAL uint8_t getMediaSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT format);
32+
3033
protected:
3134
GMM_CLIENT_CONTEXT *clientContext;
3235
GmmClientContextBase(GMM_CLIENT clientType, GmmExportEntries &gmmEntries);

runtime/helpers/hw_helper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class HwHelper {
4444
virtual bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const = 0;
4545
virtual const AubMemDump::LrcaHelper &getCsTraits(aub_stream::EngineType engineType) const = 0;
4646
virtual bool hvAlign4Required() const = 0;
47-
virtual bool obtainRenderBufferCompressionPreference(const size_t size) const = 0;
47+
virtual bool obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) const = 0;
4848
virtual void checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) = 0;
4949
static bool renderCompressedBuffersSupported(const HardwareInfo &hwInfo);
5050
static bool renderCompressedImagesSupported(const HardwareInfo &hwInfo);
@@ -137,7 +137,7 @@ class HwHelperHw : public HwHelper {
137137

138138
bool hvAlign4Required() const override;
139139

140-
bool obtainRenderBufferCompressionPreference(const size_t size) const override;
140+
bool obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) const override;
141141

142142
void checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) override;
143143

runtime/helpers/hw_helper_base.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ template <typename Family>
2323
const aub_stream::EngineType HwHelperHw<Family>::lowPriorityEngineType = aub_stream::EngineType::ENGINE_RCS;
2424

2525
template <typename Family>
26-
bool HwHelperHw<Family>::obtainRenderBufferCompressionPreference(const size_t size) const {
26+
bool HwHelperHw<Family>::obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo, const size_t size) const {
2727
return size > KB;
2828
}
2929

0 commit comments

Comments
 (0)