mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Split buffer object validation and early pinning
Change-Id: If1b136807dc8593179ce743c8e0187ee80c3e95f Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
@@ -205,18 +205,38 @@ void BufferObject::printExecutionBuffer(drm_i915_gem_execbuffer2 &execbuf, const
|
||||
std::cout << logger.str() << std::endl;
|
||||
}
|
||||
|
||||
int BufferObject::pin(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId, bool validateHostPtr) {
|
||||
int bindBOsWithinContext(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId) {
|
||||
auto retVal = 0;
|
||||
|
||||
if ((validateHostPtr && osContext->isDirectSubmissionActive()) ||
|
||||
(!validateHostPtr && this->drm->isBindAvailable())) {
|
||||
for (auto drmIterator = 0u; drmIterator < osContext->getDeviceBitfield().size(); drmIterator++) {
|
||||
if (osContext->getDeviceBitfield().test(drmIterator)) {
|
||||
for (size_t i = 0; i < numberOfBos; i++) {
|
||||
retVal |= boToPin[i]->bind(osContext, drmIterator);
|
||||
}
|
||||
for (auto drmIterator = 0u; drmIterator < osContext->getDeviceBitfield().size(); drmIterator++) {
|
||||
if (osContext->getDeviceBitfield().test(drmIterator)) {
|
||||
for (size_t i = 0; i < numberOfBos; i++) {
|
||||
retVal |= boToPin[i]->bind(osContext, drmIterator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int BufferObject::pin(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId) {
|
||||
auto retVal = 0;
|
||||
|
||||
if (this->drm->isBindAvailable()) {
|
||||
retVal = bindBOsWithinContext(boToPin, numberOfBos, osContext, vmHandleId);
|
||||
} else {
|
||||
StackVec<drm_i915_gem_exec_object2, maxFragmentsCount + 1> execObject(numberOfBos + 1);
|
||||
retVal = this->exec(4u, 0u, 0u, false, osContext, vmHandleId, drmContextId, boToPin, numberOfBos, &execObject[0]);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int BufferObject::validateHostPtr(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId) {
|
||||
auto retVal = 0;
|
||||
|
||||
if (osContext->isDirectSubmissionActive()) {
|
||||
retVal = bindBOsWithinContext(boToPin, numberOfBos, osContext, vmHandleId);
|
||||
} else {
|
||||
StackVec<drm_i915_gem_exec_object2, maxFragmentsCount + 1> execObject(numberOfBos + 1);
|
||||
retVal = this->exec(4u, 0u, 0u, false, osContext, vmHandleId, drmContextId, boToPin, numberOfBos, &execObject[0]);
|
||||
|
||||
Reference in New Issue
Block a user