mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
fix: Fixed function for printing BO binding results to show correct vm id
Related-To: NEO-12952 Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e1b33a657c
commit
027e5597a3
@@ -243,22 +243,23 @@ MemoryOperationsStatus BufferObject::evictUnusedAllocations(bool waitForCompleti
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BufferObject::printBOBindingResult(OsContext *osContext, uint32_t vmHandleId, bool bind, int retVal) {
|
void BufferObject::printBOBindingResult(OsContext *osContext, uint32_t vmHandleId, bool bind, int retVal) {
|
||||||
|
auto vmId = static_cast<const OsContextLinux *>(osContext)->getDrmVmIds().size() > 0 ? static_cast<const OsContextLinux *>(osContext)->getDrmVmIds()[vmHandleId] : drm->getVirtualMemoryAddressSpace(vmHandleId);
|
||||||
if (retVal == 0) {
|
if (retVal == 0) {
|
||||||
if (bind) {
|
if (bind) {
|
||||||
PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stdout, "bind BO-%d to VM %u, drmVmId = %u, range: %llx - %llx, size: %lld, result: %d\n",
|
PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stdout, "bind BO-%d to VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d\n",
|
||||||
this->handle.getBoHandle(), vmHandleId, static_cast<const OsContextLinux *>(osContext)->getDrmVmIds().size() ? static_cast<const OsContextLinux *>(osContext)->getDrmVmIds()[vmHandleId] : 0, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal);
|
this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal);
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stdout, "unbind BO-%d from VM %u, drmVmId = %u, range: %llx - %llx, size: %lld, result: %d\n",
|
PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stdout, "unbind BO-%d from VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d\n",
|
||||||
this->handle.getBoHandle(), vmHandleId, static_cast<const OsContextLinux *>(osContext)->getDrmVmIds().size() ? static_cast<const OsContextLinux *>(osContext)->getDrmVmIds()[vmHandleId] : 0, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal);
|
this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto err = this->drm->getErrno();
|
auto err = this->drm->getErrno();
|
||||||
if (bind) {
|
if (bind) {
|
||||||
PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stderr, "bind BO-%d to VM %u, drmVmId = %u, range: %llx - %llx, size: %lld, result: %d, errno: %d(%s)\n",
|
PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stderr, "bind BO-%d to VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d, errno: %d(%s)\n",
|
||||||
this->handle.getBoHandle(), vmHandleId, static_cast<const OsContextLinux *>(osContext)->getDrmVmIds().size() ? static_cast<const OsContextLinux *>(osContext)->getDrmVmIds()[vmHandleId] : 0, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal, err, strerror(err));
|
this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal, err, strerror(err));
|
||||||
} else {
|
} else {
|
||||||
PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stderr, "unbind BO-%d from VM %u, drmVmId = %u, range: %llx - %llx, size: %lld, result: %d, errno: %d(%s)\n",
|
PRINT_DEBUG_STRING(debugManager.flags.PrintBOBindingResult.get(), stderr, "unbind BO-%d from VM %u, vmHandleId = %u, range: %llx - %llx, size: %lld, result: %d, errno: %d(%s)\n",
|
||||||
this->handle.getBoHandle(), vmHandleId, static_cast<const OsContextLinux *>(osContext)->getDrmVmIds().size() ? static_cast<const OsContextLinux *>(osContext)->getDrmVmIds()[vmHandleId] : 0, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal, err, strerror(err));
|
this->handle.getBoHandle(), vmId, vmHandleId, this->gpuAddress, ptrOffset(this->gpuAddress, this->size), this->size, retVal, err, strerror(err));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -534,7 +534,8 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindSucceedsThenPr
|
|||||||
|
|
||||||
std::string bindOutput = capture.getCapturedStdout();
|
std::string bindOutput = capture.getCapturedStdout();
|
||||||
std::stringstream expected;
|
std::stringstream expected;
|
||||||
expected << "bind BO-0 to VM 0, drmVmId = " << drm->latestCreatedVmId << ", range: 0 - 0, size: 0, result: 0\n";
|
expected << "bind BO-0 to VM " << drm->latestCreatedVmId << ", vmHandleId = 0"
|
||||||
|
<< ", range: 0 - 0, size: 0, result: 0\n";
|
||||||
EXPECT_STREQ(bindOutput.c_str(), expected.str().c_str()) << bindOutput;
|
EXPECT_STREQ(bindOutput.c_str(), expected.str().c_str()) << bindOutput;
|
||||||
expected.str("");
|
expected.str("");
|
||||||
|
|
||||||
@@ -544,7 +545,8 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindSucceedsThenPr
|
|||||||
EXPECT_FALSE(bo.bindInfo[contextId][0]);
|
EXPECT_FALSE(bo.bindInfo[contextId][0]);
|
||||||
|
|
||||||
std::string unbindOutput = capture.getCapturedStdout();
|
std::string unbindOutput = capture.getCapturedStdout();
|
||||||
expected << "unbind BO-0 from VM 0, drmVmId = " << drm->latestCreatedVmId << ", range: 0 - 0, size: 0, result: 0\n";
|
expected << "unbind BO-0 from VM " << drm->latestCreatedVmId << ", vmHandleId = 0"
|
||||||
|
<< ", range: 0 - 0, size: 0, result: 0\n";
|
||||||
EXPECT_STREQ(unbindOutput.c_str(), expected.str().c_str()) << unbindOutput;
|
EXPECT_STREQ(unbindOutput.c_str(), expected.str().c_str()) << unbindOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,7 +595,8 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindFailsThenPrint
|
|||||||
|
|
||||||
std::string bindOutput = testing::internal::GetCapturedStderr();
|
std::string bindOutput = testing::internal::GetCapturedStderr();
|
||||||
std::stringstream expected;
|
std::stringstream expected;
|
||||||
expected << "bind BO-0 to VM 0, drmVmId = " << drm->latestCreatedVmId << ", range: 0 - 0, size: 0, result: -1, errno: 22\n";
|
expected << "bind BO-0 to VM " << drm->latestCreatedVmId << ", vmHandleId = 0"
|
||||||
|
<< ", range: 0 - 0, size: 0, result: -1, errno: 22\n";
|
||||||
EXPECT_TRUE(hasSubstr(expected.str(), expected.str())) << bindOutput;
|
EXPECT_TRUE(hasSubstr(expected.str(), expected.str())) << bindOutput;
|
||||||
expected.str("");
|
expected.str("");
|
||||||
testing::internal::CaptureStderr();
|
testing::internal::CaptureStderr();
|
||||||
@@ -603,7 +606,8 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindFailsThenPrint
|
|||||||
EXPECT_TRUE(bo.bindInfo[contextId][0]);
|
EXPECT_TRUE(bo.bindInfo[contextId][0]);
|
||||||
|
|
||||||
std::string unbindOutput = testing::internal::GetCapturedStderr();
|
std::string unbindOutput = testing::internal::GetCapturedStderr();
|
||||||
expected << "unbind BO-0 from VM 0, drmVmId = " << drm->latestCreatedVmId << ", range: 0 - 0, size: 0, result: -1, errno: 22";
|
expected << "unbind BO-0 from VM " << drm->latestCreatedVmId << ", vmHandleId = 0"
|
||||||
|
<< ", range: 0 - 0, size: 0, result: -1, errno: 22";
|
||||||
EXPECT_TRUE(hasSubstr(unbindOutput, expected.str())) << unbindOutput;
|
EXPECT_TRUE(hasSubstr(unbindOutput, expected.str())) << unbindOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user