Skip to content

Commit 76501a2

Browse files
Adjust early BO pin to new residency model
Resolves: NEO-5112 Change-Id: Ia65b1d75f957669999f7de423716a1e3cffc4032 Signed-off-by: Lukasz Jobczyk <[email protected]>
1 parent 9c84458 commit 76501a2

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

shared/source/os_interface/linux/drm_buffer_object.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,20 @@ void BufferObject::printExecutionBuffer(drm_i915_gem_execbuffer2 &execbuf, const
196196
}
197197

198198
int BufferObject::pin(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId) {
199-
StackVec<drm_i915_gem_exec_object2, maxFragmentsCount + 1> execObject(numberOfBos + 1);
200-
return this->exec(4u, 0u, 0u, false, osContext, vmHandleId, drmContextId, boToPin, numberOfBos, &execObject[0]);
199+
auto retVal = 0;
200+
if (this->drm->isBindAvailable()) {
201+
for (auto drmIterator = 0u; drmIterator < osContext->getDeviceBitfield().size(); drmIterator++) {
202+
if (osContext->getDeviceBitfield().test(drmIterator)) {
203+
for (size_t i = 0; i < numberOfBos; i++) {
204+
boToPin[i]->bind(osContext, drmIterator);
205+
}
206+
}
207+
}
208+
} else {
209+
StackVec<drm_i915_gem_exec_object2, maxFragmentsCount + 1> execObject(numberOfBos + 1);
210+
retVal = this->exec(4u, 0u, 0u, false, osContext, vmHandleId, drmContextId, boToPin, numberOfBos, &execObject[0]);
211+
}
212+
return retVal;
201213
}
202214

203215
void BufferObject::addBindExtHandle(uint32_t handle) {

shared/source/os_interface/linux/drm_neo.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ class Drm {
143143
static Drm *create(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment);
144144
static void overrideBindSupport(bool &useVmBind);
145145

146+
bool isBindAvailable() {
147+
return this->bindAvailable;
148+
}
149+
void setBindAvailable() {
150+
this->bindAvailable = true;
151+
}
152+
146153
protected:
147154
int getQueueSliceCount(drm_i915_gem_context_param_sseu *sseu);
148155
std::string generateUUID();
@@ -151,6 +158,7 @@ class Drm {
151158
bool preemptionSupported = false;
152159
bool nonPersistentContextsSupported = false;
153160
bool requirePerContextVM = false;
161+
bool bindAvailable = false;
154162
std::unique_ptr<HwDeviceId> hwDeviceId;
155163
int deviceId = 0;
156164
int revisionId = 0;

0 commit comments

Comments
 (0)