Add helpers for page fault support

Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
Milczarek, Slawomir
2021-11-02 07:54:20 +00:00
committed by Compute-Runtime-Automation
parent 7d109c42bc
commit ca4af1dde1
9 changed files with 59 additions and 0 deletions

View File

@@ -138,6 +138,7 @@ void DrmAllocation::registerBOBindExtHandle(Drm *drm) {
}
bo->requireImmediateBinding(true);
bo->requireExplicitResidency(!shouldAllocationPageFault(drm));
}
}
}

View File

@@ -88,6 +88,7 @@ class DrmAllocation : public GraphicsAllocation {
void freeRegisteredBOBindExtHandles(Drm *drm);
void linkWithRegisteredHandle(uint32_t handle);
MOCKABLE_VIRTUAL void markForCapture();
bool shouldAllocationPageFault(Drm *drm);
protected:
BufferObjects bufferObjects{};

View File

@@ -42,4 +42,8 @@ bool DrmAllocation::setMemAdvise(Drm *drm, MemAdviseFlags flags) {
return true;
}
bool DrmAllocation::shouldAllocationPageFault(Drm *drm) {
return false;
}
} // namespace NEO

View File

@@ -91,6 +91,13 @@ class BufferObject {
requiresImmediateBinding = required;
}
bool isExplicitResidencyRequired() {
return requiresExplicitResidency;
}
void requireExplicitResidency(bool required) {
requiresExplicitResidency = required;
}
void setCacheRegion(CacheRegion regionIndex) { cacheRegion = regionIndex; }
CacheRegion peekCacheRegion() const { return cacheRegion; }
@@ -133,6 +140,7 @@ class BufferObject {
uint32_t tiling_mode;
bool allowCapture = false;
bool requiresImmediateBinding = false;
bool requiresExplicitResidency = false;
uint32_t getOsContextId(OsContext *osContext);
MOCKABLE_VIRTUAL void fillExecObject(drm_i915_gem_exec_object2 &execObject, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId);

View File

@@ -172,6 +172,9 @@ class Drm : public DriverModel {
MOCKABLE_VIRTUAL bool isVmBindAvailable();
MOCKABLE_VIRTUAL bool registerResourceClasses();
void queryPageFaultSupport();
bool hasPageFaultSupport();
MOCKABLE_VIRTUAL uint32_t registerResource(ResourceClass classType, const void *data, size_t size);
MOCKABLE_VIRTUAL void unregisterResource(uint32_t handle);
MOCKABLE_VIRTUAL uint32_t registerIsaCookie(uint32_t isaHandle);
@@ -323,6 +326,7 @@ class Drm : public DriverModel {
bool bindAvailable = false;
bool directSubmissionActive = false;
bool contextDebugSupported = false;
bool pageFaultSupported = false;
private:
int getParamIoctl(int param, int *dstValue);

View File

@@ -71,4 +71,11 @@ uint32_t Drm::createDrmContextExt(drm_i915_gem_context_create_ext &gcc, uint32_t
void Drm::appendDrmContextFlags(drm_i915_gem_context_create_ext &gcc, bool isSpecialContextRequested) {
}
void Drm::queryPageFaultSupport() {
}
bool Drm::hasPageFaultSupport() {
return false;
}
} // namespace NEO