Simplify preemption control on Linux

Change-Id: Ie0896cc8950f7fbb271b710b8bb221eb41ba0445
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2018-12-07 15:03:23 +01:00
committed by sys_ocldev
parent 9e53740130
commit f5508ed2d7
11 changed files with 63 additions and 105 deletions

View File

@@ -19,6 +19,10 @@
using namespace OCLRT;
#if !defined(I915_PARAM_HAS_PREEMPTION)
#define I915_PARAM_HAS_PREEMPTION 0x806
#endif
static const int mockFd = 33;
// Mock DRM class that responds to DRM_IOCTL_I915_GETPARAMs
class DrmMock : public Drm {
@@ -32,7 +36,7 @@ class DrmMock : public Drm {
sysFsDefaultGpuPath = sysFsDefaultGpuPathToRestore;
}
}
virtual inline int ioctl(unsigned long request, void *arg) {
int ioctl(unsigned long request, void *arg) override {
if ((request == DRM_IOCTL_I915_GETPARAM) && (arg != nullptr)) {
drm_i915_getparam_t *gp = (drm_i915_getparam_t *)arg;
if (false
@@ -194,20 +198,8 @@ class DrmMock : public Drm {
void setDeviceID(int deviceId) { this->deviceId = deviceId; }
void setDeviceRevID(int revisionId) { this->revisionId = revisionId; }
bool hasPreemption() {
#if defined(I915_PARAM_HAS_PREEMPTION)
drm_i915_getparam_t gp;
int value = 0;
gp.value = &value;
gp.param = I915_PARAM_HAS_PREEMPTION;
int ret = ioctl(DRM_IOCTL_I915_GETPARAM, &gp);
if (ret == 0 && *gp.value == 1) {
return contextCreate() && setLowPriority();
}
return false;
#else
return this->StoredMockPreemptionSupport == 1 ? true : false;
#endif
void checkPreemptionSupport() override {
preemptionSupported = StoredPreemptionSupport;
}
int StoredEUVal = -1;
@@ -224,8 +216,7 @@ class DrmMock : public Drm {
int StoredRetValForPooledEU = 0;
int StoredRetValForMinEUinPool = 0;
int StoredPPGTT = 3;
int StoredPreemptionSupport = 1;
int StoredMockPreemptionSupport = 0;
int StoredPreemptionSupport = 0;
int StoredExecSoftPin = 0;
uint32_t StoredCtxId = 1;