/* Fetch and adjust GPU GET pointer * *Returns: *value>=0,theadjustedGETpointer *-EINVALifGETpointercurrentlyoutsidemainpushbuffer *-EBUSYiftimeoutexceeded
*/ staticinlineint
READ_GET(struct nouveau_channel *chan, uint64_t *prev_get, int *timeout)
{
uint64_t val;
val = nvif_rd32(chan->userd, chan->user_get);
/* reset counter as long as GET is still advancing, this is *toavoidmisdetectingaGPUlockupiftheGPUhappensto *justbeprocessinganoperationthattakesalongtime
*/ if (val != *prev_get) {
*prev_get = val;
*timeout = 0;
}
if ((++*timeout & 0xff) == 0) {
udelay(1); if (*timeout > 100000) return -EBUSY;
}
if (val < chan->push.addr ||
val > chan->push.addr + (chan->dma.max << 2)) return -EINVAL;
return (val - chan->push.addr) >> 2;
}
int
nouveau_dma_wait(struct nouveau_channel *chan, int size)
{
uint64_t prev_get = 0; int cnt = 0, get;
while (chan->dma.free < size) {
get = READ_GET(chan, &prev_get, &cnt); if (unlikely(get == -EBUSY)) return -EBUSY;
/* loop until we have a usable GET pointer. the value *wereadfromtheGPUmaybeoutsidethemainringif *PFIFOisprocessingabuffercalledfromthemainring, *discardthesevaluesuntilsomethingsensibleisseen. * *theothercasewediscardGETiswhiletheGPUisfetching *fromtheSKIPSarea,sothecodebelowdoesn'thavetodeal *withsomefuncornercases.
*/ if (unlikely(get == -EINVAL) || get < NOUVEAU_DMA_SKIPS) continue;
if (get <= chan->dma.cur) { /* engine is fetching behind us, or is completely *idle(GET==PUT)sowehavefreespaceupuntil *theendofthepushbuffer * *wecanonlyhitthatpathoncepercalldueto *loopingbacktothebeginningofthepushbuffer, *we'llhitthefetching-ahead-of-uspathfromthat *pointon. * *the*one*exceptiontothatruleisifweread *GET==PUT,inwhichcasethebelowconditionalwill *alwayssucceedandbreakusoutofthewaitloop. */ chan->dma.free=chan->dma.max-chan->dma.cur; if(chan->dma.free>=size) break;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.