Lines Matching refs:scratch
899 if (!nv->scratch.runout) in nouveau_scratch_runout_release()
903 nv->scratch.runout)) in nouveau_scratch_runout_release()
906 nv->scratch.end = 0; in nouveau_scratch_runout_release()
907 nv->scratch.runout = NULL; in nouveau_scratch_runout_release()
919 if (nv->scratch.runout) in nouveau_scratch_runout()
920 n = nv->scratch.runout->nr; in nouveau_scratch_runout()
923 nv->scratch.runout = REALLOC(nv->scratch.runout, n == 0 ? 0 : in nouveau_scratch_runout()
924 (sizeof(*nv->scratch.runout) + (n + 0) * sizeof(void *)), in nouveau_scratch_runout()
925 sizeof(*nv->scratch.runout) + (n + 1) * sizeof(void *)); in nouveau_scratch_runout()
926 nv->scratch.runout->nr = n + 1; in nouveau_scratch_runout()
927 nv->scratch.runout->bo[n] = NULL; in nouveau_scratch_runout()
929 ret = nouveau_scratch_bo_alloc(nv, &nv->scratch.runout->bo[n], size); in nouveau_scratch_runout()
931 ret = nouveau_bo_map(nv->scratch.runout->bo[n], 0, NULL); in nouveau_scratch_runout()
933 nouveau_bo_ref(NULL, &nv->scratch.runout->bo[--nv->scratch.runout->nr]); in nouveau_scratch_runout()
936 nv->scratch.current = nv->scratch.runout->bo[n]; in nouveau_scratch_runout()
937 nv->scratch.offset = 0; in nouveau_scratch_runout()
938 nv->scratch.end = size; in nouveau_scratch_runout()
939 nv->scratch.map = nv->scratch.current->map; in nouveau_scratch_runout()
952 const unsigned i = (nv->scratch.id + 1) % NOUVEAU_MAX_SCRATCH_BUFS; in nouveau_scratch_next()
954 if ((size > nv->scratch.bo_size) || (i == nv->scratch.wrap)) in nouveau_scratch_next()
956 nv->scratch.id = i; in nouveau_scratch_next()
958 bo = nv->scratch.bo[i]; in nouveau_scratch_next()
960 ret = nouveau_scratch_bo_alloc(nv, &bo, nv->scratch.bo_size); in nouveau_scratch_next()
963 nv->scratch.bo[i] = bo; in nouveau_scratch_next()
965 nv->scratch.current = bo; in nouveau_scratch_next()
966 nv->scratch.offset = 0; in nouveau_scratch_next()
967 nv->scratch.end = nv->scratch.bo_size; in nouveau_scratch_next()
971 nv->scratch.map = bo->map; in nouveau_scratch_next()
993 unsigned bgn = MAX2(base, nv->scratch.offset); in nouveau_scratch_data()
996 if (end >= nv->scratch.end) { in nouveau_scratch_data()
1002 nv->scratch.offset = align(end, 4); in nouveau_scratch_data()
1004 memcpy(nv->scratch.map + bgn, (const uint8_t *)data + base, size); in nouveau_scratch_data()
1006 *bo = nv->scratch.current; in nouveau_scratch_data()
1014 unsigned bgn = nv->scratch.offset; in nouveau_scratch_get()
1015 unsigned end = nv->scratch.offset + size; in nouveau_scratch_get()
1017 if (end >= nv->scratch.end) { in nouveau_scratch_get()
1023 nv->scratch.offset = align(end, 4); in nouveau_scratch_get()
1025 *pbo = nv->scratch.current; in nouveau_scratch_get()
1026 *gpu_addr = nv->scratch.current->offset + bgn; in nouveau_scratch_get()
1027 return nv->scratch.map + bgn; in nouveau_scratch_get()