Lines Matching refs:scratch

548    if (!nv->scratch.nr_runout)  in nouveau_scratch_runout_release()
551 --nv->scratch.nr_runout; in nouveau_scratch_runout_release()
552 nouveau_bo_ref(NULL, &nv->scratch.runout[nv->scratch.nr_runout]); in nouveau_scratch_runout_release()
553 } while (nv->scratch.nr_runout); in nouveau_scratch_runout_release()
555 FREE(nv->scratch.runout); in nouveau_scratch_runout_release()
556 nv->scratch.end = 0; in nouveau_scratch_runout_release()
557 nv->scratch.runout = NULL; in nouveau_scratch_runout_release()
567 const unsigned n = nv->scratch.nr_runout++; in nouveau_scratch_runout()
569 nv->scratch.runout = REALLOC(nv->scratch.runout, in nouveau_scratch_runout()
570 (n + 0) * sizeof(*nv->scratch.runout), in nouveau_scratch_runout()
571 (n + 1) * sizeof(*nv->scratch.runout)); in nouveau_scratch_runout()
572 nv->scratch.runout[n] = NULL; in nouveau_scratch_runout()
574 ret = nouveau_scratch_bo_alloc(nv, &nv->scratch.runout[n], size); in nouveau_scratch_runout()
576 ret = nouveau_bo_map(nv->scratch.runout[n], 0, NULL); in nouveau_scratch_runout()
578 nouveau_bo_ref(NULL, &nv->scratch.runout[--nv->scratch.nr_runout]); in nouveau_scratch_runout()
581 nv->scratch.current = nv->scratch.runout[n]; in nouveau_scratch_runout()
582 nv->scratch.offset = 0; in nouveau_scratch_runout()
583 nv->scratch.end = size; in nouveau_scratch_runout()
584 nv->scratch.map = nv->scratch.current->map; in nouveau_scratch_runout()
597 const unsigned i = (nv->scratch.id + 1) % NOUVEAU_MAX_SCRATCH_BUFS; in nouveau_scratch_next()
599 if ((size > nv->scratch.bo_size) || (i == nv->scratch.wrap)) in nouveau_scratch_next()
601 nv->scratch.id = i; in nouveau_scratch_next()
603 bo = nv->scratch.bo[i]; in nouveau_scratch_next()
605 ret = nouveau_scratch_bo_alloc(nv, &bo, nv->scratch.bo_size); in nouveau_scratch_next()
608 nv->scratch.bo[i] = bo; in nouveau_scratch_next()
610 nv->scratch.current = bo; in nouveau_scratch_next()
611 nv->scratch.offset = 0; in nouveau_scratch_next()
612 nv->scratch.end = nv->scratch.bo_size; in nouveau_scratch_next()
616 nv->scratch.map = bo->map; in nouveau_scratch_next()
638 unsigned bgn = MAX2(base, nv->scratch.offset); in nouveau_scratch_data()
641 if (end >= nv->scratch.end) { in nouveau_scratch_data()
647 nv->scratch.offset = align(end, 4); in nouveau_scratch_data()
649 memcpy(nv->scratch.map + bgn, (const uint8_t *)data + base, size); in nouveau_scratch_data()
651 *bo = nv->scratch.current; in nouveau_scratch_data()
659 unsigned bgn = nv->scratch.offset; in nouveau_scratch_get()
660 unsigned end = nv->scratch.offset + size; in nouveau_scratch_get()
662 if (end >= nv->scratch.end) { in nouveau_scratch_get()
668 nv->scratch.offset = align(end, 4); in nouveau_scratch_get()
670 *pbo = nv->scratch.current; in nouveau_scratch_get()
671 *gpu_addr = nv->scratch.current->offset + bgn; in nouveau_scratch_get()
672 return nv->scratch.map + bgn; in nouveau_scratch_get()