Lines Matching refs:nv

157 nouveau_transfer_staging(struct nouveau_context *nv,
163 if (!nv->push_data)
166 if ((size <= nv->screen->transfer_pushbuf_threshold) && permit_pb) {
172 nouveau_mm_allocate(nv->screen->mm_GART, size, &tx->bo, &tx->offset);
187 nouveau_transfer_read(struct nouveau_context *nv, struct nouveau_transfer *tx)
193 NOUVEAU_DRV_STAT(nv->screen, buf_read_bytes_staging_vid, size);
195 nv->copy_data(nv, tx->bo, tx->offset, NOUVEAU_BO_GART,
198 if (nouveau_bo_wait(tx->bo, NOUVEAU_BO_RD, nv->client))
208 nouveau_transfer_write(struct nouveau_context *nv, struct nouveau_transfer *tx,
222 NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_staging_vid, size);
224 NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_staging_sys, size);
227 nv->copy_data(nv, buf->bo, buf->offset + base, buf->domain,
230 if (nv->push_cb && can_cb)
231 nv->push_cb(nv, buf,
234 nv->push_data(nv, buf->bo, buf->offset + base, buf->domain, size, data);
236 nouveau_fence_ref(nv->screen->fence.current, &buf->fence);
237 nouveau_fence_ref(nv->screen->fence.current, &buf->fence_wr);
244 nouveau_buffer_sync(struct nouveau_context *nv,
252 if (!nouveau_fence_wait(buf->fence_wr, &nv->debug))
259 if (!nouveau_fence_wait(buf->fence, &nv->debug))
301 nouveau_buffer_transfer_del(struct nouveau_context *nv,
306 nouveau_fence_work(nv->screen->fence.current,
309 release_allocation(&tx->mm, nv->screen->fence.current);
319 nouveau_buffer_cache(struct nouveau_context *nv, struct nv04_resource *buf)
334 nv->stats.buf_cache_count++;
336 if (!nouveau_transfer_staging(nv, &tx, false))
339 ret = nouveau_transfer_read(nv, &tx);
344 nouveau_buffer_transfer_del(nv, &tx);
398 struct nouveau_context *nv = nouveau_context(pipe);
414 NOUVEAU_DRV_STAT(nv->screen, buf_transfers_rd, 1);
416 NOUVEAU_DRV_STAT(nv->screen, buf_transfers_wr, 1);
435 nouveau_transfer_staging(nv, tx, true);
446 nouveau_transfer_staging(nv, tx, false);
447 nouveau_transfer_read(nv, tx);
452 nouveau_transfer_staging(nv, tx, true);
454 nouveau_buffer_cache(nv, buf);
467 nouveau_buffer_reallocate(nv->screen, buf, buf->domain);
469 nv->invalidate_resource_storage(nv, &buf->base, ref);
480 nv->client);
500 nouveau_buffer_sync(nv, buf, usage & PIPE_MAP_READ_WRITE);
505 nouveau_transfer_staging(nv, tx, true);
512 nouveau_buffer_sync(nv, buf, usage & PIPE_MAP_READ_WRITE);
516 nouveau_transfer_staging(nv, tx, true);
555 struct nouveau_context *nv = nouveau_context(pipe);
566 nouveau_transfer_write(nv, tx, 0, tx->base.box.width);
576 nv->vbo_dirty = true;
581 NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_direct, tx->base.box.width);
583 nouveau_buffer_transfer_del(nv, tx);
589 nouveau_copy_buffer(struct nouveau_context *nv,
599 nv->copy_data(nv,
604 nouveau_fence_ref(nv->screen->fence.current, &dst->fence);
605 nouveau_fence_ref(nv->screen->fence.current, &dst->fence_wr);
608 nouveau_fence_ref(nv->screen->fence.current, &src->fence);
617 util_resource_copy_region(&nv->pipe,
627 nouveau_resource_map_offset(struct nouveau_context *nv,
637 nouveau_buffer_cache(nv, res);
645 nouveau_buffer_sync(nv, res, rw);
649 if (nouveau_bo_map(res->bo, flags, nv->client))
800 nouveau_buffer_data_fetch(struct nouveau_context *nv, struct nv04_resource *buf,
805 if (nouveau_bo_map(bo, NOUVEAU_BO_RD, nv->client))
813 nouveau_buffer_migrate(struct nouveau_context *nv,
818 struct nouveau_screen *screen = nv->screen;
830 ret = nouveau_bo_map(buf->bo, 0, nv->client);
841 if (!nouveau_buffer_data_fetch(nv, buf, buf->bo, buf->offset, size))
853 nv->copy_data(nv, buf->bo, buf->offset, new_domain,
869 if (!nouveau_transfer_staging(nv, &tx, false))
871 nouveau_transfer_write(nv, &tx, 0, tx.base.box.width);
872 nouveau_buffer_transfer_del(nv, &tx);
885 nouveau_user_buffer_upload(struct nouveau_context *nv,
900 ret = nouveau_bo_map(buf->bo, 0, nv->client);
915 struct nouveau_context *nv = nouveau_context(pipe);
932 nouveau_buffer_reallocate(nv->screen, buf, buf->domain);
934 nv->invalidate_resource_storage(nv, &buf->base, ref);
942 nouveau_scratch_bo_alloc(struct nouveau_context *nv, struct nouveau_bo **pbo,
945 return nouveau_bo_new(nv->screen->device, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
962 nouveau_scratch_runout_release(struct nouveau_context *nv)
964 if (!nv->scratch.runout)
967 if (!nouveau_fence_work(nv->screen->fence.current, nouveau_scratch_unref_bos,
968 nv->scratch.runout))
971 nv->scratch.end = 0;
972 nv->scratch.runout = NULL;
979 nouveau_scratch_runout(struct nouveau_context *nv, unsigned size)
984 if (nv->scratch.runout)
985 n = nv->scratch.runout->nr;
988 nv->scratch.runout = REALLOC(nv->scratch.runout, n == 0 ? 0 :
989 (sizeof(*nv->scratch.runout) + (n + 0) * sizeof(void *)),
990 sizeof(*nv->scratch.runout) + (n + 1) * sizeof(void *));
991 nv->scratch.runout->nr = n + 1;
992 nv->scratch.runout->bo[n] = NULL;
994 ret = nouveau_scratch_bo_alloc(nv, &nv->scratch.runout->bo[n], size);
996 ret = nouveau_bo_map(nv->scratch.runout->bo[n], 0, NULL);
998 nouveau_bo_ref(NULL, &nv->scratch.runout->bo[--nv->scratch.runout->nr]);
1001 nv->scratch.current = nv->scratch.runout->bo[n];
1002 nv->scratch.offset = 0;
1003 nv->scratch.end = size;
1004 nv->scratch.map = nv->scratch.current->map;
1013 nouveau_scratch_next(struct nouveau_context *nv, unsigned size)
1017 const unsigned i = (nv->scratch.id + 1) % NOUVEAU_MAX_SCRATCH_BUFS;
1019 if ((size > nv->scratch.bo_size) || (i == nv->scratch.wrap))
1021 nv->scratch.id = i;
1023 bo = nv->scratch.bo[i];
1025 ret = nouveau_scratch_bo_alloc(nv, &bo, nv->scratch.bo_size);
1028 nv->scratch.bo[i] = bo;
1030 nv->scratch.current = bo;
1031 nv->scratch.offset = 0;
1032 nv->scratch.end = nv->scratch.bo_size;
1034 ret = nouveau_bo_map(bo, NOUVEAU_BO_WR, nv->client);
1036 nv->scratch.map = bo->map;
1041 nouveau_scratch_more(struct nouveau_context *nv, unsigned min_size)
1045 ret = nouveau_scratch_next(nv, min_size);
1047 ret = nouveau_scratch_runout(nv, min_size);
1054 nouveau_scratch_data(struct nouveau_context *nv,
1058 unsigned bgn = MAX2(base, nv->scratch.offset);
1061 if (end >= nv->scratch.end) {
1063 if (!nouveau_scratch_more(nv, end))
1067 nv->scratch.offset = align(end, 4);
1069 memcpy(nv->scratch.map + bgn, (const uint8_t *)data + base, size);
1071 *bo = nv->scratch.current;
1076 nouveau_scratch_get(struct nouveau_context *nv,
1079 unsigned bgn = nv->scratch.offset;
1080 unsigned end = nv->scratch.offset + size;
1082 if (end >= nv->scratch.end) {
1084 if (!nouveau_scratch_more(nv, end))
1088 nv->scratch.offset = align(end, 4);
1090 *pbo = nv->scratch.current;
1091 *gpu_addr = nv->scratch.current->offset + bgn;
1092 return nv->scratch.map + bgn;