mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 17:33:00 +08:00
Prelim DRM debug support
Signed-off-by: Daniel Chabrowski daniel.chabrowski@intel.com Related-To: NEO-6591
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
4994eb18c2
commit
5e021be0cd
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/os_interface/linux/cache_info_impl.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock_helper.h"
|
||||
|
||||
@@ -47,6 +48,13 @@ int DrmMockPrelimContext::handlePrelimRequest(unsigned long request, void *arg)
|
||||
return vmBindQueryReturn;
|
||||
}
|
||||
} break;
|
||||
case DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM: {
|
||||
auto gp = static_cast<drm_i915_gem_context_param *>(arg);
|
||||
if (gp->param == PRELIM_I915_CONTEXT_PARAM_DEBUG_FLAGS) {
|
||||
gp->value = contextDebugSupported ? PRELIM_I915_CONTEXT_PARAM_DEBUG_FLAG_SIP << 32 : 0;
|
||||
return 0;
|
||||
}
|
||||
} break;
|
||||
case PRELIM_DRM_IOCTL_I915_GEM_CLOS_RESERVE: {
|
||||
auto closReserveArg = static_cast<prelim_drm_i915_gem_clos_reserve *>(arg);
|
||||
closIndex++;
|
||||
@@ -86,6 +94,41 @@ int DrmMockPrelimContext::handlePrelimRequest(unsigned long request, void *arg)
|
||||
vmUnbindCalled++;
|
||||
return vmUnbindReturn;
|
||||
} break;
|
||||
case PRELIM_DRM_IOCTL_I915_UUID_REGISTER: {
|
||||
auto uuidControl = reinterpret_cast<prelim_drm_i915_uuid_control *>(arg);
|
||||
|
||||
if (uuidControl->uuid_class != uint32_t(PRELIM_I915_UUID_CLASS_STRING) && uuidControl->uuid_class > uuidHandle) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
uuidControl->handle = uuidHandle++;
|
||||
|
||||
receivedRegisterUuid = UuidControl{
|
||||
{},
|
||||
uuidControl->uuid_class,
|
||||
reinterpret_cast<void *>(uuidControl->ptr),
|
||||
uuidControl->size,
|
||||
uuidControl->handle,
|
||||
uuidControl->flags,
|
||||
uuidControl->extensions,
|
||||
};
|
||||
memcpy_s(receivedRegisterUuid->uuid, sizeof(receivedRegisterUuid->uuid), uuidControl->uuid, sizeof(uuidControl->uuid));
|
||||
return uuidControlReturn;
|
||||
} break;
|
||||
case PRELIM_DRM_IOCTL_I915_UUID_UNREGISTER: {
|
||||
auto uuidControl = reinterpret_cast<prelim_drm_i915_uuid_control *>(arg);
|
||||
receivedUnregisterUuid = UuidControl{
|
||||
{},
|
||||
uuidControl->uuid_class,
|
||||
reinterpret_cast<void *>(uuidControl->ptr),
|
||||
uuidControl->size,
|
||||
uuidControl->handle,
|
||||
uuidControl->flags,
|
||||
uuidControl->extensions,
|
||||
};
|
||||
memcpy_s(receivedUnregisterUuid->uuid, sizeof(receivedUnregisterUuid->uuid), uuidControl->uuid, sizeof(uuidControl->uuid));
|
||||
return uuidControlReturn;
|
||||
} break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
@@ -257,3 +300,7 @@ uint32_t DrmPrelimHelper::getDistanceInfoQueryId() {
|
||||
uint32_t DrmPrelimHelper::getComputeEngineClass() {
|
||||
return PRELIM_I915_ENGINE_CLASS_COMPUTE;
|
||||
}
|
||||
|
||||
uint32_t DrmPrelimHelper::getStringUuidClass() {
|
||||
return PRELIM_I915_UUID_CLASS_STRING;
|
||||
}
|
||||
|
||||
@@ -11,14 +11,27 @@
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/os_interface/linux/cache_info.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct UuidControl {
|
||||
char uuid[36]{};
|
||||
uint32_t uuidClass{0};
|
||||
void *ptr{nullptr};
|
||||
uint64_t size{0};
|
||||
uint32_t handle{0};
|
||||
uint32_t flags{0};
|
||||
uint64_t extensions{0};
|
||||
};
|
||||
|
||||
struct DrmMockPrelimContext {
|
||||
const HardwareInfo *hwInfo;
|
||||
const RootDeviceEnvironment &rootDeviceEnvironment;
|
||||
const CacheInfo *cacheInfo;
|
||||
const bool &failRetTopology;
|
||||
const BcsInfoMask &supportedCopyEnginesMask;
|
||||
const bool &contextDebugSupported;
|
||||
|
||||
uint16_t closIndex{0};
|
||||
uint16_t maxNumWays{32};
|
||||
@@ -37,6 +50,12 @@ struct DrmMockPrelimContext {
|
||||
int hasPageFaultQueryValue{0};
|
||||
int hasPageFaultQueryReturn{0};
|
||||
|
||||
uint32_t uuidHandle{1};
|
||||
std::optional<UuidControl> receivedRegisterUuid{};
|
||||
std::optional<UuidControl> receivedUnregisterUuid{};
|
||||
|
||||
int uuidControlReturn{0};
|
||||
|
||||
bool failDistanceInfoQuery{false};
|
||||
bool disableCcsSupport{false};
|
||||
|
||||
@@ -48,4 +67,5 @@ namespace DrmPrelimHelper {
|
||||
uint32_t getQueryComputeSlicesIoctl();
|
||||
uint32_t getDistanceInfoQueryId();
|
||||
uint32_t getComputeEngineClass();
|
||||
uint32_t getStringUuidClass();
|
||||
}; // namespace DrmPrelimHelper
|
||||
|
||||
@@ -43,6 +43,7 @@ class DrmQueryMock : public DrmMock {
|
||||
.cacheInfo = getCacheInfo(),
|
||||
.failRetTopology = failRetTopology,
|
||||
.supportedCopyEnginesMask = supportedCopyEnginesMask,
|
||||
.contextDebugSupported = contextDebugSupported,
|
||||
};
|
||||
|
||||
static constexpr uint32_t maxEngineCount{9};
|
||||
|
||||
Reference in New Issue
Block a user