@@ -1324,13 +1324,13 @@ uint64_t Drm::getPatIndex(Gmm *gmm, AllocationType allocationType, CacheRegion c
13241324 return patIndex;
13251325}
13261326
1327- int Drm:: changeBufferObjectBinding (OsContext *osContext, uint32_t vmHandleId, BufferObject *bo, bool bind) {
1328- auto vmId = this ->getVirtualMemoryAddressSpace (vmHandleId);
1329- auto ioctlHelper = this ->getIoctlHelper ();
1327+ int changeBufferObjectBinding (Drm *drm, OsContext *osContext, uint32_t vmHandleId, BufferObject *bo, bool bind) {
1328+ auto vmId = drm ->getVirtualMemoryAddressSpace (vmHandleId);
1329+ auto ioctlHelper = drm ->getIoctlHelper ();
13301330
13311331 uint64_t flags = 0u ;
13321332
1333- if (this ->isPerContextVMRequired ()) {
1333+ if (drm ->isPerContextVMRequired ()) {
13341334 auto osContextLinux = static_cast <const OsContextLinux *>(osContext);
13351335 UNRECOVERABLE_IF (osContextLinux->getDrmVmIds ().size () <= vmHandleId);
13361336 vmId = osContextLinux->getDrmVmIds ()[vmHandleId];
@@ -1345,7 +1345,7 @@ int Drm::changeBufferObjectBinding(OsContext *osContext, uint32_t vmHandleId, Bu
13451345 bool bindCapture = bo->isMarkedForCapture ();
13461346 bool bindImmediate = bo->isImmediateBindingRequired ();
13471347 bool bindMakeResident = false ;
1348- if (this ->useVMBindImmediate ()) {
1348+ if (drm ->useVMBindImmediate ()) {
13491349 bindMakeResident = bo->isExplicitResidencyRequired ();
13501350 bindImmediate = true ;
13511351 }
@@ -1377,7 +1377,7 @@ int Drm::changeBufferObjectBinding(OsContext *osContext, uint32_t vmHandleId, Bu
13771377
13781378 VmBindExtSetPatT vmBindExtSetPat{};
13791379
1380- if (this ->isVmBindPatIndexProgrammingSupported ()) {
1380+ if (drm ->isVmBindPatIndexProgrammingSupported ()) {
13811381 UNRECOVERABLE_IF (bo->peekPatIndex () == CommonConstants::unsupportedPatIndex);
13821382 ioctlHelper->fillVmBindExtSetPat (vmBindExtSetPat, bo->peekPatIndex (), castToUint64 (extensions.get ()));
13831383 vmBind.extensions = castToUint64 (vmBindExtSetPat);
@@ -1390,13 +1390,13 @@ int Drm::changeBufferObjectBinding(OsContext *osContext, uint32_t vmHandleId, Bu
13901390
13911391 VmBindExtUserFenceT vmBindExtUserFence{};
13921392
1393- if (this ->useVMBindImmediate ()) {
1394- lock = this ->lockBindFenceMutex ();
1393+ if (drm ->useVMBindImmediate ()) {
1394+ lock = drm ->lockBindFenceMutex ();
13951395
1396- if (!this ->hasPageFaultSupport () || bo->isExplicitResidencyRequired ()) {
1396+ if (!drm ->hasPageFaultSupport () || bo->isExplicitResidencyRequired ()) {
13971397 auto nextExtension = vmBind.extensions ;
1398- auto address = castToUint64 (this ->getFenceAddr (vmHandleId));
1399- auto value = this ->getNextFenceVal (vmHandleId);
1398+ auto address = castToUint64 (drm ->getFenceAddr (vmHandleId));
1399+ auto value = drm ->getNextFenceVal (vmHandleId);
14001400
14011401 ioctlHelper->fillVmBindExtUserFence (vmBindExtUserFence, address, value, nextExtension);
14021402 vmBind.extensions = castToUint64 (vmBindExtUserFence);
@@ -1409,7 +1409,7 @@ int Drm::changeBufferObjectBinding(OsContext *osContext, uint32_t vmHandleId, Bu
14091409 break ;
14101410 }
14111411
1412- this ->setNewResourceBoundToVM (vmHandleId);
1412+ drm ->setNewResourceBoundToVM (vmHandleId);
14131413 } else {
14141414 vmBind.handle = 0u ;
14151415 ret = ioctlHelper->vmUnbind (vmBind);
@@ -1424,18 +1424,16 @@ int Drm::changeBufferObjectBinding(OsContext *osContext, uint32_t vmHandleId, Bu
14241424}
14251425
14261426int Drm::bindBufferObject (OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) {
1427- auto ret = changeBufferObjectBinding (osContext, vmHandleId, bo, true );
1427+ auto ret = changeBufferObjectBinding (this , osContext, vmHandleId, bo, true );
14281428 if (ret != 0 ) {
1429- do {
1430- static_cast <DrmMemoryOperationsHandlerBind *>(this ->rootDeviceEnvironment .memoryOperationsInterface .get ())->evictUnusedAllocations (false , false );
1431- ret = changeBufferObjectBinding (osContext, vmHandleId, bo, true );
1432- } while (ret != 0 && getErrno () == ENXIO);
1429+ static_cast <DrmMemoryOperationsHandlerBind *>(this ->rootDeviceEnvironment .memoryOperationsInterface .get ())->evictUnusedAllocations (false , false );
1430+ ret = changeBufferObjectBinding (this , osContext, vmHandleId, bo, true );
14331431 }
14341432 return ret;
14351433}
14361434
14371435int Drm::unbindBufferObject (OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) {
1438- return changeBufferObjectBinding (osContext, vmHandleId, bo, false );
1436+ return changeBufferObjectBinding (this , osContext, vmHandleId, bo, false );
14391437}
14401438
14411439int Drm::createDrmVirtualMemory (uint32_t &drmVmId) {
0 commit comments