mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 17:41:26 +08:00
Create wrapper for drm_i915_gem_exec_object2
Related-To: NEO-6852 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0b68fdbe52
commit
268393d776
@@ -107,6 +107,8 @@ else()
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_allocation.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_command_stream_receiver.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_memory_manager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_wrappers.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_drm_wrappers.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/linux/mock_os_context_linux.h
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -27,7 +27,7 @@ class MockBufferObject : public BufferObject {
|
||||
MockBufferObject(Drm *drm) : BufferObject(drm, CommonConstants::unsupportedPatIndex, 0, 0, 1) {
|
||||
}
|
||||
int exec(uint32_t used, size_t startOffset, unsigned int flags, bool requiresCoherency, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId,
|
||||
BufferObject *const residency[], size_t residencyCount, drm_i915_gem_exec_object2 *execObjectsStorage, uint64_t completionGpuAddress, uint32_t completionValue) override {
|
||||
BufferObject *const residency[], size_t residencyCount, ExecObject *execObjectsStorage, uint64_t completionGpuAddress, uint32_t completionValue) override {
|
||||
passedExecParams.push_back({completionGpuAddress, completionValue});
|
||||
return BufferObject::exec(used, startOffset, flags, requiresCoherency, osContext, vmHandleId, drmContextId,
|
||||
residency, residencyCount, execObjectsStorage, completionGpuAddress, completionValue);
|
||||
|
||||
@@ -35,6 +35,7 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
|
||||
using DrmCommandStreamReceiver<GfxFamily>::residency;
|
||||
using DrmCommandStreamReceiver<GfxFamily>::useContextForUserFenceWait;
|
||||
using DrmCommandStreamReceiver<GfxFamily>::useUserFenceWait;
|
||||
using DrmCommandStreamReceiver<GfxFamily>::execObjectsStorage;
|
||||
using CommandStreamReceiverHw<GfxFamily>::directSubmission;
|
||||
using CommandStreamReceiverHw<GfxFamily>::blitterDirectSubmission;
|
||||
using CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiver::lastSentSliceCount;
|
||||
@@ -75,10 +76,6 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
|
||||
this->submissionAggregator.reset(newSubmissionsAggregator);
|
||||
}
|
||||
|
||||
std::vector<drm_i915_gem_exec_object2> &getExecStorage() {
|
||||
return this->execObjectsStorage;
|
||||
}
|
||||
|
||||
bool createPreemptionAllocation() override {
|
||||
if (ultHwConfig.csrBaseCallCreatePreemption) {
|
||||
return CommandStreamReceiver::createPreemptionAllocation();
|
||||
|
||||
34
shared/test/common/mocks/linux/mock_drm_wrappers.cpp
Normal file
34
shared/test/common/mocks/linux/mock_drm_wrappers.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/mocks/linux/mock_drm_wrappers.h"
|
||||
|
||||
#include "drm/i915_drm.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
uint32_t MockExecObject::getHandle() const {
|
||||
auto drmExecObject = reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
|
||||
return drmExecObject->handle;
|
||||
}
|
||||
uint64_t MockExecObject::getOffset() const {
|
||||
auto drmExecObject = reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
|
||||
return drmExecObject->offset;
|
||||
}
|
||||
bool MockExecObject::has48BAddressSupportFlag() const {
|
||||
auto drmExecObject = reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
|
||||
return drmExecObject->flags & EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
|
||||
}
|
||||
bool MockExecObject::hasCaptureFlag() const {
|
||||
auto drmExecObject = reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
|
||||
return drmExecObject->flags & EXEC_OBJECT_CAPTURE;
|
||||
}
|
||||
bool MockExecObject::hasAsyncFlag() const {
|
||||
auto drmExecObject = reinterpret_cast<const drm_i915_gem_exec_object2 *>(this->data);
|
||||
return drmExecObject->flags & EXEC_OBJECT_ASYNC;
|
||||
}
|
||||
} // namespace NEO
|
||||
22
shared/test/common/mocks/linux/mock_drm_wrappers.h
Normal file
22
shared/test/common/mocks/linux/mock_drm_wrappers.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct MockExecObject : ExecObject {
|
||||
uint32_t getHandle() const;
|
||||
uint64_t getOffset() const;
|
||||
bool has48BAddressSupportFlag() const;
|
||||
bool hasCaptureFlag() const;
|
||||
bool hasAsyncFlag() const;
|
||||
};
|
||||
|
||||
static_assert(sizeof(MockExecObject) == sizeof(ExecObject));
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user