Create wrappers for drm getparam, query, gem close, prime handle, version
Related-To: NEO-6852 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
07efa4a3a9
commit
05cb48976f
|
@ -469,7 +469,7 @@ TEST_F(DrmTests, GivenErrorCodeWhenCreatingDrmThenDrmCreatedOnlyWithSpecificErro
|
|||
auto drm = DrmWrap::createDrm(*rootDeviceEnvironment);
|
||||
EXPECT_NE(drm, nullptr);
|
||||
|
||||
drm_i915_getparam_t getParam;
|
||||
GetParam getParam{};
|
||||
int lDeviceId;
|
||||
|
||||
VariableBackup<decltype(ioctlCnt)> backupIoctlCnt(&ioctlCnt);
|
||||
|
|
|
@ -132,7 +132,7 @@ struct dirent *readdir(DIR *dir) {
|
|||
return &entries[entryIndex++];
|
||||
}
|
||||
|
||||
int drmGetParam(drm_i915_getparam_t *param) {
|
||||
int drmGetParam(NEO::GetParam *param) {
|
||||
assert(param);
|
||||
int ret = 0;
|
||||
|
||||
|
@ -245,14 +245,14 @@ int drmVirtualMemoryDestroy(NEO::GemVmControl *control) {
|
|||
return (control->vmId > 0) ? 0 : -1;
|
||||
}
|
||||
|
||||
int drmVersion(drm_version_t *version) {
|
||||
memcpy_s(version->name, version->name_len, providedDrmVersion, strlen(providedDrmVersion) + 1);
|
||||
int drmVersion(NEO::DrmVersion *version) {
|
||||
memcpy_s(version->name, version->nameLen, providedDrmVersion, strlen(providedDrmVersion) + 1);
|
||||
|
||||
return failOnDrmVersion;
|
||||
}
|
||||
|
||||
int drmQueryItem(drm_i915_query *query) {
|
||||
auto queryItemArg = reinterpret_cast<NEO::QueryItem *>(query->items_ptr);
|
||||
int drmQueryItem(NEO::Query *query) {
|
||||
auto queryItemArg = reinterpret_cast<NEO::QueryItem *>(query->itemsPtr);
|
||||
if (queryItemArg->length == 0) {
|
||||
if (queryItemArg->queryId == DRM_I915_QUERY_TOPOLOGY_INFO) {
|
||||
queryItemArg->length = sizeof(NEO::QueryTopologyInfo) + 1;
|
||||
|
@ -293,7 +293,7 @@ int ioctl(int fd, unsigned long int request, ...) throw() {
|
|||
if (res == 0) {
|
||||
switch (request) {
|
||||
case DRM_IOCTL_I915_GETPARAM:
|
||||
res = drmGetParam(va_arg(vl, drm_i915_getparam_t *));
|
||||
res = drmGetParam(va_arg(vl, NEO::GetParam *));
|
||||
break;
|
||||
case DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM:
|
||||
res = drmSetContextParam(va_arg(vl, NEO::GemContextParam *));
|
||||
|
@ -314,10 +314,10 @@ int ioctl(int fd, unsigned long int request, ...) throw() {
|
|||
res = drmVirtualMemoryDestroy(va_arg(vl, NEO::GemVmControl *));
|
||||
break;
|
||||
case DRM_IOCTL_VERSION:
|
||||
res = drmVersion(va_arg(vl, drm_version_t *));
|
||||
res = drmVersion(va_arg(vl, NEO::DrmVersion *));
|
||||
break;
|
||||
case DRM_IOCTL_I915_QUERY:
|
||||
res = drmQueryItem(va_arg(vl, drm_i915_query *));
|
||||
res = drmQueryItem(va_arg(vl, NEO::Query *));
|
||||
break;
|
||||
default:
|
||||
res = drmOtherRequests(request, vl);
|
||||
|
|
|
@ -29,7 +29,7 @@ TEST(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSharedAllocationIsCreatedFro
|
|||
|
||||
int ioctl(unsigned long request, void *arg) override {
|
||||
if (request == DRM_IOCTL_PRIME_FD_TO_HANDLE) {
|
||||
auto *primeToHandleParams = (drm_prime_handle *)arg;
|
||||
auto *primeToHandleParams = static_cast<PrimeHandle *>(arg);
|
||||
primeToHandleParams->handle = 10;
|
||||
}
|
||||
return 0;
|
||||
|
@ -88,7 +88,7 @@ TEST(DrmMemoryManagerTest, givenMultipleThreadsWhenSharedAllocationIsCreatedThen
|
|||
|
||||
int ioctl(unsigned long request, void *arg) override {
|
||||
if (request == DRM_IOCTL_PRIME_FD_TO_HANDLE) {
|
||||
auto *primeToHandleParams = (drm_prime_handle *)arg;
|
||||
auto *primeToHandleParams = static_cast<PrimeHandle *>(arg);
|
||||
primeToHandleParams->handle = primeFdHandle;
|
||||
|
||||
// PrimeFdHandle should not be lower than closeHandle
|
||||
|
|
|
@ -62,7 +62,7 @@ void BufferObject::setAddress(uint64_t address) {
|
|||
}
|
||||
|
||||
bool BufferObject::close() {
|
||||
drm_gem_close close = {};
|
||||
GemClose close{};
|
||||
close.handle = this->handle;
|
||||
|
||||
PRINT_DEBUG_STRING(DebugManager.flags.PrintBOCreateDestroyResult.get(), stdout, "Calling gem close on handle: BO-%d\n", this->handle);
|
||||
|
|
|
@ -678,8 +678,8 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromMultipleShared
|
|||
bool areBosSharedObjects = true;
|
||||
|
||||
for (auto handle : handles) {
|
||||
drm_prime_handle openFd = {0, 0, 0};
|
||||
openFd.fd = handle;
|
||||
PrimeHandle openFd = {0, 0, 0};
|
||||
openFd.fileDescriptor = handle;
|
||||
|
||||
auto ret = this->getDrm(properties.rootDeviceIndex).ioctl(DRM_IOCTL_PRIME_FD_TO_HANDLE, &openFd);
|
||||
|
||||
|
@ -762,8 +762,8 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
|
|||
|
||||
std::unique_lock<std::mutex> lock(mtx);
|
||||
|
||||
drm_prime_handle openFd = {0, 0, 0};
|
||||
openFd.fd = handle;
|
||||
PrimeHandle openFd{};
|
||||
openFd.fileDescriptor = handle;
|
||||
|
||||
auto &drm = this->getDrm(properties.rootDeviceIndex);
|
||||
|
||||
|
@ -1134,14 +1134,14 @@ void DrmMemoryManager::unlockResourceImpl(GraphicsAllocation &graphicsAllocation
|
|||
}
|
||||
|
||||
int DrmMemoryManager::obtainFdFromHandle(int boHandle, uint32_t rootDeviceindex) {
|
||||
drm_prime_handle openFd = {0, 0, 0};
|
||||
PrimeHandle openFd{};
|
||||
|
||||
openFd.flags = DRM_CLOEXEC | DRM_RDWR;
|
||||
openFd.handle = boHandle;
|
||||
|
||||
getDrm(rootDeviceindex).ioctl(DRM_IOCTL_PRIME_HANDLE_TO_FD, &openFd);
|
||||
|
||||
return openFd.fd;
|
||||
return openFd.fileDescriptor;
|
||||
}
|
||||
|
||||
uint32_t DrmMemoryManager::getDefaultDrmContextId(uint32_t rootDeviceIndex) const {
|
||||
|
@ -1878,8 +1878,8 @@ GraphicsAllocation *DrmMemoryManager::createSharedUnifiedMemoryAllocation(const
|
|||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::createUSMHostAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool hasMappedPtr) {
|
||||
drm_prime_handle openFd = {0, 0, 0};
|
||||
openFd.fd = handle;
|
||||
PrimeHandle openFd{};
|
||||
openFd.fileDescriptor = handle;
|
||||
|
||||
auto &drm = this->getDrm(properties.rootDeviceIndex);
|
||||
auto patIndex = drm.getPatIndex(nullptr, properties.allocationType, CacheRegion::Default, CachePolicy::WriteBack, false);
|
||||
|
|
|
@ -268,7 +268,7 @@ int Drm::ioctl(unsigned long request, void *arg) {
|
|||
}
|
||||
|
||||
int Drm::getParamIoctl(int param, int *dstValue) {
|
||||
drm_i915_getparam_t getParam = {};
|
||||
GetParam getParam{};
|
||||
getParam.param = param;
|
||||
getParam.value = dstValue;
|
||||
|
||||
|
@ -659,10 +659,10 @@ std::vector<std::unique_ptr<HwDeviceId>> Drm::discoverDevices(ExecutionEnvironme
|
|||
}
|
||||
|
||||
std::string Drm::getDrmVersion(int fileDescriptor) {
|
||||
drm_version_t version = {};
|
||||
DrmVersion version = {};
|
||||
char name[5] = {};
|
||||
version.name = name;
|
||||
version.name_len = 5;
|
||||
version.nameLen = 5;
|
||||
|
||||
int ret = SysCalls::ioctl(fileDescriptor, DRM_IOCTL_VERSION, &version);
|
||||
if (ret) {
|
||||
|
@ -674,13 +674,13 @@ std::string Drm::getDrmVersion(int fileDescriptor) {
|
|||
}
|
||||
|
||||
std::vector<uint8_t> Drm::query(uint32_t queryId, uint32_t queryItemFlags) {
|
||||
drm_i915_query query{};
|
||||
Query query{};
|
||||
QueryItem queryItem{};
|
||||
queryItem.queryId = queryId;
|
||||
queryItem.length = 0; // query length first
|
||||
queryItem.flags = queryItemFlags;
|
||||
query.items_ptr = reinterpret_cast<__u64>(&queryItem);
|
||||
query.num_items = 1;
|
||||
query.itemsPtr = reinterpret_cast<uint64_t>(&queryItem);
|
||||
query.numItems = 1;
|
||||
|
||||
auto ret = this->ioctl(DRM_IOCTL_I915_QUERY, &query);
|
||||
if (ret != 0 || queryItem.length <= 0) {
|
||||
|
|
|
@ -141,4 +141,33 @@ static_assert(offsetof(ResetStats, batchActive) == offsetof(drm_i915_reset_stats
|
|||
static_assert(offsetof(ResetStats, batchPending) == offsetof(drm_i915_reset_stats, batch_pending));
|
||||
static_assert(offsetof(ResetStats, reserved) == offsetof(drm_i915_reset_stats, pad));
|
||||
|
||||
static_assert(sizeof(GetParam) == sizeof(struct drm_i915_getparam));
|
||||
static_assert(offsetof(GetParam, param) == offsetof(struct drm_i915_getparam, param));
|
||||
static_assert(offsetof(GetParam, value) == offsetof(struct drm_i915_getparam, value));
|
||||
|
||||
static_assert(sizeof(Query) == sizeof(struct drm_i915_query));
|
||||
static_assert(offsetof(Query, numItems) == offsetof(struct drm_i915_query, num_items));
|
||||
static_assert(offsetof(Query, flags) == offsetof(struct drm_i915_query, flags));
|
||||
static_assert(offsetof(Query, itemsPtr) == offsetof(struct drm_i915_query, items_ptr));
|
||||
|
||||
static_assert(sizeof(GemClose) == sizeof(drm_gem_close));
|
||||
static_assert(offsetof(GemClose, handle) == offsetof(drm_gem_close, handle));
|
||||
static_assert(offsetof(GemClose, reserved) == offsetof(drm_gem_close, pad));
|
||||
|
||||
static_assert(sizeof(PrimeHandle) == sizeof(drm_prime_handle));
|
||||
static_assert(offsetof(PrimeHandle, handle) == offsetof(drm_prime_handle, handle));
|
||||
static_assert(offsetof(PrimeHandle, flags) == offsetof(drm_prime_handle, flags));
|
||||
static_assert(offsetof(PrimeHandle, fileDescriptor) == offsetof(drm_prime_handle, fd));
|
||||
|
||||
static_assert(sizeof(DrmVersion) == sizeof(drm_version));
|
||||
static_assert(offsetof(DrmVersion, versionMajor) == offsetof(drm_version, version_major));
|
||||
static_assert(offsetof(DrmVersion, versionMinor) == offsetof(drm_version, version_minor));
|
||||
static_assert(offsetof(DrmVersion, versionPatch) == offsetof(drm_version, version_patchlevel));
|
||||
static_assert(offsetof(DrmVersion, nameLen) == offsetof(drm_version, name_len));
|
||||
static_assert(offsetof(DrmVersion, name) == offsetof(drm_version, name));
|
||||
static_assert(offsetof(DrmVersion, dateLen) == offsetof(drm_version, date_len));
|
||||
static_assert(offsetof(DrmVersion, date) == offsetof(drm_version, date));
|
||||
static_assert(offsetof(DrmVersion, descLen) == offsetof(drm_version, desc_len));
|
||||
static_assert(offsetof(DrmVersion, desc) == offsetof(drm_version, desc));
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
namespace NEO {
|
||||
|
||||
|
@ -162,4 +163,37 @@ struct ResetStats {
|
|||
uint32_t reserved;
|
||||
};
|
||||
|
||||
struct GetParam {
|
||||
int32_t param;
|
||||
int *value;
|
||||
};
|
||||
|
||||
struct Query {
|
||||
uint32_t numItems;
|
||||
uint32_t flags;
|
||||
uint64_t itemsPtr;
|
||||
};
|
||||
|
||||
struct GemClose {
|
||||
uint32_t handle;
|
||||
uint32_t reserved;
|
||||
};
|
||||
|
||||
struct PrimeHandle {
|
||||
uint32_t handle;
|
||||
uint32_t flags;
|
||||
int32_t fileDescriptor;
|
||||
};
|
||||
|
||||
struct DrmVersion {
|
||||
int versionMajor;
|
||||
int versionMinor;
|
||||
int versionPatch;
|
||||
size_t nameLen;
|
||||
char *name;
|
||||
size_t dateLen;
|
||||
char *date;
|
||||
size_t descLen;
|
||||
char *desc;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
|
|
@ -30,7 +30,7 @@ IoctlHelper *IoctlHelperPrelim20::clone() {
|
|||
|
||||
bool IoctlHelperPrelim20::isVmBindAvailable(Drm *drm) {
|
||||
int vmBindSupported = 0;
|
||||
drm_i915_getparam_t getParam = {};
|
||||
GetParam getParam{};
|
||||
getParam.param = PRELIM_I915_PARAM_HAS_VM_BIND;
|
||||
getParam.value = &vmBindSupported;
|
||||
int retVal = IoctlHelper::ioctl(drm, DRM_IOCTL_I915_GETPARAM, &getParam);
|
||||
|
@ -322,9 +322,9 @@ uint32_t IoctlHelperPrelim20::queryDistances(Drm *drm, std::vector<QueryItem> &q
|
|||
queryItems[i].dataPtr = reinterpret_cast<uint64_t>(&i915Distances[i]);
|
||||
}
|
||||
|
||||
drm_i915_query query{};
|
||||
query.items_ptr = reinterpret_cast<__u64>(queryItems.data());
|
||||
query.num_items = static_cast<uint32_t>(queryItems.size());
|
||||
Query query{};
|
||||
query.itemsPtr = reinterpret_cast<__u64>(queryItems.data());
|
||||
query.numItems = static_cast<uint32_t>(queryItems.size());
|
||||
auto ret = IoctlHelper::ioctl(drm, DRM_IOCTL_I915_QUERY, &query);
|
||||
for (auto i = 0u; i < i915Distances.size(); i++) {
|
||||
distanceInfos[i].distance = i915Distances[i].distance;
|
||||
|
|
|
@ -23,7 +23,7 @@ int DrmMock::ioctl(unsigned long request, void *arg) {
|
|||
|
||||
if ((request == DRM_IOCTL_I915_GETPARAM) && (arg != nullptr)) {
|
||||
ioctlCount.contextGetParam++;
|
||||
auto gp = static_cast<drm_i915_getparam_t *>(arg);
|
||||
auto gp = static_cast<GetParam *>(arg);
|
||||
if (gp->param == I915_PARAM_EU_TOTAL) {
|
||||
if (0 == this->storedRetValForEUVal) {
|
||||
*gp->value = this->storedEUVal;
|
||||
|
@ -189,16 +189,16 @@ int DrmMock::ioctl(unsigned long request, void *arg) {
|
|||
}
|
||||
if (request == DRM_IOCTL_PRIME_FD_TO_HANDLE) {
|
||||
ioctlCount.primeFdToHandle++;
|
||||
auto primeToHandleParams = static_cast<drm_prime_handle *>(arg);
|
||||
auto primeToHandleParams = static_cast<PrimeHandle *>(arg);
|
||||
//return BO
|
||||
primeToHandleParams->handle = outputHandle;
|
||||
inputFd = primeToHandleParams->fd;
|
||||
inputFd = primeToHandleParams->fileDescriptor;
|
||||
return fdToHandleRetVal;
|
||||
}
|
||||
if (request == DRM_IOCTL_PRIME_HANDLE_TO_FD) {
|
||||
ioctlCount.handleToPrimeFd++;
|
||||
auto primeToFdParams = static_cast<drm_prime_handle *>(arg);
|
||||
primeToFdParams->fd = outputFd;
|
||||
auto primeToFdParams = static_cast<PrimeHandle *>(arg);
|
||||
primeToFdParams->fileDescriptor = outputFd;
|
||||
return 0;
|
||||
}
|
||||
if (request == DRM_IOCTL_I915_GEM_GET_APERTURE) {
|
||||
|
@ -238,8 +238,8 @@ int DrmMock::ioctl(unsigned long request, void *arg) {
|
|||
|
||||
if (request == DRM_IOCTL_I915_QUERY && arg != nullptr) {
|
||||
ioctlCount.query++;
|
||||
auto queryArg = static_cast<drm_i915_query *>(arg);
|
||||
auto queryItemArg = reinterpret_cast<QueryItem *>(queryArg->items_ptr);
|
||||
auto queryArg = static_cast<Query *>(arg);
|
||||
auto queryItemArg = reinterpret_cast<QueryItem *>(queryArg->itemsPtr);
|
||||
storedQueryItem = *queryItemArg;
|
||||
|
||||
auto realEuCount = rootDeviceEnvironment.getHardwareInfo()->gtSystemInfo.EUCount;
|
||||
|
@ -283,12 +283,12 @@ int DrmMockEngine::handleRemainingRequests(unsigned long request, void *arg) {
|
|||
return EINVAL;
|
||||
}
|
||||
i915QuerySuccessCount--;
|
||||
auto query = static_cast<drm_i915_query *>(arg);
|
||||
if (query->items_ptr == 0) {
|
||||
auto query = static_cast<Query *>(arg);
|
||||
if (query->itemsPtr == 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
for (auto i = 0u; i < query->num_items; i++) {
|
||||
handleQueryItem(reinterpret_cast<QueryItem *>(query->items_ptr) + i);
|
||||
for (auto i = 0u; i < query->numItems; i++) {
|
||||
handleQueryItem(reinterpret_cast<QueryItem *>(query->itemsPtr) + i);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ constexpr std::array<uint64_t, 9> copyEnginesCapsMap = {{
|
|||
int DrmMockPrelimContext::handlePrelimRequest(unsigned long request, void *arg) {
|
||||
switch (request) {
|
||||
case DRM_IOCTL_I915_GETPARAM: {
|
||||
auto gp = static_cast<drm_i915_getparam_t *>(arg);
|
||||
auto gp = static_cast<GetParam *>(arg);
|
||||
if (gp->param == PRELIM_I915_PARAM_HAS_PAGE_FAULT) {
|
||||
*gp->value = hasPageFaultQueryValue;
|
||||
return hasPageFaultQueryReturn;
|
||||
|
|
|
@ -18,13 +18,13 @@ int DrmQueryMock::handleRemainingRequests(unsigned long request, void *arg) {
|
|||
}
|
||||
i915QuerySuccessCount--;
|
||||
|
||||
auto query = static_cast<drm_i915_query *>(arg);
|
||||
if (query->items_ptr == 0) {
|
||||
auto query = static_cast<Query *>(arg);
|
||||
if (query->itemsPtr == 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
for (auto i = 0u; i < query->num_items; ++i) {
|
||||
const auto queryItem = reinterpret_cast<QueryItem *>(query->items_ptr) + i;
|
||||
for (auto i = 0u; i < query->numItems; ++i) {
|
||||
const auto queryItem = reinterpret_cast<QueryItem *>(query->itemsPtr) + i;
|
||||
if (!this->handleQueryItem(queryItem)) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
|
|
@ -104,21 +104,21 @@ int DrmMockCustom::ioctl(unsigned long request, void *arg) {
|
|||
ioctl_cnt.gemGetTiling++;
|
||||
} break;
|
||||
case DRM_IOCTL_PRIME_FD_TO_HANDLE: {
|
||||
auto *primeToHandleParams = (drm_prime_handle *)arg;
|
||||
auto *primeToHandleParams = static_cast<NEO::PrimeHandle *>(arg);
|
||||
//return BO
|
||||
primeToHandleParams->handle = outputHandle;
|
||||
inputFd = primeToHandleParams->fd;
|
||||
inputFd = primeToHandleParams->fileDescriptor;
|
||||
ioctl_cnt.primeFdToHandle++;
|
||||
if (failOnPrimeFdToHandle == true) {
|
||||
return -1;
|
||||
}
|
||||
} break;
|
||||
case DRM_IOCTL_PRIME_HANDLE_TO_FD: {
|
||||
auto *handleToPrimeParams = (drm_prime_handle *)arg;
|
||||
auto *handleToPrimeParams = static_cast<NEO::PrimeHandle *>(arg);
|
||||
//return FD
|
||||
inputHandle = handleToPrimeParams->handle;
|
||||
inputFlags = handleToPrimeParams->flags;
|
||||
handleToPrimeParams->fd = outputFd;
|
||||
handleToPrimeParams->fileDescriptor = outputFd;
|
||||
ioctl_cnt.handleToPrimeFd++;
|
||||
} break;
|
||||
case DRM_IOCTL_I915_GEM_MMAP: {
|
||||
|
@ -155,7 +155,7 @@ int DrmMockCustom::ioctl(unsigned long request, void *arg) {
|
|||
|
||||
case DRM_IOCTL_I915_GETPARAM: {
|
||||
ioctl_cnt.contextGetParam++;
|
||||
auto getParam = (drm_i915_getparam_t *)arg;
|
||||
auto getParam = static_cast<NEO::GetParam *>(arg);
|
||||
recordedGetParam = *getParam;
|
||||
*getParam->value = getParamRetValue;
|
||||
} break;
|
||||
|
|
|
@ -168,48 +168,48 @@ class DrmMockCustom : public Drm {
|
|||
NEO::MockExecObject execBufferBufferObjects{};
|
||||
|
||||
//DRM_IOCTL_I915_GEM_CREATE
|
||||
__u64 createParamsSize = 0;
|
||||
__u32 createParamsHandle = 0;
|
||||
uint64_t createParamsSize = 0;
|
||||
uint32_t createParamsHandle = 0;
|
||||
//DRM_IOCTL_I915_GEM_SET_TILING
|
||||
__u32 setTilingMode = 0;
|
||||
__u32 setTilingHandle = 0;
|
||||
__u32 setTilingStride = 0;
|
||||
uint32_t setTilingMode = 0;
|
||||
uint32_t setTilingHandle = 0;
|
||||
uint32_t setTilingStride = 0;
|
||||
//DRM_IOCTL_I915_GEM_GET_TILING
|
||||
__u32 getTilingModeOut = I915_TILING_NONE;
|
||||
__u32 getTilingHandleIn = 0;
|
||||
uint32_t getTilingModeOut = I915_TILING_NONE;
|
||||
uint32_t getTilingHandleIn = 0;
|
||||
//DRM_IOCTL_PRIME_FD_TO_HANDLE
|
||||
__u32 outputHandle = 0;
|
||||
__s32 inputFd = 0;
|
||||
uint32_t outputHandle = 0;
|
||||
int32_t inputFd = 0;
|
||||
//DRM_IOCTL_PRIME_HANDLE_TO_FD
|
||||
__u32 inputHandle = 0;
|
||||
__s32 outputFd = 0;
|
||||
__s32 inputFlags = 0;
|
||||
uint32_t inputHandle = 0;
|
||||
int32_t outputFd = 0;
|
||||
int32_t inputFlags = 0;
|
||||
//DRM_IOCTL_I915_GEM_USERPTR
|
||||
__u32 returnHandle = 0;
|
||||
uint32_t returnHandle = 0;
|
||||
//DRM_IOCTL_I915_GEM_MMAP
|
||||
__u32 mmapHandle = 0;
|
||||
__u32 mmapPad = 0;
|
||||
__u64 mmapOffset = 0;
|
||||
__u64 mmapSize = 0;
|
||||
__u64 mmapAddrPtr = 0x7F4000001000;
|
||||
__u64 mmapFlags = 0;
|
||||
uint32_t mmapHandle = 0;
|
||||
uint32_t mmapPad = 0;
|
||||
uint64_t mmapOffset = 0;
|
||||
uint64_t mmapSize = 0;
|
||||
uint64_t mmapAddrPtr = 0x7F4000001000;
|
||||
uint64_t mmapFlags = 0;
|
||||
//DRM_IOCTL_I915_GEM_SET_DOMAIN
|
||||
__u32 setDomainHandle = 0;
|
||||
__u32 setDomainReadDomains = 0;
|
||||
__u32 setDomainWriteDomain = 0;
|
||||
uint32_t setDomainHandle = 0;
|
||||
uint32_t setDomainReadDomains = 0;
|
||||
uint32_t setDomainWriteDomain = 0;
|
||||
//DRM_IOCTL_I915_GETPARAM
|
||||
drm_i915_getparam_t recordedGetParam = {0};
|
||||
NEO::GetParam recordedGetParam = {0};
|
||||
int getParamRetValue = 0;
|
||||
//DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM
|
||||
NEO::GemContextParam recordedGetContextParam = {0};
|
||||
__u64 getContextParamRetValue = 0;
|
||||
uint64_t getContextParamRetValue = 0;
|
||||
//DRM_IOCTL_I915_GEM_WAIT
|
||||
int64_t gemWaitTimeout = 0;
|
||||
//DRM_IOCTL_I915_GEM_MMAP_OFFSET
|
||||
__u32 mmapOffsetHandle = 0;
|
||||
__u32 mmapOffsetPad = 0;
|
||||
__u64 mmapOffsetExpected = 0;
|
||||
__u64 mmapOffsetFlags = 0;
|
||||
uint32_t mmapOffsetHandle = 0;
|
||||
uint32_t mmapOffsetPad = 0;
|
||||
uint64_t mmapOffsetExpected = 0;
|
||||
uint64_t mmapOffsetFlags = 0;
|
||||
bool failOnMmapOffset = false;
|
||||
bool failOnPrimeFdToHandle = false;
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ int ioctl(int fileDescriptor, unsigned long int request, void *arg) {
|
|||
|
||||
if (fileDescriptor == fakeFileDescriptor) {
|
||||
if (request == DRM_IOCTL_VERSION) {
|
||||
auto pVersion = static_cast<drm_version_t *>(arg);
|
||||
memcpy_s(pVersion->name, pVersion->name_len, drmVersion, std::min(pVersion->name_len, strlen(drmVersion) + 1));
|
||||
auto pVersion = static_cast<DrmVersion *>(arg);
|
||||
memcpy_s(pVersion->name, pVersion->nameLen, drmVersion, std::min(pVersion->nameLen, strlen(drmVersion) + 1));
|
||||
}
|
||||
}
|
||||
if (request == DRM_IOCTL_I915_GEM_VM_CREATE) {
|
||||
|
|
|
@ -47,12 +47,12 @@ class DrmTipMock : public DrmMock {
|
|||
return EINVAL;
|
||||
}
|
||||
i915QuerySuccessCount--;
|
||||
auto query = static_cast<drm_i915_query *>(arg);
|
||||
if (query->items_ptr == 0) {
|
||||
auto query = static_cast<Query *>(arg);
|
||||
if (query->itemsPtr == 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
for (auto i = 0u; i < query->num_items; i++) {
|
||||
handleQueryItem(reinterpret_cast<QueryItem *>(query->items_ptr) + i);
|
||||
for (auto i = 0u; i < query->numItems; i++) {
|
||||
handleQueryItem(reinterpret_cast<QueryItem *>(query->itemsPtr) + i);
|
||||
}
|
||||
return 0;
|
||||
} else if (request == DRM_IOCTL_I915_GEM_MMAP_OFFSET) {
|
||||
|
|
|
@ -47,12 +47,12 @@ int handlePrelimRequests(unsigned long request, void *arg, int ioctlRetVal, int
|
|||
auto closReserveArg = static_cast<prelim_drm_i915_gem_clos_reserve *>(arg);
|
||||
closReserveArg->clos_index = 1u;
|
||||
} else if (request == DRM_IOCTL_I915_QUERY) {
|
||||
auto query = static_cast<drm_i915_query *>(arg);
|
||||
if (query->items_ptr == 0) {
|
||||
auto query = static_cast<Query *>(arg);
|
||||
if (query->itemsPtr == 0) {
|
||||
return EINVAL;
|
||||
}
|
||||
for (auto i = 0u; i < query->num_items; i++) {
|
||||
auto queryItemPtr = reinterpret_cast<QueryItem *>(query->items_ptr) + i;
|
||||
for (auto i = 0u; i < query->numItems; i++) {
|
||||
auto queryItemPtr = reinterpret_cast<QueryItem *>(query->itemsPtr) + i;
|
||||
if (queryItemPtr->queryId == PRELIM_DRM_I915_QUERY_DISTANCE_INFO) {
|
||||
if (queryDistanceIoctlRetVal != 0) {
|
||||
return queryDistanceIoctlRetVal;
|
||||
|
|
Loading…
Reference in New Issue