refactor: correct ioctl and related functions to return signed int
Change IoctlHelper::ioctl function to return int. Change IoctlHelper::createGemExt function to return int. Change IoctlHelper::queryDistances function to return int. Change UuidRegisterResult::retVal type to int32_t. Rename res to ret in debug_session.cpp for consistency. Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
parent
fc7a37d950
commit
2ed2ac73d1
|
@ -373,10 +373,10 @@ bool DebugSessionLinux::closeFd() {
|
|||
return false;
|
||||
}
|
||||
|
||||
auto res = NEO::SysCalls::close(fd);
|
||||
auto ret = NEO::SysCalls::close(fd);
|
||||
|
||||
if (res != 0) {
|
||||
PRINT_DEBUGGER_ERROR_LOG("Debug connection close() on fd: %d failed: retCode: %d\n", fd, res);
|
||||
if (ret != 0) {
|
||||
PRINT_DEBUGGER_ERROR_LOG("Debug connection close() on fd: %d failed: retCode: %d\n", fd, ret);
|
||||
return false;
|
||||
}
|
||||
fd = 0;
|
||||
|
@ -568,9 +568,9 @@ void DebugSessionLinux::handleEvent(prelim_drm_i915_debug_event *event) {
|
|||
readUuid.handle = static_cast<decltype(readUuid.handle)>(uuid->handle);
|
||||
readUuid.payload_ptr = reinterpret_cast<uint64_t>(payload.get());
|
||||
readUuid.payload_size = uuid->payload_size;
|
||||
auto res = ioctl(PRELIM_I915_DEBUG_IOCTL_READ_UUID, &readUuid);
|
||||
auto ret = ioctl(PRELIM_I915_DEBUG_IOCTL_READ_UUID, &readUuid);
|
||||
|
||||
if (res == 0) {
|
||||
if (ret == 0) {
|
||||
std::string uuidString = std::string(readUuid.uuid, 36);
|
||||
uint32_t classIndex = static_cast<uint32_t>(NEO::DrmResourceClass::MaxSize);
|
||||
auto validClassUuid = NEO::DrmUuid::getClassUuidIndex(uuidString, classIndex);
|
||||
|
@ -640,10 +640,10 @@ void DebugSessionLinux::handleEvent(prelim_drm_i915_debug_event *event) {
|
|||
extractUuidData(uuid->client_handle, uuidData);
|
||||
}
|
||||
|
||||
PRINT_DEBUGGER_INFO_LOG("PRELIM_I915_DEBUG_IOCTL_READ_UUID client_handle = %llu handle = %llu flags = %d uuid = %s res = %d\n",
|
||||
(uint64_t)readUuid.client_handle, (uint64_t)readUuid.handle, (int)readUuid.flags, uuidString.c_str(), res);
|
||||
PRINT_DEBUGGER_INFO_LOG("PRELIM_I915_DEBUG_IOCTL_READ_UUID client_handle = %llu handle = %llu flags = %d uuid = %s ret = %d\n",
|
||||
(uint64_t)readUuid.client_handle, (uint64_t)readUuid.handle, (int)readUuid.flags, uuidString.c_str(), ret);
|
||||
} else {
|
||||
PRINT_DEBUGGER_ERROR_LOG("PRELIM_I915_DEBUG_IOCTL_READ_UUID res = %d errno = %d\n", res, errno);
|
||||
PRINT_DEBUGGER_ERROR_LOG("PRELIM_I915_DEBUG_IOCTL_READ_UUID ret = %d errno = %d\n", ret, errno);
|
||||
}
|
||||
} else {
|
||||
connection->uuidMap[uuid->handle].classHandle = uuid->class_handle;
|
||||
|
@ -789,10 +789,10 @@ void DebugSessionLinux::readStateSaveAreaHeader() {
|
|||
}
|
||||
|
||||
ze_result_t DebugSessionLinux::readEventImp(prelim_drm_i915_debug_event *drmDebugEvent) {
|
||||
auto res = ioctl(PRELIM_I915_DEBUG_IOCTL_READ_EVENT, drmDebugEvent);
|
||||
auto ret = ioctl(PRELIM_I915_DEBUG_IOCTL_READ_EVENT, drmDebugEvent);
|
||||
|
||||
if (res != 0) {
|
||||
PRINT_DEBUGGER_ERROR_LOG("PRELIM_I915_DEBUG_IOCTL_READ_EVENT failed: retCode: %d errno = %d\n", res, errno);
|
||||
if (ret != 0) {
|
||||
PRINT_DEBUGGER_ERROR_LOG("PRELIM_I915_DEBUG_IOCTL_READ_EVENT failed: retCode: %d errno = %d\n", ret, errno);
|
||||
} else {
|
||||
if ((drmDebugEvent->flags & PRELIM_DRM_I915_DEBUG_EVENT_CREATE) == 0 &&
|
||||
(drmDebugEvent->flags & PRELIM_DRM_I915_DEBUG_EVENT_DESTROY) == 0 &&
|
||||
|
@ -1415,16 +1415,16 @@ int DebugSessionLinux::threadControl(const std::vector<EuThread::ThreadId> &thre
|
|||
|
||||
printBitmask(bitmask.get(), bitmaskSize);
|
||||
|
||||
auto res = ioctl(PRELIM_I915_DEBUG_IOCTL_EU_CONTROL, &euControl);
|
||||
if (res != 0) {
|
||||
PRINT_DEBUGGER_ERROR_LOG("PRELIM_I915_DEBUG_IOCTL_EU_CONTROL failed: retCode: %d errno = %d command = %d\n", res, errno, command);
|
||||
auto ret = ioctl(PRELIM_I915_DEBUG_IOCTL_EU_CONTROL, &euControl);
|
||||
if (ret != 0) {
|
||||
PRINT_DEBUGGER_ERROR_LOG("PRELIM_I915_DEBUG_IOCTL_EU_CONTROL failed: retCode: %d errno = %d command = %d\n", ret, errno, command);
|
||||
} else {
|
||||
PRINT_DEBUGGER_INFO_LOG("PRELIM_I915_DEBUG_IOCTL_EU_CONTROL: seqno = %llu command = %u\n", (uint64_t)euControl.seqno, command);
|
||||
}
|
||||
|
||||
if (command == PRELIM_I915_DEBUG_EU_THREADS_CMD_INTERRUPT ||
|
||||
command == PRELIM_I915_DEBUG_EU_THREADS_CMD_INTERRUPT_ALL) {
|
||||
if (res == 0) {
|
||||
if (ret == 0) {
|
||||
euControlInterruptSeqno[tile] = euControl.seqno;
|
||||
} else {
|
||||
euControlInterruptSeqno[tile] = invalidHandle;
|
||||
|
@ -1435,7 +1435,7 @@ int DebugSessionLinux::threadControl(const std::vector<EuThread::ThreadId> &thre
|
|||
bitmaskOut = std::move(bitmask);
|
||||
bitmaskSizeOut = euControl.bitmask_size;
|
||||
}
|
||||
return res;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ze_result_t DebugSessionLinux::resumeImp(const std::vector<EuThread::ThreadId> &threads, uint32_t deviceIndex) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -111,7 +111,7 @@ ze_result_t MetricIpSamplingLinuxImp::startMeasurement(uint32_t ¬ifyEveryNRep
|
|||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
int32_t ret = NEO::SysCalls::ioctl(stream, I915_PERF_IOCTL_ENABLE, 0);
|
||||
auto ret = NEO::SysCalls::ioctl(stream, I915_PERF_IOCTL_ENABLE, 0);
|
||||
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get() && (ret < 0), stderr,
|
||||
"PRELIM_I915_PERF_IOCTL_ENABLE failed errno = %d | ret = %d \n", errno, ret);
|
||||
|
||||
|
@ -120,11 +120,11 @@ ze_result_t MetricIpSamplingLinuxImp::startMeasurement(uint32_t ¬ifyEveryNRep
|
|||
|
||||
ze_result_t MetricIpSamplingLinuxImp::stopMeasurement() {
|
||||
|
||||
int32_t disableStatus = NEO::SysCalls::ioctl(stream, I915_PERF_IOCTL_DISABLE, 0);
|
||||
int disableStatus = NEO::SysCalls::ioctl(stream, I915_PERF_IOCTL_DISABLE, 0);
|
||||
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get() && (disableStatus < 0), stderr,
|
||||
"I915_PERF_IOCTL_DISABLE failed errno = %d | ret = %d \n", errno, disableStatus);
|
||||
|
||||
int32_t closeStatus = NEO::SysCalls::close(stream);
|
||||
int closeStatus = NEO::SysCalls::close(stream);
|
||||
PRINT_DEBUG_STRING(NEO::DebugManager.flags.PrintDebugMessages.get() && (closeStatus < 0), stderr,
|
||||
"close() failed errno = %d | ret = %d \n", errno, closeStatus);
|
||||
stream = -1;
|
||||
|
|
|
@ -4980,7 +4980,7 @@ TEST_F(DebugApiLinuxTest, GivenDebuggerLogsAndFailingReadUuidEventIoctlWhenHandl
|
|||
EXPECT_EQ(0u, session->getClassHandleToIndex().size());
|
||||
|
||||
auto errorMessage = ::testing::internal::GetCapturedStderr();
|
||||
EXPECT_EQ(std::string("\nERROR: PRELIM_I915_DEBUG_IOCTL_READ_UUID res = -1 errno = 0\n"), errorMessage);
|
||||
EXPECT_EQ(std::string("\nERROR: PRELIM_I915_DEBUG_IOCTL_READ_UUID ret = -1 errno = 0\n"), errorMessage);
|
||||
}
|
||||
|
||||
TEST_F(DebugApiLinuxTest, GivenEventsAvailableWhenReadingEventThenEventsAreReturned) {
|
||||
|
|
|
@ -1590,7 +1590,7 @@ BufferObject *DrmMemoryManager::createBufferObjectInMemoryRegion(Drm *drm, Gmm *
|
|||
}
|
||||
|
||||
uint32_t handle = 0;
|
||||
uint32_t ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
auto banks = std::bitset<4>(memoryBanks);
|
||||
if (banks.count() > 1) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace NEO {
|
||||
|
||||
uint32_t IoctlHelper::ioctl(DrmIoctl request, void *arg) {
|
||||
int IoctlHelper::ioctl(DrmIoctl request, void *arg) {
|
||||
return drm.ioctl(request, arg);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ bool IoctlHelper::setDomainCpu(uint32_t handle, bool writeEnable) {
|
|||
setDomain.handle = handle;
|
||||
setDomain.read_domains = I915_GEM_DOMAIN_CPU;
|
||||
setDomain.write_domain = writeEnable ? I915_GEM_DOMAIN_CPU : 0;
|
||||
return this->ioctl(DrmIoctl::GemSetDomain, &setDomain) == 0u;
|
||||
return this->ioctl(DrmIoctl::GemSetDomain, &setDomain) == 0;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelper::getFlagsForPrimeHandleToFd() const {
|
||||
|
|
|
@ -55,7 +55,7 @@ struct VmBindParams {
|
|||
};
|
||||
|
||||
struct UuidRegisterResult {
|
||||
uint32_t retVal;
|
||||
int32_t retVal;
|
||||
uint32_t handle;
|
||||
};
|
||||
|
||||
|
@ -68,12 +68,12 @@ class IoctlHelper {
|
|||
IoctlHelper(Drm &drmArg) : drm(drmArg){};
|
||||
virtual ~IoctlHelper() {}
|
||||
static std::unique_ptr<IoctlHelper> getI915Helper(const PRODUCT_FAMILY productFamily, const std::string &prelimVersion, Drm &drm);
|
||||
virtual uint32_t ioctl(DrmIoctl request, void *arg);
|
||||
virtual int ioctl(DrmIoctl request, void *arg);
|
||||
|
||||
virtual bool initialize() = 0;
|
||||
virtual bool isSetPairAvailable() = 0;
|
||||
virtual bool isVmBindAvailable() = 0;
|
||||
virtual uint32_t createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) = 0;
|
||||
virtual int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) = 0;
|
||||
virtual CacheRegion closAlloc() = 0;
|
||||
virtual uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) = 0;
|
||||
virtual CacheRegion closFree(CacheRegion closIndex) = 0;
|
||||
|
@ -86,7 +86,7 @@ class IoctlHelper {
|
|||
virtual uint32_t getDirectSubmissionFlag() = 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 uint32_t queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) = 0;
|
||||
virtual int queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) = 0;
|
||||
virtual uint16_t getWaitUserFenceSoftFlag() = 0;
|
||||
virtual int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) = 0;
|
||||
virtual bool completionFenceExtensionSupported(const bool isVmBindAvailable) = 0;
|
||||
|
@ -151,7 +151,7 @@ class IoctlHelperUpstream : public IoctlHelper {
|
|||
bool initialize() override;
|
||||
bool isSetPairAvailable() override;
|
||||
bool isVmBindAvailable() override;
|
||||
uint32_t createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) override;
|
||||
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) override;
|
||||
CacheRegion closAlloc() override;
|
||||
uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override;
|
||||
CacheRegion closFree(CacheRegion closIndex) override;
|
||||
|
@ -164,7 +164,7 @@ class IoctlHelperUpstream : public IoctlHelper {
|
|||
uint32_t getDirectSubmissionFlag() override;
|
||||
std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) override;
|
||||
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override;
|
||||
uint32_t queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) override;
|
||||
int queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) override;
|
||||
uint16_t getWaitUserFenceSoftFlag() override;
|
||||
int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) override;
|
||||
bool completionFenceExtensionSupported(const bool isVmBindAvailable) override;
|
||||
|
@ -204,7 +204,7 @@ class IoctlHelperImpl : public IoctlHelperUpstream {
|
|||
return std::make_unique<IoctlHelperImpl<gfxProduct>>(drm);
|
||||
}
|
||||
|
||||
uint32_t createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) override;
|
||||
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) override;
|
||||
std::vector<MemoryRegion> translateToMemoryRegions(const std::vector<uint8_t> ®ionInfo) override;
|
||||
unsigned int getIoctlRequestValue(DrmIoctl ioctlRequest) const override;
|
||||
std::string getIoctlString(DrmIoctl ioctlRequest) const override;
|
||||
|
@ -217,7 +217,7 @@ class IoctlHelperPrelim20 : public IoctlHelper {
|
|||
bool initialize() override;
|
||||
bool isSetPairAvailable() override;
|
||||
bool isVmBindAvailable() override;
|
||||
uint32_t createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) override;
|
||||
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) override;
|
||||
CacheRegion closAlloc() override;
|
||||
uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override;
|
||||
CacheRegion closFree(CacheRegion closIndex) override;
|
||||
|
@ -230,7 +230,7 @@ class IoctlHelperPrelim20 : public IoctlHelper {
|
|||
uint32_t getDirectSubmissionFlag() override;
|
||||
std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) override;
|
||||
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override;
|
||||
uint32_t queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) override;
|
||||
int queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) override;
|
||||
uint16_t getWaitUserFenceSoftFlag() override;
|
||||
int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) override;
|
||||
bool completionFenceExtensionSupported(const bool isVmBindAvailable) override;
|
||||
|
|
|
@ -66,7 +66,7 @@ bool IoctlHelperPrelim20::isVmBindAvailable() {
|
|||
return vmBindSupported;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperPrelim20::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) {
|
||||
int IoctlHelperPrelim20::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) {
|
||||
uint32_t regionsSize = static_cast<uint32_t>(memClassInstances.size());
|
||||
std::vector<prelim_drm_i915_gem_memory_class_instance> regions(regionsSize);
|
||||
for (uint32_t i = 0; i < regionsSize; i++) {
|
||||
|
@ -330,7 +330,7 @@ prelim_drm_i915_query_distance_info translateToi915(const DistanceInfo &distance
|
|||
return dist;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperPrelim20::queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) {
|
||||
int IoctlHelperPrelim20::queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) {
|
||||
std::vector<prelim_drm_i915_query_distance_info> i915Distances(distanceInfos.size());
|
||||
std::transform(distanceInfos.begin(), distanceInfos.end(), i915Distances.begin(), translateToi915);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -26,7 +26,7 @@ bool IoctlHelperUpstream::isVmBindAvailable() {
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperUpstream::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) {
|
||||
int IoctlHelperUpstream::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) {
|
||||
uint32_t regionsSize = static_cast<uint32_t>(memClassInstances.size());
|
||||
std::vector<drm_i915_gem_memory_class_instance> regions(regionsSize);
|
||||
for (uint32_t i = 0; i < regionsSize; i++) {
|
||||
|
@ -106,7 +106,7 @@ uint64_t IoctlHelperUpstream::getFlagsForVmBind(bool bindCapture, bool bindImmed
|
|||
return 0u;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperUpstream::queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) {
|
||||
int IoctlHelperUpstream::queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) {
|
||||
for (auto &query : queryItems) {
|
||||
query.length = -EINVAL;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ constexpr static auto gfxProduct = IGFX_DG1;
|
|||
extern bool isQueryDrmTip(const std::vector<uint8_t> &queryInfo);
|
||||
|
||||
template <>
|
||||
uint32_t IoctlHelperImpl<gfxProduct>::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) {
|
||||
int IoctlHelperImpl<gfxProduct>::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) {
|
||||
auto ret = IoctlHelperUpstream::createGemExt(memClassInstances, allocSize, handle, vmId, pairHandle);
|
||||
if (ret == 0) {
|
||||
return ret;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -56,7 +56,7 @@ void MemoryInfo::assignRegionsFromDistances(const std::vector<DistanceInfo> &dis
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t MemoryInfo::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) {
|
||||
int MemoryInfo::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) {
|
||||
return this->drm.getIoctlHelper()->createGemExt(memClassInstances, allocSize, handle, vmId, pairHandle);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ void MemoryInfo::printRegionSizes() {
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t MemoryInfo::createGemExtWithSingleRegion(uint32_t memoryBanks, size_t allocSize, uint32_t &handle, int32_t pairHandle) {
|
||||
int MemoryInfo::createGemExtWithSingleRegion(uint32_t memoryBanks, size_t allocSize, uint32_t &handle, int32_t pairHandle) {
|
||||
auto pHwInfo = this->drm.getRootDeviceEnvironment().getHardwareInfo();
|
||||
auto regionClassAndInstance = getMemoryRegionClassAndInstance(memoryBanks, *pHwInfo);
|
||||
MemRegionsVec region = {regionClassAndInstance};
|
||||
|
@ -127,7 +127,7 @@ uint32_t MemoryInfo::createGemExtWithSingleRegion(uint32_t memoryBanks, size_t a
|
|||
return ret;
|
||||
}
|
||||
|
||||
uint32_t MemoryInfo::createGemExtWithMultipleRegions(uint32_t memoryBanks, size_t allocSize, uint32_t &handle) {
|
||||
int MemoryInfo::createGemExtWithMultipleRegions(uint32_t memoryBanks, size_t allocSize, uint32_t &handle) {
|
||||
auto pHwInfo = this->drm.getRootDeviceEnvironment().getHardwareInfo();
|
||||
auto banks = std::bitset<4>(memoryBanks);
|
||||
MemRegionsVec memRegions{};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -26,7 +26,7 @@ class MemoryInfo {
|
|||
|
||||
void assignRegionsFromDistances(const std::vector<DistanceInfo> &distances);
|
||||
|
||||
MOCKABLE_VIRTUAL uint32_t createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle);
|
||||
MOCKABLE_VIRTUAL int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle);
|
||||
|
||||
MemoryClassInstance getMemoryRegionClassAndInstance(uint32_t memoryBank, const HardwareInfo &hwInfo);
|
||||
|
||||
|
@ -36,8 +36,8 @@ class MemoryInfo {
|
|||
|
||||
uint32_t getTileIndex(uint32_t memoryBank);
|
||||
|
||||
MOCKABLE_VIRTUAL uint32_t createGemExtWithSingleRegion(uint32_t memoryBanks, size_t allocSize, uint32_t &handle, int32_t pairHandle);
|
||||
MOCKABLE_VIRTUAL uint32_t createGemExtWithMultipleRegions(uint32_t memoryBanks, size_t allocSize, uint32_t &handle);
|
||||
MOCKABLE_VIRTUAL int createGemExtWithSingleRegion(uint32_t memoryBanks, size_t allocSize, uint32_t &handle, int32_t pairHandle);
|
||||
MOCKABLE_VIRTUAL int createGemExtWithMultipleRegions(uint32_t memoryBanks, size_t allocSize, uint32_t &handle);
|
||||
|
||||
const RegionContainer &getDrmRegionInfos() const { return drmQueryRegions; }
|
||||
|
||||
|
|
|
@ -346,9 +346,8 @@ bool IoctlHelperXe::isVmBindAvailable() {
|
|||
return true;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) {
|
||||
int IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) {
|
||||
struct drm_xe_gem_create create = {};
|
||||
int ret;
|
||||
uint32_t regionsSize = static_cast<uint32_t>(memClassInstances.size());
|
||||
|
||||
if (!regionsSize) {
|
||||
|
@ -374,7 +373,7 @@ uint32_t IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, siz
|
|||
UNRECOVERABLE_IF(true);
|
||||
break;
|
||||
}
|
||||
ret = IoctlHelper::ioctl(DrmIoctl::GemCreate, &create);
|
||||
auto ret = IoctlHelper::ioctl(DrmIoctl::GemCreate, &create);
|
||||
handle = create.handle;
|
||||
|
||||
xeLog(" -> IoctlHelperXe::%s [%d,%d] vmid=0x%x s=0x%lx f=0x%x h=0x%x r=%d\n", __FUNCTION__,
|
||||
|
@ -387,7 +386,7 @@ uint32_t IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, siz
|
|||
bindInfo.push_back(b);
|
||||
}
|
||||
|
||||
return static_cast<uint32_t>(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
CacheRegion IoctlHelperXe::closAlloc() {
|
||||
|
@ -550,7 +549,7 @@ uint64_t IoctlHelperXe::getFlagsForVmBind(bool bindCapture, bool bindImmediate,
|
|||
return ret;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperXe::queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) {
|
||||
int IoctlHelperXe::queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) {
|
||||
xeLog(" -> IoctlHelperXe::%s\n", __FUNCTION__);
|
||||
if (distanceInfos.size() == 0) {
|
||||
DistanceInfo d;
|
||||
|
@ -842,8 +841,8 @@ uint64_t IoctlHelperXe::xeDecanonize(uint64_t address) {
|
|||
return (address & maxNBitValue(addressWidth));
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
||||
uint32_t ret = static_cast<uint32_t>(-1);
|
||||
int IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
||||
int ret = -1;
|
||||
xeLog(" => IoctlHelperXe::%s 0x%x\n", __FUNCTION__, request);
|
||||
switch (request) {
|
||||
case DrmIoctl::Getparam: {
|
||||
|
@ -869,7 +868,7 @@ uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
*d->value = static_cast<int>(xeTimestampFrequency);
|
||||
break;
|
||||
default:
|
||||
ret = static_cast<uint32_t>(-1);
|
||||
ret = -1;
|
||||
}
|
||||
xeLog(" -> IoctlHelperXe::ioctl Getparam 0x%x/0x%x r=%d\n", d->param, *d->value, ret);
|
||||
} break;
|
||||
|
@ -896,7 +895,7 @@ uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
bindInfo.push_back(b);
|
||||
}
|
||||
ret = 0;
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemUserptrGemUserptr p=0x%llx s=0x%llx f=0x%x h=0x%x r=0x%x\n", d->userPtr,
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemUserptrGemUserptr p=0x%llx s=0x%llx f=0x%x h=0x%x r=%d\n", d->userPtr,
|
||||
d->userSize, d->flags, d->handle, ret);
|
||||
xeShowBindTable();
|
||||
} break;
|
||||
|
@ -911,7 +910,7 @@ uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
ret = IoctlHelper::ioctl(request, &destroy);
|
||||
else
|
||||
ret = 0;
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemContextDestroryExt ctx=0x%x r=0x%x\n",
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemContextDestroryExt ctx=0x%x r=%d\n",
|
||||
d->contextId, ret);
|
||||
} break;
|
||||
case DrmIoctl::GemContextGetparam: {
|
||||
|
@ -929,10 +928,10 @@ uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
d->value = 0x1;
|
||||
break;
|
||||
default:
|
||||
ret = static_cast<uint32_t>(-1);
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemContextGetparam r=0x%x\n", ret);
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemContextGetparam r=%d\n", ret);
|
||||
} break;
|
||||
case DrmIoctl::GemContextSetparam: {
|
||||
GemContextParam *d = static_cast<GemContextParam *>(arg);
|
||||
|
@ -962,10 +961,10 @@ uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
ret = 0;
|
||||
break;
|
||||
default:
|
||||
ret = static_cast<uint32_t>(-1);
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemContextSetparam r=0x%x\n", ret);
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemContextSetparam r=%d\n", ret);
|
||||
} break;
|
||||
case DrmIoctl::GemClose: {
|
||||
struct GemClose *d = static_cast<struct GemClose *>(arg);
|
||||
|
@ -996,7 +995,7 @@ uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
} else {
|
||||
ret = 0; // let it pass trough for now
|
||||
}
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemClose found=%d h=0x%x r=0x%x\n", found, d->handle, ret);
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemClose found=%d h=0x%x r=%d\n", found, d->handle, ret);
|
||||
} break;
|
||||
case DrmIoctl::RegRead: {
|
||||
struct drm_xe_mmio mmio = {};
|
||||
|
@ -1008,7 +1007,7 @@ uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
mmio.flags = DRM_XE_MMIO_READ | DRM_XE_MMIO_64BIT;
|
||||
ret = IoctlHelper::ioctl(request, &mmio);
|
||||
reg->value = mmio.value;
|
||||
xeLog(" -> IoctlHelperXe::ioctl RegRead 0x%lx/0x%lx r=0x%x\n",
|
||||
xeLog(" -> IoctlHelperXe::ioctl RegRead 0x%lx/0x%lx r=%d\n",
|
||||
reg->offset, reg->value, ret);
|
||||
} break;
|
||||
case DrmIoctl::GemVmCreate: {
|
||||
|
@ -1020,7 +1019,7 @@ uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
d->vmId = ret ? 0 : args.vm_id;
|
||||
xeVmId = d->vmId;
|
||||
printf("VM: 0x%llx\n", args.reserved[0]); // Don't remove for now
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemVmCreate vmid=0x%x r=0x%x\n", d->vmId, ret);
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemVmCreate vmid=0x%x r=%d\n", d->vmId, ret);
|
||||
|
||||
} break;
|
||||
case DrmIoctl::GemVmDestroy: {
|
||||
|
@ -1028,7 +1027,7 @@ uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
struct drm_xe_vm_destroy args = {};
|
||||
args.vm_id = d->vmId;
|
||||
ret = IoctlHelper::ioctl(request, &args);
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemVmDestroy vmid=0x%x r=0x%x\n", d->vmId, ret);
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemVmDestroy vmid=0x%x r=%d\n", d->vmId, ret);
|
||||
|
||||
} break;
|
||||
|
||||
|
@ -1038,25 +1037,25 @@ uint32_t IoctlHelperXe::ioctl(DrmIoctl request, void *arg) {
|
|||
mmo.handle = d->handle;
|
||||
ret = IoctlHelper::ioctl(request, &mmo);
|
||||
d->offset = mmo.offset;
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemMmapOffset h=0x%x o=0x%x r=0x%x\n",
|
||||
xeLog(" -> IoctlHelperXe::ioctl GemMmapOffset h=0x%x o=0x%x r=%d\n",
|
||||
d->handle, d->offset, ret);
|
||||
} break;
|
||||
case DrmIoctl::GetResetStats: {
|
||||
ResetStats *d = static_cast<ResetStats *>(arg);
|
||||
// d->batchActive = 1; // fake gpu hang
|
||||
ret = 0;
|
||||
xeLog(" -> IoctlHelperXe::ioctl GetResetStats ctx=0x%x r=0x%x\n",
|
||||
xeLog(" -> IoctlHelperXe::ioctl GetResetStats ctx=0x%x r=%d\n",
|
||||
d->contextId, ret);
|
||||
} break;
|
||||
case DrmIoctl::PrimeFdToHandle: {
|
||||
PrimeHandle *prime = static_cast<PrimeHandle *>(arg);
|
||||
ret = IoctlHelper::ioctl(request, arg);
|
||||
xeLog(" ->PrimeFdToHandle h=0x%x f=0x%x d=0x%x r=0x%x\n",
|
||||
xeLog(" ->PrimeFdToHandle h=0x%x f=0x%x d=0x%x r=%d\n",
|
||||
prime->handle, prime->flags, prime->fileDescriptor, ret);
|
||||
} break;
|
||||
case DrmIoctl::PrimeHandleToFd: {
|
||||
PrimeHandle *prime = static_cast<PrimeHandle *>(arg);
|
||||
xeLog(" ->PrimeHandleToFd h=0x%x f=0x%x d=0x%x r=0x%x\n",
|
||||
xeLog(" ->PrimeHandleToFd h=0x%x f=0x%x d=0x%x r=%d\n",
|
||||
prime->handle, prime->flags, prime->fileDescriptor, ret);
|
||||
ret = IoctlHelper::ioctl(request, arg);
|
||||
} break;
|
||||
|
|
|
@ -38,12 +38,12 @@ class IoctlHelperXe : public IoctlHelper {
|
|||
|
||||
IoctlHelperXe(Drm &drmArg);
|
||||
~IoctlHelperXe() override;
|
||||
uint32_t ioctl(DrmIoctl request, void *arg) override;
|
||||
int ioctl(DrmIoctl request, void *arg) override;
|
||||
|
||||
bool initialize() override;
|
||||
bool isSetPairAvailable() override;
|
||||
bool isVmBindAvailable() override;
|
||||
uint32_t createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) override;
|
||||
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) override;
|
||||
CacheRegion closAlloc() override;
|
||||
uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override;
|
||||
CacheRegion closFree(CacheRegion closIndex) override;
|
||||
|
@ -56,7 +56,7 @@ class IoctlHelperXe : public IoctlHelper {
|
|||
uint32_t getDirectSubmissionFlag() override;
|
||||
std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) override;
|
||||
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override;
|
||||
uint32_t queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) override;
|
||||
int queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) override;
|
||||
uint16_t getWaitUserFenceSoftFlag() override;
|
||||
int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) override;
|
||||
bool completionFenceExtensionSupported(const bool isVmBindAvailable) override;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -70,28 +70,28 @@ struct MockedMemoryInfo : public NEO::MemoryInfo {
|
|||
size_t getMemoryRegionSize(uint32_t memoryBank) override {
|
||||
return 1024u;
|
||||
}
|
||||
uint32_t createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) override {
|
||||
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle) override {
|
||||
if (allocSize == 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
handle = 1u;
|
||||
return 0u;
|
||||
return 0;
|
||||
}
|
||||
uint32_t createGemExtWithSingleRegion(uint32_t memoryBanks, size_t allocSize, uint32_t &handle, int32_t pairHandle) override {
|
||||
int createGemExtWithSingleRegion(uint32_t memoryBanks, size_t allocSize, uint32_t &handle, int32_t pairHandle) override {
|
||||
if (allocSize == 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
handle = 1u;
|
||||
pairHandlePassed = pairHandle;
|
||||
return 0u;
|
||||
return 0;
|
||||
}
|
||||
uint32_t createGemExtWithMultipleRegions(uint32_t memoryBanks, size_t allocSize, uint32_t &handle) override {
|
||||
int createGemExtWithMultipleRegions(uint32_t memoryBanks, size_t allocSize, uint32_t &handle) override {
|
||||
if (allocSize == 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
handle = 1u;
|
||||
banks = memoryBanks;
|
||||
return 0u;
|
||||
return 0;
|
||||
}
|
||||
uint32_t banks = 0;
|
||||
int32_t pairHandlePassed = -1;
|
||||
|
|
|
@ -375,7 +375,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemWithExtensionsThenRetu
|
|||
|
||||
auto ret = memoryInfo->createGemExt(memClassInstance, 1024, handle, {}, -1);
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
ASSERT_TRUE(drm->context.receivedCreateGemExt);
|
||||
EXPECT_EQ(1024u, drm->context.receivedCreateGemExt->size);
|
||||
|
@ -399,7 +399,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingleRegionThe
|
|||
ASSERT_NE(nullptr, memoryInfo);
|
||||
auto ret = memoryInfo->createGemExtWithSingleRegion(1, 1024, handle, -1);
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
|
||||
const auto &createExt = drm->context.receivedCreateGemExt;
|
||||
|
@ -429,12 +429,12 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithPairHandleThenR
|
|||
auto memoryInfo = std::make_unique<MemoryInfo>(regionInfo, *drm);
|
||||
ASSERT_NE(nullptr, memoryInfo);
|
||||
auto ret = memoryInfo->createGemExtWithSingleRegion(1, 1024, pairHandle, -1);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
|
||||
uint32_t handle = 0;
|
||||
ret = memoryInfo->createGemExtWithSingleRegion(1, 1024, handle, pairHandle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(2u, drm->ioctlCallsCount);
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndPrivateBOSupportWhenCreatingGemExt
|
|||
uint32_t handle = 0;
|
||||
auto ret = memoryInfo->createGemExtWithSingleRegion(1, 1024, handle, -1);
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
|
||||
const auto &createExt = drm->context.receivedCreateGemExt;
|
||||
|
@ -489,7 +489,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndNoPrivateBOSupportWhenCreatingGemE
|
|||
uint32_t handle = 0;
|
||||
auto ret = memoryInfo->createGemExtWithSingleRegion(1, 1024, handle, -1);
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
|
||||
const auto &createExt = drm->context.receivedCreateGemExt;
|
||||
|
@ -518,7 +518,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsAndPrivateBOSupportedAndIsPerContextV
|
|||
uint32_t handle = 0;
|
||||
auto ret = memoryInfo->createGemExtWithSingleRegion(1, 1024, handle, -1);
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
|
||||
const auto &createExt = drm->context.receivedCreateGemExt;
|
||||
|
@ -551,7 +551,7 @@ TEST(MemoryInfo, givenMemoryInfoWithRegionsWhenCreatingGemExtWithMultipleRegions
|
|||
uint32_t memoryRegions = 0b1011;
|
||||
auto ret = memoryInfo->createGemExtWithMultipleRegions(memoryRegions, 1024, handle);
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
|
||||
const auto &createExt = drm->context.receivedCreateGemExt;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -237,7 +237,7 @@ HWTEST2_F(MemoryInfoTest, givenMemoryInfoWithRegionsWhenCreatingGemWithExtension
|
|||
MemRegionsVec memClassInstance = {regionInfo[0].region, regionInfo[1].region};
|
||||
auto ret = memoryInfo->createGemExt(memClassInstance, 1024, handle, {}, -1);
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
EXPECT_EQ(1024u, drm->createExt.size);
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ HWTEST2_F(MemoryInfoTest, givenMemoryInfoWithRegionsWhenCreatingGemExtWithSingle
|
|||
|
||||
auto ret = memoryInfo->createGemExtWithSingleRegion(1, 1024, handle, -1);
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
EXPECT_EQ(drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, drm->memRegions.memoryClass);
|
||||
EXPECT_EQ(1024u, drm->createExt.size);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -136,7 +136,7 @@ TEST_F(IoctlHelperPrelimFixture, givenPrelimsWhenCreateGemExtThenReturnSuccess)
|
|||
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, {}, -1);
|
||||
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ TEST_F(IoctlHelperPrelimFixture, givenPrelimsWhenCallIoctlThenProperIoctlRegiste
|
|||
GemContextCreateExt arg{};
|
||||
drm->ioctlCallsCount = 0;
|
||||
auto ret = drm->ioctlHelper->ioctl(DrmIoctl::GemContextCreateExt, &arg);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ TEST_F(IoctlHelperPrelimFixture, givenPrelimsWhenQueryDistancesThenCorrectDistan
|
|||
distances[2].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 2};
|
||||
std::vector<QueryItem> queryItems(distances.size());
|
||||
auto ret = ioctlHelper->queryDistances(queryItems, distances);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(0, distances[0].distance);
|
||||
EXPECT_EQ(0, distances[1].distance);
|
||||
EXPECT_EQ(100, distances[2].distance);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -28,7 +28,7 @@ DG1TEST_F(IoctlHelperTestsDg1, givenDg1WhenCreateGemExtThenReturnCorrectValue) {
|
|||
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
|
||||
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, {}, -1);
|
||||
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(1u, drm->numRegions);
|
||||
EXPECT_EQ(1024u, drm->createExt.size);
|
||||
|
@ -53,7 +53,7 @@ DG1TEST_F(IoctlHelperTestsDg1, givenDg1WithDrmTipWhenCreateGemExtWithDebugFlagTh
|
|||
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_MEMORY_REGIONS has returned: 0 BO-1 with size: 1024\n");
|
||||
EXPECT_EQ(expectedOutput, output);
|
||||
EXPECT_EQ(1u, drm->ioctlCallsCount);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
}
|
||||
|
||||
DG1TEST_F(IoctlHelperTestsDg1, givenDg1WhenCreateGemExtWithDebugFlagThenPrintDebugInfo) {
|
||||
|
@ -74,7 +74,7 @@ DG1TEST_F(IoctlHelperTestsDg1, givenDg1WhenCreateGemExtWithDebugFlagThenPrintDeb
|
|||
std::string expectedOutput("Performing GEM_CREATE_EXT with { size: 1024, memory class: 1, memory instance: 0 }\nGEM_CREATE_EXT with EXT_MEMORY_REGIONS has returned: -1 BO-0 with size: 1024\nGEM_CREATE_EXT with EXT_SETPARAM has returned: 0 BO-1 with size: 1024\n");
|
||||
EXPECT_EQ(expectedOutput, output);
|
||||
EXPECT_EQ(2u, drm->ioctlCallsCount);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
}
|
||||
|
||||
DG1TEST_F(IoctlHelperTestsDg1, givenDg1AndMemoryRegionQuerySupportedWhenQueryingMemoryInfoThenMemoryInfoIsCreatedWithRegions) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -206,7 +206,7 @@ TEST(IoctlHelperTestsUpstream, givenUpstreamWhenCreateGemExtThenReturnCorrectVal
|
|||
MemRegionsVec memClassInstance = {{drm_i915_gem_memory_class::I915_MEMORY_CLASS_DEVICE, 0}};
|
||||
auto ret = ioctlHelper->createGemExt(memClassInstance, 1024, handle, {}, -1);
|
||||
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, handle);
|
||||
EXPECT_EQ(1u, drm->numRegions);
|
||||
EXPECT_EQ(1024u, drm->createExt.size);
|
||||
|
@ -307,7 +307,7 @@ TEST(IoctlHelperTestsUpstream, givenUpstreamWhenQueryDistancesThenReturnEinval)
|
|||
std::vector<DistanceInfo> distanceInfos;
|
||||
std::vector<QueryItem> queries(4);
|
||||
auto ret = drm->getIoctlHelper()->queryDistances(queries, distanceInfos);
|
||||
EXPECT_EQ(0u, ret);
|
||||
EXPECT_EQ(0, ret);
|
||||
const bool queryUnsupported = std::all_of(queries.begin(), queries.end(),
|
||||
[](const QueryItem &item) { return item.length == -EINVAL; });
|
||||
EXPECT_TRUE(queryUnsupported);
|
||||
|
@ -434,13 +434,13 @@ TEST(IoctlHelperTestsUpstream, whenRegisterUuidIsCalledThenReturnNullHandle) {
|
|||
|
||||
{
|
||||
const auto [retVal, handle] = ioctlHelper.registerUuid("", 0, 0, 0);
|
||||
EXPECT_EQ(0u, retVal);
|
||||
EXPECT_EQ(0, retVal);
|
||||
EXPECT_EQ(0u, handle);
|
||||
}
|
||||
|
||||
{
|
||||
const auto [retVal, handle] = ioctlHelper.registerStringClassUuid("", 0, 0);
|
||||
EXPECT_EQ(0u, retVal);
|
||||
EXPECT_EQ(0, retVal);
|
||||
EXPECT_EQ(0u, handle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
|
|||
|
||||
MemRegionsVec memRegions{};
|
||||
uint32_t handle = 0u;
|
||||
EXPECT_NE(0u, xeIoctlHelper->createGemExt(memRegions, 0u, handle, {}, -1));
|
||||
EXPECT_NE(0, xeIoctlHelper->createGemExt(memRegions, 0u, handle, {}, -1));
|
||||
|
||||
EXPECT_TRUE(xeIoctlHelper->isVmBindAvailable());
|
||||
|
||||
|
@ -88,7 +88,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
|
|||
|
||||
std::vector<QueryItem> queryItems;
|
||||
std::vector<DistanceInfo> distanceInfos;
|
||||
EXPECT_EQ(0u, xeIoctlHelper->queryDistances(queryItems, distanceInfos));
|
||||
EXPECT_EQ(0, xeIoctlHelper->queryDistances(queryItems, distanceInfos));
|
||||
EXPECT_EQ(0u, distanceInfos.size());
|
||||
|
||||
EXPECT_EQ(PRELIM_I915_UFENCE_WAIT_SOFT, xeIoctlHelper->getWaitUserFenceSoftFlag());
|
||||
|
@ -132,11 +132,11 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingAnyMethodThenDummyValueIsRe
|
|||
|
||||
std::string uuid{};
|
||||
auto registerUuidResult = xeIoctlHelper->registerUuid(uuid, 0, 0, 0);
|
||||
EXPECT_EQ(0u, registerUuidResult.retVal);
|
||||
EXPECT_EQ(0, registerUuidResult.retVal);
|
||||
EXPECT_EQ(0u, registerUuidResult.handle);
|
||||
|
||||
auto registerStringClassUuidResult = xeIoctlHelper->registerStringClassUuid(uuid, 0, 0);
|
||||
EXPECT_EQ(0u, registerStringClassUuidResult.retVal);
|
||||
EXPECT_EQ(0, registerStringClassUuidResult.retVal);
|
||||
EXPECT_EQ(0u, registerStringClassUuidResult.handle);
|
||||
|
||||
EXPECT_EQ(0, xeIoctlHelper->unregisterUuid(0));
|
||||
|
@ -388,7 +388,7 @@ TEST(IoctlHelperXeTest, verifyPublicFunctions) {
|
|||
query.itemsPtr = reinterpret_cast<uint64_t>(&queryItem);
|
||||
query.numItems = 1;
|
||||
|
||||
EXPECT_EQ(static_cast<uint32_t>(-1), mockXeIoctlHelper->ioctl(DrmIoctl::Query, &query));
|
||||
EXPECT_EQ(-1, mockXeIoctlHelper->ioctl(DrmIoctl::Query, &query));
|
||||
queryItem.queryId = xeIoctlHelper->getDrmParamValue(DrmParam::QueryHwconfigTable);
|
||||
mockXeIoctlHelper->ioctl(DrmIoctl::Query, &query);
|
||||
EXPECT_EQ(0, queryItem.length);
|
||||
|
|
Loading…
Reference in New Issue