preferRenderCompression flag for GMM resources creation

Change-Id: I718fa21d0feb825e0a3215408c78fa49d094a15f
This commit is contained in:
Dunajski, Bartosz
2018-01-12 09:08:49 +01:00
committed by sys_ocldev
parent b0c07bf27f
commit c939419ccc
12 changed files with 143 additions and 22 deletions

View File

@@ -118,15 +118,13 @@ Gmm *Gmm::create(GMM_RESOURCE_INFO *inputGmm) {
return gmm;
}
Gmm *Gmm::queryImgParams(ImageInfo &imgInfo,
GFXCORE_FAMILY gfxFamily) {
Gmm *Gmm::createGmmAndQueryImgParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo) {
Gmm *gmm = new Gmm();
gmm->queryImageParams(imgInfo, gfxFamily);
gmm->queryImageParams(imgInfo, hwInfo);
return gmm;
}
void Gmm::queryImageParams(ImageInfo &imgInfo,
GFXCORE_FAMILY gfxFamily) {
void Gmm::queryImageParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo) {
uint32_t imageWidth = static_cast<uint32_t>(imgInfo.imgDesc->image_width);
uint32_t imageHeight = 1;
uint32_t imageDepth = 1;
@@ -178,6 +176,15 @@ void Gmm::queryImageParams(ImageInfo &imgInfo,
this->resourceParams.Flags.Info.AllowVirtualPadding = true;
}
if (hwInfo.capabilityTable.ftrCompression && imgInfo.preferRenderCompression) {
this->resourceParams.Flags.Info.Linear = 0;
this->resourceParams.Flags.Info.TiledY = 1;
this->resourceParams.Flags.Info.RenderCompressed = 1;
this->resourceParams.Flags.Gpu.CCS = 1;
this->resourceParams.Flags.Gpu.UnifiedAuxSurface = 1;
this->isRenderCompressed = true;
}
this->gmmResourceInfo.reset(GmmResourceInfo::create(&this->resourceParams));
imgInfo.size = this->gmmResourceInfo->getSizeAllocation();
@@ -229,7 +236,7 @@ void Gmm::queryImageParams(ImageInfo &imgInfo,
imgInfo.yOffsetForUVPlane = reqOffsetInfo.Lock.Offset / reqOffsetInfo.Lock.Pitch;
}
imgInfo.qPitch = queryQPitch(gfxFamily, this->resourceParams.Type);
imgInfo.qPitch = queryQPitch(hwInfo.pPlatform->eRenderCoreFamily, this->resourceParams.Type);
return;
}

View File

@@ -34,6 +34,7 @@ void GMMPrintMessage(uint32_t debugLevel, const char *debugMessageFmt, ...);
}
namespace OCLRT {
struct HardwareInfo;
struct FeatureTable;
struct WorkaroundTable;
struct ImageInfo;
@@ -63,9 +64,9 @@ class Gmm {
static uint32_t getMOCS(uint32_t type);
void queryImageParams(ImageInfo &imgInfo, GFXCORE_FAMILY gfxFamily);
void queryImageParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo);
static Gmm *queryImgParams(ImageInfo &imgInfo, GFXCORE_FAMILY gfxFamily);
static Gmm *createGmmAndQueryImgParams(ImageInfo &imgInfo, const HardwareInfo &hwInfo);
static void queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAlloc);

View File

@@ -57,6 +57,7 @@ struct ImageInfo {
uint32_t yOffsetForUVPlane;
GMM_YUV_PLANE_ENUM plane;
int mipLevel;
bool preferRenderCompression;
};
struct McsSurfaceInfo {

View File

@@ -194,7 +194,7 @@ Image *Image::create(Context *context,
if (memoryManager->peekVirtualPaddingSupport() && (imageDesc->image_type == CL_MEM_OBJECT_IMAGE2D)) {
// Retrieve sizes from GMM and apply virtual padding if buffer storage is not big enough
auto queryGmmImgInfo(imgInfo);
std::unique_ptr<Gmm> gmm(Gmm::queryImgParams(queryGmmImgInfo, hwInfo.pPlatform->eRenderCoreFamily));
std::unique_ptr<Gmm> gmm(Gmm::createGmmAndQueryImgParams(queryGmmImgInfo, hwInfo));
auto gmmAllocationSize = gmm->gmmResourceInfo->getSizeAllocation();
if (gmmAllocationSize > memory->getUnderlyingBufferSize()) {
memory = memoryManager->createGraphicsAllocationWithPadding(memory, gmmAllocationSize);
@@ -205,11 +205,11 @@ Image *Image::create(Context *context,
else if (parentImage != nullptr) {
DEBUG_BREAK_IF(!IsNV12Image(&parentImage->getImageFormat()));
memory = parentImage->getGraphicsAllocation();
memory->gmm->queryImageParams(imgInfo, hwInfo.pPlatform->eRenderCoreFamily);
memory->gmm->queryImageParams(imgInfo, hwInfo);
isTilingAllowed = parentImage->allowTiling();
} else {
gmm = new Gmm();
gmm->queryImageParams(imgInfo, hwInfo.pPlatform->eRenderCoreFamily);
gmm->queryImageParams(imgInfo, hwInfo);
if (flags & CL_MEM_USE_HOST_PTR) {
errcodeRet = CL_INVALID_HOST_PTR;
if (hostPtr) {
@@ -668,7 +668,7 @@ cl_int Image::getImageParams(Context *context,
Gmm *gmm = nullptr;
gmm = new Gmm();
gmm->queryImageParams(imgInfo, hwInfo.pPlatform->eRenderCoreFamily);
gmm->queryImageParams(imgInfo, hwInfo);
delete gmm;
*imageRowPitch = imgInfo.rowPitch;

View File

@@ -99,7 +99,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
imgDesc.image_width /= 2;
imgDesc.image_height /= 2;
}
Gmm *gmm = Gmm::queryImgParams(imgInfo, context->getDevice(0)->getRenderCoreFamily());
Gmm *gmm = Gmm::createGmmAndQueryImgParams(imgInfo, context->getDevice(0)->getHardwareInfo());
imgDesc.image_row_pitch = imgInfo.rowPitch;
imgDesc.image_slice_pitch = imgInfo.slicePitch;

View File

@@ -77,7 +77,7 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(sharedHandle, false, true);
Gmm *gmm = Gmm::queryImgParams(imgInfo, hwInfo.pPlatform->eRenderCoreFamily);
Gmm *gmm = Gmm::createGmmAndQueryImgParams(imgInfo, hwInfo);
DEBUG_BREAK_IF(alloc->gmm != nullptr);
alloc->gmm = gmm;