fix: add empty functions to set and get gemTiling in xeIoctlHelper

it is needed until there is no support in xe kmd for image tiling

Related-To: NEO-8325
Signed-off-by: Cencelewska, Katarzyna <katarzyna.cencelewska@intel.com>
This commit is contained in:
Cencelewska, Katarzyna
2023-09-12 14:57:55 +00:00
committed by Compute-Runtime-Automation
parent df961b3dc0
commit a6ea67bd09
7 changed files with 51 additions and 4 deletions

View File

@@ -159,10 +159,9 @@ bool BufferObject::setTiling(uint32_t mode, uint32_t stride) {
setTiling.stride = stride;
auto ioctlHelper = this->drm->getIoctlHelper();
if (ioctlHelper->ioctl(DrmIoctl::GemSetTiling, &setTiling) != 0) {
if (!ioctlHelper->setGemTiling(&setTiling)) {
return false;
}
this->tilingMode = setTiling.tilingMode;
return setTiling.tilingMode == mode;

View File

@@ -1021,9 +1021,10 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
GemGetTiling getTiling{};
getTiling.handle = boHandle;
auto ioctlHelper = drm.getIoctlHelper();
ret = ioctlHelper->ioctl(DrmIoctl::GemGetTiling, &getTiling);
if (ret == 0) {
ret = ioctlHelper->getGemTiling(&getTiling);
if (ret) {
auto ioctlHelper = drm.getIoctlHelper();
if (getTiling.tilingMode == static_cast<uint32_t>(ioctlHelper->getDrmParamValue(DrmParam::TilingNone))) {
properties.imgInfo->linearStorage = true;

View File

@@ -564,4 +564,12 @@ uint32_t IoctlHelper::createGem(uint64_t size, uint32_t memoryBanks) {
DEBUG_BREAK_IF(ret != 0);
return gemCreate.handle;
}
bool IoctlHelper::setGemTiling(void *setTiling) {
return this->ioctl(DrmIoctl::GemSetTiling, setTiling) == 0;
}
bool IoctlHelper::getGemTiling(void *setTiling) {
return this->ioctl(DrmIoctl::GemGetTiling, setTiling) == 0;
}
} // namespace NEO

View File

@@ -93,6 +93,8 @@ class IoctlHelper {
virtual bool setVmBoAdvise(int32_t handle, uint32_t attribute, void *region) = 0;
virtual bool setVmBoAdviseForChunking(int32_t handle, uint64_t start, uint64_t length, uint32_t attribute, void *region) = 0;
virtual bool setVmPrefetch(uint64_t start, uint64_t length, uint32_t region, uint32_t vmId) = 0;
virtual bool setGemTiling(void *setTiling);
virtual bool getGemTiling(void *setTiling);
virtual uint32_t getDirectSubmissionFlag() = 0;
virtual std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) = 0;
virtual uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) = 0;

View File

@@ -1472,4 +1472,12 @@ bool IoctlHelperXe::isWaitBeforeBindRequired(bool bind) const {
return true;
}
bool IoctlHelperXe::setGemTiling(void *setTiling) {
return true;
}
bool IoctlHelperXe::getGemTiling(void *setTiling) {
return true;
}
} // namespace NEO

View File

@@ -60,6 +60,8 @@ class IoctlHelperXe : public IoctlHelper {
bool setVmBoAdvise(int32_t handle, uint32_t attribute, void *region) override;
bool setVmBoAdviseForChunking(int32_t handle, uint64_t start, uint64_t length, uint32_t attribute, void *region) override;
bool setVmPrefetch(uint64_t start, uint64_t length, uint32_t region, uint32_t vmId) override;
bool setGemTiling(void *setTiling) override;
bool getGemTiling(void *setTiling) override;
uint32_t getDirectSubmissionFlag() override;
std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) override;
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override;

View File

@@ -170,6 +170,7 @@ class DrmMockXe : public DrmMockCustom {
}
int ioctl(DrmIoctl request, void *arg) override {
int ret = -1;
ioctlCalled = true;
if (forceIoctlAnswer) {
return setIoctlAnswer;
}
@@ -327,6 +328,7 @@ class DrmMockXe : public DrmMockCustom {
StackVec<drm_xe_sync, 1> syncInputs;
int waitUserFenceReturn = 0;
uint32_t createParamsFlags = 0u;
bool ioctlCalled = false;
};
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThenProperValuesSet) {
@@ -410,6 +412,31 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndLocalMemoryThenPro
EXPECT_EQ(handle, testValueGemCreate);
}
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallSetGemTilingThenAlwaysTrue) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
ASSERT_NE(nullptr, xeIoctlHelper);
GemSetTiling setTiling{};
uint32_t ret = xeIoctlHelper->setGemTiling(&setTiling);
EXPECT_TRUE(ret);
EXPECT_FALSE(drm.ioctlCalled);
}
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGetGemTilingThenAlwaysTrue) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
ASSERT_NE(nullptr, xeIoctlHelper);
GemGetTiling getTiling{};
uint32_t ret = xeIoctlHelper->getGemTiling(&getTiling);
EXPECT_TRUE(ret);
EXPECT_FALSE(drm.ioctlCalled);
}
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsReturned) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};