Lines Matching refs:nv
105 nouveau_buffer_download(struct nouveau_context *nv, struct nv04_resource *buf,
114 mm = nouveau_mm_allocate(nv->screen->mm_GART, size, &bounce, &offset);
118 nv->copy_data(nv, bounce, offset, NOUVEAU_BO_GART,
121 if (nouveau_bo_map(bounce, NOUVEAU_BO_RD, nv->screen->client))
134 nouveau_buffer_upload(struct nouveau_context *nv, struct nv04_resource *buf,
141 if (size <= 192 && (nv->push_data || nv->push_cb)) {
143 nv->push_cb(nv, buf->bo, buf->domain, buf->offset, buf->base.width0,
146 nv->push_data(nv, buf->bo, buf->offset + start, buf->domain,
151 mm = nouveau_mm_allocate(nv->screen->mm_GART, size, &bounce, &offset);
155 nouveau_bo_map(bounce, 0, nv->screen->client);
158 nv->copy_data(nv, buf->bo, buf->offset + start, NOUVEAU_BO_VRAM,
163 release_allocation(&mm, nv->screen->fence.current);
177 struct nouveau_context *nv = nouveau_context(pipe);
190 nouveau_buffer_download(nv, buf, 0, buf->base.width0);
203 struct nouveau_context *nv = nouveau_context(pipe);
207 nouveau_buffer_upload(nv, buf, transfer->box.x, transfer->box.width);
252 struct nouveau_context *nv = nouveau_context(pipe);
269 ret = nouveau_bo_map(buf->bo, flags, nv->screen->client);
314 nouveau_resource_map_offset(struct nouveau_context *nv,
320 nouveau_buffer_download(nv, res, 0, res->base.width0);
333 if (nouveau_bo_map(res->bo, flags, nv->screen->client))
434 nouveau_buffer_data_fetch(struct nouveau_context *nv, struct nv04_resource *buf,
442 if (nouveau_bo_map(bo, NOUVEAU_BO_RD, nv->screen->client))
451 nouveau_buffer_migrate(struct nouveau_context *nv,
454 struct nouveau_screen *screen = nv->screen;
466 ret = nouveau_bo_map(buf->bo, 0, nv->screen->client);
477 if (!nouveau_buffer_data_fetch(nv, buf, buf->bo, buf->offset, size))
489 nv->copy_data(nv, buf->bo, buf->offset, new_domain,
499 if (!nouveau_buffer_upload(nv, buf, 0, buf->base.width0))
513 nouveau_user_buffer_upload(struct nouveau_context *nv,
526 ret = nouveau_bo_map(buf->bo, 0, nv->screen->client);
538 nouveau_scratch_bo_alloc(struct nouveau_context *nv, struct nouveau_bo **pbo,
541 return nouveau_bo_new(nv->screen->device, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
546 nouveau_scratch_runout_release(struct nouveau_context *nv)
548 if (!nv->scratch.nr_runout)
551 --nv->scratch.nr_runout;
552 nouveau_bo_ref(NULL, &nv->scratch.runout[nv->scratch.nr_runout]);
553 } while (nv->scratch.nr_runout);
555 FREE(nv->scratch.runout);
556 nv->scratch.end = 0;
557 nv->scratch.runout = NULL;
564 nouveau_scratch_runout(struct nouveau_context *nv, unsigned size)
567 const unsigned n = nv->scratch.nr_runout++;
569 nv->scratch.runout = REALLOC(nv->scratch.runout,
570 (n + 0) * sizeof(*nv->scratch.runout),
571 (n + 1) * sizeof(*nv->scratch.runout));
572 nv->scratch.runout[n] = NULL;
574 ret = nouveau_scratch_bo_alloc(nv, &nv->scratch.runout[n], size);
576 ret = nouveau_bo_map(nv->scratch.runout[n], 0, NULL);
578 nouveau_bo_ref(NULL, &nv->scratch.runout[--nv->scratch.nr_runout]);
581 nv->scratch.current = nv->scratch.runout[n];
582 nv->scratch.offset = 0;
583 nv->scratch.end = size;
584 nv->scratch.map = nv->scratch.current->map;
593 nouveau_scratch_next(struct nouveau_context *nv, unsigned size)
597 const unsigned i = (nv->scratch.id + 1) % NOUVEAU_MAX_SCRATCH_BUFS;
599 if ((size > nv->scratch.bo_size) || (i == nv->scratch.wrap))
601 nv->scratch.id = i;
603 bo = nv->scratch.bo[i];
605 ret = nouveau_scratch_bo_alloc(nv, &bo, nv->scratch.bo_size);
608 nv->scratch.bo[i] = bo;
610 nv->scratch.current = bo;
611 nv->scratch.offset = 0;
612 nv->scratch.end = nv->scratch.bo_size;
614 ret = nouveau_bo_map(bo, NOUVEAU_BO_WR, nv->screen->client);
616 nv->scratch.map = bo->map;
621 nouveau_scratch_more(struct nouveau_context *nv, unsigned min_size)
625 ret = nouveau_scratch_next(nv, min_size);
627 ret = nouveau_scratch_runout(nv, min_size);
634 nouveau_scratch_data(struct nouveau_context *nv,
638 unsigned bgn = MAX2(base, nv->scratch.offset);
641 if (end >= nv->scratch.end) {
643 if (!nouveau_scratch_more(nv, end))
647 nv->scratch.offset = align(end, 4);
649 memcpy(nv->scratch.map + bgn, (const uint8_t *)data + base, size);
651 *bo = nv->scratch.current;
656 nouveau_scratch_get(struct nouveau_context *nv,
659 unsigned bgn = nv->scratch.offset;
660 unsigned end = nv->scratch.offset + size;
662 if (end >= nv->scratch.end) {
664 if (!nouveau_scratch_more(nv, end))
668 nv->scratch.offset = align(end, 4);
670 *pbo = nv->scratch.current;
671 *gpu_addr = nv->scratch.current->offset + bgn;
672 return nv->scratch.map + bgn;