Hi,
I implemented barrier that works on uncached memory:
void uncachedOrderedBarrier(volatile int_fast8_t* barrierValue, int_fast8_t userIndex, int_fast8_t isLastUser)
{
_nassert((int) barrierValue % 8 == 0);
_nassert(userIndex >= 0);
//Cache_inv((void*)0x9FFFFF00, 1, Cache_Type_L1D, FALSE);
while (*barrierValue != userIndex); // Wait for user's turn to enter the barrier
if (isLastUser) {
*barrierValue = -userIndex; // Last user enables exit mode of the barrier
} else {
*barrierValue = userIndex + 1; // Give turn to next user to enter the barrier
while (*barrierValue != -userIndex - 1);
*barrierValue = -userIndex; // Give turn to next user to exit the barrier
}
}
void MulticoreApi_swbarr(int32_t coreID, int32_t swbarr_id, uint32_t swbarr_cnt)
{
uncachedOrderedBarrier((int_fast8_t*) &uncachedOrderedBarrierValues[swbarr_id], coreID, swbarr_cnt == coreID + 1);
}
The problem is that H.264 HP encoder (01.00.02.00) produces artifacts (shaking video slices) with this barrier implementation.
I found out that to remove artifacts I need to Cache_inv or Cache_wbInv any cache-enabled memory address inside the barrier (see commented Cache_inv in the code above).
When I replace Cache_inv with a dummy delay loop OR any other cache operation like Cache_wbInvAll OR Cache_inv cache-disabled memory address the same artifacts appear again - I tried different variants.
I spent a lot of time debugging this issue and do not see problems in my barrier implementation. Can you explain this behaviour?
Regards,
Andrey Lisnevich