Lines Matching refs:parser
416 static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bool backoff) in radeon_cs_parser_fini() argument
431 list_sort(NULL, &parser->validated, cmp_size_smaller_first); in radeon_cs_parser_fini()
433 ttm_eu_fence_buffer_objects(&parser->ticket, in radeon_cs_parser_fini()
434 &parser->validated, in radeon_cs_parser_fini()
435 &parser->ib.fence->base); in radeon_cs_parser_fini()
437 ttm_eu_backoff_reservation(&parser->ticket, in radeon_cs_parser_fini()
438 &parser->validated); in radeon_cs_parser_fini()
441 if (parser->relocs != NULL) { in radeon_cs_parser_fini()
442 for (i = 0; i < parser->nrelocs; i++) { in radeon_cs_parser_fini()
443 struct radeon_bo *bo = parser->relocs[i].robj; in radeon_cs_parser_fini()
450 kfree(parser->track); in radeon_cs_parser_fini()
451 kvfree(parser->relocs); in radeon_cs_parser_fini()
452 kvfree(parser->vm_bos); in radeon_cs_parser_fini()
453 for (i = 0; i < parser->nchunks; i++) in radeon_cs_parser_fini()
454 kvfree(parser->chunks[i].kdata); in radeon_cs_parser_fini()
455 kvfree(parser->chunks); in radeon_cs_parser_fini()
456 kvfree(parser->chunks_array); in radeon_cs_parser_fini()
457 radeon_ib_free(parser->rdev, &parser->ib); in radeon_cs_parser_fini()
458 radeon_ib_free(parser->rdev, &parser->const_ib); in radeon_cs_parser_fini()
462 struct radeon_cs_parser *parser) in radeon_cs_ib_chunk() argument
466 if (parser->chunk_ib == NULL) in radeon_cs_ib_chunk()
469 if (parser->cs_flags & RADEON_CS_USE_VM) in radeon_cs_ib_chunk()
472 r = radeon_cs_parse(rdev, parser->ring, parser); in radeon_cs_ib_chunk()
473 if (r || parser->parser_error) { in radeon_cs_ib_chunk()
478 r = radeon_cs_sync_rings(parser); in radeon_cs_ib_chunk()
485 if (parser->ring == R600_RING_TYPE_UVD_INDEX) in radeon_cs_ib_chunk()
487 else if ((parser->ring == TN_RING_TYPE_VCE1_INDEX) || in radeon_cs_ib_chunk()
488 (parser->ring == TN_RING_TYPE_VCE2_INDEX)) in radeon_cs_ib_chunk()
491 r = radeon_ib_schedule(rdev, &parser->ib, NULL, true); in radeon_cs_ib_chunk()
548 struct radeon_cs_parser *parser) in radeon_cs_ib_vm_chunk() argument
550 struct radeon_fpriv *fpriv = parser->filp->driver_priv; in radeon_cs_ib_vm_chunk()
554 if (parser->chunk_ib == NULL) in radeon_cs_ib_vm_chunk()
556 if ((parser->cs_flags & RADEON_CS_USE_VM) == 0) in radeon_cs_ib_vm_chunk()
559 if (parser->const_ib.length_dw) { in radeon_cs_ib_vm_chunk()
560 r = radeon_ring_ib_parse(rdev, parser->ring, &parser->const_ib); in radeon_cs_ib_vm_chunk()
566 r = radeon_ring_ib_parse(rdev, parser->ring, &parser->ib); in radeon_cs_ib_vm_chunk()
571 if (parser->ring == R600_RING_TYPE_UVD_INDEX) in radeon_cs_ib_vm_chunk()
575 r = radeon_bo_vm_update_pte(parser, vm); in radeon_cs_ib_vm_chunk()
580 r = radeon_cs_sync_rings(parser); in radeon_cs_ib_vm_chunk()
588 (parser->chunk_const_ib != NULL)) { in radeon_cs_ib_vm_chunk()
589 r = radeon_ib_schedule(rdev, &parser->ib, &parser->const_ib, true); in radeon_cs_ib_vm_chunk()
591 r = radeon_ib_schedule(rdev, &parser->ib, NULL, true); in radeon_cs_ib_vm_chunk()
609 static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser *parser) in radeon_cs_ib_fill() argument
615 if (parser->chunk_ib == NULL) in radeon_cs_ib_fill()
618 if (parser->cs_flags & RADEON_CS_USE_VM) { in radeon_cs_ib_fill()
619 struct radeon_fpriv *fpriv = parser->filp->driver_priv; in radeon_cs_ib_fill()
623 (parser->chunk_const_ib != NULL)) { in radeon_cs_ib_fill()
624 ib_chunk = parser->chunk_const_ib; in radeon_cs_ib_fill()
629 r = radeon_ib_get(rdev, parser->ring, &parser->const_ib, in radeon_cs_ib_fill()
635 parser->const_ib.is_const_ib = true; in radeon_cs_ib_fill()
636 parser->const_ib.length_dw = ib_chunk->length_dw; in radeon_cs_ib_fill()
637 if (copy_from_user(parser->const_ib.ptr, in radeon_cs_ib_fill()
643 ib_chunk = parser->chunk_ib; in radeon_cs_ib_fill()
649 ib_chunk = parser->chunk_ib; in radeon_cs_ib_fill()
651 r = radeon_ib_get(rdev, parser->ring, &parser->ib, in radeon_cs_ib_fill()
657 parser->ib.length_dw = ib_chunk->length_dw; in radeon_cs_ib_fill()
659 memcpy(parser->ib.ptr, ib_chunk->kdata, ib_chunk->length_dw * 4); in radeon_cs_ib_fill()
660 else if (copy_from_user(parser->ib.ptr, ib_chunk->user_ptr, ib_chunk->length_dw * 4)) in radeon_cs_ib_fill()
668 struct radeon_cs_parser parser; in radeon_cs_ioctl() local
684 memset(&parser, 0, sizeof(struct radeon_cs_parser)); in radeon_cs_ioctl()
685 parser.filp = filp; in radeon_cs_ioctl()
686 parser.rdev = rdev; in radeon_cs_ioctl()
687 parser.dev = rdev->dev; in radeon_cs_ioctl()
688 parser.family = rdev->family; in radeon_cs_ioctl()
689 r = radeon_cs_parser_init(&parser, data); in radeon_cs_ioctl()
692 radeon_cs_parser_fini(&parser, r, false); in radeon_cs_ioctl()
698 r = radeon_cs_ib_fill(rdev, &parser); in radeon_cs_ioctl()
700 r = radeon_cs_parser_relocs(&parser); in radeon_cs_ioctl()
706 radeon_cs_parser_fini(&parser, r, false); in radeon_cs_ioctl()
712 trace_radeon_cs(&parser); in radeon_cs_ioctl()
714 r = radeon_cs_ib_chunk(rdev, &parser); in radeon_cs_ioctl()
718 r = radeon_cs_ib_vm_chunk(rdev, &parser); in radeon_cs_ioctl()
723 radeon_cs_parser_fini(&parser, r, true); in radeon_cs_ioctl()