Lines Matching refs:tx

158                          struct nouveau_transfer *tx, bool permit_pb)
160 const unsigned adj = tx->base.box.x & NOUVEAU_MIN_BUFFER_MAP_ALIGN_MASK;
161 const unsigned size = align(tx->base.box.width, 4) + adj;
167 tx->map = align_malloc(size, NOUVEAU_MIN_BUFFER_MAP_ALIGN);
168 if (tx->map)
169 tx->map += adj;
171 tx->mm =
172 nouveau_mm_allocate(nv->screen->mm_GART, size, &tx->bo, &tx->offset);
173 if (tx->bo) {
174 tx->offset += adj;
175 if (!nouveau_bo_map(tx->bo, 0, NULL))
176 tx->map = (uint8_t *)tx->bo->map + tx->offset;
179 return tx->map;
187 nouveau_transfer_read(struct nouveau_context *nv, struct nouveau_transfer *tx)
189 struct nv04_resource *buf = nv04_resource(tx->base.resource);
190 const unsigned base = tx->base.box.x;
191 const unsigned size = tx->base.box.width;
195 nv->copy_data(nv, tx->bo, tx->offset, NOUVEAU_BO_GART,
198 if (nouveau_bo_wait(tx->bo, NOUVEAU_BO_RD, nv->client))
202 memcpy(buf->data + base, tx->map, size);
208 nouveau_transfer_write(struct nouveau_context *nv, struct nouveau_transfer *tx,
211 struct nv04_resource *buf = nv04_resource(tx->base.resource);
212 uint8_t *data = tx->map + offset;
213 const unsigned base = tx->base.box.x + offset;
226 if (tx->bo)
228 tx->bo, tx->offset + offset, NOUVEAU_BO_GART, size);
279 nouveau_buffer_transfer_init(struct nouveau_transfer *tx,
284 tx->base.resource = resource;
285 tx->base.level = 0;
286 tx->base.usage = usage;
287 tx->base.box.x = box->x;
288 tx->base.box.y = 0;
289 tx->base.box.z = 0;
290 tx->base.box.width = box->width;
291 tx->base.box.height = 1;
292 tx->base.box.depth = 1;
293 tx->base.stride = 0;
294 tx->base.layer_stride = 0;
296 tx->bo = NULL;
297 tx->map = NULL;
302 struct nouveau_transfer *tx)
304 if (tx->map) {
305 if (likely(tx->bo)) {
307 nouveau_fence_unref_bo, tx->bo);
308 if (tx->mm)
309 release_allocation(&tx->mm, nv->screen->fence.current);
311 align_free(tx->map -
312 (tx->base.box.x & NOUVEAU_MIN_BUFFER_MAP_ALIGN_MASK));
321 struct nouveau_transfer tx;
323 tx.base.resource = &buf->base;
324 tx.base.box.x = 0;
325 tx.base.box.width = buf->base.width0;
326 tx.bo = NULL;
327 tx.map = NULL;
336 if (!nouveau_transfer_staging(nv, &tx, false))
339 ret = nouveau_transfer_read(nv, &tx);
342 memcpy(buf->data, tx.map, buf->base.width0);
344 nouveau_buffer_transfer_del(nv, &tx);
404 struct nouveau_transfer *tx = MALLOC_STRUCT(nouveau_transfer);
408 if (!tx)
410 nouveau_buffer_transfer_init(tx, resource, box, usage);
411 *ptransfer = &tx->base;
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);
457 return buf->data ? (buf->data + box->x) : tx->map;
482 FREE(tx);
505 nouveau_transfer_staging(nv, tx, true);
506 map = tx->map;
516 nouveau_transfer_staging(nv, tx, true);
517 if (tx->map)
518 memcpy(tx->map, map, box->width);
519 map = tx->map;
523 FREE(tx);
534 struct nouveau_transfer *tx = nouveau_transfer(transfer);
537 if (tx->map)
538 nouveau_transfer_write(nouveau_context(pipe), tx, box->x, box->width);
541 tx->base.box.x + box->x,
542 tx->base.box.x + box->x + box->width);
561 struct nouveau_transfer *tx = nouveau_transfer(transfer);
563 if (tx->base.usage & PIPE_MAP_WRITE) {
564 if (!(tx->base.usage & PIPE_MAP_FLUSH_EXPLICIT)) {
565 if (tx->map)
566 nouveau_transfer_write(nv, tx, 0, tx->base.box.width);
569 tx->base.box.x, tx->base.box.x + tx->base.box.width);
580 if (!tx->bo && (tx->base.usage & PIPE_MAP_WRITE))
581 NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_direct, tx->base.box.width);
583 nouveau_buffer_transfer_del(nv, tx);
584 FREE(tx);
662 struct nouveau_transfer *tx = MALLOC_STRUCT(nouveau_transfer);
663 if (!tx)
665 nouveau_buffer_transfer_init(tx, resource, box, usage);
666 *ptransfer = &tx->base;
674 struct nouveau_transfer *tx = nouveau_transfer(transfer);
675 FREE(tx);
861 struct nouveau_transfer tx;
864 tx.base.resource = &buf->base;
865 tx.base.box.x = 0;
866 tx.base.box.width = buf->base.width0;
867 tx.bo = NULL;
868 tx.map = NULL;
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);