mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Change residency vector to set
Related-To: NEO-4302 Change-Id: I318e28ed6d84fa781f9369a870f3e9e10a897db9 Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
7c8193179a
commit
29c3c7180b
@ -6,12 +6,18 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
|
||||
#include "drm/i915_drm.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <stdint.h>
|
||||
|
||||
struct drm_i915_gem_exec_object2;
|
||||
struct drm_i915_gem_relocation_entry;
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@ -29,7 +35,8 @@ class BufferObject {
|
||||
|
||||
MOCKABLE_VIRTUAL int pin(BufferObject *const boToPin[], size_t numberOfBos, uint32_t drmContextId);
|
||||
|
||||
int exec(uint32_t used, size_t startOffset, unsigned int flags, bool requiresCoherency, uint32_t drmContextId, BufferObject *const residency[], size_t residencyCount, drm_i915_gem_exec_object2 *execObjectsStorage);
|
||||
template <typename Iterator>
|
||||
int exec(uint32_t used, size_t startOffset, unsigned int flags, bool requiresCoherency, uint32_t drmContextId, Iterator begin, size_t residencyCount, drm_i915_gem_exec_object2 *execObjectsStorage);
|
||||
|
||||
int wait(int64_t timeoutNs);
|
||||
bool close();
|
||||
@ -47,7 +54,6 @@ class BufferObject {
|
||||
void setLockedAddress(void *cpuAddress) { this->lockedAddress = cpuAddress; }
|
||||
void setUnmapSize(uint64_t unmapSize) { this->unmapSize = unmapSize; }
|
||||
uint64_t peekUnmapSize() const { return unmapSize; }
|
||||
bool peekIsReusableAllocation() const { return this->isReused; }
|
||||
|
||||
protected:
|
||||
Drm *drm = nullptr;
|
||||
@ -69,4 +75,29 @@ class BufferObject {
|
||||
|
||||
uint64_t unmapSize = 0;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
inline int BufferObject::exec(uint32_t used, size_t startOffset, unsigned int flags, bool requiresCoherency, uint32_t drmContextId, Iterator begin, size_t residencyCount, drm_i915_gem_exec_object2 *execObjectsStorage) {
|
||||
for (size_t i = 0; i < residencyCount; ++i) {
|
||||
(*begin++)->fillExecObject(execObjectsStorage[i], drmContextId);
|
||||
}
|
||||
this->fillExecObject(execObjectsStorage[residencyCount], drmContextId);
|
||||
|
||||
drm_i915_gem_execbuffer2 execbuf{};
|
||||
execbuf.buffers_ptr = reinterpret_cast<uintptr_t>(execObjectsStorage);
|
||||
execbuf.buffer_count = static_cast<uint32_t>(residencyCount + 1u);
|
||||
execbuf.batch_start_offset = static_cast<uint32_t>(startOffset);
|
||||
execbuf.batch_len = alignUp(used, 8);
|
||||
execbuf.flags = flags;
|
||||
execbuf.rsvd1 = drmContextId;
|
||||
|
||||
int ret = this->drm->ioctl(DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
|
||||
if (ret == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int err = this->drm->getErrno();
|
||||
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "ioctl(I915_GEM_EXECBUFFER2) failed with %d. errno=%d(%s)\n", ret, err, strerror(err));
|
||||
return err;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user