/* cp_path() sets the directory where all codepage files must be found (if * the parameter to cp_set() specifies a full path, that is used instead). * The path is specified into two parts: root and directory; the full path * for the codepage direcory is just the concatenation of the two, with a * directory separator in between. The directory is given in two parts, * because often a program already retrieves its "home" directory and the * codepages are most conveniently stored in a subdirectory of this home * directory. */ SC_FUNC int cp_path(const char *root, const char *directory) { size_t len1,len2; int add_slash1,add_slash2; len1= (root!=NULL) ? strlen(root) : 0; add_slash1= (len1==0 || root[len1-1]!=DIRSEP_CHAR); len2= (directory!=NULL) ? strlen(directory) : 0; add_slash2= (len2>0 && root[len2-1]!=DIRSEP_CHAR); if (len1+add_slash1+len2+add_slash2>=(_MAX_PATH-MAXCODEPAGE)) return FALSE; /* full filename may not fit */ if (root!=NULL) strcpy(cprootpath,root); if (add_slash1) { assert(len1==0 || cprootpath[len1]=='\0'); cprootpath[len1]=DIRSEP_CHAR; cprootpath[len1+1]='\0'; } /* if */ if (directory!=NULL) strcat(cprootpath,directory); if (add_slash2) { assert(cprootpath[len1+add_slash1+len2]=='\0'); cprootpath[len1+add_slash1+len2]=DIRSEP_CHAR; cprootpath[len1+add_slash1+len2+1]='\0'; } /* if */ cp_set(NULL); /* start with a "linear" table (no translation) */ return TRUE; }
static void nv40_grctx_generate(struct nouveau_grctx *ctx) { /* decide whether we're loading/unloading the context */ cp_bra (ctx, AUTO_SAVE, PENDING, cp_setup_save); cp_bra (ctx, USER_SAVE, PENDING, cp_setup_save); cp_name(ctx, cp_check_load); cp_bra (ctx, AUTO_LOAD, PENDING, cp_setup_auto_load); cp_bra (ctx, USER_LOAD, PENDING, cp_setup_load); cp_bra (ctx, ALWAYS, TRUE, cp_exit); /* setup for context load */ cp_name(ctx, cp_setup_auto_load); cp_wait(ctx, STATUS, IDLE); cp_out (ctx, CP_NEXT_TO_SWAP); cp_name(ctx, cp_setup_load); cp_wait(ctx, STATUS, IDLE); cp_set (ctx, SWAP_DIRECTION, LOAD); cp_out (ctx, 0x00910880); /* ?? */ cp_out (ctx, 0x00901ffe); /* ?? */ cp_out (ctx, 0x01940000); /* ?? */ cp_lsr (ctx, 0x20); cp_out (ctx, 0x0060000b); /* ?? */ cp_wait(ctx, UNK57, CLEAR); cp_out (ctx, 0x0060000c); /* ?? */ cp_bra (ctx, ALWAYS, TRUE, cp_swap_state); /* setup for context save */ cp_name(ctx, cp_setup_save); cp_set (ctx, SWAP_DIRECTION, SAVE); /* general PGRAPH state */ cp_name(ctx, cp_swap_state); cp_pos (ctx, 0x00020/4); nv40_graph_construct_general(ctx); cp_wait(ctx, STATUS, IDLE); /* 3D state, block 1 */ cp_bra (ctx, UNK54, CLEAR, cp_prepare_exit); nv40_graph_construct_state3d(ctx); cp_wait(ctx, STATUS, IDLE); /* 3D state, block 2 */ nv40_graph_construct_state3d_2(ctx); /* Some other block of "random" state */ nv40_graph_construct_state3d_3(ctx); /* Per-vertex shader state */ cp_pos (ctx, ctx->ctxvals_pos); nv40_graph_construct_shader(ctx); /* pre-exit state updates */ cp_name(ctx, cp_prepare_exit); cp_bra (ctx, SWAP_DIRECTION, SAVE, cp_check_load); cp_bra (ctx, USER_SAVE, PENDING, cp_exit); cp_out (ctx, CP_NEXT_TO_CURRENT); cp_name(ctx, cp_exit); cp_set (ctx, USER_SAVE, NOT_PENDING); cp_set (ctx, USER_LOAD, NOT_PENDING); cp_out (ctx, CP_END); }
void nv40_grctx_init(struct nouveau_grctx *ctx) { cp_bra (ctx, AUTO_SAVE, PENDING, cp_setup_save); cp_bra (ctx, USER_SAVE, PENDING, cp_setup_save); cp_name(ctx, cp_check_load); cp_bra (ctx, AUTO_LOAD, PENDING, cp_setup_auto_load); cp_bra (ctx, USER_LOAD, PENDING, cp_setup_load); cp_bra (ctx, ALWAYS, TRUE, cp_exit); cp_name(ctx, cp_setup_auto_load); cp_wait(ctx, STATUS, IDLE); cp_out (ctx, CP_NEXT_TO_SWAP); cp_name(ctx, cp_setup_load); cp_wait(ctx, STATUS, IDLE); cp_set (ctx, SWAP_DIRECTION, LOAD); cp_out (ctx, 0x00910880); cp_out (ctx, 0x00901ffe); cp_out (ctx, 0x01940000); cp_lsr (ctx, 0x20); cp_out (ctx, 0x0060000b); cp_wait(ctx, UNK57, CLEAR); cp_out (ctx, 0x0060000c); cp_bra (ctx, ALWAYS, TRUE, cp_swap_state); cp_name(ctx, cp_setup_save); cp_set (ctx, SWAP_DIRECTION, SAVE); cp_name(ctx, cp_swap_state); cp_pos (ctx, 0x00020/4); nv40_graph_construct_general(ctx); cp_wait(ctx, STATUS, IDLE); cp_bra (ctx, UNK54, CLEAR, cp_prepare_exit); nv40_graph_construct_state3d(ctx); cp_wait(ctx, STATUS, IDLE); nv40_graph_construct_state3d_2(ctx); nv40_graph_construct_state3d_3(ctx); cp_pos (ctx, ctx->ctxvals_pos); nv40_graph_construct_shader(ctx); cp_name(ctx, cp_prepare_exit); cp_bra (ctx, SWAP_DIRECTION, SAVE, cp_check_load); cp_bra (ctx, USER_SAVE, PENDING, cp_exit); cp_out (ctx, CP_NEXT_TO_CURRENT); cp_name(ctx, cp_exit); cp_set (ctx, USER_SAVE, NOT_PENDING); cp_set (ctx, USER_LOAD, NOT_PENDING); cp_out (ctx, CP_END); }