sdk/linux_kernel_drivers/xocl/xocl_exec.c
/**
 * acquire_slot_idx() - Acquire a slot index if available.  Update slot status to busy
 * so it cannot be reacquired.
 *
 * This function is called from scheduler thread
 *
 * Return: Command queue slot index, or -1 if none avaiable
 */
Acquire a slot index if available.  Update slot status to busy
so it cannot be reacquired.

This function is called from scheduler thread

Command queue slot index, or -1 if none avaiable
Acquire a slot index if available . Update slot status to busy so it cannot be reacquired . This function is called from scheduler thread Command queue slot index or - 1 if none avaiable
static int
acquire_slot_idx(struct drm_xocl_dev *xdev)
{
	unsigned int mask_idx=0, slot_idx=-1;
	u32 mask;
	SCHED_DEBUG("-> acquire_slot_idx\n");
	for (mask_idx=0; mask_idx<xdev->exec.num_slot_masks; ++mask_idx) {
		mask = xdev->exec.slot_status[mask_idx];
		slot_idx = ffz_or_neg_one(mask);
		if (slot_idx==-1 || slot_idx_from_mask_idx(slot_idx,mask_idx)>=xdev->exec.num_slots)
			continue;
		xdev->exec.slot_status[mask_idx] ^= (1<<slot_idx);
		SCHED_DEBUGF("<- acquire_slot_idx returns %d\n",slot_idx_from_mask_idx(slot_idx,mask_idx));
		return slot_idx_from_mask_idx(slot_idx,mask_idx);
	}
	SCHED_DEBUGF("<- acquire_slot_idx returns -1\n");
	return -1;
}
static int acquire_slot_idx ( struct drm_xocl_dev * xdev ) { unsigned int mask_idx = 0 , slot_idx = -1 ; u32 mask ; SCHED_DEBUG ( " \n " ) ; for ( mask_idx = 0 ; mask_idx < xdev -> exec . num_slot_masks ; ++ mask_idx ) { mask = xdev -> exec . slot_status [ mask_idx ] ; slot_idx = ffz_or_neg_one ( mask ) ; if ( slot_idx == -1 || slot_idx_from_mask_idx ( slot_idx , mask_idx ) >= xdev -> exec . num_slots ) continue ; xdev -> exec . slot_status [ mask_idx ] ^= ( 1 << slot_idx ) ; SCHED_DEBUGF ( " \n " , slot_idx_from_mask_idx ( slot_idx , mask_idx ) ) ; return slot_idx_from_mask_idx ( slot_idx , mask_idx ) ; } SCHED_DEBUGF ( " \n " ) ; return -1 ; }
acquire_slot_idx() - Acquire a slot index if available.
acquire_slot_idx () - Acquire a slot index if available .