mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
Update all L0 Sysman getHandle routines to match spec.
Updated all the getHandle routines to use the following
algorithm:
n = min(*pCount, available)
if (*pCount == 0 || *pCount > available) {
*pCount = available;
}
if (pArrayn != nullptr) {
for(i = 0; i < n; i++) {
pArray[i] = handle[i];
}
}
Change-Id: I3b2a2170c2b52d1651bddae4f85f361fd86167a0
Signed-off-by: Bill Jordan <bill.jordan@intel.com>
This commit is contained in:
@@ -7,34 +7,35 @@
|
||||
|
||||
#include "standby.h"
|
||||
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
|
||||
#include "standby_imp.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
StandbyHandleContext::~StandbyHandleContext() {
|
||||
for (Standby *pStandby : handle_list) {
|
||||
for (Standby *pStandby : handleList) {
|
||||
delete pStandby;
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t StandbyHandleContext::init() {
|
||||
Standby *pStandby = new StandbyImp(pOsSysman);
|
||||
handle_list.push_back(pStandby);
|
||||
handleList.push_back(pStandby);
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t StandbyHandleContext::standbyGet(uint32_t *pCount, zet_sysman_standby_handle_t *phStandby) {
|
||||
if (nullptr == phStandby) {
|
||||
*pCount = static_cast<uint32_t>(handle_list.size());
|
||||
return ZE_RESULT_SUCCESS;
|
||||
uint32_t handleListSize = static_cast<uint32_t>(handleList.size());
|
||||
uint32_t numToCopy = std::min(*pCount, handleListSize);
|
||||
if (0 == *pCount || *pCount > handleListSize) {
|
||||
*pCount = handleListSize;
|
||||
}
|
||||
uint32_t i = 0;
|
||||
for (Standby *standby : handle_list) {
|
||||
if (i >= *pCount)
|
||||
break;
|
||||
phStandby[i++] = standby->toHandle();
|
||||
if (nullptr != phStandby) {
|
||||
for (uint32_t i = 0; i < numToCopy; i++) {
|
||||
phStandby[i] = handleList[i]->toHandle();
|
||||
}
|
||||
}
|
||||
*pCount = i;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ struct StandbyHandleContext {
|
||||
ze_result_t standbyGet(uint32_t *pCount, zet_sysman_standby_handle_t *phStandby);
|
||||
|
||||
OsSysman *pOsSysman;
|
||||
std::vector<Standby *> handle_list = {};
|
||||
std::vector<Standby *> handleList = {};
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user