Lines Matching refs:nv
105 nouveau_buffer_download(struct nouveau_context *nv, struct nv04_resource *buf, in nouveau_buffer_download() argument
114 mm = nouveau_mm_allocate(nv->screen->mm_GART, size, &bounce, &offset); in nouveau_buffer_download()
118 nv->copy_data(nv, bounce, offset, NOUVEAU_BO_GART, in nouveau_buffer_download()
121 if (nouveau_bo_map(bounce, NOUVEAU_BO_RD, nv->screen->client)) in nouveau_buffer_download()
134 nouveau_buffer_upload(struct nouveau_context *nv, struct nv04_resource *buf, in nouveau_buffer_upload() argument
141 if (size <= 192 && (nv->push_data || nv->push_cb)) { in nouveau_buffer_upload()
143 nv->push_cb(nv, buf->bo, buf->domain, buf->offset, buf->base.width0, in nouveau_buffer_upload()
146 nv->push_data(nv, buf->bo, buf->offset + start, buf->domain, in nouveau_buffer_upload()
151 mm = nouveau_mm_allocate(nv->screen->mm_GART, size, &bounce, &offset); in nouveau_buffer_upload()
155 nouveau_bo_map(bounce, 0, nv->screen->client); in nouveau_buffer_upload()
158 nv->copy_data(nv, buf->bo, buf->offset + start, NOUVEAU_BO_VRAM, in nouveau_buffer_upload()
163 release_allocation(&mm, nv->screen->fence.current); in nouveau_buffer_upload()
177 struct nouveau_context *nv = nouveau_context(pipe); in nouveau_buffer_transfer_get() local
190 nouveau_buffer_download(nv, buf, 0, buf->base.width0); in nouveau_buffer_transfer_get()
203 struct nouveau_context *nv = nouveau_context(pipe); in nouveau_buffer_transfer_destroy() local
207 nouveau_buffer_upload(nv, buf, transfer->box.x, transfer->box.width); in nouveau_buffer_transfer_destroy()
252 struct nouveau_context *nv = nouveau_context(pipe); in nouveau_buffer_transfer_map() local
269 ret = nouveau_bo_map(buf->bo, flags, nv->screen->client); in nouveau_buffer_transfer_map()
314 nouveau_resource_map_offset(struct nouveau_context *nv, in nouveau_resource_map_offset() argument
320 nouveau_buffer_download(nv, res, 0, res->base.width0); in nouveau_resource_map_offset()
333 if (nouveau_bo_map(res->bo, flags, nv->screen->client)) in nouveau_resource_map_offset()
434 nouveau_buffer_data_fetch(struct nouveau_context *nv, struct nv04_resource *buf, in nouveau_buffer_data_fetch() argument
442 if (nouveau_bo_map(bo, NOUVEAU_BO_RD, nv->screen->client)) in nouveau_buffer_data_fetch()
451 nouveau_buffer_migrate(struct nouveau_context *nv, in nouveau_buffer_migrate() argument
454 struct nouveau_screen *screen = nv->screen; in nouveau_buffer_migrate()
466 ret = nouveau_bo_map(buf->bo, 0, nv->screen->client); in nouveau_buffer_migrate()
477 if (!nouveau_buffer_data_fetch(nv, buf, buf->bo, buf->offset, size)) in nouveau_buffer_migrate()
489 nv->copy_data(nv, buf->bo, buf->offset, new_domain, in nouveau_buffer_migrate()
499 if (!nouveau_buffer_upload(nv, buf, 0, buf->base.width0)) in nouveau_buffer_migrate()
513 nouveau_user_buffer_upload(struct nouveau_context *nv, in nouveau_user_buffer_upload() argument
526 ret = nouveau_bo_map(buf->bo, 0, nv->screen->client); in nouveau_user_buffer_upload()
538 nouveau_scratch_bo_alloc(struct nouveau_context *nv, struct nouveau_bo **pbo, in nouveau_scratch_bo_alloc() argument
541 return nouveau_bo_new(nv->screen->device, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, in nouveau_scratch_bo_alloc()
546 nouveau_scratch_runout_release(struct nouveau_context *nv) in nouveau_scratch_runout_release() argument
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()
564 nouveau_scratch_runout(struct nouveau_context *nv, unsigned size) in nouveau_scratch_runout() argument
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()
593 nouveau_scratch_next(struct nouveau_context *nv, unsigned size) in nouveau_scratch_next() argument
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()
614 ret = nouveau_bo_map(bo, NOUVEAU_BO_WR, nv->screen->client); in nouveau_scratch_next()
616 nv->scratch.map = bo->map; in nouveau_scratch_next()
621 nouveau_scratch_more(struct nouveau_context *nv, unsigned min_size) in nouveau_scratch_more() argument
625 ret = nouveau_scratch_next(nv, min_size); in nouveau_scratch_more()
627 ret = nouveau_scratch_runout(nv, min_size); in nouveau_scratch_more()
634 nouveau_scratch_data(struct nouveau_context *nv, in nouveau_scratch_data() argument
638 unsigned bgn = MAX2(base, nv->scratch.offset); in nouveau_scratch_data()
641 if (end >= nv->scratch.end) { in nouveau_scratch_data()
643 if (!nouveau_scratch_more(nv, 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()
656 nouveau_scratch_get(struct nouveau_context *nv, in nouveau_scratch_get() argument
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()
664 if (!nouveau_scratch_more(nv, 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()