Update H/V alignment GMM API
Change-Id: I394f51bee0ffb23007f4f0970b89dc15deb7e5c2 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
parent
e9b48f44b9
commit
b3e1bb08ba
|
@ -200,14 +200,6 @@ uint32_t Gmm::queryQPitch(GMM_RESOURCE_TYPE resType) {
|
|||
return gmmResourceInfo->getQPitch();
|
||||
}
|
||||
|
||||
uint32_t Gmm::getRenderHAlignment() {
|
||||
return GmmHelper::getRenderAlignment(gmmResourceInfo->getHAlign());
|
||||
}
|
||||
|
||||
uint32_t Gmm::getRenderVAlignment() {
|
||||
return GmmHelper::getRenderAlignment(gmmResourceInfo->getVAlign());
|
||||
}
|
||||
|
||||
void Gmm::updateImgInfo(ImageInfo &imgInfo, cl_image_desc &imgDesc, cl_uint arrayIndex) {
|
||||
imgDesc.image_width = gmmResourceInfo->getBaseWidth();
|
||||
imgDesc.image_row_pitch = gmmResourceInfo->getRenderPitch();
|
||||
|
|
|
@ -32,9 +32,6 @@ class Gmm {
|
|||
|
||||
void queryImageParams(ImageInfo &inputOutputImgInfo);
|
||||
|
||||
uint32_t getRenderHAlignment();
|
||||
uint32_t getRenderVAlignment();
|
||||
|
||||
void applyAuxFlagsForBuffer(bool preferRenderCompression);
|
||||
void applyMemoryFlags(bool systemMemoryPool, StorageInfo &storageInfo);
|
||||
|
||||
|
|
|
@ -106,18 +106,6 @@ uint64_t GmmHelper::decanonize(uint64_t address) {
|
|||
return (uint64_t)(address & 0xFFFFFFFFFFFF);
|
||||
}
|
||||
|
||||
uint32_t GmmHelper::getRenderAlignment(uint32_t alignment) {
|
||||
uint32_t returnAlign = 0;
|
||||
if (alignment == 8) {
|
||||
returnAlign = 2;
|
||||
} else if (alignment == 16) {
|
||||
returnAlign = 3;
|
||||
} else {
|
||||
returnAlign = 1;
|
||||
}
|
||||
return returnAlign;
|
||||
}
|
||||
|
||||
uint32_t GmmHelper::getRenderMultisamplesCount(uint32_t numSamples) {
|
||||
if (numSamples == 2) {
|
||||
return 1;
|
||||
|
|
|
@ -47,7 +47,6 @@ class GmmHelper {
|
|||
static void queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAlloc);
|
||||
static GMM_CUBE_FACE_ENUM getCubeFaceIndex(uint32_t target);
|
||||
static bool allowTiling(const cl_image_desc &imageDesc);
|
||||
static uint32_t getRenderAlignment(uint32_t alignment);
|
||||
static uint32_t getRenderMultisamplesCount(uint32_t numSamples);
|
||||
static GMM_YUV_PLANE convertPlane(OCLPlane oclPlane);
|
||||
|
||||
|
|
|
@ -42,6 +42,10 @@ class GmmResourceInfo {
|
|||
|
||||
MOCKABLE_VIRTUAL uint32_t getVAlign() { return resourceInfo->GetVAlign(); }
|
||||
|
||||
MOCKABLE_VIRTUAL uint32_t getHAlignSurfaceState() { return resourceInfo->GetHAlignSurfaceState(); }
|
||||
|
||||
MOCKABLE_VIRTUAL uint32_t getVAlignSurfaceState() { return resourceInfo->GetVAlignSurfaceState(); }
|
||||
|
||||
MOCKABLE_VIRTUAL uint32_t getMaxLod() { return resourceInfo->GetMaxLod(); }
|
||||
|
||||
MOCKABLE_VIRTUAL uint32_t getTileModeSurfaceState() { return resourceInfo->GetTileModeSurfaceState(); }
|
||||
|
|
|
@ -48,8 +48,8 @@ void ImageHw<GfxFamily>::setImageArg(void *memory, bool setAsMediaBlockImage, ui
|
|||
auto vAlign = RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4;
|
||||
|
||||
if (gmm) {
|
||||
hAlign = static_cast<typename RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT>(gmm->getRenderHAlignment());
|
||||
vAlign = static_cast<typename RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT>(gmm->getRenderVAlignment());
|
||||
hAlign = static_cast<typename RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT>(gmm->gmmResourceInfo->getHAlignSurfaceState());
|
||||
vAlign = static_cast<typename RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT>(gmm->gmmResourceInfo->getVAlignSurfaceState());
|
||||
}
|
||||
|
||||
if (cubeFaceIndex != __GMM_NO_CUBE_MAP) {
|
||||
|
|
|
@ -375,13 +375,6 @@ TEST_F(GmmTests, decanonize) {
|
|||
EXPECT_EQ(GmmHelper::decanonize(addr2), addrExpected2);
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, returnRenderTileMode) {
|
||||
uint32_t alignments[5][2] = {{0, 1}, {4, 1}, {8, 2}, {16, 3}, {20, 1}}; // {given, expected}
|
||||
for (uint32_t i = 0; i < 5; i++) {
|
||||
EXPECT_EQ(GmmHelper::getRenderAlignment(alignments[i][0]), alignments[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, givenMipmapedInputWhenAskedForHalingThenNonDefaultValueIsReturned) {
|
||||
cl_image_desc imgDesc{};
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/compiler_interface/compiler_interface.h"
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/mipmap.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
|
@ -1452,7 +1453,22 @@ HWTEST_F(HwImageTest, givenImageHwWhenSettingCCSParamsThenSetClearColorParamsIsC
|
|||
EXPECT_TRUE(mockImage->setClearColorParamsCalled);
|
||||
}
|
||||
|
||||
using HwImageTest = ::testing::Test;
|
||||
HWTEST_F(HwImageTest, givenImageHwWhenSettingAlignmentThenUseGmmValues) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
MockContext context;
|
||||
OsAgnosticMemoryManager memoryManager(*context.getDevice(0)->getExecutionEnvironment());
|
||||
context.setMemoryManager(&memoryManager);
|
||||
|
||||
std::unique_ptr<Image> image(ImageHelper<Image2dDefaults>::create(&context));
|
||||
|
||||
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
|
||||
|
||||
image->setImageArg(&surfaceState, false, 0);
|
||||
auto resourceInfo = image->getGraphicsAllocation()->getDefaultGmm()->gmmResourceInfo.get();
|
||||
EXPECT_EQ(resourceInfo->getHAlignSurfaceState(), surfaceState.getSurfaceHorizontalAlignment());
|
||||
EXPECT_EQ(resourceInfo->getVAlignSurfaceState(), surfaceState.getSurfaceVerticalAlignment());
|
||||
}
|
||||
|
||||
HWTEST_F(HwImageTest, givenImageHwWithUnifiedSurfaceAndMcsWhenSettingParamsForMultisampleImageThenSetParamsForCcsMcsIsCalled) {
|
||||
|
||||
MockContext context;
|
||||
|
|
|
@ -49,6 +49,10 @@ class MockGmmResourceInfo : public GmmResourceInfo {
|
|||
|
||||
uint32_t getVAlign() override { return 4u; }
|
||||
|
||||
uint32_t getHAlignSurfaceState() override { return 1u; }
|
||||
|
||||
uint32_t getVAlignSurfaceState() override { return 1u; }
|
||||
|
||||
uint32_t getMaxLod() override { return 7u; }
|
||||
|
||||
uint32_t getTileModeSurfaceState() override;
|
||||
|
|
Loading…
Reference in New Issue