mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
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:
committed by
Compute-Runtime-Automation
parent
df961b3dc0
commit
a6ea67bd09
@@ -159,10 +159,9 @@ bool BufferObject::setTiling(uint32_t mode, uint32_t stride) {
|
|||||||
setTiling.stride = stride;
|
setTiling.stride = stride;
|
||||||
auto ioctlHelper = this->drm->getIoctlHelper();
|
auto ioctlHelper = this->drm->getIoctlHelper();
|
||||||
|
|
||||||
if (ioctlHelper->ioctl(DrmIoctl::GemSetTiling, &setTiling) != 0) {
|
if (!ioctlHelper->setGemTiling(&setTiling)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->tilingMode = setTiling.tilingMode;
|
this->tilingMode = setTiling.tilingMode;
|
||||||
|
|
||||||
return setTiling.tilingMode == mode;
|
return setTiling.tilingMode == mode;
|
||||||
|
|||||||
@@ -1021,9 +1021,10 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
|
|||||||
GemGetTiling getTiling{};
|
GemGetTiling getTiling{};
|
||||||
getTiling.handle = boHandle;
|
getTiling.handle = boHandle;
|
||||||
auto ioctlHelper = drm.getIoctlHelper();
|
auto ioctlHelper = drm.getIoctlHelper();
|
||||||
ret = ioctlHelper->ioctl(DrmIoctl::GemGetTiling, &getTiling);
|
|
||||||
|
|
||||||
if (ret == 0) {
|
ret = ioctlHelper->getGemTiling(&getTiling);
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
auto ioctlHelper = drm.getIoctlHelper();
|
auto ioctlHelper = drm.getIoctlHelper();
|
||||||
if (getTiling.tilingMode == static_cast<uint32_t>(ioctlHelper->getDrmParamValue(DrmParam::TilingNone))) {
|
if (getTiling.tilingMode == static_cast<uint32_t>(ioctlHelper->getDrmParamValue(DrmParam::TilingNone))) {
|
||||||
properties.imgInfo->linearStorage = true;
|
properties.imgInfo->linearStorage = true;
|
||||||
|
|||||||
@@ -564,4 +564,12 @@ uint32_t IoctlHelper::createGem(uint64_t size, uint32_t memoryBanks) {
|
|||||||
DEBUG_BREAK_IF(ret != 0);
|
DEBUG_BREAK_IF(ret != 0);
|
||||||
return gemCreate.handle;
|
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
|
} // namespace NEO
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ class IoctlHelper {
|
|||||||
virtual bool setVmBoAdvise(int32_t handle, uint32_t attribute, void *region) = 0;
|
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 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 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 uint32_t getDirectSubmissionFlag() = 0;
|
||||||
virtual std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) = 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;
|
virtual uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) = 0;
|
||||||
|
|||||||
@@ -1472,4 +1472,12 @@ bool IoctlHelperXe::isWaitBeforeBindRequired(bool bind) const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IoctlHelperXe::setGemTiling(void *setTiling) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IoctlHelperXe::getGemTiling(void *setTiling) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ class IoctlHelperXe : public IoctlHelper {
|
|||||||
bool setVmBoAdvise(int32_t handle, uint32_t attribute, void *region) override;
|
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 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 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;
|
uint32_t getDirectSubmissionFlag() override;
|
||||||
std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) override;
|
std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) override;
|
||||||
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override;
|
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override;
|
||||||
|
|||||||
@@ -170,6 +170,7 @@ class DrmMockXe : public DrmMockCustom {
|
|||||||
}
|
}
|
||||||
int ioctl(DrmIoctl request, void *arg) override {
|
int ioctl(DrmIoctl request, void *arg) override {
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
ioctlCalled = true;
|
||||||
if (forceIoctlAnswer) {
|
if (forceIoctlAnswer) {
|
||||||
return setIoctlAnswer;
|
return setIoctlAnswer;
|
||||||
}
|
}
|
||||||
@@ -327,6 +328,7 @@ class DrmMockXe : public DrmMockCustom {
|
|||||||
StackVec<drm_xe_sync, 1> syncInputs;
|
StackVec<drm_xe_sync, 1> syncInputs;
|
||||||
int waitUserFenceReturn = 0;
|
int waitUserFenceReturn = 0;
|
||||||
uint32_t createParamsFlags = 0u;
|
uint32_t createParamsFlags = 0u;
|
||||||
|
bool ioctlCalled = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThenProperValuesSet) {
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThenProperValuesSet) {
|
||||||
@@ -410,6 +412,31 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndLocalMemoryThenPro
|
|||||||
EXPECT_EQ(handle, testValueGemCreate);
|
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) {
|
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsReturned) {
|
||||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||||
|
|||||||
Reference in New Issue
Block a user