Add compression flags for Images

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-06-25 16:21:51 +00:00
committed by Compute-Runtime-Automation
parent 2a9b147f2a
commit b5d4732169
3 changed files with 300 additions and 4 deletions

View File

@@ -142,6 +142,48 @@ void Gmm::applyAuxFlagsForBuffer(bool preferRenderCompression) {
hwHelper.applyAdditionalCompressionSettings(*this, !isCompressionEnabled);
}
void Gmm::applyAuxFlagsForImage(ImageInfo &imgInfo) {
uint8_t compressionFormat;
if (this->resourceParams.Flags.Info.MediaCompressed) {
compressionFormat = clientContext->getMediaSurfaceStateCompressionFormat(imgInfo.surfaceFormat->GMMSurfaceFormat);
} else {
compressionFormat = clientContext->getSurfaceStateCompressionFormat(imgInfo.surfaceFormat->GMMSurfaceFormat);
}
bool compressionFormatSupported = false;
if (clientContext->getHardwareInfo()->featureTable.ftrFlatPhysCCS) {
compressionFormatSupported = compressionFormat != GMM_FLATCCS_FORMAT::GMM_FLATCCS_FORMAT_INVALID;
} else {
compressionFormatSupported = compressionFormat != GMM_E2ECOMP_FORMAT::GMM_E2ECOMP_FORMAT_INVALID;
}
const bool isPackedYuv = imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_FORMAT_YUY2 ||
imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_FORMAT_UYVY ||
imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_FORMAT_YVYU ||
imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_FORMAT_VYUY;
auto hwInfo = clientContext->getHardwareInfo();
bool allowRenderCompression = HwHelper::renderCompressedImagesSupported(*hwInfo) &&
imgInfo.preferRenderCompression &&
compressionFormatSupported &&
imgInfo.surfaceFormat->GMMSurfaceFormat != GMM_RESOURCE_FORMAT::GMM_FORMAT_NV12 &&
imgInfo.plane == GMM_YUV_PLANE_ENUM::GMM_NO_PLANE &&
!isPackedYuv;
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
if (imgInfo.useLocalMemory || !hwInfo->featureTable.ftrLocalMemory) {
if (allowRenderCompression) {
hwHelper.applyRenderCompressionFlag(*this, 1);
this->resourceParams.Flags.Gpu.CCS = 1;
this->resourceParams.Flags.Gpu.UnifiedAuxSurface = 1;
this->resourceParams.Flags.Gpu.IndirectClearColor = 1;
this->isCompressionEnabled = true;
}
}
hwHelper.applyAdditionalCompressionSettings(*this, !isCompressionEnabled);
}
void Gmm::queryImageParams(ImageInfo &imgInfo) {
auto imageCount = this->gmmResourceInfo->getArraySize();
imgInfo.size = this->gmmResourceInfo->getSizeAllocation();

View File

@@ -12,5 +12,4 @@
using namespace NEO;
void Gmm::applyAppResource(StorageInfo &storageInfo) {}
void Gmm::applyAuxFlagsForImage(ImageInfo &imgInfo) {}
void Gmm::applyMemoryFlags(bool systemMemoryPool, StorageInfo &storageInfo) { this->useSystemMemoryPool = systemMemoryPool; }