nouveau: switch to libdrm_nouveau-2.0
[mesa.git] / src / gallium / drivers / nv50 / nv50_program.h
index 639f06217ed94ab55fbc3eb2734bb26068a328f9..17aee97a024d820e2467b5897ee7131b33fbc020 100644 (file)
 
 #include "pipe/p_state.h"
 #include "tgsi/tgsi_scan.h"
-#include "nouveau/nouveau_class.h"
+
+#define NV50_CAP_MAX_PROGRAM_TEMPS 64
 
 struct nv50_varying {
    uint8_t id; /* tgsi index */
    uint8_t hw; /* hw index, nv50 wants flat FP inputs last */
 
-   uint8_t mask   : 4;
-   uint8_t linear : 1;
-   uint8_t pad    : 3;
+   unsigned mask   : 4;
+   unsigned linear : 1;
+   unsigned pad    : 3;
 
    ubyte sn; /* semantic name */
    ubyte si; /* semantic index */
@@ -44,13 +45,11 @@ struct nv50_program {
 
    ubyte type;
    boolean translated;
-
-   struct nouveau_bo *bo;
-   struct nouveau_stateobj *so;
+   boolean uses_lmem;
 
    uint32_t *code;
    unsigned code_size;
-   unsigned code_start; /* offset inside bo */
+   unsigned code_base;
    uint32_t *immd;
    unsigned immd_size;
    unsigned parm_size; /* size limit of uniform buffer */
@@ -84,45 +83,55 @@ struct nv50_program {
       uint8_t prim_type; /* point, line strip or tri strip */
    } gp;
 
+   /* relocation records */
    void *fixups;
    unsigned num_fixups;
+
+   struct nouveau_heap *mem;
 };
 
 #define NV50_INTERP_LINEAR   (1 << 0)
 #define NV50_INTERP_FLAT     (1 << 1)
 #define NV50_INTERP_CENTROID (1 << 2)
 
-#define NV50_PROG_MAX_SUBROUTINES 8
-
 /* analyze TGSI and see which TEMP[] are used as subroutine inputs/outputs */
 struct nv50_subroutine {
-   int id;
-   uint32_t argv[4][1]; /* 4 bitmasks, for each of xyzw, only allow 32 TEMPs */
-   uint32_t retv[4][1];
+   unsigned id;
+   unsigned pos;
+   /* function inputs and outputs */
+   uint32_t argv[NV50_CAP_MAX_PROGRAM_TEMPS][4];
+   uint32_t retv[NV50_CAP_MAX_PROGRAM_TEMPS][4];
 };
 
 struct nv50_translation_info {
    struct nv50_program *p;
    unsigned inst_nr;
+   struct tgsi_full_instruction *insns;
    ubyte input_file;
    ubyte output_file;
    ubyte input_map[PIPE_MAX_SHADER_INPUTS][4];
    ubyte output_map[PIPE_MAX_SHADER_OUTPUTS][4];
+   ubyte sysval_map[TGSI_SEMANTIC_COUNT];
    ubyte interp_mode[PIPE_MAX_SHADER_INPUTS];
    int input_access[PIPE_MAX_SHADER_INPUTS][4];
    int output_access[PIPE_MAX_SHADER_OUTPUTS][4];
    boolean indirect_inputs;
    boolean indirect_outputs;
+   boolean store_to_memory;
    struct tgsi_shader_info scan;
    uint32_t *immd32;
    unsigned immd32_nr;
    ubyte *immd32_ty;
    ubyte edgeflag_out;
-   struct nv50_subroutine subr[NV50_PROG_MAX_SUBROUTINES];
-   int subr_nr;
+   struct nv50_subroutine *subr;
+   unsigned subr_nr;
 };
 
 int nv50_generate_code(struct nv50_translation_info *ti);
+
+void nv50_relocate_program(struct nv50_program *p,
+                           uint32_t code_base, uint32_t data_base);
+
 boolean nv50_program_tx(struct nv50_program *p);
 
 #endif /* __NV50_PROG_H__ */