xe: Add IOCTL support for GemCreate

This is needed to execute some workloads with iGPUs.

Signed-off-by: Francois Dugast <francois.dugast@intel.com>
This commit is contained in:
Francois Dugast
2023-03-10 16:24:01 +00:00
committed by Compute-Runtime-Automation
parent 7b5897d585
commit e2a4cd0d48
2 changed files with 20 additions and 0 deletions

View File

@@ -219,6 +219,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
verifyIoctlString(DrmIoctl::SyncobjWait, "DRM_IOCTL_SYNCOBJ_WAIT");
verifyIoctlString(DrmIoctl::SyncobjDestroy, "DRM_IOCTL_SYNCOBJ_DESTROY");
verifyIoctlString(DrmIoctl::GemClose, "DRM_IOCTL_GEM_CLOSE");
verifyIoctlString(DrmIoctl::GemCreate, "DRM_IOCTL_XE_GEM_CREATE");
verifyIoctlString(DrmIoctl::GemVmCreate, "DRM_IOCTL_XE_VM_CREATE");
verifyIoctlString(DrmIoctl::GemVmDestroy, "DRM_IOCTL_XE_VM_DESTROY");
verifyIoctlString(DrmIoctl::GemMmapOffset, "DRM_IOCTL_XE_GEM_MMAP_OFFSET");
@@ -436,6 +437,7 @@ TEST(IoctlHelperXeTest, whenGettingFileNamesForFrequencyThenProperStringIsReturn
inline constexpr int testValueVmId = 0x5764;
inline constexpr int testValueMapOff = 0x7788;
inline constexpr int testValuePrime = 0x4321;
inline constexpr int testValueGemCreate = 0x8273;
class DrmMockXe : public DrmMockCustom {
public:
@@ -491,6 +493,12 @@ class DrmMockXe : public DrmMockCustom {
ret = 0;
}
} break;
case DrmIoctl::GemCreate: {
GemCreate *v = static_cast<GemCreate *>(arg);
if (v->handle == testValueGemCreate) {
ret = 0;
}
} break;
case DrmIoctl::Getparam:
case DrmIoctl::GetResetStats:
ret = -2;
@@ -580,6 +588,12 @@ TEST(IoctlHelperXeTest, whenCallingIoctlThenProperValueIsReturned) {
EXPECT_EQ(0, ret);
EXPECT_EQ(static_cast<int>(test.fileDescriptor), testValuePrime);
}
{
GemCreate test = {};
test.handle = testValueGemCreate;
ret = mockXeIoctlHelper->ioctl(DrmIoctl::GemCreate, &test);
EXPECT_EQ(0, ret);
}
{
ResetStats test = {};
ret = mockXeIoctlHelper->ioctl(DrmIoctl::GetResetStats, &test);