Lines Matching refs:prog

526 nvc0_program_dump(struct nvc0_program *prog)  in nvc0_program_dump()  argument
530 for (pos = 0; pos < sizeof(prog->hdr) / sizeof(prog->hdr[0]); ++pos) in nvc0_program_dump()
532 pos * sizeof(prog->hdr[0]), prog->hdr[pos]); in nvc0_program_dump()
534 debug_printf("shader binary code (0x%x bytes):", prog->code_size); in nvc0_program_dump()
535 for (pos = 0; pos < prog->code_size / 4; ++pos) { in nvc0_program_dump()
538 debug_printf("%08x ", prog->code[pos]); in nvc0_program_dump()
545 nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset) in nvc0_program_translate() argument
554 info->type = prog->type; in nvc0_program_translate()
557 info->bin.source = (void *)prog->pipe.tokens; in nvc0_program_translate()
559 info->io.genUserClip = prog->vp.num_ucps; in nvc0_program_translate()
580 prog->code = info->bin.code; in nvc0_program_translate()
581 prog->code_size = info->bin.codeSize; in nvc0_program_translate()
582 prog->immd_data = info->immd.buf; in nvc0_program_translate()
583 prog->immd_size = info->immd.bufSize; in nvc0_program_translate()
584 prog->relocs = info->bin.relocData; in nvc0_program_translate()
585 prog->max_gpr = MAX2(4, (info->bin.maxGPR + 1)); in nvc0_program_translate()
587 prog->vp.need_vertex_id = info->io.vertexId < PIPE_MAX_SHADER_INPUTS; in nvc0_program_translate()
591 prog->vp.edgeflag = info->io.edgeFlagIn; in nvc0_program_translate()
593 switch (prog->type) { in nvc0_program_translate()
595 ret = nvc0_vp_gen_header(prog, info); in nvc0_program_translate()
599 ret = nvc0_tcp_gen_header(prog, info); in nvc0_program_translate()
604 ret = nvc0_tep_gen_header(prog, info); in nvc0_program_translate()
608 ret = nvc0_gp_gen_header(prog, info); in nvc0_program_translate()
611 ret = nvc0_fp_gen_header(prog, info); in nvc0_program_translate()
615 NOUVEAU_ERR("unknown program type: %u\n", prog->type); in nvc0_program_translate()
623 prog->hdr[0] |= 1 << 26; in nvc0_program_translate()
624 prog->hdr[1] |= info->bin.tlsSpace; /* l[] size */ in nvc0_program_translate()
625 prog->need_tls = TRUE; in nvc0_program_translate()
637 prog->hdr[0] |= 1 << 16; in nvc0_program_translate()
639 if (prog->pipe.stream_output.num_outputs) in nvc0_program_translate()
640 prog->tfb = nvc0_program_create_tfb_state(info, in nvc0_program_translate()
641 &prog->pipe.stream_output); in nvc0_program_translate()
649 nvc0_program_upload_code(struct nvc0_context *nvc0, struct nvc0_program *prog) in nvc0_program_upload_code() argument
653 uint32_t size = prog->code_size + NVC0_SHADER_HEADER_SIZE; in nvc0_program_upload_code()
659 if (prog->immd_size) { in nvc0_program_upload_code()
660 prog->immd_base = size; in nvc0_program_upload_code()
662 size += prog->immd_size + 0xc0; /* add 0xc0 for align 0x40 -> 0x100 */ in nvc0_program_upload_code()
672 ret = nouveau_heap_alloc(screen->text_heap, size, prog, &prog->mem); in nvc0_program_upload_code()
677 prog->code_base = prog->mem->start; in nvc0_program_upload_code()
678 prog->immd_base = align(prog->mem->start + prog->immd_base, 0x100); in nvc0_program_upload_code()
679 assert((prog->immd_size == 0) || (prog->immd_base + prog->immd_size <= in nvc0_program_upload_code()
680 prog->mem->start + prog->mem->size)); in nvc0_program_upload_code()
683 switch (prog->mem->start & 0xff) { in nvc0_program_upload_code()
684 case 0x40: prog->code_base += 0x70; break; in nvc0_program_upload_code()
685 case 0x80: prog->code_base += 0x30; break; in nvc0_program_upload_code()
686 case 0xc0: prog->code_base += 0x70; break; in nvc0_program_upload_code()
688 prog->code_base += 0x30; in nvc0_program_upload_code()
689 assert((prog->mem->start & 0xff) == 0x00); in nvc0_program_upload_code()
693 code_pos = prog->code_base + NVC0_SHADER_HEADER_SIZE; in nvc0_program_upload_code()
695 if (prog->relocs) in nvc0_program_upload_code()
696 nv50_ir_relocate_code(prog->relocs, prog->code, code_pos, lib_pos, 0); in nvc0_program_upload_code()
700 nvc0_program_dump(prog); in nvc0_program_upload_code()
703 nvc0->base.push_data(&nvc0->base, screen->text, prog->code_base, in nvc0_program_upload_code()
704 NOUVEAU_BO_VRAM, NVC0_SHADER_HEADER_SIZE, prog->hdr); in nvc0_program_upload_code()
706 prog->code_base + NVC0_SHADER_HEADER_SIZE, in nvc0_program_upload_code()
707 NOUVEAU_BO_VRAM, prog->code_size, prog->code); in nvc0_program_upload_code()
708 if (prog->immd_size) in nvc0_program_upload_code()
710 screen->text, prog->immd_base, NOUVEAU_BO_VRAM, in nvc0_program_upload_code()
711 prog->immd_size, prog->immd_data); in nvc0_program_upload_code()
747 nvc0_program_destroy(struct nvc0_context *nvc0, struct nvc0_program *prog) in nvc0_program_destroy() argument
749 const struct pipe_shader_state pipe = prog->pipe; in nvc0_program_destroy()
750 const ubyte type = prog->type; in nvc0_program_destroy()
752 if (prog->mem) in nvc0_program_destroy()
753 nouveau_heap_free(&prog->mem); in nvc0_program_destroy()
755 if (prog->code) in nvc0_program_destroy()
756 FREE(prog->code); in nvc0_program_destroy()
757 if (prog->immd_data) in nvc0_program_destroy()
758 FREE(prog->immd_data); in nvc0_program_destroy()
759 if (prog->relocs) in nvc0_program_destroy()
760 FREE(prog->relocs); in nvc0_program_destroy()
761 if (prog->tfb) { in nvc0_program_destroy()
762 if (nvc0->state.tfb == prog->tfb) in nvc0_program_destroy()
764 FREE(prog->tfb); in nvc0_program_destroy()
767 memset(prog, 0, sizeof(*prog)); in nvc0_program_destroy()
769 prog->pipe = pipe; in nvc0_program_destroy()
770 prog->type = type; in nvc0_program_destroy()