Lines Matching refs:nv
141 nouveau_transfer_staging(struct nouveau_context *nv, in nouveau_transfer_staging() argument
147 if (!nv->push_data) in nouveau_transfer_staging()
150 if ((size <= nv->screen->transfer_pushbuf_threshold) && permit_pb) { in nouveau_transfer_staging()
156 nouveau_mm_allocate(nv->screen->mm_GART, size, &tx->bo, &tx->offset); in nouveau_transfer_staging()
171 nouveau_transfer_read(struct nouveau_context *nv, struct nouveau_transfer *tx) in nouveau_transfer_read() argument
177 NOUVEAU_DRV_STAT(nv->screen, buf_read_bytes_staging_vid, size); in nouveau_transfer_read()
179 nv->copy_data(nv, tx->bo, tx->offset, NOUVEAU_BO_GART, in nouveau_transfer_read()
182 if (nouveau_bo_wait(tx->bo, NOUVEAU_BO_RD, nv->client)) in nouveau_transfer_read()
192 nouveau_transfer_write(struct nouveau_context *nv, struct nouveau_transfer *tx, in nouveau_transfer_write() argument
206 NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_staging_vid, size); in nouveau_transfer_write()
208 NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_staging_sys, size); in nouveau_transfer_write()
211 nv->copy_data(nv, buf->bo, buf->offset + base, buf->domain, in nouveau_transfer_write()
214 if (nv->push_cb && can_cb) in nouveau_transfer_write()
215 nv->push_cb(nv, buf, in nouveau_transfer_write()
218 nv->push_data(nv, buf->bo, buf->offset + base, buf->domain, size, data); in nouveau_transfer_write()
220 nouveau_fence_ref(nv->screen->fence.current, &buf->fence); in nouveau_transfer_write()
221 nouveau_fence_ref(nv->screen->fence.current, &buf->fence_wr); in nouveau_transfer_write()
228 nouveau_buffer_sync(struct nouveau_context *nv, in nouveau_buffer_sync() argument
236 if (!nouveau_fence_wait(buf->fence_wr, &nv->debug)) in nouveau_buffer_sync()
243 if (!nouveau_fence_wait(buf->fence, &nv->debug)) in nouveau_buffer_sync()
285 nouveau_buffer_transfer_del(struct nouveau_context *nv, in nouveau_buffer_transfer_del() argument
290 nouveau_fence_work(nv->screen->fence.current, in nouveau_buffer_transfer_del()
293 release_allocation(&tx->mm, nv->screen->fence.current); in nouveau_buffer_transfer_del()
303 nouveau_buffer_cache(struct nouveau_context *nv, struct nv04_resource *buf) in nouveau_buffer_cache() argument
318 nv->stats.buf_cache_count++; in nouveau_buffer_cache()
320 if (!nouveau_transfer_staging(nv, &tx, false)) in nouveau_buffer_cache()
323 ret = nouveau_transfer_read(nv, &tx); in nouveau_buffer_cache()
328 nouveau_buffer_transfer_del(nv, &tx); in nouveau_buffer_cache()
382 struct nouveau_context *nv = nouveau_context(pipe); in nouveau_buffer_transfer_map() local
394 NOUVEAU_DRV_STAT(nv->screen, buf_transfers_rd, 1); in nouveau_buffer_transfer_map()
396 NOUVEAU_DRV_STAT(nv->screen, buf_transfers_wr, 1); in nouveau_buffer_transfer_map()
415 nouveau_transfer_staging(nv, tx, true); in nouveau_buffer_transfer_map()
426 nouveau_transfer_staging(nv, tx, false); in nouveau_buffer_transfer_map()
427 nouveau_transfer_read(nv, tx); in nouveau_buffer_transfer_map()
432 nouveau_transfer_staging(nv, tx, true); in nouveau_buffer_transfer_map()
434 nouveau_buffer_cache(nv, buf); in nouveau_buffer_transfer_map()
447 nouveau_buffer_reallocate(nv->screen, buf, buf->domain); in nouveau_buffer_transfer_map()
449 nv->invalidate_resource_storage(nv, &buf->base, ref); in nouveau_buffer_transfer_map()
460 nv->client); in nouveau_buffer_transfer_map()
480 nouveau_buffer_sync(nv, buf, usage & PIPE_MAP_READ_WRITE); in nouveau_buffer_transfer_map()
485 nouveau_transfer_staging(nv, tx, true); in nouveau_buffer_transfer_map()
492 nouveau_buffer_sync(nv, buf, usage & PIPE_MAP_READ_WRITE); in nouveau_buffer_transfer_map()
496 nouveau_transfer_staging(nv, tx, true); in nouveau_buffer_transfer_map()
535 struct nouveau_context *nv = nouveau_context(pipe); in nouveau_buffer_transfer_unmap() local
542 nouveau_transfer_write(nv, tx, 0, tx->base.box.width); in nouveau_buffer_transfer_unmap()
552 nv->vbo_dirty = true; in nouveau_buffer_transfer_unmap()
557 NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_direct, tx->base.box.width); in nouveau_buffer_transfer_unmap()
559 nouveau_buffer_transfer_del(nv, tx); in nouveau_buffer_transfer_unmap()
565 nouveau_copy_buffer(struct nouveau_context *nv, in nouveau_copy_buffer() argument
575 nv->copy_data(nv, in nouveau_copy_buffer()
580 nouveau_fence_ref(nv->screen->fence.current, &dst->fence); in nouveau_copy_buffer()
581 nouveau_fence_ref(nv->screen->fence.current, &dst->fence_wr); in nouveau_copy_buffer()
584 nouveau_fence_ref(nv->screen->fence.current, &src->fence); in nouveau_copy_buffer()
593 util_resource_copy_region(&nv->pipe, in nouveau_copy_buffer()
603 nouveau_resource_map_offset(struct nouveau_context *nv, in nouveau_resource_map_offset() argument
613 nouveau_buffer_cache(nv, res); in nouveau_resource_map_offset()
621 nouveau_buffer_sync(nv, res, rw); in nouveau_resource_map_offset()
625 if (nouveau_bo_map(res->bo, flags, nv->client)) in nouveau_resource_map_offset()
805 nouveau_buffer_data_fetch(struct nouveau_context *nv, struct nv04_resource *buf, in nouveau_buffer_data_fetch() argument
810 if (nouveau_bo_map(bo, NOUVEAU_BO_RD, nv->client)) in nouveau_buffer_data_fetch()
818 nouveau_buffer_migrate(struct nouveau_context *nv, in nouveau_buffer_migrate() argument
823 struct nouveau_screen *screen = nv->screen; in nouveau_buffer_migrate()
835 ret = nouveau_bo_map(buf->bo, 0, nv->client); in nouveau_buffer_migrate()
846 if (!nouveau_buffer_data_fetch(nv, buf, buf->bo, buf->offset, size)) in nouveau_buffer_migrate()
858 nv->copy_data(nv, buf->bo, buf->offset, new_domain, in nouveau_buffer_migrate()
874 if (!nouveau_transfer_staging(nv, &tx, false)) in nouveau_buffer_migrate()
876 nouveau_transfer_write(nv, &tx, 0, tx.base.box.width); in nouveau_buffer_migrate()
877 nouveau_buffer_transfer_del(nv, &tx); in nouveau_buffer_migrate()
890 nouveau_user_buffer_upload(struct nouveau_context *nv, in nouveau_user_buffer_upload() argument
905 ret = nouveau_bo_map(buf->bo, 0, nv->client); in nouveau_user_buffer_upload()
920 struct nouveau_context *nv = nouveau_context(pipe); in nouveau_buffer_invalidate() local
937 nouveau_buffer_reallocate(nv->screen, buf, buf->domain); in nouveau_buffer_invalidate()
939 nv->invalidate_resource_storage(nv, &buf->base, ref); in nouveau_buffer_invalidate()
947 nouveau_scratch_bo_alloc(struct nouveau_context *nv, struct nouveau_bo **pbo, in nouveau_scratch_bo_alloc() argument
950 return nouveau_bo_new(nv->screen->device, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, in nouveau_scratch_bo_alloc()
967 nouveau_scratch_runout_release(struct nouveau_context *nv) in nouveau_scratch_runout_release() argument
969 if (!nv->scratch.runout) in nouveau_scratch_runout_release()
972 if (!nouveau_fence_work(nv->screen->fence.current, nouveau_scratch_unref_bos, in nouveau_scratch_runout_release()
973 nv->scratch.runout)) in nouveau_scratch_runout_release()
976 nv->scratch.end = 0; in nouveau_scratch_runout_release()
977 nv->scratch.runout = NULL; in nouveau_scratch_runout_release()
984 nouveau_scratch_runout(struct nouveau_context *nv, unsigned size) in nouveau_scratch_runout() argument
989 if (nv->scratch.runout) in nouveau_scratch_runout()
990 n = nv->scratch.runout->nr; in nouveau_scratch_runout()
993 nv->scratch.runout = REALLOC(nv->scratch.runout, n == 0 ? 0 : in nouveau_scratch_runout()
994 (sizeof(*nv->scratch.runout) + (n + 0) * sizeof(void *)), in nouveau_scratch_runout()
995 sizeof(*nv->scratch.runout) + (n + 1) * sizeof(void *)); in nouveau_scratch_runout()
996 nv->scratch.runout->nr = n + 1; in nouveau_scratch_runout()
997 nv->scratch.runout->bo[n] = NULL; in nouveau_scratch_runout()
999 ret = nouveau_scratch_bo_alloc(nv, &nv->scratch.runout->bo[n], size); in nouveau_scratch_runout()
1001 ret = nouveau_bo_map(nv->scratch.runout->bo[n], 0, NULL); in nouveau_scratch_runout()
1003 nouveau_bo_ref(NULL, &nv->scratch.runout->bo[--nv->scratch.runout->nr]); in nouveau_scratch_runout()
1006 nv->scratch.current = nv->scratch.runout->bo[n]; in nouveau_scratch_runout()
1007 nv->scratch.offset = 0; in nouveau_scratch_runout()
1008 nv->scratch.end = size; in nouveau_scratch_runout()
1009 nv->scratch.map = nv->scratch.current->map; in nouveau_scratch_runout()
1018 nouveau_scratch_next(struct nouveau_context *nv, unsigned size) in nouveau_scratch_next() argument
1022 const unsigned i = (nv->scratch.id + 1) % NOUVEAU_MAX_SCRATCH_BUFS; in nouveau_scratch_next()
1024 if ((size > nv->scratch.bo_size) || (i == nv->scratch.wrap)) in nouveau_scratch_next()
1026 nv->scratch.id = i; in nouveau_scratch_next()
1028 bo = nv->scratch.bo[i]; in nouveau_scratch_next()
1030 ret = nouveau_scratch_bo_alloc(nv, &bo, nv->scratch.bo_size); in nouveau_scratch_next()
1033 nv->scratch.bo[i] = bo; in nouveau_scratch_next()
1035 nv->scratch.current = bo; in nouveau_scratch_next()
1036 nv->scratch.offset = 0; in nouveau_scratch_next()
1037 nv->scratch.end = nv->scratch.bo_size; in nouveau_scratch_next()
1039 ret = nouveau_bo_map(bo, NOUVEAU_BO_WR, nv->client); in nouveau_scratch_next()
1041 nv->scratch.map = bo->map; in nouveau_scratch_next()
1046 nouveau_scratch_more(struct nouveau_context *nv, unsigned min_size) in nouveau_scratch_more() argument
1050 ret = nouveau_scratch_next(nv, min_size); in nouveau_scratch_more()
1052 ret = nouveau_scratch_runout(nv, min_size); in nouveau_scratch_more()
1059 nouveau_scratch_data(struct nouveau_context *nv, in nouveau_scratch_data() argument
1063 unsigned bgn = MAX2(base, nv->scratch.offset); in nouveau_scratch_data()
1066 if (end >= nv->scratch.end) { in nouveau_scratch_data()
1068 if (!nouveau_scratch_more(nv, end)) in nouveau_scratch_data()
1072 nv->scratch.offset = align(end, 4); in nouveau_scratch_data()
1074 memcpy(nv->scratch.map + bgn, (const uint8_t *)data + base, size); in nouveau_scratch_data()
1076 *bo = nv->scratch.current; in nouveau_scratch_data()
1081 nouveau_scratch_get(struct nouveau_context *nv, in nouveau_scratch_get() argument
1084 unsigned bgn = nv->scratch.offset; in nouveau_scratch_get()
1085 unsigned end = nv->scratch.offset + size; in nouveau_scratch_get()
1087 if (end >= nv->scratch.end) { in nouveau_scratch_get()
1089 if (!nouveau_scratch_more(nv, end)) in nouveau_scratch_get()
1093 nv->scratch.offset = align(end, 4); in nouveau_scratch_get()
1095 *pbo = nv->scratch.current; in nouveau_scratch_get()
1096 *gpu_addr = nv->scratch.current->offset + bgn; in nouveau_scratch_get()
1097 return nv->scratch.map + bgn; in nouveau_scratch_get()