refactor: refactor mcs surface handling on xe2 and later
Related-To: NEO-13290 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
parent
6ec92ac082
commit
4ed25da5fa
|
@ -389,7 +389,7 @@ Image *Image::createImageHw(Context *context, const MemoryProperties &memoryProp
|
|||
Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler, const McsSurfaceInfo &mcsSurfaceInfo,
|
||||
MultiGraphicsAllocation multiGraphicsAllocation, GraphicsAllocation *mcsAllocation,
|
||||
cl_mem_flags flags, cl_mem_flags_intel flagsIntel, const ClSurfaceFormatInfo *surfaceFormat,
|
||||
ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount) {
|
||||
ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount, bool hasUnifiedMcsSurface) {
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
auto size = multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex)->getUnderlyingBufferSize();
|
||||
auto sharedImage = createImageHw(
|
||||
|
@ -407,6 +407,7 @@ Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler
|
|||
sharedImage->setMcsSurfaceInfo(mcsSurfaceInfo);
|
||||
sharedImage->setPlane(imgInfo.plane);
|
||||
sharedImage->setIsDisplayable(imgInfo.isDisplayable);
|
||||
sharedImage->setIsUnifiedMcsSurface(hasUnifiedMcsSurface);
|
||||
return sharedImage;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -87,7 +87,7 @@ class Image : public MemObj {
|
|||
|
||||
static Image *createSharedImage(Context *context, SharingHandler *sharingHandler, const McsSurfaceInfo &mcsSurfaceInfo,
|
||||
MultiGraphicsAllocation multiGraphicsAllocation, GraphicsAllocation *mcsAllocation,
|
||||
cl_mem_flags flags, cl_mem_flags_intel flagsIntel, const ClSurfaceFormatInfo *surfaceFormat, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount);
|
||||
cl_mem_flags flags, cl_mem_flags_intel flagsIntel, const ClSurfaceFormatInfo *surfaceFormat, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount, bool hasUnifiedMcsSurface);
|
||||
|
||||
static cl_int validate(Context *context,
|
||||
const MemoryProperties &memoryProperties,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
* Copyright (C) 2024-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -15,4 +15,22 @@ void ImageHw<Family>::adjustDepthLimitations(RENDER_SURFACE_STATE *surfaceState,
|
|||
surfaceState->setDepth(newDepth);
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
void ImageHw<Family>::setAuxParamsForMultisamples(RENDER_SURFACE_STATE *surfaceState, uint32_t rootDeviceIndex) {
|
||||
using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT;
|
||||
if (getMcsAllocation() || getIsUnifiedMcsSurface()) {
|
||||
auto mcsGmm = getMcsAllocation() ? getMcsAllocation()->getDefaultGmm() : getMultiGraphicsAllocation().getDefaultGraphicsAllocation()->getDefaultGmm();
|
||||
auto *releaseHelper = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getReleaseHelper();
|
||||
DEBUG_BREAK_IF(releaseHelper == nullptr);
|
||||
EncodeSurfaceState<Family>::setAuxParamsForMCSCCS(surfaceState, releaseHelper);
|
||||
surfaceState->setAuxiliarySurfacePitch(mcsGmm->getUnifiedAuxPitchTiles());
|
||||
surfaceState->setAuxiliarySurfaceQPitch(mcsGmm->getAuxQPitch());
|
||||
EncodeSurfaceState<Family>::setClearColorParams(surfaceState, mcsGmm);
|
||||
ImageSurfaceStateHelper<Family>::setUnifiedAuxBaseAddress(surfaceState, mcsGmm);
|
||||
} else if (isDepthFormat(imageFormat) && surfaceState->getSurfaceFormat() != SURFACE_FORMAT::SURFACE_FORMAT_R32_FLOAT_X8X24_TYPELESS) {
|
||||
surfaceState->setMultisampledSurfaceStorageFormat(RENDER_SURFACE_STATE::MULTISAMPLED_SURFACE_STORAGE_FORMAT::MULTISAMPLED_SURFACE_STORAGE_FORMAT_DEPTH_STENCIL);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace NEO
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -167,6 +167,12 @@ class MemObj : public BaseObject<_cl_mem> {
|
|||
void setSizeInPoolAllocator(size_t size) {
|
||||
this->sizeInPoolAllocator = size;
|
||||
}
|
||||
bool getIsUnifiedMcsSurface() {
|
||||
return isMcsSurfaceUnified;
|
||||
}
|
||||
void setIsUnifiedMcsSurface(bool isMcsSurfaceUnified) {
|
||||
this->isMcsSurfaceUnified = isMcsSurfaceUnified;
|
||||
}
|
||||
|
||||
protected:
|
||||
void getOsSpecificMemObjectInfo(const cl_mem_info ¶mName, size_t *srcParamSize, void **srcParam);
|
||||
|
@ -192,6 +198,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
|||
bool isHostPtrSVM;
|
||||
bool isObjectRedescribed;
|
||||
bool isDisplayable{false};
|
||||
bool isMcsSurfaceUnified = false;
|
||||
MemoryManager *memoryManager = nullptr;
|
||||
MultiGraphicsAllocation multiGraphicsAllocation;
|
||||
GraphicsAllocation *mcsAllocation = nullptr;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -122,7 +122,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
|
|||
auto multiGraphicsAllocation = MultiGraphicsAllocation(rootDeviceIndex);
|
||||
multiGraphicsAllocation.addAllocation(alloc);
|
||||
|
||||
return Image::createSharedImage(context, surface, mcsSurfaceInfo, std::move(multiGraphicsAllocation), nullptr, flags, 0, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
return Image::createSharedImage(context, surface, mcsSurfaceInfo, std::move(multiGraphicsAllocation), nullptr, flags, 0, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, 0, 0, false);
|
||||
}
|
||||
|
||||
void D3DSurface::synchronizeObject(UpdateData &updateData) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -119,7 +119,7 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
|
|||
auto multiGraphicsAllocation = MultiGraphicsAllocation(rootDeviceIndex);
|
||||
multiGraphicsAllocation.addAllocation(alloc);
|
||||
|
||||
return Image::createSharedImage(context, d3dTextureObj, mcsSurfaceInfo, std::move(multiGraphicsAllocation), nullptr, flags, 0, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
return Image::createSharedImage(context, d3dTextureObj, mcsSurfaceInfo, std::move(multiGraphicsAllocation), nullptr, flags, 0, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, 0, 0, false);
|
||||
}
|
||||
|
||||
template <typename D3D>
|
||||
|
@ -204,7 +204,7 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
|
|||
auto multiGraphicsAllocation = MultiGraphicsAllocation(rootDeviceIndex);
|
||||
multiGraphicsAllocation.addAllocation(alloc);
|
||||
|
||||
auto image = Image::createSharedImage(context, d3dTextureObj, mcsSurfaceInfo, std::move(multiGraphicsAllocation), nullptr, flags, 0, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
auto image = Image::createSharedImage(context, d3dTextureObj, mcsSurfaceInfo, std::move(multiGraphicsAllocation), nullptr, flags, 0, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, 0, 0, false);
|
||||
image->setAs3DUavOrRtvImage(is3DUavOrRtv);
|
||||
return image;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
* Copyright (C) 2023-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -245,7 +245,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
|||
multiGraphicsAllocation.addAllocation(alloc);
|
||||
|
||||
return Image::createSharedImage(context, glTexture, mcsSurfaceInfo, std::move(multiGraphicsAllocation), mcsAlloc, flags, 0, &surfaceFormatInfo, imgInfo, cubeFaceIndex,
|
||||
std::max(miplevel, 0), imgInfo.imgDesc.numMipLevels);
|
||||
std::max(miplevel, 0), imgInfo.imgDesc.numMipLevels, false);
|
||||
}
|
||||
|
||||
void GlTexture::synchronizeObject(UpdateData &updateData) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
* Copyright (C) 2020-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -125,6 +125,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
|||
if (texInfo.glInternalFormat != GL_RGB10) {
|
||||
surfaceFormatInfo.surfaceFormat.genxSurfaceFormat = (SurfaceFormat)texInfo.glHWFormat;
|
||||
}
|
||||
bool hasUnifiedMcsSurface = texInfo.numberOfSamples > 1 && texInfo.globalShareHandleMCS == NULL && gmm->hasMultisampleControlSurface();
|
||||
|
||||
GraphicsAllocation *mcsAlloc = nullptr;
|
||||
if (texInfo.globalShareHandleMCS) {
|
||||
|
@ -137,6 +138,9 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
|||
}
|
||||
mcsSurfaceInfo.pitch = getValidParam(static_cast<uint32_t>(mcsAlloc->getDefaultGmm()->gmmResourceInfo->getRenderPitch() / 128));
|
||||
mcsSurfaceInfo.qPitch = mcsAlloc->getDefaultGmm()->gmmResourceInfo->getQPitch();
|
||||
} else if (hasUnifiedMcsSurface) {
|
||||
mcsSurfaceInfo.pitch = getValidParam(static_cast<uint32_t>(gmm->gmmResourceInfo->getRenderPitch() / 128));
|
||||
mcsSurfaceInfo.qPitch = gmm->gmmResourceInfo->getQPitch();
|
||||
}
|
||||
mcsSurfaceInfo.multisampleCount = GmmTypesConverter::getRenderMultisamplesCount(static_cast<uint32_t>(imgDesc.num_samples));
|
||||
|
||||
|
@ -162,7 +166,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
|||
multiGraphicsAllocation.addAllocation(alloc);
|
||||
|
||||
return Image::createSharedImage(context, glTexture, mcsSurfaceInfo, std::move(multiGraphicsAllocation), mcsAlloc, flags, 0, &surfaceFormatInfo, imgInfo, cubeFaceIndex,
|
||||
std::max(miplevel, 0), imgInfo.imgDesc.numMipLevels);
|
||||
std::max(miplevel, 0), imgInfo.imgDesc.numMipLevels, hasUnifiedMcsSurface);
|
||||
} // namespace NEO
|
||||
|
||||
void GlTexture::synchronizeObject(UpdateData &updateData) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019-2024 Intel Corporation
|
||||
* Copyright (C) 2019-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -53,7 +53,7 @@ Image *UnifiedImage::createSharedUnifiedImage(Context *context, cl_mem_flags fla
|
|||
multiGraphicsAllocation.addAllocation(graphicsAllocation);
|
||||
|
||||
return Image::createSharedImage(context, sharingHandler, McsSurfaceInfo{}, std::move(multiGraphicsAllocation), nullptr,
|
||||
flags, 0, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, baseMipmapIndex, sharedMipmapsCount);
|
||||
flags, 0, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, baseMipmapIndex, sharedMipmapsCount, false);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -232,7 +232,7 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
|
|||
auto multiGraphicsAllocation = MultiGraphicsAllocation(context->getDevice(0)->getRootDeviceIndex());
|
||||
multiGraphicsAllocation.addAllocation(alloc);
|
||||
|
||||
auto image = Image::createSharedImage(context, vaSurface, mcsSurfaceInfo, std::move(multiGraphicsAllocation), nullptr, flags, flagsIntel, imgSurfaceFormat, sharedSurfaceInfo.imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
auto image = Image::createSharedImage(context, vaSurface, mcsSurfaceInfo, std::move(multiGraphicsAllocation), nullptr, flags, flagsIntel, imgSurfaceFormat, sharedSurfaceInfo.imgInfo, __GMM_NO_CUBE_MAP, 0, 0, false);
|
||||
image->setMediaPlaneType(plane);
|
||||
return image;
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ HWTEST_F(ImageSetArgTest, givenImageArraySizeGreaterThanOneButTypeIsNotImageArra
|
|||
0,
|
||||
&surfaceFormatInfo,
|
||||
imageInfo,
|
||||
0, 0, 0)};
|
||||
0, 0, 0, false)};
|
||||
image->setCubeFaceIndex(__GMM_NO_CUBE_MAP);
|
||||
|
||||
typename FamilyType::RENDER_SURFACE_STATE surfaceState{};
|
||||
|
@ -510,7 +510,7 @@ HWTEST_F(ImageSetArgTest, Given1dArrayWhenSettingKernelArgThenPropertiesAreSetCo
|
|||
delete image1Darray;
|
||||
}
|
||||
|
||||
HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithoutUnifiedAuxCapabilityThenProgramAuxFieldsForMultisamples) {
|
||||
HWTEST2_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithoutUnifiedAuxCapabilityThenProgramAuxFieldsForMultisamples, IsAtMostArl) {
|
||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
@ -551,7 +551,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithoutUnifiedAuxC
|
|||
delete image;
|
||||
}
|
||||
|
||||
HWTEST_F(ImageSetArgTest, givenDepthFormatWhenSetArgIsCalledThenProgramAuxFields) {
|
||||
HWTEST2_F(ImageSetArgTest, givenDepthFormatWhenSetArgIsCalledThenProgramAuxFields, IsAtMostArl) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
using AUXILIARY_SURFACE_MODE = typename RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE;
|
||||
|
||||
|
@ -612,7 +612,7 @@ HWTEST_F(ImageSetArgTest, givenMultisampledR32Floatx8x24DepthStencilFormatWhenSe
|
|||
RENDER_SURFACE_STATE::MULTISAMPLED_SURFACE_STORAGE_FORMAT::MULTISAMPLED_SURFACE_STORAGE_FORMAT_MSS);
|
||||
}
|
||||
|
||||
HWTEST_F(ImageSetArgTest, givenMcsAllocationAndCompressionWhenSetArgOnMultisampledImgIsCalledThenProgramAuxFieldsWithMcsParams) {
|
||||
HWTEST2_F(ImageSetArgTest, givenMcsAllocationAndCompressionWhenSetArgOnMultisampledImgIsCalledThenProgramAuxFieldsWithMcsParams, IsAtMostArl) {
|
||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
@ -645,7 +645,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationAndCompressionWhenSetArgOnMultisampl
|
|||
EXPECT_EQ(mcsAlloc->getGpuAddress(), surfaceState->getAuxiliarySurfaceBaseAddress());
|
||||
}
|
||||
|
||||
HWTEST_F(ImageSetArgTest, givenDepthFormatAndCompressionWhenSetArgOnMultisampledImgIsCalledThenDontProgramAuxFields) {
|
||||
HWTEST2_F(ImageSetArgTest, givenDepthFormatAndCompressionWhenSetArgOnMultisampledImgIsCalledThenDontProgramAuxFields, IsAtMostArl) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
using AUXILIARY_SURFACE_MODE = typename RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE;
|
||||
|
||||
|
|
|
@ -205,6 +205,145 @@ HWTEST2_F(XeHPAndLaterImageTests, givenMcsAllocationWhenSetArgIsCalledWithUnifie
|
|||
EXPECT_EQ(surfaceState.getAuxiliarySurfaceMode(), expectedMode);
|
||||
}
|
||||
|
||||
HWTEST2_F(XeHPAndLaterImageTests, givenMcsAllocationWhenSetAuxParamsForMultisampleCalledThenAuxModeIsExpected, IsAtLeastBmg) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
|
||||
MockContext context;
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
std::unique_ptr<Image> image(Image2dHelper<>::create(&context, &imgDesc));
|
||||
|
||||
auto pClDevice = context.getDevice(0);
|
||||
|
||||
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
|
||||
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
|
||||
GmmRequirements gmmRequirements{};
|
||||
gmmRequirements.allowLargePages = true;
|
||||
gmmRequirements.preferCompressed = false;
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pClDevice->getRootDeviceEnvironment().getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, {}, gmmRequirements));
|
||||
surfaceState.setSurfaceBaseAddress(0xABCDEF1000);
|
||||
imageHw->setMcsSurfaceInfo(msi);
|
||||
imageHw->setMcsAllocation(mcsAlloc);
|
||||
|
||||
EXPECT_EQ(0u, surfaceState.getAuxiliarySurfaceBaseAddress());
|
||||
|
||||
imageHw->setAuxParamsForMultisamples(&surfaceState, pClDevice->getRootDeviceIndex());
|
||||
|
||||
auto releaseHelper = pClDevice->getDevice().getReleaseHelper();
|
||||
RENDER_SURFACE_STATE expectedSS = {};
|
||||
EncodeSurfaceState<FamilyType>::setAuxParamsForMCSCCS(&expectedSS, releaseHelper);
|
||||
|
||||
EXPECT_NE(0u, surfaceState.getAuxiliarySurfaceBaseAddress());
|
||||
EXPECT_EQ(surfaceState.getAuxiliarySurfaceMode(), expectedSS.getAuxiliarySurfaceMode());
|
||||
}
|
||||
|
||||
HWTEST2_F(XeHPAndLaterImageTests, givenImageWithUnifiedMcsWhenSetAuxParamsForMultisampleThenAuxModeIsExpected, IsAtLeastBmg) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
|
||||
MockContext context;
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
std::unique_ptr<Image> image(Image2dHelper<>::create(&context, &imgDesc));
|
||||
|
||||
auto pClDevice = context.getDevice(0);
|
||||
|
||||
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
|
||||
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
|
||||
surfaceState.setSurfaceBaseAddress(0xABCDEF1000);
|
||||
imageHw->setMcsSurfaceInfo(msi);
|
||||
imageHw->setIsUnifiedMcsSurface(true);
|
||||
|
||||
EXPECT_EQ(0u, surfaceState.getAuxiliarySurfaceBaseAddress());
|
||||
|
||||
imageHw->setAuxParamsForMultisamples(&surfaceState, pClDevice->getRootDeviceIndex());
|
||||
|
||||
auto releaseHelper = pClDevice->getDevice().getReleaseHelper();
|
||||
RENDER_SURFACE_STATE expectedSS = {};
|
||||
EncodeSurfaceState<FamilyType>::setAuxParamsForMCSCCS(&expectedSS, releaseHelper);
|
||||
EXPECT_NE(0u, surfaceState.getAuxiliarySurfaceBaseAddress());
|
||||
EXPECT_EQ(surfaceState.getAuxiliarySurfaceMode(), expectedSS.getAuxiliarySurfaceMode());
|
||||
}
|
||||
|
||||
HWTEST2_F(XeHPAndLaterImageTests, givenImageWithoutMcsWhenSetAuxParamsForMultisampleThenAuxSurfBaseAddredssIsZero, IsAtLeastBmg) {
|
||||
MockContext context;
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
std::unique_ptr<Image> image(Image2dHelper<>::create(&context, &imgDesc));
|
||||
|
||||
auto pClDevice = context.getDevice(0);
|
||||
|
||||
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
|
||||
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
|
||||
imageHw->setAuxParamsForMultisamples(&surfaceState, pClDevice->getRootDeviceIndex());
|
||||
|
||||
EXPECT_EQ(0u, surfaceState.getAuxiliarySurfaceBaseAddress());
|
||||
}
|
||||
|
||||
HWTEST2_F(XeHPAndLaterImageTests, givenImageWithoutMcsWithDepthFormatWhenSetAuxParamsForMultisampleThenStorageFormatIsSetToDepthStencil, IsAtLeastBmg) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
|
||||
MockContext context;
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
cl_image_format imgFormat = {CL_DEPTH, CL_FLOAT};
|
||||
imgDesc.num_samples = 8;
|
||||
std::unique_ptr<Image> image(Image2dHelper<>::create(&context, &imgDesc, &imgFormat));
|
||||
|
||||
auto pClDevice = context.getDevice(0);
|
||||
|
||||
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
|
||||
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
|
||||
surfaceState.setSurfaceFormat(RENDER_SURFACE_STATE::SURFACE_FORMAT::SURFACE_FORMAT_R8G8B8A8_UINT);
|
||||
imageHw->setAuxParamsForMultisamples(&surfaceState, pClDevice->getRootDeviceIndex());
|
||||
|
||||
EXPECT_EQ(surfaceState.getMultisampledSurfaceStorageFormat(),
|
||||
RENDER_SURFACE_STATE::MULTISAMPLED_SURFACE_STORAGE_FORMAT::MULTISAMPLED_SURFACE_STORAGE_FORMAT_DEPTH_STENCIL);
|
||||
}
|
||||
|
||||
HWTEST2_F(XeHPAndLaterImageTests, givenImageWithoutMcsWithNotDepthFormatWhenSetAuxParamsForMultisampleThenStorageFormatIsSetToMSS, IsAtLeastBmg) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
|
||||
MockContext context;
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
cl_image_format imgFormat = {CL_RGBA, CL_FLOAT};
|
||||
imgDesc.num_samples = 8;
|
||||
std::unique_ptr<Image> image(Image2dHelper<>::create(&context, &imgDesc, &imgFormat));
|
||||
|
||||
auto pClDevice = context.getDevice(0);
|
||||
|
||||
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
|
||||
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
|
||||
surfaceState.setSurfaceFormat(RENDER_SURFACE_STATE::SURFACE_FORMAT::SURFACE_FORMAT_R8G8B8A8_UINT);
|
||||
imageHw->setAuxParamsForMultisamples(&surfaceState, pClDevice->getRootDeviceIndex());
|
||||
|
||||
EXPECT_EQ(surfaceState.getMultisampledSurfaceStorageFormat(),
|
||||
RENDER_SURFACE_STATE::MULTISAMPLED_SURFACE_STORAGE_FORMAT::MULTISAMPLED_SURFACE_STORAGE_FORMAT_MSS);
|
||||
}
|
||||
|
||||
HWTEST2_F(XeHPAndLaterImageTests, givenImageWithoutMcsWithTypelessSurfaceStateFormatWhenSetAuxParamsForMultisampleThenStorageFormatIsSetToMSS, IsAtLeastBmg) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
|
||||
MockContext context;
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
cl_image_format imgFormat = {CL_DEPTH, CL_FLOAT};
|
||||
imgDesc.num_samples = 8;
|
||||
std::unique_ptr<Image> image(Image2dHelper<>::create(&context, &imgDesc, &imgFormat));
|
||||
|
||||
auto pClDevice = context.getDevice(0);
|
||||
|
||||
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
|
||||
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
|
||||
surfaceState.setSurfaceFormat(RENDER_SURFACE_STATE::SURFACE_FORMAT::SURFACE_FORMAT_R32_FLOAT_X8X24_TYPELESS);
|
||||
imageHw->setAuxParamsForMultisamples(&surfaceState, pClDevice->getRootDeviceIndex());
|
||||
|
||||
EXPECT_EQ(surfaceState.getMultisampledSurfaceStorageFormat(),
|
||||
RENDER_SURFACE_STATE::MULTISAMPLED_SURFACE_STORAGE_FORMAT::MULTISAMPLED_SURFACE_STORAGE_FORMAT_MSS);
|
||||
}
|
||||
|
||||
HWTEST2_F(ImageClearColorFixture, givenImageForXeHPAndLaterWhenClearColorParametersAreSetThenClearColorSurfaceInSurfaceStateIsSet, CompressionParamsSupportedMatcher) {
|
||||
this->setUpImpl<FamilyType>();
|
||||
auto surfaceState = this->getSurfaceState<FamilyType>();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -114,7 +114,7 @@ TEST_P(CreateTiledImageTest, GivenSharedTiledImageWhenCheckingIsTiledThenTrueRet
|
|||
0,
|
||||
&surfaceFormat,
|
||||
info,
|
||||
0, 0, 0);
|
||||
0, 0, 0, false);
|
||||
|
||||
ASSERT_NE(nullptr, image);
|
||||
|
||||
|
@ -155,7 +155,7 @@ TEST_P(CreateNonTiledImageTest, GivenSharedNonTiledImageWhenCheckingIsTiledThenF
|
|||
0,
|
||||
&surfaceFormat,
|
||||
info,
|
||||
0, 0, 0);
|
||||
0, 0, 0, false);
|
||||
|
||||
ASSERT_NE(nullptr, image);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -79,6 +79,11 @@ class GlSharingTextureTests : public ::testing::Test {
|
|||
auto mockGmmResInfo = static_cast<MockGmmResourceInfo *>(tempMM->forceGmm->gmmResourceInfo.get());
|
||||
mockGmmResInfo->setUnifiedAuxTranslationCapable();
|
||||
}
|
||||
void setMcsSurf() {
|
||||
tempMM->useForcedGmm = true;
|
||||
auto mockGmmResInfo = static_cast<MockGmmResourceInfo *>(tempMM->forceGmm->gmmResourceInfo.get());
|
||||
mockGmmResInfo->setMultisampleControlSurface();
|
||||
}
|
||||
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
ImageDescriptor imgDesc;
|
||||
|
@ -211,6 +216,24 @@ TEST_F(GlSharingTextureTests, givenGmmResourceAsInputWhenTextureIsCreatedThenItH
|
|||
delete glTexture;
|
||||
}
|
||||
|
||||
TEST_F(GlSharingTextureTests, givenGmmResourceInfoWithMcsWhenMcsHandleIsNullAndMultisampleCountIsGreaterThanOneThenImageHasUnifiedMcs) {
|
||||
cl_int retVal = CL_INVALID_VALUE;
|
||||
|
||||
setMcsSurf();
|
||||
glSharing->textureInfoOutput.globalShareHandleMCS = NULL;
|
||||
glSharing->textureInfoOutput.numberOfSamples = 16;
|
||||
glSharing->textureInfoOutput.globalShareHandle = textureId;
|
||||
glSharing->textureInfoOutput.pGmmResInfo = this->tempMM->forceGmm->gmmResourceInfo->peekGmmResourceInfo();
|
||||
this->tempMM->useForcedGmm = false;
|
||||
glSharing->textureInfoOutput.pGmmResInfo = this->tempMM->forceGmm->gmmResourceInfo->peekGmmResourceInfo();
|
||||
|
||||
glSharing->uploadDataToTextureInfo();
|
||||
|
||||
auto glTexture = GlTexture::createSharedGlTexture(clContext.get(), (cl_mem_flags)0, GL_TEXTURE_1D, 0, textureId, &retVal);
|
||||
EXPECT_TRUE(glTexture->getIsUnifiedMcsSurface());
|
||||
delete glTexture;
|
||||
}
|
||||
|
||||
TEST_F(GlSharingTextureTests, givenDifferentHwFormatWhenSurfaceFormatInfoIsSetThenOverwrite) {
|
||||
cl_int retVal = CL_INVALID_VALUE;
|
||||
cl_image_format imageFormat = {};
|
||||
|
|
Loading…
Reference in New Issue