From 35707dbe57873adb5a8088cd47c13bd216e143e4 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Thu, 12 Apr 2007 09:43:00 +0800 Subject: Initial 965 GLSL support --- src/mesa/drivers/dri/i965/brw_clip.h | 4 +- src/mesa/drivers/dri/i965/brw_context.c | 47 ++++++++ src/mesa/drivers/dri/i965/brw_eu.h | 3 +- src/mesa/drivers/dri/i965/brw_eu_emit.c | 2 +- src/mesa/drivers/dri/i965/brw_gs.h | 4 +- src/mesa/drivers/dri/i965/brw_sf.h | 4 +- src/mesa/drivers/dri/i965/brw_vs.h | 1 + src/mesa/drivers/dri/i965/brw_vs_emit.c | 184 ++++++++++++++++++++++-------- src/mesa/drivers/dri/i965/brw_vs_tnl.c | 2 +- src/mesa/drivers/dri/i965/brw_wm.c | 4 + src/mesa/drivers/dri/i965/brw_wm_emit.c | 82 ++++++++++--- src/mesa/drivers/dri/i965/brw_wm_pass0.c | 4 + src/mesa/drivers/dri/i965/brw_wm_pass1.c | 5 +- src/mesa/drivers/dri/i965/intel_context.c | 4 + src/mesa/shader/slang/slang_codegen.c | 1 + 15 files changed, 276 insertions(+), 75 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_clip.h b/src/mesa/drivers/dri/i965/brw_clip.h index 49b2770a514..2a65697325b 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.h +++ b/src/mesa/drivers/dri/i965/brw_clip.h @@ -42,7 +42,7 @@ * up polygon offset and flatshading at this point: */ struct brw_clip_prog_key { - GLuint attrs:16; + GLuint attrs:32; GLuint primitive:4; GLuint nr_userclip:3; GLuint do_flat_shading:1; @@ -51,7 +51,7 @@ struct brw_clip_prog_key { GLuint fill_ccw:2; /* includes cull information */ GLuint offset_cw:1; GLuint offset_ccw:1; - GLuint pad0:1; + GLuint pad0:17; GLuint copy_bfc_cw:1; GLuint copy_bfc_ccw:1; diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 397a9bd3f5c..badf178b68e 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -44,6 +44,8 @@ #include "api_noop.h" #include "vtxfmt.h" +#include "shader/shader_api.h" + /*************************************** * Mesa's Driver Functions ***************************************/ @@ -60,12 +62,57 @@ static const struct dri_extension brw_extensions[] = { NULL, NULL } }; +static void brwLinkProgram(GLcontext *ctx, GLuint program) +{ + struct brw_context *brw = brw_context(ctx); + struct brw_vertex_program *vert_prog; + struct brw_fragment_program *frag_prog; + struct gl_shader_program *sh_prog; + _mesa_link_program(ctx, program); + + sh_prog = _mesa_lookup_shader_program(ctx, program); + if (sh_prog) { + sh_prog->FragmentProgram = + _mesa_realloc(sh_prog->FragmentProgram, + sizeof(struct gl_fragment_program), + sizeof(struct brw_fragment_program)); + frag_prog = (struct brw_fragment_program *)sh_prog->FragmentProgram; + frag_prog->id = brw->program_id++; + sh_prog->VertexProgram = _mesa_realloc(sh_prog->VertexProgram, + sizeof(struct gl_vertex_program), + sizeof(struct brw_vertex_program)); + vert_prog = (struct brw_vertex_program *)sh_prog->VertexProgram; + vert_prog->id = brw->program_id++; + } +} + +static void brwUseProgram(GLcontext *ctx, GLuint program) +{ + struct brw_context *brw = brw_context(ctx); + struct gl_shader_program *sh_prog; + _mesa_use_program(ctx, program); + sh_prog = ctx->Shader.CurrentProgram; + if (sh_prog) { + ctx->VertexProgram.Enabled = GL_TRUE; + ctx->FragmentProgram.Enabled = GL_TRUE; + brw->attribs.VertexProgram->Current = sh_prog->VertexProgram; + brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram; + brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM; + brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM; + } +} +static void brwInitProgFuncs( struct dd_function_table *functions ) +{ + functions->UseProgram = brwUseProgram; + functions->LinkProgram = brwLinkProgram; +} static void brwInitDriverFunctions( struct dd_function_table *functions ) { intelInitDriverFunctions( functions ); brwInitTextureFuncs( functions ); brwInitFragProgFuncs( functions ); + brwInitProgFuncs( functions ); } diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 52f89d577ca..144f209edab 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -860,5 +860,6 @@ void brw_math_invert( struct brw_compile *p, struct brw_reg dst, struct brw_reg src); - +void brw_set_src1( struct brw_instruction *insn, + struct brw_reg reg ); #endif diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 9992b47d8ae..0c04bf6c624 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -164,7 +164,7 @@ static void brw_set_src0( struct brw_instruction *insn, } -static void brw_set_src1( struct brw_instruction *insn, +void brw_set_src1( struct brw_instruction *insn, struct brw_reg reg ) { assert(reg.file != BRW_MESSAGE_REGISTER_FILE); diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h index 29a4e80ce1b..18a4537c323 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.h +++ b/src/mesa/drivers/dri/i965/brw_gs.h @@ -40,11 +40,11 @@ #define MAX_GS_VERTS (4) struct brw_gs_prog_key { + GLuint attrs:32; GLuint primitive:4; - GLuint attrs:16; GLuint hint_gs_always:1; GLuint need_gs_prog:1; - GLuint pad:10; + GLuint pad:26; }; struct brw_gs_compile { diff --git a/src/mesa/drivers/dri/i965/brw_sf.h b/src/mesa/drivers/dri/i965/brw_sf.h index fb72b84ba8a..23b89684b24 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.h +++ b/src/mesa/drivers/dri/i965/brw_sf.h @@ -45,12 +45,12 @@ #define SF_UNFILLED_TRIS 3 struct brw_sf_prog_key { + GLuint attrs:32; GLuint primitive:2; GLuint do_twoside_color:1; GLuint do_flat_shading:1; - GLuint attrs:16; GLuint frontface_ccw:1; - GLuint pad:11; + GLuint pad:27; }; diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index fdb5785d67d..c31a1b63666 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -67,6 +67,7 @@ struct brw_vs_compile { struct brw_reg r1; struct brw_reg regs[PROGRAM_ADDRESS+1][128]; struct brw_reg tmp; + struct brw_reg ret; struct brw_reg userplane[6]; diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 6eb11b19ad2..613ee03b2ae 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -134,6 +134,17 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) WRITEMASK_X); reg++; } + + c->ret = brw_reg(BRW_GENERAL_REGISTER_FILE, + reg, + 0, + BRW_REGISTER_TYPE_D, + BRW_VERTICAL_STRIDE_8, + BRW_WIDTH_8, + BRW_HORIZONTAL_STRIDE_1, + BRW_SWIZZLE_XXXX, + WRITEMASK_X); + reg++; /* Some opcodes need an internal temporary: @@ -213,57 +224,68 @@ static void unalias2( struct brw_vs_compile *c, } } +static void emit_sop( struct brw_compile *p, + struct brw_reg dst, + struct brw_reg arg0, + struct brw_reg arg1, + GLuint cond) +{ + brw_push_insn_state(p); + brw_CMP(p, brw_null_reg(), cond, arg0, arg1); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + brw_MOV(p, dst, brw_imm_f(1.0f)); + brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); + brw_MOV(p, dst, brw_imm_f(0.0f)); + brw_pop_insn_state(p); +} +static void emit_seq( struct brw_compile *p, + struct brw_reg dst, + struct brw_reg arg0, + struct brw_reg arg1 ) +{ + emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_EQ); +} - +static void emit_sne( struct brw_compile *p, + struct brw_reg dst, + struct brw_reg arg0, + struct brw_reg arg1 ) +{ + emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_NEQ); +} static void emit_slt( struct brw_compile *p, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - /* Could be done with an if/else/endif, but this method uses half - * the instructions. Note that we are careful to reference the - * arguments before writing the dest. That means we emit the - * instructions in an odd order and have to play with the flag - * values. - */ - brw_push_insn_state(p); - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_GE, arg0, arg1); - - /* Write all values to 1: - */ - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_MOV(p, dst, brw_imm_f(1.0)); + emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_L); +} - /* Where the test succeeded, overwite with zero: - */ - brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); - brw_MOV(p, dst, brw_imm_f(0.0)); - brw_pop_insn_state(p); +static void emit_sle( struct brw_compile *p, + struct brw_reg dst, + struct brw_reg arg0, + struct brw_reg arg1 ) +{ + emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_LE); } +static void emit_sgt( struct brw_compile *p, + struct brw_reg dst, + struct brw_reg arg0, + struct brw_reg arg1 ) +{ + emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_G); +} static void emit_sge( struct brw_compile *p, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - brw_push_insn_state(p); - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_GE, arg0, arg1); - - /* Write all values to zero: - */ - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_MOV(p, dst, brw_imm_f(0)); - - /* Where the test succeeded, overwite with 1: - */ - brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); - brw_MOV(p, dst, brw_imm_f(1.0)); - brw_pop_insn_state(p); + emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_GE); } - static void emit_max( struct brw_compile *p, struct brw_reg dst, struct brw_reg arg0, @@ -592,9 +614,13 @@ static struct brw_reg get_reg( struct brw_vs_compile *c, case PROGRAM_TEMPORARY: case PROGRAM_INPUT: case PROGRAM_OUTPUT: - case PROGRAM_STATE_VAR: assert(c->regs[file][index].nr != 0); return c->regs[file][index]; + case PROGRAM_STATE_VAR: + case PROGRAM_CONSTANT: + case PROGRAM_UNIFORM: + assert(c->regs[PROGRAM_STATE_VAR][index].nr != 0); + return c->regs[PROGRAM_STATE_VAR][index]; case PROGRAM_ADDRESS: assert(index == 0); return c->regs[file][index]; @@ -891,17 +917,46 @@ static void emit_vertex_write( struct brw_vs_compile *c) } - - +static void +post_vs_emit( struct brw_vs_compile *c, struct brw_instruction *end_inst ) +{ + GLuint nr_insns = c->vp->program.Base.NumInstructions; + GLuint insn, target_insn; + struct prog_instruction *inst1, *inst2; + struct brw_instruction *brw_inst1, *brw_inst2; + int offset; + for (insn = 0; insn < nr_insns; insn++) { + inst1 = &c->vp->program.Base.Instructions[insn]; + brw_inst1 = inst1->Data; + switch (inst1->Opcode) { + case OPCODE_CAL: + case OPCODE_BRA: + target_insn = inst1->BranchTarget; + inst2 = &c->vp->program.Base.Instructions[target_insn]; + brw_inst2 = inst2->Data; + offset = brw_inst2 - brw_inst1; + brw_set_src1(brw_inst1, brw_imm_d(offset*16)); + break; + case OPCODE_END: + offset = end_inst - brw_inst1; + brw_set_src1(brw_inst1, brw_imm_d(offset*16)); + break; + default: + break; + } + } +} /* Emit the fragment program instructions here. */ -void brw_vs_emit( struct brw_vs_compile *c ) +void brw_vs_emit(struct brw_vs_compile *c ) { +#define MAX_IFSN 32 struct brw_compile *p = &c->func; GLuint nr_insns = c->vp->program.Base.NumInstructions; - GLuint insn; - + GLuint insn, if_insn = 0; + struct brw_instruction *end_inst; + struct brw_instruction *if_inst[32]; if (INTEL_DEBUG & DEBUG_VS) { _mesa_printf("\n\n\nvs-emit:\n"); @@ -924,6 +979,7 @@ void brw_vs_emit( struct brw_vs_compile *c ) /* Get argument regs. SWZ is special and does this itself. */ + inst->Data = &p->store[p->nr_insn]; if (inst->Opcode != OPCODE_SWZ) for (i = 0; i < 3; i++) args[i] = get_arg(c, inst->SrcReg[i]); @@ -934,7 +990,6 @@ void brw_vs_emit( struct brw_vs_compile *c ) */ dst = get_dst(c, inst->DstReg); - switch (inst->Opcode) { case OPCODE_ABS: brw_MOV(p, dst, brw_abs(args[0])); @@ -1003,12 +1058,25 @@ void brw_vs_emit( struct brw_vs_compile *c ) case OPCODE_RSQ: emit_math1(c, BRW_MATH_FUNCTION_RSQ, dst, args[0], BRW_MATH_PRECISION_FULL); break; + + case OPCODE_SEQ: + emit_seq(p, dst, args[0], args[1]); + break; + case OPCODE_SNE: + emit_sne(p, dst, args[0], args[1]); + break; case OPCODE_SGE: emit_sge(p, dst, args[0], args[1]); break; + case OPCODE_SGT: + emit_sgt(p, dst, args[0], args[1]); + break; case OPCODE_SLT: emit_slt(p, dst, args[0], args[1]); break; + case OPCODE_SLE: + emit_sle(p, dst, args[0], args[1]); + break; case OPCODE_SUB: brw_ADD(p, dst, args[0], negate(args[1])); break; @@ -1021,21 +1089,45 @@ void brw_vs_emit( struct brw_vs_compile *c ) case OPCODE_XPD: emit_xpd(p, dst, args[0], args[1]); break; + case OPCODE_IF: + assert(if_insn < MAX_IFSN); + if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8); + break; + case OPCODE_ELSE: + brw_ELSE(p, if_inst[if_insn]); + break; + case OPCODE_ENDIF: + assert(if_insn > 0); + brw_ENDIF(p, if_inst[--if_insn]); + break; + case OPCODE_BRA: + brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); + brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); + brw_set_predicate_control_flag_value(p, 0xFF); + break; + case OPCODE_CAL: + brw_ADD(p, c->ret, brw_ip_reg(), brw_imm_d(2*16)); + inst->Data = &p->store[p->nr_insn]; + brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); + break; + case OPCODE_RET: + brw_MOV(p, brw_ip_reg(), c->ret); case OPCODE_END: + brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); + break; case OPCODE_PRINT: + case OPCODE_BGNSUB: + case OPCODE_ENDSUB: break; default: + _mesa_printf("Unsupport opcode %d in vertex shader\n", inst->Opcode); break; } release_tmps(c); } + end_inst = &p->store[p->nr_insn]; emit_vertex_write(c); - + post_vs_emit(c, end_inst); } - - - - - diff --git a/src/mesa/drivers/dri/i965/brw_vs_tnl.c b/src/mesa/drivers/dri/i965/brw_vs_tnl.c index 35adc4846a0..bc0526fab61 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_tnl.c +++ b/src/mesa/drivers/dri/i965/brw_vs_tnl.c @@ -855,7 +855,7 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p, struct ureg slt = get_temp(p); emit_op2(p, OPCODE_DP3, spot, 0, ureg_negate(VPpli), spot_dir_norm); - emit_op2(p, OPCODE_SLT, slt, 0, swizzle1(spot_dir_norm,W), spot); + emit_op2(p, OPCODE_SLT, slt, 0, spot, swizzle1(spot_dir_norm,W)); emit_op2(p, OPCODE_POW, spot, 0, spot, swizzle1(attenuation, W)); emit_op2(p, OPCODE_MUL, att, 0, slt, spot); diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 1497dc79687..a02a0a23af6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -66,7 +66,11 @@ GLuint brw_wm_nr_args( GLuint opcode ) case OPCODE_POW: case OPCODE_SUB: case OPCODE_SGE: + case OPCODE_SGT: + case OPCODE_SLE: case OPCODE_SLT: + case OPCODE_SEQ: + case OPCODE_SNE: case OPCODE_ADD: case OPCODE_MAX: case OPCODE_MIN: diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index fd605159727..197a0ae13d2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -343,11 +343,10 @@ static void emit_lrp( struct brw_compile *p, } } } - - -static void emit_slt( struct brw_compile *p, +static void emit_sop( struct brw_compile *p, const struct brw_reg *dst, GLuint mask, + GLuint cond, const struct brw_reg *arg0, const struct brw_reg *arg1 ) { @@ -356,34 +355,66 @@ static void emit_slt( struct brw_compile *p, for (i = 0; i < 4; i++) { if (mask & (1<opcode); } for (i = 0; i < 4; i++) diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c index 00f6f6b9a4f..1bfae5a069b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c @@ -168,6 +168,7 @@ static const struct brw_wm_ref *pass0_get_reg( struct brw_wm_compile *c, case PROGRAM_PAYLOAD: case PROGRAM_TEMPORARY: case PROGRAM_OUTPUT: + case PROGRAM_VARYING: break; case PROGRAM_LOCAL_PARAM: @@ -179,6 +180,8 @@ static const struct brw_wm_ref *pass0_get_reg( struct brw_wm_compile *c, break; case PROGRAM_STATE_VAR: + case PROGRAM_UNIFORM: + case PROGRAM_CONSTANT: case PROGRAM_NAMED_PARAM: { struct gl_program_parameter_list *plist = c->fp->program.Base.Parameters; @@ -197,6 +200,7 @@ static const struct brw_wm_ref *pass0_get_reg( struct brw_wm_compile *c, break; case PROGRAM_STATE_VAR: + case PROGRAM_UNIFORM: /* These may change from run to run: */ ref = get_param_ref(c, &plist->ParameterValues[idx][component] ); diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass1.c b/src/mesa/drivers/dri/i965/brw_wm_pass1.c index d668def7007..26c044d4002 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass1.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass1.c @@ -155,7 +155,11 @@ void brw_wm_pass1( struct brw_wm_compile *c ) case OPCODE_SUB: case OPCODE_SLT: + case OPCODE_SLE: case OPCODE_SGE: + case OPCODE_SGT: + case OPCODE_SEQ: + case OPCODE_SNE: case OPCODE_ADD: case OPCODE_MAX: case OPCODE_MIN: @@ -257,7 +261,6 @@ void brw_wm_pass1( struct brw_wm_compile *c ) case OPCODE_DST: case OPCODE_TXP: default: - assert(0); break; } diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index 10eb9a2e28d..a94c1dc6d5b 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -81,6 +81,7 @@ int INTEL_DEBUG = (0); #define need_GL_EXT_fog_coord #define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_secondary_color +#define need_GL_VERSION_2_0 #include "extension_helper.h" #ifndef VERBOSE @@ -180,6 +181,9 @@ const struct dri_extension card_extensions[] = { "GL_MESA_ycbcr_texture", NULL }, { "GL_NV_blend_square", NULL }, { "GL_SGIS_generate_mipmap", NULL }, + { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions}, + /* XXX not implement yet, to compile builtin glsl lib */ + { "GL_ARB_draw_buffers", NULL }, { NULL, NULL } }; diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index fe6b615c5d6..30f044e77c8 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -1746,6 +1746,7 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var) n->Store->File = PROGRAM_TEMPORARY; n->Store->Size = _slang_sizeof_type_specifier(&n->Var->type.specifier); + A->program->NumTemporaries++; assert(n->Store->Size > 0); } return n; -- cgit v1.2.3 From a78b26fff04026a24189ecad7ec85bfe0df2cce1 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Mon, 30 Apr 2007 15:24:38 +0800 Subject: support nested function call else instruction fix. --- src/mesa/drivers/dri/i965/brw_vs.h | 2 +- src/mesa/drivers/dri/i965/brw_vs_emit.c | 30 ++++++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index c31a1b63666..912ab563f4d 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -67,7 +67,7 @@ struct brw_vs_compile { struct brw_reg r1; struct brw_reg regs[PROGRAM_ADDRESS+1][128]; struct brw_reg tmp; - struct brw_reg ret; + struct brw_reg stack; struct brw_reg userplane[6]; diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 613ee03b2ae..f8367c48266 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -135,16 +135,8 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) reg++; } - c->ret = brw_reg(BRW_GENERAL_REGISTER_FILE, - reg, - 0, - BRW_REGISTER_TYPE_D, - BRW_VERTICAL_STRIDE_8, - BRW_WIDTH_8, - BRW_HORIZONTAL_STRIDE_1, - BRW_SWIZZLE_XXXX, - WRITEMASK_X); - reg++; + c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, reg, 0); + reg += 2; /* Some opcodes need an internal temporary: @@ -956,7 +948,8 @@ void brw_vs_emit(struct brw_vs_compile *c ) GLuint nr_insns = c->vp->program.Base.NumInstructions; GLuint insn, if_insn = 0; struct brw_instruction *end_inst; - struct brw_instruction *if_inst[32]; + struct brw_instruction *if_inst[MAX_IFSN]; + struct brw_indirect stack_index = brw_indirect(0, 0); if (INTEL_DEBUG & DEBUG_VS) { _mesa_printf("\n\n\nvs-emit:\n"); @@ -970,6 +963,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) /* Static register allocation */ brw_vs_alloc_regs(c); + brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack)); for (insn = 0; insn < nr_insns; insn++) { @@ -1094,7 +1088,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8); break; case OPCODE_ELSE: - brw_ELSE(p, if_inst[if_insn]); + if_inst[if_insn-1] = brw_ELSE(p, if_inst[if_insn-1]); break; case OPCODE_ENDIF: assert(if_insn > 0); @@ -1106,12 +1100,20 @@ void brw_vs_emit(struct brw_vs_compile *c ) brw_set_predicate_control_flag_value(p, 0xFF); break; case OPCODE_CAL: - brw_ADD(p, c->ret, brw_ip_reg(), brw_imm_d(2*16)); + brw_set_access_mode(p, BRW_ALIGN_1); + brw_ADD(p, deref_1uw(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16)); + brw_set_access_mode(p, BRW_ALIGN_16); + brw_ADD(p, get_addr_reg(stack_index), + get_addr_reg(stack_index), brw_imm_d(4)); inst->Data = &p->store[p->nr_insn]; brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); break; case OPCODE_RET: - brw_MOV(p, brw_ip_reg(), c->ret); + brw_ADD(p, get_addr_reg(stack_index), + get_addr_reg(stack_index), brw_imm_d(-4)); + brw_set_access_mode(p, BRW_ALIGN_1); + brw_MOV(p, brw_ip_reg(), deref_1uw(stack_index, 0)); + brw_set_access_mode(p, BRW_ALIGN_16); case OPCODE_END: brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); break; -- cgit v1.2.3 From 58eac1bbf320b4104c3158aaeca4726f1a59daf9 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Wed, 9 May 2007 10:08:10 +0800 Subject: Support loop, conditional update fix --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index f8367c48266..ffc1a0ea09f 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -921,8 +921,10 @@ post_vs_emit( struct brw_vs_compile *c, struct brw_instruction *end_inst ) inst1 = &c->vp->program.Base.Instructions[insn]; brw_inst1 = inst1->Data; switch (inst1->Opcode) { - case OPCODE_CAL: case OPCODE_BRA: + case OPCODE_BRK: + case OPCODE_CAL: + case OPCODE_ENDLOOP: target_insn = inst1->BranchTarget; inst2 = &c->vp->program.Base.Instructions[target_insn]; brw_inst2 = inst2->Data; @@ -943,12 +945,12 @@ post_vs_emit( struct brw_vs_compile *c, struct brw_instruction *end_inst ) */ void brw_vs_emit(struct brw_vs_compile *c ) { -#define MAX_IFSN 32 +#define MAX_IF_DEPTH 32 struct brw_compile *p = &c->func; GLuint nr_insns = c->vp->program.Base.NumInstructions; GLuint insn, if_insn = 0; struct brw_instruction *end_inst; - struct brw_instruction *if_inst[MAX_IFSN]; + struct brw_instruction *if_inst[MAX_IF_DEPTH]; struct brw_indirect stack_index = brw_indirect(0, 0); if (INTEL_DEBUG & DEBUG_VS) { @@ -1083,8 +1085,13 @@ void brw_vs_emit(struct brw_vs_compile *c ) case OPCODE_XPD: emit_xpd(p, dst, args[0], args[1]); break; + + case OPCODE_INT: + /* XXX TODO track type information in shader program */ + brw_MOV(p, dst, args[0]); + break; case OPCODE_IF: - assert(if_insn < MAX_IFSN); + assert(if_insn < MAX_IF_DEPTH); if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8); break; case OPCODE_ELSE: @@ -1094,11 +1101,6 @@ void brw_vs_emit(struct brw_vs_compile *c ) assert(if_insn > 0); brw_ENDIF(p, if_inst[--if_insn]); break; - case OPCODE_BRA: - brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); - brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); - brw_set_predicate_control_flag_value(p, 0xFF); - break; case OPCODE_CAL: brw_set_access_mode(p, BRW_ALIGN_1); brw_ADD(p, deref_1uw(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16)); @@ -1114,9 +1116,13 @@ void brw_vs_emit(struct brw_vs_compile *c ) brw_set_access_mode(p, BRW_ALIGN_1); brw_MOV(p, brw_ip_reg(), deref_1uw(stack_index, 0)); brw_set_access_mode(p, BRW_ALIGN_16); + case OPCODE_ENDLOOP: + case OPCODE_BRK: + case OPCODE_BRA: case OPCODE_END: brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); break; + case OPCODE_BGNLOOP: case OPCODE_PRINT: case OPCODE_BGNSUB: case OPCODE_ENDSUB: @@ -1125,7 +1131,8 @@ void brw_vs_emit(struct brw_vs_compile *c ) _mesa_printf("Unsupport opcode %d in vertex shader\n", inst->Opcode); break; } - + brw_set_predicate_control(p, + inst->CondUpdate?BRW_PREDICATE_NORMAL:BRW_PREDICATE_NONE); release_tmps(c); } -- cgit v1.2.3 From d19d0596daf004b56d80f78fa1a329b43c2ebf94 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Thu, 21 Jun 2007 10:22:28 +0800 Subject: support branch and loop in pixel shader most of the sample working with some small modification --- progs/glsl/CH06-brick.frag.txt | 6 +- progs/glsl/CH11-bumpmap.frag.txt | 2 +- progs/glsl/CH11-bumpmap.vert.txt | 9 +- progs/glsl/CH11-toyball.frag.txt | 7 +- progs/glsl/CH11-toyball.vert.txt | 7 +- src/mesa/drivers/dri/i965/Makefile | 1 + src/mesa/drivers/dri/i965/brw_eu.h | 8 +- src/mesa/drivers/dri/i965/brw_eu_emit.c | 28 +- src/mesa/drivers/dri/i965/brw_vs.h | 5 + src/mesa/drivers/dri/i965/brw_vs_emit.c | 84 ++- src/mesa/drivers/dri/i965/brw_wm.c | 80 +- src/mesa/drivers/dri/i965/brw_wm.h | 10 + src/mesa/drivers/dri/i965/brw_wm_emit.c | 28 +- src/mesa/drivers/dri/i965/brw_wm_fp.c | 16 +- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 1177 ++++++++++++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm_pass2.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_state.c | 7 +- 17 files changed, 1365 insertions(+), 112 deletions(-) create mode 100644 src/mesa/drivers/dri/i965/brw_wm_glsl.c (limited to 'src/mesa') diff --git a/progs/glsl/CH06-brick.frag.txt b/progs/glsl/CH06-brick.frag.txt index 06ef04e3afb..388c5f9e660 100644 --- a/progs/glsl/CH06-brick.frag.txt +++ b/progs/glsl/CH06-brick.frag.txt @@ -23,7 +23,11 @@ void main() position = MCposition / BrickSize; - if (fract(position.y * 0.5) > 0.5) +// if (fract(position.y * 0.5) > 0.5) +// position.x += 0.5; + float tmp; + tmp = fract(position.y * 0.5); + if (tmp > 0.5) position.x += 0.5; position = fract(position); diff --git a/progs/glsl/CH11-bumpmap.frag.txt b/progs/glsl/CH11-bumpmap.frag.txt index 063576f5a3c..1467f767ec4 100644 --- a/progs/glsl/CH11-bumpmap.frag.txt +++ b/progs/glsl/CH11-bumpmap.frag.txt @@ -33,7 +33,7 @@ void main() litColor = SurfaceColor * max(dot(normDelta, LightDir), 0.0); vec3 reflectDir = reflect(LightDir, normDelta); - float spec = max(dot(EyeDir, reflectDir), 0.0); + float spec = max(dot(normalize(EyeDir), reflectDir), 0.0); spec *= SpecularFactor; litColor = min(litColor + spec, vec3(1.0)); diff --git a/progs/glsl/CH11-bumpmap.vert.txt b/progs/glsl/CH11-bumpmap.vert.txt index d3d19f62ac3..55cf43ba7dd 100644 --- a/progs/glsl/CH11-bumpmap.vert.txt +++ b/progs/glsl/CH11-bumpmap.vert.txt @@ -31,8 +31,9 @@ void main() v.z = dot(LightPosition, n); LightDir = normalize(v); - v.x = dot(EyeDir, t); - v.y = dot(EyeDir, b); - v.z = dot(EyeDir, n); - EyeDir = normalize(v); +/* v.x = dot(EyeDir, t); + v.y = dot(EyeDir, b); + v.z = dot(EyeDir, n); + EyeDir = normalize(EyeDir); +*/ } diff --git a/progs/glsl/CH11-toyball.frag.txt b/progs/glsl/CH11-toyball.frag.txt index 90ec1c27fc1..f3cac62fb3e 100644 --- a/progs/glsl/CH11-toyball.frag.txt +++ b/progs/glsl/CH11-toyball.frag.txt @@ -49,14 +49,15 @@ void main() inorout += dot(distance, vec4(1.0)); distance.x = dot(p, HalfSpace4); - distance.y = StripeWidth - abs(p.z); +// distance.y = StripeWidth - abs(p.z); + distance.y = StripeWidth - abs(p.y); distance = smoothstep(-FWidth, FWidth, distance); inorout += distance.x; inorout = clamp(inorout, 0.0, 1.0); - surfColor = mix(Yellow, Red, inorout); - surfColor = mix(surfColor, Blue, distance.y); + surfColor = mix(Yellow, Blue, distance.y); + surfColor = mix(surfColor, Red, inorout); // normal = point on surface for sphere at (0,0,0) normal = p; diff --git a/progs/glsl/CH11-toyball.vert.txt b/progs/glsl/CH11-toyball.vert.txt index b7da3ac839e..a3ee1b03776 100644 --- a/progs/glsl/CH11-toyball.vert.txt +++ b/progs/glsl/CH11-toyball.vert.txt @@ -14,10 +14,11 @@ uniform vec4 BallCenter; // ball center in modelling coordinates void main() { -//orig: ECposition = gl_ModelViewMatrix * gl_Vertex; + ECposition = gl_ModelViewMatrix * gl_Vertex; - ECposition = gl_TextureMatrix[0] * gl_Vertex; - ECposition = gl_ModelViewMatrix * ECposition; +// ECposition = gl_TextureMatrix[0] * gl_Vertex; +// ECposition = gl_MultiTexCoord0 * gl_Vertex; +// ECposition = gl_ModelViewMatrix * ECposition; ECballCenter = gl_ModelViewMatrix * BallCenter; gl_Position = ftransform(); diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 9e4ff112dc3..66de6f583c3 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -70,6 +70,7 @@ DRIVER_SOURCES = \ brw_wm_emit.c \ brw_wm_fp.c \ brw_wm_iz.c \ + brw_wm_glsl.c \ brw_wm_pass0.c \ brw_wm_pass1.c \ brw_wm_pass2.c \ diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 144f209edab..9b6581fd932 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -668,7 +668,10 @@ static __inline struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offse return ptr; } - +static __inline struct brw_instruction *current_insn( struct brw_compile *p) +{ + return &p->store[p->nr_insn]; +} void brw_pop_insn_state( struct brw_compile *p ); void brw_push_insn_state( struct brw_compile *p ); @@ -808,9 +811,10 @@ void brw_ENDIF(struct brw_compile *p, struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size); -void brw_WHILE(struct brw_compile *p, +struct brw_instruction *brw_WHILE(struct brw_compile *p, struct brw_instruction *patch_insn); +struct brw_instruction *brw_BREAK(struct brw_compile *p); /* Forward jumps: */ void brw_land_fwd_jump(struct brw_compile *p, diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 0c04bf6c624..7b95fbdac03 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -186,7 +186,7 @@ void brw_set_src1( struct brw_instruction *insn, * in the future: */ assert (reg.address_mode == BRW_ADDRESS_DIRECT); - assert (reg.file == BRW_GENERAL_REGISTER_FILE); + //assert (reg.file == BRW_GENERAL_REGISTER_FILE); if (insn->header.access_mode == BRW_ALIGN_1) { insn->bits3.da1.src1_subreg_nr = reg.subnr; @@ -597,6 +597,20 @@ void brw_ENDIF(struct brw_compile *p, } } +struct brw_instruction *brw_BREAK(struct brw_compile *p) +{ + struct brw_instruction *insn; + insn = next_insn(p, BRW_OPCODE_BREAK); + brw_set_dest(insn, brw_ip_reg()); + brw_set_src0(insn, brw_ip_reg()); + brw_set_src1(insn, brw_imm_d(0x0)); + insn->header.compression_control = BRW_COMPRESSION_NONE; + insn->header.execution_size = BRW_EXECUTE_8; + insn->header.mask_control = BRW_MASK_DISABLE; + insn->bits3.if_else.pad0 = 0; + return insn; +} + /* DO/WHILE loop: */ struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size) @@ -608,13 +622,15 @@ struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size) /* Override the defaults for this instruction: */ - brw_set_dest(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src0(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src1(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD)); + brw_set_dest(insn, brw_null_reg()); + brw_set_src0(insn, brw_null_reg()); + brw_set_src1(insn, brw_null_reg()); insn->header.compression_control = BRW_COMPRESSION_NONE; insn->header.execution_size = execute_size; + insn->header.predicate_control = BRW_PREDICATE_NONE; /* insn->header.mask_control = BRW_MASK_ENABLE; */ + insn->header.mask_control = BRW_MASK_DISABLE; return insn; } @@ -622,7 +638,7 @@ struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size) -void brw_WHILE(struct brw_compile *p, +struct brw_instruction *brw_WHILE(struct brw_compile *p, struct brw_instruction *do_insn) { struct brw_instruction *insn; @@ -653,7 +669,9 @@ void brw_WHILE(struct brw_compile *p, /* insn->header.mask_control = BRW_MASK_ENABLE; */ + insn->header.mask_control = BRW_MASK_DISABLE; p->current->header.predicate_control = BRW_PREDICATE_NONE; + return insn; } diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index 912ab563f4d..36636b5ffd6 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -69,6 +69,11 @@ struct brw_vs_compile { struct brw_reg tmp; struct brw_reg stack; + struct { + GLboolean used_in_src; + struct brw_reg reg; + } output_regs[128]; + struct brw_reg userplane[6]; }; diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index ffc1a0ea09f..fa94d5b1a87 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -135,6 +135,13 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) reg++; } + for (i = 0; i < 128; i++) { + if (c->output_regs[i].used_in_src) { + c->regs[PROGRAM_OUTPUT][i] = brw_vec8_grf(reg, 0); + reg++; + } + } + c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, reg, 0); reg += 2; @@ -686,28 +693,28 @@ static void emit_arl( struct brw_vs_compile *c, * account. */ static struct brw_reg get_arg( struct brw_vs_compile *c, - struct prog_src_register src ) + struct prog_src_register *src ) { struct brw_reg reg; - if (src.File == PROGRAM_UNDEFINED) + if (src->File == PROGRAM_UNDEFINED) return brw_null_reg(); - if (src.RelAddr) - reg = deref(c, c->regs[PROGRAM_STATE_VAR][0], src.Index); + if (src->RelAddr) + reg = deref(c, c->regs[PROGRAM_STATE_VAR][0], src->Index); else - reg = get_reg(c, src.File, src.Index); + reg = get_reg(c, src->File, src->Index); /* Convert 3-bit swizzle to 2-bit. */ - reg.dw1.bits.swizzle = BRW_SWIZZLE4(GET_SWZ(src.Swizzle, 0), - GET_SWZ(src.Swizzle, 1), - GET_SWZ(src.Swizzle, 2), - GET_SWZ(src.Swizzle, 3)); + reg.dw1.bits.swizzle = BRW_SWIZZLE4(GET_SWZ(src->Swizzle, 0), + GET_SWZ(src->Swizzle, 1), + GET_SWZ(src->Swizzle, 2), + GET_SWZ(src->Swizzle, 3)); /* Note this is ok for non-swizzle instructions: */ - reg.negate = src.NegateBase ? 1 : 0; + reg.negate = src->NegateBase ? 1 : 0; return reg; } @@ -921,10 +928,8 @@ post_vs_emit( struct brw_vs_compile *c, struct brw_instruction *end_inst ) inst1 = &c->vp->program.Base.Instructions[insn]; brw_inst1 = inst1->Data; switch (inst1->Opcode) { - case OPCODE_BRA: - case OPCODE_BRK: case OPCODE_CAL: - case OPCODE_ENDLOOP: + case OPCODE_BRA: target_insn = inst1->BranchTarget; inst2 = &c->vp->program.Base.Instructions[target_insn]; brw_inst2 = inst2->Data; @@ -945,12 +950,12 @@ post_vs_emit( struct brw_vs_compile *c, struct brw_instruction *end_inst ) */ void brw_vs_emit(struct brw_vs_compile *c ) { -#define MAX_IF_DEPTH 32 +#define MAX_IFSN 32 struct brw_compile *p = &c->func; GLuint nr_insns = c->vp->program.Base.NumInstructions; GLuint insn, if_insn = 0; struct brw_instruction *end_inst; - struct brw_instruction *if_inst[MAX_IF_DEPTH]; + struct brw_instruction *if_inst[MAX_IFSN]; struct brw_indirect stack_index = brw_indirect(0, 0); if (INTEL_DEBUG & DEBUG_VS) { @@ -962,6 +967,20 @@ void brw_vs_emit(struct brw_vs_compile *c ) brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_set_access_mode(p, BRW_ALIGN_16); + /* Message registers can't be read, so copy the output into GRF register + if they are used in source registers */ + for (insn = 0; insn < nr_insns; insn++) { + GLuint i; + struct prog_instruction *inst = &c->vp->program.Base.Instructions[insn]; + for (i = 0; i < 3; i++) { + struct prog_src_register *src = &inst->SrcReg[i]; + GLuint index = src->Index; + GLuint file = src->File; + if (file == PROGRAM_OUTPUT && index != VERT_RESULT_HPOS) + c->output_regs[index].used_in_src = GL_TRUE; + } + } + /* Static register allocation */ brw_vs_alloc_regs(c); @@ -977,8 +996,15 @@ void brw_vs_emit(struct brw_vs_compile *c ) */ inst->Data = &p->store[p->nr_insn]; if (inst->Opcode != OPCODE_SWZ) - for (i = 0; i < 3; i++) - args[i] = get_arg(c, inst->SrcReg[i]); + for (i = 0; i < 3; i++) { + struct prog_src_register *src = &inst->SrcReg[i]; + GLuint index = src->Index; + GLuint file = src->File; + if (file == PROGRAM_OUTPUT&&c->output_regs[index].used_in_src) + args[i] = c->output_regs[index].reg; + else + args[i] = get_arg(c, src); + } /* Get dest regs. Note that it is possible for a reg to be both * dst and arg, given the static allocation of registers. So @@ -1085,13 +1111,8 @@ void brw_vs_emit(struct brw_vs_compile *c ) case OPCODE_XPD: emit_xpd(p, dst, args[0], args[1]); break; - - case OPCODE_INT: - /* XXX TODO track type information in shader program */ - brw_MOV(p, dst, args[0]); - break; case OPCODE_IF: - assert(if_insn < MAX_IF_DEPTH); + assert(if_insn < MAX_IFSN); if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8); break; case OPCODE_ELSE: @@ -1101,6 +1122,11 @@ void brw_vs_emit(struct brw_vs_compile *c ) assert(if_insn > 0); brw_ENDIF(p, if_inst[--if_insn]); break; + case OPCODE_BRA: + brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); + brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); + brw_set_predicate_control_flag_value(p, 0xff); + break; case OPCODE_CAL: brw_set_access_mode(p, BRW_ALIGN_1); brw_ADD(p, deref_1uw(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16)); @@ -1116,13 +1142,9 @@ void brw_vs_emit(struct brw_vs_compile *c ) brw_set_access_mode(p, BRW_ALIGN_1); brw_MOV(p, brw_ip_reg(), deref_1uw(stack_index, 0)); brw_set_access_mode(p, BRW_ALIGN_16); - case OPCODE_ENDLOOP: - case OPCODE_BRK: - case OPCODE_BRA: case OPCODE_END: brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); break; - case OPCODE_BGNLOOP: case OPCODE_PRINT: case OPCODE_BGNSUB: case OPCODE_ENDSUB: @@ -1131,8 +1153,12 @@ void brw_vs_emit(struct brw_vs_compile *c ) _mesa_printf("Unsupport opcode %d in vertex shader\n", inst->Opcode); break; } - brw_set_predicate_control(p, - inst->CondUpdate?BRW_PREDICATE_NORMAL:BRW_PREDICATE_NONE); + + if (inst->DstReg.File == PROGRAM_OUTPUT + &&inst->DstReg.Index != VERT_RESULT_HPOS + &&c->output_regs[inst->DstReg.Index].used_in_src) + brw_MOV(p, get_dst(c, inst->DstReg), dst); + release_tmps(c); } diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index a02a0a23af6..45ba4eaf322 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -154,47 +154,49 @@ static void do_wm_prog( struct brw_context *brw, c->fp = fp; c->env_param = brw->intel.ctx.FragmentProgram.Parameters; - - /* Augment fragment program. Add instructions for pre- and - * post-fragment-program tasks such as interpolation and fogging. - */ - brw_wm_pass_fp(c); - - /* Translate to intermediate representation. Build register usage - * chains. - */ - brw_wm_pass0(c); - - /* Dead code removal. - */ - brw_wm_pass1(c); - - /* Hal optimization - */ - brw_wm_pass_hal (c); - - /* Register allocation. - */ - c->grf_limit = BRW_WM_MAX_GRF/2; - - /* This is where we start emitting gen4 code: - */ - brw_init_compile(&c->func); - - brw_wm_pass2(c); - - c->prog_data.total_grf = c->max_wm_grf; - if (c->last_scratch) { - c->prog_data.total_scratch = - c->last_scratch + 0x40; + if (brw_wm_is_glsl(&c->fp->program)) { + brw_wm_glsl_emit(c); } else { - c->prog_data.total_scratch = 0; + /* Augment fragment program. Add instructions for pre- and + * post-fragment-program tasks such as interpolation and fogging. + */ + brw_wm_pass_fp(c); + + /* Translate to intermediate representation. Build register usage + * chains. + */ + brw_wm_pass0(c); + + /* Dead code removal. + */ + brw_wm_pass1(c); + + /* Hal optimization + */ + brw_wm_pass_hal (c); + + /* Register allocation. + */ + c->grf_limit = BRW_WM_MAX_GRF/2; + + /* This is where we start emitting gen4 code: + */ + brw_init_compile(&c->func); + + brw_wm_pass2(c); + + c->prog_data.total_grf = c->max_wm_grf; + if (c->last_scratch) { + c->prog_data.total_scratch = + c->last_scratch + 0x40; + } else { + c->prog_data.total_scratch = 0; + } + + /* Emit GEN4 code. + */ + brw_wm_emit(c); } - - /* Emit GEN4 code. - */ - brw_wm_emit(c); - /* get the program */ program = brw_get_program(&c->func, &program_size); diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index f5fddfdb68a..4143d5be6cb 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -231,6 +231,14 @@ struct brw_wm_compile { GLuint grf_limit; GLuint max_wm_grf; GLuint last_scratch; + + struct { + GLboolean inited; + struct brw_reg reg; + } wm_regs[PROGRAM_PAYLOAD+1][256][4]; + struct brw_reg ret_reg; + GLuint reg_index; + GLuint tmp_index; }; @@ -259,4 +267,6 @@ void brw_wm_lookup_iz( GLuint line_aa, GLuint lookup, struct brw_wm_prog_key *key ); +GLboolean brw_wm_is_glsl(struct gl_fragment_program *fp); +void brw_wm_glsl_emit(struct brw_wm_compile *c); #endif diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 197a0ae13d2..5660b555162 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -229,20 +229,20 @@ static void emit_cinterp( struct brw_compile *p, GLuint mask, const struct brw_reg *arg0 ) { - struct brw_reg interp[4]; - GLuint nr = arg0[0].nr; - GLuint i; - - interp[0] = brw_vec1_grf(nr, 0); - interp[1] = brw_vec1_grf(nr, 4); - interp[2] = brw_vec1_grf(nr+1, 0); - interp[3] = brw_vec1_grf(nr+1, 4); - - for(i = 0; i < 4; i++ ) { - if (mask & (1<Data = (void *)inst0; return inst; } @@ -201,7 +202,6 @@ static struct prog_instruction * emit_op(struct brw_wm_compile *c, inst->SrcReg[0] = src0; inst->SrcReg[1] = src1; inst->SrcReg[2] = src2; - return inst; } @@ -907,8 +907,10 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) */ out->DstReg.WriteMask = 0; break; - case OPCODE_END: + emit_fog(c); + emit_fb_write(c); + break; case OPCODE_PRINT: break; @@ -917,15 +919,11 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) break; } } - - emit_fog(c); - emit_fb_write(c); - if (INTEL_DEBUG & DEBUG_WM) { - _mesa_printf("\n\n\npass_fp:\n"); - print_insns( c->prog_instructions, c->nr_fp_insns ); - _mesa_printf("\n"); + _mesa_printf("\n\n\npass_fp:\n"); + print_insns( c->prog_instructions, c->nr_fp_insns ); + _mesa_printf("\n"); } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c new file mode 100644 index 00000000000..cdd79766076 --- /dev/null +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -0,0 +1,1177 @@ +#include "macros.h" +#include "shader/prog_parameter.h" +#include "brw_context.h" +#include "brw_eu.h" +#include "brw_wm.h" + +/* Only guess, need a flag in gl_fragment_program later */ +GLboolean brw_wm_is_glsl(struct gl_fragment_program *fp) +{ + int i; + for (i = 0; i < fp->Base.NumInstructions; i++) { + struct prog_instruction *inst = &fp->Base.Instructions[i]; + switch (inst->Opcode) { + case OPCODE_IF: + case OPCODE_ENDIF: + case OPCODE_CAL: + case OPCODE_BRK: + case OPCODE_RET: + case OPCODE_BGNLOOP: + return GL_TRUE; + default: + break; + } + } + return GL_FALSE; +} + +static void set_reg(struct brw_wm_compile *c, int file, int index, + int component, struct brw_reg reg) +{ + c->wm_regs[file][index][component].reg = reg; + c->wm_regs[file][index][component].inited = GL_TRUE; +} + +static int get_scalar_dst_index(struct prog_instruction *inst) +{ + int i; + for (i = 0; i < 4; i++) + if (inst->DstReg.WriteMask & (1<tmp_index--, 0); + return reg; +} + +static void release_tmps(struct brw_wm_compile *c) +{ + c->tmp_index = 127; +} + +static struct brw_reg +get_reg(struct brw_wm_compile *c, int file, int index, int component, int nr, GLuint neg, GLuint abs) +{ + struct brw_reg reg; + switch (file) { + case PROGRAM_STATE_VAR: + case PROGRAM_CONSTANT: + case PROGRAM_UNIFORM: + file = PROGRAM_STATE_VAR; + break; + case PROGRAM_UNDEFINED: + return brw_null_reg(); + default: + break; + } + + if(c->wm_regs[file][index][component].inited) + reg = c->wm_regs[file][index][component].reg; + else + reg = brw_vec8_grf(c->reg_index, 0); + + if(!c->wm_regs[file][index][component].inited) { + set_reg(c, file, index, component, reg); + c->reg_index++; + } + + if (neg & (1<< component)) { + reg = negate(reg); + } + if (abs) + reg = brw_abs(reg); + return reg; +} + +static void prealloc_reg(struct brw_wm_compile *c) +{ + int i, j; + struct brw_reg reg; + int nr_interp_regs = 0; + GLuint inputs = FRAG_BIT_WPOS | c->fp_interp_emitted; + + for (i = 0; i < 4; i++) { + reg = (i < c->key.nr_depth_regs) + ? brw_vec8_grf(i*2, 0) : brw_vec8_grf(0, 0); + set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, reg); + } + c->reg_index += 2*c->key.nr_depth_regs; + { + int nr_params = c->fp->program.Base.Parameters->NumParameters; + struct gl_program_parameter_list *plist = + c->fp->program.Base.Parameters; + int index = 0; + c->prog_data.nr_params = 4*nr_params; + for (i = 0; i < nr_params; i++) { + for (j = 0; j < 4; j++, index++) { + reg = brw_vec1_grf(c->reg_index + index/8, + index%8); + c->prog_data.param[index] = + &plist->ParameterValues[i][j]; + set_reg(c, PROGRAM_STATE_VAR, i, j, reg); + } + } + c->nr_creg = 2*((4*nr_params+15)/16); + c->reg_index += c->nr_creg; + } + for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + if (inputs & (1<reg_index, 0); + for (j = 0; j < 4; j++) + set_reg(c, PROGRAM_PAYLOAD, i, j, reg); + c->reg_index += 2; + + } + } + c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2; + c->prog_data.urb_read_length = nr_interp_regs * 2; + c->prog_data.curb_read_length = c->nr_creg; + c->ret_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0); + c->reg_index++; +} + +static struct brw_reg get_dst_reg(struct brw_wm_compile *c, + struct prog_instruction *inst, int component, int nr) +{ + return get_reg(c, inst->DstReg.File, inst->DstReg.Index, component, nr, + 0, 0); +} + +static struct brw_reg get_src_reg(struct brw_wm_compile *c, + struct prog_src_register *src, int index, int nr) +{ + int component = GET_SWZ(src->Swizzle, index); + return get_reg(c, src->File, src->Index, component, nr, + src->NegateBase, src->Abs); +} + +static void emit_abs( struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + int i; + struct brw_compile *p = &c->func; + brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); + for (i = 0; i < 4; i++) { + if (inst->DstReg.WriteMask & (1<SrcReg[0], i, 1); + brw_MOV(p, dst, brw_abs(src)); + } + } + brw_set_saturate(p, 0); +} + +static void emit_mov( struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + int i; + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); + for (i = 0; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + brw_MOV(p, dst, src); + } + } + brw_set_saturate(p, 0); +} + +static void emit_pixel_xy(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_reg r1 = brw_vec1_grf(1, 0); + struct brw_reg r1_uw = retype(r1, BRW_REGISTER_TYPE_UW); + + struct brw_reg dst0, dst1; + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + + dst0 = get_dst_reg(c, inst, 0, 1); + dst1 = get_dst_reg(c, inst, 1, 1); + /* Calculate pixel centers by adding 1 or 0 to each of the + * micro-tile coordinates passed in r1. + */ + if (mask & WRITEMASK_X) { + brw_ADD(p, + vec8(retype(dst0, BRW_REGISTER_TYPE_UW)), + stride(suboffset(r1_uw, 4), 2, 4, 0), + brw_imm_v(0x10101010)); + } + + if (mask & WRITEMASK_Y) { + brw_ADD(p, + vec8(retype(dst1, BRW_REGISTER_TYPE_UW)), + stride(suboffset(r1_uw, 5), 2, 4, 0), + brw_imm_v(0x11001100)); + } + +} + +static void emit_delta_xy(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_reg r1 = brw_vec1_grf(1, 0); + struct brw_reg dst0, dst1, src0, src1; + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + + dst0 = get_dst_reg(c, inst, 0, 1); + dst1 = get_dst_reg(c, inst, 1, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); + src1 = get_src_reg(c, &inst->SrcReg[0], 1, 1); + /* Calc delta X,Y by subtracting origin in r1 from the pixel + * centers. + */ + if (mask & WRITEMASK_X) { + brw_ADD(p, + dst0, + retype(src0, BRW_REGISTER_TYPE_UW), + negate(r1)); + } + + if (mask & WRITEMASK_Y) { + brw_ADD(p, + dst1, + retype(src1, BRW_REGISTER_TYPE_UW), + negate(suboffset(r1,1))); + + } + +} + + +static void fire_fb_write( struct brw_wm_compile *c, + GLuint base_reg, + GLuint nr ) +{ + struct brw_compile *p = &c->func; + + /* Pass through control information: + */ + /* mov (8) m1.0<1>:ud r1.0<8;8,1>:ud { Align1 NoMask } */ + { + brw_push_insn_state(p); + brw_set_mask_control(p, BRW_MASK_DISABLE); /* ? */ + brw_MOV(p, + brw_message_reg(base_reg + 1), + brw_vec8_grf(1, 0)); + brw_pop_insn_state(p); + } + /* Send framebuffer write message: */ + brw_fb_WRITE(p, + retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW), + base_reg, + retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), + 0, /* render surface always 0 */ + nr, + 0, + 1); +} + +static void emit_fb_write(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + int nr = 2; + int channel; + struct brw_reg src0;//, src1, src2, dst; + + /* Reserve a space for AA - may not be needed: + */ + if (c->key.aa_dest_stencil_reg) + nr += 1; + { + brw_push_insn_state(p); + for (channel = 0; channel < 4; channel++) { + src0 = get_src_reg(c, &inst->SrcReg[0], channel, 1); + /* mov (8) m2.0<1>:ud r28.0<8;8,1>:ud { Align1 } */ + /* mov (8) m6.0<1>:ud r29.0<8;8,1>:ud { Align1 SecHalf } */ + brw_MOV(p, brw_message_reg(nr + channel), src0); + } + /* skip over the regs populated above: */ + nr += 8; + brw_pop_insn_state(p); + } + fire_fb_write(c, 0, nr); +} + +static void emit_pixel_w( struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + if (mask & WRITEMASK_W) { + struct brw_reg dst, src0, delta0, delta1; + struct brw_reg interp3; + + dst = get_dst_reg(c, inst, 3, 1); + src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); + delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1); + delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1); + + interp3 = brw_vec1_grf(src0.nr+1, 4); + /* Calc 1/w - just linterp wpos[3] optimized by putting the + * result straight into a message reg. + */ + brw_LINE(p, brw_null_reg(), interp3, delta0); + brw_MAC(p, brw_message_reg(2), suboffset(interp3, 1), delta1); + + /* Calc w */ + brw_math_16( p, dst, + BRW_MATH_FUNCTION_INV, + BRW_MATH_SATURATE_NONE, + 2, brw_null_reg(), + BRW_MATH_PRECISION_FULL); + } +} + +static void emit_linterp(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + struct brw_reg interp[4]; + struct brw_reg dst, delta0, delta1; + struct brw_reg src0; + + src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); + delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1); + delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1); + GLuint nr = src0.nr; + int i; + + interp[0] = brw_vec1_grf(nr, 0); + interp[1] = brw_vec1_grf(nr, 4); + interp[2] = brw_vec1_grf(nr+1, 0); + interp[3] = brw_vec1_grf(nr+1, 4); + + for(i = 0; i < 4; i++ ) { + if (mask & (1<func; + GLuint mask = inst->DstReg.WriteMask; + + struct brw_reg interp[4]; + struct brw_reg dst, src0; + + src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); + GLuint nr = src0.nr; + int i; + + interp[0] = brw_vec1_grf(nr, 0); + interp[1] = brw_vec1_grf(nr, 4); + interp[2] = brw_vec1_grf(nr+1, 0); + interp[3] = brw_vec1_grf(nr+1, 4); + + for(i = 0; i < 4; i++ ) { + if (mask & (1<func; + GLuint mask = inst->DstReg.WriteMask; + + struct brw_reg interp[4]; + struct brw_reg dst, delta0, delta1; + struct brw_reg src0, w; + + src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); + delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1); + delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1); + w = get_src_reg(c, &inst->SrcReg[2], 3, 1); + GLuint nr = src0.nr; + int i; + + interp[0] = brw_vec1_grf(nr, 0); + interp[1] = brw_vec1_grf(nr, 4); + interp[2] = brw_vec1_grf(nr+1, 0); + interp[3] = brw_vec1_grf(nr+1, 4); + + for(i = 0; i < 4; i++ ) { + if (mask & (1<func; + GLuint mask = inst->DstReg.WriteMask; + for (i = 0; i < 4; i++) { + GLuint i2 = (i+2)%3; + GLuint i1 = (i+1)%3; + if (mask & (1<SrcReg[0], i2, 1)); + src1 = get_src_reg(c, &inst->SrcReg[1], i1, 1); + brw_MUL(p, brw_null_reg(), src0, src1); + src0 = get_src_reg(c, &inst->SrcReg[0], i1, 1); + src1 = get_src_reg(c, &inst->SrcReg[1], i2, 1); + brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); + brw_MAC(p, dst, src0, src1); + brw_set_saturate(p, 0); + } + } + brw_set_saturate(p, 0); +} + +static void emit_dp3(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_reg src0[3], src1[3], dst; + int i; + struct brw_compile *p = &c->func; + for (i = 0; i < 3; i++) { + src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1); + src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1); + } + + dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1); + brw_MUL(p, brw_null_reg(), src0[0], src1[0]); + brw_MAC(p, brw_null_reg(), src0[1], src1[1]); + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + brw_MAC(p, dst, src0[2], src1[2]); + brw_set_saturate(p, 0); +} + +static void emit_dp4(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_reg src0[4], src1[4], dst; + int i; + struct brw_compile *p = &c->func; + for (i = 0; i < 4; i++) { + src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1); + src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1); + } + dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1); + brw_MUL(p, brw_null_reg(), src0[0], src1[0]); + brw_MAC(p, brw_null_reg(), src0[1], src1[1]); + brw_MAC(p, brw_null_reg(), src0[2], src1[2]); + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + brw_MAC(p, dst, src0[3], src1[3]); + brw_set_saturate(p, 0); +} + +static void emit_dph(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_reg src0[4], src1[4], dst; + int i; + struct brw_compile *p = &c->func; + for (i = 0; i < 4; i++) { + src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1); + src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1); + } + dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1); + brw_MUL(p, brw_null_reg(), src0[0], src1[0]); + brw_MAC(p, brw_null_reg(), src0[1], src1[1]); + brw_MAC(p, dst, src0[2], src1[2]); + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + brw_ADD(p, dst, src0[3], src1[3]); + brw_set_saturate(p, 0); +} + +static void emit_math1(struct brw_wm_compile *c, + struct prog_instruction *inst, GLuint func) +{ + struct brw_compile *p = &c->func; + struct brw_reg src0, dst; + + src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); + dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1); + brw_MOV(p, brw_message_reg(2), src0); + brw_math(p, + dst, + func, + (inst->SaturateMode != SATURATE_OFF) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE, + 2, + brw_null_reg(), + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); +} + +static void emit_rcp(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_math1(c, inst, BRW_MATH_FUNCTION_INV); +} + +static void emit_rsq(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_math1(c, inst, BRW_MATH_FUNCTION_RSQ); +} + +static void emit_sin(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_math1(c, inst, BRW_MATH_FUNCTION_SIN); +} + +static void emit_cos(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_math1(c, inst, BRW_MATH_FUNCTION_COS); +} + +static void emit_ex2(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_math1(c, inst, BRW_MATH_FUNCTION_EXP); +} + +static void emit_lg2(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_math1(c, inst, BRW_MATH_FUNCTION_LOG); +} + +static void emit_add(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + struct brw_reg src0, src1, dst; + GLuint mask = inst->DstReg.WriteMask; + int i; + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + for (i = 0 ; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + brw_ADD(p, dst, src0, src1); + } + } + brw_set_saturate(p, 0); +} + +static void emit_sub(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + struct brw_reg src0, src1, dst; + GLuint mask = inst->DstReg.WriteMask; + int i; + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + for (i = 0 ; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + brw_ADD(p, dst, src0, negate(src1)); + } + } + brw_set_saturate(p, 0); +} + +static void emit_mul(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + struct brw_reg src0, src1, dst; + GLuint mask = inst->DstReg.WriteMask; + int i; + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + for (i = 0 ; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + brw_MUL(p, dst, src0, src1); + } + } + brw_set_saturate(p, 0); +} + +static void emit_frc(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + struct brw_reg src0, dst; + GLuint mask = inst->DstReg.WriteMask; + int i; + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + for (i = 0 ; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + brw_FRC(p, dst, src0); + } + } + if (inst->SaturateMode != SATURATE_OFF) + brw_set_saturate(p, 0); +} + +static void emit_flr(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + struct brw_reg src0, dst; + GLuint mask = inst->DstReg.WriteMask; + int i; + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + for (i = 0 ; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + brw_RNDD(p, dst, src0); + } + } + brw_set_saturate(p, 0); +} + +static void emit_max(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + struct brw_reg src0, src1, dst; + int i; + brw_push_insn_state(p); + for (i = 0; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + brw_MOV(p, dst, src0); + brw_set_saturate(p, 0); + + brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src0, src1); + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); + brw_MOV(p, dst, src1); + brw_set_saturate(p, 0); + brw_set_predicate_control_flag_value(p, 0xff); + } + } + brw_pop_insn_state(p); +} + +static void emit_min(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + struct brw_reg src0, src1, dst; + int i; + brw_push_insn_state(p); + for (i = 0; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + brw_MOV(p, dst, src0); + brw_set_saturate(p, 0); + + brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src1, src0); + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); + brw_MOV(p, dst, src1); + brw_set_saturate(p, 0); + brw_set_predicate_control_flag_value(p, 0xff); + } + } + brw_pop_insn_state(p); +} + +static void emit_pow(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + struct brw_reg dst, src0, src1; + dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1); + src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); + src1 = get_src_reg(c, &inst->SrcReg[1], 0, 1); + + brw_MOV(p, brw_message_reg(2), src0); + brw_MOV(p, brw_message_reg(3), src1); + + brw_math(p, + dst, + BRW_MATH_FUNCTION_POW, + (inst->SaturateMode != SATURATE_OFF) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE, + 2, + brw_null_reg(), + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); +} + +static void emit_lrp(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + struct brw_reg dst, tmp1, tmp2, src0, src1, src2; + int i; + for (i = 0; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + + src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + + if (src1.nr == dst.nr) { + tmp1 = alloc_tmp(c); + brw_MOV(p, tmp1, src1); + } else + tmp1 = src1; + + src2 = get_src_reg(c, &inst->SrcReg[2], i, 1); + if (src2.nr == dst.nr) { + tmp2 = alloc_tmp(c); + brw_MOV(p, tmp2, src2); + } else + tmp2 = src2; + + brw_ADD(p, dst, negate(src0), brw_imm_f(1.0)); + brw_MUL(p, brw_null_reg(), dst, tmp2); + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + brw_MAC(p, dst, src0, tmp1); + brw_set_saturate(p, 0); + } + release_tmps(c); + } +} + +static void emit_mad(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + struct brw_reg dst, src0, src1, src2; + int i; + + for (i = 0; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + src2 = get_src_reg(c, &inst->SrcReg[2], i, 1); + brw_MUL(p, dst, src0, src1); + + brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); + brw_ADD(p, dst, dst, src2); + brw_set_saturate(p, 0); + } + } +} + +static void emit_sop(struct brw_wm_compile *c, + struct prog_instruction *inst, GLuint cond) +{ + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + struct brw_reg dst, src0, src1; + int i; + + for (i = 0; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1); + src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); + brw_MOV(p, dst, brw_imm_f(0)); + brw_CMP(p, brw_null_reg(), cond, src0, src1); + brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); + brw_MOV(p, dst, brw_imm_f(1.0)); + brw_set_predicate_control_flag_value(p, 0xff); + } + } +} + +static void emit_slt(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_sop(c, inst, BRW_CONDITIONAL_L); +} + +static void emit_sle(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_sop(c, inst, BRW_CONDITIONAL_LE); +} + +static void emit_sgt(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_sop(c, inst, BRW_CONDITIONAL_G); +} + +static void emit_sge(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_sop(c, inst, BRW_CONDITIONAL_GE); +} + +static void emit_seq(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_sop(c, inst, BRW_CONDITIONAL_EQ); +} + +static void emit_sne(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + emit_sop(c, inst, BRW_CONDITIONAL_NEQ); +} +/* TODO + BIAS on SIMD8 not workind yet... + */ +static void emit_txb(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + struct brw_reg dst[4], src[4], payload_reg; + GLuint i; + payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); + for (i = 0; i < 4; i++) + dst[i] = get_dst_reg(c, inst, i, 1); + for (i = 0; i < 4; i++) + src[i] = get_src_reg(c, &inst->SrcReg[0], i, 1); + + switch (inst->TexSrcTarget) { + case TEXTURE_1D_INDEX: + brw_MOV(p, brw_message_reg(2), src[0]); + brw_MOV(p, brw_message_reg(3), brw_imm_f(0)); + brw_MOV(p, brw_message_reg(4), brw_imm_f(0)); + break; + case TEXTURE_2D_INDEX: + case TEXTURE_RECT_INDEX: + brw_MOV(p, brw_message_reg(2), src[0]); + brw_MOV(p, brw_message_reg(3), src[1]); + brw_MOV(p, brw_message_reg(4), brw_imm_f(0)); + break; + default: + brw_MOV(p, brw_message_reg(2), src[0]); + brw_MOV(p, brw_message_reg(3), src[1]); + brw_MOV(p, brw_message_reg(4), src[2]); + break; + } + brw_MOV(p, brw_message_reg(5), src[3]); + brw_MOV(p, brw_message_reg(6), brw_imm_f(0)); + brw_SAMPLE(p, + retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), + 1, + retype(payload_reg, BRW_REGISTER_TYPE_UW), + inst->TexSrcUnit + 1, /* surface */ + inst->TexSrcUnit, /* sampler */ + inst->DstReg.WriteMask, + BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS, + 4, + 4, + 0); +} + +static void emit_tex(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + struct brw_reg dst[4], src[4], payload_reg; + GLuint msg_len; + GLuint i, nr; + GLuint emit; + + payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); + for (i = 0; i < 4; i++) + dst[i] = get_dst_reg(c, inst, i, 1); + for (i = 0; i < 4; i++) + src[i] = get_src_reg(c, &inst->SrcReg[0], i, 1); + + + switch (inst->TexSrcTarget) { + case TEXTURE_1D_INDEX: + emit = WRITEMASK_X; + nr = 1; + break; + case TEXTURE_2D_INDEX: + case TEXTURE_RECT_INDEX: + emit = WRITEMASK_XY; + nr = 2; + break; + default: + emit = WRITEMASK_XYZ; + nr = 3; + break; + } + msg_len = 1; + + for (i = 0; i < nr; i++) { + static const GLuint swz[4] = {0,1,2,2}; + if (emit & (1<TexSrcUnit + 1, /* surface */ + inst->TexSrcUnit, /* sampler */ + inst->DstReg.WriteMask, + BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE, + 4, + 4, + 0); +} + +static void post_wm_emit( struct brw_wm_compile *c ) +{ + GLuint nr_insns = c->fp->program.Base.NumInstructions; + GLuint insn, target_insn; + struct prog_instruction *inst1, *inst2; + struct brw_instruction *brw_inst1, *brw_inst2; + int offset; + for (insn = 0; insn < nr_insns; insn++) { + inst1 = &c->fp->program.Base.Instructions[insn]; + brw_inst1 = inst1->Data; + switch (inst1->Opcode) { + case OPCODE_CAL: + target_insn = inst1->BranchTarget; + inst2 = &c->fp->program.Base.Instructions[target_insn]; + brw_inst2 = inst2->Data; + offset = brw_inst2 - brw_inst1; + brw_set_src1(brw_inst1, brw_imm_d(offset*16)); + break; + default: + break; + } + } +} + +static void brw_wm_emit_glsl(struct brw_wm_compile *c) + +{ +#define MAX_IFSN 32 +#define MAX_LOOP_DEPTH 32 + struct brw_instruction *if_inst[MAX_IFSN], *loop_inst[MAX_LOOP_DEPTH]; + struct brw_instruction *inst0, *inst1; + int i, if_insn = 0, loop_insn = 0; + struct brw_compile *p = &c->func; + brw_init_compile(&c->func); + c->reg_index = 0; + prealloc_reg(c); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + for (i = 0; i < c->nr_fp_insns; i++) { + struct prog_instruction *inst = &c->prog_instructions[i]; + struct prog_instruction *orig_inst; + + if ((orig_inst = inst->Data) != 0) + orig_inst->Data = current_insn(p); + + switch (inst->Opcode) { + case WM_PIXELXY: + emit_pixel_xy(c, inst); + break; + case WM_DELTAXY: + emit_delta_xy(c, inst); + break; + case WM_PIXELW: + emit_pixel_w(c, inst); + break; + case WM_LINTERP: + emit_linterp(c, inst); + break; + case WM_PINTERP: + emit_pinterp(c, inst); + break; + case WM_CINTERP: + emit_cinterp(c, inst); + break; + case WM_FB_WRITE: + emit_fb_write(c, inst); + break; + case OPCODE_ABS: + emit_abs(c, inst); + break; + case OPCODE_ADD: + emit_add(c, inst); + break; + case OPCODE_SUB: + emit_sub(c, inst); + break; + case OPCODE_FRC: + emit_frc(c, inst); + break; + case OPCODE_FLR: + emit_flr(c, inst); + break; + case OPCODE_LRP: + emit_lrp(c, inst); + break; + case OPCODE_MOV: + emit_mov(c, inst); + break; + case OPCODE_DP3: + emit_dp3(c, inst); + break; + case OPCODE_DP4: + emit_dp4(c, inst); + break; + case OPCODE_XPD: + emit_xpd(c, inst); + break; + case OPCODE_DPH: + emit_dph(c, inst); + break; + case OPCODE_RCP: + emit_rcp(c, inst); + break; + case OPCODE_RSQ: + emit_rsq(c, inst); + break; + case OPCODE_SIN: + emit_sin(c, inst); + break; + case OPCODE_COS: + emit_cos(c, inst); + break; + case OPCODE_EX2: + emit_ex2(c, inst); + break; + case OPCODE_LG2: + emit_lg2(c, inst); + break; + case OPCODE_MAX: + emit_max(c, inst); + break; + case OPCODE_MIN: + emit_min(c, inst); + break; + case OPCODE_SLT: + emit_slt(c, inst); + break; + case OPCODE_SLE: + emit_sle(c, inst); + break; + case OPCODE_SGT: + emit_sgt(c, inst); + break; + case OPCODE_SGE: + emit_sge(c, inst); + break; + case OPCODE_SEQ: + emit_seq(c, inst); + break; + case OPCODE_SNE: + emit_sne(c, inst); + break; + case OPCODE_MUL: + emit_mul(c, inst); + break; + case OPCODE_POW: + emit_pow(c, inst); + break; + case OPCODE_MAD: + emit_mad(c, inst); + break; + case OPCODE_TEX: + emit_tex(c, inst); + break; + case OPCODE_TXB: + emit_txb(c, inst); + break; + case OPCODE_IF: + assert(if_insn < MAX_IFSN); + if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8); + break; + case OPCODE_ELSE: + if_inst[if_insn-1] = brw_ELSE(p, if_inst[if_insn-1]); + break; + case OPCODE_ENDIF: + assert(if_insn > 0); + brw_ENDIF(p, if_inst[--if_insn]); + break; + case OPCODE_BGNSUB: + case OPCODE_ENDSUB: + break; + case OPCODE_CAL: + brw_push_insn_state(p); + brw_set_mask_control(p, BRW_MASK_DISABLE); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + brw_ADD(p, c->ret_reg, brw_ip_reg(), brw_imm_d(2*16)); + orig_inst = inst->Data; + orig_inst->Data = current_insn(p); + brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); + brw_pop_insn_state(p); + break; + case OPCODE_RET: + brw_push_insn_state(p); + brw_set_mask_control(p, BRW_MASK_DISABLE); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + brw_MOV(p, brw_ip_reg(), c->ret_reg); + brw_pop_insn_state(p); + break; + case OPCODE_BGNLOOP: + loop_inst[loop_insn++] = brw_DO(p, BRW_EXECUTE_8); + break; + case OPCODE_BRK: + brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); + brw_BREAK(p); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + break; + case OPCODE_ENDLOOP: + loop_insn--; + inst0 = inst1 = brw_WHILE(p, loop_inst[loop_insn]); + /* patch all the BREAK instructions from + last BEGINLOOP */ + while (inst0 > loop_inst[loop_insn]) { + inst0--; + if (inst0->header.opcode == BRW_OPCODE_BREAK) { + inst0->bits3.if_else.jump_count = inst1 - inst0 + 1; + inst0->bits3.if_else.pop_count = 0; + } + } + break; + default: + _mesa_printf("unsupported IR in fragment shader %d\n", + inst->Opcode); + } + } + post_wm_emit(c); +} + +void brw_wm_glsl_emit(struct brw_wm_compile *c) +{ + brw_wm_pass_fp(c); + c->tmp_index = 127; + brw_wm_emit_glsl(c); + c->prog_data.total_grf = c->reg_index; + c->prog_data.total_scratch = 0; +} diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass2.c b/src/mesa/drivers/dri/i965/brw_wm_pass2.c index a1edbd6168d..c1ce6a9b6b5 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass2.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass2.c @@ -328,7 +328,7 @@ void brw_wm_pass2( struct brw_wm_compile *c ) c->state = PASS2_DONE; if (INTEL_DEBUG & DEBUG_WM) { - brw_wm_print_program(c, "pass2/done"); + brw_wm_print_program(c, "pass2/done"); } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index ff5cb31bdd1..401864fc4e1 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -34,6 +34,7 @@ #include "brw_context.h" #include "brw_state.h" #include "brw_defines.h" +#include "brw_wm.h" #include "bufmgr.h" /*********************************************************************** @@ -134,9 +135,13 @@ static void upload_wm_unit(struct brw_context *brw ) if (fp->UsesKill || brw->attribs.Color->AlphaEnabled) wm.wm5.program_uses_killpixel = 1; + + if (brw_wm_is_glsl(fp)) + wm.wm5.enable_8_pix = 1; + else + wm.wm5.enable_16_pix = 1; } - wm.wm5.enable_16_pix = 1; wm.wm5.thread_dispatch_enable = 1; /* AKA: color_write */ wm.wm5.legacy_line_rast = 0; wm.wm5.legacy_global_depth_bias = 0; -- cgit v1.2.3 From 4fc02ad000a0948ab77306980492924f5beebc0a Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 3 Jul 2007 15:27:43 +0800 Subject: Fix a nasty bug... --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index fa94d5b1a87..7dc6f9bf93f 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -137,7 +137,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c ) for (i = 0; i < 128; i++) { if (c->output_regs[i].used_in_src) { - c->regs[PROGRAM_OUTPUT][i] = brw_vec8_grf(reg, 0); + c->output_regs[i].reg = brw_vec8_grf(reg, 0); reg++; } } @@ -958,6 +958,9 @@ void brw_vs_emit(struct brw_vs_compile *c ) struct brw_instruction *if_inst[MAX_IFSN]; struct brw_indirect stack_index = brw_indirect(0, 0); + GLuint index; + GLuint file; + if (INTEL_DEBUG & DEBUG_VS) { _mesa_printf("\n\n\nvs-emit:\n"); _mesa_print_program(&c->vp->program.Base); @@ -998,8 +1001,8 @@ void brw_vs_emit(struct brw_vs_compile *c ) if (inst->Opcode != OPCODE_SWZ) for (i = 0; i < 3; i++) { struct prog_src_register *src = &inst->SrcReg[i]; - GLuint index = src->Index; - GLuint file = src->File; + index = src->Index; + file = src->File; if (file == PROGRAM_OUTPUT&&c->output_regs[index].used_in_src) args[i] = c->output_regs[index].reg; else @@ -1009,8 +1012,13 @@ void brw_vs_emit(struct brw_vs_compile *c ) /* Get dest regs. Note that it is possible for a reg to be both * dst and arg, given the static allocation of registers. So * care needs to be taken emitting multi-operation instructions. - */ - dst = get_dst(c, inst->DstReg); + */ + index = inst->DstReg.Index; + file = inst->DstReg.File; + if (file == PROGRAM_OUTPUT && c->output_regs[index].used_in_src) + dst = c->output_regs[index].reg; + else + dst = get_dst(c, inst->DstReg); switch (inst->Opcode) { case OPCODE_ABS: @@ -1157,7 +1165,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) if (inst->DstReg.File == PROGRAM_OUTPUT &&inst->DstReg.Index != VERT_RESULT_HPOS &&c->output_regs[inst->DstReg.Index].used_in_src) - brw_MOV(p, get_dst(c, inst->DstReg), dst); + brw_MOV(p, dst, c->output_regs[inst->DstReg.Index].reg); release_tmps(c); } -- cgit v1.2.3 From 285b326c606e9b2f90e4fe177b15b3fa23239b86 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Wed, 4 Jul 2007 10:51:57 +0800 Subject: fix issue with output as src register. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 7dc6f9bf93f..18ede5f6cdc 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1165,7 +1165,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) if (inst->DstReg.File == PROGRAM_OUTPUT &&inst->DstReg.Index != VERT_RESULT_HPOS &&c->output_regs[inst->DstReg.Index].used_in_src) - brw_MOV(p, dst, c->output_regs[inst->DstReg.Index].reg); + brw_MOV(p, get_dst(c, inst->DstReg), dst); release_tmps(c); } -- cgit v1.2.3 From 575f3e918f00bdc0faa4a173820015b24175696f Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Thu, 5 Jul 2007 11:10:24 +0800 Subject: support "discard"; --- src/mesa/drivers/dri/i965/brw_wm.h | 1 + src/mesa/drivers/dri/i965/brw_wm_glsl.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 4143d5be6cb..931c0038d41 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -237,6 +237,7 @@ struct brw_wm_compile { struct brw_reg reg; } wm_regs[PROGRAM_PAYLOAD+1][256][4]; struct brw_reg ret_reg; + struct brw_reg emit_mask_reg; GLuint reg_index; GLuint tmp_index; }; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index cdd79766076..4988df2b0e4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -132,6 +132,7 @@ static void prealloc_reg(struct brw_wm_compile *c) c->prog_data.urb_read_length = nr_interp_regs * 2; c->prog_data.curb_read_length = c->nr_creg; c->ret_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0); + c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 1); c->reg_index++; } @@ -768,6 +769,17 @@ static void emit_lrp(struct brw_wm_compile *c, } } +static void emit_kil(struct brw_wm_compile *c) +{ + struct brw_compile *p = &c->func; + struct brw_reg depth = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); + brw_push_insn_state(p); + brw_set_mask_control(p, BRW_MASK_DISABLE); + brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); //IMASK + brw_AND(p, depth, c->emit_mask_reg, depth); + brw_pop_insn_state(p); +} + static void emit_mad(struct brw_wm_compile *c, struct prog_instruction *inst) { @@ -1107,6 +1119,9 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) case OPCODE_TXB: emit_txb(c, inst); break; + case OPCODE_KIL_NV: + emit_kil(c); + break; case OPCODE_IF: assert(if_insn < MAX_IFSN); if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8); -- cgit v1.2.3 From 719cf0b7958d0dedf8727c97eaddb6a1f31977e1 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 17 Jul 2007 11:19:52 +0800 Subject: Use ProgramStringNotify --- src/mesa/drivers/dri/i965/brw_context.c | 27 --------------------------- src/mesa/shader/program.c | 2 ++ 2 files changed, 2 insertions(+), 27 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index badf178b68e..8366f14dbea 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -62,30 +62,6 @@ static const struct dri_extension brw_extensions[] = { NULL, NULL } }; -static void brwLinkProgram(GLcontext *ctx, GLuint program) -{ - struct brw_context *brw = brw_context(ctx); - struct brw_vertex_program *vert_prog; - struct brw_fragment_program *frag_prog; - struct gl_shader_program *sh_prog; - _mesa_link_program(ctx, program); - - sh_prog = _mesa_lookup_shader_program(ctx, program); - if (sh_prog) { - sh_prog->FragmentProgram = - _mesa_realloc(sh_prog->FragmentProgram, - sizeof(struct gl_fragment_program), - sizeof(struct brw_fragment_program)); - frag_prog = (struct brw_fragment_program *)sh_prog->FragmentProgram; - frag_prog->id = brw->program_id++; - sh_prog->VertexProgram = _mesa_realloc(sh_prog->VertexProgram, - sizeof(struct gl_vertex_program), - sizeof(struct brw_vertex_program)); - vert_prog = (struct brw_vertex_program *)sh_prog->VertexProgram; - vert_prog->id = brw->program_id++; - } -} - static void brwUseProgram(GLcontext *ctx, GLuint program) { struct brw_context *brw = brw_context(ctx); @@ -97,15 +73,12 @@ static void brwUseProgram(GLcontext *ctx, GLuint program) ctx->FragmentProgram.Enabled = GL_TRUE; brw->attribs.VertexProgram->Current = sh_prog->VertexProgram; brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram; - brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM; - brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM; } } static void brwInitProgFuncs( struct dd_function_table *functions ) { functions->UseProgram = brwUseProgram; - functions->LinkProgram = brwLinkProgram; } static void brwInitDriverFunctions( struct dd_function_table *functions ) { diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 42059198282..03be368a922 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -242,6 +242,8 @@ _mesa_init_vertex_program( GLcontext *ctx, struct gl_vertex_program *prog, struct gl_program * _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) { + if (ctx->Driver.NewProgram) + return ctx->Driver.NewProgram(ctx, target, id); switch (target) { case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ return _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program), -- cgit v1.2.3 From c6d042acc94411b63f922ef68f24aa5426c0a69e Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 17 Jul 2007 16:52:03 +0800 Subject: Fix SOP in fragment shader, brick is ok now. --- progs/glsl/CH06-brick.frag.txt | 6 +----- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 6 ++++-- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src/mesa') diff --git a/progs/glsl/CH06-brick.frag.txt b/progs/glsl/CH06-brick.frag.txt index 388c5f9e660..06ef04e3afb 100644 --- a/progs/glsl/CH06-brick.frag.txt +++ b/progs/glsl/CH06-brick.frag.txt @@ -23,11 +23,7 @@ void main() position = MCposition / BrickSize; -// if (fract(position.y * 0.5) > 0.5) -// position.x += 0.5; - float tmp; - tmp = fract(position.y * 0.5); - if (tmp > 0.5) + if (fract(position.y * 0.5) > 0.5) position.x += 0.5; position = fract(position); diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 4988df2b0e4..09e75903676 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -811,18 +811,20 @@ static void emit_sop(struct brw_wm_compile *c, struct brw_reg dst, src0, src1; int i; + brw_push_insn_state(p); for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1); src1 = get_src_reg(c, &inst->SrcReg[1], i, 1); - brw_MOV(p, dst, brw_imm_f(0)); brw_CMP(p, brw_null_reg(), cond, src0, src1); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + brw_MOV(p, dst, brw_imm_f(0.0)); brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); brw_MOV(p, dst, brw_imm_f(1.0)); - brw_set_predicate_control_flag_value(p, 0xff); } } + brw_pop_insn_state(p); } static void emit_slt(struct brw_wm_compile *c, -- cgit v1.2.3 From c702a7100e2aa83241e89850a97bcc23e1c6fedb Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 24 Jul 2007 11:09:34 +0800 Subject: DDX DDY support, not very accurate --- src/mesa/drivers/dri/i965/brw_wm.h | 1 + src/mesa/drivers/dri/i965/brw_wm_fp.c | 37 ++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 66 ++++++++++++++++++++++++++++++++- 3 files changed, 103 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 931c0038d41..22e77287f45 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -194,6 +194,7 @@ struct brw_wm_compile { GLuint nr_fp_insns; GLuint fp_temp; GLuint fp_interp_emitted; + GLuint fp_deriv_emitted; struct prog_src_register pixel_xy; struct prog_src_register delta_xy; diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 403160c4949..0a6e516b933 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -361,6 +361,37 @@ static void emit_interp( struct brw_wm_compile *c, c->fp_interp_emitted |= 1<SrcReg[0].Index; + struct prog_src_register interp = src_reg(PROGRAM_PAYLOAD, idx); + + c->fp_deriv_emitted |= 1<DstReg, + 0, 0, 0, + interp, + get_pixel_w(c), + src_undef()); +} + +static void emit_ddy( struct brw_wm_compile *c, + const struct prog_instruction *inst ) +{ + GLuint idx = inst->SrcReg[0].Index; + struct prog_src_register interp = src_reg(PROGRAM_PAYLOAD, idx); + + c->fp_deriv_emitted |= 1<DstReg, + 0, 0, 0, + interp, + get_pixel_w(c), + src_undef()); +} /*********************************************************************** * Hacks to extend the program parameter and constant lists. @@ -907,6 +938,12 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) */ out->DstReg.WriteMask = 0; break; + case OPCODE_DDX: + emit_ddx(c, inst); + break; + case OPCODE_DDY: + emit_ddy(c, inst); + break; case OPCODE_END: emit_fog(c); emit_fb_write(c); diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 09e75903676..f47f139282d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -16,6 +16,8 @@ GLboolean brw_wm_is_glsl(struct gl_fragment_program *fp) case OPCODE_CAL: case OPCODE_BRK: case OPCODE_RET: + case OPCODE_DDX: + case OPCODE_DDY: case OPCODE_BGNLOOP: return GL_TRUE; default: @@ -92,7 +94,7 @@ static void prealloc_reg(struct brw_wm_compile *c) int i, j; struct brw_reg reg; int nr_interp_regs = 0; - GLuint inputs = FRAG_BIT_WPOS | c->fp_interp_emitted; + GLuint inputs = FRAG_BIT_WPOS | c->fp_interp_emitted | c->fp_deriv_emitted; for (i = 0; i < 4; i++) { reg = (i < c->key.nr_depth_regs) @@ -862,6 +864,62 @@ static void emit_sne(struct brw_wm_compile *c, { emit_sop(c, inst, BRW_CONDITIONAL_NEQ); } + +static void emit_ddx(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + struct brw_reg interp[4]; + struct brw_reg dst; + struct brw_reg src0, w; + GLuint nr, i; + src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); + w = get_src_reg(c, &inst->SrcReg[1], 3, 1); + nr = src0.nr; + interp[0] = brw_vec1_grf(nr, 0); + interp[1] = brw_vec1_grf(nr, 4); + interp[2] = brw_vec1_grf(nr+1, 0); + interp[3] = brw_vec1_grf(nr+1, 4); + brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); + for(i = 0; i < 4; i++ ) { + if (mask & (1<func; + GLuint mask = inst->DstReg.WriteMask; + struct brw_reg interp[4]; + struct brw_reg dst; + struct brw_reg src0, w; + GLuint nr, i; + + src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1); + nr = src0.nr; + w = get_src_reg(c, &inst->SrcReg[1], 3, 1); + interp[0] = brw_vec1_grf(nr, 0); + interp[1] = brw_vec1_grf(nr, 4); + interp[2] = brw_vec1_grf(nr+1, 0); + interp[3] = brw_vec1_grf(nr+1, 4); + brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); + for(i = 0; i < 4; i++ ) { + if (mask & (1< Date: Tue, 18 Sep 2007 11:32:25 +0800 Subject: fix double free in 965-glsl branch --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 ++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 2 ++ src/mesa/drivers/dri/i965/intel_context.c | 2 ++ 3 files changed, 6 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 18ede5f6cdc..f689f7b3050 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1173,4 +1173,6 @@ void brw_vs_emit(struct brw_vs_compile *c ) end_inst = &p->store[p->nr_insn]; emit_vertex_write(c); post_vs_emit(c, end_inst); + for (insn = 0; insn < nr_insns; insn++) + c->vp->program.Base.Instructions[insn].Data = NULL; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index f47f139282d..f03866d9b93 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1246,6 +1246,8 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) } } post_wm_emit(c); + for (i = 0; i < c->fp->program.Base.NumInstructions; i++) + c->fp->program.Base.Instructions[i].Data = NULL; } void brw_wm_glsl_emit(struct brw_wm_compile *c) diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index 3215cc7218a..35babcac233 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -555,6 +555,8 @@ void intelDestroyContext(__DRIcontextPrivate *driContextPriv) #endif /* free the Mesa context */ + intel->ctx.VertexProgram.Current = NULL; + intel->ctx.FragmentProgram.Current = NULL; _mesa_destroy_context(&intel->ctx); } -- cgit v1.2.3 From ec9e7bc753316cebed9c9ce12aa5513486c6b8d0 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 18 Sep 2007 12:59:50 +0800 Subject: ARB_shader_object ARB_vertex_shader ARB_fragment_shader in 965-glsl branch --- src/mesa/drivers/dri/i965/intel_context.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index 35babcac233..ac8aa5bd52c 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -82,6 +82,9 @@ int INTEL_DEBUG = (0); #define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_secondary_color #define need_GL_VERSION_2_0 +#define need_GL_ARB_shader_objects +#define need_GL_ARB_vertex_shader + #include "extension_helper.h" #ifndef VERBOSE @@ -185,6 +188,9 @@ const struct dri_extension card_extensions[] = { "GL_NV_blend_square", NULL }, { "GL_SGIS_generate_mipmap", NULL }, { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions}, + { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions}, + { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions}, + { "GL_ARB_fragment_shader", NULL }, /* XXX not implement yet, to compile builtin glsl lib */ { "GL_ARB_draw_buffers", NULL }, { NULL, NULL } -- cgit v1.2.3 From 35a0634e358baac832d6e5a76630fcae57a948a7 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Thu, 27 Sep 2007 15:47:00 +0800 Subject: fix issue when only fragment shader or vertex shader is used --- src/mesa/drivers/dri/i965/brw_context.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 8366f14dbea..2031d556c1b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -69,11 +69,18 @@ static void brwUseProgram(GLcontext *ctx, GLuint program) _mesa_use_program(ctx, program); sh_prog = ctx->Shader.CurrentProgram; if (sh_prog) { - ctx->VertexProgram.Enabled = GL_TRUE; - ctx->FragmentProgram.Enabled = GL_TRUE; - brw->attribs.VertexProgram->Current = sh_prog->VertexProgram; - brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram; - } + if (sh_prog->VertexProgram) { + brw->attribs.VertexProgram->Current = sh_prog->VertexProgram; + ctx->VertexProgram.Enabled = GL_TRUE; + }else + ctx->VertexProgram.Enabled = GL_FALSE; + + if (sh_prog->FragmentProgram) { + brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram; + ctx->FragmentProgram.Enabled = GL_TRUE; + } else + ctx->VertexProgram.Enabled = GL_FALSE; + } } static void brwInitProgFuncs( struct dd_function_table *functions ) -- cgit v1.2.3 From b1e549d1762536ebb3f7c11461c4554d4613c37a Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Thu, 27 Sep 2007 16:17:24 +0800 Subject: handle INT op, still require high level handle of integer to be correct --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index f03866d9b93..4bce150491c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -12,6 +12,7 @@ GLboolean brw_wm_is_glsl(struct gl_fragment_program *fp) struct prog_instruction *inst = &fp->Base.Instructions[i]; switch (inst->Opcode) { case OPCODE_IF: + case OPCODE_INT: case OPCODE_ENDIF: case OPCODE_CAL: case OPCODE_BRK: @@ -170,6 +171,24 @@ static void emit_abs( struct brw_wm_compile *c, brw_set_saturate(p, 0); } +static void emit_mov_int( struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + int i; + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); + for (i = 0; i < 4; i++) { + if (mask & (1<SrcReg[0], i, 1), BRW_REGISTER_TYPE_D); + brw_MOV(p, dst, src); + } + } + brw_set_saturate(p, 0); +} + static void emit_mov( struct brw_wm_compile *c, struct prog_instruction *inst) { @@ -1107,6 +1126,9 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) case OPCODE_LRP: emit_lrp(c, inst); break; + case OPCODE_INT: + emit_mov_int(c, inst); + break; case OPCODE_MOV: emit_mov(c, inst); break; -- cgit v1.2.3 From 4087c90effecdf2f466e2ddcf88ec2faf0db034f Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Fri, 28 Sep 2007 16:37:01 +0800 Subject: support nested function call in pixel shader --- src/mesa/drivers/dri/i965/brw_wm.h | 2 +- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 35 +++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 11 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 22e77287f45..ca9bc3a07b9 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -237,7 +237,7 @@ struct brw_wm_compile { GLboolean inited; struct brw_reg reg; } wm_regs[PROGRAM_PAYLOAD+1][256][4]; - struct brw_reg ret_reg; + struct brw_reg stack; struct brw_reg emit_mask_reg; GLuint reg_index; GLuint tmp_index; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 4bce150491c..c6fd7249210 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -134,9 +134,10 @@ static void prealloc_reg(struct brw_wm_compile *c) c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2; c->prog_data.urb_read_length = nr_interp_regs * 2; c->prog_data.curb_read_length = c->nr_creg; - c->ret_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0); - c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 1); + c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0); c->reg_index++; + c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0); + c->reg_index += 2; } static struct brw_reg get_dst_reg(struct brw_wm_compile *c, @@ -1075,10 +1076,14 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) struct brw_instruction *inst0, *inst1; int i, if_insn = 0, loop_insn = 0; struct brw_compile *p = &c->func; + struct brw_indirect stack_index = brw_indirect(0, 0); + brw_init_compile(&c->func); c->reg_index = 0; prealloc_reg(c); brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack)); + for (i = 0; i < c->nr_fp_insns; i++) { struct prog_instruction *inst = &c->prog_instructions[i]; struct prog_instruction *orig_inst; @@ -1227,19 +1232,29 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) case OPCODE_CAL: brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_ADD(p, c->ret_reg, brw_ip_reg(), brw_imm_d(2*16)); - orig_inst = inst->Data; - orig_inst->Data = current_insn(p); - brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); - brw_pop_insn_state(p); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + brw_set_access_mode(p, BRW_ALIGN_1); + brw_ADD(p, deref_1uw(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16)); + brw_set_access_mode(p, BRW_ALIGN_16); + brw_ADD(p, get_addr_reg(stack_index), + get_addr_reg(stack_index), brw_imm_d(4)); + orig_inst = inst->Data; + orig_inst->Data = &p->store[p->nr_insn]; + brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); + brw_pop_insn_state(p); break; + case OPCODE_RET: brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_MOV(p, brw_ip_reg(), c->ret_reg); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + brw_ADD(p, get_addr_reg(stack_index), + get_addr_reg(stack_index), brw_imm_d(-4)); + brw_set_access_mode(p, BRW_ALIGN_1); + brw_MOV(p, brw_ip_reg(), deref_1uw(stack_index, 0)); + brw_set_access_mode(p, BRW_ALIGN_16); brw_pop_insn_state(p); + break; case OPCODE_BGNLOOP: loop_inst[loop_insn++] = brw_DO(p, BRW_EXECUTE_8); -- cgit v1.2.3 From e75ae0dc792b9fe599b68d7a9ea0ab22413da424 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Fri, 28 Sep 2007 17:04:48 +0800 Subject: fix --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index c6fd7249210..9b0b7aaa551 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1232,7 +1232,6 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) case OPCODE_CAL: brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); brw_set_access_mode(p, BRW_ALIGN_1); brw_ADD(p, deref_1uw(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16)); brw_set_access_mode(p, BRW_ALIGN_16); @@ -1247,7 +1246,6 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) case OPCODE_RET: brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); brw_ADD(p, get_addr_reg(stack_index), get_addr_reg(stack_index), brw_imm_d(-4)); brw_set_access_mode(p, BRW_ALIGN_1); -- cgit v1.2.3 From b0b48798c7e854d2e36e0317bf94b7385e815242 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Sat, 29 Sep 2007 15:00:52 +0800 Subject: support continue, fix conditional --- src/mesa/drivers/dri/i965/brw_eu.h | 1 + src/mesa/drivers/dri/i965/brw_eu_emit.c | 14 +++++++++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 53 +++++++++++++++++++++++++++++++-- 3 files changed, 66 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 9b6581fd932..d44217d02fa 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -815,6 +815,7 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p, struct brw_instruction *patch_insn); struct brw_instruction *brw_BREAK(struct brw_compile *p); +struct brw_instruction *brw_CONT(struct brw_compile *p); /* Forward jumps: */ void brw_land_fwd_jump(struct brw_compile *p, diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 7b95fbdac03..95f9f027530 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -611,6 +611,20 @@ struct brw_instruction *brw_BREAK(struct brw_compile *p) return insn; } +struct brw_instruction *brw_CONT(struct brw_compile *p) +{ + struct brw_instruction *insn; + insn = next_insn(p, BRW_OPCODE_CONTINUE); + brw_set_dest(insn, brw_ip_reg()); + brw_set_src0(insn, brw_ip_reg()); + brw_set_src1(insn, brw_imm_d(0x0)); + insn->header.compression_control = BRW_COMPRESSION_NONE; + insn->header.execution_size = BRW_EXECUTE_8; + insn->header.mask_control = BRW_MASK_DISABLE; + insn->bits3.if_else.pad0 = 0; + return insn; +} + /* DO/WHILE loop: */ struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size) diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 9b0b7aaa551..1f1e32ee47e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -940,6 +940,37 @@ static void emit_ddy(struct brw_wm_compile *c, brw_set_saturate(p, 0); } +static void emit_wpos_xy(struct brw_wm_compile *c, + struct prog_instruction *inst) +{ + struct brw_compile *p = &c->func; + GLuint mask = inst->DstReg.WriteMask; + struct brw_reg src0[2], dst[2]; + + dst[0] = get_dst_reg(c, inst, 0, 1); + dst[1] = get_dst_reg(c, inst, 1, 1); + + src0[0] = get_src_reg(c, &inst->SrcReg[0], 0, 1); + src0[1] = get_src_reg(c, &inst->SrcReg[0], 1, 1); + + /* Calc delta X,Y by subtracting origin in r1 from the pixel + * centers. + */ + if (mask & WRITEMASK_X) { + brw_MOV(p, + dst[0], + retype(src0[0], BRW_REGISTER_TYPE_UW)); + } + + if (mask & WRITEMASK_Y) { + /* TODO -- window_height - Y */ + brw_MOV(p, + dst[1], + negate(retype(src0[1], BRW_REGISTER_TYPE_UW))); + + } +} + /* TODO BIAS on SIMD8 not workind yet... */ @@ -1091,6 +1122,11 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) if ((orig_inst = inst->Data) != 0) orig_inst->Data = current_insn(p); + if (inst->CondUpdate) + brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); + else + brw_set_conditionalmod(p, BRW_CONDITIONAL_NONE); + switch (inst->Opcode) { case WM_PIXELXY: emit_pixel_xy(c, inst); @@ -1110,6 +1146,9 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) case WM_CINTERP: emit_cinterp(c, inst); break; + case WM_WPOSXY: + emit_wpos_xy(c, inst); + break; case WM_FB_WRITE: emit_fb_write(c, inst); break; @@ -1258,10 +1297,13 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) loop_inst[loop_insn++] = brw_DO(p, BRW_EXECUTE_8); break; case OPCODE_BRK: - brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); brw_BREAK(p); brw_set_predicate_control(p, BRW_PREDICATE_NONE); break; + case OPCODE_CONT: + brw_CONT(p); + brw_set_predicate_control(p, BRW_PREDICATE_NONE); + break; case OPCODE_ENDLOOP: loop_insn--; inst0 = inst1 = brw_WHILE(p, loop_inst[loop_insn]); @@ -1272,13 +1314,20 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) if (inst0->header.opcode == BRW_OPCODE_BREAK) { inst0->bits3.if_else.jump_count = inst1 - inst0 + 1; inst0->bits3.if_else.pop_count = 0; - } + } else if (inst0->header.opcode == BRW_OPCODE_CONTINUE) { + inst0->bits3.if_else.jump_count = inst1 - inst0; + inst0->bits3.if_else.pop_count = 0; + } } break; default: _mesa_printf("unsupported IR in fragment shader %d\n", inst->Opcode); } + if (inst->CondUpdate) + brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); + else + brw_set_predicate_control(p, BRW_PREDICATE_NONE); } post_wm_emit(c); for (i = 0; i < c->fp->program.Base.NumInstructions; i++) -- cgit v1.2.3 From 3d6c4109902b555a3f8076170d572c7caeb6cbfe Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Sun, 30 Sep 2007 13:47:05 +0800 Subject: fragment shader function call fix, gl_FragCoord fix --- src/mesa/drivers/dri/i965/brw_eu.h | 5 +++++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index d44217d02fa..5c98767c3e5 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -648,6 +648,11 @@ static __inline struct brw_reg deref_1uw(struct brw_indirect ptr, GLint offset) return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UW); } +static __inline struct brw_reg deref_1ud(struct brw_indirect ptr, GLint offset) +{ + return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UD); +} + static __inline struct brw_reg get_addr_reg(struct brw_indirect ptr) { return brw_address_reg(ptr.addr_subnr); diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 1f1e32ee47e..58cdf72e372 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -966,7 +966,7 @@ static void emit_wpos_xy(struct brw_wm_compile *c, /* TODO -- window_height - Y */ brw_MOV(p, dst[1], - negate(retype(src0[1], BRW_REGISTER_TYPE_UW))); + retype(src0[1], BRW_REGISTER_TYPE_UW)); } } @@ -1272,7 +1272,7 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) brw_push_insn_state(p); brw_set_mask_control(p, BRW_MASK_DISABLE); brw_set_access_mode(p, BRW_ALIGN_1); - brw_ADD(p, deref_1uw(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16)); + brw_ADD(p, deref_1ud(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16)); brw_set_access_mode(p, BRW_ALIGN_16); brw_ADD(p, get_addr_reg(stack_index), get_addr_reg(stack_index), brw_imm_d(4)); @@ -1288,7 +1288,7 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) brw_ADD(p, get_addr_reg(stack_index), get_addr_reg(stack_index), brw_imm_d(-4)); brw_set_access_mode(p, BRW_ALIGN_1); - brw_MOV(p, brw_ip_reg(), deref_1uw(stack_index, 0)); + brw_MOV(p, brw_ip_reg(), deref_1ud(stack_index, 0)); brw_set_access_mode(p, BRW_ALIGN_16); brw_pop_insn_state(p); -- cgit v1.2.3 From 2dbd905ab0265b520efccce24ce9de66b6fc5fb0 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 2 Oct 2007 16:50:40 -0600 Subject: fix comment: s/branch/kill/ --- src/mesa/shader/slang/slang_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index fe13f2865cd..41646af387a 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -864,7 +864,7 @@ emit_kill(slang_emit_info *emitInfo) * Note that ARB-KILL depends on sign of vector operand. */ inst = new_instruction(emitInfo, OPCODE_KIL_NV); - inst->DstReg.CondMask = COND_TR; /* always branch */ + inst->DstReg.CondMask = COND_TR; /* always kill */ return inst; } -- cgit v1.2.3 From 4cd3ef58a989f61ff22669648e4117426c6e603c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 3 Oct 2007 15:50:46 +1000 Subject: i915/drmbuf: attempt to push relocations into buffer manager This moves the relocations into the buffer manager in prepration for a superioctl move. --- src/mesa/drivers/dri/common/dri_bufmgr.c | 16 ++++ src/mesa/drivers/dri/common/dri_bufmgr.h | 13 +++ src/mesa/drivers/dri/common/dri_bufmgr_fake.c | 131 +++++++++++++++++++++++++- src/mesa/drivers/dri/common/dri_bufmgr_ttm.c | 131 +++++++++++++++++++++++++- src/mesa/drivers/dri/i915/Makefile | 3 +- src/mesa/drivers/dri/i915/intel_batchbuffer.c | 112 +++------------------- src/mesa/drivers/dri/i915/intel_batchbuffer.h | 17 +--- 7 files changed, 305 insertions(+), 118 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 407409bf06d..359b57863ad 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -150,3 +150,19 @@ dri_bufmgr_destroy(dri_bufmgr *bufmgr) { bufmgr->destroy(bufmgr); } + + +void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee) +{ + batch_buf->bufmgr->emit_reloc(batch_buf, flags, delta, offset, relocatee); +} + +void dri_process_relocs(dri_bo *batch_buf) +{ + batch_buf->bufmgr->process_relocs(batch_buf); +} + +void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence) +{ + batch_buf->bufmgr->post_submit(batch_buf, last_fence); +} diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h index 3be342926f7..aeeb6bdb43c 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.h +++ b/src/mesa/drivers/dri/common/dri_bufmgr.h @@ -158,6 +158,15 @@ struct _dri_bufmgr { * Tears down the buffer manager instance. */ void (*destroy)(dri_bufmgr *bufmgr); + + /** + * Add relocation + */ + void (*emit_reloc)(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); + + void *(*process_relocs)(dri_bo *batch_buf); + + void (*post_submit)(dri_bo *batch_buf, dri_fence **fence); }; dri_bo *dri_bo_alloc(dri_bufmgr *bufmgr, const char *name, unsigned long size, @@ -195,4 +204,8 @@ void dri_bufmgr_destroy(dri_bufmgr *bufmgr); dri_bo *dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, unsigned int handle); +void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); +void dri_process_relocs(dri_bo *batch_buf); +void dri_post_process_relocs(dri_bo *batch_buf); +void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence); #endif diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c index e0d23a36477..adf0cf5ab72 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c @@ -59,6 +59,16 @@ * processed through the command queue wouldn't need to care about * fences. */ +#define MAX_RELOCS 4096 + +struct fake_buffer_reloc +{ + dri_bo *buf; + GLuint offset; + GLuint delta; /* not needed? */ + GLuint validate_flags; +}; + struct block { struct block *next, *prev; struct mem_block *mem; /* BM_MEM_AGP */ @@ -107,6 +117,12 @@ typedef struct _bufmgr_fake { int (*fence_wait)(void *private, unsigned int fence_cookie); /** Driver-supplied argument to driver callbacks */ void *driver_priv; + + + /** fake relocation list */ + struct fake_buffer_reloc reloc[MAX_RELOCS]; + GLuint nr_relocs; + GLboolean performed_rendering; } dri_bufmgr_fake; typedef struct _dri_bo_fake { @@ -837,6 +853,117 @@ dri_fake_destroy(dri_bufmgr *bufmgr) free(bufmgr); } +static void +dri_fake_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, + dri_bo *relocatee) +{ + dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)batch_buf->bufmgr; + struct fake_buffer_reloc *r = &bufmgr_fake->reloc[bufmgr_fake->nr_relocs++]; + + assert(bufmgr_fake->nr_relocs <= MAX_RELOCS); + + dri_bo_reference(relocatee); + + r->buf = relocatee; + r->offset = offset; + r->delta = delta; + r->validate_flags = flags; + + return; +} + + +static int +relocation_sort(const void *a_in, const void *b_in) { + const struct fake_buffer_reloc *a = a_in, *b = b_in; + + return (intptr_t)a->buf < (intptr_t)b->buf ? -1 : 1; +} + +static void * +dri_fake_process_reloc(dri_bo *batch_buf) +{ + dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)batch_buf->bufmgr; + GLuint i; + GLuint *ptr; + + assert(batch_buf->virtual != NULL); + ptr = batch_buf->virtual; + + bufmgr_fake->performed_rendering = GL_FALSE; + + /* Sort our relocation list in terms of referenced buffer pointer. + * This lets us uniquely validate the buffers with the sum of all the flags, + * while avoiding O(n^2) on number of relocations. + */ + qsort(bufmgr_fake->reloc, bufmgr_fake->nr_relocs, sizeof(bufmgr_fake->reloc[0]), + relocation_sort); + + /* Perform the necessary validations of buffers, and enter the relocations + * in the batchbuffer. + */ + for (i = 0; i < bufmgr_fake->nr_relocs; i++) { + struct fake_buffer_reloc *r = &bufmgr_fake->reloc[i]; + + if (r->validate_flags & DRM_BO_FLAG_WRITE) + bufmgr_fake->performed_rendering = GL_TRUE; + + /* If this is the first time we've seen this buffer in the relocation + * list, figure out our flags and validate it. + */ + if (i == 0 || bufmgr_fake->reloc[i - 1].buf != r->buf) { + uint32_t validate_flags; + int j, ret; + + /* Accumulate the flags we need for validating this buffer. */ + validate_flags = r->validate_flags; + for (j = i + 1; j < bufmgr_fake->nr_relocs; j++) { + if (bufmgr_fake->reloc[j].buf != r->buf) + break; + validate_flags |= bufmgr_fake->reloc[j].validate_flags; + } + + /* Validate. If we fail, fence to clear the unfenced list and bail + * out. + */ + ret = dri_bo_validate(r->buf, validate_flags); + if (ret != 0) { + dri_fence *fo; + dri_bo_unmap(batch_buf); + fo = dri_fence_validated(batch_buf->bufmgr, + "batchbuffer failure fence", GL_TRUE); + dri_fence_unreference(fo); + goto done; + } + } + ptr[r->offset / 4] = r->buf->offset + r->delta; + dri_bo_unreference(r->buf); + } + dri_bo_unmap(batch_buf); + + dri_bo_validate(batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE); + + bufmgr_fake->nr_relocs = 0; + done: + return NULL; +} + +static void +dri_fake_post_submit(dri_bo *batch_buf, dri_fence **last_fence) +{ + dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)batch_buf->bufmgr; + dri_fence *fo; + + fo = dri_fence_validated(batch_buf->bufmgr, "Batch fence", GL_TRUE); + + if (bufmgr_fake->performed_rendering) { + dri_fence_unreference(*last_fence); + *last_fence = fo; + } else { + dri_fence_unreference(fo); + } +} + dri_bufmgr * dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, unsigned long size, @@ -873,7 +1000,9 @@ dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, bufmgr_fake->bufmgr.fence_reference = dri_fake_fence_reference; bufmgr_fake->bufmgr.fence_unreference = dri_fake_fence_unreference; bufmgr_fake->bufmgr.destroy = dri_fake_destroy; - + bufmgr_fake->bufmgr.emit_reloc = dri_fake_emit_reloc; + bufmgr_fake->bufmgr.process_relocs = dri_fake_process_reloc; + bufmgr_fake->bufmgr.post_submit = dri_fake_post_submit; bufmgr_fake->fence_emit = fence_emit; bufmgr_fake->fence_wait = fence_wait; bufmgr_fake->driver_priv = driver_priv; diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c index 235398eb872..84ac0b2c0d9 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c @@ -43,6 +43,15 @@ #include "imports.h" #define BUFMGR_DEBUG 0 +#define MAX_RELOCS 4096 + +struct ttm_buffer_reloc +{ + dri_bo *buf; + GLuint offset; + GLuint delta; /* not needed? */ + GLuint validate_flags; +}; typedef struct _dri_bufmgr_ttm { dri_bufmgr bufmgr; @@ -51,6 +60,12 @@ typedef struct _dri_bufmgr_ttm { _glthread_Mutex mutex; unsigned int fence_type; unsigned int fence_type_flush; + + /** ttm relocation list */ + struct ttm_buffer_reloc reloc[MAX_RELOCS]; + GLuint nr_relocs; + GLboolean performed_rendering; + } dri_bufmgr_ttm; typedef struct _dri_bo_ttm { @@ -431,6 +446,118 @@ dri_bufmgr_ttm_destroy(dri_bufmgr *bufmgr) free(bufmgr); } + +static void +dri_ttm_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, + dri_bo *relocatee) +{ + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; + struct ttm_buffer_reloc *r = &bufmgr_ttm->reloc[bufmgr_ttm->nr_relocs++]; + + assert(bufmgr_ttm->nr_relocs <= MAX_RELOCS); + + dri_bo_reference(relocatee); + + r->buf = relocatee; + r->offset = offset; + r->delta = delta; + r->validate_flags = flags; + + return; +} + + +static int +relocation_sort(const void *a_in, const void *b_in) { + const struct ttm_buffer_reloc *a = a_in, *b = b_in; + + return (intptr_t)a->buf < (intptr_t)b->buf ? -1 : 1; +} + +static void * +dri_ttm_process_reloc(dri_bo *batch_buf) +{ + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; + GLuint i; + GLuint *ptr; + + assert(batch_buf->virtual != NULL); + ptr = batch_buf->virtual; + + bufmgr_ttm->performed_rendering = GL_FALSE; + + /* Sort our relocation list in terms of referenced buffer pointer. + * This lets us uniquely validate the buffers with the sum of all the flags, + * while avoiding O(n^2) on number of relocations. + */ + qsort(bufmgr_ttm->reloc, bufmgr_ttm->nr_relocs, sizeof(bufmgr_ttm->reloc[0]), + relocation_sort); + + /* Perform the necessary validations of buffers, and enter the relocations + * in the batchbuffer. + */ + for (i = 0; i < bufmgr_ttm->nr_relocs; i++) { + struct ttm_buffer_reloc *r = &bufmgr_ttm->reloc[i]; + + if (r->validate_flags & DRM_BO_FLAG_WRITE) + bufmgr_ttm->performed_rendering = GL_TRUE; + + /* If this is the first time we've seen this buffer in the relocation + * list, figure out our flags and validate it. + */ + if (i == 0 || bufmgr_ttm->reloc[i - 1].buf != r->buf) { + uint32_t validate_flags; + int j, ret; + + /* Accumulate the flags we need for validating this buffer. */ + validate_flags = r->validate_flags; + for (j = i + 1; j < bufmgr_ttm->nr_relocs; j++) { + if (bufmgr_ttm->reloc[j].buf != r->buf) + break; + validate_flags |= bufmgr_ttm->reloc[j].validate_flags; + } + + /* Validate. If we fail, fence to clear the unfenced list and bail + * out. + */ + ret = dri_bo_validate(r->buf, validate_flags); + if (ret != 0) { + dri_fence *fo; + dri_bo_unmap(batch_buf); + fo = dri_fence_validated(batch_buf->bufmgr, + "batchbuffer failure fence", GL_TRUE); + dri_fence_unreference(fo); + goto done; + } + } + ptr[r->offset / 4] = r->buf->offset + r->delta; + dri_bo_unreference(r->buf); + } + dri_bo_unmap(batch_buf); + + dri_bo_validate(batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE); + + bufmgr_ttm->nr_relocs = 0; + done: + return NULL; +} + +static void +dri_ttm_post_submit(dri_bo *batch_buf, dri_fence **last_fence) +{ + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; + dri_fence *fo; + + fo = dri_fence_validated(batch_buf->bufmgr, "Batch fence", GL_TRUE); + + if (bufmgr_ttm->performed_rendering) { + dri_fence_unreference(*last_fence); + *last_fence = fo; + } else { + dri_fence_unreference(fo); + } +} + /** * Initializes the TTM buffer manager, which uses the kernel to allocate, map, * and manage map buffer objections. @@ -464,6 +591,8 @@ dri_bufmgr_ttm_init(int fd, unsigned int fence_type, bufmgr_ttm->bufmgr.fence_unreference = dri_ttm_fence_unreference; bufmgr_ttm->bufmgr.fence_wait = dri_ttm_fence_wait; bufmgr_ttm->bufmgr.destroy = dri_bufmgr_ttm_destroy; - + bufmgr_ttm->bufmgr.emit_reloc = dri_ttm_emit_reloc; + bufmgr_ttm->bufmgr.process_relocs = dri_ttm_process_reloc; + bufmgr_ttm->bufmgr.post_submit = dri_ttm_post_submit; return &bufmgr_ttm->bufmgr; } diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index 38e40902111..84749f1fd95 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -52,7 +52,8 @@ DRIVER_SOURCES = \ intel_state.c \ intel_tris.c \ intel_fbo.c \ - intel_depthstencil.c + intel_depthstencil.c \ + intel_drmbuf.c C_SOURCES = \ $(COMMON_SOURCES) \ diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.c b/src/mesa/drivers/dri/i915/intel_batchbuffer.c index 045ff0a5b09..6934b8841ea 100644 --- a/src/mesa/drivers/dri/i915/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.c @@ -116,85 +116,21 @@ intel_batchbuffer_free(struct intel_batchbuffer *batch) free(batch); } -static int -relocation_sort(const void *a_in, const void *b_in) { - const struct buffer_reloc *a = a_in, *b = b_in; - - return (intptr_t)a->buf < (intptr_t)b->buf ? -1 : 1; -} /* TODO: Push this whole function into bufmgr. */ static void do_flush_locked(struct intel_batchbuffer *batch, - GLuint used, - GLboolean ignore_cliprects, GLboolean allow_unlock) + GLuint used, + GLboolean ignore_cliprects, GLboolean allow_unlock) { - GLuint *ptr; - GLuint i; struct intel_context *intel = batch->intel; - dri_fence *fo; - GLboolean performed_rendering = GL_FALSE; - - assert(batch->buf->virtual != NULL); - ptr = batch->buf->virtual; - - /* Sort our relocation list in terms of referenced buffer pointer. - * This lets us uniquely validate the buffers with the sum of all the flags, - * while avoiding O(n^2) on number of relocations. - */ - qsort(batch->reloc, batch->nr_relocs, sizeof(batch->reloc[0]), - relocation_sort); - - /* Perform the necessary validations of buffers, and enter the relocations - * in the batchbuffer. - */ - for (i = 0; i < batch->nr_relocs; i++) { - struct buffer_reloc *r = &batch->reloc[i]; - if (r->validate_flags & DRM_BO_FLAG_WRITE) - performed_rendering = GL_TRUE; + dri_process_relocs(batch->buf); - /* If this is the first time we've seen this buffer in the relocation - * list, figure out our flags and validate it. - */ - if (i == 0 || batch->reloc[i - 1].buf != r->buf) { - uint32_t validate_flags; - int j, ret; - - /* Accumulate the flags we need for validating this buffer. */ - validate_flags = r->validate_flags; - for (j = i + 1; j < batch->nr_relocs; j++) { - if (batch->reloc[j].buf != r->buf) - break; - validate_flags |= batch->reloc[j].validate_flags; - } - - /* Validate. If we fail, fence to clear the unfenced list and bail - * out. - */ - ret = dri_bo_validate(r->buf, validate_flags); - if (ret != 0) { - dri_bo_unmap(batch->buf); - fo = dri_fence_validated(intel->intelScreen->bufmgr, - "batchbuffer failure fence", GL_TRUE); - dri_fence_unreference(fo); - goto done; - } - } - ptr[r->offset / 4] = r->buf->offset + r->delta; - dri_bo_unreference(r->buf); - } - - dri_bo_unmap(batch->buf); batch->map = NULL; batch->ptr = NULL; - - dri_bo_validate(batch->buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE); - - batch->list_count = 0; - batch->nr_relocs = 0; batch->flags = 0; /* Throw away non-effective packets. Won't work once we have @@ -208,21 +144,7 @@ do_flush_locked(struct intel_batchbuffer *batch, used, ignore_cliprects, allow_unlock); } - /* Associate a fence with the validated buffers, and note that we included - * a flush at the end. - */ - fo = dri_fence_validated(intel->intelScreen->bufmgr, - "Batch fence", GL_TRUE); - - if (performed_rendering) { - dri_fence_unreference(batch->last_fence); - batch->last_fence = fo; - } else { - /* If we didn't validate any buffers for writing by the card, we don't - * need to track the fence for glFinish(). - */ - dri_fence_unreference(fo); - } + dri_post_submit(batch->buf, &batch->last_fence); if (intel->numClipRects == 0 && !ignore_cliprects) { if (allow_unlock) { @@ -237,16 +159,14 @@ do_flush_locked(struct intel_batchbuffer *batch, intel->vtbl.lost_hardware(intel); } -done: if (INTEL_DEBUG & DEBUG_BATCH) { - dri_bo_map(batch->buf, GL_FALSE); - intel_decode(ptr, used / 4, batch->buf->offset, - intel->intelScreen->deviceID); - dri_bo_unmap(batch->buf); + // dri_bo_map(batch->buf, GL_FALSE); + // intel_decode(ptr, used / 4, batch->buf->offset, + // intel->intelScreen->deviceID); + // dri_bo_unmap(batch->buf); } } - void intel_batchbuffer_flush(struct intel_batchbuffer *batch) { @@ -280,7 +200,7 @@ intel_batchbuffer_flush(struct intel_batchbuffer *batch) do_flush_locked(batch, used, !(batch->flags & INTEL_BATCH_CLIPRECTS), GL_FALSE); - + if (!was_locked) UNLOCK_HARDWARE(intel); @@ -305,22 +225,12 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, dri_bo *buffer, GLuint flags, GLuint delta) { - struct buffer_reloc *r = &batch->reloc[batch->nr_relocs++]; - - assert(batch->nr_relocs <= MAX_RELOCS); - - dri_bo_reference(buffer); - r->buf = buffer; - r->offset = batch->ptr - batch->map; - r->delta = delta; - r->validate_flags = flags; - + dri_emit_reloc(batch->buf, flags, delta, batch->ptr - batch->map, buffer); batch->ptr += 4; + return GL_TRUE; } - - void intel_batchbuffer_data(struct intel_batchbuffer *batch, const void *data, GLuint bytes, GLuint flags) diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.h b/src/mesa/drivers/dri/i915/intel_batchbuffer.h index 850a91e1c91..3cb272d7346 100644 --- a/src/mesa/drivers/dri/i915/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.h @@ -2,6 +2,9 @@ #define INTEL_BATCHBUFFER_H #include "mtypes.h" + +#include "intel_drmbuf.h" + #include "dri_bufmgr.h" struct intel_context; @@ -9,19 +12,9 @@ struct intel_context; #define BATCH_SZ 16384 #define BATCH_RESERVED 16 -#define MAX_RELOCS 4096 - #define INTEL_BATCH_NO_CLIPRECTS 0x1 #define INTEL_BATCH_CLIPRECTS 0x2 -struct buffer_reloc -{ - dri_bo *buf; - GLuint offset; - GLuint delta; /* not needed? */ - GLuint validate_flags; -}; - struct intel_batchbuffer { struct intel_context *intel; @@ -30,13 +23,9 @@ struct intel_batchbuffer dri_fence *last_fence; GLuint flags; - drmBOList list; - GLuint list_count; GLubyte *map; GLubyte *ptr; - struct buffer_reloc reloc[MAX_RELOCS]; - GLuint nr_relocs; GLuint size; }; -- cgit v1.2.3 From fa031c8914d685e153b4ab886f43fdbfbbd0a30b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 3 Oct 2007 16:54:59 +1000 Subject: i915: add superioctl initial support inside bufmgr ttm --- src/mesa/drivers/dri/common/dri_bufmgr.c | 4 +- src/mesa/drivers/dri/common/dri_bufmgr.h | 4 +- src/mesa/drivers/dri/common/dri_bufmgr_fake.c | 2 +- src/mesa/drivers/dri/i915/Makefile | 2 +- src/mesa/drivers/dri/i915/intel_batchbuffer.c | 18 +- src/mesa/drivers/dri/i915/intel_batchbuffer.h | 2 - src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c | 950 ++++++++++++++++++++++++++ src/mesa/drivers/dri/i915/intel_ioctl.c | 48 +- src/mesa/drivers/dri/i915/intel_regions.c | 2 +- src/mesa/drivers/dri/i915/intel_screen.c | 2 +- 10 files changed, 1016 insertions(+), 18 deletions(-) create mode 100644 src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 359b57863ad..7eee0fbf501 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -157,9 +157,9 @@ void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset batch_buf->bufmgr->emit_reloc(batch_buf, flags, delta, offset, relocatee); } -void dri_process_relocs(dri_bo *batch_buf) +void *dri_process_relocs(dri_bo *batch_buf, GLuint *hack) { - batch_buf->bufmgr->process_relocs(batch_buf); + return batch_buf->bufmgr->process_relocs(batch_buf, hack); } void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence) diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h index aeeb6bdb43c..f6f283eaa62 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.h +++ b/src/mesa/drivers/dri/common/dri_bufmgr.h @@ -164,7 +164,7 @@ struct _dri_bufmgr { */ void (*emit_reloc)(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); - void *(*process_relocs)(dri_bo *batch_buf); + void *(*process_relocs)(dri_bo *batch_buf, void *hack); void (*post_submit)(dri_bo *batch_buf, dri_fence **fence); }; @@ -205,7 +205,7 @@ dri_bo *dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, unsigned int handle); void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); -void dri_process_relocs(dri_bo *batch_buf); +void *dri_process_relocs(dri_bo *batch_buf, GLuint *hack); void dri_post_process_relocs(dri_bo *batch_buf); void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence); #endif diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c index adf0cf5ab72..21b09b448b5 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c @@ -881,7 +881,7 @@ relocation_sort(const void *a_in, const void *b_in) { } static void * -dri_fake_process_reloc(dri_bo *batch_buf) +dri_fake_process_reloc(dri_bo *batch_buf, GLuint *hack) { dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)batch_buf->bufmgr; GLuint i; diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index 84749f1fd95..b9328a48f3d 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -53,7 +53,7 @@ DRIVER_SOURCES = \ intel_tris.c \ intel_fbo.c \ intel_depthstencil.c \ - intel_drmbuf.c + intel_bufmgr_ttm.c C_SOURCES = \ $(COMMON_SOURCES) \ diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.c b/src/mesa/drivers/dri/i915/intel_batchbuffer.c index 6934b8841ea..46bcb9a941a 100644 --- a/src/mesa/drivers/dri/i915/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.c @@ -126,8 +126,10 @@ do_flush_locked(struct intel_batchbuffer *batch, GLboolean ignore_cliprects, GLboolean allow_unlock) { struct intel_context *intel = batch->intel; + void *start; + uint32_t hack; - dri_process_relocs(batch->buf); + start = dri_process_relocs(batch->buf, &hack); batch->map = NULL; batch->ptr = NULL; @@ -139,11 +141,17 @@ do_flush_locked(struct intel_batchbuffer *batch, */ if (!(intel->numClipRects == 0 && !ignore_cliprects)) { - intel_batch_ioctl(batch->intel, - batch->buf->offset, - used, ignore_cliprects, allow_unlock); + if (intel->intelScreen->ttm == GL_TRUE) { + intel_exec_ioctl(batch->intel, + used, ignore_cliprects, allow_unlock, + start, &hack); + } else { + intel_batch_ioctl(batch->intel, + batch->buf->offset, + used, ignore_cliprects, allow_unlock); + } } - + dri_post_submit(batch->buf, &batch->last_fence); if (intel->numClipRects == 0 && !ignore_cliprects) { diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.h b/src/mesa/drivers/dri/i915/intel_batchbuffer.h index 3cb272d7346..b5c7a783a72 100644 --- a/src/mesa/drivers/dri/i915/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.h @@ -3,8 +3,6 @@ #include "mtypes.h" -#include "intel_drmbuf.h" - #include "dri_bufmgr.h" struct intel_context; diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c new file mode 100644 index 00000000000..45a9aa3ed14 --- /dev/null +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c @@ -0,0 +1,950 @@ +/************************************************************************** + * + * Copyright © 2007 Intel Corporation + * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * + **************************************************************************/ +/* + * Authors: Thomas Hellström + * Keith Whitwell + * Eric Anholt + */ + +#include +#include +#include +#include "glthread.h" +#include "errno.h" +#include "mtypes.h" +#include "dri_bufmgr.h" +#include "string.h" +#include "imports.h" + +#include "i915_drm.h" + +#define BUFMGR_DEBUG 0 + +#define MAX_RELOCS_PER_LIST 511 +struct intel_reloc_info +{ + GLuint type; + GLuint reloc; + GLuint delta; /* not needed? */ + GLuint index; + drm_handle_t handle; +}; + +struct intel_bo_node +{ + drmMMListHead head; + drmBO *buf; + struct drm_i915_op_arg bo_arg; + unsigned long arg0; + unsigned long arg1; + void (*destroy)(void *); + void *priv; +}; + +struct intel_bo_reloc_list +{ + drmMMListHead head; + drmBO buf; + uint32_t *relocs; +}; + +struct intel_bo_reloc_node +{ + drmMMListHead head; + drm_handle_t handle; + uint32_t nr_reloc_types; + struct intel_bo_reloc_list type_list; +}; + +struct intel_bo_list { + unsigned numTarget; + unsigned numCurrent; + unsigned numOnList; + drmMMListHead list; + drmMMListHead free; + void (*destroy)(void *node); +}; + +typedef struct _dri_bufmgr_ttm { + dri_bufmgr bufmgr; + + int fd; + _glthread_Mutex mutex; + unsigned int fence_type; + unsigned int fence_type_flush; + + /** ttm relocation list */ + struct intel_bo_list list; + struct intel_bo_list reloc_list; + +} dri_bufmgr_ttm; + +typedef struct _dri_bo_ttm { + dri_bo bo; + + int refcount; /* Protected by bufmgr->mutex */ + drmBO drm_bo; + const char *name; + /** + * Note whether we are the owner of the buffer, to determine if we must + * drmBODestroy or drmBOUnreference to unreference the buffer. + */ + GLboolean owner; +} dri_bo_ttm; + +typedef struct _dri_fence_ttm +{ + dri_fence fence; + + int refcount; /* Protected by bufmgr->mutex */ + const char *name; + drmFence drm_fence; +} dri_fence_ttm; + + +static int i830AdjustListNodes(struct intel_bo_list *list) +{ + struct intel_bo_node *node; + drmMMListHead *l; + int ret = 0; + + while(list->numCurrent < list->numTarget) { + node = (struct intel_bo_node *) drmMalloc(sizeof(*node)); + if (!node) { + ret = -ENOMEM; + break; + } + list->numCurrent++; + DRMLISTADD(&node->head, &list->free); + } + + while(list->numCurrent > list->numTarget) { + l = list->free.next; + if (l == &list->free) + break; + DRMLISTDEL(l); + node = DRMLISTENTRY(struct intel_bo_node, l, head); + list->destroy(node); + list->numCurrent--; + } + return ret; +} + +void intel_bo_free_list(struct intel_bo_list *list) +{ + struct intel_bo_node *node; + drmMMListHead *l; + + l = list->list.next; + while(l != &list->list) { + DRMLISTDEL(l); + node = DRMLISTENTRY(struct intel_bo_node, l, head); + list->destroy(node); + l = list->list.next; + list->numCurrent--; + list->numOnList--; + } + + l = list->free.next; + while(l != &list->free) { + DRMLISTDEL(l); + node = DRMLISTENTRY(struct intel_bo_node, l, head); + list->destroy(node); + l = list->free.next; + list->numCurrent--; + } +} + +int intel_bo_reset_list(struct intel_bo_list *list) +{ + drmMMListHead *l; + int ret; + + ret = i830AdjustListNodes(list); + if (ret) + return ret; + + l = list->list.next; + while (l != &list->list) { + DRMLISTDEL(l); + DRMLISTADD(l, &list->free); + list->numOnList--; + l = list->list.next; + } + return i830AdjustListNodes(list); +} + +static void generic_destroy(void *nodep) +{ + free(nodep); +} + +int intel_create_bo_list(int numTarget, struct intel_bo_list *list, void (*destroy)(void *)) +{ + DRMINITLISTHEAD(&list->list); + DRMINITLISTHEAD(&list->free); + list->numTarget = numTarget; + list->numCurrent = 0; + list->numOnList = 0; + if (list->destroy) + list->destroy = destroy; + else + list->destroy = generic_destroy; + return i830AdjustListNodes(list); +} + + +struct drm_i915_op_arg * +intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_list *reloc_list) +{ + struct intel_bo_node *node; + struct intel_bo_reloc_node *rl_node; + drmMMListHead *l, *rl; + struct drm_i915_op_arg *arg, *first; + struct drm_bo_op_req *req; + uint64_t *prevNext = NULL; + + first = NULL; + + for (l = list->list.next; l != &list->list; l = l->next) { + node = DRMLISTENTRY(struct intel_bo_node, l, head); + + arg = &node->bo_arg; + req = &arg->d.req; + + if (!first) + first = arg; + + if (prevNext) + *prevNext = (unsigned long) arg; + + memset(arg, 0, sizeof(*arg)); + prevNext = &arg->next; + req->bo_req.handle = node->buf->handle; + req->op = drm_bo_validate; + req->bo_req.flags = node->arg0; + req->bo_req.hint = 0; + req->bo_req.mask = node->arg1; + req->bo_req.fence_class = 0; /* Backwards compat. */ + arg->reloc_handle = 0; + + for (rl = reloc_list->list.next; rl != &reloc_list->list; rl = rl->next) { + rl_node = DRMLISTENTRY(struct intel_bo_reloc_node, rl, head); + + if (rl_node->handle == node->buf->handle) { + arg->reloc_handle = rl_node->type_list.buf.handle; + // drmBOUnmap(fd, &rl_node->type_list.buf); + } + } + } + + if (!first) + return 0; + + return first; +} + +void intel_free_validate_list(int fd, struct intel_bo_list *list) +{ + struct intel_bo_node *node; + drmMMListHead *l; + + for (l = list->list.next; l != &list->list; l = l->next) { + node = DRMLISTENTRY(struct intel_bo_node, l, head); + + if (node->destroy) + (*node->destroy)(node->priv); + + } +} + +void intel_free_reloc_list(int fd, struct intel_bo_list *reloc_list) +{ + struct intel_bo_reloc_node *reloc_node; + drmMMListHead *rl, *tmp; + + for (rl = reloc_list->list.next, tmp = rl->next; rl != &reloc_list->list; rl = tmp, tmp = rl->next) { + reloc_node = DRMLISTENTRY(struct intel_bo_reloc_node, rl, head); + + DRMLISTDEL(rl); + + if (reloc_node->nr_reloc_types > 1) { + + /* TODO */ + } + + drmBOUnmap(fd, &reloc_node->type_list.buf); + drmBODestroy(fd, &reloc_node->type_list.buf); + free(reloc_node); + } +} + +int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, unsigned flags, + unsigned mask, int *itemLoc, void (*destroy_cb)(void *)) +{ + struct intel_bo_node *node, *cur; + drmMMListHead *l; + int count = 0; + int ret = 0; + drmBO *buf_bo = &((dri_bo_ttm *)buf)->drm_bo; + cur = NULL; + + for (l = list->list.next; l != &list->list; l = l->next) { + node = DRMLISTENTRY(struct intel_bo_node, l, head); + if (node->buf == buf_bo) { + cur = node; + break; + } + count++; + } + + if (!cur) { + cur = drmMalloc(sizeof(*cur)); + if (!cur) { + return -ENOMEM; + } + cur->buf = buf_bo; + cur->priv = buf; + cur->arg0 = flags; + cur->arg1 = mask; + cur->destroy = destroy_cb; + ret = 1; + + DRMLISTADDTAIL(&cur->head, &list->list); + + } else { + unsigned memMask = (cur->arg1 | mask) & DRM_BO_MASK_MEM; + unsigned memFlags = cur->arg0 & flags & memMask; + + if (!memFlags) { +#if 0 + ErrorF("Incompatible memory location requests " + "on validate list.\n"); + ErrorF("Previous flag: 0x%08lx, mask: 0x%08lx\n", + cur->arg0, cur->arg1); + ErrorF("Current flag: 0x%08lx, mask: 0x%08lx\n", + flags, mask); +#endif + return -EINVAL; + } + if (mask & cur->arg1 & ~DRM_BO_MASK_MEM & (cur->arg0 ^ flags)) { +#if 0 + ErrorF("Incompatible buffer flag requests " + "on validate list.\n"); + ErrorF("Previous flag: 0x%08lx, mask: 0x%08lx\n", + cur->arg0, cur->arg1); + ErrorF("Current flag: 0x%08lx, mask: 0x%08lx\n", + flags, mask); +#endif + return -EINVAL; + } + cur->arg1 |= mask; + cur->arg0 = memFlags | ((cur->arg0 | flags) & + cur->arg1 & ~DRM_BO_MASK_MEM); + } + *itemLoc = count; + return ret; +} + +#define RELOC0_STRIDE 4 +#define RELOC0_HEADER 4 +#define RELOC_BUF_SIZE ((RELOC0_HEADER + MAX_RELOCS_PER_LIST * RELOC0_STRIDE) * sizeof(uint32_t)) + +static int intel_create_new_reloc_type_list(int fd, struct intel_bo_reloc_list *cur_type) +{ + int ret; + + /* should allocate a drmBO here */ + ret = drmBOCreate(fd, 0, RELOC_BUF_SIZE, 0, + NULL, drm_bo_type_dc, + DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE | DRM_BO_FLAG_CACHED, + 0, &cur_type->buf); + if (ret) + return ret; + + ret = drmBOMap(fd, &cur_type->buf, DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, 0, (void **)&cur_type->relocs); + if (ret) + return ret; + return 0; +} + + +int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, struct intel_reloc_info *reloc_info) +{ + struct intel_bo_reloc_node *rl_node, *cur; + drmMMListHead *rl, *l; + int ret = 0; + uint32_t *reloc_start; + int num_relocs; + struct intel_bo_reloc_list *cur_type; + + cur = NULL; + + for (rl = reloc_list->list.next; rl != &reloc_list->list; rl = rl->next) { + rl_node = DRMLISTENTRY(struct intel_bo_reloc_node, rl, head); + if (rl_node->handle == reloc_info->handle) { + cur = rl_node; + break; + + } + } + + if (!cur) { + + cur = malloc(sizeof(*cur)); + if (!cur) + return -ENOMEM; + + cur->nr_reloc_types = 1; + cur->handle = reloc_info->handle; + cur_type = &cur->type_list; + + DRMINITLISTHEAD(&cur->type_list.head); + ret = intel_create_new_reloc_type_list(fd, cur_type); + if (ret) { + return -1; + } + DRMLISTADDTAIL(&cur->head, &reloc_list->list); + + cur_type->relocs[0] = 0 | (reloc_info->type << 16); + cur_type->relocs[1] = 0; // next reloc buffer handle is 0 + + } else { + int found = 0; + if ((cur->type_list.relocs[0] >> 16) == reloc_info->type) { + cur_type = &cur->type_list; + found = 1; + } else { + for (l = cur->type_list.head.next; l != &cur->type_list.head; l = l->next) { + cur_type = DRMLISTENTRY(struct intel_bo_reloc_list, l, head); + if (((cur_type->relocs[0] >> 16) & 0xffff) == reloc_info->type) + found = 1; + break; + } + } + + /* didn't find the relocation type */ + if (!found) { + cur_type = malloc(sizeof(*cur_type)); + if (!cur_type) { + return -ENOMEM; + } + + ret = intel_create_new_reloc_type_list(fd, cur_type); + DRMLISTADDTAIL(&cur_type->head, &cur->type_list.head); + + cur_type->relocs[0] = (reloc_info->type << 16); + cur_type->relocs[1] = 0; + + // cur->relocs[cur->nr_reloc_lists-1][1] = 0;// TODO ADD HANDLE HERE + + cur->nr_reloc_types++; + } + } + + reloc_start = cur_type->relocs; + + num_relocs = (reloc_start[0] & 0xffff); + + reloc_start[num_relocs*RELOC0_STRIDE + RELOC0_HEADER] = reloc_info->reloc; + reloc_start[num_relocs*RELOC0_STRIDE + RELOC0_HEADER+1] = reloc_info->delta; + reloc_start[num_relocs*RELOC0_STRIDE + RELOC0_HEADER+2] = reloc_info->index; + reloc_start[0]++; + if (((reloc_start[0] & 0xffff)) > (MAX_RELOCS_PER_LIST)) { + return -ENOMEM; + } + return 0; +} + + +#if 0 +int +driFenceSignaled(DriFenceObject * fence, unsigned type) +{ + int signaled; + int ret; + + if (fence == NULL) + return GL_TRUE; + + _glthread_LOCK_MUTEX(fence->mutex); + ret = drmFenceSignaled(bufmgr_ttm->fd, &fence->fence, type, &signaled); + _glthread_UNLOCK_MUTEX(fence->mutex); + BM_CKFATAL(ret); + return signaled; +} +#endif + +static dri_bo * +dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name, + unsigned long size, unsigned int alignment, + unsigned int location_mask) +{ + dri_bufmgr_ttm *ttm_bufmgr; + dri_bo_ttm *ttm_buf; + unsigned int pageSize = getpagesize(); + int ret; + unsigned int flags, hint; + + ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr; + + ttm_buf = malloc(sizeof(*ttm_buf)); + if (!ttm_buf) + return NULL; + + /* The mask argument doesn't do anything for us that we want other than + * determine which pool (TTM or local) the buffer is allocated into, so just + * pass all of the allocation class flags. + */ + flags = location_mask | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | + DRM_BO_FLAG_EXE; + /* No hints we want to use. */ + hint = 0; + + ret = drmBOCreate(ttm_bufmgr->fd, 0, size, alignment / pageSize, + NULL, drm_bo_type_dc, + flags, hint, &ttm_buf->drm_bo); + if (ret != 0) { + free(ttm_buf); + return NULL; + } + ttm_buf->bo.size = ttm_buf->drm_bo.size; + ttm_buf->bo.offset = ttm_buf->drm_bo.offset; + ttm_buf->bo.virtual = NULL; + ttm_buf->bo.bufmgr = bufmgr; + ttm_buf->name = name; + ttm_buf->refcount = 1; + ttm_buf->owner = GL_TRUE; + +#if BUFMGR_DEBUG + fprintf(stderr, "bo_create: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); +#endif + + return &ttm_buf->bo; +} + +/* Our TTM backend doesn't allow creation of static buffers, as that requires + * privelege for the non-fake case, and the lock in the fake case where we were + * working around the X Server not creating buffers and passing handles to us. + */ +static dri_bo * +dri_ttm_alloc_static(dri_bufmgr *bufmgr, const char *name, + unsigned long offset, unsigned long size, void *virtual, + unsigned int location_mask) +{ + return NULL; +} + +/** Returns a dri_bo wrapping the given buffer object handle. + * + * This can be used when one application needs to pass a buffer object + * to another. + */ +dri_bo * +intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, + unsigned int handle) +{ + dri_bufmgr_ttm *ttm_bufmgr; + dri_bo_ttm *ttm_buf; + int ret; + + ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr; + + ttm_buf = malloc(sizeof(*ttm_buf)); + if (!ttm_buf) + return NULL; + + ret = drmBOReference(ttm_bufmgr->fd, handle, &ttm_buf->drm_bo); + if (ret != 0) { + free(ttm_buf); + return NULL; + } + ttm_buf->bo.size = ttm_buf->drm_bo.size; + ttm_buf->bo.offset = ttm_buf->drm_bo.offset; + ttm_buf->bo.virtual = NULL; + ttm_buf->bo.bufmgr = bufmgr; + ttm_buf->name = name; + ttm_buf->refcount = 1; + ttm_buf->owner = GL_FALSE; + +#if BUFMGR_DEBUG + fprintf(stderr, "bo_create_from_handle: %p (%s)\n", &ttm_buf->bo, + ttm_buf->name); +#endif + + return &ttm_buf->bo; +} + +static void +dri_ttm_bo_reference(dri_bo *buf) +{ + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; + dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; + + _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); + ttm_buf->refcount++; + _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); +} + +static void +dri_ttm_bo_unreference(dri_bo *buf) +{ + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; + dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; + + if (!buf) + return; + + _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); + if (--ttm_buf->refcount == 0) { + int ret; + + /* XXX Having to use drmBODestroy as the opposite of drmBOCreate instead + * of simply unreferencing is madness, and leads to behaviors we may not + * want (making the buffer unsharable). + */ + if (ttm_buf->owner) + ret = drmBODestroy(bufmgr_ttm->fd, &ttm_buf->drm_bo); + else + ret = drmBOUnReference(bufmgr_ttm->fd, &ttm_buf->drm_bo); + if (ret != 0) { + fprintf(stderr, "drmBOUnReference failed (%s): %s\n", ttm_buf->name, + strerror(-ret)); + } +#if BUFMGR_DEBUG + fprintf(stderr, "bo_unreference final: %p (%s)\n", + &ttm_buf->bo, ttm_buf->name); +#endif + _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); + free(buf); + return; + } + _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); +} + +static int +dri_ttm_bo_map(dri_bo *buf, GLboolean write_enable) +{ + dri_bufmgr_ttm *bufmgr_ttm; + dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; + unsigned int flags; + + bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; + + flags = DRM_BO_FLAG_READ; + if (write_enable) + flags |= DRM_BO_FLAG_WRITE; + + assert(buf->virtual == NULL); + +#if BUFMGR_DEBUG + fprintf(stderr, "bo_map: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); +#endif + + return drmBOMap(bufmgr_ttm->fd, &ttm_buf->drm_bo, flags, 0, &buf->virtual); +} + +static int +dri_ttm_bo_unmap(dri_bo *buf) +{ + dri_bufmgr_ttm *bufmgr_ttm; + dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; + + if (buf == NULL) + return 0; + + bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; + + assert(buf->virtual != NULL); + + buf->virtual = NULL; + +#if BUFMGR_DEBUG + fprintf(stderr, "bo_unmap: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); +#endif + + return drmBOUnmap(bufmgr_ttm->fd, &ttm_buf->drm_bo); +} + +static int +dri_ttm_validate(dri_bo *buf, unsigned int flags) +{ + dri_bufmgr_ttm *bufmgr_ttm; + dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; + unsigned int mask; + int err; + + /* XXX: Sanity-check whether we've already validated this one under + * different flags. See drmAddValidateItem(). + */ + + bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; + + /* Calculate the appropriate mask to pass to the DRM. There appears to be + * be a direct relationship to flags, so it's unnecessary to have it passed + * in as an argument. + */ + mask = DRM_BO_MASK_MEM; + mask |= flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE); + + err = drmBOValidate(bufmgr_ttm->fd, &ttm_buf->drm_bo, 0, flags, mask, 0); + + if (err == 0) { + /* XXX: add to fence list for sanity checking */ + } else { + fprintf(stderr, "failed to validate buffer (%s): %s\n", + ttm_buf->name, strerror(-err)); + } + + buf->offset = ttm_buf->drm_bo.offset; + +#if BUFMGR_DEBUG + fprintf(stderr, "bo_validate: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); +#endif + + return err; +} + +static dri_fence * +dri_ttm_fence_validated(dri_bufmgr *bufmgr, const char *name, + GLboolean flushed) +{ + dri_fence_ttm *fence_ttm = malloc(sizeof(*fence_ttm)); + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr; + int ret; + unsigned int type; + + if (!fence_ttm) + return NULL; + + if (flushed) + type = bufmgr_ttm->fence_type_flush; + else + type = bufmgr_ttm->fence_type; + + fence_ttm->refcount = 1; + fence_ttm->name = name; + fence_ttm->fence.bufmgr = bufmgr; + ret = drmFenceBuffers(bufmgr_ttm->fd, type, 0, &fence_ttm->drm_fence); + if (ret) { + fprintf(stderr, "failed to fence (%s): %s\n", name, strerror(-ret)); + free(fence_ttm); + return NULL; + } + +#if BUFMGR_DEBUG + fprintf(stderr, "fence_validated: %p (%s)\n", &fence_ttm->fence, + fence_ttm->name); +#endif + + return &fence_ttm->fence; +} + +static void +dri_ttm_fence_reference(dri_fence *fence) +{ + dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence; + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr; + + _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); + ++fence_ttm->refcount; + _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); +} + +static void +dri_ttm_fence_unreference(dri_fence *fence) +{ + dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence; + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr; + + if (!fence) + return; + + _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); + if (--fence_ttm->refcount == 0) { + int ret; + + /* XXX Having to use drmFenceDestroy as the opposite of drmFenceBuffers + * instead of simply unreferencing is madness, and leads to behaviors we + * may not want (making the fence unsharable). This behavior by the DRM + * ioctls should be fixed, and drmFenceDestroy eliminated. + */ + ret = drmFenceDestroy(bufmgr_ttm->fd, &fence_ttm->drm_fence); + if (ret != 0) { + fprintf(stderr, "drmFenceDestroy failed (%s): %s\n", + fence_ttm->name, strerror(-ret)); + } + + _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); + free(fence); + return; + } + _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); +} + +static void +dri_ttm_fence_wait(dri_fence *fence) +{ + dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence; + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr; + int ret; + + _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); + ret = drmFenceWait(bufmgr_ttm->fd, 0, &fence_ttm->drm_fence, 0); + _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); + if (ret != 0) { + _mesa_printf("%s:%d: Error %d waiting for fence %s.\n", + __FILE__, __LINE__, ret, fence_ttm->name); + abort(); + } + +#if BUFMGR_DEBUG + fprintf(stderr, "fence_wait: %p (%s)\n", &fence_ttm->fence, + fence_ttm->name); +#endif +} + +static void +dri_bufmgr_ttm_destroy(dri_bufmgr *bufmgr) +{ + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr; + + _glthread_DESTROY_MUTEX(bufmgr_ttm->mutex); + free(bufmgr); +} + + +static void intel_dribo_destroy_callback(void *priv) +{ + dri_bo *dribo = priv; + + if (dribo) { + dri_bo_unreference(dribo); + } +} + +static void +dri_ttm_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, + dri_bo *relocatee) +{ + dri_bo_ttm *ttm_buf = (dri_bo_ttm *)batch_buf; + dri_bo_ttm *relocatee_buf = (dri_bo_ttm *)relocatee; + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; + int newItem; + struct intel_reloc_info reloc; + + intel_add_validate_buffer(&bufmgr_ttm->list, relocatee, flags, flags, &newItem, intel_dribo_destroy_callback); + + reloc.type = I915_RELOC_TYPE_0; + reloc.reloc = offset; + reloc.delta = delta; + reloc.index = newItem; + reloc.handle = ttm_buf->drm_bo.handle; + + intel_add_validate_reloc(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list, &reloc); + return; +} + + +static void * +dri_ttm_process_reloc(dri_bo *batch_buf, GLuint *hack) +{ + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; + void *ptr; + int itemLoc; + + intel_add_validate_buffer(&bufmgr_ttm->list, batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE, + DRM_BO_MASK_MEM | DRM_BO_FLAG_EXE, &itemLoc, NULL); + + ptr = intel_setup_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list, &bufmgr_ttm->reloc_list); + + *hack = ((dri_bo_ttm *)batch_buf)->drm_bo.handle; + return ptr; +} + +static void +dri_ttm_post_submit(dri_bo *batch_buf, dri_fence **last_fence) +{ + dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; + + intel_free_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list); + intel_free_reloc_list(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list); + + /* + + bb->fence.handle = execbuf.fence_arg.handle; + bb->fence.fence_class = execbuf.fence_arg.fence_class; + bb->fence.type = execbuf.fence_arg.type; + bb->fence.flags = execbuf.fence_arg.flags; + bb->fence.signaled = 0; + */ +} + +/** + * Initializes the TTM buffer manager, which uses the kernel to allocate, map, + * and manage map buffer objections. + * + * \param fd File descriptor of the opened DRM device. + * \param fence_type Driver-specific fence type used for fences with no flush. + * \param fence_type_flush Driver-specific fence type used for fences with a + * flush. + */ +dri_bufmgr * +intel_bufmgr_ttm_init(int fd, unsigned int fence_type, + unsigned int fence_type_flush) +{ + dri_bufmgr_ttm *bufmgr_ttm; + + bufmgr_ttm = malloc(sizeof(*bufmgr_ttm)); + bufmgr_ttm->fd = fd; + bufmgr_ttm->fence_type = fence_type; + bufmgr_ttm->fence_type_flush = fence_type_flush; + _glthread_INIT_MUTEX(bufmgr_ttm->mutex); + + intel_create_bo_list(40, &bufmgr_ttm->list, NULL); + intel_create_bo_list(1, &bufmgr_ttm->reloc_list, NULL); + + bufmgr_ttm->bufmgr.bo_alloc = dri_ttm_alloc; + bufmgr_ttm->bufmgr.bo_alloc_static = dri_ttm_alloc_static; + bufmgr_ttm->bufmgr.bo_reference = dri_ttm_bo_reference; + bufmgr_ttm->bufmgr.bo_unreference = dri_ttm_bo_unreference; + bufmgr_ttm->bufmgr.bo_map = dri_ttm_bo_map; + bufmgr_ttm->bufmgr.bo_unmap = dri_ttm_bo_unmap; + bufmgr_ttm->bufmgr.bo_validate = dri_ttm_validate; + bufmgr_ttm->bufmgr.fence_validated = dri_ttm_fence_validated; + bufmgr_ttm->bufmgr.fence_reference = dri_ttm_fence_reference; + bufmgr_ttm->bufmgr.fence_unreference = dri_ttm_fence_unreference; + bufmgr_ttm->bufmgr.fence_wait = dri_ttm_fence_wait; + bufmgr_ttm->bufmgr.destroy = dri_bufmgr_ttm_destroy; + bufmgr_ttm->bufmgr.emit_reloc = dri_ttm_emit_reloc; + bufmgr_ttm->bufmgr.process_relocs = dri_ttm_process_reloc; + bufmgr_ttm->bufmgr.post_submit = dri_ttm_post_submit; + return &bufmgr_ttm->bufmgr; +} + diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.c b/src/mesa/drivers/dri/i915/intel_ioctl.c index 6e76737c783..a93530c7b18 100644 --- a/src/mesa/drivers/dri/i915/intel_ioctl.c +++ b/src/mesa/drivers/dri/i915/intel_ioctl.c @@ -105,9 +105,6 @@ intel_batch_ioctl(struct intel_context *intel, * hardware contexts which would preserve statechanges beyond a * single buffer. */ - - - batch.start = start_offset; batch.used = used; batch.cliprects = intel->pClipRects; @@ -133,3 +130,48 @@ intel_batch_ioctl(struct intel_context *intel, */ intel->vtbl.lost_hardware(intel); } + +void +intel_exec_ioctl(struct intel_context *intel, + GLuint used, + GLboolean ignore_cliprects, GLboolean allow_unlock, + void *start, uint32_t *hack) +{ + struct drm_i915_execbuffer execbuf; + + assert(intel->locked); + assert(used); + + memset(&execbuf, 0, sizeof(execbuf)); + + execbuf.cmdbuf_handle = *hack; // TODO + execbuf.batch.used = used; + execbuf.batch.cliprects = intel->pClipRects; + execbuf.batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects; + execbuf.batch.DR1 = 0; + execbuf.batch.DR4 = ((((GLuint) intel->drawX) & 0xffff) | + (((GLuint) intel->drawY) << 16)); + + execbuf.ops_list = (unsigned)start; // TODO + execbuf.fence_arg.flags = DRM_I915_FENCE_FLAG_FLUSHED; + + if (drmCommandWrite(intel->driFd, DRM_I915_EXECBUFFER, &execbuf, + sizeof(execbuf))) { + fprintf(stderr, "DRM_I830_EXECBUFFER: %d\n", -errno); + UNLOCK_HARDWARE(intel); + exit(1); + } + + /* FIXME: use hardware contexts to avoid 'losing' hardware after + * each buffer flush. + */ + intel->vtbl.lost_hardware(intel); + +#if 0 + fence->handle = execbuf.fence_arg.handle; + fence->fence_class = execbuf.fence_arg.fence_class; + fence->type = execbuf.fence_arg.type; + fence->flags = execbuf.fence_arg.flags; + fence->fence.signaled = 0; +#endif +} diff --git a/src/mesa/drivers/dri/i915/intel_regions.c b/src/mesa/drivers/dri/i915/intel_regions.c index 4eac859a133..d2441970b3b 100644 --- a/src/mesa/drivers/dri/i915/intel_regions.c +++ b/src/mesa/drivers/dri/i915/intel_regions.c @@ -201,7 +201,7 @@ intel_region_update_static(intelScreenPrivate *intelScreen, dri_bo_unreference(region->buffer); if (intelScreen->ttm) { assert(bo_handle != -1); - region->buffer = dri_ttm_bo_create_from_handle(intelScreen->bufmgr, + region->buffer = intel_ttm_bo_create_from_handle(intelScreen->bufmgr, "static region", bo_handle); } else { diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 2721a900945..0b889b1aa0d 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -538,7 +538,7 @@ intelInitDriver(__DRIscreenPrivate * sPriv) if (getenv("INTEL_NO_TTM") == NULL && intelScreen->driScrnPriv->ddxMinor >= 9 && intelScreen->front.bo_handle != -1) { - intelScreen->bufmgr = dri_bufmgr_ttm_init(sPriv->fd, + intelScreen->bufmgr = intel_bufmgr_ttm_init(sPriv->fd, DRM_FENCE_TYPE_EXE, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW); -- cgit v1.2.3 From 1bc84102ad4df377df6c8bf5734b886b7683b939 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Wed, 3 Oct 2007 10:48:56 +0200 Subject: i915: Work around texture pitch related performance drops on i915 at least. --- src/mesa/drivers/dri/i915/intel_mipmap_tree.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c index 74f6b2d8515..aefb89ac83c 100644 --- a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c @@ -104,7 +104,16 @@ intel_miptree_create(struct intel_context *intel, * replaced at some point by some scheme to only do this when really * necessary. */ - mt->pitch = ((mt->pitch * cpp + 63) & ~63) / cpp; + mt->pitch = (mt->pitch * cpp + 63) & ~63; + + /* XXX: At least the i915 seems very upset when the pitch is a multiple + * of 1024 and sometimes 512 bytes - performance can drop by several + * times. Go to the next multiple of 64 for now. + */ + if (!(mt->pitch & 511)) + mt->pitch += 64; + + mt->pitch /= cpp; } mt->region = intel_region_alloc(intel->intelScreen, -- cgit v1.2.3 From 58cdd1dc520d211b65f05fd06b5ba472f552853c Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Wed, 3 Oct 2007 11:25:59 +0200 Subject: i915: Only align texture pitch to 64 bytes when textures can be render targets. --- src/mesa/drivers/dri/i915/intel_mipmap_tree.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c index aefb89ac83c..2c167a9ab7b 100644 --- a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c @@ -99,19 +99,27 @@ intel_miptree_create(struct intel_context *intel, if (ok) { if (!mt->compressed) { - /* XXX: Align pitch to multiple of 64 bytes for now to allow - * render-to-texture to work in all cases. This should probably be - * replaced at some point by some scheme to only do this when really - * necessary. - */ - mt->pitch = (mt->pitch * cpp + 63) & ~63; + int align; + + if (intel->intelScreen->ttm) { + /* XXX: Align pitch to multiple of 64 bytes for now to allow + * render-to-texture to work in all cases. This should probably be + * replaced at some point by some scheme to only do this when really + * necessary. + */ + align = 63; + } else { + align = 3; + } + + mt->pitch = (mt->pitch * cpp + align) & ~align; /* XXX: At least the i915 seems very upset when the pitch is a multiple * of 1024 and sometimes 512 bytes - performance can drop by several - * times. Go to the next multiple of 64 for now. + * times. Go to the next multiple of the required alignment for now. */ if (!(mt->pitch & 511)) - mt->pitch += 64; + mt->pitch += align + 1; mt->pitch /= cpp; } -- cgit v1.2.3 From db0f050582e73d64b7d260275ff0c1eed912b35d Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 3 Oct 2007 22:20:44 +0200 Subject: minor fog calc cleanup --- src/mesa/tnl/t_vb_fog.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c index f6518500d80..d8bca3820bc 100644 --- a/src/mesa/tnl/t_vb_fog.c +++ b/src/mesa/tnl/t_vb_fog.c @@ -41,7 +41,6 @@ struct fog_stage_data { GLvector4f fogcoord; /* has actual storage allocated */ - GLvector4f input; /* points into VB->EyePtr Z values */ }; #define FOG_STAGE_DATA(stage) ((struct fog_stage_data *)stage->privatePtr) @@ -91,7 +90,8 @@ init_static_data( void ) * evaluating the GL_LINEAR, GL_EXP or GL_EXP2 fog function. * Fog coordinates are distances from the eye (typically between the * near and far clip plane distances). - * Note the fog (eye Z) coords may be negative so we use ABS(z) below. + * Note that fogcoords may be negative, if eye z is source absolute + * value must be taken earlier. * Fog blend factors are in the range [0,1]. */ static void @@ -169,13 +169,10 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) */ input = &store->fogcoord; - /* NOTE: negate plane here so we get positive fog coords! */ - /* NOTE2: this doesn't always work (tests/fog - all frag depth fog - coords will be negative). */ - plane[0] = -m[2]; - plane[1] = -m[6]; - plane[2] = -m[10]; - plane[3] = -m[14]; + plane[0] = m[2]; + plane[1] = m[6]; + plane[2] = m[10]; + plane[3] = m[14]; /* Full eye coords weren't required, just calculate the * eye Z values. */ @@ -189,12 +186,12 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) NOTE should avoid going through array twice */ coord = input->start; for (i = 0; i < input->count; i++) { - input->data[i][0] = FABSF(*coord); + *coord = FABSF(*coord); STRIDE_F(coord, input->stride); } } else { - /* fog coordinates = eye Z coordinates (use ABS later) */ + /* fog coordinates = eye Z coordinates - need to copy for ABS */ input = &store->fogcoord; if (VB->EyePtr->size < 2) @@ -249,7 +246,6 @@ alloc_fog_data(GLcontext *ctx, struct tnl_pipeline_stage *stage) return GL_FALSE; _mesa_vector4f_alloc( &store->fogcoord, 0, tnl->vb.Size, 32 ); - _mesa_vector4f_init( &store->input, 0, NULL ); if (!inited) init_static_data(); -- cgit v1.2.3 From c4a9a708884c2f790e04aaaa4a4cb2993ff33089 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 4 Oct 2007 15:31:47 +1000 Subject: i915: add superioctl support to the ttm codepaths. gears now runs for about 10-15 seconds with some artifacts before falling over. --- src/mesa/drivers/dri/common/dri_bufmgr.c | 4 +- src/mesa/drivers/dri/common/dri_bufmgr.h | 4 +- src/mesa/drivers/dri/common/dri_bufmgr_fake.c | 2 +- src/mesa/drivers/dri/i915/intel_batchbuffer.c | 5 +- src/mesa/drivers/dri/i915/intel_batchbuffer.h | 3 +- src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c | 155 ++++++++++++++------------ src/mesa/drivers/dri/i915/intel_bufmgr_ttm.h | 17 +++ src/mesa/drivers/dri/i915/intel_ioctl.c | 33 ++++-- src/mesa/drivers/dri/i915/intel_ioctl.h | 4 + src/mesa/drivers/dri/i915/intel_regions.c | 2 +- src/mesa/drivers/dri/i915/intel_screen.c | 2 + 11 files changed, 135 insertions(+), 96 deletions(-) create mode 100644 src/mesa/drivers/dri/i915/intel_bufmgr_ttm.h (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 7eee0fbf501..91caa8757d2 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -157,9 +157,9 @@ void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset batch_buf->bufmgr->emit_reloc(batch_buf, flags, delta, offset, relocatee); } -void *dri_process_relocs(dri_bo *batch_buf, GLuint *hack) +void *dri_process_relocs(dri_bo *batch_buf) { - return batch_buf->bufmgr->process_relocs(batch_buf, hack); + return batch_buf->bufmgr->process_relocs(batch_buf); } void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence) diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h index f6f283eaa62..46e41f9bec1 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.h +++ b/src/mesa/drivers/dri/common/dri_bufmgr.h @@ -164,7 +164,7 @@ struct _dri_bufmgr { */ void (*emit_reloc)(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); - void *(*process_relocs)(dri_bo *batch_buf, void *hack); + void *(*process_relocs)(dri_bo *batch_buf); void (*post_submit)(dri_bo *batch_buf, dri_fence **fence); }; @@ -205,7 +205,7 @@ dri_bo *dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, unsigned int handle); void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); -void *dri_process_relocs(dri_bo *batch_buf, GLuint *hack); +void *dri_process_relocs(dri_bo *batch_buf); void dri_post_process_relocs(dri_bo *batch_buf); void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence); #endif diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c index 21b09b448b5..adf0cf5ab72 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c @@ -881,7 +881,7 @@ relocation_sort(const void *a_in, const void *b_in) { } static void * -dri_fake_process_reloc(dri_bo *batch_buf, GLuint *hack) +dri_fake_process_reloc(dri_bo *batch_buf) { dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)batch_buf->bufmgr; GLuint i; diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.c b/src/mesa/drivers/dri/i915/intel_batchbuffer.c index 46bcb9a941a..34c6d6f764b 100644 --- a/src/mesa/drivers/dri/i915/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.c @@ -127,9 +127,8 @@ do_flush_locked(struct intel_batchbuffer *batch, { struct intel_context *intel = batch->intel; void *start; - uint32_t hack; - start = dri_process_relocs(batch->buf, &hack); + start = dri_process_relocs(batch->buf); batch->map = NULL; batch->ptr = NULL; @@ -144,7 +143,7 @@ do_flush_locked(struct intel_batchbuffer *batch, if (intel->intelScreen->ttm == GL_TRUE) { intel_exec_ioctl(batch->intel, used, ignore_cliprects, allow_unlock, - start, &hack); + start, &batch->last_fence); } else { intel_batch_ioctl(batch->intel, batch->buf->offset, diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.h b/src/mesa/drivers/dri/i915/intel_batchbuffer.h index b5c7a783a72..b5934e3c9ff 100644 --- a/src/mesa/drivers/dri/i915/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.h @@ -7,7 +7,8 @@ struct intel_context; -#define BATCH_SZ 16384 +//#define BATCH_SZ 16384 +#define BATCH_SZ 4096 #define BATCH_RESERVED 16 #define INTEL_BATCH_NO_CLIPRECTS 0x1 diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c index 45a9aa3ed14..0091bb41731 100644 --- a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c @@ -44,6 +44,8 @@ #include "i915_drm.h" +#include "intel_bufmgr_ttm.h" + #define BUFMGR_DEBUG 0 #define MAX_RELOCS_PER_LIST 511 @@ -128,7 +130,7 @@ typedef struct _dri_fence_ttm } dri_fence_ttm; -static int i830AdjustListNodes(struct intel_bo_list *list) +static int intel_adjust_list_nodes(struct intel_bo_list *list) { struct intel_bo_node *node; drmMMListHead *l; @@ -156,6 +158,7 @@ static int i830AdjustListNodes(struct intel_bo_list *list) return ret; } +#if 0 void intel_bo_free_list(struct intel_bo_list *list) { struct intel_bo_node *node; @@ -180,13 +183,14 @@ void intel_bo_free_list(struct intel_bo_list *list) list->numCurrent--; } } - -int intel_bo_reset_list(struct intel_bo_list *list) +#endif + +static int intel_bo_reset_list(struct intel_bo_list *list) { drmMMListHead *l; int ret; - ret = i830AdjustListNodes(list); + ret = intel_adjust_list_nodes(list); if (ret) return ret; @@ -197,7 +201,7 @@ int intel_bo_reset_list(struct intel_bo_list *list) list->numOnList--; l = list->list.next; } - return i830AdjustListNodes(list); + return intel_adjust_list_nodes(list); } static void generic_destroy(void *nodep) @@ -205,7 +209,7 @@ static void generic_destroy(void *nodep) free(nodep); } -int intel_create_bo_list(int numTarget, struct intel_bo_list *list, void (*destroy)(void *)) +static int intel_create_bo_list(int numTarget, struct intel_bo_list *list, void (*destroy)(void *)) { DRMINITLISTHEAD(&list->list); DRMINITLISTHEAD(&list->free); @@ -216,11 +220,11 @@ int intel_create_bo_list(int numTarget, struct intel_bo_list *list, void (*destr list->destroy = destroy; else list->destroy = generic_destroy; - return i830AdjustListNodes(list); + return intel_adjust_list_nodes(list); } -struct drm_i915_op_arg * +static struct drm_i915_op_arg * intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_list *reloc_list) { struct intel_bo_node *node; @@ -259,7 +263,6 @@ intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_li if (rl_node->handle == node->buf->handle) { arg->reloc_handle = rl_node->type_list.buf.handle; - // drmBOUnmap(fd, &rl_node->type_list.buf); } } } @@ -270,7 +273,7 @@ intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_li return first; } -void intel_free_validate_list(int fd, struct intel_bo_list *list) +static void intel_free_validate_list(int fd, struct intel_bo_list *list) { struct intel_bo_node *node; drmMMListHead *l; @@ -284,29 +287,29 @@ void intel_free_validate_list(int fd, struct intel_bo_list *list) } } -void intel_free_reloc_list(int fd, struct intel_bo_list *reloc_list) +static void intel_free_reloc_list(int fd, struct intel_bo_list *reloc_list) { struct intel_bo_reloc_node *reloc_node; drmMMListHead *rl, *tmp; for (rl = reloc_list->list.next, tmp = rl->next; rl != &reloc_list->list; rl = tmp, tmp = rl->next) { reloc_node = DRMLISTENTRY(struct intel_bo_reloc_node, rl, head); - + DRMLISTDEL(rl); if (reloc_node->nr_reloc_types > 1) { /* TODO */ } - + drmBOUnmap(fd, &reloc_node->type_list.buf); drmBODestroy(fd, &reloc_node->type_list.buf); free(reloc_node); } } -int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, unsigned flags, - unsigned mask, int *itemLoc, void (*destroy_cb)(void *)) +static int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, unsigned flags, + unsigned mask, int *itemLoc, void (*destroy_cb)(void *)) { struct intel_bo_node *node, *cur; drmMMListHead *l; @@ -317,7 +320,7 @@ int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, unsigned for (l = list->list.next; l != &list->list; l = l->next) { node = DRMLISTENTRY(struct intel_bo_node, l, head); - if (node->buf == buf_bo) { + if (node->buf->handle == buf_bo->handle) { cur = node; break; } @@ -343,25 +346,9 @@ int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, unsigned unsigned memFlags = cur->arg0 & flags & memMask; if (!memFlags) { -#if 0 - ErrorF("Incompatible memory location requests " - "on validate list.\n"); - ErrorF("Previous flag: 0x%08lx, mask: 0x%08lx\n", - cur->arg0, cur->arg1); - ErrorF("Current flag: 0x%08lx, mask: 0x%08lx\n", - flags, mask); -#endif return -EINVAL; } if (mask & cur->arg1 & ~DRM_BO_MASK_MEM & (cur->arg0 ^ flags)) { -#if 0 - ErrorF("Incompatible buffer flag requests " - "on validate list.\n"); - ErrorF("Previous flag: 0x%08lx, mask: 0x%08lx\n", - cur->arg0, cur->arg1); - ErrorF("Current flag: 0x%08lx, mask: 0x%08lx\n", - flags, mask); -#endif return -EINVAL; } cur->arg1 |= mask; @@ -395,7 +382,7 @@ static int intel_create_new_reloc_type_list(int fd, struct intel_bo_reloc_list * } -int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, struct intel_reloc_info *reloc_info) +static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, struct intel_reloc_info *reloc_info) { struct intel_bo_reloc_node *rl_node, *cur; drmMMListHead *rl, *l; @@ -411,7 +398,6 @@ int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, struct in if (rl_node->handle == reloc_info->handle) { cur = rl_node; break; - } } @@ -594,7 +580,7 @@ intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, ttm_buf->owner = GL_FALSE; #if BUFMGR_DEBUG - fprintf(stderr, "bo_create_from_handle: %p (%s)\n", &ttm_buf->bo, + fprintf(stderr, "bo_create_from_handle: %p %08x (%s)\n", &ttm_buf->bo, handle, ttm_buf->name); #endif @@ -731,39 +717,48 @@ dri_ttm_validate(dri_bo *buf, unsigned int flags) return err; } -static dri_fence * -dri_ttm_fence_validated(dri_bufmgr *bufmgr, const char *name, - GLboolean flushed) +/* Returns a dri_bo wrapping the given buffer object handle. + * + * This can be used when one application needs to pass a buffer object + * to another. + */ +dri_fence * +intel_ttm_fence_create_from_arg(dri_bufmgr *bufmgr, const char *name, + drm_fence_arg_t *arg) { - dri_fence_ttm *fence_ttm = malloc(sizeof(*fence_ttm)); - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr; - int ret; - unsigned int type; + dri_bufmgr_ttm *ttm_bufmgr; + dri_fence_ttm *ttm_fence; - if (!fence_ttm) - return NULL; + ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr; - if (flushed) - type = bufmgr_ttm->fence_type_flush; - else - type = bufmgr_ttm->fence_type; - - fence_ttm->refcount = 1; - fence_ttm->name = name; - fence_ttm->fence.bufmgr = bufmgr; - ret = drmFenceBuffers(bufmgr_ttm->fd, type, 0, &fence_ttm->drm_fence); - if (ret) { - fprintf(stderr, "failed to fence (%s): %s\n", name, strerror(-ret)); - free(fence_ttm); + ttm_fence = malloc(sizeof(*ttm_fence)); + if (!ttm_fence) return NULL; - } + + ttm_fence->drm_fence.handle = arg->handle; + ttm_fence->drm_fence.fence_class = arg->fence_class; + ttm_fence->drm_fence.type = arg->type; + ttm_fence->drm_fence.flags = arg->flags; + ttm_fence->drm_fence.signaled = 0; + ttm_fence->drm_fence.sequence = arg->sequence; + + ttm_fence->fence.bufmgr = bufmgr; + ttm_fence->name = name; + ttm_fence->refcount = 1; #if BUFMGR_DEBUG - fprintf(stderr, "fence_validated: %p (%s)\n", &fence_ttm->fence, - fence_ttm->name); + fprintf(stderr, "fence_create_from_handle: %p (%s)\n", &ttm_fence->fence, + ttm_fence->name); #endif - return &fence_ttm->fence; + return &ttm_fence->fence; +} + +static dri_fence * +dri_ttm_fence_validated(dri_bufmgr *bufmgr, const char *name, + GLboolean flushed) +{ + return NULL; } static void @@ -775,6 +770,10 @@ dri_ttm_fence_reference(dri_fence *fence) _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); ++fence_ttm->refcount; _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); +#if BUFMGR_DEBUG + fprintf(stderr, "fence_reference: %p (%s)\n", &fence_ttm->fence, + fence_ttm->name); +#endif } static void @@ -786,6 +785,10 @@ dri_ttm_fence_unreference(dri_fence *fence) if (!fence) return; +#if BUFMGR_DEBUG + fprintf(stderr, "fence_unreference: %p (%s)\n", &fence_ttm->fence, + fence_ttm->name); +#endif _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); if (--fence_ttm->refcount == 0) { int ret; @@ -845,7 +848,7 @@ static void intel_dribo_destroy_callback(void *priv) dri_bo *dribo = priv; if (dribo) { - dri_bo_unreference(dribo); + dri_bo_unreference(dribo); } } @@ -854,12 +857,22 @@ dri_ttm_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee) { dri_bo_ttm *ttm_buf = (dri_bo_ttm *)batch_buf; - dri_bo_ttm *relocatee_buf = (dri_bo_ttm *)relocatee; dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; int newItem; struct intel_reloc_info reloc; + int mask; + int ret; + + mask = DRM_BO_MASK_MEM; + mask |= flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE); + + ret = intel_add_validate_buffer(&bufmgr_ttm->list, relocatee, flags, mask, &newItem, intel_dribo_destroy_callback); + if (ret < 0) + return; - intel_add_validate_buffer(&bufmgr_ttm->list, relocatee, flags, flags, &newItem, intel_dribo_destroy_callback); + if (ret == 1) { + dri_bo_reference(relocatee); + } reloc.type = I915_RELOC_TYPE_0; reloc.reloc = offset; @@ -873,18 +886,19 @@ dri_ttm_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, static void * -dri_ttm_process_reloc(dri_bo *batch_buf, GLuint *hack) +dri_ttm_process_reloc(dri_bo *batch_buf) { dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; void *ptr; int itemLoc; + dri_bo_unmap(batch_buf); + intel_add_validate_buffer(&bufmgr_ttm->list, batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE, DRM_BO_MASK_MEM | DRM_BO_FLAG_EXE, &itemLoc, NULL); ptr = intel_setup_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list, &bufmgr_ttm->reloc_list); - *hack = ((dri_bo_ttm *)batch_buf)->drm_bo.handle; return ptr; } @@ -896,14 +910,7 @@ dri_ttm_post_submit(dri_bo *batch_buf, dri_fence **last_fence) intel_free_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list); intel_free_reloc_list(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list); - /* - - bb->fence.handle = execbuf.fence_arg.handle; - bb->fence.fence_class = execbuf.fence_arg.fence_class; - bb->fence.type = execbuf.fence_arg.type; - bb->fence.flags = execbuf.fence_arg.flags; - bb->fence.signaled = 0; - */ + intel_bo_reset_list(&bufmgr_ttm->list); } /** @@ -927,7 +934,7 @@ intel_bufmgr_ttm_init(int fd, unsigned int fence_type, bufmgr_ttm->fence_type_flush = fence_type_flush; _glthread_INIT_MUTEX(bufmgr_ttm->mutex); - intel_create_bo_list(40, &bufmgr_ttm->list, NULL); + intel_create_bo_list(10, &bufmgr_ttm->list, NULL); intel_create_bo_list(1, &bufmgr_ttm->reloc_list, NULL); bufmgr_ttm->bufmgr.bo_alloc = dri_ttm_alloc; diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.h b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.h new file mode 100644 index 00000000000..642fe358f6a --- /dev/null +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.h @@ -0,0 +1,17 @@ + +#ifndef INTEL_BUFMGR_TTM_H +#define INTEL_BUFMGR_TTM_H + +#include "dri_bufmgr.h" + +extern dri_bo *intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, + unsigned int handle); + +dri_fence *intel_ttm_fence_create_from_arg(dri_bufmgr *bufmgr, const char *name, + drm_fence_arg_t *arg); + + +dri_bufmgr *intel_bufmgr_ttm_init(int fd, unsigned int fence_type, + unsigned int fence_type_flush); + +#endif diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.c b/src/mesa/drivers/dri/i915/intel_ioctl.c index a93530c7b18..873e8b97883 100644 --- a/src/mesa/drivers/dri/i915/intel_ioctl.c +++ b/src/mesa/drivers/dri/i915/intel_ioctl.c @@ -42,6 +42,8 @@ #include "intel_regions.h" #include "drm.h" +#include "intel_bufmgr_ttm.h" + #define FILE_DEBUG_FLAG DEBUG_IOCTL int @@ -135,16 +137,20 @@ void intel_exec_ioctl(struct intel_context *intel, GLuint used, GLboolean ignore_cliprects, GLboolean allow_unlock, - void *start, uint32_t *hack) + void *start, dri_fence **fence) { struct drm_i915_execbuffer execbuf; - + dri_fence *fo; + assert(intel->locked); assert(used); + if (*fence) { + dri_fence_unreference(*fence); + } + memset(&execbuf, 0, sizeof(execbuf)); - execbuf.cmdbuf_handle = *hack; // TODO execbuf.batch.used = used; execbuf.batch.cliprects = intel->pClipRects; execbuf.batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects; @@ -153,25 +159,28 @@ intel_exec_ioctl(struct intel_context *intel, (((GLuint) intel->drawY) << 16)); execbuf.ops_list = (unsigned)start; // TODO - execbuf.fence_arg.flags = DRM_I915_FENCE_FLAG_FLUSHED; + execbuf.fence_arg.flags = DRM_FENCE_FLAG_SHAREABLE | DRM_I915_FENCE_FLAG_FLUSHED; - if (drmCommandWrite(intel->driFd, DRM_I915_EXECBUFFER, &execbuf, + if (drmCommandWriteRead(intel->driFd, DRM_I915_EXECBUFFER, &execbuf, sizeof(execbuf))) { fprintf(stderr, "DRM_I830_EXECBUFFER: %d\n", -errno); UNLOCK_HARDWARE(intel); exit(1); } + + fo = intel_ttm_fence_create_from_arg(intel->intelScreen->bufmgr, "fence buffers", + &execbuf.fence_arg); + if (!fo) { + fprintf(stderr, "failed to fence handle: %08x\n", execbuf.fence_arg.handle); + UNLOCK_HARDWARE(intel); + exit(1); + } + *fence = fo; + /* FIXME: use hardware contexts to avoid 'losing' hardware after * each buffer flush. */ intel->vtbl.lost_hardware(intel); -#if 0 - fence->handle = execbuf.fence_arg.handle; - fence->fence_class = execbuf.fence_arg.fence_class; - fence->type = execbuf.fence_arg.type; - fence->flags = execbuf.fence_arg.flags; - fence->fence.signaled = 0; -#endif } diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.h b/src/mesa/drivers/dri/i915/intel_ioctl.h index 7a5b175ed1c..689f21cae89 100644 --- a/src/mesa/drivers/dri/i915/intel_ioctl.h +++ b/src/mesa/drivers/dri/i915/intel_ioctl.h @@ -37,4 +37,8 @@ void intel_batch_ioctl(struct intel_context *intel, GLuint start_offset, GLuint used, GLboolean ignore_cliprects, GLboolean allow_unlock); +void intel_exec_ioctl(struct intel_context *intel, + GLuint used, + GLboolean ignore_cliprects, GLboolean allow_unlock, + void *start, dri_fence **fence); #endif diff --git a/src/mesa/drivers/dri/i915/intel_regions.c b/src/mesa/drivers/dri/i915/intel_regions.c index d2441970b3b..187ccf17764 100644 --- a/src/mesa/drivers/dri/i915/intel_regions.c +++ b/src/mesa/drivers/dri/i915/intel_regions.c @@ -162,7 +162,7 @@ intel_region_create_static(intelScreenPrivate *intelScreen, if (intelScreen->ttm) { assert(bo_handle != -1); - region->buffer = dri_ttm_bo_create_from_handle(intelScreen->bufmgr, + region->buffer = intel_ttm_bo_create_from_handle(intelScreen->bufmgr, "static region", bo_handle); } else { diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 0b889b1aa0d..084de1004b7 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -50,6 +50,8 @@ #include "intel_regions.h" #include "intel_batchbuffer.h" +#include "intel_bufmgr_ttm.h" + PUBLIC const char __driConfigOptions[] = DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS) -- cgit v1.2.3 From 10cc229dc2ef61c51f7e242ac2d497916793d265 Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Thu, 4 Oct 2007 19:08:37 +0200 Subject: nouveau: Replace removed device classes with their proper labels. --- src/mesa/drivers/dri/nouveau/nouveau_card_list.h | 66 ++++++++++++------------ 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_card_list.h b/src/mesa/drivers/dri/nouveau/nouveau_card_list.h index b1a0e7bfd12..94f170e057d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_card_list.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_card_list.h @@ -72,10 +72,10 @@ static nouveau_card nouveau_card_list[]={ {0x014D, "Quadro FX 550", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0}, {0x014E, "Quadro FX 540", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0}, {0x014F, "GeForce 6200", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0}, -{0x0150, "GeForce2 GTS/Pro", NV11_TCL_PRIMITIVE_3D, NV_15, 0}, -{0x0151, "GeForce2 Ti", NV11_TCL_PRIMITIVE_3D, NV_15, 0}, -{0x0152, "GeForce2 Ultra, Bladerunner", NV11_TCL_PRIMITIVE_3D, NV_15, 0}, -{0x0153, "Quadro2 Pro", NV11_TCL_PRIMITIVE_3D, NV_15, 0}, +{0x0150, "GeForce2 GTS/Pro", NV11_TCL_PRIMITIVE_3D, NV_11, 0}, +{0x0151, "GeForce2 Ti", NV11_TCL_PRIMITIVE_3D, NV_11, 0}, +{0x0152, "GeForce2 Ultra, Bladerunner", NV11_TCL_PRIMITIVE_3D, NV_11, 0}, +{0x0153, "Quadro2 Pro", NV11_TCL_PRIMITIVE_3D, NV_11, 0}, {0x0161, "GeForce 6200 TurboCache(TM)", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0}, {0x0162, "GeForce 6200 SE TurboCache (TM)", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0}, {0x0163, "GeForce 6200 LE", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0}, @@ -132,20 +132,20 @@ static nouveau_card nouveau_card_list[]={ {0x0240, "GeForce 6150", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0}, {0x0242, "GeForce 6100", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0}, {0x0244, "Geforce 6150 Go", NV30_TCL_PRIMITIVE_3D|0x4400, NV_44, 0}, -{0x0250, "GeForce4 Ti 4600", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0251, "GeForce4 Ti 4400", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0252, "GeForce4 Ti", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0253, "GeForce4 Ti 4200", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0258, "Quadro4 900 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0259, "Quadro4 750 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x025B, "Quadro4 700 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0280, "GeForce4 Ti 4800", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0281, "GeForce4 Ti 4200 AGP 8x", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0282, "GeForce4 Ti 4800 SE", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0286, "GeForce4 Ti 4200 Go AGP 8x", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0288, "Quadro4 980 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x0289, "Quadro4 780 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, -{0x028C, "Quadro4 700 GoGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_25, 0}, +{0x0250, "GeForce4 Ti 4600", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0251, "GeForce4 Ti 4400", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0252, "GeForce4 Ti", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0253, "GeForce4 Ti 4200", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0258, "Quadro4 900 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0259, "Quadro4 750 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x025B, "Quadro4 700 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0280, "GeForce4 Ti 4800", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0281, "GeForce4 Ti 4200 AGP 8x", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0282, "GeForce4 Ti 4800 SE", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0286, "GeForce4 Ti 4200 Go AGP 8x", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0288, "Quadro4 980 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x0289, "Quadro4 780 XGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, +{0x028C, "Quadro4 700 GoGL", NV20_TCL_PRIMITIVE_3D|0x0500, NV_20, 0}, {0x0290, "GeForce 7900 GTX", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0}, {0x0291, "GeForce 7900 GT", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0}, {0x0292, "GeForce 7900 GS", NV30_TCL_PRIMITIVE_3D|0x4000, NV_40, 0}, @@ -176,21 +176,21 @@ static nouveau_card nouveau_card_list[]={ {0x031D, "NV31GLM", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0}, {0x031E, "NV31GLM Pro", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0}, {0x031F, "NV31GLM Pro", NV30_TCL_PRIMITIVE_3D|0x0300, NV_30, 0}, -{0x0320, "GeForce FX 5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x0321, "GeForce FX 5200 Ultra", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x0322, "GeForce FX 5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x0323, "GeForce FX 5200LE", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x0324, "GeForce FX Go5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x0325, "GeForce FX Go5250", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x0326, "GeForce FX 5500", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x0327, "GeForce FX 5100", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x0328, "GeForce FX Go5200 32M/64M", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x0329, "GeForce FX Go5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x032A, "Quadro NVS 280 PCI", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x032B, "Quadro FX 500/600 PCI", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x032C, "GeForce FX Go 5300", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x032D, "GeForce FX Go5100", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, -{0x032F, "NV34GL", NV30_TCL_PRIMITIVE_3D|0x0600, NV_34, 0}, +{0x0320, "GeForce FX 5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x0321, "GeForce FX 5200 Ultra", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x0322, "GeForce FX 5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x0323, "GeForce FX 5200LE", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x0324, "GeForce FX Go5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x0325, "GeForce FX Go5250", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x0326, "GeForce FX 5500", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x0327, "GeForce FX 5100", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x0328, "GeForce FX Go5200 32M/64M", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x0329, "GeForce FX Go5200", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x032A, "Quadro NVS 280 PCI", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x032B, "Quadro FX 500/600 PCI", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x032C, "GeForce FX Go 5300", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x032D, "GeForce FX Go5100", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, +{0x032F, "NV34GL", NV30_TCL_PRIMITIVE_3D|0x0600, NV_30, 0}, {0x0330, "GeForce FX 5900 Ultra", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0}, {0x0331, "GeForce FX 5900", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0}, {0x0332, "GeForce FX 5900XT", NV30_TCL_PRIMITIVE_3D|0x0400, NV_30, 0}, -- cgit v1.2.3 From 1f7378ee465eba8d82d224a7bf835e38c5ab6ee2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 3 Oct 2007 16:30:42 -0700 Subject: Replace some structure-based batch preparation with plain OUT_BATCH. OUT_BATCH is far more amenable to the upcoming relocations being done for TTM support. --- src/mesa/drivers/dri/i965/intel_blit.c | 55 +++++++++++++++------------------- src/mesa/drivers/dri/i965/intel_reg.h | 6 +++- 2 files changed, 29 insertions(+), 32 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c index f88cbb2328d..da6b68c22ba 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.c +++ b/src/mesa/drivers/dri/i965/intel_blit.c @@ -535,9 +535,9 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, GLshort w, GLshort h, GLenum logic_op) { - struct xy_setup_blit setup; struct xy_text_immediate_blit text; int dwords = ((src_size + 7) & ~7) / 4; + uint32_t opcode, br13; assert( logic_op - GL_CLEAR >= 0 ); assert( logic_op - GL_CLEAR < 0x10 ); @@ -554,31 +554,6 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h, src_size, dwords); - memset(&setup, 0, sizeof(setup)); - - setup.br0.client = CLIENT_2D; - setup.br0.opcode = OPCODE_XY_SETUP_BLT; - setup.br0.write_alpha = (cpp == 4); - setup.br0.write_rgb = (cpp == 4); - setup.br0.dst_tiled = dst_tiled; - setup.br0.length = (sizeof(setup) / sizeof(int)) - 2; - - setup.br13.dest_pitch = dst_pitch; - setup.br13.rop = translate_raster_op(logic_op); - setup.br13.color_depth = (cpp == 4) ? BR13_8888 : BR13_565; - setup.br13.clipping_enable = 0; - setup.br13.mono_source_transparency = 1; - - setup.dw2.clip_y1 = 0; - setup.dw2.clip_x1 = 0; - setup.dw3.clip_y2 = 100; - setup.dw3.clip_x2 = 100; - - setup.dest_base_addr = bmBufferOffset(intel, dst_buffer) + dst_offset; - setup.background_color = 0; - setup.foreground_color = fg_color; - setup.pattern_base_addr = 0; - memset(&text, 0, sizeof(text)); text.dw0.client = CLIENT_2D; text.dw0.opcode = OPCODE_XY_TEXT_IMMEDIATE_BLT; @@ -594,15 +569,33 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, text.dw2.dest_x2 = x + w; intel_batchbuffer_require_space( intel->batch, - sizeof(setup) + + (8 * 4) + sizeof(text) + dwords, INTEL_BATCH_NO_CLIPRECTS ); - intel_batchbuffer_data( intel->batch, - &setup, - sizeof(setup), - INTEL_BATCH_NO_CLIPRECTS ); + opcode = XY_SETUP_BLT_CMD; + if (cpp == 4) + opcode |= XY_COLOR_BLT_WRITE_ALPHA | XY_COLOR_BLT_WRITE_RGB; + if (dst_tiled) + opcode |= XY_DST_TILED; + + br13 = dst_pitch | (translate_raster_op(logic_op) << 16) | (1 << 29); + if (cpp == 2) + br13 |= BR13_565 << 24; + else + br13 |= BR13_8888 << 24; + + BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS); + OUT_BATCH(opcode); + OUT_BATCH(br13); + OUT_BATCH((0 << 16) | 0); /* clip x1, y1 */ + OUT_BATCH((100 << 16) | 100); /* clip x2, y2 */ + OUT_BATCH(bmBufferOffset(intel, dst_buffer) + dst_offset); + OUT_BATCH(0); /* bg */ + OUT_BATCH(fg_color); /* fg */ + OUT_BATCH(0); /* pattern base addr */ + ADVANCE_BATCH(); intel_batchbuffer_data( intel->batch, &text, diff --git a/src/mesa/drivers/dri/i965/intel_reg.h b/src/mesa/drivers/dri/i965/intel_reg.h index 3c448b3559a..618afb6cbbb 100644 --- a/src/mesa/drivers/dri/i965/intel_reg.h +++ b/src/mesa/drivers/dri/i965/intel_reg.h @@ -32,7 +32,7 @@ #define CMD_3D (0x3<<29) - +#define CMD_2D (0x2<<29) #define _3DPRIMITIVE ((0x3<<29)|(0x1f<<24)) #define PRIM_INDIRECT (1<<23) @@ -73,6 +73,8 @@ #define BR00_OP_SRC_COPY_BLT 0x10C00000 #define BR13_SOLID_PATTERN 0x80000000 +#define XY_SETUP_BLT_CMD (CMD_2D | (1 << 22) | 6) + #define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4) #define XY_COLOR_BLT_WRITE_ALPHA (1<<21) #define XY_COLOR_BLT_WRITE_RGB (1<<20) @@ -81,6 +83,8 @@ #define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) +#define XY_BLT_WRITE_ALPHA (1<<21) +#define XY_BLT_WRITE_RGB (1<<20) #define XY_SRC_TILED (1<<15) #define XY_DST_TILED (1<<11) -- cgit v1.2.3 From 6bac9478c39fbe7955d10a21a2d7743697427a56 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 3 Oct 2007 16:59:01 -0700 Subject: Replace duplicated intel_reg.h with a shared header. --- src/mesa/drivers/dri/i915/i915_reg.h | 2 - src/mesa/drivers/dri/i915/intel_batchbuffer.c | 2 +- src/mesa/drivers/dri/i915/intel_blit.c | 18 ++--- src/mesa/drivers/dri/i915/intel_context.h | 3 - src/mesa/drivers/dri/i915/intel_reg.h | 88 ------------------------- src/mesa/drivers/dri/i965/intel_blit.c | 29 +++----- src/mesa/drivers/dri/i965/intel_reg.h | 95 --------------------------- src/mesa/drivers/dri/intel/intel_reg.h | 76 +++++++++++++++++++++ 8 files changed, 94 insertions(+), 219 deletions(-) delete mode 100644 src/mesa/drivers/dri/i915/intel_reg.h delete mode 100644 src/mesa/drivers/dri/i965/intel_reg.h create mode 100644 src/mesa/drivers/dri/intel/intel_reg.h (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i915_reg.h b/src/mesa/drivers/dri/i915/i915_reg.h index a9fa56e8a60..b5585e70e79 100644 --- a/src/mesa/drivers/dri/i915/i915_reg.h +++ b/src/mesa/drivers/dri/i915/i915_reg.h @@ -34,8 +34,6 @@ #define I915_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value) -#define CMD_3D (0x3<<29) - #define PRIM3D_INLINE (CMD_3D | (0x1f<<24)) #define PRIM3D_TRILIST (0x0<<18) #define PRIM3D_TRISTRIP (0x1<<18) diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.c b/src/mesa/drivers/dri/i915/intel_batchbuffer.c index 045ff0a5b09..639457d44ab 100644 --- a/src/mesa/drivers/dri/i915/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.c @@ -28,7 +28,7 @@ #include "intel_batchbuffer.h" #include "intel_ioctl.h" #include "intel_decode.h" -#include "i915_debug.h" +#include "intel_reg.h" /* Relocations in kernel space: * - pass dma buffer seperately diff --git a/src/mesa/drivers/dri/i915/intel_blit.c b/src/mesa/drivers/dri/i915/intel_blit.c index 5d97f08434a..b00b0d9e1b5 100644 --- a/src/mesa/drivers/dri/i915/intel_blit.c +++ b/src/mesa/drivers/dri/i915/intel_blit.c @@ -105,8 +105,7 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, } else { BR13 = (pitch * cpp) | (0xCC << 16) | (1 << 24) | (1 << 25); - CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB); + CMD = (XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB); } for (i = 0; i < nbox; i++, pbox++) { @@ -184,8 +183,7 @@ intelEmitFillBlit(struct intel_context *intel, break; case 4: BR13 = dst_pitch | (0xF0 << 16) | (1 << 24) | (1 << 25); - CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA | - XY_COLOR_BLT_WRITE_RGB); + CMD = (XY_COLOR_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB); break; default: return; @@ -273,8 +271,7 @@ intelEmitCopyBlit(struct intel_context *intel, (((GLint) dst_pitch) & 0xffff) | (translate_raster_op(logic_op) << 16) | (1 << 24) | (1 << 25); CMD = - (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB); + (XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB); break; default: return; @@ -443,15 +440,14 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask) if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) { CMD = XY_COLOR_BLT_CMD; if (clearMask & BUFFER_BIT_DEPTH) - CMD |= XY_COLOR_BLT_WRITE_RGB; + CMD |= XY_BLT_WRITE_RGB; if (clearMask & BUFFER_BIT_STENCIL) - CMD |= XY_COLOR_BLT_WRITE_ALPHA; + CMD |= XY_BLT_WRITE_ALPHA; } else { /* clearing RGBA */ - CMD = (XY_COLOR_BLT_CMD | - XY_COLOR_BLT_WRITE_ALPHA | - XY_COLOR_BLT_WRITE_RGB); + CMD = XY_COLOR_BLT_CMD | + XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; } } else { diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h index 1e9ccd5cdc0..c8298dd9c43 100644 --- a/src/mesa/drivers/dri/i915/intel_context.h +++ b/src/mesa/drivers/dri/i915/intel_context.h @@ -460,9 +460,6 @@ extern void intelInitStateFuncs(struct dd_function_table *functions); #define BLENDFACT_INV_CONST_ALPHA 0x0f #define BLENDFACT_MASK 0x0f -#define MI_BATCH_BUFFER_END (0xA<<23) - - extern int intel_translate_compare_func(GLenum func); extern int intel_translate_stencil_op(GLenum op); extern int intel_translate_blend_factor(GLenum factor); diff --git a/src/mesa/drivers/dri/i915/intel_reg.h b/src/mesa/drivers/dri/i915/intel_reg.h deleted file mode 100644 index 7828ba6ad39..00000000000 --- a/src/mesa/drivers/dri/i915/intel_reg.h +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef _INTEL_REG_H_ -#define _INTEL_REG_H_ - - - -#define CMD_3D (0x3<<29) - - -#define _3DPRIMITIVE ((0x3<<29)|(0x1f<<24)) -#define PRIM_INDIRECT (1<<23) -#define PRIM_INLINE (0<<23) -#define PRIM_INDIRECT_SEQUENTIAL (0<<17) -#define PRIM_INDIRECT_ELTS (1<<17) - -#define PRIM3D_TRILIST (0x0<<18) -#define PRIM3D_TRISTRIP (0x1<<18) -#define PRIM3D_TRISTRIP_RVRSE (0x2<<18) -#define PRIM3D_TRIFAN (0x3<<18) -#define PRIM3D_POLY (0x4<<18) -#define PRIM3D_LINELIST (0x5<<18) -#define PRIM3D_LINESTRIP (0x6<<18) -#define PRIM3D_RECTLIST (0x7<<18) -#define PRIM3D_POINTLIST (0x8<<18) -#define PRIM3D_DIB (0x9<<18) -#define PRIM3D_MASK (0x1f<<18) - -#define I915PACKCOLOR4444(r,g,b,a) \ - ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) - -#define I915PACKCOLOR1555(r,g,b,a) \ - ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ - ((a) ? 0x8000 : 0)) - -#define I915PACKCOLOR565(r,g,b) \ - ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) - -#define I915PACKCOLOR8888(r,g,b,a) \ - ((a<<24) | (r<<16) | (g<<8) | b) - - - - -#define BR00_BITBLT_CLIENT 0x40000000 -#define BR00_OP_COLOR_BLT 0x10000000 -#define BR00_OP_SRC_COPY_BLT 0x10C00000 -#define BR13_SOLID_PATTERN 0x80000000 - -#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4) -#define XY_COLOR_BLT_WRITE_ALPHA (1<<21) -#define XY_COLOR_BLT_WRITE_RGB (1<<20) - -#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) -#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) -#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) - -#define MI_WAIT_FOR_EVENT ((0x3<<23)) -#define MI_WAIT_FOR_PLANE_B_FLIP (1<<6) -#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) - -#endif diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c index da6b68c22ba..962bb24f67a 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.c +++ b/src/mesa/drivers/dri/i965/intel_blit.c @@ -110,8 +110,7 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv, } else { BR13 = (0xCC << 16) | (1<<24) | (1<<25); - CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB); + CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; } if (src->tiled) { @@ -199,8 +198,7 @@ void intelEmitFillBlit( struct intel_context *intel, break; case 4: BR13 = (0xF0 << 16) | (1<<24) | (1<<25); - CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA | - XY_COLOR_BLT_WRITE_RGB); + CMD = XY_COLOR_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; break; default: return; @@ -290,8 +288,7 @@ void intelEmitCopyBlit( struct intel_context *intel, case 4: BR13 = (translate_raster_op(logic_op) << 16) | (1<<24) | (1<<25); - CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB); + CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; break; default: return; @@ -388,12 +385,11 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags) break; case 4: BR13 = (0xF0 << 16) | (1<<24) | (1<<25); - BACK_CMD = FRONT_CMD = (XY_COLOR_BLT_CMD | - XY_COLOR_BLT_WRITE_ALPHA | - XY_COLOR_BLT_WRITE_RGB); + BACK_CMD = FRONT_CMD = XY_COLOR_BLT_CMD | + XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; DEPTH_CMD = XY_COLOR_BLT_CMD; - if (flags & BUFFER_BIT_DEPTH) DEPTH_CMD |= XY_COLOR_BLT_WRITE_RGB; - if (flags & BUFFER_BIT_STENCIL) DEPTH_CMD |= XY_COLOR_BLT_WRITE_ALPHA; + if (flags & BUFFER_BIT_DEPTH) DEPTH_CMD |= XY_BLT_WRITE_RGB; + if (flags & BUFFER_BIT_STENCIL) DEPTH_CMD |= XY_BLT_WRITE_ALPHA; break; default: return; @@ -517,11 +513,6 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags) } - -#define BR13_565 0x1 -#define BR13_8888 0x3 - - void intelEmitImmediateColorExpandBlit(struct intel_context *intel, GLuint cpp, @@ -576,15 +567,15 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, opcode = XY_SETUP_BLT_CMD; if (cpp == 4) - opcode |= XY_COLOR_BLT_WRITE_ALPHA | XY_COLOR_BLT_WRITE_RGB; + opcode |= XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; if (dst_tiled) opcode |= XY_DST_TILED; br13 = dst_pitch | (translate_raster_op(logic_op) << 16) | (1 << 29); if (cpp == 2) - br13 |= BR13_565 << 24; + br13 |= BR13_565; else - br13 |= BR13_8888 << 24; + br13 |= BR13_8888; BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS); OUT_BATCH(opcode); diff --git a/src/mesa/drivers/dri/i965/intel_reg.h b/src/mesa/drivers/dri/i965/intel_reg.h deleted file mode 100644 index 618afb6cbbb..00000000000 --- a/src/mesa/drivers/dri/i965/intel_reg.h +++ /dev/null @@ -1,95 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef _INTEL_REG_H_ -#define _INTEL_REG_H_ - - - -#define CMD_3D (0x3<<29) -#define CMD_2D (0x2<<29) - -#define _3DPRIMITIVE ((0x3<<29)|(0x1f<<24)) -#define PRIM_INDIRECT (1<<23) -#define PRIM_INLINE (0<<23) -#define PRIM_INDIRECT_SEQUENTIAL (0<<17) -#define PRIM_INDIRECT_ELTS (1<<17) - -#define PRIM3D_TRILIST (0x0<<18) -#define PRIM3D_TRISTRIP (0x1<<18) -#define PRIM3D_TRISTRIP_RVRSE (0x2<<18) -#define PRIM3D_TRIFAN (0x3<<18) -#define PRIM3D_POLY (0x4<<18) -#define PRIM3D_LINELIST (0x5<<18) -#define PRIM3D_LINESTRIP (0x6<<18) -#define PRIM3D_RECTLIST (0x7<<18) -#define PRIM3D_POINTLIST (0x8<<18) -#define PRIM3D_DIB (0x9<<18) -#define PRIM3D_MASK (0x1f<<18) - -#define I915PACKCOLOR4444(r,g,b,a) \ - ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) - -#define I915PACKCOLOR1555(r,g,b,a) \ - ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ - ((a) ? 0x8000 : 0)) - -#define I915PACKCOLOR565(r,g,b) \ - ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) - -#define I915PACKCOLOR8888(r,g,b,a) \ - ((a<<24) | (r<<16) | (g<<8) | b) - - - - -#define BR00_BITBLT_CLIENT 0x40000000 -#define BR00_OP_COLOR_BLT 0x10000000 -#define BR00_OP_SRC_COPY_BLT 0x10C00000 -#define BR13_SOLID_PATTERN 0x80000000 - -#define XY_SETUP_BLT_CMD (CMD_2D | (1 << 22) | 6) - -#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4) -#define XY_COLOR_BLT_WRITE_ALPHA (1<<21) -#define XY_COLOR_BLT_WRITE_RGB (1<<20) - -#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) -#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) -#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) - -#define XY_BLT_WRITE_ALPHA (1<<21) -#define XY_BLT_WRITE_RGB (1<<20) -#define XY_SRC_TILED (1<<15) -#define XY_DST_TILED (1<<11) - -#define FENCE_LINEAR 0 -#define FENCE_XMAJOR 1 -#define FENCE_YMAJOR 2 - -#endif diff --git a/src/mesa/drivers/dri/intel/intel_reg.h b/src/mesa/drivers/dri/intel/intel_reg.h new file mode 100644 index 00000000000..b9bbcdc704d --- /dev/null +++ b/src/mesa/drivers/dri/intel/intel_reg.h @@ -0,0 +1,76 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#define CMD_MI (0x0 << 29) +#define CMD_2D (0x2 << 29) +#define CMD_3D (0x3 << 29) + +#define MI_BATCH_BUFFER_END (CMD_MI | 0xA << 23) + +/* Stalls command execution waiting for the given events to have occurred. */ +#define MI_WAIT_FOR_EVENT (CMD_MI | (0x3 << 23)) +#define MI_WAIT_FOR_PLANE_B_FLIP (1<<6) +#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) + +/* Primitive dispatch on 830-945 */ +#define _3DPRIMITIVE (CMD_3D | (0x1f << 24)) +#define PRIM_INDIRECT (1<<23) +#define PRIM_INLINE (0<<23) +#define PRIM_INDIRECT_SEQUENTIAL (0<<17) +#define PRIM_INDIRECT_ELTS (1<<17) + +#define PRIM3D_TRILIST (0x0<<18) +#define PRIM3D_TRISTRIP (0x1<<18) +#define PRIM3D_TRISTRIP_RVRSE (0x2<<18) +#define PRIM3D_TRIFAN (0x3<<18) +#define PRIM3D_POLY (0x4<<18) +#define PRIM3D_LINELIST (0x5<<18) +#define PRIM3D_LINESTRIP (0x6<<18) +#define PRIM3D_RECTLIST (0x7<<18) +#define PRIM3D_POINTLIST (0x8<<18) +#define PRIM3D_DIB (0x9<<18) +#define PRIM3D_MASK (0x1f<<18) + +#define XY_SETUP_BLT_CMD (CMD_2D | (0x011 << 22) | 6) + +#define XY_COLOR_BLT_CMD (CMD_2D | (0x50 << 22) | 4) + +#define XY_SRC_COPY_BLT_CMD (CMD_2D | (0x53 << 22) | 6) + +/* BR00 */ +#define XY_BLT_WRITE_ALPHA (1 << 21) +#define XY_BLT_WRITE_RGB (1 << 20) +#define XY_SRC_TILED (1 << 15) +#define XY_DST_TILED (1 << 11) + +/* BR13 */ +#define BR13_565 (0x1 << 24) +#define BR13_8888 (0x3 << 24) + +#define FENCE_LINEAR 0 +#define FENCE_XMAJOR 1 +#define FENCE_YMAJOR 2 -- cgit v1.2.3 From 0fc9efd8f0b1b6c4e3525a50e3478e5aef72531a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Oct 2007 11:16:50 -0700 Subject: Replace bmBufferOffset usage in batchbuffer setup with OUT_RELOC. This is in preparation for 965 TTM. --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 8 ++++--- src/mesa/drivers/dri/i965/intel_batchbuffer.h | 6 ++++++ src/mesa/drivers/dri/i965/intel_blit.c | 30 ++++++++++++++++----------- 3 files changed, 29 insertions(+), 15 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index fc2e3035af1..89cd063d460 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -541,7 +541,8 @@ GLboolean brw_upload_vertices( struct brw_context *brw, for (i = 0; i < nr_enabled; i++) { OUT_BATCH( vbp.vb[i].vb0.dword ); - OUT_BATCH( bmBufferOffset(&brw->intel, vbp.vb[i].buffer) + vbp.vb[i].offset); + OUT_RELOC( vbp.vb[i].buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, + vbp.vb[i].offset); OUT_BATCH( vbp.vb[i].max_index ); OUT_BATCH( vbp.vb[i].instance_data_step_rate ); } @@ -632,8 +633,9 @@ void brw_upload_indices( struct brw_context *brw, BEGIN_BATCH(4, 0); OUT_BATCH( ib.header.dword ); - OUT_BATCH( bmBufferOffset(intel, buffer) + offset ); - OUT_BATCH( bmBufferOffset(intel, buffer) + offset + ib_size ); + OUT_RELOC( buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, offset); + OUT_RELOC( buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, + offset + ib_size); OUT_BATCH( 0 ); ADVANCE_BATCH(); } diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.h b/src/mesa/drivers/dri/i965/intel_batchbuffer.h index 25e0a65e99f..c40cad96383 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.h @@ -121,6 +121,12 @@ void intel_batchbuffer_align( struct intel_batchbuffer *batch, #define BATCH_LOCALS #define BEGIN_BATCH(n, flags) intel_batchbuffer_require_space(intel->batch, n*4, flags) #define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d) + +#define OUT_RELOC(buf, flags, delta) do { \ + assert((delta) >= 0); \ + OUT_BATCH(bmBufferOffset(intel, buf) + delta); \ +} while (0) + #define ADVANCE_BATCH() do { } while(0) diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c index 962bb24f67a..7a9e1a2a3f8 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.c +++ b/src/mesa/drivers/dri/i965/intel_blit.c @@ -144,10 +144,10 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv, OUT_BATCH( dst_pitch | BR13 ); OUT_BATCH( (tmp.y1 << 16) | tmp.x1 ); OUT_BATCH( (tmp.y2 << 16) | tmp.x2 ); - OUT_BATCH( bmBufferOffset(intel, dst->buffer) ); + OUT_RELOC( dst->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE, 0 ); OUT_BATCH( (tmp.y1 << 16) | tmp.x1 ); OUT_BATCH( src_pitch ); - OUT_BATCH( bmBufferOffset(intel, src->buffer) ); + OUT_RELOC( src->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, 0 ); ADVANCE_BATCH(); } } @@ -214,7 +214,7 @@ void intelEmitFillBlit( struct intel_context *intel, OUT_BATCH( dst_pitch | BR13 ); OUT_BATCH( (y << 16) | x ); OUT_BATCH( ((y+h) << 16) | (x+w) ); - OUT_BATCH( bmBufferOffset(intel, dst_buffer) + dst_offset ); + OUT_RELOC( dst_buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE, dst_offset ); OUT_BATCH( color ); ADVANCE_BATCH(); } @@ -325,10 +325,12 @@ void intelEmitCopyBlit( struct intel_context *intel, OUT_BATCH( dst_pitch | BR13 ); OUT_BATCH( (dst_y << 16) | dst_x ); OUT_BATCH( (dst_y2 << 16) | dst_x2 ); - OUT_BATCH( bmBufferOffset(intel, dst_buffer) + dst_offset ); + OUT_RELOC( dst_buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE, + dst_offset ); OUT_BATCH( (src_y << 16) | src_x ); OUT_BATCH( src_pitch ); - OUT_BATCH( bmBufferOffset(intel, src_buffer) + src_offset ); + OUT_RELOC( src_buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, + src_offset ); ADVANCE_BATCH(); } else { @@ -337,10 +339,11 @@ void intelEmitCopyBlit( struct intel_context *intel, OUT_BATCH( (dst_pitch & 0xffff) | BR13 ); OUT_BATCH( (0 << 16) | dst_x ); OUT_BATCH( (h << 16) | dst_x2 ); - OUT_BATCH( bmBufferOffset(intel, dst_buffer) + dst_offset + dst_y * dst_pitch ); - OUT_BATCH( (0 << 16) | src_x ); + OUT_RELOC( dst_buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE, + dst_offset + dst_y * dst_pitch ); OUT_BATCH( (src_pitch & 0xffff) ); - OUT_BATCH( bmBufferOffset(intel, src_buffer) + src_offset + src_y * src_pitch ); + OUT_RELOC( src_buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, + src_offset + src_y * src_pitch ); ADVANCE_BATCH(); } } @@ -480,7 +483,8 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags) OUT_BATCH( front_pitch | BR13 ); OUT_BATCH( (b.y1 << 16) | b.x1 ); OUT_BATCH( (b.y2 << 16) | b.x2 ); - OUT_BATCH( bmBufferOffset(intel, front->buffer) ); + OUT_RELOC( front->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE, + 0 ); OUT_BATCH( clear_color ); ADVANCE_BATCH(); } @@ -491,7 +495,8 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags) OUT_BATCH( back_pitch | BR13 ); OUT_BATCH( (b.y1 << 16) | b.x1 ); OUT_BATCH( (b.y2 << 16) | b.x2 ); - OUT_BATCH( bmBufferOffset(intel, back->buffer) ); + OUT_RELOC( back->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE, + 0 ); OUT_BATCH( clear_color ); ADVANCE_BATCH(); } @@ -502,7 +507,8 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags) OUT_BATCH( depth_pitch | BR13 ); OUT_BATCH( (b.y1 << 16) | b.x1 ); OUT_BATCH( (b.y2 << 16) | b.x2 ); - OUT_BATCH( bmBufferOffset(intel, depth->buffer) ); + OUT_RELOC( depth->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE, + 0 ); OUT_BATCH( clear_depth ); ADVANCE_BATCH(); } @@ -582,7 +588,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, OUT_BATCH(br13); OUT_BATCH((0 << 16) | 0); /* clip x1, y1 */ OUT_BATCH((100 << 16) | 100); /* clip x2, y2 */ - OUT_BATCH(bmBufferOffset(intel, dst_buffer) + dst_offset); + OUT_RELOC(dst_buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE, dst_offset); OUT_BATCH(0); /* bg */ OUT_BATCH(fg_color); /* fg */ OUT_BATCH(0); /* pattern base addr */ -- cgit v1.2.3 From 77e0523fb7769df4bf43747e136b1653b2421b97 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Oct 2007 12:07:25 -0700 Subject: [965] Replace various alignment code with a shared ALIGN() macro. In the process, fix some alignment issues: - Scratch space allocation was aligned into units of 1KB, while the allocation wanted units of bytes, so we never allocated enough space for scratch. - GRF register count was programmed as ALIGN(val - 1, 16) / 16 instead of ALIGN(val, 16) / 16 - 1, which overcounted for val != 16n+1. --- src/mesa/drivers/dri/i915/intel_context.h | 2 ++ src/mesa/drivers/dri/i965/brw_clip_state.c | 3 ++- src/mesa/drivers/dri/i965/brw_curbe.c | 2 +- src/mesa/drivers/dri/i965/brw_draw_upload.c | 2 +- src/mesa/drivers/dri/i965/brw_gs_state.c | 3 ++- src/mesa/drivers/dri/i965/brw_sf_state.c | 2 +- src/mesa/drivers/dri/i965/brw_state_cache.c | 2 +- src/mesa/drivers/dri/i965/brw_state_pool.c | 5 ++--- src/mesa/drivers/dri/i965/brw_tex_layout.c | 4 +--- src/mesa/drivers/dri/i965/brw_vs_state.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_state.c | 4 ++-- src/mesa/drivers/dri/i965/bufmgr_fake.c | 2 +- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 4 ++-- src/mesa/drivers/dri/i965/intel_blit.c | 2 +- src/mesa/drivers/dri/i965/intel_context.h | 2 ++ src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 4 ++-- src/mesa/drivers/dri/i965/intel_pixel_bitmap.c | 9 ++------- src/mesa/drivers/dri/intel/intel_tex_layout.c | 20 +++++++------------- 18 files changed, 33 insertions(+), 41 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h index c8298dd9c43..ce9a362944b 100644 --- a/src/mesa/drivers/dri/i915/intel_context.h +++ b/src/mesa/drivers/dri/i915/intel_context.h @@ -292,6 +292,8 @@ extern char *__progname; #define SUBPIXEL_X 0.125 #define SUBPIXEL_Y 0.125 +#define ALIGN(value, alignment) ((value + alignment - 1) & ~(alignment - 1)) + #define INTEL_FIREVERTICES(intel) \ do { \ if ((intel)->prim.flush) \ diff --git a/src/mesa/drivers/dri/i965/brw_clip_state.c b/src/mesa/drivers/dri/i965/brw_clip_state.c index ae46d7a86e0..ba2f0edf513 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_state.c +++ b/src/mesa/drivers/dri/i965/brw_clip_state.c @@ -43,7 +43,8 @@ static void upload_clip_unit( struct brw_context *brw ) memset(&clip, 0, sizeof(clip)); /* CACHE_NEW_CLIP_PROG */ - clip.thread0.grf_reg_count = ((brw->clip.prog_data->total_grf-1) & ~15) / 16; + clip.thread0.grf_reg_count = + ALIGN(brw->clip.prog_data->total_grf, 16) / 16 - 1; clip.thread0.kernel_start_pointer = brw->clip.prog_gs_offset >> 6; clip.thread3.urb_entry_read_length = brw->clip.prog_data->urb_read_length; clip.thread3.const_urb_entry_read_length = brw->clip.prog_data->curb_read_length; diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index d3c88c1dca0..fa4ea42aa6e 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -304,7 +304,7 @@ static void upload_constant_buffer(struct brw_context *brw) if (!brw_pool_alloc(pool, bufsz, - 6, + 1 << 6, &brw->curbe.gs_offset)) { _mesa_printf("out of GS memory for curbe\n"); assert(0); diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 89cd063d460..b7795703fd3 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -290,7 +290,7 @@ static void get_space( struct brw_context *brw, struct gl_buffer_object **vbo_return, GLuint *offset_return ) { - size = (size + 63) & ~63; + size = ALIGN(size, 64); if (brw->vb.upload.offset + size > BRW_UPLOAD_INIT_SIZE) wrap_buffers(brw, size); diff --git a/src/mesa/drivers/dri/i965/brw_gs_state.c b/src/mesa/drivers/dri/i965/brw_gs_state.c index 5826c01d4f9..5db4dd4603b 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_state.c +++ b/src/mesa/drivers/dri/i965/brw_gs_state.c @@ -46,7 +46,8 @@ static void upload_gs_unit( struct brw_context *brw ) /* CACHE_NEW_GS_PROG */ if (brw->gs.prog_active) { - gs.thread0.grf_reg_count = ((brw->gs.prog_data->total_grf-1) & ~15) / 16; + gs.thread0.grf_reg_count = + ALIGN(brw->gs.prog_data->total_grf, 16) / 16 - 1; gs.thread0.kernel_start_pointer = brw->gs.prog_gs_offset >> 6; gs.thread3.urb_entry_read_length = brw->gs.prog_data->urb_read_length; } diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index 236c6fd42a5..2257916aaec 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -118,7 +118,7 @@ static void upload_sf_unit( struct brw_context *brw ) memset(&sf, 0, sizeof(sf)); /* CACHE_NEW_SF_PROG */ - sf.thread0.grf_reg_count = ((brw->sf.prog_data->total_grf-1) & ~15) / 16; + sf.thread0.grf_reg_count = ALIGN(brw->sf.prog_data->total_grf, 16) / 16 - 1; sf.thread0.kernel_start_pointer = brw->sf.prog_gs_offset >> 6; sf.thread3.urb_entry_read_length = brw->sf.prog_data->urb_read_length; diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index 98d765ac0e0..0e73ff8390f 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -148,7 +148,7 @@ GLuint brw_upload_cache( struct brw_cache *cache, GLuint hash = hash_key(key, key_size); void *tmp = _mesa_malloc(key_size + cache->aux_size); - if (!brw_pool_alloc(cache->pool, data_size, 6, &offset)) { + if (!brw_pool_alloc(cache->pool, data_size, 1 << 6, &offset)) { /* Should not be possible: */ _mesa_printf("brw_pool_alloc failed\n"); diff --git a/src/mesa/drivers/dri/i965/brw_state_pool.c b/src/mesa/drivers/dri/i965/brw_state_pool.c index 708ae857ab5..eda92a2fa89 100644 --- a/src/mesa/drivers/dri/i965/brw_state_pool.c +++ b/src/mesa/drivers/dri/i965/brw_state_pool.c @@ -41,10 +41,9 @@ GLboolean brw_pool_alloc( struct brw_mem_pool *pool, GLuint align, GLuint *offset_return) { - GLuint align_mask = (1<offset + align_mask) & ~align_mask) - pool->offset; + GLuint fixup = ALIGN(pool->offset, align) - pool->offset; - size = (size + 3) & ~3; + size = ALIGN(size, 4); if (pool->offset + fixup + size >= pool->size) { _mesa_printf("%s failed\n", __FUNCTION__); diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index 2094a1c8ad7..e306c9cf106 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -37,8 +37,6 @@ #include "intel_tex_layout.h" #include "macros.h" -#define ALIGN(value, alignment) ((value + alignment - 1) & ~(alignment - 1)) - GLboolean brw_miptree_layout( struct intel_mipmap_tree *mt ) { /* XXX: these vary depending on image format: @@ -64,7 +62,7 @@ GLboolean brw_miptree_layout( struct intel_mipmap_tree *mt ) mt->pitch = ALIGN(width, align_w); pack_y_pitch = (height + 3) / 4; } else { - mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp; + mt->pitch = ALIGN(mt->width0 * mt->cpp, 4) / mt->cpp; pack_y_pitch = ALIGN(mt->height0, align_h); } diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c index c225bf8f5c5..f561979138c 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_state.c @@ -44,7 +44,7 @@ static void upload_vs_unit( struct brw_context *brw ) /* CACHE_NEW_VS_PROG */ vs.thread0.kernel_start_pointer = brw->vs.prog_gs_offset >> 6; - vs.thread0.grf_reg_count = ((brw->vs.prog_data->total_grf-1) & ~15) / 16; + vs.thread0.grf_reg_count = ALIGN(brw->vs.prog_data->total_grf, 16) / 16 - 1; vs.thread3.urb_entry_read_length = brw->vs.prog_data->urb_read_length; vs.thread3.const_urb_entry_read_length = brw->vs.prog_data->curb_read_length; vs.thread3.dispatch_grf_start_reg = 1; diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 5b4f2abd0e2..351de6d90ef 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -62,7 +62,7 @@ static void upload_wm_unit(struct brw_context *brw ) memset(&wm, 0, sizeof(wm)); /* CACHE_NEW_WM_PROG */ - wm.thread0.grf_reg_count = ((brw->wm.prog_data->total_grf-1) & ~15) / 16; + wm.thread0.grf_reg_count = ALIGN(brw->wm.prog_data->total_grf, 16) / 16 - 1; wm.thread0.kernel_start_pointer = brw->wm.prog_gs_offset >> 6; wm.thread3.dispatch_grf_start_reg = brw->wm.prog_data->first_curbe_grf; wm.thread3.urb_entry_read_length = brw->wm.prog_data->urb_read_length; @@ -71,7 +71,7 @@ static void upload_wm_unit(struct brw_context *brw ) wm.wm5.max_threads = max_threads; if (brw->wm.prog_data->total_scratch) { - GLuint per_thread = (brw->wm.prog_data->total_scratch + 1023) / 1024; + GLuint per_thread = ALIGN(brw->wm.prog_data->total_scratch, 1024); GLuint total = per_thread * (max_threads + 1); /* Scratch space -- just have to make sure there is sufficient diff --git a/src/mesa/drivers/dri/i965/bufmgr_fake.c b/src/mesa/drivers/dri/i965/bufmgr_fake.c index a85121122fc..65760c40d47 100644 --- a/src/mesa/drivers/dri/i965/bufmgr_fake.c +++ b/src/mesa/drivers/dri/i965/bufmgr_fake.c @@ -168,7 +168,7 @@ static GLboolean alloc_from_pool( struct intel_context *intel, if (!block) return GL_FALSE; - sz = (buf->size + align-1) & ~(align-1); + sz = ALIGN(buf->size, align); block->mem = mmAllocMem(pool->heap, sz, diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index fb58c0e708c..7a6293b5578 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -37,7 +37,7 @@ static void intel_batchbuffer_reset( struct intel_batchbuffer *batch ) assert(batch->map == NULL); batch->offset = (unsigned long)batch->ptr; - batch->offset = (batch->offset + 63) & ~63; + batch->offset = ALIGN(batch->offset, 64); batch->ptr = (unsigned char *) batch->offset; if (BATCH_SZ - batch->offset < BATCH_REFILL) { @@ -208,7 +208,7 @@ void intel_batchbuffer_align( struct intel_batchbuffer *batch, GLuint sz ) { unsigned long ptr = (unsigned long) batch->ptr; - unsigned long aptr = (ptr + align) & ~((unsigned long)align-1); + unsigned long aptr = ALIGN(ptr, align); GLuint fixup = aptr - ptr; if (intel_batchbuffer_space(batch) < fixup + sz) diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c index 7a9e1a2a3f8..d1c1c8afb6a 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.c +++ b/src/mesa/drivers/dri/i965/intel_blit.c @@ -533,7 +533,7 @@ intelEmitImmediateColorExpandBlit(struct intel_context *intel, GLenum logic_op) { struct xy_text_immediate_blit text; - int dwords = ((src_size + 7) & ~7) / 4; + int dwords = ALIGN(src_size, 8) / 4; uint32_t opcode, br13; assert( logic_op - GL_CLEAR >= 0 ); diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h index f63c2f613dc..65898caaa75 100644 --- a/src/mesa/drivers/dri/i965/intel_context.h +++ b/src/mesa/drivers/dri/i965/intel_context.h @@ -252,6 +252,8 @@ void UNLOCK_HARDWARE( struct intel_context *intel ); #define SUBPIXEL_X 0.125 #define SUBPIXEL_Y 0.125 +#define ALIGN(value, alignment) ((value + alignment - 1) & ~(alignment - 1)) + /* ================================================================ * Color packing: */ diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 0fb33e27f47..268a982a97f 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -233,8 +233,8 @@ GLboolean intel_miptree_image_data(struct intel_context *intel, if (dst->compressed) { alignment = intel_compressed_alignment(dst->internal_format); - src_row_pitch = ((src_row_pitch + alignment - 1) & ~(alignment - 1)); - width = ((width + alignment - 1) & ~(alignment - 1)); + src_row_pitch = ALIGN(src_row_pitch, alignment); + width = ALIGN(width, alignment); height = (height + 3) / 4; } diff --git a/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c b/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c index 79c1fee9c07..3777422619b 100644 --- a/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c @@ -91,11 +91,6 @@ static void set_bit( GLubyte *dest, dest[bit/8] |= 1 << (bit % 8); } -static int align(int x, int align) -{ - return (x + align - 1) & ~(align - 1); -} - /* Extract a rectangle's worth of data from the bitmap. Called * per-cliprect. */ @@ -147,7 +142,7 @@ static GLuint get_bitmap_rect(GLsizei width, GLsizei height, } if (row_align) - bit = (bit + row_align - 1) & ~(row_align - 1); + bit = ALIGN(bit, row_align); } return count; @@ -268,7 +263,7 @@ do_blit_bitmap( GLcontext *ctx, for (px = 0; px < box_w; px += DX) { int h = MIN2(DY, box_h - py); int w = MIN2(DX, box_w - px); - GLuint sz = align(align(w,8) * h, 64)/8; + GLuint sz = ALIGN(ALIGN(w,8) * h, 64)/8; GLenum logic_op = ctx->Color.ColorLogicOpEnabled ? ctx->Color.LogicOp : GL_COPY; diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c b/src/mesa/drivers/dri/intel/intel_tex_layout.c index fdecd3e1868..e3c6e1c17cf 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.c +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c @@ -34,12 +34,6 @@ #include "intel_tex_layout.h" #include "macros.h" - -static int align(int value, int alignment) -{ - return (value + alignment - 1) & ~(alignment - 1); -} - GLuint intel_compressed_alignment(GLenum internalFormat) { GLuint alignment = 4; @@ -70,7 +64,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt ) if (mt->compressed) { align_w = intel_compressed_alignment(mt->internal_format); - mt->pitch = align(mt->width0, align_w); + mt->pitch = ALIGN(mt->width0, align_w); } /* May need to adjust pitch to accomodate the placement of @@ -82,10 +76,10 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt ) GLuint mip1_width; if (mt->compressed) { - mip1_width = align(minify(mt->width0), align_w) - + align(minify(minify(mt->width0)), align_w); + mip1_width = ALIGN(minify(mt->width0), align_w) + + ALIGN(minify(minify(mt->width0)), align_w); } else { - mip1_width = align(minify(mt->width0), align_w) + mip1_width = ALIGN(minify(mt->width0), align_w) + minify(minify(mt->width0)); } @@ -97,7 +91,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt ) /* Pitch must be a whole number of dwords, even though we * express it in texels. */ - mt->pitch = align(mt->pitch * mt->cpp, 4) / mt->cpp; + mt->pitch = ALIGN(mt->pitch * mt->cpp, 4) / mt->cpp; mt->total_height = 0; for ( level = mt->first_level ; level <= mt->last_level ; level++ ) { @@ -109,7 +103,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt ) if (mt->compressed) img_height = MAX2(1, height/4); else - img_height = align(height, align_h); + img_height = ALIGN(height, align_h); /* Because the images are packed better, the final offset @@ -120,7 +114,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt ) /* Layout_below: step right after second mipmap. */ if (level == mt->first_level + 1) { - x += align(width, align_w); + x += ALIGN(width, align_w); } else { y += img_height; -- cgit v1.2.3 From 8e21bb516f87bfdde90d0f469ede4192435b9235 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 5 Oct 2007 12:12:33 +1000 Subject: i915: increase batchbuffer back to 16k --- src/mesa/drivers/dri/i915/intel_batchbuffer.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.h b/src/mesa/drivers/dri/i915/intel_batchbuffer.h index b5934e3c9ff..b5c7a783a72 100644 --- a/src/mesa/drivers/dri/i915/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.h @@ -7,8 +7,7 @@ struct intel_context; -//#define BATCH_SZ 16384 -#define BATCH_SZ 4096 +#define BATCH_SZ 16384 #define BATCH_RESERVED 16 #define INTEL_BATCH_NO_CLIPRECTS 0x1 -- cgit v1.2.3 From 4e1c76de0bf767857737116a0ec908cb8d35083e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 5 Oct 2007 12:15:50 +1000 Subject: i915: add copyrights to new files --- src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c index 0091bb41731..466dc1ec323 100644 --- a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c @@ -1,5 +1,6 @@ /************************************************************************** * + * Copyright © 2007 Red Hat Inc. * Copyright © 2007 Intel Corporation * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA * All Rights Reserved. @@ -30,6 +31,7 @@ * Authors: Thomas Hellström * Keith Whitwell * Eric Anholt + * Dave Airlie */ #include -- cgit v1.2.3 From 4a22ae8d446855d839cc199df8eb1b057045cb88 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Sun, 7 Jan 2007 08:12:01 -0500 Subject: Remove XIDs from DRI interface (see #5714). --- include/GL/internal/dri_interface.h | 55 +++------ src/glx/x11/XF86dri.c | 24 ++++ src/glx/x11/dri_glx.c | 2 +- src/glx/x11/glxclient.h | 7 ++ src/glx/x11/glxcmds.c | 153 ++++++++++++------------- src/glx/x11/glxext.c | 76 +++++++++++-- src/glx/x11/glxhash.c | 6 +- src/glx/x11/xf86dristr.h | 5 +- src/mesa/drivers/dri/common/dri_util.c | 198 +++------------------------------ src/mesa/drivers/dri/common/dri_util.h | 5 - src/mesa/drivers/dri/i810/i810screen.c | 2 +- 11 files changed, 213 insertions(+), 320 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 8d24e311f84..a1a29409b11 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -48,16 +48,16 @@ * side library and the DRI (direct rendering infrastructure). */ /*@{*/ -typedef struct __DRIdisplayRec __DRIdisplay; -typedef struct __DRIscreenRec __DRIscreen; -typedef struct __DRIcontextRec __DRIcontext; -typedef struct __DRIdrawableRec __DRIdrawable; -typedef struct __DRIdriverRec __DRIdriver; -typedef struct __DRIframebufferRec __DRIframebuffer; -typedef struct __DRIversionRec __DRIversion; -typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods; -typedef unsigned long __DRIid; -typedef void __DRInativeDisplay; +typedef struct __DRIdisplayRec __DRIdisplay; +typedef struct __DRIscreenRec __DRIscreen; +typedef struct __DRIcontextRec __DRIcontext; +typedef struct __DRIdrawableRec __DRIdrawable; +typedef struct __DRIdriverRec __DRIdriver; +typedef struct __DRIframebufferRec __DRIframebuffer; +typedef struct __DRIversionRec __DRIversion; +typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods; +typedef unsigned long __DRIid; +typedef void __DRInativeDisplay; /*@}*/ @@ -106,7 +106,7 @@ typedef void *(CREATENEWSCREENFUNC)(__DRInativeDisplay *dpy, int scrn, const __DRIinterfaceMethods * interface, __GLcontextModes ** driver_modes); typedef CREATENEWSCREENFUNC* PFNCREATENEWSCREENFUNC; -extern CREATENEWSCREENFUNC __driCreateNewScreen_20050727; +extern CREATENEWSCREENFUNC __driCreateNewScreen_20070105; /** @@ -170,16 +170,6 @@ struct __DRIinterfaceMethodsRec { * the wire protocol (e.g., EGL) will implement glorified no-op functions. */ /*@{*/ - /** - * Determine if the specified window ID still exists. - * - * \note - * Implementations may assume that the driver will only pass an ID into - * this function that actually corresponds to a window. On - * implementations where windows can only be destroyed by the DRI driver - * (e.g., EGL), this function is allowed to always return \c GL_TRUE. - */ - GLboolean (*windowExists)(__DRInativeDisplay *dpy, __DRIid draw); /** * Create the server-side portion of the GL context. @@ -306,12 +296,6 @@ struct __DRIscreenRec { __DRIid draw, __DRIdrawable *pdraw, int renderType, const int *attrs); - /** - * Method to return a pointer to the DRI drawable data. - */ - __DRIdrawable *(*getDrawable)(__DRInativeDisplay *dpy, __DRIid draw, - void *drawablePrivate); - /** * Opaque pointer to private per screen direct rendering data. \c NULL * if direct rendering is not supported on this screen. Never @@ -392,28 +376,23 @@ struct __DRIcontextRec { */ void *private; - /** - * Pointer to the mode used to create this context. - * - * \since Internal API version 20040317. - */ - const __GLcontextModes * mode; - /** * Method to bind a DRI drawable to a DRI graphics context. * * \since Internal API version 20050727. */ - GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw, - __DRIid read, __DRIcontext *ctx); + GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn, + __DRIdrawable *pdraw, + __DRIdrawable *pread, + __DRIcontext *ctx); /** * Method to unbind a DRI drawable from a DRI graphics context. * * \since Internal API version 20050727. */ - GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw, - __DRIid read, __DRIcontext *ctx); + GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn, + __DRIcontext *ctx); }; /** diff --git a/src/glx/x11/XF86dri.c b/src/glx/x11/XF86dri.c index 8909a047721..721bb3e65ac 100644 --- a/src/glx/x11/XF86dri.c +++ b/src/glx/x11/XF86dri.c @@ -427,16 +427,37 @@ PUBLIC GLboolean XF86DRICreateDrawable( __DRInativeDisplay * ndpy, int screen, return True; } +static int noopErrorHandler(Display *dpy, XErrorEvent *xerr) +{ + return 0; +} + PUBLIC GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, __DRIid drawable ) { Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRIDestroyDrawableReq *req; + int (*oldXErrorHandler)(Display *, XErrorEvent *); TRACE("DestroyDrawable..."); XF86DRICheckExtension (dpy, info, False); + /* This is called from the DRI driver, which used call it like this + * + * if (windowExists(drawable)) + * destroyDrawable(drawable); + * + * which is a textbook race condition - the window may disappear + * from the server between checking for its existance and + * destroying it. Instead we change the semantics of + * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if + * the windows is gone, by wrapping the destroy call in an error + * handler. */ + + XSync(dpy, GL_FALSE); + oldXErrorHandler = XSetErrorHandler(noopErrorHandler); + LockDisplay(dpy); GetReq(XF86DRIDestroyDrawable, req); req->reqType = info->codes->major_opcode; @@ -445,6 +466,9 @@ PUBLIC GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, req->drawable = drawable; UnlockDisplay(dpy); SyncHandle(); + + XSetErrorHandler(oldXErrorHandler); + TRACE("DestroyDrawable... return True"); return True; } diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 5cf9923979a..d68addaa9f4 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -171,7 +171,7 @@ ExtractDir(int index, const char *paths, int dirLen, char *dir) * \todo * Create a macro or something so that this is automatically updated. */ -static const char createNewScreenName[] = "__driCreateNewScreen_20050727"; +static const char createNewScreenName[] = "__driCreateNewScreen_20070105"; /** diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 477566cc464..3dbdc306da3 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -60,6 +60,7 @@ #include "GL/internal/glcore.h" #include "glapitable.h" #include "glxextensions.h" +#include "glxhash.h" #if defined( USE_XTHREADS ) # include #elif defined( PTHREADS ) @@ -349,6 +350,11 @@ struct __GLXcontextRec { * Per context direct rendering interface functions and data. */ __DRIcontext driContext; + + /** + * Pointer to the mode used to create this context. + */ + const __GLcontextModes * mode; #endif /** @@ -456,6 +462,7 @@ typedef struct __GLXscreenConfigsRec { * Per screen direct rendering interface functions and data. */ __DRIscreen driScreen; + __glxHashTable *drawHash; #endif /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index f52b71ffcd2..09514937269 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -61,41 +61,92 @@ static const char __glXGLXClientVersion[] = "1.4"; /****************************************************************************/ + +#ifdef GLX_DIRECT_RENDERING + +static Bool windowExistsFlag; +static int windowExistsErrorHandler(Display *dpy, XErrorEvent *xerr) +{ + if (xerr->error_code == BadWindow) { + windowExistsFlag = GL_FALSE; + } + return 0; +} + +/** + * Find drawables in the local hash that have been destroyed on the + * server. + * + * \param dpy Display to destroy drawables for + * \param screen Screen number to destroy drawables for + */ +static void GarbageCollectDRIDrawables(Display *dpy, int screen) +{ + __GLXdisplayPrivate * const priv = __glXInitialize(dpy); + __GLXscreenConfigs *sc; + __DRIid draw; + __DRIdrawable *pdraw; + XWindowAttributes xwa; + int (*oldXErrorHandler)(Display *, XErrorEvent *); + + if (priv == NULL || priv->driDisplay.private == NULL) + return; + + /* Set no-op error handler so Xlib doesn't bail out if the windows + * has alreay been destroyed on the server. */ + XSync(dpy, GL_FALSE); + oldXErrorHandler = XSetErrorHandler(windowExistsErrorHandler); + + sc = &priv->screenConfigs[screen]; + if (__glxHashFirst(sc->drawHash, &draw, (void *)&pdraw) == 1) { + do { + windowExistsFlag = GL_TRUE; + XGetWindowAttributes(dpy, draw, &xwa); /* dummy request */ + if (!windowExistsFlag) { + /* Destroy the local drawable data, if the drawable no + longer exists in the Xserver */ + (*pdraw->destroyDrawable)(dpy, pdraw->private); + Xfree(pdraw); + } + } while (__glxHashNext(sc->drawHash, &draw, (void *)&pdraw) == 1); + } + + XSetErrorHandler(oldXErrorHandler); +} + /** * Get the __DRIdrawable for the drawable associated with a GLXContext * * \param dpy The display associated with \c drawable. * \param drawable GLXDrawable whose __DRIdrawable part is to be retrieved. + * \param scrn_num If non-NULL, the drawables screen is stored there * \returns A pointer to the context's __DRIdrawable on success, or NULL if * the drawable is not associated with a direct-rendering context. */ - -#ifdef GLX_DIRECT_RENDERING static __DRIdrawable * GetDRIDrawable( Display *dpy, GLXDrawable drawable, int * const scrn_num ) { __GLXdisplayPrivate * const priv = __glXInitialize(dpy); + __DRIdrawable * const pdraw; + const unsigned screen_count = ScreenCount(dpy); + unsigned i; + __GLXscreenConfigs *sc; - if ( (priv != NULL) && (priv->driDisplay.private != NULL) ) { - const unsigned screen_count = ScreenCount(dpy); - unsigned i; - - for ( i = 0 ; i < screen_count ; i++ ) { - __DRIscreen * const psc = &priv->screenConfigs[i].driScreen; - __DRIdrawable * const pdraw = (psc->private != NULL) - ? (*psc->getDrawable)(dpy, drawable, psc->private) : NULL; - - if ( pdraw != NULL ) { - if ( scrn_num != NULL ) { - *scrn_num = i; - } - return pdraw; - } + if (priv == NULL || priv->driDisplay.private == NULL) + return NULL; + + for (i = 0; i < screen_count; i++) { + sc = &priv->screenConfigs[i]; + if (__glxHashLookup(sc->drawHash, drawable, (void *) &pdraw) == 0) { + if (scrn_num != NULL) + *scrn_num = i; + return pdraw; } } return NULL; } + #endif @@ -359,7 +410,7 @@ CreateContext(Display *dpy, XVisualInfo *vis, gc->screen = mode->screen; gc->vid = mode->visualID; gc->fbconfigID = mode->fbconfigID; - gc->driContext.mode = mode; + gc->mode = mode; } } } @@ -473,6 +524,7 @@ DestroyContext(Display *dpy, GLXContext gc) gc->driContext.private); gc->driContext.private = NULL; } + GarbageCollectDRIDrawables(dpy, gc->screen); } #endif @@ -1730,9 +1782,7 @@ static int __glXSwapIntervalMESA(unsigned int interval) if ( (psc != NULL) && (psc->driScreen.private != NULL) && __glXExtensionBitIsEnabled( psc, MESA_swap_control_bit ) ) { __DRIdrawable * const pdraw = - (*psc->driScreen.getDrawable)(gc->currentDpy, - gc->currentDrawable, - psc->driScreen.private); + GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); if ( pdraw != NULL ) { pdraw->swap_interval = interval; return 0; @@ -1759,9 +1809,7 @@ static int __glXGetSwapIntervalMESA(void) if ( (psc != NULL) && (psc->driScreen.private != NULL) && __glXExtensionBitIsEnabled( psc, MESA_swap_control_bit ) ) { __DRIdrawable * const pdraw = - (*psc->driScreen.getDrawable)(gc->currentDpy, - gc->currentDrawable, - psc->driScreen.private); + GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); if ( pdraw != NULL ) { return pdraw->swap_interval; } @@ -1919,9 +1967,7 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count if ( __glXExtensionBitIsEnabled( psc, SGI_video_sync_bit ) && psc->driScreen.private ) { __DRIdrawable * const pdraw = - (*psc->driScreen.getDrawable)(gc->currentDpy, - gc->currentDrawable, - psc->driScreen.private); + GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); if ( (pdraw != NULL) && (pdraw->waitForMSC != NULL) ) { int ret; int64_t msc; @@ -2140,11 +2186,10 @@ Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, int i; - GetDRIDrawable( dpy, drawable, & screen_num ); - if ( (screen_num != -1) - && XF86VidModeQueryVersion( dpy, & i, & i ) - && XF86VidModeGetModeLine( dpy, screen_num, & dot_clock, - & mode_line ) ) { + if (GetDRIDrawable( dpy, drawable, & screen_num) != NULL + && XF86VidModeQueryVersion( dpy, & i, & i ) + && XF86VidModeGetModeLine( dpy, screen_num, & dot_clock, + & mode_line ) ) { unsigned n = dot_clock * 1000; unsigned d = mode_line.vtotal * mode_line.htotal; @@ -2889,50 +2934,6 @@ int __glXGetInternalVersion(void) } - -static Bool windowExistsFlag; - -static int windowExistsErrorHandler(Display *dpy, XErrorEvent *xerr) -{ - if (xerr->error_code == BadWindow) { - windowExistsFlag = GL_FALSE; - } - return 0; -} - -/** - * Determine if a window associated with a \c GLXDrawable exists on the - * X-server. This function is not used internally by libGL. It is provided - * as a utility function for DRI drivers. - * Drivers should not call this function directly. They should instead use - * \c glXGetProcAddress to obtain a pointer to the function. - * - * \param dpy Display associated with the drawable to be queried. - * \param draw \c GLXDrawable to test. - * - * \returns \c GL_TRUE if a window exists that is associated with \c draw, - * otherwise \c GL_FALSE is returned. - * - * \warning This function is not currently thread-safe. - * - * \sa glXGetProcAddress - * - * \since Internal API version 20021128. - */ -Bool __glXWindowExists(Display *dpy, GLXDrawable draw) -{ - XWindowAttributes xwa; - int (*oldXErrorHandler)(Display *, XErrorEvent *); - - XSync(dpy, GL_FALSE); - windowExistsFlag = GL_TRUE; - oldXErrorHandler = XSetErrorHandler(windowExistsErrorHandler); - XGetWindowAttributes(dpy, draw, &xwa); /* dummy request */ - XSetErrorHandler(oldXErrorHandler); - return windowExistsFlag; -} - - /** * Get the unadjusted system time (UST). Currently, the UST is measured in * microseconds since Epoc. The actual resolution of the UST may vary from diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 8fe10338a80..7f0428c0a99 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -61,6 +61,7 @@ #include #include #include "xf86dri.h" +#include "xf86drm.h" #include "sarea.h" #include "dri_glx.h" #endif @@ -366,6 +367,7 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv) (*psc->driScreen.destroyScreen)(priv->dpy, i, psc->driScreen.private); psc->driScreen.private = NULL; + __glxHashDestroy(psc->drawHash); #endif } XFree((char*) priv->screenConfigs); @@ -781,7 +783,6 @@ static const __DRIinterfaceMethods interface_methods = { _gl_context_modes_destroy, __glXFindDRIScreen, - __glXWindowExists, XF86DRICreateContextWithConfig, XF86DRIDestroyContext, @@ -816,7 +817,7 @@ static const __DRIinterfaceMethods interface_methods = { * returned by the client-side driver. */ static void * -CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc, +CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, __DRIdisplay * driDpy, PFNCREATENEWSCREENFUNC createNewScreen) { @@ -937,13 +938,12 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc, if ( status == 0 ) { __GLcontextModes * driver_modes = NULL; - __GLXscreenConfigs *configs = psc->screenConfigs; err_msg = "InitDriver"; err_extra = NULL; psp = (*createNewScreen)(dpy, scrn, - psc, - configs->configs, + &psc->driScreen, + psc->configs, & ddx_version, & dri_version, & drm_version, @@ -954,7 +954,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc, & interface_methods, & driver_modes ); - filter_modes( & configs->configs, + filter_modes( & psc->configs, driver_modes ); _gl_context_modes_destroy( driver_modes ); } @@ -1169,6 +1169,14 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) UnlockDisplay(dpy); #ifdef GLX_DIRECT_RENDERING + /* Create drawable hash */ + psc->drawHash = __glxHashCreate(); + if ( psc->drawHash == NULL ) { + SyncHandle(); + FreeScreenConfigs(priv); + return GL_FALSE; + } + /* Initialize per screen dynamic client GLX extensions */ psc->ext_list_first_time = GL_TRUE; /* Initialize the direct rendering per screen data and functions */ @@ -1181,7 +1189,7 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) psc->driScreen.screenConfigs = (void *)psc; psc->driScreen.private = - CallCreateNewScreen(dpy, i, & psc->driScreen, + CallCreateNewScreen(dpy, i, psc, & priv->driDisplay, priv->driDisplay.createNewScreen[i] ); } @@ -1617,20 +1625,64 @@ static Bool SendMakeCurrentRequest(Display *dpy, CARD8 opcode, #ifdef GLX_DIRECT_RENDERING +static __DRIdrawable * +FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc) +{ + __GLXdisplayPrivate * const priv = __glXInitialize(dpy); + __DRIdrawable *pdraw; + __GLXscreenConfigs *sc; + void *empty_attribute_list = NULL; + + if (priv == NULL || priv->driDisplay.private == NULL) + return NULL; + + sc = &priv->screenConfigs[gc->screen]; + if (__glxHashLookup(sc->drawHash, drawable, (void *) &pdraw) == 0) + return pdraw; + + /* Allocate a new drawable */ + pdraw = (__DRIdrawable *)Xmalloc(sizeof(__DRIdrawable)); + if (!pdraw) + return NULL; + + /* Create a new drawable */ + pdraw->private = + (*sc->driScreen.createNewDrawable)(dpy, + gc->mode, + drawable, pdraw, + GLX_WINDOW_BIT, + empty_attribute_list); + + if (!pdraw->private) { + /* ERROR!!! */ + Xfree(pdraw); + return NULL; + } + + if (__glxHashInsert(sc->drawHash, drawable, pdraw)) { + (*pdraw->destroyDrawable)(dpy, pdraw->private); + Xfree(pdraw); + return NULL; + } + + return pdraw; +} + static Bool BindContextWrapper( Display *dpy, GLXContext gc, GLXDrawable draw, GLXDrawable read ) { - return (*gc->driContext.bindContext)(dpy, gc->screen, draw, read, + __DRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc); + __DRIdrawable *pread = FetchDRIDrawable(dpy, read, gc); + + return (*gc->driContext.bindContext)(dpy, gc->screen, pdraw, pread, & gc->driContext); } static Bool UnbindContextWrapper( GLXContext gc ) { - return (*gc->driContext.unbindContext)(gc->currentDpy, gc->screen, - gc->currentDrawable, - gc->currentReadable, - & gc->driContext ); + return (*gc->driContext.unbindContext)(gc->currentDpy, gc->screen, + &gc->driContext ); } #endif /* GLX_DIRECT_RENDERING */ diff --git a/src/glx/x11/glxhash.c b/src/glx/x11/glxhash.c index f722cbaf389..1b284c5f451 100644 --- a/src/glx/x11/glxhash.c +++ b/src/glx/x11/glxhash.c @@ -1,4 +1,6 @@ -/* xf86drmHash.c -- Small hash table support for integer -> integer mapping +/* glxhash.c -- Small hash table support for integer -> integer mapping + * Taken from libdrm. + * * Created: Sun Apr 18 09:35:45 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -25,8 +27,6 @@ * * Authors: Rickard E. (Rik) Faith * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.4 2001/03/21 18:08:54 dawes Exp $ - * * DESCRIPTION * * This file contains a straightforward implementation of a fixed-sized diff --git a/src/glx/x11/xf86dristr.h b/src/glx/x11/xf86dristr.h index ac05b183b3c..7e8bc557d3e 100644 --- a/src/glx/x11/xf86dristr.h +++ b/src/glx/x11/xf86dristr.h @@ -50,9 +50,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 4.0.0: Original * 4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02 * 4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02 + * 5.0.0: Drop XIDs from DRI interface. */ -#define XF86DRI_MAJOR_VERSION 4 -#define XF86DRI_MINOR_VERSION 1 +#define XF86DRI_MAJOR_VERSION 5 +#define XF86DRI_MINOR_VERSION 0 #define XF86DRI_PATCH_VERSION 0 typedef struct _XF86DRIQueryVersion { diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index c30e66f1722..1f916a82cad 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -88,63 +88,6 @@ __driUtilMessage(const char *f, ...) } -/*****************************************************************/ -/** \name Drawable list management */ -/*****************************************************************/ -/*@{*/ - -static GLboolean __driAddDrawable(void *drawHash, __DRIdrawable *pdraw) -{ - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; - - if (drmHashInsert(drawHash, pdp->draw, pdraw)) - return GL_FALSE; - - return GL_TRUE; -} - -static __DRIdrawable *__driFindDrawable(void *drawHash, __DRIid draw) -{ - int retcode; - __DRIdrawable *pdraw; - - retcode = drmHashLookup(drawHash, draw, (void *)&pdraw); - if (retcode) - return NULL; - - return pdraw; -} - - -/** - * Find drawables in the local hash that have been destroyed on the - * server. - * - * \param drawHash Hash-table containing all know drawables. - */ -static void __driGarbageCollectDrawables(void *drawHash) -{ - __DRIid draw; - __DRInativeDisplay *dpy; - __DRIdrawable *pdraw; - - if (drmHashFirst(drawHash, &draw, (void *)&pdraw) == 1) { - do { - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; - dpy = pdp->driScreenPriv->display; - if (! (*dri_interface->windowExists)(dpy, draw)) { - /* Destroy the local drawable data, if the drawable no - longer exists in the Xserver */ - (*pdraw->destroyDrawable)(dpy, pdraw->private); - _mesa_free(pdraw); - } - } while (drmHashNext(drawHash, &draw, (void *)&pdraw) == 1); - } -} - -/*@}*/ - - /*****************************************************************/ /** \name Context (un)binding functions */ /*****************************************************************/ @@ -155,8 +98,6 @@ static void __driGarbageCollectDrawables(void *drawHash) * * \param dpy the display handle. * \param scrn the screen number. - * \param draw drawable. - * \param read Current reading drawable. * \param gc context. * * \return \c GL_TRUE on success, or \c GL_FALSE on failure. @@ -170,12 +111,9 @@ static void __driGarbageCollectDrawables(void *drawHash) * into their respective real types it also assures they are not \c NULL. */ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, - __DRIid draw, __DRIid read, - __DRIcontext *ctx) + __DRIcontext *ctx) { __DRIscreen *pDRIScreen; - __DRIdrawable *pdraw; - __DRIdrawable *pread; __DRIcontextPrivate *pcp; __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -186,7 +124,7 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, ** calling driUnbindContext. */ - if (ctx == NULL || draw == None || read == None) { + if (ctx == NULL) { /* ERROR!!! */ return GL_FALSE; } @@ -199,26 +137,12 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, psp = (__DRIscreenPrivate *)pDRIScreen->private; pcp = (__DRIcontextPrivate *)ctx->private; - - pdraw = __driFindDrawable(psp->drawHash, draw); - if (!pdraw) { - /* ERROR!!! */ - return GL_FALSE; - } - pdp = (__DRIdrawablePrivate *)pdraw->private; - - pread = __driFindDrawable(psp->drawHash, read); - if (!pread) { - /* ERROR!!! */ - return GL_FALSE; - } - prp = (__DRIdrawablePrivate *)pread->private; - + pdp = (__DRIdrawablePrivate *)pcp->driDrawablePriv; + prp = (__DRIdrawablePrivate *)pcp->driReadablePriv; /* Let driver unbind drawable from context */ (*psp->DriverAPI.UnbindContext)(pcp); - if (pdp->refcount == 0) { /* ERROR!!! */ return GL_FALSE; @@ -254,72 +178,20 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, * This function takes both a read buffer and a draw buffer. This is needed * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. - * - * \bug This function calls \c driCreateNewDrawable in two places with the - * \c renderType hard-coded to \c GLX_WINDOW_BIT. Some checking might - * be needed in those places when support for pbuffers and / or pixmaps - * is added. Is it safe to assume that the drawable is a window? */ static GLboolean DoBindContext(__DRInativeDisplay *dpy, - __DRIid draw, __DRIid read, - __DRIcontext *ctx, const __GLcontextModes * modes, - __DRIscreenPrivate *psp) + __DRIdrawable *pdraw, + __DRIdrawable *pread, + __DRIcontext *ctx, + __DRIscreenPrivate *psp) { - __DRIdrawable *pdraw; __DRIdrawablePrivate *pdp; - __DRIdrawable *pread; __DRIdrawablePrivate *prp; __DRIcontextPrivate * const pcp = ctx->private; - /* Find the _DRIdrawable which corresponds to the writing drawable. */ - pdraw = __driFindDrawable(psp->drawHash, draw); - if (!pdraw) { - /* Allocate a new drawable */ - pdraw = (__DRIdrawable *)_mesa_malloc(sizeof(__DRIdrawable)); - if (!pdraw) { - /* ERROR!!! */ - return GL_FALSE; - } - - /* Create a new drawable */ - driCreateNewDrawable(dpy, modes, draw, pdraw, GLX_WINDOW_BIT, - empty_attribute_list); - if (!pdraw->private) { - /* ERROR!!! */ - _mesa_free(pdraw); - return GL_FALSE; - } - - } pdp = (__DRIdrawablePrivate *) pdraw->private; - - /* Find the _DRIdrawable which corresponds to the reading drawable. */ - if (read == draw) { - /* read buffer == draw buffer */ - prp = pdp; - } - else { - pread = __driFindDrawable(psp->drawHash, read); - if (!pread) { - /* Allocate a new drawable */ - pread = (__DRIdrawable *)_mesa_malloc(sizeof(__DRIdrawable)); - if (!pread) { - /* ERROR!!! */ - return GL_FALSE; - } - - /* Create a new drawable */ - driCreateNewDrawable(dpy, modes, read, pread, GLX_WINDOW_BIT, - empty_attribute_list); - if (!pread->private) { - /* ERROR!!! */ - _mesa_free(pread); - return GL_FALSE; - } - } - prp = (__DRIdrawablePrivate *) pread->private; - } + prp = (__DRIdrawablePrivate *) pread->private; /* Bind the drawable to the context */ pcp->driDrawablePriv = pdp; @@ -359,8 +231,9 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy, * function. */ static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn, - __DRIid draw, __DRIid read, - __DRIcontext * ctx) + __DRIdrawable *pdraw, + __DRIdrawable *pread, + __DRIcontext * ctx) { __DRIscreen *pDRIScreen; @@ -369,7 +242,7 @@ static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn, ** calling driBindContext. */ - if (ctx == NULL || draw == None || read == None) { + if (ctx == NULL || pdraw == None || pread == None) { /* ERROR!!! */ return GL_FALSE; } @@ -380,7 +253,7 @@ static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn, return GL_FALSE; } - return DoBindContext( dpy, draw, read, ctx, ctx->mode, + return DoBindContext( dpy, pdraw, pread, ctx, (__DRIscreenPrivate *)pDRIScreen->private ); } /*@}*/ @@ -438,8 +311,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); - if (!__driFindDrawable(psp->drawHash, pdp->draw) || - ! (*dri_interface->getDrawableInfo)(pdp->display, pdp->screen, pdp->draw, + if (! (*dri_interface->getDrawableInfo)(pdp->display, pdp->screen, pdp->draw, &pdp->index, &pdp->lastStamp, &pdp->x, &pdp->y, &pdp->w, &pdp->h, &pdp->numClipRects, &pdp->pClipRects, @@ -675,30 +547,9 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, pdp->swapBuffers = psp->DriverAPI.SwapBuffers; - /* Add pdraw to drawable list */ - if (!__driAddDrawable(psp->drawHash, pdraw)) { - /* ERROR!!! */ - (*pdraw->destroyDrawable)(dpy, pdp); - _mesa_free(pdp); - pdp = NULL; - pdraw->private = NULL; - } - return (void *) pdp; } -static __DRIdrawable * -driGetDrawable(__DRInativeDisplay *dpy, __DRIid draw, void *screenPrivate) -{ - __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; - - /* - ** Make sure this routine returns NULL if the drawable is not bound - ** to a direct rendering context! - */ - return __driFindDrawable(psp->drawHash, draw); -} - static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) { @@ -710,9 +561,7 @@ driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) psp = pdp->driScreenPriv; scrn = psp->myNum; (*psp->DriverAPI.DestroyBuffer)(pdp); - if ((*dri_interface->windowExists)(dpy, pdp->draw)) - (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw); - drmHashDelete(psp->drawHash, pdp->draw); + (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw); if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; @@ -751,7 +600,6 @@ driDestroyContext(__DRInativeDisplay *dpy, int scrn, void *contextPrivate) if (pcp) { (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); - __driGarbageCollectDrawables(pcp->driScreenPriv->drawHash); (void) (*dri_interface->destroyContext)(dpy, scrn, pcp->contextID); _mesa_free(pcp); } @@ -836,8 +684,6 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, return NULL; } - __driGarbageCollectDrawables(pcp->driScreenPriv->drawHash); - return pcp; } /*@}*/ @@ -874,15 +720,11 @@ static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPriv (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); - _mesa_free(psp->pDevPriv); (void)drmCloseOnce(psp->fd); if ( psp->modes != NULL ) { (*dri_interface->destroyContextModes)( psp->modes ); } - assert(psp->drawHash); - drmHashDestroy(psp->drawHash); - _mesa_free(psp); } } @@ -939,13 +781,6 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, return NULL; } - /* Create the hash table */ - psp->drawHash = drmHashCreate(); - if ( psp->drawHash == NULL ) { - _mesa_free( psp ); - return NULL; - } - psp->display = dpy; psp->myNum = scrn; psp->psc = psc; @@ -993,7 +828,6 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, psc->destroyScreen = driDestroyScreen; psc->createNewDrawable = driCreateNewDrawable; - psc->getDrawable = driGetDrawable; psc->getMSC = driGetMSC; psc->createNewContext = driCreateNewContext; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 539d28d1149..a08eab1616e 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -489,11 +489,6 @@ struct __DRIscreenPrivateRec { */ __DRIcontextPrivate dummyContextPriv; - /** - * Hash table to hold the drawable information for this screen. - */ - void *drawHash; - /** * Device-dependent private information (not stored in the SAREA). * diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index f8cf050d7e4..c0a7cdb90a9 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -431,7 +431,7 @@ static const struct __DriverAPIRec i810API = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +void * __driCreateNewScreen_20070105( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, -- cgit v1.2.3 From 4611b9398e6164ea419bf587e759a354be4c58b4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 5 Oct 2007 14:33:18 +1000 Subject: i915: clean up lists on teardown also fix a use of uninitialised pointer --- src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c index 466dc1ec323..990c58aa256 100644 --- a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c @@ -160,7 +160,6 @@ static int intel_adjust_list_nodes(struct intel_bo_list *list) return ret; } -#if 0 void intel_bo_free_list(struct intel_bo_list *list) { struct intel_bo_node *node; @@ -185,7 +184,6 @@ void intel_bo_free_list(struct intel_bo_list *list) list->numCurrent--; } } -#endif static int intel_bo_reset_list(struct intel_bo_list *list) { @@ -218,7 +216,7 @@ static int intel_create_bo_list(int numTarget, struct intel_bo_list *list, void list->numTarget = numTarget; list->numCurrent = 0; list->numOnList = 0; - if (list->destroy) + if (destroy) list->destroy = destroy; else list->destroy = generic_destroy; @@ -840,6 +838,9 @@ dri_bufmgr_ttm_destroy(dri_bufmgr *bufmgr) { dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr; + intel_bo_free_list(&bufmgr_ttm->list); + intel_bo_free_list(&bufmgr_ttm->reloc_list); + _glthread_DESTROY_MUTEX(bufmgr_ttm->mutex); free(bufmgr); } -- cgit v1.2.3 From 0ba57d02cd4a9e37bb5367a5c345c5f41038eb27 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 5 Oct 2007 14:41:32 +1000 Subject: i915: drop complex list handling for now If this proves a win later we can add it back but at the moment I don't think it's required yet --- src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c | 69 ++-------------------------- 1 file changed, 3 insertions(+), 66 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c index 990c58aa256..e85bc7e2f80 100644 --- a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c @@ -87,11 +87,8 @@ struct intel_bo_reloc_node }; struct intel_bo_list { - unsigned numTarget; unsigned numCurrent; - unsigned numOnList; drmMMListHead list; - drmMMListHead free; void (*destroy)(void *node); }; @@ -132,35 +129,7 @@ typedef struct _dri_fence_ttm } dri_fence_ttm; -static int intel_adjust_list_nodes(struct intel_bo_list *list) -{ - struct intel_bo_node *node; - drmMMListHead *l; - int ret = 0; - - while(list->numCurrent < list->numTarget) { - node = (struct intel_bo_node *) drmMalloc(sizeof(*node)); - if (!node) { - ret = -ENOMEM; - break; - } - list->numCurrent++; - DRMLISTADD(&node->head, &list->free); - } - - while(list->numCurrent > list->numTarget) { - l = list->free.next; - if (l == &list->free) - break; - DRMLISTDEL(l); - node = DRMLISTENTRY(struct intel_bo_node, l, head); - list->destroy(node); - list->numCurrent--; - } - return ret; -} - -void intel_bo_free_list(struct intel_bo_list *list) +static void intel_bo_free_list(struct intel_bo_list *list) { struct intel_bo_node *node; drmMMListHead *l; @@ -172,38 +141,9 @@ void intel_bo_free_list(struct intel_bo_list *list) list->destroy(node); l = list->list.next; list->numCurrent--; - list->numOnList--; - } - - l = list->free.next; - while(l != &list->free) { - DRMLISTDEL(l); - node = DRMLISTENTRY(struct intel_bo_node, l, head); - list->destroy(node); - l = list->free.next; - list->numCurrent--; } } -static int intel_bo_reset_list(struct intel_bo_list *list) -{ - drmMMListHead *l; - int ret; - - ret = intel_adjust_list_nodes(list); - if (ret) - return ret; - - l = list->list.next; - while (l != &list->list) { - DRMLISTDEL(l); - DRMLISTADD(l, &list->free); - list->numOnList--; - l = list->list.next; - } - return intel_adjust_list_nodes(list); -} - static void generic_destroy(void *nodep) { free(nodep); @@ -212,15 +152,12 @@ static void generic_destroy(void *nodep) static int intel_create_bo_list(int numTarget, struct intel_bo_list *list, void (*destroy)(void *)) { DRMINITLISTHEAD(&list->list); - DRMINITLISTHEAD(&list->free); - list->numTarget = numTarget; list->numCurrent = 0; - list->numOnList = 0; if (destroy) list->destroy = destroy; else list->destroy = generic_destroy; - return intel_adjust_list_nodes(list); + return 0; } @@ -913,7 +850,7 @@ dri_ttm_post_submit(dri_bo *batch_buf, dri_fence **last_fence) intel_free_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list); intel_free_reloc_list(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list); - intel_bo_reset_list(&bufmgr_ttm->list); + intel_bo_free_list(&bufmgr_ttm->list); } /** -- cgit v1.2.3 From d85e8b088bda9a118494dd86464c4a495475e407 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Sat, 6 Oct 2007 02:30:24 +0200 Subject: nouveau: move nv10 clear command, for usage by other gpu --- src/mesa/drivers/dri/nouveau/nouveau_context.c | 36 +++++++++++ src/mesa/drivers/dri/nouveau/nouveau_context.h | 6 +- src/mesa/drivers/dri/nouveau/nouveau_driver.c | 70 ++++++++++++++++++++- src/mesa/drivers/dri/nouveau/nv10_state.c | 86 +++----------------------- 4 files changed, 115 insertions(+), 83 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index f36483a3d49..a8569a9f153 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -378,3 +378,39 @@ void nouveauCopySubBuffer(__DRIdrawablePrivate *dPriv, { } +void nouveauClearBuffer(GLcontext *ctx, nouveau_renderbuffer_t *buffer, + int fill, int mask) +{ + nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); + int dimensions; + + if (!buffer) { + return; + } + + /* FIXME: only support 32 bits atm */ + + /* Surface that we will work on */ + nouveauObjectOnSubchannel(nmesa, NvSubCtxSurf2D, NvCtxSurf2D); + + BEGIN_RING_SIZE(NvSubCtxSurf2D, NV10_CONTEXT_SURFACES_2D_FORMAT, 4); + OUT_RING(0x0b); /* Y32 color format */ + OUT_RING((buffer->pitch<<16)|buffer->pitch); + OUT_RING(buffer->offset); + OUT_RING(buffer->offset); + + /* Now clear a rectangle */ + dimensions = ((buffer->mesa.Height)<<16) | (buffer->mesa.Width); + + nouveauObjectOnSubchannel(nmesa, NvSubGdiRectText, NvGdiRectText); + + BEGIN_RING_SIZE(NvSubGdiRectText, NV04_GDI_RECTANGLE_TEXT_OPERATION, 1); + OUT_RING(3); /* SRCCOPY */ + + BEGIN_RING_SIZE(NvSubGdiRectText, NV04_GDI_RECTANGLE_TEXT_BLOCK_LEVEL1_TL, 5); + OUT_RING(0); /* top left */ + OUT_RING(dimensions); /* bottom right */ + OUT_RING(fill); + OUT_RING(0); /* top left */ + OUT_RING(dimensions); /* bottom right */ +} diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 77fe13a9cdc..9aff0ee668b 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -133,9 +133,6 @@ typedef struct nouveau_context { nouveau_renderbuffer_t *color_buffer; nouveau_renderbuffer_t *depth_buffer; - /* Color buffer clear value */ - uint32_t clear_color_value; - /* Depth/stencil clear value */ uint32_t clear_value; @@ -234,6 +231,9 @@ extern void nouveauSwapBuffers(__DRIdrawablePrivate *dPriv); extern void nouveauCopySubBuffer(__DRIdrawablePrivate *dPriv, int x, int y, int w, int h); +extern void nouveauClearBuffer(GLcontext *ctx, nouveau_renderbuffer_t *buffer, + int fill, int mask); + /* Debugging utils: */ extern int NOUVEAU_DEBUG; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c index 4851c668356..8b76779002b 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c @@ -35,6 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "framebuffer.h" #include "utils.h" +#include "colormac.h" /* Wrapper for DRM_NOUVEAU_GETPARAM ioctl */ GLboolean nouveauDRMGetParam(nouveauContextPtr nmesa, @@ -135,7 +136,74 @@ static void nouveauFinish( GLcontext *ctx ) /* glClear */ static void nouveauClear( GLcontext *ctx, GLbitfield mask ) { - // XXX we really should do something here... + uint32_t clear_value; + nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); + + /* FIXME: should we clear front buffer, even if asked to do it? */ + if (mask & (BUFFER_BIT_FRONT_LEFT|BUFFER_BIT_BACK_LEFT)) { + GLubyte c[4]; + int color_bits = 32; + int color_mask = 0xffffffff; + + UNCLAMPED_FLOAT_TO_RGBA_CHAN(c,ctx->Color.ClearColor); + clear_value = PACK_COLOR_8888(c[3],c[0],c[1],c[2]); + + if (ctx->DrawBuffer) { + /* FIXME: find correct color buffer, instead of [0][0] */ + if (ctx->DrawBuffer->_ColorDrawBuffers[0][0]) { + color_bits = ctx->DrawBuffer->_ColorDrawBuffers[0][0]->RedBits; + color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0][0]->GreenBits; + color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0][0]->BlueBits; + color_bits += ctx->DrawBuffer->_ColorDrawBuffers[0][0]->AlphaBits; + } + } + + if (color_bits<24) { + clear_value = PACK_COLOR_565(c[0],c[1],c[2]); + color_mask = 0xffff; + } + + nouveauClearBuffer(ctx, nmesa->color_buffer, + clear_value, color_mask); + } + + if (mask & (BUFFER_BIT_DEPTH)) { + int depth_bits = 24; + int depth_mask; + if (ctx->DrawBuffer) { + if (ctx->DrawBuffer->_DepthBuffer) { + depth_bits = ctx->DrawBuffer->_DepthBuffer->DepthBits; + } + } + + switch(depth_bits) { + case 16: + clear_value = (uint32_t) (ctx->Depth.Clear * 32767.0); + depth_mask = 0xffff; + break; + default: + clear_value = ((uint32_t) (ctx->Depth.Clear * 16777215.0)) << 8; + depth_mask = 0xffffff00; + break; + } + + nouveauClearBuffer(ctx, nmesa->depth_buffer, + clear_value, depth_mask); + } + + if (mask & (BUFFER_BIT_STENCIL)) { + int stencil_bits = 0; + if (ctx->DrawBuffer) { + if (ctx->DrawBuffer->_StencilBuffer) { + stencil_bits = ctx->DrawBuffer->_StencilBuffer->StencilBits; + } + } + + if (stencil_bits>0) { + nouveauClearBuffer(ctx, nmesa->depth_buffer, + ctx->Stencil.Clear, (1<pitch<<16)|buffer->pitch); - OUT_RING(buffer->offset); - OUT_RING(buffer->offset); - - /* Now clear a rectangle */ - dimensions = ((buffer->mesa.Height)<<16) | (buffer->mesa.Width); - - nouveauObjectOnSubchannel(nmesa, NvSubGdiRectText, NvGdiRectText); - - BEGIN_RING_SIZE(NvSubGdiRectText, NV04_GDI_RECTANGLE_TEXT_OPERATION, 1); - OUT_RING(3); /* SRCCOPY */ - - BEGIN_RING_SIZE(NvSubGdiRectText, NV04_GDI_RECTANGLE_TEXT_BLOCK_LEVEL1_TL, 5); - OUT_RING(0); /* top left */ - OUT_RING(dimensions); /* bottom right */ - OUT_RING(fill); - OUT_RING(0); /* top left */ - OUT_RING(dimensions); /* bottom right */ -} - -static void nv10Clear(GLcontext *ctx, GLbitfield mask) -{ - nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - - if (mask & (BUFFER_BIT_FRONT_LEFT|BUFFER_BIT_BACK_LEFT)) { - nv10ClearBuffer(ctx, nmesa->color_buffer, - nmesa->clear_color_value, 0xffffffff); - } - /* FIXME: check depth bits */ - if (mask & (BUFFER_BIT_DEPTH)) { - nv10ClearBuffer(ctx, nmesa->depth_buffer, - nmesa->clear_value, 0xffffff00); - } - /* FIXME: check about stencil? */ - if (mask & (BUFFER_BIT_STENCIL)) { - nv10ClearBuffer(ctx, nmesa->depth_buffer, - nmesa->clear_value, 0x000000ff); - } -} - static void nv10ClearColor(GLcontext *ctx, const GLfloat color[4]) { - nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - GLubyte c[4]; - UNCLAMPED_FLOAT_TO_RGBA_CHAN(c,color); - nmesa->clear_color_value = PACK_COLOR_8888(c[3],c[0],c[1],c[2]); + /* Not for NV10 */ } static void nv10ClearDepth(GLcontext *ctx, GLclampd d) { - nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - -/* switch (ctx->DrawBuffer->_DepthBuffer->DepthBits) { - case 16: - nmesa->clear_value = (uint32_t)(d*0x7FFF); - break; - case 24:*/ - nmesa->clear_value = ((nmesa->clear_value&0x000000FF) | - (((uint32_t)(d*0xFFFFFF))<<8)); -/* break; - }*/ + /* Not for NV10 */ } static void nv10ClearStencil(GLcontext *ctx, GLint s) { - nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - -/* if (ctx->DrawBuffer->_DepthBuffer->DepthBits == 24) {*/ - nmesa->clear_value = ((nmesa->clear_value&0xFFFFFF00)| - (s&0x000000FF)); -/* }*/ + /* Not for NV10 */ } static void nv10ClipPlane(GLcontext *ctx, GLenum plane, const GLfloat *equation) @@ -1037,10 +965,10 @@ void nv10InitStateFuncs(GLcontext *ctx, struct dd_function_table *func) func->BlendColor = nv10BlendColor; func->BlendEquationSeparate = nv10BlendEquationSeparate; func->BlendFuncSeparate = nv10BlendFuncSeparate; - func->Clear = nv10Clear; - func->ClearColor = nv10ClearColor; - func->ClearDepth = nv10ClearDepth; - func->ClearStencil = nv10ClearStencil; +/* func->Clear = nv10Clear;*/ /* Not for NV10 */ + func->ClearColor = nv10ClearColor; /* Not for NV10 */ + func->ClearDepth = nv10ClearDepth; /* Not for NV10 */ + func->ClearStencil = nv10ClearStencil; /* Not for NV10 */ func->ClipPlane = nv10ClipPlane; func->ColorMask = nv10ColorMask; func->ColorMaterial = nv10ColorMaterial; -- cgit v1.2.3 From 32699696e31234c8d4e4b08f255ba2134ec12db5 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Sun, 7 Oct 2007 22:49:56 +0200 Subject: r300: fragprog tex instruction now take writemask into acount. --- src/mesa/drivers/dri/r300/r300_fragprog.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c index cce8e685865..78ed44b09c7 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog.c @@ -951,6 +951,10 @@ static void emit_tex(struct r300_fragment_program *fp, if (REG_GET_TYPE(dest) == REG_TYPE_OUTPUT) { rdest = dest; dest = get_temp_reg_tex(fp); + } else if (fpi->DstReg.WriteMask != WRITEMASK_XYZW) { + /* in case write mask isn't XYZW */ + rdest = dest; + dest = get_temp_reg_tex(fp); } hwdest = t_hw_dst(fp, dest, GL_TRUE, @@ -1016,7 +1020,7 @@ static void emit_tex(struct r300_fragment_program *fp, /* Copy from temp to output if needed */ if (REG_GET_VALID(rdest)) { - emit_arith(fp, PFS_OP_MAD, rdest, WRITEMASK_XYZW, dest, + emit_arith(fp, PFS_OP_MAD, rdest, fpi->DstReg.WriteMask, dest, pfs_one, pfs_zero, 0); free_temp(fp, dest); } -- cgit v1.2.3 From ac985708f4820173bdc4509d032bdabeb93a0590 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Mon, 8 Oct 2007 15:34:03 +0800 Subject: Only vertex program fix, bypass tnl vertex program --- src/mesa/drivers/dri/i965/brw_context.c | 2 +- src/mesa/main/texenvprogram.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 2031d556c1b..9266e73570a 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -79,7 +79,7 @@ static void brwUseProgram(GLcontext *ctx, GLuint program) brw->attribs.FragmentProgram->Current = sh_prog->FragmentProgram; ctx->FragmentProgram.Enabled = GL_TRUE; } else - ctx->VertexProgram.Enabled = GL_FALSE; + ctx->FragmentProgram.Enabled = GL_FALSE; } } diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 72b54b27d9a..126a9e1179d 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1239,7 +1239,7 @@ _mesa_UpdateTexEnvProgram( GLcontext *ctx ) /* If a conventional fragment program/shader isn't in effect... */ if (!ctx->FragmentProgram._Enabled && - !ctx->Shader.CurrentProgram) { + (!ctx->Shader.CurrentProgram || !ctx->Shader.CurrentProgram->FragmentProgram)) { make_state_key(ctx, &key); hash = hash_key(&key); -- cgit v1.2.3 From 4599683b480d295e407725e0fe99c357a0086092 Mon Sep 17 00:00:00 2001 From: Sergio Monteiro Basto Date: Mon, 8 Oct 2007 11:09:38 -0700 Subject: i915: Fix undefined ALIGN symbol from 77e0523fb7769df4bf43747e136b1653b2421b97. --- src/mesa/drivers/dri/intel/intel_tex_layout.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c b/src/mesa/drivers/dri/intel/intel_tex_layout.c index e3c6e1c17cf..4da636021ba 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.c +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c @@ -32,6 +32,7 @@ #include "intel_mipmap_tree.h" #include "intel_tex_layout.h" +#include "intel_context.h" #include "macros.h" GLuint intel_compressed_alignment(GLenum internalFormat) -- cgit v1.2.3 From 7e83c15fa01c04c12b7aab9dd2e7ab0ae193b1c3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 9 Oct 2007 12:18:50 +1000 Subject: i915: fixup up bufmgr to pass num buffers to kernel remove unneeded entry points --- src/mesa/drivers/dri/Makefile.template | 1 - src/mesa/drivers/dri/common/dri_bufmgr.c | 16 +------- src/mesa/drivers/dri/common/dri_bufmgr.h | 31 +------------- src/mesa/drivers/dri/common/dri_bufmgr_fake.c | 19 ++++----- src/mesa/drivers/dri/i915/intel_batchbuffer.c | 5 ++- src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c | 58 +++------------------------ src/mesa/drivers/dri/i915/intel_ioctl.c | 3 +- src/mesa/drivers/dri/i915/intel_ioctl.h | 2 +- 8 files changed, 26 insertions(+), 109 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index 3abce004c92..6ed6fc15b54 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -13,7 +13,6 @@ COMMON_SOURCES = \ COMMON_BM_SOURCES = \ ../common/dri_bufmgr.c \ - ../common/dri_bufmgr_ttm.c \ ../common/dri_bufmgr_fake.c diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.c b/src/mesa/drivers/dri/common/dri_bufmgr.c index 91caa8757d2..83886480dd3 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr.c @@ -88,18 +88,6 @@ dri_bo_unmap(dri_bo *buf) return buf->bufmgr->bo_unmap(buf); } -int -dri_bo_validate(dri_bo *buf, unsigned int flags) -{ - return buf->bufmgr->bo_validate(buf, flags); -} - -dri_fence * -dri_fence_validated(dri_bufmgr *bufmgr, const char *name, GLboolean flushed) -{ - return bufmgr->fence_validated(bufmgr, name, flushed); -} - void dri_fence_wait(dri_fence *fence) { @@ -157,9 +145,9 @@ void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset batch_buf->bufmgr->emit_reloc(batch_buf, flags, delta, offset, relocatee); } -void *dri_process_relocs(dri_bo *batch_buf) +void *dri_process_relocs(dri_bo *batch_buf, GLuint *count) { - return batch_buf->bufmgr->process_relocs(batch_buf); + return batch_buf->bufmgr->process_relocs(batch_buf, count); } void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence) diff --git a/src/mesa/drivers/dri/common/dri_bufmgr.h b/src/mesa/drivers/dri/common/dri_bufmgr.h index 46e41f9bec1..7dbb558949a 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr.h +++ b/src/mesa/drivers/dri/common/dri_bufmgr.h @@ -116,30 +116,6 @@ struct _dri_bufmgr { /** Reduces the refcount on the userspace mapping of the buffer object. */ int (*bo_unmap)(dri_bo *buf); - /** - * Makes the buffer accessible to the graphics chip. - * - * The resulting offset of the buffer within the graphics aperture is then - * available at buf->offset until the buffer is fenced. - * - * Flags should consist of the memory types that the buffer may be validated - * into and the read/write/exe flags appropriate to the use of the buffer. - */ - int (*bo_validate)(dri_bo *buf, unsigned int flags); - - /** - * Associates the current set of validated buffers with a fence. - * - * Once fenced, the buffer manager will allow the validated buffers to be - * evicted when the graphics device's execution has passed the fence - * command. - * - * The fence object will have flags for the sum of the read/write/exe flags - * of the validated buffers associated with it. - */ - dri_fence * (*fence_validated)(dri_bufmgr *bufmgr, const char *name, - GLboolean flushed); - /** Takes a reference on a fence object */ void (*fence_reference)(dri_fence *fence); @@ -164,7 +140,7 @@ struct _dri_bufmgr { */ void (*emit_reloc)(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); - void *(*process_relocs)(dri_bo *batch_buf); + void *(*process_relocs)(dri_bo *batch_buf, GLuint *count); void (*post_submit)(dri_bo *batch_buf, dri_fence **fence); }; @@ -178,9 +154,6 @@ void dri_bo_reference(dri_bo *bo); void dri_bo_unreference(dri_bo *bo); int dri_bo_map(dri_bo *buf, GLboolean write_enable); int dri_bo_unmap(dri_bo *buf); -int dri_bo_validate(dri_bo *buf, unsigned int flags); -dri_fence *dri_fence_validated(dri_bufmgr *bufmgr, const char *name, - GLboolean flushed); void dri_fence_wait(dri_fence *fence); void dri_fence_reference(dri_fence *fence); void dri_fence_unreference(dri_fence *fence); @@ -205,7 +178,7 @@ dri_bo *dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, unsigned int handle); void dri_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, dri_bo *relocatee); -void *dri_process_relocs(dri_bo *batch_buf); +void *dri_process_relocs(dri_bo *batch_buf, uint32_t *count); void dri_post_process_relocs(dri_bo *batch_buf); void dri_post_submit(dri_bo *batch_buf, dri_fence **last_fence); #endif diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c index adf0cf5ab72..bda45d921c9 100644 --- a/src/mesa/drivers/dri/common/dri_bufmgr_fake.c +++ b/src/mesa/drivers/dri/common/dri_bufmgr_fake.c @@ -881,11 +881,12 @@ relocation_sort(const void *a_in, const void *b_in) { } static void * -dri_fake_process_reloc(dri_bo *batch_buf) +dri_fake_process_relocs(dri_bo *batch_buf, GLuint *count_p) { dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)batch_buf->bufmgr; GLuint i; GLuint *ptr; + GLuint count = 0; assert(batch_buf->virtual != NULL); ptr = batch_buf->virtual; @@ -926,23 +927,25 @@ dri_fake_process_reloc(dri_bo *batch_buf) /* Validate. If we fail, fence to clear the unfenced list and bail * out. */ - ret = dri_bo_validate(r->buf, validate_flags); + ret = dri_fake_bo_validate(r->buf, validate_flags); if (ret != 0) { dri_fence *fo; dri_bo_unmap(batch_buf); - fo = dri_fence_validated(batch_buf->bufmgr, - "batchbuffer failure fence", GL_TRUE); + fo = dri_fake_fence_validated(batch_buf->bufmgr, + "batchbuffer failure fence", GL_TRUE); dri_fence_unreference(fo); goto done; } + count++; } ptr[r->offset / 4] = r->buf->offset + r->delta; dri_bo_unreference(r->buf); } dri_bo_unmap(batch_buf); - dri_bo_validate(batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE); + dri_fake_bo_validate(batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE); + *count_p = count; bufmgr_fake->nr_relocs = 0; done: return NULL; @@ -954,7 +957,7 @@ dri_fake_post_submit(dri_bo *batch_buf, dri_fence **last_fence) dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)batch_buf->bufmgr; dri_fence *fo; - fo = dri_fence_validated(batch_buf->bufmgr, "Batch fence", GL_TRUE); + fo = dri_fake_fence_validated(batch_buf->bufmgr, "Batch fence", GL_TRUE); if (bufmgr_fake->performed_rendering) { dri_fence_unreference(*last_fence); @@ -994,14 +997,12 @@ dri_bufmgr_fake_init(unsigned long low_offset, void *low_virtual, bufmgr_fake->bufmgr.bo_unreference = dri_fake_bo_unreference; bufmgr_fake->bufmgr.bo_map = dri_fake_bo_map; bufmgr_fake->bufmgr.bo_unmap = dri_fake_bo_unmap; - bufmgr_fake->bufmgr.bo_validate = dri_fake_bo_validate; - bufmgr_fake->bufmgr.fence_validated = dri_fake_fence_validated; bufmgr_fake->bufmgr.fence_wait = dri_fake_fence_wait; bufmgr_fake->bufmgr.fence_reference = dri_fake_fence_reference; bufmgr_fake->bufmgr.fence_unreference = dri_fake_fence_unreference; bufmgr_fake->bufmgr.destroy = dri_fake_destroy; bufmgr_fake->bufmgr.emit_reloc = dri_fake_emit_reloc; - bufmgr_fake->bufmgr.process_relocs = dri_fake_process_reloc; + bufmgr_fake->bufmgr.process_relocs = dri_fake_process_relocs; bufmgr_fake->bufmgr.post_submit = dri_fake_post_submit; bufmgr_fake->fence_emit = fence_emit; bufmgr_fake->fence_wait = fence_wait; diff --git a/src/mesa/drivers/dri/i915/intel_batchbuffer.c b/src/mesa/drivers/dri/i915/intel_batchbuffer.c index 34c6d6f764b..0422029353d 100644 --- a/src/mesa/drivers/dri/i915/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i915/intel_batchbuffer.c @@ -127,8 +127,9 @@ do_flush_locked(struct intel_batchbuffer *batch, { struct intel_context *intel = batch->intel; void *start; + GLuint count; - start = dri_process_relocs(batch->buf); + start = dri_process_relocs(batch->buf, &count); batch->map = NULL; batch->ptr = NULL; @@ -143,7 +144,7 @@ do_flush_locked(struct intel_batchbuffer *batch, if (intel->intelScreen->ttm == GL_TRUE) { intel_exec_ioctl(batch->intel, used, ignore_cliprects, allow_unlock, - start, &batch->last_fence); + start, count, &batch->last_fence); } else { intel_batch_ioctl(batch->intel, batch->buf->offset, diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c index e85bc7e2f80..ae6de496281 100644 --- a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c @@ -162,7 +162,7 @@ static int intel_create_bo_list(int numTarget, struct intel_bo_list *list, void static struct drm_i915_op_arg * -intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_list *reloc_list) +intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_list *reloc_list, GLuint *count_p) { struct intel_bo_node *node; struct intel_bo_reloc_node *rl_node; @@ -170,6 +170,7 @@ intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_li struct drm_i915_op_arg *arg, *first; struct drm_bo_op_req *req; uint64_t *prevNext = NULL; + GLuint count = 0; first = NULL; @@ -202,11 +203,13 @@ intel_setup_validate_list(int fd, struct intel_bo_list *list, struct intel_bo_li arg->reloc_handle = rl_node->type_list.buf.handle; } } + count++; } if (!first) return 0; + *count_p = count; return first; } @@ -385,8 +388,6 @@ static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, st cur_type->relocs[0] = (reloc_info->type << 16); cur_type->relocs[1] = 0; - // cur->relocs[cur->nr_reloc_lists-1][1] = 0;// TODO ADD HANDLE HERE - cur->nr_reloc_types++; } } @@ -615,45 +616,6 @@ dri_ttm_bo_unmap(dri_bo *buf) return drmBOUnmap(bufmgr_ttm->fd, &ttm_buf->drm_bo); } -static int -dri_ttm_validate(dri_bo *buf, unsigned int flags) -{ - dri_bufmgr_ttm *bufmgr_ttm; - dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; - unsigned int mask; - int err; - - /* XXX: Sanity-check whether we've already validated this one under - * different flags. See drmAddValidateItem(). - */ - - bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; - - /* Calculate the appropriate mask to pass to the DRM. There appears to be - * be a direct relationship to flags, so it's unnecessary to have it passed - * in as an argument. - */ - mask = DRM_BO_MASK_MEM; - mask |= flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE); - - err = drmBOValidate(bufmgr_ttm->fd, &ttm_buf->drm_bo, 0, flags, mask, 0); - - if (err == 0) { - /* XXX: add to fence list for sanity checking */ - } else { - fprintf(stderr, "failed to validate buffer (%s): %s\n", - ttm_buf->name, strerror(-err)); - } - - buf->offset = ttm_buf->drm_bo.offset; - -#if BUFMGR_DEBUG - fprintf(stderr, "bo_validate: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); -#endif - - return err; -} - /* Returns a dri_bo wrapping the given buffer object handle. * * This can be used when one application needs to pass a buffer object @@ -691,12 +653,6 @@ intel_ttm_fence_create_from_arg(dri_bufmgr *bufmgr, const char *name, return &ttm_fence->fence; } -static dri_fence * -dri_ttm_fence_validated(dri_bufmgr *bufmgr, const char *name, - GLboolean flushed) -{ - return NULL; -} static void dri_ttm_fence_reference(dri_fence *fence) @@ -826,7 +782,7 @@ dri_ttm_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, static void * -dri_ttm_process_reloc(dri_bo *batch_buf) +dri_ttm_process_reloc(dri_bo *batch_buf, GLuint *count) { dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; void *ptr; @@ -837,7 +793,7 @@ dri_ttm_process_reloc(dri_bo *batch_buf) intel_add_validate_buffer(&bufmgr_ttm->list, batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE, DRM_BO_MASK_MEM | DRM_BO_FLAG_EXE, &itemLoc, NULL); - ptr = intel_setup_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list, &bufmgr_ttm->reloc_list); + ptr = intel_setup_validate_list(bufmgr_ttm->fd, &bufmgr_ttm->list, &bufmgr_ttm->reloc_list, count); return ptr; } @@ -883,8 +839,6 @@ intel_bufmgr_ttm_init(int fd, unsigned int fence_type, bufmgr_ttm->bufmgr.bo_unreference = dri_ttm_bo_unreference; bufmgr_ttm->bufmgr.bo_map = dri_ttm_bo_map; bufmgr_ttm->bufmgr.bo_unmap = dri_ttm_bo_unmap; - bufmgr_ttm->bufmgr.bo_validate = dri_ttm_validate; - bufmgr_ttm->bufmgr.fence_validated = dri_ttm_fence_validated; bufmgr_ttm->bufmgr.fence_reference = dri_ttm_fence_reference; bufmgr_ttm->bufmgr.fence_unreference = dri_ttm_fence_unreference; bufmgr_ttm->bufmgr.fence_wait = dri_ttm_fence_wait; diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.c b/src/mesa/drivers/dri/i915/intel_ioctl.c index 873e8b97883..94f7e73ecfb 100644 --- a/src/mesa/drivers/dri/i915/intel_ioctl.c +++ b/src/mesa/drivers/dri/i915/intel_ioctl.c @@ -137,7 +137,7 @@ void intel_exec_ioctl(struct intel_context *intel, GLuint used, GLboolean ignore_cliprects, GLboolean allow_unlock, - void *start, dri_fence **fence) + void *start, GLuint count, dri_fence **fence) { struct drm_i915_execbuffer execbuf; dri_fence *fo; @@ -151,6 +151,7 @@ intel_exec_ioctl(struct intel_context *intel, memset(&execbuf, 0, sizeof(execbuf)); + execbuf.num_buffers = count; execbuf.batch.used = used; execbuf.batch.cliprects = intel->pClipRects; execbuf.batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects; diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.h b/src/mesa/drivers/dri/i915/intel_ioctl.h index 689f21cae89..953fee92406 100644 --- a/src/mesa/drivers/dri/i915/intel_ioctl.h +++ b/src/mesa/drivers/dri/i915/intel_ioctl.h @@ -40,5 +40,5 @@ void intel_batch_ioctl(struct intel_context *intel, void intel_exec_ioctl(struct intel_context *intel, GLuint used, GLboolean ignore_cliprects, GLboolean allow_unlock, - void *start, dri_fence **fence); + void *start, GLuint count, dri_fence **fence); #endif -- cgit v1.2.3 From 8909f1131ab4d9d117d79aee617eceabf3ea60c8 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 9 Oct 2007 14:36:04 +1000 Subject: i915: workout max relocs from batch buffer size --- src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c | 32 +++++++++++++++------------- src/mesa/drivers/dri/i915/intel_bufmgr_ttm.h | 2 +- src/mesa/drivers/dri/i915/intel_screen.c | 7 +++--- 3 files changed, 22 insertions(+), 19 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c index ae6de496281..be77b509590 100644 --- a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c @@ -50,7 +50,6 @@ #define BUFMGR_DEBUG 0 -#define MAX_RELOCS_PER_LIST 511 struct intel_reloc_info { GLuint type; @@ -100,6 +99,7 @@ typedef struct _dri_bufmgr_ttm { unsigned int fence_type; unsigned int fence_type_flush; + uint32_t max_relocs; /** ttm relocation list */ struct intel_bo_list list; struct intel_bo_list reloc_list; @@ -299,16 +299,15 @@ static int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, un return ret; } -#define RELOC0_STRIDE 4 -#define RELOC0_HEADER 4 -#define RELOC_BUF_SIZE ((RELOC0_HEADER + MAX_RELOCS_PER_LIST * RELOC0_STRIDE) * sizeof(uint32_t)) -static int intel_create_new_reloc_type_list(int fd, struct intel_bo_reloc_list *cur_type) +#define RELOC_BUF_SIZE(x) ((I915_RELOC0_HEADER + x * I915_RELOC0_STRIDE) * sizeof(uint32_t)) + +static int intel_create_new_reloc_type_list(int fd, struct intel_bo_reloc_list *cur_type, int max_relocs) { int ret; /* should allocate a drmBO here */ - ret = drmBOCreate(fd, 0, RELOC_BUF_SIZE, 0, + ret = drmBOCreate(fd, 0, RELOC_BUF_SIZE(max_relocs), 0, NULL, drm_bo_type_dc, DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE | DRM_BO_FLAG_CACHED, 0, &cur_type->buf); @@ -322,7 +321,7 @@ static int intel_create_new_reloc_type_list(int fd, struct intel_bo_reloc_list * } -static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, struct intel_reloc_info *reloc_info) +static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, struct intel_reloc_info *reloc_info, uint32_t max_relocs) { struct intel_bo_reloc_node *rl_node, *cur; drmMMListHead *rl, *l; @@ -352,7 +351,7 @@ static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, st cur_type = &cur->type_list; DRMINITLISTHEAD(&cur->type_list.head); - ret = intel_create_new_reloc_type_list(fd, cur_type); + ret = intel_create_new_reloc_type_list(fd, cur_type, max_relocs); if (ret) { return -1; } @@ -382,7 +381,7 @@ static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, st return -ENOMEM; } - ret = intel_create_new_reloc_type_list(fd, cur_type); + ret = intel_create_new_reloc_type_list(fd, cur_type, max_relocs); DRMLISTADDTAIL(&cur_type->head, &cur->type_list.head); cur_type->relocs[0] = (reloc_info->type << 16); @@ -396,11 +395,11 @@ static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, st num_relocs = (reloc_start[0] & 0xffff); - reloc_start[num_relocs*RELOC0_STRIDE + RELOC0_HEADER] = reloc_info->reloc; - reloc_start[num_relocs*RELOC0_STRIDE + RELOC0_HEADER+1] = reloc_info->delta; - reloc_start[num_relocs*RELOC0_STRIDE + RELOC0_HEADER+2] = reloc_info->index; + reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC0_HEADER] = reloc_info->reloc; + reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC0_HEADER+1] = reloc_info->delta; + reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC0_HEADER+2] = reloc_info->index; reloc_start[0]++; - if (((reloc_start[0] & 0xffff)) > (MAX_RELOCS_PER_LIST)) { + if (((reloc_start[0] & 0xffff)) > (max_relocs)) { return -ENOMEM; } return 0; @@ -776,7 +775,7 @@ dri_ttm_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, reloc.index = newItem; reloc.handle = ttm_buf->drm_bo.handle; - intel_add_validate_reloc(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list, &reloc); + intel_add_validate_reloc(bufmgr_ttm->fd, &bufmgr_ttm->reloc_list, &reloc, bufmgr_ttm->max_relocs); return; } @@ -820,7 +819,7 @@ dri_ttm_post_submit(dri_bo *batch_buf, dri_fence **last_fence) */ dri_bufmgr * intel_bufmgr_ttm_init(int fd, unsigned int fence_type, - unsigned int fence_type_flush) + unsigned int fence_type_flush, int batch_size) { dri_bufmgr_ttm *bufmgr_ttm; @@ -830,6 +829,9 @@ intel_bufmgr_ttm_init(int fd, unsigned int fence_type, bufmgr_ttm->fence_type_flush = fence_type_flush; _glthread_INIT_MUTEX(bufmgr_ttm->mutex); + /* lets go with one relocation per every four dwords - purely heuristic */ + bufmgr_ttm->max_relocs = batch_size / sizeof(uint32_t) / 4; + intel_create_bo_list(10, &bufmgr_ttm->list, NULL); intel_create_bo_list(1, &bufmgr_ttm->reloc_list, NULL); diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.h b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.h index 642fe358f6a..0738839cefb 100644 --- a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.h +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.h @@ -12,6 +12,6 @@ dri_fence *intel_ttm_fence_create_from_arg(dri_bufmgr *bufmgr, const char *name, dri_bufmgr *intel_bufmgr_ttm_init(int fd, unsigned int fence_type, - unsigned int fence_type_flush); + unsigned int fence_type_flush, int batch_size); #endif diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 084de1004b7..cd4052616fe 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -541,9 +541,10 @@ intelInitDriver(__DRIscreenPrivate * sPriv) intelScreen->driScrnPriv->ddxMinor >= 9 && intelScreen->front.bo_handle != -1) { intelScreen->bufmgr = intel_bufmgr_ttm_init(sPriv->fd, - DRM_FENCE_TYPE_EXE, - DRM_FENCE_TYPE_EXE | - DRM_I915_FENCE_TYPE_RW); + DRM_FENCE_TYPE_EXE, + DRM_FENCE_TYPE_EXE | + DRM_I915_FENCE_TYPE_RW, + BATCH_SZ); if (intelScreen->bufmgr != NULL) intelScreen->ttm = GL_TRUE; } -- cgit v1.2.3 From 82d4aa40551fe86a04346c3eea944f8ce7ae8d28 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 9 Oct 2007 14:14:59 +0800 Subject: shadow sampler fix. 1. spec requite result (0, 0, 0, 1) instead of (0, 0, 0, 0) 2. support shadow sampler in simd8 --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 2 ++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 5660b555162..1f7158f7a78 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -702,6 +702,8 @@ static void emit_tex( struct brw_wm_compile *c, msgLength, 0); + if (shadow) + brw_MOV(p, dst[3], brw_imm_f(1.0)); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 58cdf72e372..8133c384f38 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1027,8 +1027,10 @@ static void emit_tex(struct brw_wm_compile *c, GLuint msg_len; GLuint i, nr; GLuint emit; + GLboolean shadow = (c->key.shadowtex_mask & (1<TexSrcUnit)) ? 1 : 0; payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); + for (i = 0; i < 4; i++) dst[i] = get_dst_reg(c, inst, i, 1); for (i = 0; i < 4; i++) @@ -1061,6 +1063,11 @@ static void emit_tex(struct brw_wm_compile *c, msg_len += 1; } + if (shadow) { + brw_MOV(p, brw_message_reg(5), brw_imm_f(0)); + brw_MOV(p, brw_message_reg(6), src[2]); + } + brw_SAMPLE(p, retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), 1, @@ -1070,8 +1077,11 @@ static void emit_tex(struct brw_wm_compile *c, inst->DstReg.WriteMask, BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE, 4, - 4, + shadow ? 6 : 4, 0); + + if (shadow) + brw_MOV(p, dst[3], brw_imm_f(1.0)); } static void post_wm_emit( struct brw_wm_compile *c ) -- cgit v1.2.3 From e2dff35f9589dd5616933654a2136584cb30ed18 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 9 Oct 2007 14:26:01 +0800 Subject: INT support --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 8133c384f38..8ed92840967 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -172,7 +172,7 @@ static void emit_abs( struct brw_wm_compile *c, brw_set_saturate(p, 0); } -static void emit_mov_int( struct brw_wm_compile *c, +static void emit_int( struct brw_wm_compile *c, struct prog_instruction *inst) { int i; @@ -184,7 +184,7 @@ static void emit_mov_int( struct brw_wm_compile *c, struct brw_reg src, dst; dst = retype(get_dst_reg(c, inst, i, 1), BRW_REGISTER_TYPE_D); src = retype(get_src_reg(c, &inst->SrcReg[0], i, 1), BRW_REGISTER_TYPE_D); - brw_MOV(p, dst, src); + brw_RNDD(p, dst, src); } } brw_set_saturate(p, 0); @@ -1181,7 +1181,7 @@ static void brw_wm_emit_glsl(struct brw_wm_compile *c) emit_lrp(c, inst); break; case OPCODE_INT: - emit_mov_int(c, inst); + emit_int(c, inst); break; case OPCODE_MOV: emit_mov(c, inst); -- cgit v1.2.3 From ae5aa1f90651a2a6168f687c95a069e78a0231bb Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 9 Oct 2007 14:35:28 +0800 Subject: fix for prev commit --- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 8ed92840967..4b273fefe92 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -182,8 +182,8 @@ static void emit_int( struct brw_wm_compile *c, for (i = 0; i < 4; i++) { if (mask & (1<SrcReg[0], i, 1), BRW_REGISTER_TYPE_D); + dst = get_dst_reg(c, inst, i, 1) ; + src = get_src_reg(c, &inst->SrcReg[0], i, 1); brw_RNDD(p, dst, src); } } -- cgit v1.2.3 From de803f538c16096c9e241cfdddc092ac2aa2504e Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Tue, 9 Oct 2007 15:05:10 +0800 Subject: Non Square Matrix --- src/mesa/drivers/dri/i965/intel_context.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index ac8aa5bd52c..a5d8be83865 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -82,6 +82,7 @@ int INTEL_DEBUG = (0); #define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_secondary_color #define need_GL_VERSION_2_0 +#define need_GL_VERSION_2_1 #define need_GL_ARB_shader_objects #define need_GL_ARB_vertex_shader @@ -188,6 +189,7 @@ const struct dri_extension card_extensions[] = { "GL_NV_blend_square", NULL }, { "GL_SGIS_generate_mipmap", NULL }, { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions}, + { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions}, { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions}, { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions}, { "GL_ARB_fragment_shader", NULL }, -- cgit v1.2.3 From de3073d377ee3a0c58fec4b1611cbf893a543c5b Mon Sep 17 00:00:00 2001 From: Mrc Gran Date: Wed, 10 Oct 2007 09:15:42 -0600 Subject: fix force_s3tc_enable option --- src/mesa/drivers/dri/i965/intel_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index 2cf311c7135..7ec316aa8ae 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -498,7 +498,7 @@ GLboolean intelInitContext( struct intel_context *intel, _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); _mesa_enable_extension( ctx, "GL_S3_s3tc" ); } - else if (driQueryOptionb (&intelScreen->optionCache, "force_s3tc_enable")) { + else if (driQueryOptionb (&intel->optionCache, "force_s3tc_enable")) { _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); } -- cgit v1.2.3 From aceccda56b08338e217991e54607f1c9f18fc3e6 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 10 May 2007 15:52:22 -0400 Subject: Drop __DRInativeDisplay and pass in __DRIscreen pointers instead. Many DRI entry points took a __DRInativeDisplay pointer and a screen index as arguments. The only use for the native display pointer was to pass it back to the loader when looking up the __DRIscreen for the given screen index. Instead, let's just pass in the __DRIscreen pointer directly, which let's drop the __DRInativeDisplay type and the getScreen function. The assumption is now that the loader will be able to retrieve context from the __DRIscreen pointer when necessary. --- include/GL/internal/dri_interface.h | 75 ++++++------ src/glx/x11/XF86dri.c | 9 +- src/glx/x11/glxclient.h | 28 ++++- src/glx/x11/glxcmds.c | 60 +++++----- src/glx/x11/glxext.c | 155 +++++++++++++++---------- src/glx/x11/xf86dri.h | 6 +- src/mesa/drivers/dri/common/dri_util.c | 139 +++++++--------------- src/mesa/drivers/dri/common/dri_util.h | 24 +--- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 22 ++-- src/mesa/drivers/dri/i810/i810screen.c | 23 ++-- src/mesa/drivers/dri/i915/intel_screen.c | 33 +++--- src/mesa/drivers/dri/i965/intel_screen.c | 22 ++-- src/mesa/drivers/dri/mach64/mach64_screen.c | 22 ++-- src/mesa/drivers/dri/mga/mga_xmesa.c | 22 ++-- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 22 ++-- src/mesa/drivers/dri/r128/r128_screen.c | 22 ++-- src/mesa/drivers/dri/r200/r200_ioctl.c | 6 +- src/mesa/drivers/dri/r200/r200_ioctl.h | 6 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 25 ++-- src/mesa/drivers/dri/savage/savage_xmesa.c | 22 ++-- src/mesa/drivers/dri/sis/sis_screen.c | 23 ++-- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 22 ++-- src/mesa/drivers/dri/trident/trident_context.c | 24 ++-- src/mesa/drivers/dri/unichrome/via_context.c | 3 - src/mesa/drivers/dri/unichrome/via_context.h | 1 - src/mesa/drivers/dri/unichrome/via_screen.c | 23 ++-- 26 files changed, 405 insertions(+), 434 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 97edec0ca9d..8a6984de68a 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -57,7 +57,6 @@ typedef struct __DRIframebufferRec __DRIframebuffer; typedef struct __DRIversionRec __DRIversion; typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods; typedef unsigned long __DRIid; -typedef void __DRInativeDisplay; /*@}*/ @@ -73,7 +72,7 @@ typedef void __DRInativeDisplay; * * \sa glXGetScreenDriver, glXGetProcAddress, glXGetDriverConfig */ -typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (__DRInativeDisplay *dpy, int scrNum); +typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (__DRIscreen *screen); /** * Type of a pointer to \c glXGetDriverConfig, as returned by @@ -115,8 +114,8 @@ typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name ); #define __DRI_INTERFACE_VERSION 20070105 -typedef void *(CREATENEWSCREENFUNC)(__DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, const __GLcontextModes * modes, +typedef void *(CREATENEWSCREENFUNC)(int scr, __DRIscreen *psc, + const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, void * pSAREA, int fd, int internal_api_version, @@ -174,11 +173,6 @@ struct __DRIinterfaceMethodsRec { */ void (*destroyContextModes)( __GLcontextModes * modes ); - /** - * Get the \c __DRIscreen for a given display and screen number. - */ - __DRIscreen *(*getScreen)(__DRInativeDisplay *dpy, int screenNum); - /** * \name Client/server protocol functions. @@ -192,33 +186,31 @@ struct __DRIinterfaceMethodsRec { /** * Create the server-side portion of the GL context. */ - GLboolean (* createContext)( __DRInativeDisplay *dpy, int screenNum, + GLboolean (* createContext)( __DRIscreen *screen, int configID, void * contextID, drm_context_t * hw_context ); /** * Destroy the server-side portion of the GL context. */ - GLboolean (* destroyContext)( __DRInativeDisplay *dpy, int screenNum, - __DRIid context ); + GLboolean (* destroyContext)( __DRIscreen *screen, __DRIid context ); /** * Create the server-side portion of the drawable. */ - GLboolean (*createDrawable)( __DRInativeDisplay * ndpy, int screen, + GLboolean (*createDrawable)( __DRIscreen *screen, __DRIid drawable, drm_drawable_t * hHWDrawable ); /** * Destroy the server-side portion of the drawable. */ - GLboolean (*destroyDrawable)( __DRInativeDisplay * ndpy, int screen, - __DRIid drawable ); + GLboolean (*destroyDrawable)( __DRIscreen *screen, __DRIid drawable ); /** * This function is used to get information about the position, size, and * clip rects of a drawable. */ - GLboolean (* getDrawableInfo) ( __DRInativeDisplay *dpy, int scrn, - __DRIid draw, unsigned int * index, unsigned int * stamp, + GLboolean (* getDrawableInfo) ( __DRIscreen *screen, __DRIid drawable, + unsigned int * index, unsigned int * stamp, int * x, int * y, int * width, int * height, int * numClipRects, drm_clip_rect_t ** pClipRects, int * backX, int * backY, @@ -242,8 +234,8 @@ struct __DRIinterfaceMethodsRec { * the rate of the "media stream counter". In practical terms, this is * the frame refresh rate of the display. */ - GLboolean (*getMSCRate)(__DRInativeDisplay * dpy, __DRIid drawable, - int32_t * numerator, int32_t * denominator); + GLboolean (*getMSCRate)(__DRIdrawable *draw, + int32_t * numerator, int32_t * denominator); /*@}*/ /** @@ -260,11 +252,10 @@ struct __DRIinterfaceMethodsRec { * drawable was actually done directly to the front buffer (instead * of backing storage, for example) */ - void (*reportDamage)(__DRInativeDisplay * dpy, int screen, - __DRIid drawable, + void (*reportDamage)(__DRIdrawable *draw, int x, int y, drm_clip_rect_t *rects, int num_rects, - int front_buffer); + GLboolean front_buffer); }; @@ -304,13 +295,14 @@ struct __DRIscreenRec { /** * Method to destroy the private DRI screen data. */ - void (*destroyScreen)(__DRInativeDisplay *dpy, int scrn, void *screenPrivate); + void (*destroyScreen)(void *screenPrivate); /** * Method to create the private DRI drawable data and initialize the * drawable dependent methods. */ - void *(*createNewDrawable)(__DRInativeDisplay *dpy, const __GLcontextModes *modes, + void *(*createNewDrawable)(__DRIscreen *screen, + const __GLcontextModes *modes, __DRIid draw, __DRIdrawable *pdraw, int renderType, const int *attrs); @@ -345,13 +337,13 @@ struct __DRIscreenRec { * \since Internal API version 20030815. */ /*@{*/ - void *(*allocateMemory)(__DRInativeDisplay *dpy, int scrn, GLsizei size, + void *(*allocateMemory)(__DRIscreen *screen, GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); - void (*freeMemory)(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer); + void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer); - GLuint (*memoryOffset)(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer); + GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer); /*@}*/ /** @@ -360,7 +352,8 @@ struct __DRIscreenRec { * * \since Internal API version 20031201. */ - void * (*createNewContext)(__DRInativeDisplay *dpy, const __GLcontextModes *modes, + void * (*createNewContext)(__DRIscreen *screen, + const __GLcontextModes *modes, int render_type, void *sharedPrivate, __DRIcontext *pctx); @@ -385,7 +378,7 @@ struct __DRIcontextRec { /** * Method to destroy the private DRI context data. */ - void (*destroyContext)(__DRInativeDisplay *dpy, int scrn, void *contextPrivate); + void (*destroyContext)(void *contextPrivate); /** * Opaque pointer to private per context direct rendering data. @@ -399,8 +392,7 @@ struct __DRIcontextRec { * * \since Internal API version 20050727. */ - GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn, - __DRIdrawable *pdraw, + GLboolean (*bindContext)(__DRIdrawable *pdraw, __DRIdrawable *pread, __DRIcontext *ctx); @@ -409,8 +401,7 @@ struct __DRIcontextRec { * * \since Internal API version 20050727. */ - GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn, - __DRIcontext *ctx); + GLboolean (*unbindContext)(__DRIcontext *ctx); }; /** @@ -423,12 +414,12 @@ struct __DRIdrawableRec { /** * Method to destroy the private DRI drawable data. */ - void (*destroyDrawable)(__DRInativeDisplay *dpy, void *drawablePrivate); + void (*destroyDrawable)(void *drawablePrivate); /** * Method to swap the front and back buffers. */ - void (*swapBuffers)(__DRInativeDisplay *dpy, void *drawablePrivate); + void (*swapBuffers)(void *drawablePrivate); /** * Opaque pointer to private per drawable direct rendering data. @@ -442,14 +433,14 @@ struct __DRIdrawableRec { * * \since Internal API version 20030317. */ - int (*getSBC)(__DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc ); + int (*getSBC)(void *drawablePrivate, int64_t *sbc ); /** * Wait for the SBC to be greater than or equal target_sbc. * * \since Internal API version 20030317. */ - int (*waitForSBC)( __DRInativeDisplay * dpy, void *drawablePriv, + int (*waitForSBC)( void *drawablePriv, int64_t target_sbc, int64_t * msc, int64_t * sbc ); @@ -461,7 +452,7 @@ struct __DRIdrawableRec { * * \since Internal API version 20030317. */ - int (*waitForMSC)( __DRInativeDisplay * dpy, void *drawablePriv, + int (*waitForMSC)( void *drawablePriv, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc, int64_t * sbc ); @@ -474,7 +465,7 @@ struct __DRIdrawableRec { * * \since Internal API version 20030317. */ - int64_t (*swapBuffersMSC)(__DRInativeDisplay *dpy, void *drawablePrivate, + int64_t (*swapBuffersMSC)(void *drawablePrivate, int64_t target_msc, int64_t divisor, int64_t remainder); @@ -483,14 +474,14 @@ struct __DRIdrawableRec { * * \since Internal API version 20030317. */ - int (*frameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate, GLboolean enable); + int (*frameTracking)(void *drawablePrivate, GLboolean enable); /** * Retrieve frame usage information. * * \since Internal API version 20030317. */ - int (*queryFrameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate, + int (*queryFrameTracking)(void *drawablePrivate, int64_t * sbc, int64_t * missedFrames, float * lastMissedUsage, float * usage ); @@ -507,7 +498,7 @@ struct __DRIdrawableRec { * * \since Internal API version 20060314. */ - void (*copySubBuffer)(__DRInativeDisplay *dpy, void *drawablePrivate, + void (*copySubBuffer)(void *drawablePrivate, int x, int y, int w, int h); }; diff --git a/src/glx/x11/XF86dri.c b/src/glx/x11/XF86dri.c index 721bb3e65ac..b44ebaf3296 100644 --- a/src/glx/x11/XF86dri.c +++ b/src/glx/x11/XF86dri.c @@ -375,10 +375,9 @@ PUBLIC Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext) context, hHWContext ); } -PUBLIC GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, +PUBLIC GLboolean XF86DRIDestroyContext(Display *dpy, int screen, __DRIid context ) { - Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRIDestroyContextReq *req; @@ -397,10 +396,9 @@ PUBLIC GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, return True; } -PUBLIC GLboolean XF86DRICreateDrawable( __DRInativeDisplay * ndpy, int screen, +PUBLIC GLboolean XF86DRICreateDrawable(Display *dpy, int screen, __DRIid drawable, drm_drawable_t * hHWDrawable ) { - Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRICreateDrawableReply rep; xXF86DRICreateDrawableReq *req; @@ -432,10 +430,9 @@ static int noopErrorHandler(Display *dpy, XErrorEvent *xerr) return 0; } -PUBLIC GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen, +PUBLIC GLboolean XF86DRIDestroyDrawable(Display *dpy, int screen, __DRIid drawable ) { - Display * const dpy = (Display *) ndpy; XExtDisplayInfo *info = find_display (dpy); xXF86DRIDestroyDrawableReq *req; int (*oldXErrorHandler)(Display *, XErrorEvent *); diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 3dbdc306da3..7ed45496581 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -72,7 +72,9 @@ #define __GLX_MAX_TEXTURE_UNITS 32 +typedef struct __GLXscreenConfigsRec __GLXscreenConfigs; typedef struct __GLXcontextRec __GLXcontext; +typedef struct __GLXdrawableRec __GLXdrawable; typedef struct __GLXdisplayPrivateRec __GLXdisplayPrivate; typedef struct _glapi_table __GLapi; @@ -80,6 +82,9 @@ typedef struct _glapi_table __GLapi; #ifdef GLX_DIRECT_RENDERING +#define containerOf(ptr, type, member) \ + (type *)( (char *)ptr - offsetof(type,member) ) + #include @@ -240,6 +245,7 @@ struct __GLXcontextRec { * Screen number. */ GLint screen; + __GLXscreenConfigs *psc; /** * \c GL_TRUE if the context was created with ImportContext, which @@ -445,7 +451,7 @@ extern void __glFreeAttributeState(__GLXcontext *); * One of these records exists per screen of the display. It contains * a pointer to the config data for that screen (if the screen supports GL). */ -typedef struct __GLXscreenConfigsRec { +struct __GLXscreenConfigsRec { /** * GLX extension string reported by the X-server. */ @@ -463,6 +469,8 @@ typedef struct __GLXscreenConfigsRec { */ __DRIscreen driScreen; __glxHashTable *drawHash; + Display *dpy; + int scr; #endif /** @@ -482,7 +490,7 @@ typedef struct __GLXscreenConfigsRec { GLboolean ext_list_first_time; /*@}*/ -} __GLXscreenConfigs; +}; /** * Per display private data. One of these records exists for each display @@ -535,6 +543,18 @@ struct __GLXdisplayPrivateRec { #endif }; +#ifdef GLX_DIRECT_RENDERING + +struct __GLXdrawableRec { + XID drawable; + __GLXscreenConfigs *psc; + __DRIdrawable driDrawable; +}; + +#endif + + + void __glXFreeContext(__GLXcontext*); extern GLubyte *__glXFlushRenderBuffer(__GLXcontext*, GLubyte*); @@ -694,7 +714,7 @@ extern int __glXGetInternalVersion(void); /* Get the unadjusted system time */ extern int __glXGetUST( int64_t * ust ); -extern Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, - int32_t * numerator, int32_t * denominator); +extern GLboolean __glXGetMscRateOML(__DRIdrawable *draw, + int32_t * numerator, int32_t * denominator); #endif /* !__GLX_client_h__ */ diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 09514937269..45ee93c5c3a 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -105,7 +105,7 @@ static void GarbageCollectDRIDrawables(Display *dpy, int screen) if (!windowExistsFlag) { /* Destroy the local drawable data, if the drawable no longer exists in the Xserver */ - (*pdraw->destroyDrawable)(dpy, pdraw->private); + (*pdraw->destroyDrawable)(pdraw->private); Xfree(pdraw); } } while (__glxHashNext(sc->drawHash, &draw, (void *)&pdraw) == 1); @@ -127,7 +127,7 @@ static __DRIdrawable * GetDRIDrawable( Display *dpy, GLXDrawable drawable, int * const scrn_num ) { __GLXdisplayPrivate * const priv = __glXInitialize(dpy); - __DRIdrawable * const pdraw; + __GLXdrawable * const pdraw; const unsigned screen_count = ScreenCount(dpy); unsigned i; __GLXscreenConfigs *sc; @@ -140,7 +140,7 @@ GetDRIDrawable( Display *dpy, GLXDrawable drawable, int * const scrn_num ) if (__glxHashLookup(sc->drawHash, drawable, (void *) &pdraw) == 0) { if (scrn_num != NULL) *scrn_num = i; - return pdraw; + return &pdraw->driDrawable; } } @@ -402,12 +402,14 @@ CreateContext(Display *dpy, XVisualInfo *vis, void * const shared = (shareList != NULL) ? shareList->driContext.private : NULL; gc->driContext.private = - (*psc->driScreen.createNewContext)( dpy, mode, renderType, + (*psc->driScreen.createNewContext)( &psc->driScreen, + mode, renderType, shared, &gc->driContext ); if (gc->driContext.private) { gc->isDirect = GL_TRUE; gc->screen = mode->screen; + gc->psc = psc; gc->vid = mode->visualID; gc->fbconfigID = mode->fbconfigID; gc->mode = mode; @@ -520,8 +522,7 @@ DestroyContext(Display *dpy, GLXContext gc) /* Destroy the direct rendering context */ if (gc->isDirect) { if (gc->driContext.private) { - (*gc->driContext.destroyContext)(dpy, gc->screen, - gc->driContext.private); + (*gc->driContext.destroyContext)(gc->driContext.private); gc->driContext.private = NULL; } GarbageCollectDRIDrawables(dpy, gc->screen); @@ -849,7 +850,7 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable) __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, NULL ); if ( pdraw != NULL ) { - (*pdraw->swapBuffers)(dpy, pdraw->private); + (*pdraw->swapBuffers)(pdraw->private); return; } #endif @@ -1835,7 +1836,7 @@ static GLint __glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable) if ( (pdraw != NULL) && (pdraw->frameTracking != NULL) && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { - status = pdraw->frameTracking( dpy, pdraw->private, GL_TRUE ); + status = pdraw->frameTracking( pdraw->private, GL_TRUE ); } #else (void) dpy; @@ -1855,7 +1856,7 @@ static GLint __glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable) if ( (pdraw != NULL) && (pdraw->frameTracking != NULL) && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { - status = pdraw->frameTracking( dpy, pdraw->private, GL_FALSE ); + status = pdraw->frameTracking( pdraw->private, GL_FALSE ); } #else (void) dpy; @@ -1879,7 +1880,7 @@ static GLint __glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, int64_t sbc, missedFrames; float lastMissedUsage; - status = pdraw->queryFrameTracking( dpy, pdraw->private, &sbc, + status = pdraw->queryFrameTracking( pdraw->private, &sbc, &missedFrames, &lastMissedUsage, usage ); } @@ -1906,7 +1907,7 @@ static GLint __glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { float usage; - status = pdraw->queryFrameTracking( dpy, pdraw->private, sbc, + status = pdraw->queryFrameTracking( pdraw->private, sbc, missedFrames, lastMissedUsage, & usage ); } @@ -1973,7 +1974,7 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count int64_t msc; int64_t sbc; - ret = (*pdraw->waitForMSC)( gc->currentDpy, pdraw->private, + ret = (*pdraw->waitForMSC)( pdraw->private, 0, divisor, remainder, & msc, & sbc ); *count = (unsigned) msc; @@ -2142,7 +2143,7 @@ static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable, return ( (pdraw && pdraw->getSBC && psc->driScreen.getMSC) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) && ((*psc->driScreen.getMSC)( psc->driScreen.private, msc ) == 0) - && ((*pdraw->getSBC)( dpy, psc->driScreen.private, sbc ) == 0) + && ((*pdraw->getSBC)( psc->driScreen.private, sbc ) == 0) && (__glXGetUST( ust ) == 0) ); } #else @@ -2172,24 +2173,25 @@ static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable, * when GLX_OML_sync_control appears in the client extension string. */ -Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, - int32_t * numerator, int32_t * denominator) +GLboolean __glXGetMscRateOML(__DRIdrawable *draw, + int32_t * numerator, int32_t * denominator) { #if defined( GLX_DIRECT_RENDERING ) && defined( XF86VIDMODE ) + __GLXdrawable *glxDraw = + containerOf(draw, __GLXdrawable, driDrawable); + __GLXscreenConfigs *psc = glxDraw->psc; + Display *dpy = psc->dpy; __GLXdisplayPrivate * const priv = __glXInitialize(dpy); if ( priv != NULL ) { XF86VidModeModeLine mode_line; int dot_clock; - int screen_num; int i; - if (GetDRIDrawable( dpy, drawable, & screen_num) != NULL - && XF86VidModeQueryVersion( dpy, & i, & i ) - && XF86VidModeGetModeLine( dpy, screen_num, & dot_clock, - & mode_line ) ) { + if (XF86VidModeQueryVersion( dpy, & i, & i ) && + XF86VidModeGetModeLine(dpy, psc->scr, &dot_clock, &mode_line) ) { unsigned n = dot_clock * 1000; unsigned d = mode_line.vtotal * mode_line.htotal; @@ -2231,13 +2233,11 @@ Bool __glXGetMscRateOML(Display * dpy, GLXDrawable drawable, *numerator = n; *denominator = d; - (void) drawable; return True; } } #else - (void) dpy; - (void) drawable; + (void) draw; (void) numerator; (void) denominator; #endif @@ -2266,7 +2266,7 @@ static int64_t __glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable, if ( (pdraw != NULL) && (pdraw->swapBuffersMSC != NULL) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) { - return (*pdraw->swapBuffersMSC)(dpy, pdraw->private, target_msc, + return (*pdraw->swapBuffersMSC)(pdraw->private, target_msc, divisor, remainder); } #else @@ -2301,7 +2301,7 @@ static Bool __glXWaitForMscOML(Display * dpy, GLXDrawable drawable, if ( (pdraw != NULL) && (pdraw->waitForMSC != NULL) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) { - ret = (*pdraw->waitForMSC)( dpy, pdraw->private, target_msc, + ret = (*pdraw->waitForMSC)( pdraw->private, target_msc, divisor, remainder, msc, sbc ); /* __glXGetUST returns zero on success and non-zero on failure. @@ -2341,7 +2341,7 @@ static Bool __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable, if ( (pdraw != NULL) && (pdraw->waitForSBC != NULL) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit )) { - ret = (*pdraw->waitForSBC)( dpy, pdraw->private, target_sbc, msc, sbc ); + ret = (*pdraw->waitForSBC)( pdraw->private, target_sbc, msc, sbc ); /* __glXGetUST returns zero on success and non-zero on failure. * This function returns True on success and False on failure. @@ -2374,7 +2374,7 @@ PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn, if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { if (psc && psc->driScreen.private && psc->driScreen.allocateMemory) { - return (*psc->driScreen.allocateMemory)( dpy, scrn, size, + return (*psc->driScreen.allocateMemory)( &psc->driScreen, size, readFreq, writeFreq, priority ); } @@ -2399,7 +2399,7 @@ PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer) if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { if (psc && psc->driScreen.private && psc->driScreen.freeMemory) { - (*psc->driScreen.freeMemory)( dpy, scrn, pointer ); + (*psc->driScreen.freeMemory)( &psc->driScreen, pointer ); } } #else @@ -2418,7 +2418,7 @@ PUBLIC GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn, if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { if (psc && psc->driScreen.private && psc->driScreen.memoryOffset) { - return (*psc->driScreen.memoryOffset)( dpy, scrn, pointer ); + return (*psc->driScreen.memoryOffset)( &psc->driScreen, pointer ); } } #else @@ -2499,7 +2499,7 @@ static void __glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, if ( pdraw != NULL ) { __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen ); if ( __glXExtensionBitIsEnabled( psc, MESA_copy_sub_buffer_bit ) ) { - (*pdraw->copySubBuffer)(dpy, pdraw->private, x, y, width, height); + (*pdraw->copySubBuffer)(pdraw->private, x, y, width, height); } return; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 7f0428c0a99..2ff73685e37 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -109,10 +109,6 @@ static int _mesa_sparc_needs_init = 1; #define INIT_MESA_SPARC #endif -#ifdef GLX_DIRECT_RENDERING -static __DRIscreen *__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn); -#endif /* GLX_DIRECT_RENDERING */ - static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext gc); @@ -364,8 +360,7 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv) #ifdef GLX_DIRECT_RENDERING /* Free the direct rendering per screen data */ if (psc->driScreen.private) - (*psc->driScreen.destroyScreen)(priv->dpy, i, - psc->driScreen.private); + (*psc->driScreen.destroyScreen)(psc->driScreen.private); psc->driScreen.private = NULL; __glxHashDestroy(psc->drawHash); #endif @@ -710,7 +705,7 @@ static __DRIfuncPtr get_proc_address( const char * proc_name ) } #ifdef XDAMAGE_1_1_INTERFACE -static GLboolean has_damage_post(__DRInativeDisplay *dpy) +static GLboolean has_damage_post(Display *dpy) { static GLboolean inited = GL_FALSE; static GLboolean has_damage; @@ -732,8 +727,7 @@ static GLboolean has_damage_post(__DRInativeDisplay *dpy) } #endif /* XDAMAGE_1_1_INTERFACE */ -static void __glXReportDamage(__DRInativeDisplay *dpy, int screen, - __DRIid drawable, +static void __glXReportDamage(__DRIdrawable *driDraw, int x, int y, drm_clip_rect_t *rects, int num_rects, GLboolean front_buffer) @@ -743,6 +737,11 @@ static void __glXReportDamage(__DRInativeDisplay *dpy, int screen, XserverRegion region; int i; int x_off, y_off; + __GLXdrawable *glxDraw = + containerOf(driDraw, __GLXdrawable, driDrawable); + __GLXscreenConfigs *psc = glxDraw->psc; + Display *dpy = psc->dpy; + Drawable drawable; if (!has_damage_post(dpy)) return; @@ -750,10 +749,11 @@ static void __glXReportDamage(__DRInativeDisplay *dpy, int screen, if (front_buffer) { x_off = x; y_off = y; - drawable = RootWindow(dpy, screen); + drawable = RootWindow(dpy, psc->scr); } else{ x_off = 0; y_off = 0; + drawable = glxDraw->drawable; } xrects = malloc(sizeof(XRectangle) * num_rects); @@ -773,6 +773,69 @@ static void __glXReportDamage(__DRInativeDisplay *dpy, int screen, #endif } +static GLboolean +__glXDRICreateContext(__DRIscreen *screen, int configID, + void *pid, drm_context_t *hHWContext) +{ + __GLXscreenConfigs *psc = + containerOf(screen, __GLXscreenConfigs, driScreen); + Display *dpy = psc->dpy; + + return XF86DRICreateContextWithConfig(dpy, psc->scr, + configID, pid, hHWContext); +} + +static GLboolean +__glXDRIDestroyContext(__DRIscreen *screen, __DRIid context_id) +{ + __GLXscreenConfigs *psc = + containerOf(screen, __GLXscreenConfigs, driScreen); + Display *dpy = psc->dpy; + + return XF86DRIDestroyContext(dpy, psc->scr, context_id); +} + +static GLboolean +__glXDRICreateDrawable( __DRIscreen *screen, + __DRIid drawable, drm_drawable_t *hHWDrawable ) +{ + __GLXscreenConfigs *psc = + containerOf(screen, __GLXscreenConfigs, driScreen); + Display *dpy = psc->dpy; + + return XF86DRICreateDrawable(dpy, psc->scr, drawable, hHWDrawable); +} + +static GLboolean +__glXDRIDestroyDrawable(__DRIscreen *screen, __DRIid drawable) +{ + __GLXscreenConfigs *psc = + containerOf(screen, __GLXscreenConfigs, driScreen); + Display *dpy = psc->dpy; + + return XF86DRIDestroyDrawable(dpy, psc->scr, drawable); +} + +static GLboolean +__glXDRIGetDrawableInfo(__DRIscreen *screen, __DRIid drawable, + unsigned int *index, unsigned int *stamp, + int *X, int *Y, int *W, int *H, + int *numClipRects, drm_clip_rect_t ** pClipRects, + int *backX, int *backY, + int *numBackClipRects, drm_clip_rect_t **pBackClipRects) +{ + __GLXscreenConfigs *psc = + containerOf(screen, __GLXscreenConfigs, driScreen); + Display *dpy = psc->dpy; + + return XF86DRIGetDrawableInfo(dpy, psc->scr, drawable, + index, stamp, X, Y, W, H, + numClipRects, pClipRects, + backX, backY, + numBackClipRects, pBackClipRects); +} + + /** * Table of functions exported by the loader to the driver. */ @@ -782,14 +845,12 @@ static const __DRIinterfaceMethods interface_methods = { _gl_context_modes_create, _gl_context_modes_destroy, - __glXFindDRIScreen, - - XF86DRICreateContextWithConfig, - XF86DRIDestroyContext, + __glXDRICreateContext, + __glXDRIDestroyContext, - XF86DRICreateDrawable, - XF86DRIDestroyDrawable, - XF86DRIGetDrawableInfo, + __glXDRICreateDrawable, + __glXDRIDestroyDrawable, + __glXDRIGetDrawableInfo, __glXGetUST, __glXGetMscRateOML, @@ -941,7 +1002,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, err_msg = "InitDriver"; err_extra = NULL; - psp = (*createNewScreen)(dpy, scrn, + psp = (*createNewScreen)(scrn, &psc->driScreen, psc->configs, & ddx_version, @@ -1169,6 +1230,8 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) UnlockDisplay(dpy); #ifdef GLX_DIRECT_RENDERING + psc->scr = i; + psc->dpy = dpy; /* Create drawable hash */ psc->drawHash = __glxHashCreate(); if ( psc->drawHash == NULL ) { @@ -1512,33 +1575,6 @@ PUBLIC GLXDrawable glXGetCurrentDrawable(void) } -/************************************************************************/ - -#ifdef GLX_DIRECT_RENDERING -/* Return the DRI per screen structure */ -__DRIscreen *__glXFindDRIScreen(__DRInativeDisplay *dpy, int scrn) -{ - __DRIscreen *pDRIScreen = NULL; - XExtDisplayInfo *info = __glXFindDisplay(dpy); - XExtData **privList, *found; - __GLXdisplayPrivate *dpyPriv; - XEDataObject dataObj; - - __glXLock(); - dataObj.display = dpy; - privList = XEHeadOfExtensionList(dataObj); - found = XFindOnExtensionList(privList, info->codes->extension); - __glXUnlock(); - - if (found) { - dpyPriv = (__GLXdisplayPrivate *)found->private_data; - pDRIScreen = &dpyPriv->screenConfigs[scrn].driScreen; - } - - return pDRIScreen; -} -#endif - /************************************************************************/ static Bool SendMakeCurrentRequest( Display *dpy, CARD8 opcode, @@ -1629,7 +1665,7 @@ static __DRIdrawable * FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc) { __GLXdisplayPrivate * const priv = __glXInitialize(dpy); - __DRIdrawable *pdraw; + __GLXdrawable *pdraw; __GLXscreenConfigs *sc; void *empty_attribute_list = NULL; @@ -1638,34 +1674,37 @@ FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc) sc = &priv->screenConfigs[gc->screen]; if (__glxHashLookup(sc->drawHash, drawable, (void *) &pdraw) == 0) - return pdraw; + return &pdraw->driDrawable; /* Allocate a new drawable */ - pdraw = (__DRIdrawable *)Xmalloc(sizeof(__DRIdrawable)); + pdraw = Xmalloc(sizeof(*pdraw)); if (!pdraw) return NULL; + pdraw->drawable = drawable; + pdraw->psc = sc; + /* Create a new drawable */ - pdraw->private = - (*sc->driScreen.createNewDrawable)(dpy, + pdraw->driDrawable.private = + (*sc->driScreen.createNewDrawable)(&sc->driScreen, gc->mode, - drawable, pdraw, + drawable, &pdraw->driDrawable, GLX_WINDOW_BIT, empty_attribute_list); - if (!pdraw->private) { + if (!pdraw->driDrawable.private) { /* ERROR!!! */ Xfree(pdraw); return NULL; } if (__glxHashInsert(sc->drawHash, drawable, pdraw)) { - (*pdraw->destroyDrawable)(dpy, pdraw->private); + (*pdraw->driDrawable.destroyDrawable)(pdraw->driDrawable.private); Xfree(pdraw); return NULL; } - return pdraw; + return &pdraw->driDrawable; } static Bool BindContextWrapper( Display *dpy, GLXContext gc, @@ -1674,15 +1713,13 @@ static Bool BindContextWrapper( Display *dpy, GLXContext gc, __DRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc); __DRIdrawable *pread = FetchDRIDrawable(dpy, read, gc); - return (*gc->driContext.bindContext)(dpy, gc->screen, pdraw, pread, - & gc->driContext); + return (*gc->driContext.bindContext)(pdraw, pread, &gc->driContext); } static Bool UnbindContextWrapper( GLXContext gc ) { - return (*gc->driContext.unbindContext)(gc->currentDpy, gc->screen, - &gc->driContext ); + return (*gc->driContext.unbindContext)(&gc->driContext); } #endif /* GLX_DIRECT_RENDERING */ @@ -1794,7 +1831,7 @@ USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, if (oldGC->isDirect) { if (oldGC->driContext.private) { (*oldGC->driContext.destroyContext) - (dpy, oldGC->screen, oldGC->driContext.private); + (oldGC->driContext.private); oldGC->driContext.private = NULL; } } diff --git a/src/glx/x11/xf86dri.h b/src/glx/x11/xf86dri.h index 0a2bb24971d..ddac7db266c 100644 --- a/src/glx/x11/xf86dri.h +++ b/src/glx/x11/xf86dri.h @@ -94,13 +94,13 @@ Bool XF86DRICreateContext( Display *dpy, int screen, Visual *visual, Bool XF86DRICreateContextWithConfig( Display *dpy, int screen, int configID, XID *ptr_to_returned_context_id, drm_context_t *hHWContext ); -extern GLboolean XF86DRIDestroyContext( __DRInativeDisplay *dpy, int screen, +extern GLboolean XF86DRIDestroyContext( Display *dpy, int screen, __DRIid context_id ); -extern GLboolean XF86DRICreateDrawable( __DRInativeDisplay *dpy, int screen, +extern GLboolean XF86DRICreateDrawable( Display *dpy, int screen, __DRIid drawable, drm_drawable_t *hHWDrawable ); -extern GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay *dpy, int screen, +extern GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen, __DRIid drawable); Bool XF86DRIGetDrawableInfo( Display *dpy, int screen, Drawable drawable, diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 1f916a82cad..2b5d6f0a598 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -33,7 +33,7 @@ #include "drm_sarea.h" #ifndef GLX_OML_sync_control -typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRInativeDisplay *dpy, __DRIid drawable, int32_t *numerator, int32_t *denominator); +typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator); #endif /* This pointer *must* be set by the driver's __driCreateNewScreen funciton! @@ -53,16 +53,16 @@ static const int empty_attribute_list[1] = { None }; static int api_ver = 0; /* forward declarations */ -static int driQueryFrameTracking( __DRInativeDisplay *dpy, void *priv, +static int driQueryFrameTracking( void *priv, int64_t *sbc, int64_t *missedFrames, float *lastMissedUsage, float *usage ); -static void *driCreateNewDrawable(__DRInativeDisplay *dpy, - const __GLcontextModes *modes, +static void *driCreateNewDrawable(__DRIscreen *screen, + const __GLcontextModes *modes, __DRIid draw, __DRIdrawable *pdraw, int renderType, const int *attrs); -static void driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate); +static void driDestroyDrawable(void *drawablePrivate); /** @@ -96,8 +96,7 @@ __driUtilMessage(const char *f, ...) /** * Unbind context. * - * \param dpy the display handle. - * \param scrn the screen number. + * \param scrn the screen. * \param gc context. * * \return \c GL_TRUE on success, or \c GL_FALSE on failure. @@ -110,10 +109,8 @@ __driUtilMessage(const char *f, ...) * While casting the opaque private pointers associated with the parameters * into their respective real types it also assures they are not \c NULL. */ -static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, - __DRIcontext *ctx) +static GLboolean driUnbindContext(__DRIcontext *ctx) { - __DRIscreen *pDRIScreen; __DRIcontextPrivate *pcp; __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -124,19 +121,11 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, ** calling driUnbindContext. */ - if (ctx == NULL) { - /* ERROR!!! */ - return GL_FALSE; - } + if (ctx == NULL) + return GL_FALSE; - pDRIScreen = (*dri_interface->getScreen)(dpy, scrn); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - /* ERROR!!! */ - return GL_FALSE; - } - - psp = (__DRIscreenPrivate *)pDRIScreen->private; pcp = (__DRIcontextPrivate *)ctx->private; + psp = (__DRIscreenPrivate *)pcp->driScreenPriv; pdp = (__DRIdrawablePrivate *)pcp->driDrawablePriv; prp = (__DRIdrawablePrivate *)pcp->driReadablePriv; @@ -179,16 +168,14 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn, * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. */ -static GLboolean DoBindContext(__DRInativeDisplay *dpy, - __DRIdrawable *pdraw, +static GLboolean DoBindContext(__DRIdrawable *pdraw, __DRIdrawable *pread, - __DRIcontext *ctx, - __DRIscreenPrivate *psp) + __DRIcontext *ctx) { __DRIdrawablePrivate *pdp; __DRIdrawablePrivate *prp; __DRIcontextPrivate * const pcp = ctx->private; - + __DRIscreenPrivate *psp = pcp->driScreenPriv; pdp = (__DRIdrawablePrivate *) pdraw->private; prp = (__DRIdrawablePrivate *) pread->private; @@ -230,31 +217,19 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy, * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. */ -static GLboolean driBindContext(__DRInativeDisplay *dpy, int scrn, - __DRIdrawable *pdraw, +static GLboolean driBindContext(__DRIdrawable *pdraw, __DRIdrawable *pread, __DRIcontext * ctx) { - __DRIscreen *pDRIScreen; - /* ** Assume error checking is done properly in glXMakeCurrent before ** calling driBindContext. */ - if (ctx == NULL || pdraw == None || pread == None) { - /* ERROR!!! */ - return GL_FALSE; - } - - pDRIScreen = (*dri_interface->getScreen)(dpy, scrn); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - /* ERROR!!! */ + if (ctx == NULL || pdraw == None || pread == None) return GL_FALSE; - } - return DoBindContext( dpy, pdraw, pread, ctx, - (__DRIscreenPrivate *)pDRIScreen->private ); + return DoBindContext( pdraw, pread, ctx ); } /*@}*/ @@ -311,7 +286,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); - if (! (*dri_interface->getDrawableInfo)(pdp->display, pdp->screen, pdp->draw, + if (! (*dri_interface->getDrawableInfo)(pdp->driScreenPriv->psc, pdp->draw, &pdp->index, &pdp->lastStamp, &pdp->x, &pdp->y, &pdp->w, &pdp->h, &pdp->numClipRects, &pdp->pClipRects, @@ -345,7 +320,6 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) /** * Swap buffers. * - * \param dpy the display handle. * \param drawablePrivate opaque pointer to the per-drawable private info. * * \internal @@ -353,7 +327,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) * * Is called directly from glXSwapBuffers(). */ -static void driSwapBuffers( __DRInativeDisplay *dpy, void *drawablePrivate ) +static void driSwapBuffers(void *drawablePrivate) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; drm_clip_rect_t rect; @@ -374,8 +348,7 @@ static void driSwapBuffers( __DRInativeDisplay *dpy, void *drawablePrivate ) * front buffer, so we report the damage there rather than to the backing * store (if any). */ - (*dri_interface->reportDamage)(dpy, dPriv->screen, dPriv->draw, - dPriv->x, dPriv->y, + (*dri_interface->reportDamage)(dPriv->pdraw, dPriv->x, dPriv->y, &rect, 1, GL_TRUE); } @@ -392,7 +365,7 @@ static int driGetMSC( void *screenPrivate, int64_t *msc ) /** * Called directly from a number of higher-level GLX functions. */ -static int driGetSBC( __DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc ) +static int driGetSBC( void *drawablePrivate, int64_t *sbc ) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; __DRIswapInfo sInfo; @@ -405,8 +378,7 @@ static int driGetSBC( __DRInativeDisplay *dpy, void *drawablePrivate, int64_t *s return status; } -static int driWaitForSBC( __DRInativeDisplay * dpy, void *drawablePriv, - int64_t target_sbc, +static int driWaitForSBC( void *drawablePriv, int64_t target_sbc, int64_t * msc, int64_t * sbc ) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv; @@ -415,8 +387,7 @@ static int driWaitForSBC( __DRInativeDisplay * dpy, void *drawablePriv, msc, sbc ); } -static int driWaitForMSC( __DRInativeDisplay * dpy, void *drawablePriv, - int64_t target_msc, +static int driWaitForMSC( void *drawablePriv, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc, int64_t * sbc ) { @@ -442,8 +413,7 @@ static int driWaitForMSC( __DRInativeDisplay * dpy, void *drawablePriv, return status; } -static int64_t driSwapBuffersMSC( __DRInativeDisplay * dpy, void *drawablePriv, - int64_t target_msc, +static int64_t driSwapBuffersMSC( void *drawablePriv, int64_t target_msc, int64_t divisor, int64_t remainder ) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv; @@ -453,25 +423,23 @@ static int64_t driSwapBuffersMSC( __DRInativeDisplay * dpy, void *drawablePriv, remainder ); } -static void driCopySubBuffer( __DRInativeDisplay *dpy, void *drawablePrivate, +static void driCopySubBuffer( void *drawablePrivate, int x, int y, int w, int h) { __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); - (void) dpy; } /** * This is called via __DRIscreenRec's createNewDrawable pointer. */ -static void *driCreateNewDrawable(__DRInativeDisplay *dpy, +static void *driCreateNewDrawable(__DRIscreen *screen, const __GLcontextModes *modes, __DRIid draw, __DRIdrawable *pdraw, int renderType, const int *attrs) { - __DRIscreen * const pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen); __DRIscreenPrivate *psp; __DRIdrawablePrivate *pdp; @@ -483,16 +451,14 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, */ (void) attrs; - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - return NULL; - } - pdp = (__DRIdrawablePrivate *)_mesa_malloc(sizeof(__DRIdrawablePrivate)); if (!pdp) { return NULL; } - if (!(*dri_interface->createDrawable)(dpy, modes->screen, draw, &pdp->hHWDrawable)) { + /* Ensure that modes->screen and screen are the same screen? */ + + if (!(*dri_interface->createDrawable)(screen, draw, &pdp->hHWDrawable)) { _mesa_free(pdp); return NULL; } @@ -511,16 +477,14 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, pdp->numBackClipRects = 0; pdp->pClipRects = NULL; pdp->pBackClipRects = NULL; - pdp->display = dpy; - pdp->screen = modes->screen; - psp = (__DRIscreenPrivate *)pDRIScreen->private; + psp = (__DRIscreenPrivate *)screen->private; pdp->driScreenPriv = psp; pdp->driContextPriv = &psp->dummyContextPriv; if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, modes, renderType == GLX_PIXMAP_BIT)) { - (void)(*dri_interface->destroyDrawable)(dpy, modes->screen, pdp->draw); + (void)(*dri_interface->destroyDrawable)(screen, pdp->draw); _mesa_free(pdp); return NULL; } @@ -551,17 +515,15 @@ static void *driCreateNewDrawable(__DRInativeDisplay *dpy, } static void -driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) +driDestroyDrawable(void *drawablePrivate) { __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *) drawablePrivate; __DRIscreenPrivate *psp; - int scrn; if (pdp) { psp = pdp->driScreenPriv; - scrn = psp->myNum; (*psp->DriverAPI.DestroyBuffer)(pdp); - (void)(*dri_interface->destroyDrawable)(dpy, scrn, pdp->draw); + (void)(*dri_interface->destroyDrawable)(psp->psc, pdp->draw); if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; @@ -585,8 +547,6 @@ driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) /** * Destroy the per-context private information. * - * \param dpy the display handle. - * \param scrn the screen number. * \param contextPrivate opaque pointer to the per-drawable private info. * * \internal @@ -594,13 +554,14 @@ driDestroyDrawable(__DRInativeDisplay *dpy, void *drawablePrivate) * drmDestroyContext(), and finally frees \p contextPrivate. */ static void -driDestroyContext(__DRInativeDisplay *dpy, int scrn, void *contextPrivate) +driDestroyContext(void *contextPrivate) { __DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate; if (pcp) { (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); - (void) (*dri_interface->destroyContext)(dpy, scrn, pcp->contextID); + (void) (*dri_interface->destroyContext)(pcp->driScreenPriv->psc, + pcp->contextID); _mesa_free(pcp); } } @@ -628,35 +589,27 @@ driDestroyContext(__DRInativeDisplay *dpy, int scrn, void *contextPrivate) * */ static void * -driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, +driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, int render_type, void *sharedPrivate, __DRIcontext *pctx) { - __DRIscreen *pDRIScreen; __DRIcontextPrivate *pcp; __DRIcontextPrivate *pshare = (__DRIcontextPrivate *) sharedPrivate; __DRIscreenPrivate *psp; void * const shareCtx = (pshare != NULL) ? pshare->driverPrivate : NULL; - pDRIScreen = (*dri_interface->getScreen)(dpy, modes->screen); - if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) { - /* ERROR!!! */ - return NULL; - } - - psp = (__DRIscreenPrivate *)pDRIScreen->private; + psp = (__DRIscreenPrivate *)screen->private; pcp = (__DRIcontextPrivate *)_mesa_malloc(sizeof(__DRIcontextPrivate)); if (!pcp) { return NULL; } - if (! (*dri_interface->createContext)(dpy, modes->screen, modes->fbconfigID, - &pcp->contextID, &pcp->hHWContext)) { + if (! (*dri_interface->createContext)(screen, modes->fbconfigID, + &pcp->contextID, &pcp->hHWContext)) { _mesa_free(pcp); return NULL; } - pcp->display = dpy; pcp->driScreenPriv = psp; pcp->driDrawablePriv = NULL; @@ -678,8 +631,7 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, pctx->unbindContext = driUnbindContext; if ( !(*psp->DriverAPI.CreateContext)(modes, pcp, shareCtx) ) { - (void) (*dri_interface->destroyContext)(dpy, modes->screen, - pcp->contextID); + (void) (*dri_interface->destroyContext)(screen, pcp->contextID); _mesa_free(pcp); return NULL; } @@ -705,7 +657,7 @@ driCreateNewContext(__DRInativeDisplay *dpy, const __GLcontextModes *modes, * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls * drmClose(), and finally frees \p screenPrivate. */ -static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPrivate) +static void driDestroyScreen(void *screenPrivate) { __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; @@ -760,7 +712,7 @@ static void driDestroyScreen(__DRInativeDisplay *dpy, int scrn, void *screenPriv * loader that is too old to even load this driver. */ __DRIscreenPrivate * -__driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, +__driUtilCreateNewScreen(int scr, __DRIscreen *psc, __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, @@ -781,8 +733,6 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, return NULL; } - psp->display = dpy; - psp->myNum = scrn; psp->psc = psc; psp->modes = modes; @@ -818,6 +768,7 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, psp->fbBPP = psp->fbStride * 8 / frame_buffer->width; psp->fd = fd; + psp->myNum = scr; /* ** Do not init dummy context here; actual initialization will be @@ -873,7 +824,7 @@ int driCompareGLXAPIVersion( GLint required_version ) static int -driQueryFrameTracking( __DRInativeDisplay * dpy, void * priv, +driQueryFrameTracking( void * priv, int64_t * sbc, int64_t * missedFrames, float * lastMissedUsage, float * usage ) { @@ -935,7 +886,7 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, float usage = 1.0; - if ( (*dri_interface->getMSCRate)( dPriv->display, dPriv->draw, &n, &d ) ) { + if ( (*dri_interface->getMSCRate)(dPriv->pdraw, &n, &d) ) { interval = (dPriv->pdraw->swap_interval != 0) ? dPriv->pdraw->swap_interval : 1; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index a08eab1616e..cae170c5f81 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -317,17 +317,6 @@ struct __DRIdrawablePrivateRec { */ __DRIscreenPrivate *driScreenPriv; - /** - * \name Display and screen information. - * - * Basically just need these for when the locking code needs to call - * \c __driUtilUpdateDrawableInfo. - */ - /*@{*/ - __DRInativeDisplay *display; - int screen; - /*@}*/ - /** * Called via glXSwapBuffers(). */ @@ -354,9 +343,9 @@ struct __DRIcontextPrivateRec { void *driverPrivate; /** - * This context's display pointer. + * Pointer back to the \c __DRIcontext that contains this structure. */ - __DRInativeDisplay *display; + __DRIcontext *pctx; /** * Pointer to drawable currently bound to this context for drawing. @@ -378,11 +367,6 @@ struct __DRIcontextPrivateRec { * Per-screen private driver information. */ struct __DRIscreenPrivateRec { - /** - * Display for this screen - */ - __DRInativeDisplay *display; - /** * Current screen's number */ @@ -535,8 +519,8 @@ extern void __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp); -extern __DRIscreenPrivate * __driUtilCreateNewScreen( __DRInativeDisplay *dpy, - int scrn, __DRIscreen *psc, __GLcontextModes * modes, +extern __DRIscreenPrivate * __driUtilCreateNewScreen( int scr, __DRIscreen *psc, + __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, drm_sarea_t *pSAREA, int fd, int internal_api_version, diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 4c5323d230e..4cd5b9a2080 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -714,16 +714,16 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -740,7 +740,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &ffbAPI); diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index c0a7cdb90a9..b04bc383270 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -431,17 +431,16 @@ static const struct __DriverAPIRec i810API = { * failure. */ PUBLIC -void * __driCreateNewScreen_20070105( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) - +void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 0, 0 }; @@ -457,7 +456,7 @@ void * __driCreateNewScreen_20070105( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &i810API); diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 2721a900945..7a11672a8f1 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -886,18 +886,18 @@ intelFillInModes(unsigned pixel_bits, unsigned depth_bits, * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on * failure. */ -PUBLIC void * -__driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn, - __DRIscreen * psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +PUBLIC +void * __DRI_CREATE_NEW_SCREEN(int scrn, + __DRIscreen * psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 5, 0 }; @@ -913,11 +913,10 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn, return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &intelAPI); - + psp = __driUtilCreateNewScreen(scrn, psc, NULL, + ddx_version, dri_version, drm_version, + frame_buffer, pSAREA, fd, + internal_api_version, &intelAPI); if (psp != NULL) { I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; *driver_modes = intelFillInModes(dri_priv->cpp * 8, diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 5dac50df32c..29ea07d78ef 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -650,16 +650,16 @@ intelFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes ) { __DRIscreenPrivate *psp; @@ -676,7 +676,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &intelAPI); diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 4e9e216e7db..52b96bf0bc0 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -505,16 +505,16 @@ static struct __DriverAPIRec mach64API = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -531,7 +531,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &mach64API); diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index f4e651afa0c..372d2ce4339 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -963,16 +963,16 @@ static const struct __DriverAPIRec mgaAPI = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -989,7 +989,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &mgaAPI); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 065aa81746c..cab53f41ad4 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -295,16 +295,16 @@ nouveauFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -331,7 +331,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &nouveauAPI); diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 880dee85c25..a84b54924ac 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -514,16 +514,16 @@ r128FillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -541,7 +541,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &r128API); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 2366bde5250..c9c5a861722 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -857,7 +857,7 @@ void r200Finish( GLcontext *ctx ) * the kernel data structures, and the current context to get the * device fd. */ -void *r200AllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLsizei size, +void *r200AllocateMemoryMESA(__DRIscreen *screen, GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority) { @@ -899,7 +899,7 @@ void *r200AllocateMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLsizei size, /* Called via glXFreeMemoryMESA() */ -void r200FreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer) +void r200FreeMemoryMESA(__DRIscreen *screen, GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); r200ContextPtr rmesa; @@ -936,7 +936,7 @@ void r200FreeMemoryMESA(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer) } /* Called via glXGetMemoryOffsetMESA() */ -GLuint r200GetMemoryOffsetMESA(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer) +GLuint r200GetMemoryOffsetMESA(__DRIscreen *screen, const GLvoid *pointer) { GET_CURRENT_CONTEXT(ctx); r200ContextPtr rmesa; diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index 5ed1555f6a3..bf126799472 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -98,10 +98,10 @@ extern void r200WaitForIdleLocked( r200ContextPtr rmesa ); extern void r200WaitForVBlank( r200ContextPtr rmesa ); extern void r200InitIoctlFuncs( struct dd_function_table *functions ); -extern void *r200AllocateMemoryMESA( __DRInativeDisplay *dpy, int scrn, GLsizei size, GLfloat readfreq, +extern void *r200AllocateMemoryMESA( __DRIscreen *screen, GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority ); -extern void r200FreeMemoryMESA( __DRInativeDisplay *dpy, int scrn, GLvoid *pointer ); -extern GLuint r200GetMemoryOffsetMESA( __DRInativeDisplay *dpy, int scrn, const GLvoid *pointer ); +extern void r200FreeMemoryMESA( __DRIscreen *screen, GLvoid *pointer ); +extern GLuint r200GetMemoryOffsetMESA( __DRIscreen *screen, const GLvoid *pointer ); extern GLboolean r200IsGartMemory( r200ContextPtr rmesa, const GLvoid *pointer, GLint size ); diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 682cf3a5ee5..2d44532a843 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -990,17 +990,16 @@ static const struct __DriverAPIRec r200API = { * failure. */ PUBLIC void * -__driCreateNewScreen_20050727( __DRInativeDisplay *dpy, - int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; #if !RADEON_COMMON @@ -1029,12 +1028,12 @@ __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, return NULL; } #if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &radeonAPI); #elif RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &r200API); diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 43422db9a82..e8a63ae51b9 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -1027,16 +1027,16 @@ savageFillInModes( unsigned pixel_bits, unsigned depth_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes ) { __DRIscreenPrivate *psp; @@ -1053,7 +1053,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &savageAPI); diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 89d734ba786..a1275f00263 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -333,17 +333,16 @@ static struct __DriverAPIRec sisAPI = { * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, - const __GLcontextModes *modes, - const __DRIversion *ddx_version, - const __DRIversion *dri_version, - const __DRIversion *drm_version, - const __DRIframebuffer *frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes **driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes *modes, + const __DRIversion *ddx_version, + const __DRIversion *dri_version, + const __DRIversion *drm_version, + const __DRIframebuffer *frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes **driver_modes) { __DRIscreenPrivate *psp; @@ -359,7 +358,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &sisAPI); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 1f9ff4e30ca..899963d06d3 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -442,16 +442,16 @@ static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits, * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 1, 0 }; @@ -467,7 +467,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &tdfxAPI); diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index 8dc7f0dc781..1d2a49e6f4a 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -430,17 +430,17 @@ static struct __DriverAPIRec tridentAPI = { }; -PUBLIC void *__driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +PUBLIC void * +__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 4, 0, 0 }; @@ -456,7 +456,7 @@ PUBLIC void *__driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &tridentAPI); diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 7c738777209..66e92cc602e 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -601,9 +601,6 @@ viaCreateContext(const __GLcontextModes *visual, _tnl_allow_pixel_fog(ctx, GL_FALSE); _tnl_allow_vertex_fog(ctx, GL_TRUE); -/* vmesa->display = dpy; */ - vmesa->display = sPriv->display; - vmesa->hHWContext = driContextPriv->hHWContext; vmesa->driFd = sPriv->fd; vmesa->driHwLock = &sPriv->pSAREA->lock; diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index fecd2782fba..63217136882 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -289,7 +289,6 @@ struct via_context { drm_context_t hHWContext; drm_hw_lock_t *driHwLock; int driFd; - __DRInativeDisplay *display; /** * DRI drawable bound to this context for drawing. diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 90f76be44d4..c10b7d1a9b1 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -418,17 +418,16 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) * failure. */ PUBLIC -void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, - __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) +void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes) { __DRIscreenPrivate *psp; @@ -448,7 +447,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, return NULL; } - psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL, + psp = __driUtilCreateNewScreen(scrn, psc, NULL, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &viaAPI); -- cgit v1.2.3 From b068af2f3b890bec26a186e9d0bdd3d44c17cd4d Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 10 Oct 2007 17:07:01 -0400 Subject: Key drm_i915_flip_t typedef off of the ioctl #define instead. --- src/mesa/drivers/dri/i915/intel_buffers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c b/src/mesa/drivers/dri/i915/intel_buffers.c index 938bed6da7c..bd2e67fbed4 100644 --- a/src/mesa/drivers/dri/i915/intel_buffers.c +++ b/src/mesa/drivers/dri/i915/intel_buffers.c @@ -45,7 +45,7 @@ /* This block can be removed when libdrm >= 2.3.1 is required */ -#ifndef DRM_VBLANK_FLIP +#ifndef DRM_IOCTL_I915_FLIP #define DRM_VBLANK_FLIP 0x8000000 -- cgit v1.2.3 From 4ff95e78e19e5902352ea3759d32d9f013255f42 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 10 May 2007 17:14:38 -0400 Subject: Drop createDrawable and destroyDrawable fron DRIinterfaceMethods. All the DRI driver did was call the createDrawable callback immediately upon entry to DRIscreen::createNewDrawable to get the drm_drawable_t. We can just call that before calling into the DRI driver and pass the returned drm_drawable_t as an argument to the DRI entry point. Likewise for destroyDrawable. Also, DRIdrawablePrivate::draw isn't used anywhere, and since the driver no longer needs the XID of the drawable we can now drop that. --- include/GL/internal/dri_interface.h | 16 +++---------- src/glx/x11/glxcmds.c | 5 ++-- src/glx/x11/glxext.c | 42 +++++++++++----------------------- src/mesa/drivers/dri/common/dri_util.c | 18 ++++----------- src/mesa/drivers/dri/common/dri_util.h | 1 - src/mesa/drivers/dri/mga/mgastate.c | 5 ---- 6 files changed, 24 insertions(+), 63 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 8a6984de68a..0f90f49507a 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -194,22 +194,11 @@ struct __DRIinterfaceMethodsRec { */ GLboolean (* destroyContext)( __DRIscreen *screen, __DRIid context ); - /** - * Create the server-side portion of the drawable. - */ - GLboolean (*createDrawable)( __DRIscreen *screen, - __DRIid drawable, drm_drawable_t * hHWDrawable ); - - /** - * Destroy the server-side portion of the drawable. - */ - GLboolean (*destroyDrawable)( __DRIscreen *screen, __DRIid drawable ); - /** * This function is used to get information about the position, size, and * clip rects of a drawable. */ - GLboolean (* getDrawableInfo) ( __DRIscreen *screen, __DRIid drawable, + GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable, unsigned int * index, unsigned int * stamp, int * x, int * y, int * width, int * height, int * numClipRects, drm_clip_rect_t ** pClipRects, @@ -303,7 +292,8 @@ struct __DRIscreenRec { */ void *(*createNewDrawable)(__DRIscreen *screen, const __GLcontextModes *modes, - __DRIid draw, __DRIdrawable *pdraw, + __DRIdrawable *pdraw, + drm_drawable_t hwDrawable, int renderType, const int *attrs); /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 45ee93c5c3a..229da5a584e 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -85,7 +85,7 @@ static void GarbageCollectDRIDrawables(Display *dpy, int screen) __GLXdisplayPrivate * const priv = __glXInitialize(dpy); __GLXscreenConfigs *sc; __DRIid draw; - __DRIdrawable *pdraw; + __GLXdrawable *pdraw; XWindowAttributes xwa; int (*oldXErrorHandler)(Display *, XErrorEvent *); @@ -105,7 +105,8 @@ static void GarbageCollectDRIDrawables(Display *dpy, int screen) if (!windowExistsFlag) { /* Destroy the local drawable data, if the drawable no longer exists in the Xserver */ - (*pdraw->destroyDrawable)(pdraw->private); + (*pdraw->driDrawable.destroyDrawable)(pdraw->driDrawable.private); + XF86DRIDestroyDrawable(dpy, sc->scr, draw); Xfree(pdraw); } } while (__glxHashNext(sc->drawHash, &draw, (void *)&pdraw) == 1); diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 2ff73685e37..dce01d5528d 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -796,39 +796,19 @@ __glXDRIDestroyContext(__DRIscreen *screen, __DRIid context_id) } static GLboolean -__glXDRICreateDrawable( __DRIscreen *screen, - __DRIid drawable, drm_drawable_t *hHWDrawable ) -{ - __GLXscreenConfigs *psc = - containerOf(screen, __GLXscreenConfigs, driScreen); - Display *dpy = psc->dpy; - - return XF86DRICreateDrawable(dpy, psc->scr, drawable, hHWDrawable); -} - -static GLboolean -__glXDRIDestroyDrawable(__DRIscreen *screen, __DRIid drawable) -{ - __GLXscreenConfigs *psc = - containerOf(screen, __GLXscreenConfigs, driScreen); - Display *dpy = psc->dpy; - - return XF86DRIDestroyDrawable(dpy, psc->scr, drawable); -} - -static GLboolean -__glXDRIGetDrawableInfo(__DRIscreen *screen, __DRIid drawable, +__glXDRIGetDrawableInfo(__DRIdrawable *drawable, unsigned int *index, unsigned int *stamp, int *X, int *Y, int *W, int *H, int *numClipRects, drm_clip_rect_t ** pClipRects, int *backX, int *backY, int *numBackClipRects, drm_clip_rect_t **pBackClipRects) { - __GLXscreenConfigs *psc = - containerOf(screen, __GLXscreenConfigs, driScreen); + __GLXdrawable *glxDraw = + containerOf(drawable, __GLXdrawable, driDrawable); + __GLXscreenConfigs *psc = glxDraw->psc; Display *dpy = psc->dpy; - return XF86DRIGetDrawableInfo(dpy, psc->scr, drawable, + return XF86DRIGetDrawableInfo(dpy, psc->scr, glxDraw->drawable, index, stamp, X, Y, W, H, numClipRects, pClipRects, backX, backY, @@ -848,8 +828,6 @@ static const __DRIinterfaceMethods interface_methods = { __glXDRICreateContext, __glXDRIDestroyContext, - __glXDRICreateDrawable, - __glXDRIDestroyDrawable, __glXDRIGetDrawableInfo, __glXGetUST, @@ -1667,6 +1645,7 @@ FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc) __GLXdisplayPrivate * const priv = __glXInitialize(dpy); __GLXdrawable *pdraw; __GLXscreenConfigs *sc; + drm_drawable_t hwDrawable; void *empty_attribute_list = NULL; if (priv == NULL || priv->driDisplay.private == NULL) @@ -1684,22 +1663,27 @@ FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc) pdraw->drawable = drawable; pdraw->psc = sc; + if (!XF86DRICreateDrawable(dpy, sc->scr, drawable, &hwDrawable)) + return NULL; + /* Create a new drawable */ pdraw->driDrawable.private = (*sc->driScreen.createNewDrawable)(&sc->driScreen, gc->mode, - drawable, &pdraw->driDrawable, + &pdraw->driDrawable, + hwDrawable, GLX_WINDOW_BIT, empty_attribute_list); if (!pdraw->driDrawable.private) { - /* ERROR!!! */ + XF86DRIDestroyDrawable(dpy, sc->scr, drawable); Xfree(pdraw); return NULL; } if (__glxHashInsert(sc->drawHash, drawable, pdraw)) { (*pdraw->driDrawable.destroyDrawable)(pdraw->driDrawable.private); + XF86DRIDestroyDrawable(dpy, sc->scr, drawable); Xfree(pdraw); return NULL; } diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 2b5d6f0a598..dd7068ad103 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -59,7 +59,8 @@ static int driQueryFrameTracking( void *priv, static void *driCreateNewDrawable(__DRIscreen *screen, const __GLcontextModes *modes, - __DRIid draw, __DRIdrawable *pdraw, + __DRIdrawable *pdraw, + drm_drawable_t hwDrawable, int renderType, const int *attrs); static void driDestroyDrawable(void *drawablePrivate); @@ -286,7 +287,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); - if (! (*dri_interface->getDrawableInfo)(pdp->driScreenPriv->psc, pdp->draw, + if (! (*dri_interface->getDrawableInfo)(pdp->pdraw, &pdp->index, &pdp->lastStamp, &pdp->x, &pdp->y, &pdp->w, &pdp->h, &pdp->numClipRects, &pdp->pClipRects, @@ -435,8 +436,8 @@ static void driCopySubBuffer( void *drawablePrivate, */ static void *driCreateNewDrawable(__DRIscreen *screen, const __GLcontextModes *modes, - __DRIid draw, __DRIdrawable *pdraw, + drm_drawable_t hwDrawable, int renderType, const int *attrs) { @@ -456,14 +457,7 @@ static void *driCreateNewDrawable(__DRIscreen *screen, return NULL; } - /* Ensure that modes->screen and screen are the same screen? */ - - if (!(*dri_interface->createDrawable)(screen, draw, &pdp->hHWDrawable)) { - _mesa_free(pdp); - return NULL; - } - - pdp->draw = draw; + pdp->hHWDrawable = hwDrawable; pdp->pdraw = pdraw; pdp->refcount = 0; pdp->pStamp = NULL; @@ -484,7 +478,6 @@ static void *driCreateNewDrawable(__DRIscreen *screen, if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, modes, renderType == GLX_PIXMAP_BIT)) { - (void)(*dri_interface->destroyDrawable)(screen, pdp->draw); _mesa_free(pdp); return NULL; } @@ -523,7 +516,6 @@ driDestroyDrawable(void *drawablePrivate) if (pdp) { psp = pdp->driScreenPriv; (*psp->DriverAPI.DestroyBuffer)(pdp); - (void)(*dri_interface->destroyDrawable)(psp->psc, pdp->draw); if (pdp->pClipRects) { _mesa_free(pdp->pClipRects); pdp->pClipRects = NULL; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index cae170c5f81..cb9bb260512 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -248,7 +248,6 @@ struct __DRIdrawablePrivateRec { /** * X's drawable ID associated with this private drawable. */ - __DRIid draw; __DRIdrawable *pdraw; /** diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c index c20a76f29ef..88f2175cc3e 100644 --- a/src/mesa/drivers/dri/mga/mgastate.c +++ b/src/mesa/drivers/dri/mga/mgastate.c @@ -778,8 +778,6 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ) { __DRIdrawablePrivate *const driDrawable = mmesa->driDrawable; __DRIdrawablePrivate *const driReadable = mmesa->driReadable; - drm_mga_sarea_t *sarea = mmesa->sarea; - mmesa->dirty_cliprects = 0; @@ -790,9 +788,6 @@ void mgaUpdateRects( mgaContextPtr mmesa, GLuint buffers ) mga_set_cliprects(mmesa); - sarea->req_drawable = driDrawable->draw; - sarea->req_draw_buffer = mmesa->draw_buffer; - mgaUpdateClipping( mmesa->glCtx ); mgaCalcViewport( mmesa->glCtx ); } -- cgit v1.2.3 From 8ed5c7ca0572a09375bdfd411c3804456dac78d6 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 10 May 2007 18:38:49 -0400 Subject: Drop createContext and destroyContext from DRIinterfaceMethods. As for createDrawable and destroyDrawable, these functions immediately upon entry to driCreateNewContext and immediately before exit from driDestroyContext. Instead of passing function pointers back and forth just obtain the drm_context_t prior to calling DRIscreen::createNewContext and pass it as a parameter. This change also lets us keep the DRI context XID in the libGL loader only. --- include/GL/internal/dri_interface.h | 14 ++------------ src/glx/x11/glxclient.h | 5 +++++ src/glx/x11/glxcmds.c | 14 ++++++++++++++ src/glx/x11/glxext.c | 28 +++------------------------- src/mesa/drivers/dri/common/dri_util.c | 14 +++----------- src/mesa/drivers/dri/common/dri_util.h | 5 ----- 6 files changed, 27 insertions(+), 53 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 0f90f49507a..98271ad0aff 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -183,17 +183,6 @@ struct __DRIinterfaceMethodsRec { */ /*@{*/ - /** - * Create the server-side portion of the GL context. - */ - GLboolean (* createContext)( __DRIscreen *screen, - int configID, void * contextID, drm_context_t * hw_context ); - - /** - * Destroy the server-side portion of the GL context. - */ - GLboolean (* destroyContext)( __DRIscreen *screen, __DRIid context ); - /** * This function is used to get information about the position, size, and * clip rects of a drawable. @@ -345,7 +334,8 @@ struct __DRIscreenRec { void * (*createNewContext)(__DRIscreen *screen, const __GLcontextModes *modes, int render_type, - void *sharedPrivate, __DRIcontext *pctx); + void *sharedPrivate, + drm_context_t hwContext, __DRIcontext *pctx); /** * Method to override base texture image with a driver specific 'offset'. diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 7ed45496581..56973251758 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -361,6 +361,11 @@ struct __GLXcontextRec { * Pointer to the mode used to create this context. */ const __GLcontextModes * mode; + + /** + * XID for the server side drm_context_t + */ + XID hwContextID; #endif /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 229da5a584e..b6c0c763e3b 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -382,6 +382,7 @@ CreateContext(Display *dpy, XVisualInfo *vis, int screen = (fbconfig == NULL) ? vis->screen : fbconfig->screen; __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen); const __GLcontextModes * mode; + drm_context_t hwContext; /* The value of fbconfig cannot change because it is tested * later in the function. @@ -402,10 +403,19 @@ CreateContext(Display *dpy, XVisualInfo *vis, if (psc && psc->driScreen.private) { void * const shared = (shareList != NULL) ? shareList->driContext.private : NULL; + + + if (!XF86DRICreateContextWithConfig(dpy, psc->scr, + mode->fbconfigID, + &gc->hwContextID, &hwContext)) + /* gah, handle this better */ + return NULL; + gc->driContext.private = (*psc->driScreen.createNewContext)( &psc->driScreen, mode, renderType, shared, + hwContext, &gc->driContext ); if (gc->driContext.private) { gc->isDirect = GL_TRUE; @@ -415,6 +425,9 @@ CreateContext(Display *dpy, XVisualInfo *vis, gc->fbconfigID = mode->fbconfigID; gc->mode = mode; } + else { + XF86DRIDestroyContext(dpy, psc->scr, gc->hwContextID); + } } } #endif @@ -524,6 +537,7 @@ DestroyContext(Display *dpy, GLXContext gc) if (gc->isDirect) { if (gc->driContext.private) { (*gc->driContext.destroyContext)(gc->driContext.private); + XF86DRIDestroyContext(dpy, gc->psc->scr, gc->hwContextID); gc->driContext.private = NULL; } GarbageCollectDRIDrawables(dpy, gc->screen); diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index dce01d5528d..85c990d4fc1 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -773,28 +773,6 @@ static void __glXReportDamage(__DRIdrawable *driDraw, #endif } -static GLboolean -__glXDRICreateContext(__DRIscreen *screen, int configID, - void *pid, drm_context_t *hHWContext) -{ - __GLXscreenConfigs *psc = - containerOf(screen, __GLXscreenConfigs, driScreen); - Display *dpy = psc->dpy; - - return XF86DRICreateContextWithConfig(dpy, psc->scr, - configID, pid, hHWContext); -} - -static GLboolean -__glXDRIDestroyContext(__DRIscreen *screen, __DRIid context_id) -{ - __GLXscreenConfigs *psc = - containerOf(screen, __GLXscreenConfigs, driScreen); - Display *dpy = psc->dpy; - - return XF86DRIDestroyContext(dpy, psc->scr, context_id); -} - static GLboolean __glXDRIGetDrawableInfo(__DRIdrawable *drawable, unsigned int *index, unsigned int *stamp, @@ -824,9 +802,6 @@ static const __DRIinterfaceMethods interface_methods = { _gl_context_modes_create, _gl_context_modes_destroy, - - __glXDRICreateContext, - __glXDRIDestroyContext, __glXDRIGetDrawableInfo, @@ -1816,6 +1791,9 @@ USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, if (oldGC->driContext.private) { (*oldGC->driContext.destroyContext) (oldGC->driContext.private); + XF86DRIDestroyContext(oldGC->createDpy, + oldGC->psc->scr, + gc->hwContextID); oldGC->driContext.private = NULL; } } diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index dd7068ad103..31438b82710 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -552,8 +552,6 @@ driDestroyContext(void *contextPrivate) if (pcp) { (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); - (void) (*dri_interface->destroyContext)(pcp->driScreenPriv->psc, - pcp->contextID); _mesa_free(pcp); } } @@ -582,7 +580,8 @@ driDestroyContext(void *contextPrivate) */ static void * driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, - int render_type, void *sharedPrivate, __DRIcontext *pctx) + int render_type, void *sharedPrivate, + drm_context_t hwContext, __DRIcontext *pctx) { __DRIcontextPrivate *pcp; __DRIcontextPrivate *pshare = (__DRIcontextPrivate *) sharedPrivate; @@ -596,12 +595,7 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, return NULL; } - if (! (*dri_interface->createContext)(screen, modes->fbconfigID, - &pcp->contextID, &pcp->hHWContext)) { - _mesa_free(pcp); - return NULL; - } - + pcp->hHWContext = hwContext; pcp->driScreenPriv = psp; pcp->driDrawablePriv = NULL; @@ -610,7 +604,6 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, */ if (!psp->dummyContextPriv.driScreenPriv) { - psp->dummyContextPriv.contextID = 0; psp->dummyContextPriv.hHWContext = psp->pSAREA->dummy_context; psp->dummyContextPriv.driScreenPriv = psp; psp->dummyContextPriv.driDrawablePriv = NULL; @@ -623,7 +616,6 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, pctx->unbindContext = driUnbindContext; if ( !(*psp->DriverAPI.CreateContext)(modes, pcp, shareCtx) ) { - (void) (*dri_interface->destroyContext)(screen, pcp->contextID); _mesa_free(pcp); return NULL; } diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index cb9bb260512..612e24acb2d 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -326,11 +326,6 @@ struct __DRIdrawablePrivateRec { * Per-context private driver information. */ struct __DRIcontextPrivateRec { - /** - * Kernel context handle used to access the device lock. - */ - __DRIid contextID; - /** * Kernel context handle used to access the device lock. */ -- cgit v1.2.3 From aac367f48afc62176faf67aa6f329fbeae2004b4 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Fri, 11 May 2007 16:11:23 -0400 Subject: Remove screenConfigs from __DRIscreen. The screenConfigs field of __DRIscreen points back to the containing __GLXscreenConfigs struct. This is a serious abstraction violation; it assumes that the loader is libGL and that there *is* a __GLXscreenConfigs type in the loader. Using the containerOf macro, we can get from the __DRIscreen pointer to the containing __GLXscreenConfigs struct, at a place in the stack where the above is a valid assumption. Besides, the __DRI* structs shouldn't hold state other than the private pointer. --- include/GL/internal/dri_interface.h | 13 ++----------- src/glx/x11/glxext.c | 1 - src/glx/x11/glxextensions.c | 7 ++++++- src/glx/x11/glxextensions.h | 9 ++++++++- src/mesa/drivers/dri/i915/intel_screen.c | 11 +++++------ src/mesa/drivers/dri/i965/intel_screen.c | 13 ++++++------- src/mesa/drivers/dri/mach64/mach64_screen.c | 9 ++++----- src/mesa/drivers/dri/mga/mga_xmesa.c | 11 +++++------ src/mesa/drivers/dri/r128/r128_screen.c | 9 ++++----- src/mesa/drivers/dri/radeon/radeon_screen.c | 15 +++++++-------- src/mesa/drivers/dri/savage/savage_xmesa.c | 3 +-- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 3 +-- src/mesa/drivers/dri/unichrome/via_screen.c | 11 +++++------ 13 files changed, 54 insertions(+), 61 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 9cb5920aa01..752dd417dcc 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -87,7 +87,8 @@ typedef const char * (* PFNGLXGETDRIVERCONFIGPROC) (const char *driverName); * \c __DRIinterfaceMethods::getProcAddress. This function is used to enable * a GLX extension on the specified screen. */ -typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name ); +typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) (__DRIscreen *screen, + const char *name); /*@}*/ @@ -299,16 +300,6 @@ struct __DRIscreenRec { */ int (*getMSC)( void *screenPrivate, int64_t *msc ); - /** - * Opaque pointer that points back to the containing - * \c __GLXscreenConfigs. This data structure is shared with DRI drivers - * but \c __GLXscreenConfigs is not. However, they are needed by some GLX - * functions called by DRI drivers. - * - * \since Internal API version 20030813. - */ - void *screenConfigs; - /** * Functions associated with MESA_allocate_memory. * diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 85c990d4fc1..45b1dde91b6 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1203,7 +1203,6 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) if (priv->driDisplay.createNewScreen && priv->driDisplay.createNewScreen[i]) { - psc->driScreen.screenConfigs = (void *)psc; psc->driScreen.private = CallCreateNewScreen(dpy, i, psc, & priv->driDisplay, diff --git a/src/glx/x11/glxextensions.c b/src/glx/x11/glxextensions.c index 1d99b61db08..96964d1db10 100644 --- a/src/glx/x11/glxextensions.c +++ b/src/glx/x11/glxextensions.c @@ -356,6 +356,7 @@ __glXProcessServerString( const struct extension_info * ext, } } +#ifdef GLX_DIRECT_RENDERING /** * Enable a named GLX extension on a given screen. @@ -370,14 +371,18 @@ __glXProcessServerString( const struct extension_info * ext, * \since Internal API version 20030813. */ void -__glXScrEnableExtension( __GLXscreenConfigs *psc, const char * name ) +__glXScrEnableExtension( __DRIscreen *driScreen, const char * name ) { + __GLXscreenConfigs *psc = + containerOf(driScreen, __GLXscreenConfigs, driScreen); + __glXExtensionsCtr(); __glXExtensionsCtrScreen(psc); set_glx_extension( known_glx_extensions, name, strlen( name ), GL_TRUE, psc->direct_support ); } +#endif /** * Initialize global extension support tables. diff --git a/src/glx/x11/glxextensions.h b/src/glx/x11/glxextensions.h index a4241b6b7f9..62bbf116e93 100644 --- a/src/glx/x11/glxextensions.h +++ b/src/glx/x11/glxextensions.h @@ -234,7 +234,14 @@ extern GLboolean __glXExtensionBitIsEnabled( struct __GLXscreenConfigsRec *psc, extern const char * __glXGetClientExtensions( void ); extern void __glXCalculateUsableExtensions( struct __GLXscreenConfigsRec *psc, GLboolean display_is_direct_capable, int server_minor_version ); -extern void __glXScrEnableExtension( struct __GLXscreenConfigsRec *psc, const char * name ); + +#ifdef GLX_DIRECT_RENDERING + +struct __DRIscreenRec; +extern void __glXScrEnableExtension( struct __DRIscreenRec *driScreen, const char * name ); + +#endif + extern void __glXCalculateUsableGLExtensions( struct __GLXcontextRec * gc, const char * server_string, int major_version, int minor_version ); extern void __glXGetGLVersion( int * major_version, int * minor_version ); diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 7a11672a8f1..6ecde574b4f 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -430,7 +430,6 @@ intelInitDriver(__DRIscreenPrivate * sPriv) PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface-> getProcAddress("glxEnableExtension")); - void *const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(I830DRIRec)) { fprintf(stderr, @@ -524,11 +523,11 @@ intelInitDriver(__DRIscreenPrivate * sPriv) } if (glx_enable_extension != NULL) { - (*glx_enable_extension) (psc, "GLX_SGI_swap_control"); - (*glx_enable_extension) (psc, "GLX_SGI_video_sync"); - (*glx_enable_extension) (psc, "GLX_MESA_swap_control"); - (*glx_enable_extension) (psc, "GLX_MESA_swap_frame_usage"); - (*glx_enable_extension) (psc, "GLX_SGI_make_current_read"); + (*glx_enable_extension) (sPriv->psc, "GLX_SGI_swap_control"); + (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); + (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_control"); + (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_frame_usage"); + (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); } /* If we've got a new enough DDX that's initializing TTM and giving us diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 29ea07d78ef..97ccba09d82 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -271,7 +271,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; volatile drmI830Sarea *sarea; if (sPriv->devPrivSize != sizeof(I830DRIRec)) { @@ -352,12 +351,12 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) } if (glx_enable_extension != NULL) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); - (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_copy_sub_buffer" ); } return GL_TRUE; diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 52b96bf0bc0..733a16b6aef 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -210,7 +210,6 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(ATIDRIRec)) { fprintf(stderr,"\nERROR! sizeof(ATIDRIRec) does not match passed size from device driver\n"); @@ -321,12 +320,12 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) if ( glx_enable_extension != NULL ) { if ( mach64Screen->irq != 0 ) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } return mach64Screen; diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 372d2ce4339..5b9d09d0bf3 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -200,7 +200,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(MGADRIRec)) { fprintf(stderr,"\nERROR! sizeof(MGADRIRec) does not match passed size from device driver\n"); @@ -236,11 +235,11 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) } if ( glx_enable_extension != NULL ) { - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); - (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } if (serverInfo->chipset != MGA_CARD_TYPE_G200 && diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index a84b54924ac..9df9c65faef 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -100,7 +100,6 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(R128DRIRec)) { fprintf(stderr,"\nERROR! sizeof(R128DRIRec) does not match passed size from device driver\n"); @@ -228,12 +227,12 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) if ( glx_enable_extension != NULL ) { if ( r128Screen->irq != 0 ) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } return r128Screen; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 2d44532a843..8f9509de5b2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -343,7 +343,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) unsigned char *RADEONMMIO; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) { fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n"); @@ -734,17 +733,17 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) if ( glx_enable_extension != NULL ) { if ( screen->irq != 0 ) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); if (IS_R200_CLASS(screen)) - (*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_allocate_memory" ); - (*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" ); - (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_copy_sub_buffer" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index e8a63ae51b9..9678c526aa0 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -266,8 +266,7 @@ savageInitDriver(__DRIscreenPrivate *sPriv) __driConfigOptions, __driNConfigOptions); if (glx_enable_extension != NULL) { - (*glx_enable_extension)(sPriv->psc->screenConfigs, - "GLX_SGI_make_current_read"); + (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read"); } #if 0 diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 899963d06d3..e9033c5ef3a 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -75,7 +75,6 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv ) TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void *const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(TDFXDRIRec)) { fprintf(stderr,"\nERROR! sizeof(TDFXDRIRec) does not match passed size from device driver\n"); @@ -117,7 +116,7 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv ) } if (glx_enable_extension != NULL) { - (*glx_enable_extension)(psc, "GLX_SGI_make_current_read"); + (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read"); } return GL_TRUE; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index c10b7d1a9b1..22e4bcebc91 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -100,7 +100,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv) VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - void * const psc = sPriv->psc->screenConfigs; if (sPriv->devPrivSize != sizeof(VIADRIRec)) { fprintf(stderr,"\nERROR! sizeof(VIADRIRec) does not match passed size from device driver\n"); @@ -177,13 +176,13 @@ viaInitDriver(__DRIscreenPrivate *sPriv) if ( glx_enable_extension != NULL ) { if ( viaScreen->irqEnabled ) { - (*glx_enable_extension)( psc, "GLX_SGI_swap_control" ); - (*glx_enable_extension)( psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } - (*glx_enable_extension)( psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( psc, "GLX_MESA_swap_frame_usage" ); + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); + (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } return GL_TRUE; -- cgit v1.2.3 From 5987a03f994af2bb413d1cf984ab01aa095c0943 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Fri, 11 May 2007 16:43:20 -0400 Subject: Convert all DRI entrypoints to take pointers to __DRI* types. The entrypoints take a mix of __DRIscreen * and void * (screen private) arguments (similarly for contexts and drawables). This patch does away with passing the private void pointer and always only passes the fully typed __DRIscreen pointer and always as the first argument. This makes the interface more consistent and increases type safety, and catches a bug where we would pass a screen private to DRIdrawable::getSBC. --- include/GL/internal/dri_interface.h | 40 +++++++++--------- src/glx/x11/glxcmds.c | 42 +++++++++---------- src/glx/x11/glxext.c | 8 ++-- src/mesa/drivers/dri/common/dri_util.c | 74 +++++++++++++++++----------------- 4 files changed, 80 insertions(+), 84 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 752dd417dcc..178134270d1 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -273,7 +273,7 @@ struct __DRIscreenRec { /** * Method to destroy the private DRI screen data. */ - void (*destroyScreen)(void *screenPrivate); + void (*destroyScreen)(__DRIscreen *screen); /** * Method to create the private DRI drawable data and initialize the @@ -298,7 +298,7 @@ struct __DRIscreenRec { * * \since Internal API version 20030317. */ - int (*getMSC)( void *screenPrivate, int64_t *msc ); + int (*getMSC)(__DRIscreen *screen, int64_t *msc); /** * Functions associated with MESA_allocate_memory. @@ -348,7 +348,7 @@ struct __DRIcontextRec { /** * Method to destroy the private DRI context data. */ - void (*destroyContext)(void *contextPrivate); + void (*destroyContext)(__DRIcontext *context); /** * Opaque pointer to private per context direct rendering data. @@ -362,9 +362,9 @@ struct __DRIcontextRec { * * \since Internal API version 20050727. */ - GLboolean (*bindContext)(__DRIdrawable *pdraw, - __DRIdrawable *pread, - __DRIcontext *ctx); + GLboolean (*bindContext)(__DRIcontext *ctx, + __DRIdrawable *pdraw, + __DRIdrawable *pread); /** * Method to unbind a DRI drawable from a DRI graphics context. @@ -384,12 +384,12 @@ struct __DRIdrawableRec { /** * Method to destroy the private DRI drawable data. */ - void (*destroyDrawable)(void *drawablePrivate); + void (*destroyDrawable)(__DRIdrawable *drawable); /** * Method to swap the front and back buffers. */ - void (*swapBuffers)(void *drawablePrivate); + void (*swapBuffers)(__DRIdrawable *drawable); /** * Opaque pointer to private per drawable direct rendering data. @@ -403,16 +403,16 @@ struct __DRIdrawableRec { * * \since Internal API version 20030317. */ - int (*getSBC)(void *drawablePrivate, int64_t *sbc ); + int (*getSBC)(__DRIdrawable *drawable, int64_t *sbc); /** * Wait for the SBC to be greater than or equal target_sbc. * * \since Internal API version 20030317. */ - int (*waitForSBC)( void *drawablePriv, - int64_t target_sbc, - int64_t * msc, int64_t * sbc ); + int (*waitForSBC)(__DRIdrawable *drawable, + int64_t target_sbc, + int64_t * msc, int64_t * sbc); /** * Wait for the MSC to equal target_msc, or, if that has already passed, @@ -422,9 +422,9 @@ struct __DRIdrawableRec { * * \since Internal API version 20030317. */ - int (*waitForMSC)( void *drawablePriv, - int64_t target_msc, int64_t divisor, int64_t remainder, - int64_t * msc, int64_t * sbc ); + int (*waitForMSC)(__DRIdrawable *drawable, + int64_t target_msc, int64_t divisor, int64_t remainder, + int64_t * msc, int64_t * sbc); /** * Like \c swapBuffers, but does NOT have an implicit \c glFlush. Once @@ -435,7 +435,7 @@ struct __DRIdrawableRec { * * \since Internal API version 20030317. */ - int64_t (*swapBuffersMSC)(void *drawablePrivate, + int64_t (*swapBuffersMSC)(__DRIdrawable *drawable, int64_t target_msc, int64_t divisor, int64_t remainder); @@ -444,16 +444,16 @@ struct __DRIdrawableRec { * * \since Internal API version 20030317. */ - int (*frameTracking)(void *drawablePrivate, GLboolean enable); + int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable); /** * Retrieve frame usage information. * * \since Internal API version 20030317. */ - int (*queryFrameTracking)(void *drawablePrivate, + int (*queryFrameTracking)(__DRIdrawable *drawable, int64_t * sbc, int64_t * missedFrames, - float * lastMissedUsage, float * usage ); + float * lastMissedUsage, float * usage); /** * Used by drivers that implement the GLX_SGI_swap_control or @@ -468,7 +468,7 @@ struct __DRIdrawableRec { * * \since Internal API version 20060314. */ - void (*copySubBuffer)(void *drawablePrivate, + void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h); }; diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 31316463811..6b8824d8243 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -99,7 +99,7 @@ static void GarbageCollectDRIDrawables(Display *dpy, __GLXscreenConfigs *sc) if (!windowExistsFlag) { /* Destroy the local drawable data, if the drawable no longer exists in the Xserver */ - (*pdraw->driDrawable.destroyDrawable)(pdraw->driDrawable.private); + (*pdraw->driDrawable.destroyDrawable)(&pdraw->driDrawable); XF86DRIDestroyDrawable(dpy, sc->scr, draw); Xfree(pdraw); } @@ -530,7 +530,7 @@ DestroyContext(Display *dpy, GLXContext gc) /* Destroy the direct rendering context */ if (gc->isDirect) { if (gc->driContext.private) { - (*gc->driContext.destroyContext)(gc->driContext.private); + (*gc->driContext.destroyContext)(&gc->driContext); XF86DRIDestroyContext(dpy, gc->psc->scr, gc->hwContextID); gc->driContext.private = NULL; } @@ -859,7 +859,7 @@ PUBLIC void glXSwapBuffers(Display *dpy, GLXDrawable drawable) __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, NULL ); if ( pdraw != NULL ) { - (*pdraw->swapBuffers)(pdraw->private); + (*pdraw->swapBuffers)(pdraw); return; } #endif @@ -1845,7 +1845,7 @@ static GLint __glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable) if ( (pdraw != NULL) && (pdraw->frameTracking != NULL) && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { - status = pdraw->frameTracking( pdraw->private, GL_TRUE ); + status = pdraw->frameTracking(pdraw, GL_TRUE); } #else (void) dpy; @@ -1865,7 +1865,7 @@ static GLint __glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable) if ( (pdraw != NULL) && (pdraw->frameTracking != NULL) && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { - status = pdraw->frameTracking( pdraw->private, GL_FALSE ); + status = pdraw->frameTracking(pdraw, GL_FALSE); } #else (void) dpy; @@ -1889,9 +1889,8 @@ static GLint __glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, int64_t sbc, missedFrames; float lastMissedUsage; - status = pdraw->queryFrameTracking( pdraw->private, &sbc, - &missedFrames, &lastMissedUsage, - usage ); + status = pdraw->queryFrameTracking(pdraw, &sbc, &missedFrames, + &lastMissedUsage, usage); } #else (void) dpy; @@ -1916,9 +1915,8 @@ static GLint __glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { float usage; - status = pdraw->queryFrameTracking( pdraw->private, sbc, - missedFrames, lastMissedUsage, - & usage ); + status = pdraw->queryFrameTracking(pdraw, sbc, missedFrames, + lastMissedUsage, &usage); } #else (void) dpy; @@ -1952,7 +1950,7 @@ static int __glXGetVideoSyncSGI(unsigned int *count) int ret; int64_t temp; - ret = psc->driScreen.getMSC( psc->driScreen.private, & temp ); + ret = psc->driScreen.getMSC(&psc->driScreen, &temp); *count = (unsigned) temp; return (ret == 0) ? 0 : GLX_BAD_CONTEXT; } @@ -1983,9 +1981,8 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count int64_t msc; int64_t sbc; - ret = (*pdraw->waitForMSC)( pdraw->private, - 0, divisor, remainder, - & msc, & sbc ); + ret = (*pdraw->waitForMSC)(pdraw, 0, + divisor, remainder, &msc, &sbc); *count = (unsigned) msc; return (ret == 0) ? 0 : GLX_BAD_CONTEXT; } @@ -2151,8 +2148,8 @@ static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable, assert( (pdraw == NULL) || (i != -1) ); return ( (pdraw && pdraw->getSBC && psc->driScreen.getMSC) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) - && ((*psc->driScreen.getMSC)( psc->driScreen.private, msc ) == 0) - && ((*pdraw->getSBC)( psc->driScreen.private, sbc ) == 0) + && ((*psc->driScreen.getMSC)(&psc->driScreen, msc) == 0) + && ((*pdraw->getSBC)(pdraw, sbc ) == 0) && (__glXGetUST( ust ) == 0) ); } #else @@ -2275,8 +2272,7 @@ static int64_t __glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable, if ( (pdraw != NULL) && (pdraw->swapBuffersMSC != NULL) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) { - return (*pdraw->swapBuffersMSC)(pdraw->private, target_msc, - divisor, remainder); + return (*pdraw->swapBuffersMSC)(pdraw, target_msc, divisor, remainder); } #else (void) dpy; @@ -2310,8 +2306,8 @@ static Bool __glXWaitForMscOML(Display * dpy, GLXDrawable drawable, if ( (pdraw != NULL) && (pdraw->waitForMSC != NULL) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) { - ret = (*pdraw->waitForMSC)( pdraw->private, target_msc, - divisor, remainder, msc, sbc ); + ret = (*pdraw->waitForMSC)(pdraw, target_msc, + divisor, remainder, msc, sbc); /* __glXGetUST returns zero on success and non-zero on failure. * This function returns True on success and False on failure. @@ -2350,7 +2346,7 @@ static Bool __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable, if ( (pdraw != NULL) && (pdraw->waitForSBC != NULL) && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit )) { - ret = (*pdraw->waitForSBC)( pdraw->private, target_sbc, msc, sbc ); + ret = (*pdraw->waitForSBC)(pdraw, target_sbc, msc, sbc); /* __glXGetUST returns zero on success and non-zero on failure. * This function returns True on success and False on failure. @@ -2508,7 +2504,7 @@ static void __glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, if ( pdraw != NULL ) { __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen ); if ( __glXExtensionBitIsEnabled( psc, MESA_copy_sub_buffer_bit ) ) { - (*pdraw->copySubBuffer)(pdraw->private, x, y, width, height); + (*pdraw->copySubBuffer)(pdraw, x, y, width, height); } return; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 45b1dde91b6..8c12ae254ad 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -360,7 +360,7 @@ static void FreeScreenConfigs(__GLXdisplayPrivate *priv) #ifdef GLX_DIRECT_RENDERING /* Free the direct rendering per screen data */ if (psc->driScreen.private) - (*psc->driScreen.destroyScreen)(psc->driScreen.private); + (*psc->driScreen.destroyScreen)(&psc->driScreen); psc->driScreen.private = NULL; __glxHashDestroy(psc->drawHash); #endif @@ -1656,7 +1656,7 @@ FetchDRIDrawable( Display *dpy, GLXDrawable drawable, GLXContext gc) } if (__glxHashInsert(sc->drawHash, drawable, pdraw)) { - (*pdraw->driDrawable.destroyDrawable)(pdraw->driDrawable.private); + (*pdraw->driDrawable.destroyDrawable)(&pdraw->driDrawable); XF86DRIDestroyDrawable(dpy, sc->scr, drawable); Xfree(pdraw); return NULL; @@ -1671,7 +1671,7 @@ static Bool BindContextWrapper( Display *dpy, GLXContext gc, __DRIdrawable *pdraw = FetchDRIDrawable(dpy, draw, gc); __DRIdrawable *pread = FetchDRIDrawable(dpy, read, gc); - return (*gc->driContext.bindContext)(pdraw, pread, &gc->driContext); + return (*gc->driContext.bindContext)(&gc->driContext, pdraw, pread); } @@ -1789,7 +1789,7 @@ USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw, if (oldGC->isDirect) { if (oldGC->driContext.private) { (*oldGC->driContext.destroyContext) - (oldGC->driContext.private); + (&oldGC->driContext); XF86DRIDestroyContext(oldGC->createDpy, oldGC->psc->scr, gc->hwContextID); diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 31438b82710..48cde4c4e37 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -53,7 +53,7 @@ static const int empty_attribute_list[1] = { None }; static int api_ver = 0; /* forward declarations */ -static int driQueryFrameTracking( void *priv, +static int driQueryFrameTracking( __DRIdrawable *drawable, int64_t *sbc, int64_t *missedFrames, float *lastMissedUsage, float *usage ); @@ -63,7 +63,7 @@ static void *driCreateNewDrawable(__DRIscreen *screen, drm_drawable_t hwDrawable, int renderType, const int *attrs); -static void driDestroyDrawable(void *drawablePrivate); +static void driDestroyDrawable(__DRIdrawable *drawable); /** @@ -169,9 +169,9 @@ static GLboolean driUnbindContext(__DRIcontext *ctx) * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. */ -static GLboolean DoBindContext(__DRIdrawable *pdraw, - __DRIdrawable *pread, - __DRIcontext *ctx) +static GLboolean DoBindContext(__DRIcontext *ctx, + __DRIdrawable *pdraw, + __DRIdrawable *pread) { __DRIdrawablePrivate *pdp; __DRIdrawablePrivate *prp; @@ -218,9 +218,9 @@ static GLboolean DoBindContext(__DRIdrawable *pdraw, * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent * function. */ -static GLboolean driBindContext(__DRIdrawable *pdraw, - __DRIdrawable *pread, - __DRIcontext * ctx) +static GLboolean driBindContext(__DRIcontext * ctx, + __DRIdrawable *pdraw, + __DRIdrawable *pread) { /* ** Assume error checking is done properly in glXMakeCurrent before @@ -230,7 +230,7 @@ static GLboolean driBindContext(__DRIdrawable *pdraw, if (ctx == NULL || pdraw == None || pread == None) return GL_FALSE; - return DoBindContext( pdraw, pread, ctx ); + return DoBindContext( ctx, pdraw, pread ); } /*@}*/ @@ -328,9 +328,9 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) * * Is called directly from glXSwapBuffers(). */ -static void driSwapBuffers(void *drawablePrivate) +static void driSwapBuffers(__DRIdrawable *drawable) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; + __DRIdrawablePrivate *dPriv = drawable->private; drm_clip_rect_t rect; dPriv->swapBuffers(dPriv); @@ -356,9 +356,9 @@ static void driSwapBuffers(void *drawablePrivate) /** * Called directly from a number of higher-level GLX functions. */ -static int driGetMSC( void *screenPrivate, int64_t *msc ) +static int driGetMSC( __DRIscreen *screen, int64_t *msc ) { - __DRIscreenPrivate *sPriv = (__DRIscreenPrivate *) screenPrivate; + __DRIscreenPrivate *sPriv = screen->private; return sPriv->DriverAPI.GetMSC( sPriv, msc ); } @@ -366,9 +366,9 @@ static int driGetMSC( void *screenPrivate, int64_t *msc ) /** * Called directly from a number of higher-level GLX functions. */ -static int driGetSBC( void *drawablePrivate, int64_t *sbc ) +static int driGetSBC(__DRIdrawable *drawable, int64_t *sbc) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; + __DRIdrawablePrivate *dPriv = drawable->private; __DRIswapInfo sInfo; int status; @@ -379,20 +379,20 @@ static int driGetSBC( void *drawablePrivate, int64_t *sbc ) return status; } -static int driWaitForSBC( void *drawablePriv, int64_t target_sbc, - int64_t * msc, int64_t * sbc ) +static int driWaitForSBC(__DRIdrawable *drawable, int64_t target_sbc, + int64_t * msc, int64_t * sbc) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv; + __DRIdrawablePrivate *dPriv = drawable->private; return dPriv->driScreenPriv->DriverAPI.WaitForSBC( dPriv, target_sbc, msc, sbc ); } -static int driWaitForMSC( void *drawablePriv, int64_t target_msc, - int64_t divisor, int64_t remainder, - int64_t * msc, int64_t * sbc ) +static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, + int64_t divisor, int64_t remainder, + int64_t * msc, int64_t * sbc) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv; + __DRIdrawablePrivate *dPriv = drawable->private; __DRIswapInfo sInfo; int status; @@ -414,20 +414,20 @@ static int driWaitForMSC( void *drawablePriv, int64_t target_msc, return status; } -static int64_t driSwapBuffersMSC( void *drawablePriv, int64_t target_msc, - int64_t divisor, int64_t remainder ) +static int64_t driSwapBuffersMSC(__DRIdrawable *drawable, int64_t target_msc, + int64_t divisor, int64_t remainder) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePriv; + __DRIdrawablePrivate *dPriv = drawable->private; return dPriv->driScreenPriv->DriverAPI.SwapBuffersMSC( dPriv, target_msc, divisor, remainder ); } -static void driCopySubBuffer( void *drawablePrivate, +static void driCopySubBuffer(__DRIdrawable *drawable, int x, int y, int w, int h) { - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; + __DRIdrawablePrivate *dPriv = drawable->private; dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); } @@ -508,9 +508,9 @@ static void *driCreateNewDrawable(__DRIscreen *screen, } static void -driDestroyDrawable(void *drawablePrivate) +driDestroyDrawable(__DRIdrawable *drawable) { - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *) drawablePrivate; + __DRIdrawablePrivate *pdp = drawable->private; __DRIscreenPrivate *psp; if (pdp) { @@ -546,9 +546,9 @@ driDestroyDrawable(void *drawablePrivate) * drmDestroyContext(), and finally frees \p contextPrivate. */ static void -driDestroyContext(void *contextPrivate) +driDestroyContext(__DRIcontext *context) { - __DRIcontextPrivate *pcp = (__DRIcontextPrivate *) contextPrivate; + __DRIcontextPrivate *pcp = context->private; if (pcp) { (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); @@ -641,9 +641,9 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls * drmClose(), and finally frees \p screenPrivate. */ -static void driDestroyScreen(void *screenPrivate) +static void driDestroyScreen(__DRIscreen *screen) { - __DRIscreenPrivate *psp = (__DRIscreenPrivate *) screenPrivate; + __DRIscreenPrivate *psp = screen->private; if (psp) { /* No interaction with the X-server is possible at this point. This @@ -808,14 +808,14 @@ int driCompareGLXAPIVersion( GLint required_version ) static int -driQueryFrameTracking( void * priv, - int64_t * sbc, int64_t * missedFrames, - float * lastMissedUsage, float * usage ) +driQueryFrameTracking(__DRIdrawable *drawable, + int64_t * sbc, int64_t * missedFrames, + float * lastMissedUsage, float * usage) { __DRIswapInfo sInfo; int status; int64_t ust; - __DRIdrawablePrivate * dpriv = (__DRIdrawablePrivate *) priv; + __DRIdrawablePrivate * dpriv = drawable->private; status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo ); -- cgit v1.2.3 From efd03a278ae55b454509e9659c42899133983ebd Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Mon, 14 May 2007 16:37:19 -0400 Subject: Replace open-coded major, minor, and patch version fields with __DRIversionRec. --- src/mesa/drivers/dri/common/dri_util.c | 12 +++--------- src/mesa/drivers/dri/common/dri_util.h | 24 +++--------------------- src/mesa/drivers/dri/i915/intel_buffers.c | 2 +- src/mesa/drivers/dri/i915/intel_screen.c | 10 +++++----- src/mesa/drivers/dri/i965/intel_screen.c | 2 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 4 ++-- src/mesa/drivers/dri/mga/mgaioctl.c | 4 ++-- src/mesa/drivers/dri/r128/r128_context.c | 2 +- src/mesa/drivers/dri/r128/r128_screen.c | 2 +- src/mesa/drivers/dri/r200/r200_context.c | 8 ++++---- src/mesa/drivers/dri/r300/radeon_context.c | 2 +- src/mesa/drivers/dri/radeon/radeon_context.c | 8 ++++---- src/mesa/drivers/dri/radeon/radeon_screen.c | 20 ++++++++++---------- src/mesa/drivers/dri/savage/savage_xmesa.c | 2 +- src/mesa/drivers/dri/savage/savagetex.c | 4 ++-- 15 files changed, 41 insertions(+), 65 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 48cde4c4e37..09fc2230fdc 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -727,15 +727,9 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc, */ psp->drawLockID = 1; - psp->drmMajor = drm_version->major; - psp->drmMinor = drm_version->minor; - psp->drmPatch = drm_version->patch; - psp->ddxMajor = ddx_version->major; - psp->ddxMinor = ddx_version->minor; - psp->ddxPatch = ddx_version->patch; - psp->driMajor = dri_version->major; - psp->driMinor = dri_version->minor; - psp->driPatch = dri_version->patch; + psp->drm_version = *drm_version; + psp->ddx_version = *ddx_version; + psp->dri_version = *dri_version; /* install driver's callback functions */ memcpy( &psp->DriverAPI, driverAPI, sizeof(struct __DriverAPIRec) ); diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 612e24acb2d..7a70bc7aa60 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -372,37 +372,19 @@ struct __DRIscreenPrivateRec { struct __DriverAPIRec DriverAPI; /** - * \name DDX version * DDX / 2D driver version information. - * \todo Replace these fields with a \c __DRIversionRec. */ - /*@{*/ - int ddxMajor; - int ddxMinor; - int ddxPatch; - /*@}*/ + __DRIversion ddx_version; /** - * \name DRI version * DRI X extension version information. - * \todo Replace these fields with a \c __DRIversionRec. */ - /*@{*/ - int driMajor; - int driMinor; - int driPatch; - /*@}*/ + __DRIversion dri_version; /** - * \name DRM version * DRM (kernel module) version information. - * \todo Replace these fields with a \c __DRIversionRec. */ - /*@{*/ - int drmMajor; - int drmMinor; - int drmPatch; - /*@}*/ + __DRIversion drm_version; /** * ID used when the client sets the drawable lock. diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c b/src/mesa/drivers/dri/i915/intel_buffers.c index bd2e67fbed4..46a67b141e7 100644 --- a/src/mesa/drivers/dri/i915/intel_buffers.c +++ b/src/mesa/drivers/dri/i915/intel_buffers.c @@ -231,7 +231,7 @@ intelWindowMoved(struct intel_context *intel) } } - if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) { + if (intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) { drmI830Sarea *sarea = intel->sarea; drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w, .y1 = dPriv->y, .y2 = dPriv->y + dPriv->h }; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 6ecde574b4f..58dc02e24e7 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -217,7 +217,7 @@ intel_recreate_static_regions(intelScreenPrivate *intelScreen) /* The rotated region is only used for old DDXes that didn't handle rotation \ * on their own. */ - if (intelScreen->driScrnPriv->ddxMinor < 8) { + if (intelScreen->driScrnPriv->ddx_version.minor < 8) { intelScreen->rotated_region = intel_recreate_static(intelScreen, intelScreen->rotated_region, @@ -377,7 +377,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelScreen->back.handle = sarea->back_handle; intelScreen->back.size = sarea->back_size; - if (intelScreen->driScrnPriv->ddxMinor >= 8) { + if (intelScreen->driScrnPriv->ddx_version.minor >= 8) { intelScreen->third.offset = sarea->third_offset; intelScreen->third.pitch = sarea->pitch * intelScreen->cpp; intelScreen->third.handle = sarea->third_handle; @@ -389,7 +389,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelScreen->depth.handle = sarea->depth_handle; intelScreen->depth.size = sarea->depth_size; - if (intelScreen->driScrnPriv->ddxMinor >= 9) { + if (intelScreen->driScrnPriv->ddx_version.minor >= 9) { intelScreen->front.bo_handle = sarea->front_bo_handle; intelScreen->back.bo_handle = sarea->back_bo_handle; intelScreen->third.bo_handle = sarea->third_bo_handle; @@ -488,7 +488,7 @@ intelInitDriver(__DRIscreenPrivate * sPriv) if (0) intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv); - intelScreen->drmMinor = sPriv->drmMinor; + intelScreen->drmMinor = sPriv->drm_version.minor; /* Determine if IRQs are active? */ { @@ -535,7 +535,7 @@ intelInitDriver(__DRIscreenPrivate * sPriv) */ intelScreen->ttm = GL_FALSE; if (getenv("INTEL_NO_TTM") == NULL && - intelScreen->driScrnPriv->ddxMinor >= 9 && + intelScreen->driScrnPriv->ddx_version.minor >= 9 && intelScreen->front.bo_handle != -1) { intelScreen->bufmgr = dri_bufmgr_ttm_init(sPriv->fd, DRM_FENCE_TYPE_EXE, diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 97ccba09d82..cb6824b7ee1 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -316,7 +316,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) return GL_FALSE; } - intelScreen->drmMinor = sPriv->drmMinor; + intelScreen->drmMinor = sPriv->drm_version.minor; /* Determine if IRQs are active? */ { diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 5b9d09d0bf3..b001f8696a6 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -216,7 +216,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->sPriv = sPriv; sPriv->private = (void *)mgaScreen; - if (sPriv->drmMinor >= 1) { + if (sPriv->drm_version.minor >= 1) { int ret; drm_mga_getparam_t gp; @@ -273,7 +273,7 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) * there is a new, in-kernel mechanism for handling the wait. */ - if (mgaScreen->sPriv->drmMinor < 2) { + if (mgaScreen->sPriv->drm_version.minor < 2) { mgaScreen->mmio.handle = serverInfo->registers.handle; mgaScreen->mmio.size = serverInfo->registers.size; if ( drmMap( sPriv->fd, diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c index f8587fc541e..679d6889259 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.c +++ b/src/mesa/drivers/dri/mga/mgaioctl.c @@ -55,7 +55,7 @@ mgaSetFence( mgaContextPtr mmesa, uint32_t * fence ) { int ret = ENOSYS; - if ( mmesa->driScreen->drmMinor >= 2 ) { + if ( mmesa->driScreen->drm_version.minor >= 2 ) { ret = drmCommandWriteRead( mmesa->driScreen->fd, DRM_MGA_SET_FENCE, fence, sizeof( uint32_t )); if (ret) { @@ -73,7 +73,7 @@ mgaWaitFence( mgaContextPtr mmesa, uint32_t fence, uint32_t * curr_fence ) { int ret = ENOSYS; - if ( mmesa->driScreen->drmMinor >= 2 ) { + if ( mmesa->driScreen->drm_version.minor >= 2 ) { uint32_t temp = fence; ret = drmCommandWriteRead( mmesa->driScreen->fd, diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index 95e54a6af50..c9fe11f38bd 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -254,7 +254,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, _tnl_allow_vertex_fog( ctx, GL_TRUE ); driInitExtensions( ctx, card_extensions, GL_TRUE ); - if (sPriv->drmMinor >= 4) + if (sPriv->drm_version.minor >= 4) _mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" ); r128InitTriFuncs( ctx ); diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 9df9c65faef..01b33d64934 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -120,7 +120,7 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128Screen->IsPCI = r128DRIPriv->IsPCI; r128Screen->sarea_priv_offset = r128DRIPriv->sarea_priv_offset; - if (sPriv->drmMinor >= 3) { + if (sPriv->drm_version.minor >= 3) { drm_r128_getparam_t gp; int ret; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 5a178442bdb..8f43a2f3128 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -277,14 +277,14 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, "def_max_anisotropy"); if ( driQueryOptionb( &rmesa->optionCache, "hyperz" ) ) { - if ( sPriv->drmMinor < 13 ) + if ( sPriv->drm_version.minor < 13 ) fprintf( stderr, "DRM version 1.%d too old to support HyperZ, " - "disabling.\n",sPriv->drmMinor ); + "disabling.\n", sPriv->drm_version.minor ); else rmesa->using_hyperz = GL_TRUE; } - if ( sPriv->drmMinor >= 15 ) + if ( sPriv->drm_version.minor >= 15 ) rmesa->texmicrotile = GL_TRUE; /* Init default driver functions then plug in our R200-specific functions @@ -317,7 +317,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, rmesa->dri.hwContext = driContextPriv->hHWContext; rmesa->dri.hwLock = &sPriv->pSAREA->lock; rmesa->dri.fd = sPriv->fd; - rmesa->dri.drmMinor = sPriv->drmMinor; + rmesa->dri.drmMinor = sPriv->drm_version.minor; rmesa->r200Screen = screen; rmesa->sarea = (drm_radeon_sarea_t *)((GLubyte *)sPriv->pSAREA + diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index e9634b427a6..6dfaf3c6472 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -156,7 +156,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, radeon->dri.hwContext = driContextPriv->hHWContext; radeon->dri.hwLock = &sPriv->pSAREA->lock; radeon->dri.fd = sPriv->fd; - radeon->dri.drmMinor = sPriv->drmMinor; + radeon->dri.drmMinor = sPriv->drm_version.minor; radeon->radeonScreen = screen; radeon->sarea = (drm_radeon_sarea_t *) ((GLubyte *) sPriv->pSAREA + diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index b302275c714..defc82fa26b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -233,14 +233,14 @@ radeonCreateContext( const __GLcontextModes *glVisual, "def_max_anisotropy"); if ( driQueryOptionb( &rmesa->optionCache, "hyperz" ) ) { - if ( sPriv->drmMinor < 13 ) + if ( sPriv->drm_version.minor < 13 ) fprintf( stderr, "DRM version 1.%d too old to support HyperZ, " - "disabling.\n",sPriv->drmMinor ); + "disabling.\n", sPriv->drm_version.minor ); else rmesa->using_hyperz = GL_TRUE; } - if ( sPriv->drmMinor >= 15 ) + if ( sPriv->drm_version.minor >= 15 ) rmesa->texmicrotile = GL_TRUE; /* Init default driver functions then plug in our Radeon-specific functions @@ -271,7 +271,7 @@ radeonCreateContext( const __GLcontextModes *glVisual, rmesa->dri.hwContext = driContextPriv->hHWContext; rmesa->dri.hwLock = &sPriv->pSAREA->lock; rmesa->dri.fd = sPriv->fd; - rmesa->dri.drmMinor = sPriv->drmMinor; + rmesa->dri.drmMinor = sPriv->drm_version.minor; rmesa->radeonScreen = screen; rmesa->sarea = (drm_radeon_sarea_t *)((GLubyte *)sPriv->pSAREA + diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 8f9509de5b2..9801322cd8b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -395,13 +395,13 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) fprintf(stderr, "drm_radeon_getparam_t (RADEON_PARAM_IRQ_NR): %d\n", ret); return NULL; } - screen->drmSupportsCubeMapsR200 = (sPriv->drmMinor >= 7); - screen->drmSupportsBlendColor = (sPriv->drmMinor >= 11); - screen->drmSupportsTriPerf = (sPriv->drmMinor >= 16); - screen->drmSupportsFragShader = (sPriv->drmMinor >= 18); - screen->drmSupportsPointSprites = (sPriv->drmMinor >= 13); - screen->drmSupportsCubeMapsR100 = (sPriv->drmMinor >= 15); - screen->drmSupportsVertexProgram = (sPriv->drmMinor >= 25); + screen->drmSupportsCubeMapsR200 = (sPriv->drm_version.minor >= 7); + screen->drmSupportsBlendColor = (sPriv->drm_version.minor >= 11); + screen->drmSupportsTriPerf = (sPriv->drm_version.minor >= 16); + screen->drmSupportsFragShader = (sPriv->drm_version.minor >= 18); + screen->drmSupportsPointSprites = (sPriv->drm_version.minor >= 13); + screen->drmSupportsCubeMapsR100 = (sPriv->drm_version.minor >= 15); + screen->drmSupportsVertexProgram = (sPriv->drm_version.minor >= 25); } screen->mmio.handle = dri_priv->registerHandle; @@ -666,7 +666,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) return NULL; } if ((screen->chip_family == CHIP_FAMILY_R350 || screen->chip_family == CHIP_FAMILY_R300) && - sPriv->ddxMinor < 2) { + sPriv->ddx_version.minor < 2) { fprintf(stderr, "xf86-video-ati-6.6.2 or newer needed for Radeon 9500/9700/9800 cards.\n"); return NULL; } @@ -683,7 +683,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->fbLocation = ( INREG( RADEON_MC_FB_LOCATION ) & 0xffff ) << 16; - if ( sPriv->drmMinor >= 10 ) { + if ( sPriv->drm_version.minor >= 10 ) { drm_radeon_setparam_t sp; sp.param = RADEON_SETPARAM_FB_LOCATION; @@ -701,7 +701,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->depthPitch = dri_priv->depthPitch; /* Check if ddx has set up a surface reg to cover depth buffer */ - screen->depthHasSurface = ((sPriv->ddxMajor > 4) && + screen->depthHasSurface = ((sPriv->ddx_version.major > 4) && (screen->chip_flags & RADEON_CHIPSET_TCL)); if ( dri_priv->textureSize == 0 ) { diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 9678c526aa0..b2764f36f68 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -524,7 +524,7 @@ savageCreateContext( const __GLcontextModes *mesaVis, "enable_fastpath"); /* DRM versions before 2.1.3 would only render triangle lists. ELTS * support was added in 2.2.0. */ - if (imesa->enable_fastpath && sPriv->drmMinor < 2) { + if (imesa->enable_fastpath && sPriv->drm_version.minor < 2) { fprintf (stderr, "*** Disabling fast path because your DRM version is buggy " "or doesn't\n*** support ELTS. You need at least Savage DRM " diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 719e50f964c..1dcfee291f5 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -1016,7 +1016,7 @@ static void savageUploadTexImages( savageContextPtr imesa, savageTexObjPtr t ) /* Heap timestamps are only reliable with Savage DRM 2.3.x or * later. Earlier versions had only 16 bit time stamps which * would wrap too frequently. */ - if (imesa->savageScreen->driScrnPriv->drmMinor >= 3) { + if (imesa->savageScreen->driScrnPriv->drm_version.minor >= 3) { unsigned int heap = t->base.heap->heapId; LOCK_HARDWARE(imesa); savageWaitEvent (imesa, imesa->textureHeaps[heap]->timestamp); @@ -1713,7 +1713,7 @@ static void savageTimestampTextures( savageContextPtr imesa ) * Only useful with long-lived 32-bit event tags available * with Savage DRM 2.3.x or later. */ if ((imesa->CurrentTexObj[0] || imesa->CurrentTexObj[1]) && - imesa->savageScreen->driScrnPriv->drmMinor >= 3) { + imesa->savageScreen->driScrnPriv->drm_version.minor >= 3) { unsigned int e; FLUSH_BATCH(imesa); e = savageEmitEvent(imesa, SAVAGE_WAIT_3D); -- cgit v1.2.3 From 64106d0d9aeefa6974317042b6bc3e5eaabac5a2 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Mon, 14 May 2007 16:58:37 -0400 Subject: Pull createNewScreen entry point into dri_util.c. This pulls the top level createNewScreen entry point out of the drivers and rewrites __driUtilCreateNewScreen in dri_util.c to be the new entry point. The change moves more logic into the common/ layer and changes the createNewScreen entry point to only be defined in one place. --- src/mesa/drivers/dri/common/dri_util.c | 59 ++++++++-------- src/mesa/drivers/dri/common/dri_util.h | 12 ++-- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 48 ++++--------- src/mesa/drivers/dri/i810/i810screen.c | 50 ++++---------- src/mesa/drivers/dri/i915/intel_screen.c | 73 ++++++++------------ src/mesa/drivers/dri/i965/intel_screen.c | 77 ++++++++------------- src/mesa/drivers/dri/mach64/mach64_screen.c | 75 +++++++------------- src/mesa/drivers/dri/mga/mga_xmesa.c | 84 +++++++++------------- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 96 ++++++++++---------------- src/mesa/drivers/dri/r128/r128_screen.c | 80 ++++++++------------- src/mesa/drivers/dri/radeon/radeon_screen.c | 96 ++++++++++---------------- src/mesa/drivers/dri/s3v/s3v_xmesa.c | 4 +- src/mesa/drivers/dri/savage/savage_xmesa.c | 80 ++++++++------------- src/mesa/drivers/dri/sis/sis_screen.c | 72 ++++++++----------- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 86 +++++++++-------------- src/mesa/drivers/dri/trident/trident_context.c | 52 ++++++-------- src/mesa/drivers/dri/unichrome/via_screen.c | 76 ++++++++------------ 17 files changed, 421 insertions(+), 699 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 09fc2230fdc..9c96392654f 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -667,9 +667,12 @@ static void driDestroyScreen(__DRIscreen *screen) /** - * Utility function used to create a new driver-private screen structure. + * This is the bootstrap function for the driver. libGL supplies all of the + * requisite information about the system, and the driver initializes itself. + * This routine also fills in the linked list pointed to by \c driver_modes + * with the \c __GLcontextModes that the driver can support for windows or + * pbuffers. * - * \param dpy Display pointer * \param scrn Index of the screen * \param psc DRI screen data (not driver private) * \param modes Linked list of known display modes. This list is, at a @@ -690,35 +693,34 @@ static void driDestroyScreen(__DRIscreen *screen) * driver and libGL. * \param driverAPI Driver API functions used by other routines in dri_util.c. * - * \note - * There is no need to check the minimum API version in this function. Since - * the \c __driCreateNewScreen function is versioned, it is impossible for a - * loader that is too old to even load this driver. + * \note There is no need to check the minimum API version in this + * function. Since the name of this function is versioned, it is + * impossible for a loader that is too old to even load this driver. */ -__DRIscreenPrivate * -__driUtilCreateNewScreen(int scr, __DRIscreen *psc, - __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drm_sarea_t *pSAREA, - int fd, - int internal_api_version, - const struct __DriverAPIRec *driverAPI) +PUBLIC +void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, + const __GLcontextModes * modes, + const __DRIversion * ddx_version, + const __DRIversion * dri_version, + const __DRIversion * drm_version, + const __DRIframebuffer * frame_buffer, + drmAddress pSAREA, int fd, + int internal_api_version, + const __DRIinterfaceMethods * interface, + __GLcontextModes ** driver_modes ) + { __DRIscreenPrivate *psp; - + dri_interface = interface; api_ver = internal_api_version; - psp = (__DRIscreenPrivate *)_mesa_malloc(sizeof(__DRIscreenPrivate)); - if (!psp) { + psp = _mesa_malloc(sizeof(*psp)); + if (!psp) return NULL; - } psp->psc = psc; - psp->modes = modes; + psp->modes = NULL; /* ** NOT_DONE: This is used by the X server to detect when the client @@ -731,9 +733,6 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc, psp->ddx_version = *ddx_version; psp->dri_version = *dri_version; - /* install driver's callback functions */ - memcpy( &psp->DriverAPI, driverAPI, sizeof(struct __DriverAPIRec) ); - psp->pSAREA = pSAREA; psp->pFB = frame_buffer->base; @@ -746,7 +745,7 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc, psp->fbBPP = psp->fbStride * 8 / frame_buffer->width; psp->fd = fd; - psp->myNum = scr; + psp->myNum = scrn; /* ** Do not init dummy context here; actual initialization will be @@ -763,17 +762,15 @@ __driUtilCreateNewScreen(int scr, __DRIscreen *psc, if (internal_api_version >= 20070121) psc->setTexOffset = psp->DriverAPI.setTexOffset; - if ( (psp->DriverAPI.InitDriver != NULL) - && !(*psp->DriverAPI.InitDriver)(psp) ) { - _mesa_free( psp ); + *driver_modes = __driDriverInitScreen(psp); + if (*driver_modes == NULL) { + _mesa_free(psp); return NULL; } - return psp; } - /** * Compare the current GLX API version with a driver supplied required version. * diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 7a70bc7aa60..f56f1fa96ac 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -66,6 +66,13 @@ typedef struct __DRIswapInfoRec __DRIswapInfo; typedef struct __DRIutilversionRec2 __DRIutilversion2; +/** + * Driver specific entry point. Implemented by the driver. Called + * from the top level createNewScreen entry point to initialize the + * __DRIscreenPrivate struct. + */ +extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); + /** * Used by DRI_VALIDATE_DRAWABLE_INFO */ @@ -109,11 +116,6 @@ do { \ * this structure. */ struct __DriverAPIRec { - /** - * Driver initialization callback - */ - GLboolean (*InitDriver)(__DRIscreenPrivate *driScrnPriv); - /** * Screen destruction callback */ diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 4cd5b9a2080..3a5551eeb37 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -605,7 +605,6 @@ void ffbXMesaUpdateState(ffbContextPtr fmesa) } static const struct __DriverAPIRec ffbAPI = { - .InitDriver = ffbInitDriver, .DestroyScreen = ffbDestroyScreen, .CreateContext = ffbCreateContext, .DestroyContext = ffbDestroyContext, @@ -704,49 +703,28 @@ ffbFillInModes( unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 0, 1, 1 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 0, 0, 1 }; - dri_interface = interface; - if ( ! driCheckDriDdxDrmVersions2( "ffb", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &ffbAPI); - if ( psp != NULL ) { - *driver_modes = ffbFillInModes( 32, 16, 0, GL_TRUE ); - } + psp->DriverAPI = ffbAPI; + + if (!ffbInitDriver(psp)) + return NULL; - return (void *) psp; + return ffbFillInModes( 32, 16, 0, GL_TRUE ); } diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index b04bc383270..3c7ec96ff3d 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -403,7 +403,6 @@ i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv) static const struct __DriverAPIRec i810API = { - .InitDriver = i810InitDriver, .DestroyScreen = i810DestroyScreen, .CreateContext = i810CreateContext, .DestroyContext = i810DestroyContext, @@ -421,51 +420,30 @@ static const struct __DriverAPIRec i810API = { /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. + * + * \todo maybe fold this into intelInitDriver * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 2, 0 }; - dri_interface = interface; - if ( ! driCheckDriDdxDrmVersions2( "i810", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) { return NULL; } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &i810API); - if ( psp != NULL ) { - *driver_modes = i810FillInModes( 16, - 16, 0, - 1); - driInitExtensions( NULL, card_extensions, GL_TRUE ); - } + psp->DriverAPI = i810API; + driInitExtensions( NULL, card_extensions, GL_TRUE ); + + if (!i810InitDriver(psp)) + return NULL; - return (void *) psp; + return i810FillInModes(16, 16, 0, 1); } diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 58dc02e24e7..a75133ec738 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -771,7 +771,6 @@ intelCreateContext(const __GLcontextModes * mesaVis, static const struct __DriverAPIRec intelAPI = { - .InitDriver = intelInitDriver, .DestroyScreen = intelDestroyScreen, .CreateContext = intelCreateContext, .DestroyContext = intelDestroyContext, @@ -876,64 +875,46 @@ intelFillInModes(unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, - __DRIscreen * psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 5, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 5, 0 }; + I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - dri_interface = interface; + psp->DriverAPI = intelAPI; if (!driCheckDriDdxDrmVersions2("i915", - dri_version, &dri_expected, - ddx_version, &ddx_expected, - drm_version, &drm_expected)) { + &psp->dri_version, &dri_expected, + &psp->ddx_version, &ddx_expected, + &psp->drm_version, &drm_expected)) { return NULL; } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &intelAPI); - if (psp != NULL) { - I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - *driver_modes = intelFillInModes(dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, 1); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions(NULL, card_extensions, GL_FALSE); - } + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions(NULL, card_extensions, GL_FALSE); + + if (!intelInitDriver(psp)) + return NULL; - return (void *) psp; + return intelFillInModes(dri_priv->cpp * 8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, 1); } struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen) diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index cb6824b7ee1..f0bce146b08 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -540,7 +540,6 @@ static GLboolean intelCreateContext( const __GLcontextModes *mesaVis, static const struct __DriverAPIRec intelAPI = { - .InitDriver = intelInitDriver, .DestroyScreen = intelDestroyScreen, .CreateContext = intelCreateContext, .DestroyContext = intelDestroyContext, @@ -639,62 +638,44 @@ intelFillInModes( unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 6, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 3, 0 }; + I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - dri_interface = interface; - + psp->DriverAPI = intelAPI; if ( ! driCheckDriDdxDrmVersions2( "i915", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { - return NULL; + &psp->dri_version, &dri_expected, + &psp->ddx_version, &ddx_expected, + &psp->drm_version, &drm_expected ) ) { + return NULL; } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &intelAPI); - if ( psp != NULL ) { - I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; - *driver_modes = intelFillInModes( dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - GL_TRUE ); - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - intelInitExtensions(NULL, GL_FALSE); - } + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + intelInitExtensions(NULL, GL_FALSE); + + if (!intelInitDriver(psp)) + return NULL; - return (void *) psp; + return intelFillInModes( dri_priv->cpp * 8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, + GL_TRUE ); } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 733a16b6aef..ff261c841d7 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -476,7 +476,6 @@ mach64InitDriver( __DRIscreenPrivate *driScreen ) static struct __DriverAPIRec mach64API = { - .InitDriver = mach64InitDriver, .DestroyScreen = mach64DestroyScreen, .CreateContext = mach64CreateContext, .DestroyContext = mach64DestroyContext, @@ -494,63 +493,41 @@ static struct __DriverAPIRec mach64API = { /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 6, 4, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 0, 0 }; + ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv; - dri_interface = interface; - + psp->DriverAPI = mach64API; if ( ! driCheckDriDdxDrmVersions2( "Mach64", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) { return NULL; } + + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + if (!mach64InitDriver(psp)) + return NULL; - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &mach64API); - if ( psp != NULL ) { - ATIDRIPtr dri_priv = (ATIDRIPtr) psp->pDevPriv; - *driver_modes = mach64FillInModes( dri_priv->cpp * 8, - 16, - 0, - 1); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } - - return (void *) psp; + return mach64FillInModes( dri_priv->cpp * 8, 16, 0, 1); } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index b001f8696a6..5b4693983af 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -934,7 +934,6 @@ void mgaGetLock( mgaContextPtr mmesa, GLuint flags ) static const struct __DriverAPIRec mgaAPI = { - .InitDriver = mgaInitDriver, .DestroyScreen = mgaDestroyScreen, .CreateContext = mgaCreateContext, .DestroyContext = mgaDestroyContext, @@ -952,69 +951,50 @@ static const struct __DriverAPIRec mgaAPI = { /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 2, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 3, 0, 0 }; + MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv; - dri_interface = interface; - + psp->DriverAPI = mgaAPI; if ( ! driCheckDriDdxDrmVersions2( "MGA", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &mgaAPI); - if ( psp != NULL ) { - MGADRIPtr dri_priv = (MGADRIPtr) psp->pDevPriv; - *driver_modes = mgaFillInModes( dri_priv->cpp * 8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - driInitExtensions( NULL, g400_extensions, GL_FALSE ); - driInitSingleExtension( NULL, ARB_vp_extension ); - driInitExtensions( NULL, NV_vp_extensions, GL_FALSE ); - } + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + + driInitExtensions( NULL, card_extensions, GL_FALSE ); + driInitExtensions( NULL, g400_extensions, GL_FALSE ); + driInitSingleExtension( NULL, ARB_vp_extension ); + driInitExtensions( NULL, NV_vp_extensions, GL_FALSE ); + + if (!mgaInitDriver(psp)) + return NULL; - return (void *) psp; + return mgaFillInModes( dri_priv->cpp * 8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index cab53f41ad4..3e7bab63f34 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -195,7 +195,6 @@ nouveauGetSwapInfo(__DRIdrawablePrivate *dpriv, __DRIswapInfo *sInfo) } static const struct __DriverAPIRec nouveauAPI = { - .InitDriver = nouveauInitDriver, .DestroyScreen = nouveauDestroyScreen, .CreateContext = nouveauCreateContext, .DestroyContext = nouveauDestroyContext, @@ -285,81 +284,62 @@ nouveauFillInModes( unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 2, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 0, 0, NOUVEAU_DRM_HEADER_PATCHLEVEL }; + NOUVEAUDRIPtr dri_priv = (NOUVEAUDRIPtr)psp->pDevPriv; + #if NOUVEAU_DRM_HEADER_PATCHLEVEL != 10 #error nouveau_drm.h version doesn't match expected version #endif - dri_interface = interface; if (!driCheckDriDdxDrmVersions2("nouveau", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected)) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected)) return NULL; - } // temporary lock step versioning - if (drm_expected.patch!=drm_version->patch) { + if (drm_expected.patch != psp->drm_version.patch) { __driUtilMessage("%s: wrong DRM version, expected %d, got %d\n", - __func__, - drm_expected.patch, drm_version->patch); + __func__, + drm_expected.patch, psp->drm_version.patch); return NULL; } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &nouveauAPI); - if ( psp != NULL ) { - NOUVEAUDRIPtr dri_priv = (NOUVEAUDRIPtr)psp->pDevPriv; - - *driver_modes = nouveauFillInModes(dri_priv->bpp, - (dri_priv->bpp == 16) ? 16 : 24, - (dri_priv->bpp == 16) ? 0 : 8, - 1 - ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, common_extensions, GL_FALSE ); - driInitExtensions( NULL, nv10_extensions, GL_FALSE ); - driInitExtensions( NULL, nv10_extensions, GL_FALSE ); - driInitExtensions( NULL, nv30_extensions, GL_FALSE ); - driInitExtensions( NULL, nv40_extensions, GL_FALSE ); - driInitExtensions( NULL, nv50_extensions, GL_FALSE ); - } + psp->DriverAPI = nouveauAPI; + + /* Calling driInitExtensions here, with a NULL context + * pointer, does not actually enable the extensions. It just + * makes sure that all the dispatch offsets for all the + * extensions that *might* be enables are known. This is + * needed because the dispatch offsets need to be known when + * _mesa_context_create is called, but we can't enable the + * extensions until we have a context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, common_extensions, GL_FALSE ); + driInitExtensions( NULL, nv10_extensions, GL_FALSE ); + driInitExtensions( NULL, nv10_extensions, GL_FALSE ); + driInitExtensions( NULL, nv30_extensions, GL_FALSE ); + driInitExtensions( NULL, nv40_extensions, GL_FALSE ); + driInitExtensions( NULL, nv50_extensions, GL_FALSE ); + + if (!nouveauInitDriver(psp)) + return NULL; - return (void *) psp; + return nouveauFillInModes(dri_priv->bpp, + (dri_priv->bpp == 16) ? 16 : 24, + (dri_priv->bpp == 16) ? 0 : 8, + 1); } diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 01b33d64934..446280c399f 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -403,7 +403,6 @@ r128InitDriver( __DRIscreenPrivate *sPriv ) static struct __DriverAPIRec r128API = { - .InitDriver = r128InitDriver, .DestroyScreen = r128DestroyScreen, .CreateContext = r128CreateContext, .DestroyContext = r128DestroyContext, @@ -503,64 +502,43 @@ r128FillInModes( unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 2, 0 }; + R128DRIPtr dri_priv = (R128DRIPtr) psp->pDevPriv; - - dri_interface = interface; - + psp->DriverAPI = r128API; if ( ! driCheckDriDdxDrmVersions2( "Rage128", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &r128API); - if ( psp != NULL ) { - R128DRIPtr dri_priv = (R128DRIPtr) psp->pDevPriv; - *driver_modes = r128FillInModes( dri_priv->bpp, - (dri_priv->bpp == 16) ? 16 : 24, - (dri_priv->bpp == 16) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } - return (void *) psp; + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + if (!r128InitDriver(psp)) + return NULL; + + return r128FillInModes( dri_priv->bpp, + (dri_priv->bpp == 16) ? 16 : 24, + (dri_priv->bpp == 16) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 9801322cd8b..b7e0b5a0fa3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -938,7 +938,6 @@ static void radeonDestroyContext(__DRIcontextPrivate * driContextPriv) #if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) static struct __DriverAPIRec radeonAPI = { - .InitDriver = radeonInitDriver, .DestroyScreen = radeonDestroyScreen, .CreateContext = radeonCreateContext, .DestroyContext = radeonDestroyContext, @@ -959,7 +958,6 @@ static struct __DriverAPIRec radeonAPI = { }; #else static const struct __DriverAPIRec r200API = { - .InitDriver = radeonInitDriver, .DestroyScreen = radeonDestroyScreen, .CreateContext = r200CreateContext, .DestroyContext = r200DestroyContext, @@ -978,29 +976,16 @@ static const struct __DriverAPIRec r200API = { }; #endif + /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. + * + * \todo maybe fold this into intelInitDriver * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \return the __GLcontextModes supported by this driver */ -PUBLIC void * -__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; #if !RADEON_COMMON static const char *driver_name = "Radeon"; static const __DRIutilversion2 ddx_expected = { 4, 5, 0, 0 }; @@ -1017,57 +1002,46 @@ __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 24, 0 }; #endif - - dri_interface = interface; + RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv; if ( ! driCheckDriDdxDrmVersions3( driver_name, - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) { return NULL; } #if !RADEON_COMMON || (RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)) - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &radeonAPI); + psp->DriverAPI = radeonAPI; #elif RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &r200API); + psp->DriverAPI = r200API; #endif - if ( psp != NULL ) { - RADEONDRIPtr dri_priv = (RADEONDRIPtr) psp->pDevPriv; - if (driver_modes) { - *driver_modes = radeonFillInModes( dri_priv->bpp, - (dri_priv->bpp == 16) ? 16 : 24, - (dri_priv->bpp == 16) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - } - - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create - * is called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create + * is called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - driInitExtensions( NULL, blend_extensions, GL_FALSE ); - driInitSingleExtension( NULL, ARB_vp_extension ); - driInitSingleExtension( NULL, NV_vp_extension ); - driInitSingleExtension( NULL, ATI_fs_extension ); - driInitExtensions( NULL, point_extensions, GL_FALSE ); + driInitExtensions( NULL, blend_extensions, GL_FALSE ); + driInitSingleExtension( NULL, ARB_vp_extension ); + driInitSingleExtension( NULL, NV_vp_extension ); + driInitSingleExtension( NULL, ATI_fs_extension ); + driInitExtensions( NULL, point_extensions, GL_FALSE ); #endif - } - return (void *) psp; + if (!radeonInitDriver(psp)) + return NULL; + + return radeonFillInModes( dri_priv->bpp, + (dri_priv->bpp == 16) ? 16 : 24, + (dri_priv->bpp == 16) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c index c66fd6dac31..7b0b006b695 100644 --- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c +++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c @@ -329,7 +329,6 @@ s3vUnbindContext( __DRIcontextPrivate *driContextPriv ) static struct __DriverAPIRec s3vAPI = { - s3vInitDriver, s3vDestroyScreen, s3vCreateContext, s3vDestroyContext, @@ -355,6 +354,9 @@ void *__driCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, DEBUG(("__driCreateScreen: psp = %p\n", psp)); psp = __driUtilCreateScreen(dpy, scrn, psc, numConfigs, config, &s3vAPI); DEBUG(("__driCreateScreen: psp = %p\n", psp)); + if (!s3vInitDriver(psp)) + return NULLL + return (void *) psp; } #endif diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index b2764f36f68..3750c8948ac 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -919,7 +919,6 @@ void savageGetLock( savageContextPtr imesa, GLuint flags ) static const struct __DriverAPIRec savageAPI = { - savageInitDriver, savageDestroyScreen, savageCreateContext, savageDestroyContext, @@ -1016,63 +1015,44 @@ savageFillInModes( unsigned pixel_bits, unsigned depth_bits, /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes ) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 2, 0, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 1, 0 }; - - dri_interface = interface; + SAVAGEDRIPtr dri_priv = (SAVAGEDRIPtr)psp->pDevPriv; if ( ! driCheckDriDdxDrmVersions2( "Savage", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &savageAPI); - if ( psp != NULL ) { - SAVAGEDRIPtr dri_priv = (SAVAGEDRIPtr)psp->pDevPriv; - *driver_modes = savageFillInModes( dri_priv->cpp*8, - (dri_priv->cpp == 2) ? 16 : 24, - (dri_priv->cpp == 2) ? 0 : 8, - (dri_priv->backOffset != dri_priv->depthOffset) ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } - return (void *) psp; + psp->DriverAPI = savageAPI; + + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + if (!savageInitDriver(psp)) + return NULL; + + return savageFillInModes( dri_priv->cpp*8, + (dri_priv->cpp == 2) ? 16 : 24, + (dri_priv->cpp == 2) ? 0 : 8, + (dri_priv->backOffset != dri_priv->depthOffset) ); } diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index a1275f00263..79682a72530 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -304,7 +304,6 @@ sisInitDriver( __DRIscreenPrivate *sPriv ) } static struct __DriverAPIRec sisAPI = { - .InitDriver = sisInitDriver, .DestroyScreen = sisDestroyScreen, .CreateContext = sisCreateContext, .DestroyContext = sisDestroyContext, @@ -323,59 +322,42 @@ static struct __DriverAPIRec sisAPI = { /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. + * + * \todo maybe fold this into intelInitDriver * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes *modes, - const __DRIversion *ddx_version, - const __DRIversion *dri_version, - const __DRIversion *drm_version, - const __DRIframebuffer *frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes **driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = {0, 8, 0}; static const __DRIversion dri_expected = {4, 0, 0}; static const __DRIversion drm_expected = {1, 0, 0}; static const char *driver_name = "SiS"; - dri_interface = interface; + SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv; - if (!driCheckDriDdxDrmVersions2(driver_name, dri_version, &dri_expected, - ddx_version, &ddx_expected, - drm_version, &drm_expected)) { + if (!driCheckDriDdxDrmVersions2(driver_name, + &psp->dri_version, &dri_expected, + &psp->ddx_version, &ddx_expected, + &psp->drm_version, &drm_expected)) return NULL; - } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &sisAPI); - if (psp != NULL) { - SISDRIPtr dri_priv = (SISDRIPtr)psp->pDevPriv; - *driver_modes = sisFillInModes(dri_priv->bytesPerPixel * 8); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } + psp->DriverAPI = sisAPI; + + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + if (!sisInitDriver(psp)) + return NULL; - return (void *)psp; + return sisFillInModes(dri_priv->bytesPerPixel * 8); } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index e9033c5ef3a..081a5340357 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -345,7 +345,6 @@ tdfxSwapBuffers( __DRIdrawablePrivate *driDrawPriv ) static const struct __DriverAPIRec tdfxAPI = { - .InitDriver = tdfxInitDriver, .DestroyScreen = tdfxDestroyScreen, .CreateContext = tdfxCreateContext, .DestroyContext = tdfxDestroyContext, @@ -431,69 +430,50 @@ static __GLcontextModes *tdfxFillInModes(unsigned pixel_bits, } /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. + * + * \todo maybe fold this into intelInitDriver * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void *__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 1, 1, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 0, 0 }; - dri_interface = interface; + /* divined from tdfx_dri.c, sketchy */ + TDFXDRIPtr dri_priv = (TDFXDRIPtr) psp->pDevPriv; + + /* XXX i wish it was like this */ + /* bpp = dri_priv->bpp */ + int bpp = (dri_priv->cpp > 2) ? 24 : 16; if ( ! driCheckDriDdxDrmVersions2( "tdfx", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &tdfxAPI); - - if (psp != NULL) { - /* divined from tdfx_dri.c, sketchy */ - TDFXDRIPtr dri_priv = (TDFXDRIPtr) psp->pDevPriv; - int bpp = (dri_priv->cpp > 2) ? 24 : 16; + psp->DriverAPI = tdfxAPI; + + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + driInitExtensions( NULL, napalm_extensions, GL_FALSE ); - /* XXX i wish it was like this */ - /* bpp = dri_priv->bpp */ + if (!tdfxInitDriver(psp)) + return NULL; - *driver_modes = tdfxFillInModes(bpp, (bpp == 16) ? 16 : 24, - (bpp == 16) ? 0 : 8, - (dri_priv->backOffset!=dri_priv->depthOffset)); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - driInitExtensions( NULL, napalm_extensions, GL_FALSE ); - } - - return (void *)psp; + return tdfxFillInModes(bpp, (bpp == 16) ? 16 : 24, + (bpp == 16) ? 0 : 8, + (dri_priv->backOffset!=dri_priv->depthOffset)); } diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index 1d2a49e6f4a..81098bc9cdf 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -418,7 +418,6 @@ tridentInitDriver(__DRIscreenPrivate *sPriv) } static struct __DriverAPIRec tridentAPI = { - tridentInitDriver, tridentDestroyScreen, tridentCreateContext, tridentDestroyContext, @@ -430,43 +429,36 @@ static struct __DriverAPIRec tridentAPI = { }; -PUBLIC void * -__DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) +/** + * This is the driver specific part of the createNewScreen entry point. + * + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver + */ +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { 4, 0, 0 }; static const __DRIversion dri_expected = { 3, 1, 0 }; static const __DRIversion drm_expected = { 1, 0, 0 }; - - dri_interface = interface; - + if ( ! driCheckDriDdxDrmVersions2( "Trident", - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected ) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected ) ) return NULL; - } - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &tridentAPI); + psp->DriverAPI = tridentAPI; + + if (!tridentInitDriver(psp)) + return NULL; - if ( psp != NULL ) { + /* Wait... what? This driver doesn't report any modes... */ #if 0 - TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv; - *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8, - GL_TRUE ); + TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv; + *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8, + GL_TRUE ); #endif - } - return (void *) psp; + + return NULL; } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 22e4bcebc91..53f4c5c5642 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -325,7 +325,6 @@ viaDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) static struct __DriverAPIRec viaAPI = { - .InitDriver = viaInitDriver, .DestroyScreen = viaDestroyScreen, .CreateContext = viaCreateContext, .DestroyContext = viaDestroyContext, @@ -407,66 +406,47 @@ viaFillInModes( unsigned pixel_bits, GLboolean have_back_buffer ) /** - * This is the bootstrap function for the driver. libGL supplies all of the - * requisite information about the system, and the driver initializes itself. - * This routine also fills in the linked list pointed to by \c driver_modes - * with the \c __GLcontextModes that the driver can support for windows or - * pbuffers. + * This is the driver specific part of the createNewScreen entry point. * - * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on - * failure. + * \todo maybe fold this into intelInitDriver + * + * \return the __GLcontextModes supported by this driver */ -PUBLIC -void * __DRI_CREATE_NEW_SCREEN(int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, - const __DRIversion * ddx_version, - const __DRIversion * dri_version, - const __DRIversion * drm_version, - const __DRIframebuffer * frame_buffer, - drmAddress pSAREA, int fd, - int internal_api_version, - const __DRIinterfaceMethods * interface, - __GLcontextModes ** driver_modes) - +__GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) { - __DRIscreenPrivate *psp; static const __DRIversion ddx_expected = { VIA_DRIDDX_VERSION_MAJOR, VIA_DRIDDX_VERSION_MINOR, VIA_DRIDDX_VERSION_PATCH }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 2, 3, 0 }; static const char *driver_name = "Unichrome"; - - dri_interface = interface; + VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv; if ( ! driCheckDriDdxDrmVersions2( driver_name, - dri_version, & dri_expected, - ddx_version, & ddx_expected, - drm_version, & drm_expected) ) { + &psp->dri_version, & dri_expected, + &psp->ddx_version, & ddx_expected, + &psp->drm_version, & drm_expected) ) return NULL; - } - - psp = __driUtilCreateNewScreen(scrn, psc, NULL, - ddx_version, dri_version, drm_version, - frame_buffer, pSAREA, fd, - internal_api_version, &viaAPI); - if ( psp != NULL ) { - VIADRIPtr dri_priv = (VIADRIPtr) psp->pDevPriv; - *driver_modes = viaFillInModes( dri_priv->bytesPerPixel * 8, - GL_TRUE ); - - /* Calling driInitExtensions here, with a NULL context pointer, does not actually - * enable the extensions. It just makes sure that all the dispatch offsets for all - * the extensions that *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is called, but we can't - * enable the extensions until we have a context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - } - return (void *) psp; + psp->DriverAPI = viaAPI; + + /* Calling driInitExtensions here, with a NULL context pointer, + * does not actually enable the extensions. It just makes sure + * that all the dispatch offsets for all the extensions that + * *might* be enables are known. This is needed because the + * dispatch offsets need to be known when _mesa_context_create is + * called, but we can't enable the extensions until we have a + * context pointer. + * + * Hello chicken. Hello egg. How are you two today? + */ + driInitExtensions( NULL, card_extensions, GL_FALSE ); + + if (!viaInitDriver(psp)) + return NULL; + + return viaFillInModes( dri_priv->bytesPerPixel * 8, GL_TRUE ); + } -- cgit v1.2.3 From 295dc2d225ccac1951c0fcc2c08119f31d1b575c Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Mon, 14 May 2007 17:07:16 -0400 Subject: Stop passing in unused fbconfigs to createNewScreen. --- include/GL/internal/dri_interface.h | 1 - src/glx/x11/glxext.c | 4 +--- src/mesa/drivers/dri/common/dri_util.c | 5 ----- src/mesa/drivers/dri/common/dri_util.h | 11 ----------- 4 files changed, 1 insertion(+), 20 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 178134270d1..aa2b1cf8057 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -115,7 +115,6 @@ typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) (__DRIscreen *screen, #define __DRI_INTERFACE_VERSION 20070105 typedef void *(CREATENEWSCREENFUNC)(int scr, __DRIscreen *psc, - const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer, void * pSAREA, int fd, int internal_api_version, diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 8c12ae254ad..ee8e238bec5 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -957,7 +957,6 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, err_extra = NULL; psp = (*createNewScreen)(scrn, &psc->driScreen, - psc->configs, & ddx_version, & dri_version, & drm_version, @@ -968,8 +967,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, & interface_methods, & driver_modes ); - filter_modes( & psc->configs, - driver_modes ); + filter_modes(&psc->configs, driver_modes); _gl_context_modes_destroy( driver_modes ); } } diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 9c96392654f..84a6d819def 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -657,9 +657,6 @@ static void driDestroyScreen(__DRIscreen *screen) (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); (void)drmCloseOnce(psp->fd); - if ( psp->modes != NULL ) { - (*dri_interface->destroyContextModes)( psp->modes ); - } _mesa_free(psp); } @@ -699,7 +696,6 @@ static void driDestroyScreen(__DRIscreen *screen) */ PUBLIC void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, - const __GLcontextModes * modes, const __DRIversion * ddx_version, const __DRIversion * dri_version, const __DRIversion * drm_version, @@ -720,7 +716,6 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, return NULL; psp->psc = psc; - psp->modes = NULL; /* ** NOT_DONE: This is used by the X server to detect when the client diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index f56f1fa96ac..5ac2eea7221 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -458,17 +458,6 @@ struct __DRIscreenPrivateRec { */ void *private; - /** - * GLX visuals / FBConfigs for this screen. These are stored as a - * linked list. - * - * \note - * This field is \b only used in conjunction with the old interfaces. If - * the new interfaces are used, this field will be set to \c NULL and will - * not be dereferenced. - */ - __GLcontextModes *modes; - /** * Pointer back to the \c __DRIscreen that contains this structure. */ -- cgit v1.2.3 From f616a263a25eda135800bea7d3a863c569b93e30 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 15 May 2007 12:31:31 -0400 Subject: Implement new screen extension API. This new API lets the loader examine DRI level extensions provided by the driver in a forward compatible manner. Much of the churn in the DRI interface is adding support for new extensions or removing old, unused extensions. This new extension mechanism lets the loader query the extensions provided by the driver and implement the extensions it knows about. Deprecating extensions is done by not exporting that extension in the list, which doesn't require keeping old function pointers around to preserve ABI. --- include/GL/internal/dri_interface.h | 20 ++++++++++++++++++++ src/glx/x11/glxext.c | 14 ++++++++++++++ src/mesa/drivers/dri/common/dri_util.c | 9 +++++++++ 3 files changed, 43 insertions(+) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index aa2b1cf8057..ee73233771c 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -56,9 +56,24 @@ typedef struct __DRIdriverRec __DRIdriver; typedef struct __DRIframebufferRec __DRIframebuffer; typedef struct __DRIversionRec __DRIversion; typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods; + +typedef struct __DRIextensionRec __DRIextension; /*@}*/ +/** + * Extension struct. Drivers 'inherit' from this struct by embedding + * it as the first element in the extension struct. The + * __DRIscreen::getExtensions entry point will return a list of these + * structs and the loader can use the extensions it knows about by + * casting it to a more specific extension and optionally advertising + * the GLX extension. See below for examples. + */ +struct __DRIextensionRec { + const char *name; +}; + + /** * \name Functions provided by the driver loader. */ @@ -274,6 +289,11 @@ struct __DRIscreenRec { */ void (*destroyScreen)(__DRIscreen *screen); + /** + * Method to get screen extensions. + */ + const __DRIextension **(*getExtensions)(__DRIscreen *screen); + /** * Method to create the private DRI drawable data and initialize the * drawable dependent methods. diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index ee8e238bec5..cb187717f1e 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1011,6 +1011,18 @@ CallCreateNewScreen(Display *dpy, int scrn, __GLXscreenConfigs *psc, return psp; } + +static void queryExtensions(__GLXscreenConfigs *psc) +{ + const __DRIextension **extensions; + int i; + + extensions = psc->driScreen.getExtensions(&psc->driScreen); + for (i = 0; extensions[i]; i++) { + /* Unknown extension, just ignore... */ + } +} + #endif /* GLX_DIRECT_RENDERING */ @@ -1205,6 +1217,8 @@ static Bool AllocAndFetchScreenConfigs(Display *dpy, __GLXdisplayPrivate *priv) CallCreateNewScreen(dpy, i, psc, & priv->driDisplay, priv->driDisplay.createNewScreen[i] ); + if (psc->driScreen.private != NULL) + queryExtensions(psc); } } #endif diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 84a6d819def..c8be7b07064 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -624,6 +624,14 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, } /*@}*/ +static const __DRIextension ** +driGetExtensions(__DRIscreen *screen) +{ + __DRIscreenPrivate *psp = screen->private; + static const __DRIextension *extensions[1]; + + return extensions; +} /*****************************************************************/ /** \name Screen handling functions */ @@ -750,6 +758,7 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, psp->dummyContextPriv.driScreenPriv = NULL; psc->destroyScreen = driDestroyScreen; + psc->getExtensions = driGetExtensions; psc->createNewDrawable = driCreateNewDrawable; psc->getMSC = driGetMSC; psc->createNewContext = driCreateNewContext; -- cgit v1.2.3 From ac3e838fa748c8c8a6ffc04d1ab13da71f75f103 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 15 May 2007 15:17:30 -0400 Subject: Move the copySubBuffer extension over to the new mechanism. --- include/GL/internal/dri_interface.h | 18 ++++++++++-------- src/glx/x11/glxclient.h | 5 +++++ src/glx/x11/glxcmds.c | 6 +++--- src/glx/x11/glxext.c | 10 +++++++++- src/mesa/drivers/dri/common/dri_util.c | 14 ++++++++------ src/mesa/drivers/dri/common/dri_util.h | 11 ++++++++++- src/mesa/drivers/dri/i915/intel_screen.c | 10 ++++++++-- src/mesa/drivers/dri/i965/intel_screen.c | 7 ++++++- src/mesa/drivers/dri/radeon/radeon_screen.c | 7 ++++++- 9 files changed, 65 insertions(+), 23 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index ee73233771c..e2050c16b4f 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -58,6 +58,7 @@ typedef struct __DRIversionRec __DRIversion; typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods; typedef struct __DRIextensionRec __DRIextension; +typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension; /*@}*/ @@ -73,6 +74,15 @@ struct __DRIextensionRec { const char *name; }; +/** + * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension. + */ +#define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer" +struct __DRIcopySubBufferExtensionRec { + __DRIextension base; + void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h); +}; + /** * \name Functions provided by the driver loader. @@ -481,14 +491,6 @@ struct __DRIdrawableRec { * \since Internal API version 20030317. */ unsigned swap_interval; - - /** - * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension. - * - * \since Internal API version 20060314. - */ - void (*copySubBuffer)(__DRIdrawable *drawable, - int x, int y, int w, int h); }; #endif diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 56973251758..2c730282397 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -476,6 +476,11 @@ struct __GLXscreenConfigsRec { __glxHashTable *drawHash; Display *dpy; int scr; + +#ifdef __DRI_COPY_SUB_BUFFER + __DRIcopySubBufferExtension *copySubBuffer; +#endif + #endif /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 6b8824d8243..1bc5fff957c 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -2498,13 +2498,13 @@ static void __glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, INT32 *x_ptr, *y_ptr, *w_ptr, *h_ptr; CARD8 opcode; -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_COPY_SUB_BUFFER int screen; __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, & screen ); if ( pdraw != NULL ) { __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen ); - if ( __glXExtensionBitIsEnabled( psc, MESA_copy_sub_buffer_bit ) ) { - (*pdraw->copySubBuffer)(pdraw, x, y, width, height); + if (psc->copySubBuffer != NULL) { + (*psc->copySubBuffer->copySubBuffer)(pdraw, x, y, width, height); } return; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index cb187717f1e..d0a7a64445a 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1019,7 +1019,15 @@ static void queryExtensions(__GLXscreenConfigs *psc) extensions = psc->driScreen.getExtensions(&psc->driScreen); for (i = 0; extensions[i]; i++) { - /* Unknown extension, just ignore... */ +#ifdef __DRI_COPY_SUB_BUFFER + if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0) { + psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i]; + __glXScrEnableExtension(&psc->driScreen, + "GLX_MESA_copy_sub_buffer"); + + } +#endif + /* Ignore unknown extensions */ } } diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index c8be7b07064..fc7755797d6 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -431,6 +431,10 @@ static void driCopySubBuffer(__DRIdrawable *drawable, dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); } +const __DRIcopySubBufferExtension driCopySubBufferExtension = { + { __DRI_COPY_SUB_BUFFER }, driCopySubBuffer +}; + /** * This is called via __DRIscreenRec's createNewDrawable pointer. */ @@ -493,9 +497,6 @@ static void *driCreateNewDrawable(__DRIscreen *screen, pdraw->frameTracking = NULL; pdraw->queryFrameTracking = driQueryFrameTracking; - if (driCompareGLXAPIVersion (20060314) >= 0) - pdraw->copySubBuffer = driCopySubBuffer; - /* This special default value is replaced with the configured * default value when the drawable is first bound to a direct * rendering context. @@ -624,13 +625,13 @@ driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, } /*@}*/ + static const __DRIextension ** driGetExtensions(__DRIscreen *screen) { __DRIscreenPrivate *psp = screen->private; - static const __DRIextension *extensions[1]; - return extensions; + return psp->extensions; } /*****************************************************************/ @@ -715,7 +716,7 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, { __DRIscreenPrivate *psp; - + static const __DRIextension emptyExtensionList[] = { NULL }; dri_interface = interface; api_ver = internal_api_version; @@ -747,6 +748,7 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, psp->pDevPriv = frame_buffer->dev_priv; psp->fbBPP = psp->fbStride * 8 / frame_buffer->width; + psp->extensions = emptyExtensionList; psp->fd = fd; psp->myNum = scrn; diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 5ac2eea7221..59bb66d21bc 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -73,6 +73,11 @@ typedef struct __DRIutilversionRec2 __DRIutilversion2; */ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); +/** + * Extensions. + */ +extern const __DRIcopySubBufferExtension driCopySubBufferExtension; + /** * Used by DRI_VALIDATE_DRAWABLE_INFO */ @@ -461,8 +466,12 @@ struct __DRIscreenPrivateRec { /** * Pointer back to the \c __DRIscreen that contains this structure. */ - __DRIscreen *psc; + + /** + * Extensions provided by this driver. + */ + const __DRIextension **extensions; }; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index a75133ec738..792f26b5ed4 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -419,9 +419,13 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelPrintSAREA(sarea); } +static const __DRIextension *intelExtensions[] = { + &driCopySubBufferExtension.base, + NULL +}; -static GLboolean -intelInitDriver(__DRIscreenPrivate * sPriv) + +static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) { intelScreenPrivate *intelScreen; I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv; @@ -522,6 +526,8 @@ intelInitDriver(__DRIscreenPrivate * sPriv) } } + sPriv->extensions = intelExtensions; + if (glx_enable_extension != NULL) { (*glx_enable_extension) (sPriv->psc, "GLX_SGI_swap_control"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index f0bce146b08..1f74103f651 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -264,6 +264,10 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, intelPrintSAREA(sarea); } +static const __DRIextension *intelExtensions[] = { + &driCopySubBufferExtension.base, + NULL +}; static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) { @@ -350,13 +354,14 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) } } + sPriv->extensions = intelExtensions; + if (glx_enable_extension != NULL) { (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_copy_sub_buffer" ); } return GL_TRUE; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index b7e0b5a0fa3..7e533fef2cc 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -332,6 +332,10 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, return modes; } +static const __DRIextension *radeonExtensions[] = { + &driCopySubBufferExtension.base, + NULL +}; /* Create the device specific screen private data struct. */ @@ -731,6 +735,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) dri_priv->log2GARTTexGran; } + sPriv->extensions = radeonExtensions; + if ( glx_enable_extension != NULL ) { if ( screen->irq != 0 ) { (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); @@ -742,7 +748,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) if (IS_R200_CLASS(screen)) (*glx_enable_extension)( sPriv->psc, "GLX_MESA_allocate_memory" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_copy_sub_buffer" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } -- cgit v1.2.3 From efaf90b03e8b69e04909bce071f8ef6b65cc0e9d Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 15 May 2007 16:09:44 -0400 Subject: Move swap_interval to new extension mechanism. --- include/GL/internal/dri_interface.h | 19 +++++++++++-------- src/glx/x11/glxclient.h | 4 ++++ src/glx/x11/glxcmds.c | 25 +++++++++++-------------- src/glx/x11/glxext.c | 12 ++++++++++++ src/mesa/drivers/dri/common/dri_util.c | 28 ++++++++++++++++++++++++---- src/mesa/drivers/dri/common/dri_util.h | 7 +++++++ src/mesa/drivers/dri/common/vblank.c | 10 +++++----- src/mesa/drivers/dri/i915/intel_context.c | 2 +- src/mesa/drivers/dri/i915/intel_screen.c | 3 +-- src/mesa/drivers/dri/i965/intel_screen.c | 3 +-- src/mesa/drivers/dri/mach64/mach64_screen.c | 8 ++++++-- src/mesa/drivers/dri/mach64/mach64_screen.h | 2 ++ src/mesa/drivers/dri/mga/mga_xmesa.c | 9 +++++++-- src/mesa/drivers/dri/r128/r128_screen.c | 7 +++++-- src/mesa/drivers/dri/r128/r128_screen.h | 2 ++ src/mesa/drivers/dri/radeon/radeon_screen.c | 14 ++++++-------- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 ++ src/mesa/drivers/dri/unichrome/via_screen.c | 7 +++++-- src/mesa/drivers/dri/unichrome/via_screen.h | 2 ++ 19 files changed, 114 insertions(+), 52 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index e2050c16b4f..7eb168a1b90 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -59,6 +59,7 @@ typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods; typedef struct __DRIextensionRec __DRIextension; typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension; +typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension; /*@}*/ @@ -83,6 +84,16 @@ struct __DRIcopySubBufferExtensionRec { void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h); }; +/** + * Used by drivers that implement the GLX_SGI_swap_control or + * GLX_MESA_swap_control extension. + */ +#define __DRI_SWAP_CONTROL "DRI_SwapControl" +struct __DRIswapControlExtensionRec { + __DRIextension base; + void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval); + unsigned int (*getSwapInterval)(__DRIdrawable *drawable); +}; /** * \name Functions provided by the driver loader. @@ -483,14 +494,6 @@ struct __DRIdrawableRec { int (*queryFrameTracking)(__DRIdrawable *drawable, int64_t * sbc, int64_t * missedFrames, float * lastMissedUsage, float * usage); - - /** - * Used by drivers that implement the GLX_SGI_swap_control or - * GLX_MESA_swap_control extension. - * - * \since Internal API version 20030317. - */ - unsigned swap_interval; }; #endif diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 2c730282397..09ae70212ac 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -481,6 +481,10 @@ struct __GLXscreenConfigsRec { __DRIcopySubBufferExtension *copySubBuffer; #endif +#ifdef __DRI_SWAP_CONTROL + __DRIswapControlExtension *swapControl; +#endif + #endif /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 1bc5fff957c..6fda5125db7 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1731,16 +1731,15 @@ static int __glXSwapIntervalSGI(int interval) return GLX_BAD_VALUE; } -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_SWAP_CONTROL if ( gc->isDirect ) { __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen ); __DRIdrawable * const pdraw = GetDRIDrawable( gc->currentDpy, gc->currentDrawable, NULL ); - if ( __glXExtensionBitIsEnabled( psc, SGI_swap_control_bit ) - && (pdraw != NULL) ) { - pdraw->swap_interval = interval; + if (psc->swapControl != NULL && pdraw != NULL) { + psc->swapControl->setSwapInterval(pdraw, interval); return 0; } else { @@ -1778,7 +1777,7 @@ static int __glXSwapIntervalSGI(int interval) */ static int __glXSwapIntervalMESA(unsigned int interval) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_SWAP_CONTROL GLXContext gc = __glXGetCurrentContext(); if ( interval < 0 ) { @@ -1789,12 +1788,11 @@ static int __glXSwapIntervalMESA(unsigned int interval) __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen ); - if ( (psc != NULL) && (psc->driScreen.private != NULL) - && __glXExtensionBitIsEnabled( psc, MESA_swap_control_bit ) ) { + if ( (psc != NULL) && (psc->driScreen.private != NULL) ) { __DRIdrawable * const pdraw = GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); - if ( pdraw != NULL ) { - pdraw->swap_interval = interval; + if (psc->swapControl != NULL && pdraw != NULL) { + psc->swapControl->setSwapInterval(pdraw, interval); return 0; } } @@ -1809,19 +1807,18 @@ static int __glXSwapIntervalMESA(unsigned int interval) static int __glXGetSwapIntervalMESA(void) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_SWAP_CONTROL GLXContext gc = __glXGetCurrentContext(); if ( (gc != NULL) && gc->isDirect ) { __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen ); - if ( (psc != NULL) && (psc->driScreen.private != NULL) - && __glXExtensionBitIsEnabled( psc, MESA_swap_control_bit ) ) { + if ( (psc != NULL) && (psc->driScreen.private != NULL) ) { __DRIdrawable * const pdraw = GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); - if ( pdraw != NULL ) { - return pdraw->swap_interval; + if (psc->swapControl != NULL && pdraw != NULL) { + return psc->swapControl->getSwapInterval(pdraw); } } } diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index d0a7a64445a..1563ca63943 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1027,6 +1027,18 @@ static void queryExtensions(__GLXscreenConfigs *psc) } #endif + +#ifdef __DRI_SWAP_CONTROL + if (strcmp(extensions[i]->name, __DRI_SWAP_CONTROL) == 0) { + psc->swapControl = (__DRIswapControlExtension *) extensions[i]; + __glXScrEnableExtension(&psc->driScreen, + "GLX_SGI_swap_control"); + __glXScrEnableExtension(&psc->driScreen, + "GLX_MESA_swap_control"); + + } +#endif + /* Ignore unknown extensions */ } } diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index fc7755797d6..ba677f6ff86 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -435,6 +435,27 @@ const __DRIcopySubBufferExtension driCopySubBufferExtension = { { __DRI_COPY_SUB_BUFFER }, driCopySubBuffer }; +static void driSetSwapInterval(__DRIdrawable *drawable, unsigned int interval) +{ + __DRIdrawablePrivate *dpriv = drawable->private; + + dpriv->swap_interval = interval; +} + +static unsigned int driGetSwapInterval(__DRIdrawable *drawable) +{ + __DRIdrawablePrivate *dpriv = drawable->private; + + return dpriv->swap_interval; +} + +const __DRIswapControlExtension driSwapControlExtension = { + { __DRI_SWAP_CONTROL }, + driSetSwapInterval, + driGetSwapInterval +}; + + /** * This is called via __DRIscreenRec's createNewDrawable pointer. */ @@ -501,7 +522,7 @@ static void *driCreateNewDrawable(__DRIscreen *screen, * default value when the drawable is first bound to a direct * rendering context. */ - pdraw->swap_interval = (unsigned)-1; + pdp->swap_interval = (unsigned)-1; pdp->swapBuffers = psp->DriverAPI.SwapBuffers; @@ -716,7 +737,7 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, { __DRIscreenPrivate *psp; - static const __DRIextension emptyExtensionList[] = { NULL }; + static const __DRIextension *emptyExtensionList[] = { NULL }; dri_interface = interface; api_ver = internal_api_version; @@ -868,8 +889,7 @@ driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, if ( (*dri_interface->getMSCRate)(dPriv->pdraw, &n, &d) ) { - interval = (dPriv->pdraw->swap_interval != 0) - ? dPriv->pdraw->swap_interval : 1; + interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1; /* We want to calculate diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 59bb66d21bc..78320307d60 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -77,6 +77,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); * Extensions. */ extern const __DRIcopySubBufferExtension driCopySubBufferExtension; +extern const __DRIswapControlExtension driSwapControlExtension; /** * Used by DRI_VALIDATE_DRAWABLE_INFO @@ -327,6 +328,12 @@ struct __DRIdrawablePrivateRec { * Called via glXSwapBuffers(). */ void (*swapBuffers)( __DRIdrawablePrivate *dPriv ); + + /** + * Controls swap interval as used by GLX_SGI_swap_control and + * GLX_MESA_swap_control. + */ + unsigned int swap_interval; }; /** diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index e7ed545f13c..3b5acfecb12 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -255,13 +255,13 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd ) void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags, GLuint *vbl_seq ) { - if ( priv->pdraw->swap_interval == (unsigned)-1 ) { + if ( priv->swap_interval == (unsigned)-1 ) { /* Get current vertical blank sequence */ drmVBlank vbl = { .request={ .type = DRM_VBLANK_RELATIVE, .sequence = 0 } }; do_wait( &vbl, vbl_seq, priv->driScreenPriv->fd ); - priv->pdraw->swap_interval = (flags & (VBLANK_FLAG_THROTTLE | - VBLANK_FLAG_SYNC)) != 0 ? 1 : 0; + priv->swap_interval = (flags & (VBLANK_FLAG_THROTTLE | + VBLANK_FLAG_SYNC)) != 0 ? 1 : 0; } } @@ -277,9 +277,9 @@ driGetVBlankInterval( const __DRIdrawablePrivate *priv, GLuint flags ) if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) { /* this must have been initialized when the drawable was first bound * to a direct rendering context. */ - assert ( priv->pdraw->swap_interval != (unsigned)-1 ); + assert ( priv->swap_interval != (unsigned)-1 ); - return priv->pdraw->swap_interval; + return priv->swap_interval; } else if ( (flags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) { return 1; diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index 041a155fe73..d7af432ad6b 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -613,7 +613,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, if (intel->ctx.DrawBuffer == &intel_fb->Base) { if (intel->driDrawable != driDrawPriv) { - if (driDrawPriv->pdraw->swap_interval == (unsigned)-1) { + if (driDrawPriv->swap_interval == (unsigned)-1) { int i; intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0) diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 792f26b5ed4..f507a3bf05f 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -421,6 +421,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, + &driSwapControlExtension.base, NULL }; @@ -529,9 +530,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = intelExtensions; if (glx_enable_extension != NULL) { - (*glx_enable_extension) (sPriv->psc, "GLX_SGI_swap_control"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); - (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_control"); (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_frame_usage"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); } diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 1f74103f651..c75a86bf5b2 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -266,6 +266,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, + &driSwapControlExtension.base, NULL }; @@ -357,9 +358,7 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = intelExtensions; if (glx_enable_extension != NULL) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index ff261c841d7..46314b426f7 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -210,6 +210,7 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); + int i; if (sPriv->devPrivSize != sizeof(ATIDRIRec)) { fprintf(stderr,"\nERROR! sizeof(ATIDRIRec) does not match passed size from device driver\n"); @@ -318,15 +319,18 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) mach64Screen->driScreen = sPriv; + i = 0; if ( glx_enable_extension != NULL ) { if ( mach64Screen->irq != 0 ) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + mach64Screen->extensions[i++] = &driSwapControlExtension.base; + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } + mach64Screen->extensions[i++] = NULL; + sPriv->extensions = mach64Screen->extensions; return mach64Screen; } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.h b/src/mesa/drivers/dri/mach64/mach64_screen.h index 5305058e2fb..36da7157707 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.h +++ b/src/mesa/drivers/dri/mach64/mach64_screen.h @@ -73,6 +73,8 @@ typedef struct { __DRIscreenPrivate *driScreen; driOptionCache optionCache; + + const __DRIextension *extensions[2]; } mach64ScreenRec, *mach64ScreenPtr; #endif /* __MACH64_SCREEN_H__ */ diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 5b4693983af..eba96486f67 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -193,6 +193,11 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, } +static const __DRIextension *mgaExtensions[] = { + &driSwapControlExtension.base, + NULL +}; + static GLboolean mgaInitDriver(__DRIscreenPrivate *sPriv) { @@ -234,11 +239,11 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) } } + sPriv->extensions = mgaExtensions; + if ( glx_enable_extension != NULL ) { - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 446280c399f..9e5c25d7207 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -100,6 +100,7 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); + int i; if (sPriv->devPrivSize != sizeof(R128DRIRec)) { fprintf(stderr,"\nERROR! sizeof(R128DRIRec) does not match passed size from device driver\n"); @@ -225,15 +226,17 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128Screen->driScreen = sPriv; + i = 0; if ( glx_enable_extension != NULL ) { if ( r128Screen->irq != 0 ) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + r128Screen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } + r128Screen->extensions[i++] = NULL; + sPriv->extensions = r128Screen->extensions; return r128Screen; } diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h index 8db8eea3587..97339272742 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.h +++ b/src/mesa/drivers/dri/r128/r128_screen.h @@ -78,6 +78,8 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; + const __DRIextension *extensions[2]; + } r128ScreenRec, *r128ScreenPtr; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 7e533fef2cc..46160babb01 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -332,11 +332,6 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, return modes; } -static const __DRIextension *radeonExtensions[] = { - &driCopySubBufferExtension.base, - NULL -}; - /* Create the device specific screen private data struct. */ static radeonScreenPtr @@ -347,6 +342,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) unsigned char *RADEONMMIO; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); + int i; if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) { fprintf(stderr,"\nERROR! sizeof(RADEONDRIRec) does not match passed size from device driver\n"); @@ -735,13 +731,13 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) dri_priv->log2GARTTexGran; } - sPriv->extensions = radeonExtensions; + i = 0; + screen->extensions[i++] = &driCopySubBufferExtension.base; if ( glx_enable_extension != NULL ) { if ( screen->irq != 0 ) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + screen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); @@ -750,6 +746,8 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } + screen->extensions[i++] = NULL; + sPriv->extensions = screen->extensions; #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) if (IS_R200_CLASS(screen)) { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 25e6fcf399a..eceab53f5f5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -103,6 +103,8 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; + + const __DRIextension *extensions[3]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 53f4c5c5642..153e401a165 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -100,6 +100,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv) VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); + int i; if (sPriv->devPrivSize != sizeof(VIADRIRec)) { fprintf(stderr,"\nERROR! sizeof(VIADRIRec) does not match passed size from device driver\n"); @@ -174,16 +175,18 @@ viaInitDriver(__DRIscreenPrivate *sPriv) viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset; + i = 0; if ( glx_enable_extension != NULL ) { if ( viaScreen->irqEnabled ) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_swap_control" ); + viaScreen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_control" ); } (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } + viaScreen->extensions[i++] = NULL; + sPriv->extensions = viaScreen->extensions; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 84aa5aef88e..85f87c4da39 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -70,6 +70,8 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; + + const __DRIextension *extensions[2]; } viaScreenPrivate; -- cgit v1.2.3 From 78a6aa57a0155d72280dd91c05513c847bf76f3b Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 16 May 2007 14:10:29 -0400 Subject: Move GLX_MESA_allocate_memory related functions to new extension mechanism. --- include/GL/internal/dri_interface.h | 34 +++++++++++++++-------------- src/glx/x11/glxclient.h | 4 ++++ src/glx/x11/glxcmds.c | 34 ++++++++++++----------------- src/glx/x11/glxext.c | 11 ++++++++++ src/mesa/drivers/dri/i915/intel_screen.c | 8 +++++++ src/mesa/drivers/dri/radeon/radeon_screen.c | 26 +++++++++++++--------- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- 7 files changed, 72 insertions(+), 47 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 7eb168a1b90..fcf82523d99 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -57,9 +57,10 @@ typedef struct __DRIframebufferRec __DRIframebuffer; typedef struct __DRIversionRec __DRIversion; typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods; -typedef struct __DRIextensionRec __DRIextension; +typedef struct __DRIextensionRec __DRIextension; typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension; typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension; +typedef struct __DRIallocateExtensionRec __DRIallocateExtension; /*@}*/ @@ -95,6 +96,22 @@ struct __DRIswapControlExtensionRec { unsigned int (*getSwapInterval)(__DRIdrawable *drawable); }; +/** + * Used by drivers that implement the GLX_MESA_allocate_memory. + */ +#define __DRI_ALLOCATE "DRI_Allocate" +struct __DRIallocateExtensionRec { + __DRIextension base; + + void *(*allocateMemory)(__DRIscreen *screen, GLsizei size, + GLfloat readfreq, GLfloat writefreq, + GLfloat priority); + + void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer); + + GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer); +}; + /** * \name Functions provided by the driver loader. */ @@ -340,21 +357,6 @@ struct __DRIscreenRec { */ int (*getMSC)(__DRIscreen *screen, int64_t *msc); - /** - * Functions associated with MESA_allocate_memory. - * - * \since Internal API version 20030815. - */ - /*@{*/ - void *(*allocateMemory)(__DRIscreen *screen, GLsizei size, - GLfloat readfreq, GLfloat writefreq, - GLfloat priority); - - void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer); - - GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer); - /*@}*/ - /** * Method to create the private DRI context data and initialize the * context dependent methods. diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index 09ae70212ac..b60d8a0b904 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -485,6 +485,10 @@ struct __GLXscreenConfigsRec { __DRIswapControlExtension *swapControl; #endif +#ifdef __DRI_ALLOCATE + __DRIallocateExtension *allocate; +#endif + #endif /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 6fda5125db7..e2deca59686 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -2371,16 +2371,14 @@ PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, float readFreq, float writeFreq, float priority) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_ALLOCATE __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn ); - if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { - if (psc && psc->driScreen.private && psc->driScreen.allocateMemory) { - return (*psc->driScreen.allocateMemory)( &psc->driScreen, size, - readFreq, writeFreq, - priority ); - } - } + if (psc && psc->allocate) + return (*psc->allocate->allocateMemory)( &psc->driScreen, size, + readFreq, writeFreq, + priority ); + #else (void) dpy; (void) scrn; @@ -2396,14 +2394,12 @@ PUBLIC void *glXAllocateMemoryMESA(Display *dpy, int scrn, PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_ALLOCATE __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn ); - if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { - if (psc && psc->driScreen.private && psc->driScreen.freeMemory) { - (*psc->driScreen.freeMemory)( &psc->driScreen, pointer ); - } - } + if (psc && psc->allocate) + (*psc->allocate->freeMemory)( &psc->driScreen, pointer ); + #else (void) dpy; (void) scrn; @@ -2415,14 +2411,12 @@ PUBLIC void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer) PUBLIC GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn, const void *pointer ) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_ALLOCATE __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, scrn ); - if ( __glXExtensionBitIsEnabled( psc, MESA_allocate_memory_bit ) ) { - if (psc && psc->driScreen.private && psc->driScreen.memoryOffset) { - return (*psc->driScreen.memoryOffset)( &psc->driScreen, pointer ); - } - } + if (psc && psc->allocate) + return (*psc->allocate->memoryOffset)( &psc->driScreen, pointer ); + #else (void) dpy; (void) scrn; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 1563ca63943..8275b4b9e07 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1039,6 +1039,17 @@ static void queryExtensions(__GLXscreenConfigs *psc) } #endif +#ifdef __DRI_ALLOCATE + if (strcmp(extensions[i]->name, __DRI_ALLOCATE) == 0) { + psc->allocate = (__DRIallocateExtension *) extensions[i]; + __glXScrEnableExtension(&psc->driScreen, + "GLX_SGI_swap_control"); + __glXScrEnableExtension(&psc->driScreen, + "GLX_MESA_swap_control"); + + } +#endif + /* Ignore unknown extensions */ } } diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index f507a3bf05f..27bf5e12a20 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -419,9 +419,17 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelPrintSAREA(sarea); } +static const __DRIallocateExtension intelAllocateExtension = { + { __DRI_ALLOCATE }, + intelAllocateMemoryMESA, + intelFreeMemoryMESA, + intelGetMemoryOffsetMESA +}; + static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, + &intelAllocateExtension.base, NULL }; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 46160babb01..362d70f9e57 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -332,6 +332,17 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, return modes; } +#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) + +static const __DRIallocateExtension r200AllocateExtension = { + { __DRI_ALLOCATE }, + r200AllocateMemoryMESA, + r200FreeMemoryMESA, + r200GetMemoryOffsetMESA +}; + +#endif + /* Create the device specific screen private data struct. */ static radeonScreenPtr @@ -741,22 +752,17 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) } (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); - if (IS_R200_CLASS(screen)) - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_allocate_memory" ); - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } - screen->extensions[i++] = NULL; - sPriv->extensions = screen->extensions; #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - if (IS_R200_CLASS(screen)) { - sPriv->psc->allocateMemory = (void *) r200AllocateMemoryMESA; - sPriv->psc->freeMemory = (void *) r200FreeMemoryMESA; - sPriv->psc->memoryOffset = (void *) r200GetMemoryOffsetMESA; - } + if (IS_R200_CLASS(screen)) + screen->extensions[i++] = &r200AllocateExtension.base; #endif + screen->extensions[i++] = NULL; + sPriv->extensions = screen->extensions; + screen->driScreen = sPriv; screen->sarea_priv_offset = dri_priv->sarea_priv_offset; return screen; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index eceab53f5f5..954096f6770 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[3]; + const __DRIextension *extensions[4]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ -- cgit v1.2.3 From a7a0a2beb54dcb78d7e0ab64cf2f5a6ede8191a4 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 16 May 2007 15:50:40 -0400 Subject: Move GLX_MESA_swap_frame_usage DRI entry points to the new mechanism. --- include/GL/internal/dri_interface.h | 41 ++++++++++++++++++----------- src/glx/x11/glxclient.h | 4 +++ src/glx/x11/glxcmds.c | 40 +++++++++++++--------------- src/glx/x11/glxext.c | 11 +++++--- src/mesa/drivers/dri/common/dri_util.c | 18 ++++++++----- src/mesa/drivers/dri/common/dri_util.h | 1 + src/mesa/drivers/dri/i915/intel_screen.c | 2 +- src/mesa/drivers/dri/i965/intel_screen.c | 2 +- src/mesa/drivers/dri/mach64/mach64_screen.c | 3 +-- src/mesa/drivers/dri/mach64/mach64_screen.h | 2 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 2 +- src/mesa/drivers/dri/r128/r128_screen.c | 3 +-- src/mesa/drivers/dri/r128/r128_screen.h | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- src/mesa/drivers/dri/unichrome/via_screen.c | 2 +- src/mesa/drivers/dri/unichrome/via_screen.h | 2 +- 17 files changed, 78 insertions(+), 61 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index fcf82523d99..c518fd0849c 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -61,6 +61,7 @@ typedef struct __DRIextensionRec __DRIextension; typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension; typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension; typedef struct __DRIallocateExtensionRec __DRIallocateExtension; +typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension; /*@}*/ @@ -112,6 +113,30 @@ struct __DRIallocateExtensionRec { GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer); }; +/** + * Used by drivers that implement the GLX_MESA_swap_frame_usage extension. + */ +#define __DRI_FRAME_TRACKING "DRI_FrameTracking" +struct __DRIframeTrackingExtensionRec { + __DRIextension base; + + /** + * Enable or disable frame usage tracking. + * + * \since Internal API version 20030317. + */ + int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable); + + /** + * Retrieve frame usage information. + * + * \since Internal API version 20030317. + */ + int (*queryFrameTracking)(__DRIdrawable *drawable, + int64_t * sbc, int64_t * missedFrames, + float * lastMissedUsage, float * usage); +}; + /** * \name Functions provided by the driver loader. */ @@ -480,22 +505,6 @@ struct __DRIdrawableRec { int64_t (*swapBuffersMSC)(__DRIdrawable *drawable, int64_t target_msc, int64_t divisor, int64_t remainder); - - /** - * Enable or disable frame usage tracking. - * - * \since Internal API version 20030317. - */ - int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable); - - /** - * Retrieve frame usage information. - * - * \since Internal API version 20030317. - */ - int (*queryFrameTracking)(__DRIdrawable *drawable, - int64_t * sbc, int64_t * missedFrames, - float * lastMissedUsage, float * usage); }; #endif diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index b60d8a0b904..d9fc7a5a6c3 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -489,6 +489,10 @@ struct __GLXscreenConfigsRec { __DRIallocateExtension *allocate; #endif +#ifdef __DRI_FRAME_TRACKING + __DRIframeTrackingExtension *frameTracking; +#endif + #endif /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index e2deca59686..2b0403d37c9 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1835,15 +1835,13 @@ static int __glXGetSwapIntervalMESA(void) static GLint __glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable) { int status = GLX_BAD_CONTEXT; -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_FRAME_TRACKING int screen; __DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen); __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen); - if ( (pdraw != NULL) && (pdraw->frameTracking != NULL) - && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { - status = pdraw->frameTracking(pdraw, GL_TRUE); - } + if (pdraw != NULL && psc->frameTracking != NULL) + status = psc->frameTracking->frameTracking(pdraw, GL_TRUE); #else (void) dpy; (void) drawable; @@ -1855,15 +1853,13 @@ static GLint __glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable) static GLint __glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable) { int status = GLX_BAD_CONTEXT; -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_FRAME_TRACKING int screen; __DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen); __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen); - if ( (pdraw != NULL) && (pdraw->frameTracking != NULL) - && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { - status = pdraw->frameTracking(pdraw, GL_FALSE); - } + if (pdraw != NULL && psc->frameTracking != NULL) + status = psc->frameTracking->frameTracking(pdraw, GL_FALSE); #else (void) dpy; (void) drawable; @@ -1876,18 +1872,19 @@ static GLint __glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, GLfloat *usage) { int status = GLX_BAD_CONTEXT; -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_FRAME_TRACKING int screen; __DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen); __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen); - if ( (pdraw != NULL ) && (pdraw->queryFrameTracking != NULL) - && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { - int64_t sbc, missedFrames; - float lastMissedUsage; + if (pdraw != NULL && psc->frameTracking != NULL) { + int64_t sbc, missedFrames; + float lastMissedUsage; - status = pdraw->queryFrameTracking(pdraw, &sbc, &missedFrames, - &lastMissedUsage, usage); + status = psc->frameTracking->queryFrameTracking(pdraw, &sbc, + &missedFrames, + &lastMissedUsage, + usage); } #else (void) dpy; @@ -1903,17 +1900,16 @@ static GLint __glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, GLfloat *lastMissedUsage) { int status = GLX_BAD_CONTEXT; -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_FRAME_TRACKING int screen; __DRIdrawable * const pdraw = GetDRIDrawable(dpy, drawable, & screen); __GLXscreenConfigs * const psc = GetGLXScreenConfigs(dpy, screen); - if ( (pdraw != NULL ) && (pdraw->queryFrameTracking != NULL) - && __glXExtensionBitIsEnabled( psc, MESA_swap_frame_usage_bit ) ) { + if (pdraw != NULL && psc->frameTracking != NULL) { float usage; - status = pdraw->queryFrameTracking(pdraw, sbc, missedFrames, - lastMissedUsage, &usage); + status = psc->frameTracking->queryFrameTracking(pdraw, sbc, missedFrames, + lastMissedUsage, &usage); } #else (void) dpy; diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 8275b4b9e07..8a70e677342 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1024,7 +1024,6 @@ static void queryExtensions(__GLXscreenConfigs *psc) psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i]; __glXScrEnableExtension(&psc->driScreen, "GLX_MESA_copy_sub_buffer"); - } #endif @@ -1035,7 +1034,6 @@ static void queryExtensions(__GLXscreenConfigs *psc) "GLX_SGI_swap_control"); __glXScrEnableExtension(&psc->driScreen, "GLX_MESA_swap_control"); - } #endif @@ -1046,7 +1044,14 @@ static void queryExtensions(__GLXscreenConfigs *psc) "GLX_SGI_swap_control"); __glXScrEnableExtension(&psc->driScreen, "GLX_MESA_swap_control"); - + } +#endif + +#ifdef __DRI_FRAME_TRACKING + if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) { + psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i]; + __glXScrEnableExtension(&psc->driScreen, + "GLX_MESA_swap_frame_usage"); } #endif diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index ba677f6ff86..7815f361a83 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -52,11 +52,6 @@ static const int empty_attribute_list[1] = { None }; */ static int api_ver = 0; -/* forward declarations */ -static int driQueryFrameTracking( __DRIdrawable *drawable, - int64_t *sbc, int64_t *missedFrames, - float *lastMissedUsage, float *usage ); - static void *driCreateNewDrawable(__DRIscreen *screen, const __GLcontextModes *modes, __DRIdrawable *pdraw, @@ -515,8 +510,6 @@ static void *driCreateNewDrawable(__DRIscreen *screen, pdraw->waitForSBC = driWaitForSBC; pdraw->waitForMSC = driWaitForMSC; pdraw->swapBuffersMSC = driSwapBuffersMSC; - pdraw->frameTracking = NULL; - pdraw->queryFrameTracking = driQueryFrameTracking; /* This special default value is replaced with the configured * default value when the drawable is first bound to a direct @@ -825,6 +818,12 @@ int driCompareGLXAPIVersion( GLint required_version ) } +static int +driFrameTracking(__DRIdrawable *drawable, GLboolean enable) +{ + return GLX_BAD_CONTEXT; +} + static int driQueryFrameTracking(__DRIdrawable *drawable, int64_t * sbc, int64_t * missedFrames, @@ -849,6 +848,11 @@ driQueryFrameTracking(__DRIdrawable *drawable, return status; } +const __DRIframeTrackingExtension driFrameTrackingExtension = { + { __DRI_FRAME_TRACKING }, + driFrameTracking, + driQueryFrameTracking +}; /** * Calculate amount of swap interval used between GLX buffer swaps. diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 78320307d60..a7149bc5525 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -78,6 +78,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); */ extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIswapControlExtension driSwapControlExtension; +extern const __DRIframeTrackingExtension driFrameTrackingExtension; /** * Used by DRI_VALIDATE_DRAWABLE_INFO diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 27bf5e12a20..041ff6bef08 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -430,6 +430,7 @@ static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, &intelAllocateExtension.base, + &driFrameTrackingExtension.base, NULL }; @@ -539,7 +540,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) if (glx_enable_extension != NULL) { (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); - (*glx_enable_extension) (sPriv->psc, "GLX_MESA_swap_frame_usage"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); } diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index c75a86bf5b2..ed8d207a494 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -267,6 +267,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, + &driFrameTrackingExtension.base, NULL }; @@ -359,7 +360,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) if (glx_enable_extension != NULL) { (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 46314b426f7..adbed098777 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -320,14 +320,13 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) mach64Screen->driScreen = sPriv; i = 0; + mach64Screen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( mach64Screen->irq != 0 ) { mach64Screen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } - - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } mach64Screen->extensions[i++] = NULL; sPriv->extensions = mach64Screen->extensions; diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.h b/src/mesa/drivers/dri/mach64/mach64_screen.h index 36da7157707..732cb3f23ad 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.h +++ b/src/mesa/drivers/dri/mach64/mach64_screen.h @@ -74,7 +74,7 @@ typedef struct { driOptionCache optionCache; - const __DRIextension *extensions[2]; + const __DRIextension *extensions[3]; } mach64ScreenRec, *mach64ScreenPtr; #endif /* __MACH64_SCREEN_H__ */ diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index eba96486f67..198c5d5ca95 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -195,6 +195,7 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, static const __DRIextension *mgaExtensions[] = { &driSwapControlExtension.base, + &driFrameTrackingExtension.base, NULL }; @@ -242,7 +243,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = mgaExtensions; if ( glx_enable_extension != NULL ) { - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 9e5c25d7207..c7bd8762831 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -227,13 +227,12 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) r128Screen->driScreen = sPriv; i = 0; + r128Screen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( r128Screen->irq != 0 ) { r128Screen->extensions[i++] = &driSwapControlExtension.base; (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } - - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } r128Screen->extensions[i++] = NULL; sPriv->extensions = r128Screen->extensions; diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h index 97339272742..75dc084d9d1 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.h +++ b/src/mesa/drivers/dri/r128/r128_screen.h @@ -78,7 +78,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[2]; + const __DRIextension *extensions[3]; } r128ScreenRec, *r128ScreenPtr; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 362d70f9e57..4eaff652c7c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -744,6 +744,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) i = 0; screen->extensions[i++] = &driCopySubBufferExtension.base; + screen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( screen->irq != 0 ) { @@ -751,7 +752,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); } - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); } diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 954096f6770..10012109179 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[4]; + const __DRIextension *extensions[5]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 153e401a165..025d8f63af4 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -176,6 +176,7 @@ viaInitDriver(__DRIscreenPrivate *sPriv) viaScreen->sareaPrivOffset = gDRIPriv->sarea_priv_offset; i = 0; + viaScreen->extensions[i++] = &driFrameTrackingExtension.base; if ( glx_enable_extension != NULL ) { if ( viaScreen->irqEnabled ) { viaScreen->extensions[i++] = &driSwapControlExtension.base; @@ -183,7 +184,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv) } (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( sPriv->psc, "GLX_MESA_swap_frame_usage" ); } viaScreen->extensions[i++] = NULL; sPriv->extensions = viaScreen->extensions; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 85f87c4da39..3dc52ba96a8 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -71,7 +71,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[2]; + const __DRIextension *extensions[3]; } viaScreenPrivate; -- cgit v1.2.3 From 106a6f29bbdc71982afd629bdf89369cefd1459e Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 16 May 2007 18:13:41 -0400 Subject: Move media stream counter entry points to new extension. --- include/GL/internal/dri_interface.h | 76 ++++++++++------------------- src/glx/x11/glxclient.h | 4 ++ src/glx/x11/glxcmds.c | 55 ++++++++++----------- src/glx/x11/glxext.c | 15 +++++- src/mesa/drivers/dri/common/dri_util.c | 45 ++--------------- src/mesa/drivers/dri/common/dri_util.h | 1 + src/mesa/drivers/dri/i915/intel_screen.c | 2 +- src/mesa/drivers/dri/i965/intel_screen.c | 5 +- src/mesa/drivers/dri/mach64/mach64_screen.c | 11 ++--- src/mesa/drivers/dri/mach64/mach64_screen.h | 2 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 5 +- src/mesa/drivers/dri/r128/r128_screen.c | 10 ++-- src/mesa/drivers/dri/r128/r128_screen.h | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 13 ++--- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- src/mesa/drivers/dri/unichrome/via_screen.c | 12 ++--- src/mesa/drivers/dri/unichrome/via_screen.h | 2 +- 17 files changed, 102 insertions(+), 160 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index c518fd0849c..2c91876e0db 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -62,6 +62,7 @@ typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension; typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension; typedef struct __DRIallocateExtensionRec __DRIallocateExtension; typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension; +typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension; /*@}*/ @@ -137,6 +138,32 @@ struct __DRIframeTrackingExtensionRec { float * lastMissedUsage, float * usage); }; + +/** + * Used by drivers that implement the GLX_SGI_video_sync extension. + */ +#define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter" +struct __DRImediaStreamCounterExtensionRec { + __DRIextension base; + + /** + * Get the number of vertical refreshes since some point in time before + * this function was first called (i.e., system start up). + */ + int (*getMSC)(__DRIscreen *screen, int64_t *msc); + + /** + * Wait for the MSC to equal target_msc, or, if that has already passed, + * the next time (MSC % divisor) is equal to remainder. If divisor is + * zero, the function will return as soon as MSC is greater than or equal + * to target_msc. + */ + int (*waitForMSC)(__DRIdrawable *drawable, + int64_t target_msc, int64_t divisor, int64_t remainder, + int64_t * msc, int64_t * sbc); +}; + + /** * \name Functions provided by the driver loader. */ @@ -374,14 +401,6 @@ struct __DRIscreenRec { */ void *private; - /** - * Get the number of vertical refreshes since some point in time before - * this function was first called (i.e., system start up). - * - * \since Internal API version 20030317. - */ - int (*getMSC)(__DRIscreen *screen, int64_t *msc); - /** * Method to create the private DRI context data and initialize the * context dependent methods. @@ -464,47 +483,6 @@ struct __DRIdrawableRec { * screen used to create this drawable. Never dereferenced in libGL. */ void *private; - - /** - * Get the number of completed swap buffers for this drawable. - * - * \since Internal API version 20030317. - */ - int (*getSBC)(__DRIdrawable *drawable, int64_t *sbc); - - /** - * Wait for the SBC to be greater than or equal target_sbc. - * - * \since Internal API version 20030317. - */ - int (*waitForSBC)(__DRIdrawable *drawable, - int64_t target_sbc, - int64_t * msc, int64_t * sbc); - - /** - * Wait for the MSC to equal target_msc, or, if that has already passed, - * the next time (MSC % divisor) is equal to remainder. If divisor is - * zero, the function will return as soon as MSC is greater than or equal - * to target_msc. - * - * \since Internal API version 20030317. - */ - int (*waitForMSC)(__DRIdrawable *drawable, - int64_t target_msc, int64_t divisor, int64_t remainder, - int64_t * msc, int64_t * sbc); - - /** - * Like \c swapBuffers, but does NOT have an implicit \c glFlush. Once - * rendering is complete, waits until MSC is equal to target_msc, or - * if that has already passed, waits until (MSC % divisor) is equal - * to remainder. If divisor is zero, the swap will happen as soon as - * MSC is greater than or equal to target_msc. - * - * \since Internal API version 20030317. - */ - int64_t (*swapBuffersMSC)(__DRIdrawable *drawable, - int64_t target_msc, - int64_t divisor, int64_t remainder); }; #endif diff --git a/src/glx/x11/glxclient.h b/src/glx/x11/glxclient.h index d9fc7a5a6c3..0709f3ef26e 100644 --- a/src/glx/x11/glxclient.h +++ b/src/glx/x11/glxclient.h @@ -493,6 +493,10 @@ struct __GLXscreenConfigsRec { __DRIframeTrackingExtension *frameTracking; #endif +#ifdef __DRI_MEDIA_STREAM_COUNTER + __DRImediaStreamCounterExtension *msc; +#endif + #endif /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 2b0403d37c9..a680c646d95 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1931,19 +1931,18 @@ static int __glXGetVideoSyncSGI(unsigned int *count) * FIXME: there should be a GLX encoding for this call. I can find no * FIXME: documentation for the GLX encoding. */ -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_MEDIA_STREAM_COUNTER GLXContext gc = __glXGetCurrentContext(); if ( (gc != NULL) && gc->isDirect ) { __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen ); - if ( __glXExtensionBitIsEnabled( psc, SGI_video_sync_bit ) - && psc->driScreen.private && psc->driScreen.getMSC) { + if (psc->msc != NULL && psc->driScreen.private != NULL) { int ret; int64_t temp; - ret = psc->driScreen.getMSC(&psc->driScreen, &temp); + ret = psc->msc->getMSC(&psc->driScreen, &temp); *count = (unsigned) temp; return (ret == 0) ? 0 : GLX_BAD_CONTEXT; } @@ -1956,7 +1955,7 @@ static int __glXGetVideoSyncSGI(unsigned int *count) static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_MEDIA_STREAM_COUNTER GLXContext gc = __glXGetCurrentContext(); if ( divisor <= 0 || remainder < 0 ) @@ -1965,17 +1964,16 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count if ( (gc != NULL) && gc->isDirect ) { __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen ); - if ( __glXExtensionBitIsEnabled( psc, SGI_video_sync_bit ) - && psc->driScreen.private ) { + if (psc->msc != NULL && psc->driScreen.private ) { __DRIdrawable * const pdraw = GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); - if ( (pdraw != NULL) && (pdraw->waitForMSC != NULL) ) { + if (pdraw != NULL) { int ret; int64_t msc; int64_t sbc; - ret = (*pdraw->waitForMSC)(pdraw, 0, - divisor, remainder, &msc, &sbc); + ret = (*psc->msc->waitForMSC)(pdraw, 0, + divisor, remainder, &msc, &sbc); *count = (unsigned) msc; return (ret == 0) ? 0 : GLX_BAD_CONTEXT; } @@ -2130,7 +2128,7 @@ static Bool __glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max) static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc) { -#ifdef GLX_DIRECT_RENDERING +#if defined(__DRI_SWAP_BUFFER_COUNTER) && defined(__DRI_MEDIA_STREAM_COUNTER) __GLXdisplayPrivate * const priv = __glXInitialize(dpy); if ( priv != NULL ) { @@ -2139,11 +2137,10 @@ static Bool __glXGetSyncValuesOML(Display *dpy, GLXDrawable drawable, __GLXscreenConfigs * const psc = &priv->screenConfigs[i]; assert( (pdraw == NULL) || (i != -1) ); - return ( (pdraw && pdraw->getSBC && psc->driScreen.getMSC) - && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) - && ((*psc->driScreen.getMSC)(&psc->driScreen, msc) == 0) - && ((*pdraw->getSBC)(pdraw, sbc ) == 0) - && (__glXGetUST( ust ) == 0) ); + return ( (pdraw && psc->sbc && psc->msc) + && ((*psc->msc->getMSC)(&psc->driScreen, msc) == 0) + && ((*psc->sbc->getSBC)(pdraw, sbc) == 0) + && (__glXGetUST(ust) == 0) ); } #else (void) dpy; @@ -2248,7 +2245,7 @@ static int64_t __glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_SWAP_BUFFER_COUNTER int screen; __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, & screen ); __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen ); @@ -2263,10 +2260,10 @@ static int64_t __glXSwapBuffersMscOML(Display *dpy, GLXDrawable drawable, if ( divisor > 0 && remainder >= divisor ) return -1; - if ( (pdraw != NULL) && (pdraw->swapBuffersMSC != NULL) - && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) { - return (*pdraw->swapBuffersMSC)(pdraw, target_msc, divisor, remainder); - } + if (pdraw != NULL && psc->counters != NULL) + return (*psc->sbc->swapBuffersMSC)(pdraw, target_msc, + divisor, remainder); + #else (void) dpy; (void) drawable; @@ -2283,7 +2280,7 @@ static Bool __glXWaitForMscOML(Display * dpy, GLXDrawable drawable, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_MEDIA_STREAM_COUNTER int screen; __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, & screen ); __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen ); @@ -2297,10 +2294,9 @@ static Bool __glXWaitForMscOML(Display * dpy, GLXDrawable drawable, if ( divisor > 0 && remainder >= divisor ) return False; - if ( (pdraw != NULL) && (pdraw->waitForMSC != NULL) - && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit ) ) { - ret = (*pdraw->waitForMSC)(pdraw, target_msc, - divisor, remainder, msc, sbc); + if (pdraw != NULL && psc->msc != NULL) { + ret = (*psc->msc->waitForMSC)(pdraw, target_msc, + divisor, remainder, msc, sbc); /* __glXGetUST returns zero on success and non-zero on failure. * This function returns True on success and False on failure. @@ -2325,7 +2321,7 @@ static Bool __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc ) { -#ifdef GLX_DIRECT_RENDERING +#ifdef __DRI_SWAP_BUFFER_COUNTER int screen; __DRIdrawable *pdraw = GetDRIDrawable( dpy, drawable, & screen ); __GLXscreenConfigs * const psc = GetGLXScreenConfigs( dpy, screen ); @@ -2337,9 +2333,8 @@ static Bool __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable, if ( target_sbc < 0 ) return False; - if ( (pdraw != NULL) && (pdraw->waitForSBC != NULL) - && __glXExtensionBitIsEnabled( psc, OML_sync_control_bit )) { - ret = (*pdraw->waitForSBC)(pdraw, target_sbc, msc, sbc); + if (pdraw != NULL && psc->sbc != NULL) { + ret = (*psc->sbc->waitForSBC)(pdraw, target_sbc, msc, sbc); /* __glXGetUST returns zero on success and non-zero on failure. * This function returns True on success and False on failure. diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 8a70e677342..643db487c58 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1051,10 +1051,23 @@ static void queryExtensions(__GLXscreenConfigs *psc) if (strcmp(extensions[i]->name, __DRI_FRAME_TRACKING) == 0) { psc->frameTracking = (__DRIframeTrackingExtension *) extensions[i]; __glXScrEnableExtension(&psc->driScreen, - "GLX_MESA_swap_frame_usage"); + "GLX_MESA_swap_frame_usage"); } #endif +#ifdef __DRI_MEDIA_STREAM_COUNTER + if (strcmp(extensions[i]->name, __DRI_MEDIA_STREAM_COUNTER) == 0) { + psc->msc = (__DRImediaStreamCounterExtension *) extensions[i]; + __glXScrEnableExtension(&psc->driScreen, + "GLX_SGI_video_sync"); + } +#endif + +#ifdef __DRI_SWAP_BUFFER_COUNTER + /* No driver supports this at this time and the extension is + * not defined in dri_interface.h. Will enable + * GLX_OML_sync_control if implemented. */ +#endif /* Ignore unknown extensions */ } } diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 7815f361a83..e20c4fe5fac 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -358,31 +358,6 @@ static int driGetMSC( __DRIscreen *screen, int64_t *msc ) return sPriv->DriverAPI.GetMSC( sPriv, msc ); } -/** - * Called directly from a number of higher-level GLX functions. - */ -static int driGetSBC(__DRIdrawable *drawable, int64_t *sbc) -{ - __DRIdrawablePrivate *dPriv = drawable->private; - __DRIswapInfo sInfo; - int status; - - - status = dPriv->driScreenPriv->DriverAPI.GetSwapInfo( dPriv, & sInfo ); - *sbc = sInfo.swap_count; - - return status; -} - -static int driWaitForSBC(__DRIdrawable *drawable, int64_t target_sbc, - int64_t * msc, int64_t * sbc) -{ - __DRIdrawablePrivate *dPriv = drawable->private; - - return dPriv->driScreenPriv->DriverAPI.WaitForSBC( dPriv, target_sbc, - msc, sbc ); -} - static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc, int64_t * sbc) @@ -409,15 +384,11 @@ static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, return status; } -static int64_t driSwapBuffersMSC(__DRIdrawable *drawable, int64_t target_msc, - int64_t divisor, int64_t remainder) -{ - __DRIdrawablePrivate *dPriv = drawable->private; - - return dPriv->driScreenPriv->DriverAPI.SwapBuffersMSC( dPriv, target_msc, - divisor, - remainder ); -} +const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = { + { __DRI_MEDIA_STREAM_COUNTER }, + driGetMSC, + driWaitForMSC, +}; static void driCopySubBuffer(__DRIdrawable *drawable, int x, int y, int w, int h) @@ -506,11 +477,6 @@ static void *driCreateNewDrawable(__DRIscreen *screen, pdraw->destroyDrawable = driDestroyDrawable; pdraw->swapBuffers = driSwapBuffers; /* called by glXSwapBuffers() */ - pdraw->getSBC = driGetSBC; - pdraw->waitForSBC = driWaitForSBC; - pdraw->waitForMSC = driWaitForMSC; - pdraw->swapBuffersMSC = driSwapBuffersMSC; - /* This special default value is replaced with the configured * default value when the drawable is first bound to a direct * rendering context. @@ -776,7 +742,6 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, psc->destroyScreen = driDestroyScreen; psc->getExtensions = driGetExtensions; psc->createNewDrawable = driCreateNewDrawable; - psc->getMSC = driGetMSC; psc->createNewContext = driCreateNewContext; if (internal_api_version >= 20070121) diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index a7149bc5525..e43a5b752e8 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -79,6 +79,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIswapControlExtension driSwapControlExtension; extern const __DRIframeTrackingExtension driFrameTrackingExtension; +extern const __DRImediaStreamCounterExtension driMediaStreamCounterExtension; /** * Used by DRI_VALIDATE_DRAWABLE_INFO diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 041ff6bef08..60d375874df 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -431,6 +431,7 @@ static const __DRIextension *intelExtensions[] = { &driSwapControlExtension.base, &intelAllocateExtension.base, &driFrameTrackingExtension.base, + &driMediaStreamCounterExtension.base, NULL }; @@ -539,7 +540,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = intelExtensions; if (glx_enable_extension != NULL) { - (*glx_enable_extension) (sPriv->psc, "GLX_SGI_video_sync"); (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); } diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index ed8d207a494..a4d63599e55 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -268,6 +268,7 @@ static const __DRIextension *intelExtensions[] = { &driCopySubBufferExtension.base, &driSwapControlExtension.base, &driFrameTrackingExtension.base, + &driMediaStreamCounterExtension.base, NULL }; @@ -358,10 +359,8 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = intelExtensions; - if (glx_enable_extension != NULL) { - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); + if (glx_enable_extension != NULL) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - } return GL_TRUE; } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index adbed098777..04eb0815149 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -208,8 +208,6 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) { mach64ScreenPtr mach64Screen; ATIDRIPtr serverInfo = (ATIDRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); int i; if (sPriv->devPrivSize != sizeof(ATIDRIRec)) { @@ -321,12 +319,9 @@ mach64CreateScreen( __DRIscreenPrivate *sPriv ) i = 0; mach64Screen->extensions[i++] = &driFrameTrackingExtension.base; - if ( glx_enable_extension != NULL ) { - if ( mach64Screen->irq != 0 ) { - mach64Screen->extensions[i++] = &driSwapControlExtension.base; - - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - } + if ( mach64Screen->irq != 0 ) { + mach64Screen->extensions[i++] = &driSwapControlExtension.base; + mach64Screen->extensions[i++] = &driMediaStreamCounterExtension.base; } mach64Screen->extensions[i++] = NULL; sPriv->extensions = mach64Screen->extensions; diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.h b/src/mesa/drivers/dri/mach64/mach64_screen.h index 732cb3f23ad..766554d7e4d 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.h +++ b/src/mesa/drivers/dri/mach64/mach64_screen.h @@ -74,7 +74,7 @@ typedef struct { driOptionCache optionCache; - const __DRIextension *extensions[3]; + const __DRIextension *extensions[4]; } mach64ScreenRec, *mach64ScreenPtr; #endif /* __MACH64_SCREEN_H__ */ diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 198c5d5ca95..6f138351ccd 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -196,6 +196,7 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, static const __DRIextension *mgaExtensions[] = { &driSwapControlExtension.base, &driFrameTrackingExtension.base, + &driMediaStreamCounterExtension.base, NULL }; @@ -242,10 +243,8 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = mgaExtensions; - if ( glx_enable_extension != NULL ) { + if ( glx_enable_extension != NULL ) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - } if (serverInfo->chipset != MGA_CARD_TYPE_G200 && serverInfo->chipset != MGA_CARD_TYPE_G400) { diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index c7bd8762831..9d65ebddf7d 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -98,8 +98,6 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) { r128ScreenPtr r128Screen; R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); int i; if (sPriv->devPrivSize != sizeof(R128DRIRec)) { @@ -228,11 +226,9 @@ r128CreateScreen( __DRIscreenPrivate *sPriv ) i = 0; r128Screen->extensions[i++] = &driFrameTrackingExtension.base; - if ( glx_enable_extension != NULL ) { - if ( r128Screen->irq != 0 ) { - r128Screen->extensions[i++] = &driSwapControlExtension.base; - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - } + if ( r128Screen->irq != 0 ) { + r128Screen->extensions[i++] = &driSwapControlExtension.base; + r128Screen->extensions[i++] = &driMediaStreamCounterExtension.base; } r128Screen->extensions[i++] = NULL; sPriv->extensions = r128Screen->extensions; diff --git a/src/mesa/drivers/dri/r128/r128_screen.h b/src/mesa/drivers/dri/r128/r128_screen.h index 75dc084d9d1..c333713766c 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.h +++ b/src/mesa/drivers/dri/r128/r128_screen.h @@ -78,7 +78,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[3]; + const __DRIextension *extensions[4]; } r128ScreenRec, *r128ScreenPtr; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 4eaff652c7c..56493f5a3aa 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -745,15 +745,12 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) i = 0; screen->extensions[i++] = &driCopySubBufferExtension.base; screen->extensions[i++] = &driFrameTrackingExtension.base; - - if ( glx_enable_extension != NULL ) { - if ( screen->irq != 0 ) { - screen->extensions[i++] = &driSwapControlExtension.base; - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - } - - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); + if ( screen->irq != 0 ) { + screen->extensions[i++] = &driSwapControlExtension.base; + screen->extensions[i++] = &driMediaStreamCounterExtension.base; } + if ( glx_enable_extension != NULL ) + (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) if (IS_R200_CLASS(screen)) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 10012109179..0caac17dafb 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[5]; + const __DRIextension *extensions[6]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 025d8f63af4..fddf0799346 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -177,14 +177,14 @@ viaInitDriver(__DRIscreenPrivate *sPriv) i = 0; viaScreen->extensions[i++] = &driFrameTrackingExtension.base; - if ( glx_enable_extension != NULL ) { - if ( viaScreen->irqEnabled ) { - viaScreen->extensions[i++] = &driSwapControlExtension.base; - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_video_sync" ); - } + if ( viaScreen->irqEnabled ) { + viaScreen->extensions[i++] = &driSwapControlExtension.base; + viaScreen->extensions[i++] = &driMediaStreamCounterExtension.base; + } + if ( glx_enable_extension != NULL ) (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - } + viaScreen->extensions[i++] = NULL; sPriv->extensions = viaScreen->extensions; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 3dc52ba96a8..5e5bc851b05 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -71,7 +71,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[3]; + const __DRIextension *extensions[4]; } viaScreenPrivate; -- cgit v1.2.3 From f968f67e6214416f04b8875ce59a94a02f464c81 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 17 May 2007 14:39:06 -0400 Subject: Add a DRI_ReadDrawable marker extension to signal read drawable capability. --- include/GL/internal/dri_interface.h | 5 +++++ src/glx/x11/glxext.c | 7 +++++++ src/mesa/drivers/dri/common/dri_util.c | 8 ++++++++ src/mesa/drivers/dri/common/dri_util.h | 1 + src/mesa/drivers/dri/i915/intel_screen.c | 9 +-------- src/mesa/drivers/dri/i965/intel_screen.c | 6 +----- src/mesa/drivers/dri/mga/mga_xmesa.c | 6 +----- src/mesa/drivers/dri/radeon/radeon_screen.c | 6 ++---- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- src/mesa/drivers/dri/savage/savage_xmesa.c | 11 +++++------ src/mesa/drivers/dri/tdfx/tdfx_screen.c | 10 +++++----- src/mesa/drivers/dri/unichrome/via_screen.c | 6 +----- src/mesa/drivers/dri/unichrome/via_screen.h | 2 +- 13 files changed, 39 insertions(+), 40 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 2c91876e0db..cce3b6fcf02 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -78,6 +78,11 @@ struct __DRIextensionRec { const char *name; }; +/** + * Used by drivers to indicate support for setting the read drawable. + */ +#define __DRI_READ_DRAWABLE "DRI_ReadDrawable" + /** * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension. */ diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 643db487c58..3db163af1ee 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1068,6 +1068,13 @@ static void queryExtensions(__GLXscreenConfigs *psc) * not defined in dri_interface.h. Will enable * GLX_OML_sync_control if implemented. */ #endif + +#ifdef __DRI_READ_DRAWABLE + if (strcmp(extensions[i]->name, __DRI_READ_DRAWABLE) == 0) { + __glXScrEnableExtension(&psc->driScreen, + "GLX_SGI_make_current_read"); + } +#endif /* Ignore unknown extensions */ } } diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index e20c4fe5fac..b88592313ed 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -46,6 +46,14 @@ const __DRIinterfaceMethods * dri_interface = NULL; static const int empty_attribute_list[1] = { None }; +/** + * This is just a token extension used to signal that the driver + * supports setting a read drawable. + */ +const __DRIextension driReadDrawableExtension = { + __DRI_READ_DRAWABLE +}; + /** * Cached copy of the internal API version used by libGL and the client-side * DRI driver. diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index e43a5b752e8..91992a9a242 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -76,6 +76,7 @@ extern __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp); /** * Extensions. */ +extern const __DRIextension driReadDrawableExtension; extern const __DRIcopySubBufferExtension driCopySubBufferExtension; extern const __DRIswapControlExtension driSwapControlExtension; extern const __DRIframeTrackingExtension driFrameTrackingExtension; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 60d375874df..191d26e84bd 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -427,6 +427,7 @@ static const __DRIallocateExtension intelAllocateExtension = { }; static const __DRIextension *intelExtensions[] = { + &driReadDrawableExtension, &driCopySubBufferExtension.base, &driSwapControlExtension.base, &intelAllocateExtension.base, @@ -442,10 +443,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) I830DRIPtr gDRIPriv = (I830DRIPtr) sPriv->pDevPriv; drmI830Sarea *sarea; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface-> - getProcAddress("glxEnableExtension")); - if (sPriv->devPrivSize != sizeof(I830DRIRec)) { fprintf(stderr, "\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n"); @@ -539,10 +536,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = intelExtensions; - if (glx_enable_extension != NULL) { - (*glx_enable_extension) (sPriv->psc, "GLX_SGI_make_current_read"); - } - /* If we've got a new enough DDX that's initializing TTM and giving us * object handles for the shared buffers, use that. */ diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index a4d63599e55..e35f7da9387 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -265,6 +265,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate *intelScreen, } static const __DRIextension *intelExtensions[] = { + &driReadDrawableExtension, &driCopySubBufferExtension.base, &driSwapControlExtension.base, &driFrameTrackingExtension.base, @@ -276,8 +277,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) { intelScreenPrivate *intelScreen; I830DRIPtr gDRIPriv = (I830DRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); volatile drmI830Sarea *sarea; if (sPriv->devPrivSize != sizeof(I830DRIRec)) { @@ -358,9 +357,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) } sPriv->extensions = intelExtensions; - - if (glx_enable_extension != NULL) - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 6f138351ccd..99a2ea04911 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -194,6 +194,7 @@ mgaFillInModes( unsigned pixel_bits, unsigned depth_bits, static const __DRIextension *mgaExtensions[] = { + &driReadDrawableExtension, &driSwapControlExtension.base, &driFrameTrackingExtension.base, &driMediaStreamCounterExtension.base, @@ -205,8 +206,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) { mgaScreenPrivate *mgaScreen; MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); if (sPriv->devPrivSize != sizeof(MGADRIRec)) { fprintf(stderr,"\nERROR! sizeof(MGADRIRec) does not match passed size from device driver\n"); @@ -243,9 +242,6 @@ mgaInitDriver(__DRIscreenPrivate *sPriv) sPriv->extensions = mgaExtensions; - if ( glx_enable_extension != NULL ) - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - if (serverInfo->chipset != MGA_CARD_TYPE_G200 && serverInfo->chipset != MGA_CARD_TYPE_G400) { FREE(mgaScreen); diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 56493f5a3aa..269620cec47 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -351,8 +351,6 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) radeonScreenPtr screen; RADEONDRIPtr dri_priv = (RADEONDRIPtr)sPriv->pDevPriv; unsigned char *RADEONMMIO; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); int i; if (sPriv->devPrivSize != sizeof(RADEONDRIRec)) { @@ -745,12 +743,12 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) i = 0; screen->extensions[i++] = &driCopySubBufferExtension.base; screen->extensions[i++] = &driFrameTrackingExtension.base; + screen->extensions[i++] = &driReadDrawableExtension; + if ( screen->irq != 0 ) { screen->extensions[i++] = &driSwapControlExtension.base; screen->extensions[i++] = &driMediaStreamCounterExtension.base; } - if ( glx_enable_extension != NULL ) - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) if (IS_R200_CLASS(screen)) diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 0caac17dafb..68755c985a6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[6]; + const __DRIextension *extensions[7]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 3750c8948ac..013e88216fa 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -168,6 +168,10 @@ static const struct tnl_pipeline_stage *savage_pipeline[] = { }; +static const __DRIextension *savageExtensions[] = { + &driReadDrawableExtension, +}; + /* this is first function called in dirver*/ static GLboolean @@ -175,9 +179,6 @@ savageInitDriver(__DRIscreenPrivate *sPriv) { savageScreenPrivate *savageScreen; SAVAGEDRIPtr gDRIPriv = (SAVAGEDRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); - if (sPriv->devPrivSize != sizeof(SAVAGEDRIRec)) { fprintf(stderr,"\nERROR! sizeof(SAVAGEDRIRec) does not match passed size from device driver\n"); @@ -265,9 +266,7 @@ savageInitDriver(__DRIscreenPrivate *sPriv) driParseOptionInfo (&savageScreen->optionCache, __driConfigOptions, __driNConfigOptions); - if (glx_enable_extension != NULL) { - (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read"); - } + sPriv->extensions = savageExtensions; #if 0 savageDDFastPathInit(); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 081a5340357..5bdb446d155 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -63,6 +63,10 @@ DRI_CONF_BEGIN DRI_CONF_SECTION_END DRI_CONF_END; +static const __DRIextension *tdfxExtensions[] = { + &driReadDrawableExtension, +}; + static const GLuint __driNConfigOptions = 1; extern const struct dri_extension card_extensions[]; @@ -73,8 +77,6 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv ) { tdfxScreenPrivate *fxScreen; TDFXDRIPtr fxDRIPriv = (TDFXDRIPtr) sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); if (sPriv->devPrivSize != sizeof(TDFXDRIRec)) { fprintf(stderr,"\nERROR! sizeof(TDFXDRIRec) does not match passed size from device driver\n"); @@ -115,9 +117,7 @@ tdfxCreateScreen( __DRIscreenPrivate *sPriv ) return GL_FALSE; } - if (glx_enable_extension != NULL) { - (*glx_enable_extension)(sPriv->psc, "GLX_SGI_make_current_read"); - } + sPriv->extensions = tdfxExtensions; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index fddf0799346..f3912ac3521 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -98,8 +98,6 @@ viaInitDriver(__DRIscreenPrivate *sPriv) { viaScreenPrivate *viaScreen; VIADRIPtr gDRIPriv = (VIADRIPtr)sPriv->pDevPriv; - PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension = - (PFNGLXSCRENABLEEXTENSIONPROC) (*dri_interface->getProcAddress("glxEnableExtension")); int i; if (sPriv->devPrivSize != sizeof(VIADRIRec)) { @@ -177,14 +175,12 @@ viaInitDriver(__DRIscreenPrivate *sPriv) i = 0; viaScreen->extensions[i++] = &driFrameTrackingExtension.base; + viaScreen->extensions[i++] = &driReadDrawableExtension; if ( viaScreen->irqEnabled ) { viaScreen->extensions[i++] = &driSwapControlExtension.base; viaScreen->extensions[i++] = &driMediaStreamCounterExtension.base; } - if ( glx_enable_extension != NULL ) - (*glx_enable_extension)( sPriv->psc, "GLX_SGI_make_current_read" ); - viaScreen->extensions[i++] = NULL; sPriv->extensions = viaScreen->extensions; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.h b/src/mesa/drivers/dri/unichrome/via_screen.h index 5e5bc851b05..c3ef722ff07 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.h +++ b/src/mesa/drivers/dri/unichrome/via_screen.h @@ -71,7 +71,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[4]; + const __DRIextension *extensions[5]; } viaScreenPrivate; -- cgit v1.2.3 From ecdb45cb29e3209287cc297081596126e955ff2b Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 17 May 2007 16:11:19 -0400 Subject: Convert a left-over private void * to __DRIcontext *. --- include/GL/internal/dri_interface.h | 2 +- src/glx/x11/glxcmds.c | 4 ++-- src/mesa/drivers/dri/common/dri_util.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 657e3828cca..46f1f441d01 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -377,7 +377,7 @@ struct __DRIscreenRec { void * (*createNewContext)(__DRIscreen *screen, const __GLcontextModes *modes, int render_type, - void *sharedPrivate, + __DRIcontext *shared, drm_context_t hwContext, __DRIcontext *pctx); /** diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index a680c646d95..0a49e945863 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -395,8 +395,8 @@ CreateContext(Display *dpy, XVisualInfo *vis, } if (psc && psc->driScreen.private) { - void * const shared = (shareList != NULL) - ? shareList->driContext.private : NULL; + __DRIcontext *shared = (shareList != NULL) + ? &shareList->driContext : NULL; if (!XF86DRICreateContextWithConfig(dpy, psc->scr, diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index b88592313ed..20fee27f0a2 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -553,7 +553,7 @@ driDestroyContext(__DRIcontext *context) * \param modes Mode used to create the new context. * \param render_type Type of rendering target. \c GLX_RGBA is the only * type likely to ever be supported for direct-rendering. - * \param sharedPrivate The shared context dependent methods or \c NULL if + * \param shared The shared context dependent methods or \c NULL if * non-existent. * \param pctx DRI context to receive the context dependent methods. * @@ -569,11 +569,11 @@ driDestroyContext(__DRIcontext *context) */ static void * driCreateNewContext(__DRIscreen *screen, const __GLcontextModes *modes, - int render_type, void *sharedPrivate, + int render_type, __DRIcontext *shared, drm_context_t hwContext, __DRIcontext *pctx) { __DRIcontextPrivate *pcp; - __DRIcontextPrivate *pshare = (__DRIcontextPrivate *) sharedPrivate; + __DRIcontextPrivate *pshare = (shared != NULL) ? shared->private : NULL; __DRIscreenPrivate *psp; void * const shareCtx = (pshare != NULL) ? pshare->driverPrivate : NULL; -- cgit v1.2.3 From f29f0ae8383888a6493b615edc3bab254cf6df39 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 22 May 2007 12:26:02 -0400 Subject: Move new texOffset extension to the new extension mechanism. --- include/GL/internal/dri_interface.h | 29 +++++++++++++++++------------ src/mesa/drivers/dri/common/dri_util.c | 3 --- src/mesa/drivers/dri/radeon/radeon_screen.c | 14 ++++++++++---- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- 4 files changed, 28 insertions(+), 20 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 46f1f441d01..1efae11d621 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -63,6 +63,7 @@ typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension; typedef struct __DRIallocateExtensionRec __DRIallocateExtension; typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension; typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension; +typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension; /*@}*/ @@ -169,6 +170,22 @@ struct __DRImediaStreamCounterExtensionRec { }; +#define __DRI_TEX_OFFSET "DRI_TexOffset" +struct __DRItexOffsetExtensionRec { + __DRIextension base; + + /** + * Method to override base texture image with a driver specific 'offset'. + * The depth passed in allows e.g. to ignore the alpha channel of texture + * images where the non-alpha components don't occupy a whole texel. + * + * For GLX_EXT_texture_from_pixmap with AIGLX. + */ + void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname, + unsigned long long offset, GLint depth, GLuint pitch); +}; + + /** * Macros for building symbol and strings. Standard CPP two step... */ @@ -379,18 +396,6 @@ struct __DRIscreenRec { int render_type, __DRIcontext *shared, drm_context_t hwContext, __DRIcontext *pctx); - - /** - * Method to override base texture image with a driver specific 'offset'. - * The depth passed in allows e.g. to ignore the alpha channel of texture - * images where the non-alpha components don't occupy a whole texel. - * - * For GLX_EXT_texture_from_pixmap with AIGLX. - * - * \since Internal API version 20070121. - */ - void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname, - unsigned long long offset, GLint depth, GLuint pitch); }; /** diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 20fee27f0a2..22093219785 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -752,9 +752,6 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, psc->createNewDrawable = driCreateNewDrawable; psc->createNewContext = driCreateNewContext; - if (internal_api_version >= 20070121) - psc->setTexOffset = psp->DriverAPI.setTexOffset; - *driver_modes = __driDriverInitScreen(psp); if (*driver_modes == NULL) { _mesa_free(psp); diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 269620cec47..84c6885d50f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -333,14 +333,19 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, } #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - static const __DRIallocateExtension r200AllocateExtension = { { __DRI_ALLOCATE }, r200AllocateMemoryMESA, r200FreeMemoryMESA, r200GetMemoryOffsetMESA }; +#endif +#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) +static const __DRItexOffsetExtension r300texOffsetExtension = { + { __DRI_TEX_OFFSET }, + r300SetTexOffset, +}; #endif /* Create the device specific screen private data struct. @@ -755,6 +760,10 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->extensions[i++] = &r200AllocateExtension.base; #endif +#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) + screen->extensions[i++] = &r300texOffsetExtension.base; +#endif + screen->extensions[i++] = NULL; sPriv->extensions = screen->extensions; @@ -956,9 +965,6 @@ static struct __DriverAPIRec radeonAPI = { .WaitForSBC = NULL, .SwapBuffersMSC = NULL, .CopySubBuffer = radeonCopySubBuffer, -#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) - .setTexOffset = r300SetTexOffset, -#endif }; #else static const struct __DriverAPIRec r200API = { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 68755c985a6..184b0d225ef 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[7]; + const __DRIextension *extensions[8]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ -- cgit v1.2.3 From ccff0cb26378ce370fc8697a2a2ada138d2e119e Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 7 Jun 2007 19:35:54 -0400 Subject: Add a version field to __DRIextension. --- include/GL/internal/dri_interface.h | 23 +++++++++++++++++++++++ src/mesa/drivers/dri/common/dri_util.c | 11 ++++++----- src/mesa/drivers/dri/i915/intel_screen.c | 2 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 4 ++-- 4 files changed, 32 insertions(+), 8 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 1efae11d621..e7fbf8e8b8b 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -74,20 +74,38 @@ typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension; * structs and the loader can use the extensions it knows about by * casting it to a more specific extension and optionally advertising * the GLX extension. See below for examples. + * + * We never break API in for a DRI extension. If we need to change + * the way things work in a non-backwards compatible manner, we + * introduce a new extension. During a transition period, we can + * leave both the old and the new extension in the driver, which + * allows us to move to the new interface without having to update the + * loader(s) in lock step. + * + * However, we can add entry points to an extension over time as long + * as we don't break the old ones. As we add entry points to an + * extension, we increase the version number. The corresponding + * #define can be used to guard code that accesses the new entry + * points at compile time and the version field in the extension + * struct can be used at run-time to determine how to use the + * extension. */ struct __DRIextensionRec { const char *name; + int version; }; /** * Used by drivers to indicate support for setting the read drawable. */ #define __DRI_READ_DRAWABLE "DRI_ReadDrawable" +#define __DRI_READ_DRAWABLE_VERSION 1 /** * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension. */ #define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer" +#define __DRI_COPY_SUB_BUFFER_VERSION 1 struct __DRIcopySubBufferExtensionRec { __DRIextension base; void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h); @@ -98,6 +116,7 @@ struct __DRIcopySubBufferExtensionRec { * GLX_MESA_swap_control extension. */ #define __DRI_SWAP_CONTROL "DRI_SwapControl" +#define __DRI_SWAP_CONTROL_VERSION 1 struct __DRIswapControlExtensionRec { __DRIextension base; void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval); @@ -108,6 +127,7 @@ struct __DRIswapControlExtensionRec { * Used by drivers that implement the GLX_MESA_allocate_memory. */ #define __DRI_ALLOCATE "DRI_Allocate" +#define __DRI_ALLOCATE_VERSION 1 struct __DRIallocateExtensionRec { __DRIextension base; @@ -124,6 +144,7 @@ struct __DRIallocateExtensionRec { * Used by drivers that implement the GLX_MESA_swap_frame_usage extension. */ #define __DRI_FRAME_TRACKING "DRI_FrameTracking" +#define __DRI_FRAME_TRACKING_VERSION 1 struct __DRIframeTrackingExtensionRec { __DRIextension base; @@ -149,6 +170,7 @@ struct __DRIframeTrackingExtensionRec { * Used by drivers that implement the GLX_SGI_video_sync extension. */ #define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter" +#define __DRI_MEDIA_STREAM_COUNTER_VERSION 1 struct __DRImediaStreamCounterExtensionRec { __DRIextension base; @@ -171,6 +193,7 @@ struct __DRImediaStreamCounterExtensionRec { #define __DRI_TEX_OFFSET "DRI_TexOffset" +#define __DRI_TEX_OFFSET_VERSION 1 struct __DRItexOffsetExtensionRec { __DRIextension base; diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 22093219785..d59ea0ddad0 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -51,7 +51,7 @@ static const int empty_attribute_list[1] = { None }; * supports setting a read drawable. */ const __DRIextension driReadDrawableExtension = { - __DRI_READ_DRAWABLE + __DRI_READ_DRAWABLE, __DRI_READ_DRAWABLE_VERSION }; /** @@ -393,7 +393,7 @@ static int driWaitForMSC(__DRIdrawable *drawable, int64_t target_msc, } const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = { - { __DRI_MEDIA_STREAM_COUNTER }, + { __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION }, driGetMSC, driWaitForMSC, }; @@ -406,7 +406,8 @@ static void driCopySubBuffer(__DRIdrawable *drawable, } const __DRIcopySubBufferExtension driCopySubBufferExtension = { - { __DRI_COPY_SUB_BUFFER }, driCopySubBuffer + { __DRI_COPY_SUB_BUFFER, __DRI_COPY_SUB_BUFFER_VERSION }, + driCopySubBuffer }; static void driSetSwapInterval(__DRIdrawable *drawable, unsigned int interval) @@ -424,7 +425,7 @@ static unsigned int driGetSwapInterval(__DRIdrawable *drawable) } const __DRIswapControlExtension driSwapControlExtension = { - { __DRI_SWAP_CONTROL }, + { __DRI_SWAP_CONTROL, __DRI_SWAP_CONTROL_VERSION }, driSetSwapInterval, driGetSwapInterval }; @@ -819,7 +820,7 @@ driQueryFrameTracking(__DRIdrawable *drawable, } const __DRIframeTrackingExtension driFrameTrackingExtension = { - { __DRI_FRAME_TRACKING }, + { __DRI_FRAME_TRACKING, __DRI_FRAME_TRACKING_VERSION }, driFrameTracking, driQueryFrameTracking }; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 191d26e84bd..b5eab5ba004 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -420,7 +420,7 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, } static const __DRIallocateExtension intelAllocateExtension = { - { __DRI_ALLOCATE }, + { __DRI_ALLOCATE, __DRI_ALLOCATE_VERSION }, intelAllocateMemoryMESA, intelFreeMemoryMESA, intelGetMemoryOffsetMESA diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 84c6885d50f..10d3c2b27ca 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -334,7 +334,7 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) static const __DRIallocateExtension r200AllocateExtension = { - { __DRI_ALLOCATE }, + { __DRI_ALLOCATE, __DRI_ALLOCATE_VERSION }, r200AllocateMemoryMESA, r200FreeMemoryMESA, r200GetMemoryOffsetMESA @@ -343,7 +343,7 @@ static const __DRIallocateExtension r200AllocateExtension = { #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) static const __DRItexOffsetExtension r300texOffsetExtension = { - { __DRI_TEX_OFFSET }, + { __DRI_TEX_OFFSET, __DRI_TEX_OFFSET_VERSION }, r300SetTexOffset, }; #endif -- cgit v1.2.3 From f05c76ec1a5d8444c75f059d4e6f7e5bcd8c6644 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 11 Oct 2007 10:33:31 -0600 Subject: remove unneeded cast --- src/mesa/shader/prog_statevars.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index d37d7fb9bf4..57a9d2dae9d 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -818,7 +818,7 @@ _mesa_load_state_parameters(GLcontext *ctx, for (i = 0; i < paramList->NumParameters; i++) { if (paramList->Parameters[i].Type == PROGRAM_STATE_VAR) { _mesa_fetch_state(ctx, - (gl_state_index *) paramList->Parameters[i].StateIndexes, + paramList->Parameters[i].StateIndexes, paramList->ParameterValues[i]); } } -- cgit v1.2.3 From a2494462cb7d557a7643452c720e0ab8fa9f4f63 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 11 Oct 2007 12:49:26 -0400 Subject: Drop no longer implemented MESA allocate extension from i915. --- src/mesa/drivers/dri/i915/intel_screen.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index b5eab5ba004..df616f43b93 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -419,18 +419,10 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelPrintSAREA(sarea); } -static const __DRIallocateExtension intelAllocateExtension = { - { __DRI_ALLOCATE, __DRI_ALLOCATE_VERSION }, - intelAllocateMemoryMESA, - intelFreeMemoryMESA, - intelGetMemoryOffsetMESA -}; - static const __DRIextension *intelExtensions[] = { &driReadDrawableExtension, &driCopySubBufferExtension.base, &driSwapControlExtension.base, - &intelAllocateExtension.base, &driFrameTrackingExtension.base, &driMediaStreamCounterExtension.base, NULL -- cgit v1.2.3 From 7fc5c0307af98e1a0ff7e9081b07f940d1e3f916 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 12 Oct 2007 10:56:25 +1000 Subject: i915: fixup reloc header defines --- src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c index be77b509590..9ed6e3696f4 100644 --- a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c @@ -300,7 +300,7 @@ static int intel_add_validate_buffer(struct intel_bo_list *list, dri_bo *buf, un } -#define RELOC_BUF_SIZE(x) ((I915_RELOC0_HEADER + x * I915_RELOC0_STRIDE) * sizeof(uint32_t)) +#define RELOC_BUF_SIZE(x) ((I915_RELOC_HEADER + x * I915_RELOC0_STRIDE) * sizeof(uint32_t)) static int intel_create_new_reloc_type_list(int fd, struct intel_bo_reloc_list *cur_type, int max_relocs) { @@ -395,9 +395,9 @@ static int intel_add_validate_reloc(int fd, struct intel_bo_list *reloc_list, st num_relocs = (reloc_start[0] & 0xffff); - reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC0_HEADER] = reloc_info->reloc; - reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC0_HEADER+1] = reloc_info->delta; - reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC0_HEADER+2] = reloc_info->index; + reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC_HEADER] = reloc_info->reloc; + reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC_HEADER+1] = reloc_info->delta; + reloc_start[num_relocs*I915_RELOC0_STRIDE + I915_RELOC_HEADER+2] = reloc_info->index; reloc_start[0]++; if (((reloc_start[0] & 0xffff)) > (max_relocs)) { return -ENOMEM; -- cgit v1.2.3 From ea2278bc793670d4b7922131d1638f2446c896e0 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 12 Oct 2007 10:59:38 +1000 Subject: dri: remove ttm common code since superioctl is device specific --- src/mesa/drivers/dri/common/dri_bufmgr_ttm.c | 598 --------------------------- 1 file changed, 598 deletions(-) delete mode 100644 src/mesa/drivers/dri/common/dri_bufmgr_ttm.c (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c b/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c deleted file mode 100644 index 84ac0b2c0d9..00000000000 --- a/src/mesa/drivers/dri/common/dri_bufmgr_ttm.c +++ /dev/null @@ -1,598 +0,0 @@ -/************************************************************************** - * - * Copyright © 2007 Intel Corporation - * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * - **************************************************************************/ -/* - * Authors: Thomas Hellström - * Keith Whitwell - * Eric Anholt - */ - -#include -#include -#include -#include "glthread.h" -#include "errno.h" -#include "mtypes.h" -#include "dri_bufmgr.h" -#include "string.h" -#include "imports.h" - -#define BUFMGR_DEBUG 0 -#define MAX_RELOCS 4096 - -struct ttm_buffer_reloc -{ - dri_bo *buf; - GLuint offset; - GLuint delta; /* not needed? */ - GLuint validate_flags; -}; - -typedef struct _dri_bufmgr_ttm { - dri_bufmgr bufmgr; - - int fd; - _glthread_Mutex mutex; - unsigned int fence_type; - unsigned int fence_type_flush; - - /** ttm relocation list */ - struct ttm_buffer_reloc reloc[MAX_RELOCS]; - GLuint nr_relocs; - GLboolean performed_rendering; - -} dri_bufmgr_ttm; - -typedef struct _dri_bo_ttm { - dri_bo bo; - - int refcount; /* Protected by bufmgr->mutex */ - drmBO drm_bo; - const char *name; - /** - * Note whether we are the owner of the buffer, to determine if we must - * drmBODestroy or drmBOUnreference to unreference the buffer. - */ - GLboolean owner; -} dri_bo_ttm; - -typedef struct _dri_fence_ttm -{ - dri_fence fence; - - int refcount; /* Protected by bufmgr->mutex */ - const char *name; - drmFence drm_fence; -} dri_fence_ttm; - -#if 0 -int -driFenceSignaled(DriFenceObject * fence, unsigned type) -{ - int signaled; - int ret; - - if (fence == NULL) - return GL_TRUE; - - _glthread_LOCK_MUTEX(fence->mutex); - ret = drmFenceSignaled(bufmgr_ttm->fd, &fence->fence, type, &signaled); - _glthread_UNLOCK_MUTEX(fence->mutex); - BM_CKFATAL(ret); - return signaled; -} -#endif - -static dri_bo * -dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name, - unsigned long size, unsigned int alignment, - unsigned int location_mask) -{ - dri_bufmgr_ttm *ttm_bufmgr; - dri_bo_ttm *ttm_buf; - unsigned int pageSize = getpagesize(); - int ret; - unsigned int flags, hint; - - ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr; - - ttm_buf = malloc(sizeof(*ttm_buf)); - if (!ttm_buf) - return NULL; - - /* The mask argument doesn't do anything for us that we want other than - * determine which pool (TTM or local) the buffer is allocated into, so just - * pass all of the allocation class flags. - */ - flags = location_mask | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | - DRM_BO_FLAG_EXE; - /* No hints we want to use. */ - hint = 0; - - ret = drmBOCreate(ttm_bufmgr->fd, 0, size, alignment / pageSize, - NULL, drm_bo_type_dc, - flags, hint, &ttm_buf->drm_bo); - if (ret != 0) { - free(ttm_buf); - return NULL; - } - ttm_buf->bo.size = ttm_buf->drm_bo.size; - ttm_buf->bo.offset = ttm_buf->drm_bo.offset; - ttm_buf->bo.virtual = NULL; - ttm_buf->bo.bufmgr = bufmgr; - ttm_buf->name = name; - ttm_buf->refcount = 1; - ttm_buf->owner = GL_TRUE; - -#if BUFMGR_DEBUG - fprintf(stderr, "bo_create: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); -#endif - - return &ttm_buf->bo; -} - -/* Our TTM backend doesn't allow creation of static buffers, as that requires - * privelege for the non-fake case, and the lock in the fake case where we were - * working around the X Server not creating buffers and passing handles to us. - */ -static dri_bo * -dri_ttm_alloc_static(dri_bufmgr *bufmgr, const char *name, - unsigned long offset, unsigned long size, void *virtual, - unsigned int location_mask) -{ - return NULL; -} - -/** Returns a dri_bo wrapping the given buffer object handle. - * - * This can be used when one application needs to pass a buffer object - * to another. - */ -dri_bo * -dri_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, - unsigned int handle) -{ - dri_bufmgr_ttm *ttm_bufmgr; - dri_bo_ttm *ttm_buf; - int ret; - - ttm_bufmgr = (dri_bufmgr_ttm *)bufmgr; - - ttm_buf = malloc(sizeof(*ttm_buf)); - if (!ttm_buf) - return NULL; - - ret = drmBOReference(ttm_bufmgr->fd, handle, &ttm_buf->drm_bo); - if (ret != 0) { - free(ttm_buf); - return NULL; - } - ttm_buf->bo.size = ttm_buf->drm_bo.size; - ttm_buf->bo.offset = ttm_buf->drm_bo.offset; - ttm_buf->bo.virtual = NULL; - ttm_buf->bo.bufmgr = bufmgr; - ttm_buf->name = name; - ttm_buf->refcount = 1; - ttm_buf->owner = GL_FALSE; - -#if BUFMGR_DEBUG - fprintf(stderr, "bo_create_from_handle: %p (%s)\n", &ttm_buf->bo, - ttm_buf->name); -#endif - - return &ttm_buf->bo; -} - -static void -dri_ttm_bo_reference(dri_bo *buf) -{ - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; - dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; - - _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); - ttm_buf->refcount++; - _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); -} - -static void -dri_ttm_bo_unreference(dri_bo *buf) -{ - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; - dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; - - if (!buf) - return; - - _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); - if (--ttm_buf->refcount == 0) { - int ret; - - /* XXX Having to use drmBODestroy as the opposite of drmBOCreate instead - * of simply unreferencing is madness, and leads to behaviors we may not - * want (making the buffer unsharable). - */ - if (ttm_buf->owner) - ret = drmBODestroy(bufmgr_ttm->fd, &ttm_buf->drm_bo); - else - ret = drmBOUnReference(bufmgr_ttm->fd, &ttm_buf->drm_bo); - if (ret != 0) { - fprintf(stderr, "drmBOUnReference failed (%s): %s\n", ttm_buf->name, - strerror(-ret)); - } -#if BUFMGR_DEBUG - fprintf(stderr, "bo_unreference final: %p (%s)\n", - &ttm_buf->bo, ttm_buf->name); -#endif - _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); - free(buf); - return; - } - _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); -} - -static int -dri_ttm_bo_map(dri_bo *buf, GLboolean write_enable) -{ - dri_bufmgr_ttm *bufmgr_ttm; - dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; - unsigned int flags; - - bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; - - flags = DRM_BO_FLAG_READ; - if (write_enable) - flags |= DRM_BO_FLAG_WRITE; - - assert(buf->virtual == NULL); - -#if BUFMGR_DEBUG - fprintf(stderr, "bo_map: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); -#endif - - return drmBOMap(bufmgr_ttm->fd, &ttm_buf->drm_bo, flags, 0, &buf->virtual); -} - -static int -dri_ttm_bo_unmap(dri_bo *buf) -{ - dri_bufmgr_ttm *bufmgr_ttm; - dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; - - if (buf == NULL) - return 0; - - bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; - - assert(buf->virtual != NULL); - - buf->virtual = NULL; - -#if BUFMGR_DEBUG - fprintf(stderr, "bo_unmap: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); -#endif - - return drmBOUnmap(bufmgr_ttm->fd, &ttm_buf->drm_bo); -} - -static int -dri_ttm_validate(dri_bo *buf, unsigned int flags) -{ - dri_bufmgr_ttm *bufmgr_ttm; - dri_bo_ttm *ttm_buf = (dri_bo_ttm *)buf; - unsigned int mask; - int err; - - /* XXX: Sanity-check whether we've already validated this one under - * different flags. See drmAddValidateItem(). - */ - - bufmgr_ttm = (dri_bufmgr_ttm *)buf->bufmgr; - - /* Calculate the appropriate mask to pass to the DRM. There appears to be - * be a direct relationship to flags, so it's unnecessary to have it passed - * in as an argument. - */ - mask = DRM_BO_MASK_MEM; - mask |= flags & (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE); - - err = drmBOValidate(bufmgr_ttm->fd, &ttm_buf->drm_bo, 0, flags, mask, 0); - - if (err == 0) { - /* XXX: add to fence list for sanity checking */ - } else { - fprintf(stderr, "failed to validate buffer (%s): %s\n", - ttm_buf->name, strerror(-err)); - } - - buf->offset = ttm_buf->drm_bo.offset; - -#if BUFMGR_DEBUG - fprintf(stderr, "bo_validate: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); -#endif - - return err; -} - -static dri_fence * -dri_ttm_fence_validated(dri_bufmgr *bufmgr, const char *name, - GLboolean flushed) -{ - dri_fence_ttm *fence_ttm = malloc(sizeof(*fence_ttm)); - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr; - int ret; - unsigned int type; - - if (!fence_ttm) - return NULL; - - if (flushed) - type = bufmgr_ttm->fence_type_flush; - else - type = bufmgr_ttm->fence_type; - - fence_ttm->refcount = 1; - fence_ttm->name = name; - fence_ttm->fence.bufmgr = bufmgr; - ret = drmFenceBuffers(bufmgr_ttm->fd, type, 0, &fence_ttm->drm_fence); - if (ret) { - fprintf(stderr, "failed to fence (%s): %s\n", name, strerror(-ret)); - free(fence_ttm); - return NULL; - } - -#if BUFMGR_DEBUG - fprintf(stderr, "fence_validated: %p (%s)\n", &fence_ttm->fence, - fence_ttm->name); -#endif - - return &fence_ttm->fence; -} - -static void -dri_ttm_fence_reference(dri_fence *fence) -{ - dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence; - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr; - - _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); - ++fence_ttm->refcount; - _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); -} - -static void -dri_ttm_fence_unreference(dri_fence *fence) -{ - dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence; - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr; - - if (!fence) - return; - - _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); - if (--fence_ttm->refcount == 0) { - int ret; - - /* XXX Having to use drmFenceDestroy as the opposite of drmFenceBuffers - * instead of simply unreferencing is madness, and leads to behaviors we - * may not want (making the fence unsharable). This behavior by the DRM - * ioctls should be fixed, and drmFenceDestroy eliminated. - */ - ret = drmFenceDestroy(bufmgr_ttm->fd, &fence_ttm->drm_fence); - if (ret != 0) { - fprintf(stderr, "drmFenceDestroy failed (%s): %s\n", - fence_ttm->name, strerror(-ret)); - } - - _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); - free(fence); - return; - } - _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); -} - -static void -dri_ttm_fence_wait(dri_fence *fence) -{ - dri_fence_ttm *fence_ttm = (dri_fence_ttm *)fence; - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)fence->bufmgr; - int ret; - - _glthread_LOCK_MUTEX(bufmgr_ttm->mutex); - ret = drmFenceWait(bufmgr_ttm->fd, 0, &fence_ttm->drm_fence, 0); - _glthread_UNLOCK_MUTEX(bufmgr_ttm->mutex); - if (ret != 0) { - _mesa_printf("%s:%d: Error %d waiting for fence %s.\n", - __FILE__, __LINE__, ret, fence_ttm->name); - abort(); - } - -#if BUFMGR_DEBUG - fprintf(stderr, "fence_wait: %p (%s)\n", &fence_ttm->fence, - fence_ttm->name); -#endif -} - -static void -dri_bufmgr_ttm_destroy(dri_bufmgr *bufmgr) -{ - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)bufmgr; - - _glthread_DESTROY_MUTEX(bufmgr_ttm->mutex); - free(bufmgr); -} - - -static void -dri_ttm_emit_reloc(dri_bo *batch_buf, GLuint flags, GLuint delta, GLuint offset, - dri_bo *relocatee) -{ - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; - struct ttm_buffer_reloc *r = &bufmgr_ttm->reloc[bufmgr_ttm->nr_relocs++]; - - assert(bufmgr_ttm->nr_relocs <= MAX_RELOCS); - - dri_bo_reference(relocatee); - - r->buf = relocatee; - r->offset = offset; - r->delta = delta; - r->validate_flags = flags; - - return; -} - - -static int -relocation_sort(const void *a_in, const void *b_in) { - const struct ttm_buffer_reloc *a = a_in, *b = b_in; - - return (intptr_t)a->buf < (intptr_t)b->buf ? -1 : 1; -} - -static void * -dri_ttm_process_reloc(dri_bo *batch_buf) -{ - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; - GLuint i; - GLuint *ptr; - - assert(batch_buf->virtual != NULL); - ptr = batch_buf->virtual; - - bufmgr_ttm->performed_rendering = GL_FALSE; - - /* Sort our relocation list in terms of referenced buffer pointer. - * This lets us uniquely validate the buffers with the sum of all the flags, - * while avoiding O(n^2) on number of relocations. - */ - qsort(bufmgr_ttm->reloc, bufmgr_ttm->nr_relocs, sizeof(bufmgr_ttm->reloc[0]), - relocation_sort); - - /* Perform the necessary validations of buffers, and enter the relocations - * in the batchbuffer. - */ - for (i = 0; i < bufmgr_ttm->nr_relocs; i++) { - struct ttm_buffer_reloc *r = &bufmgr_ttm->reloc[i]; - - if (r->validate_flags & DRM_BO_FLAG_WRITE) - bufmgr_ttm->performed_rendering = GL_TRUE; - - /* If this is the first time we've seen this buffer in the relocation - * list, figure out our flags and validate it. - */ - if (i == 0 || bufmgr_ttm->reloc[i - 1].buf != r->buf) { - uint32_t validate_flags; - int j, ret; - - /* Accumulate the flags we need for validating this buffer. */ - validate_flags = r->validate_flags; - for (j = i + 1; j < bufmgr_ttm->nr_relocs; j++) { - if (bufmgr_ttm->reloc[j].buf != r->buf) - break; - validate_flags |= bufmgr_ttm->reloc[j].validate_flags; - } - - /* Validate. If we fail, fence to clear the unfenced list and bail - * out. - */ - ret = dri_bo_validate(r->buf, validate_flags); - if (ret != 0) { - dri_fence *fo; - dri_bo_unmap(batch_buf); - fo = dri_fence_validated(batch_buf->bufmgr, - "batchbuffer failure fence", GL_TRUE); - dri_fence_unreference(fo); - goto done; - } - } - ptr[r->offset / 4] = r->buf->offset + r->delta; - dri_bo_unreference(r->buf); - } - dri_bo_unmap(batch_buf); - - dri_bo_validate(batch_buf, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_EXE); - - bufmgr_ttm->nr_relocs = 0; - done: - return NULL; -} - -static void -dri_ttm_post_submit(dri_bo *batch_buf, dri_fence **last_fence) -{ - dri_bufmgr_ttm *bufmgr_ttm = (dri_bufmgr_ttm *)batch_buf->bufmgr; - dri_fence *fo; - - fo = dri_fence_validated(batch_buf->bufmgr, "Batch fence", GL_TRUE); - - if (bufmgr_ttm->performed_rendering) { - dri_fence_unreference(*last_fence); - *last_fence = fo; - } else { - dri_fence_unreference(fo); - } -} - -/** - * Initializes the TTM buffer manager, which uses the kernel to allocate, map, - * and manage map buffer objections. - * - * \param fd File descriptor of the opened DRM device. - * \param fence_type Driver-specific fence type used for fences with no flush. - * \param fence_type_flush Driver-specific fence type used for fences with a - * flush. - */ -dri_bufmgr * -dri_bufmgr_ttm_init(int fd, unsigned int fence_type, - unsigned int fence_type_flush) -{ - dri_bufmgr_ttm *bufmgr_ttm; - - bufmgr_ttm = malloc(sizeof(*bufmgr_ttm)); - bufmgr_ttm->fd = fd; - bufmgr_ttm->fence_type = fence_type; - bufmgr_ttm->fence_type_flush = fence_type_flush; - _glthread_INIT_MUTEX(bufmgr_ttm->mutex); - - bufmgr_ttm->bufmgr.bo_alloc = dri_ttm_alloc; - bufmgr_ttm->bufmgr.bo_alloc_static = dri_ttm_alloc_static; - bufmgr_ttm->bufmgr.bo_reference = dri_ttm_bo_reference; - bufmgr_ttm->bufmgr.bo_unreference = dri_ttm_bo_unreference; - bufmgr_ttm->bufmgr.bo_map = dri_ttm_bo_map; - bufmgr_ttm->bufmgr.bo_unmap = dri_ttm_bo_unmap; - bufmgr_ttm->bufmgr.bo_validate = dri_ttm_validate; - bufmgr_ttm->bufmgr.fence_validated = dri_ttm_fence_validated; - bufmgr_ttm->bufmgr.fence_reference = dri_ttm_fence_reference; - bufmgr_ttm->bufmgr.fence_unreference = dri_ttm_fence_unreference; - bufmgr_ttm->bufmgr.fence_wait = dri_ttm_fence_wait; - bufmgr_ttm->bufmgr.destroy = dri_bufmgr_ttm_destroy; - bufmgr_ttm->bufmgr.emit_reloc = dri_ttm_emit_reloc; - bufmgr_ttm->bufmgr.process_relocs = dri_ttm_process_reloc; - bufmgr_ttm->bufmgr.post_submit = dri_ttm_post_submit; - return &bufmgr_ttm->bufmgr; -} -- cgit v1.2.3 From 9e06cf00cfb24528653913fc90eded4d370c1149 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 12 Oct 2007 11:01:17 +1000 Subject: i915: only enable TTM path if drm minor is > 11 for superioctl --- src/mesa/drivers/dri/i915/intel_screen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index cd4052616fe..0934213c135 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -539,6 +539,7 @@ intelInitDriver(__DRIscreenPrivate * sPriv) intelScreen->ttm = GL_FALSE; if (getenv("INTEL_NO_TTM") == NULL && intelScreen->driScrnPriv->ddxMinor >= 9 && + intelScreen->drmMinor >= 11 && intelScreen->front.bo_handle != -1) { intelScreen->bufmgr = intel_bufmgr_ttm_init(sPriv->fd, DRM_FENCE_TYPE_EXE, -- cgit v1.2.3 From d0b68b215d7f172fb76f02745208fb9c5024f23d Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Mon, 27 Aug 2007 14:15:49 -0400 Subject: Uncomment GLX_SGIX_pbuffer definition. --- src/mesa/glapi/glX_API.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/glapi/glX_API.xml b/src/mesa/glapi/glX_API.xml index 455fc6a5676..4a9c5050724 100644 --- a/src/mesa/glapi/glX_API.xml +++ b/src/mesa/glapi/glX_API.xml @@ -183,7 +183,6 @@ - - +a -- cgit v1.2.3 From f33e1a440309d7dd04c0e86a67a2bdc8a38f962f Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Sun, 14 Oct 2007 20:33:56 +0300 Subject: typo --- src/mesa/glapi/glX_API.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/glapi/glX_API.xml b/src/mesa/glapi/glX_API.xml index 4a9c5050724..9e02aa498ee 100644 --- a/src/mesa/glapi/glX_API.xml +++ b/src/mesa/glapi/glX_API.xml @@ -200,7 +200,7 @@ -a + -- cgit v1.2.3 From 157eeb5c3b1ed16d67247f41e83dad3cda6e31ef Mon Sep 17 00:00:00 2001 From: Andreas Micheler Date: Mon, 15 Oct 2007 08:26:03 -0600 Subject: faster write_rgba_span_front() --- src/mesa/drivers/windows/gdi/wmesa.c | 95 +++++++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 17 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index ea3f1780d3c..7e8a87921b8 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -458,23 +458,84 @@ static void write_rgba_span_front(const GLcontext *ctx, const GLubyte rgba[][4], const GLubyte mask[] ) { - WMesaContext pwc = wmesa_context(ctx); - GLuint i; - - (void) ctx; - y=FLIP(y); - if (mask) { - for (i=0; ihDC, x+i, y, RGB(rgba[i][RCOMP], rgba[i][GCOMP], - rgba[i][BCOMP])); - } - else { - for (i=0; ihDC, x+i, y, RGB(rgba[i][RCOMP], rgba[i][GCOMP], - rgba[i][BCOMP])); - } - + WMesaContext pwc = wmesa_context(ctx); + WMesaFramebuffer pwfb = wmesa_lookup_framebuffer(pwc->hDC); + CONST BITMAPINFO bmi= + { + { + sizeof(BITMAPINFOHEADER), + n, 1, 1, 32, BI_RGB, 0, 1, 1, 0, 0 + } + }; + HBITMAP bmp=0; + HDC mdc=0; + typedef union + { + unsigned i; + struct { + unsigned b:8, g:8, r:8, a:8; + }; + } BGRA; + BGRA *bgra, c; + int i; + + if (n < 16) { // the value 16 is just guessed + y=FLIP(y); + if (mask) { + for (i=0; ihDC, x+i, y, + RGB(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP])); + } + else { + for (i=0; ihDC, x+i, y, + RGB(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP])); + } + } + else { + if (!pwfb) { + _mesa_problem(NULL, "wmesa: write_rgba_span_front on unknown hdc"); + return; + } + bgra=malloc(n*sizeof(BGRA)); + if (!bgra) { + _mesa_problem(NULL, "wmesa: write_rgba_span_front: out of memory"); + return; + } + c.a=0; + if (mask) { + for (i=0; ihDC); + SelectObject(mdc, bmp); + y=FLIP(y); + BitBlt(pwfb->hDC, x, y, n, 1, mdc, 0, 0, SRCCOPY); + SelectObject(mdc, 0); + DeleteObject(bmp); + DeleteDC(mdc); + free(bgra); + } } /* Write a horizontal span of RGB color pixels with a boolean mask. */ -- cgit v1.2.3 From cab0dce6766c9ac728bc9f88dc94b8651fc257fb Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 15 Oct 2007 18:00:17 -0600 Subject: fix fog, rescale_normals bugs (from gallium branch) --- src/mesa/tnl/t_vp_build.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 63f7890205d..6a6db06285e 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -699,7 +699,7 @@ static struct ureg get_eye_normal( struct tnl_program *p ) struct ureg rescale = register_param2(p, STATE_INTERNAL, STATE_NORMAL_SCALE); - emit_op2( p, OPCODE_MUL, p->eye_normal, 0, normal, + emit_op2( p, OPCODE_MUL, p->eye_normal, 0, p->eye_normal, swizzle1(rescale, X)); } } @@ -1123,8 +1123,6 @@ static void build_fog( struct tnl_program *p ) { struct ureg fog = register_output(p, VERT_RESULT_FOGC); struct ureg input; - GLuint useabs = p->state->fog_source_is_depth && p->state->fog_mode && - (p->state->fog_mode != FOG_EXP2); if (p->state->fog_source_is_depth) { input = swizzle1(get_eye_position(p), Z); @@ -1137,6 +1135,7 @@ static void build_fog( struct tnl_program *p ) struct ureg params = register_param2(p, STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED); struct ureg tmp = get_temp(p); + GLboolean useabs = (p->state->fog_mode != FOG_EXP2); if (useabs) { emit_op1(p, OPCODE_ABS, tmp, 0, input); @@ -1169,7 +1168,10 @@ static void build_fog( struct tnl_program *p ) /* results = incoming fog coords (compute fog per-fragment later) * * KW: Is it really necessary to do anything in this case? + * BP: Yes, we always need to compute the absolute value, unless + * we want to push that down into the fragment program... */ + GLboolean useabs = GL_TRUE; emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, WRITEMASK_X, input); } } -- cgit v1.2.3 From 9c4d104e98bb2cc8d5719d00445db0617c8f5de1 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 16 Oct 2007 13:01:44 +0200 Subject: i915: Re-enable __DRItexOffsetExtension. This seems to have got lost somehow during the recent DRI interface changes. --- src/mesa/drivers/dri/i915/intel_screen.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 291441b3608..8c4af6eaf59 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -421,12 +421,18 @@ intelUpdateScreenFromSAREA(intelScreenPrivate * intelScreen, intelPrintSAREA(sarea); } +static const __DRItexOffsetExtension intelTexOffsetExtension = { + { __DRI_TEX_OFFSET }, + intelSetTexOffset, +}; + static const __DRIextension *intelExtensions[] = { &driReadDrawableExtension, &driCopySubBufferExtension.base, &driSwapControlExtension.base, &driFrameTrackingExtension.base, &driMediaStreamCounterExtension.base, + &intelTexOffsetExtension.base, NULL }; -- cgit v1.2.3 From 70eb456a7626b7315e787f6019a405db359e0b5e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 16 Oct 2007 22:10:44 +1100 Subject: i915: fixup TTM interfaces to follow drm changes --- src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c | 38 +++++++--------------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c index 9ed6e3696f4..32d98860916 100644 --- a/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c +++ b/src/mesa/drivers/dri/i915/intel_bufmgr_ttm.c @@ -112,11 +112,6 @@ typedef struct _dri_bo_ttm { int refcount; /* Protected by bufmgr->mutex */ drmBO drm_bo; const char *name; - /** - * Note whether we are the owner of the buffer, to determine if we must - * drmBODestroy or drmBOUnreference to unreference the buffer. - */ - GLboolean owner; } dri_bo_ttm; typedef struct _dri_fence_ttm @@ -243,7 +238,7 @@ static void intel_free_reloc_list(int fd, struct intel_bo_list *reloc_list) } drmBOUnmap(fd, &reloc_node->type_list.buf); - drmBODestroy(fd, &reloc_node->type_list.buf); + drmBOUnreference(fd, &reloc_node->type_list.buf); free(reloc_node); } } @@ -307,8 +302,8 @@ static int intel_create_new_reloc_type_list(int fd, struct intel_bo_reloc_list * int ret; /* should allocate a drmBO here */ - ret = drmBOCreate(fd, 0, RELOC_BUF_SIZE(max_relocs), 0, - NULL, drm_bo_type_dc, + ret = drmBOCreate(fd, RELOC_BUF_SIZE(max_relocs), 0, + NULL, DRM_BO_FLAG_MEM_LOCAL | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_MAPPABLE | DRM_BO_FLAG_CACHED, 0, &cur_type->buf); if (ret) @@ -450,9 +445,8 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name, /* No hints we want to use. */ hint = 0; - ret = drmBOCreate(ttm_bufmgr->fd, 0, size, alignment / pageSize, - NULL, drm_bo_type_dc, - flags, hint, &ttm_buf->drm_bo); + ret = drmBOCreate(ttm_bufmgr->fd, size, alignment / pageSize, + NULL, flags, hint, &ttm_buf->drm_bo); if (ret != 0) { free(ttm_buf); return NULL; @@ -463,7 +457,6 @@ dri_ttm_alloc(dri_bufmgr *bufmgr, const char *name, ttm_buf->bo.bufmgr = bufmgr; ttm_buf->name = name; ttm_buf->refcount = 1; - ttm_buf->owner = GL_TRUE; #if BUFMGR_DEBUG fprintf(stderr, "bo_create: %p (%s)\n", &ttm_buf->bo, ttm_buf->name); @@ -514,7 +507,6 @@ intel_ttm_bo_create_from_handle(dri_bufmgr *bufmgr, const char *name, ttm_buf->bo.bufmgr = bufmgr; ttm_buf->name = name; ttm_buf->refcount = 1; - ttm_buf->owner = GL_FALSE; #if BUFMGR_DEBUG fprintf(stderr, "bo_create_from_handle: %p %08x (%s)\n", &ttm_buf->bo, handle, @@ -548,16 +540,9 @@ dri_ttm_bo_unreference(dri_bo *buf) if (--ttm_buf->refcount == 0) { int ret; - /* XXX Having to use drmBODestroy as the opposite of drmBOCreate instead - * of simply unreferencing is madness, and leads to behaviors we may not - * want (making the buffer unsharable). - */ - if (ttm_buf->owner) - ret = drmBODestroy(bufmgr_ttm->fd, &ttm_buf->drm_bo); - else - ret = drmBOUnReference(bufmgr_ttm->fd, &ttm_buf->drm_bo); + ret = drmBOUnreference(bufmgr_ttm->fd, &ttm_buf->drm_bo); if (ret != 0) { - fprintf(stderr, "drmBOUnReference failed (%s): %s\n", ttm_buf->name, + fprintf(stderr, "drmBOUnreference failed (%s): %s\n", ttm_buf->name, strerror(-ret)); } #if BUFMGR_DEBUG @@ -685,14 +670,9 @@ dri_ttm_fence_unreference(dri_fence *fence) if (--fence_ttm->refcount == 0) { int ret; - /* XXX Having to use drmFenceDestroy as the opposite of drmFenceBuffers - * instead of simply unreferencing is madness, and leads to behaviors we - * may not want (making the fence unsharable). This behavior by the DRM - * ioctls should be fixed, and drmFenceDestroy eliminated. - */ - ret = drmFenceDestroy(bufmgr_ttm->fd, &fence_ttm->drm_fence); + ret = drmFenceUnreference(bufmgr_ttm->fd, &fence_ttm->drm_fence); if (ret != 0) { - fprintf(stderr, "drmFenceDestroy failed (%s): %s\n", + fprintf(stderr, "drmFenceUnreference failed (%s): %s\n", fence_ttm->name, strerror(-ret)); } -- cgit v1.2.3 From 3feefeeb35c73ba6a8e0d81506891988bfcda5ef Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 16 Oct 2007 15:48:46 +0200 Subject: i915: Make sure extensions that require TTM actually work. --- src/mesa/drivers/dri/i915/intel_screen.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 8c4af6eaf59..8be5d910a0b 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -67,6 +67,7 @@ PUBLIC const char __driConfigOptions[] = #endif /*USE_NEW_INTERFACE */ extern const struct dri_extension card_extensions[]; + extern const struct dri_extension ttm_extensions[]; /** * Map all the memory regions described by the screen. @@ -916,6 +917,7 @@ PUBLIC __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) * Hello chicken. Hello egg. How are you two today? */ driInitExtensions(NULL, card_extensions, GL_FALSE); + driInitExtensions(NULL, ttm_extensions, GL_FALSE); if (!intelInitDriver(psp)) return NULL; -- cgit v1.2.3 From 919f617d08a34d01dd916b08ca4f315bae84f21c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 16 Oct 2007 12:25:35 -0700 Subject: Replace symlink generation from i915 with files in intel/ and symlinks there. --- src/mesa/drivers/dri/i915/Makefile | 3 +- src/mesa/drivers/dri/i915/server/i830_common.h | 256 ----- src/mesa/drivers/dri/i915/server/i830_dri.h | 63 -- src/mesa/drivers/dri/i915/server/intel.h | 331 ------ src/mesa/drivers/dri/i915/server/intel_dri.c | 1307 +---------------------- src/mesa/drivers/dri/i965/Makefile | 17 +- src/mesa/drivers/dri/i965/server/intel_dri.c | 1 + src/mesa/drivers/dri/intel/server/i830_common.h | 256 +++++ src/mesa/drivers/dri/intel/server/i830_dri.h | 63 ++ src/mesa/drivers/dri/intel/server/intel.h | 331 ++++++ src/mesa/drivers/dri/intel/server/intel_dri.c | 1306 ++++++++++++++++++++++ 11 files changed, 1962 insertions(+), 1972 deletions(-) delete mode 100644 src/mesa/drivers/dri/i915/server/i830_common.h delete mode 100644 src/mesa/drivers/dri/i915/server/i830_dri.h delete mode 100644 src/mesa/drivers/dri/i915/server/intel.h mode change 100644 => 120000 src/mesa/drivers/dri/i915/server/intel_dri.c create mode 120000 src/mesa/drivers/dri/i965/server/intel_dri.c create mode 100644 src/mesa/drivers/dri/intel/server/i830_common.h create mode 100644 src/mesa/drivers/dri/intel/server/i830_dri.h create mode 100644 src/mesa/drivers/dri/intel/server/intel.h create mode 100644 src/mesa/drivers/dri/intel/server/intel_dri.c (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index b9328a48f3d..ae96ddda0ab 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -62,7 +62,8 @@ C_SOURCES = \ ASM_SOURCES = -DRIVER_DEFINES = -I../intel $(shell pkg-config libdrm --atleast-version=2.3.1 \ +DRIVER_DEFINES = -I../intel -I../intel/server \ + $(shell pkg-config libdrm --atleast-version=2.3.1 \ && echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP") include ../Makefile.template diff --git a/src/mesa/drivers/dri/i915/server/i830_common.h b/src/mesa/drivers/dri/i915/server/i830_common.h deleted file mode 100644 index f1fd3939ab9..00000000000 --- a/src/mesa/drivers/dri/i915/server/i830_common.h +++ /dev/null @@ -1,256 +0,0 @@ -/************************************************************************** - -Copyright 2001 VA Linux Systems Inc., Fremont, California. -Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. - -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -on the rights to use, copy, modify, merge, publish, distribute, sub -license, and/or sell copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h,v 1.1 2002/09/11 00:29:32 dawes Exp $ */ - -#ifndef _I830_COMMON_H_ -#define _I830_COMMON_H_ - - -#define I830_NR_TEX_REGIONS 255 /* maximum due to use of chars for next/prev */ -#define I830_LOG_MIN_TEX_REGION_SIZE 14 - - -/* Driver specific DRM command indices - * NOTE: these are not OS specific, but they are driver specific - */ -#define DRM_I830_INIT 0x00 -#define DRM_I830_FLUSH 0x01 -#define DRM_I830_FLIP 0x02 -#define DRM_I830_BATCHBUFFER 0x03 -#define DRM_I830_IRQ_EMIT 0x04 -#define DRM_I830_IRQ_WAIT 0x05 -#define DRM_I830_GETPARAM 0x06 -#define DRM_I830_SETPARAM 0x07 -#define DRM_I830_ALLOC 0x08 -#define DRM_I830_FREE 0x09 -#define DRM_I830_INIT_HEAP 0x0a -#define DRM_I830_CMDBUFFER 0x0b -#define DRM_I830_DESTROY_HEAP 0x0c -#define DRM_I830_SET_VBLANK_PIPE 0x0d -#define DRM_I830_GET_VBLANK_PIPE 0x0e -#define DRM_I830_MMIO 0x10 - -typedef struct { - enum { - I830_INIT_DMA = 0x01, - I830_CLEANUP_DMA = 0x02, - I830_RESUME_DMA = 0x03 - } func; - unsigned int mmio_offset; - int sarea_priv_offset; - unsigned int ring_start; - unsigned int ring_end; - unsigned int ring_size; - unsigned int front_offset; - unsigned int back_offset; - unsigned int depth_offset; - unsigned int w; - unsigned int h; - unsigned int pitch; - unsigned int pitch_bits; - unsigned int back_pitch; - unsigned int depth_pitch; - unsigned int cpp; - unsigned int chipset; -} drmI830Init; - -typedef struct { - drmTextureRegion texList[I830_NR_TEX_REGIONS+1]; - int last_upload; /* last time texture was uploaded */ - int last_enqueue; /* last time a buffer was enqueued */ - int last_dispatch; /* age of the most recently dispatched buffer */ - int ctxOwner; /* last context to upload state */ - /** Last context that used the buffer manager. */ - int texAge; - int pf_enabled; /* is pageflipping allowed? */ - int pf_active; - int pf_current_page; /* which buffer is being displayed? */ - int perf_boxes; /* performance boxes to be displayed */ - int width, height; /* screen size in pixels */ - - drm_handle_t front_handle; - int front_offset; - int front_size; - - drm_handle_t back_handle; - int back_offset; - int back_size; - - drm_handle_t depth_handle; - int depth_offset; - int depth_size; - - drm_handle_t tex_handle; - int tex_offset; - int tex_size; - int log_tex_granularity; - int pitch; - int rotation; /* 0, 90, 180 or 270 */ - int rotated_offset; - int rotated_size; - int rotated_pitch; - int virtualX, virtualY; - - unsigned int front_tiled; - unsigned int back_tiled; - unsigned int depth_tiled; - unsigned int rotated_tiled; - unsigned int rotated2_tiled; - - int planeA_x; - int planeA_y; - int planeA_w; - int planeA_h; - int planeB_x; - int planeB_y; - int planeB_w; - int planeB_h; - - /* Triple buffering */ - drm_handle_t third_handle; - int third_offset; - int third_size; - unsigned int third_tiled; - - /* buffer object handles for the static buffers. May change - * over the lifetime of the client, though it doesn't in our current - * implementation. - */ - unsigned int front_bo_handle; - unsigned int back_bo_handle; - unsigned int third_bo_handle; - unsigned int depth_bo_handle; -} drmI830Sarea; - -/* Flags for perf_boxes - */ -#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */ -#define I830_BOX_FLIP 0x2 /* populated by kernel */ -#define I830_BOX_WAIT 0x4 /* populated by kernel & client */ -#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */ -#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */ - - -typedef struct { - int start; /* agp offset */ - int used; /* nr bytes in use */ - int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ - int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/ - int num_cliprects; /* mulitpass with multiple cliprects? */ - drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */ -} drmI830BatchBuffer; - -typedef struct { - char *buf; /* agp offset */ - int sz; /* nr bytes in use */ - int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ - int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/ - int num_cliprects; /* mulitpass with multiple cliprects? */ - drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */ -} drmI830CmdBuffer; - -typedef struct { - int *irq_seq; -} drmI830IrqEmit; - -typedef struct { - int irq_seq; -} drmI830IrqWait; - -typedef struct { - int param; - int *value; -} drmI830GetParam; - -#define I830_PARAM_IRQ_ACTIVE 1 -#define I830_PARAM_ALLOW_BATCHBUFFER 2 - -typedef struct { - int param; - int value; -} drmI830SetParam; - -#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1 -#define I830_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 -#define I830_SETPARAM_ALLOW_BATCHBUFFER 3 - - -/* A memory manager for regions of shared memory: - */ -#define I830_MEM_REGION_AGP 1 - -typedef struct { - int region; - int alignment; - int size; - int *region_offset; /* offset from start of fb or agp */ -} drmI830MemAlloc; - -typedef struct { - int region; - int region_offset; -} drmI830MemFree; - -typedef struct { - int region; - int size; - int start; -} drmI830MemInitHeap; - -typedef struct { - int region; -} drmI830MemDestroyHeap; - -#define DRM_I830_VBLANK_PIPE_A 1 -#define DRM_I830_VBLANK_PIPE_B 2 - -typedef struct { - int pipe; -} drmI830VBlankPipe; - -#define MMIO_READ 0 -#define MMIO_WRITE 1 - -#define MMIO_REGS_IA_PRIMATIVES_COUNT 0 -#define MMIO_REGS_IA_VERTICES_COUNT 1 -#define MMIO_REGS_VS_INVOCATION_COUNT 2 -#define MMIO_REGS_GS_PRIMITIVES_COUNT 3 -#define MMIO_REGS_GS_INVOCATION_COUNT 4 -#define MMIO_REGS_CL_PRIMITIVES_COUNT 5 -#define MMIO_REGS_CL_INVOCATION_COUNT 6 -#define MMIO_REGS_PS_INVOCATION_COUNT 7 -#define MMIO_REGS_PS_DEPTH_COUNT 8 - -typedef struct { - unsigned int read_write:1; - unsigned int reg:31; - void __user *data; -} drmI830MMIO; - -#endif /* _I830_DRM_H_ */ diff --git a/src/mesa/drivers/dri/i915/server/i830_dri.h b/src/mesa/drivers/dri/i915/server/i830_dri.h deleted file mode 100644 index c2a3af8cbf7..00000000000 --- a/src/mesa/drivers/dri/i915/server/i830_dri.h +++ /dev/null @@ -1,63 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.4 2002/10/30 12:52:18 alanh Exp $ */ - -#ifndef _I830_DRI_H -#define _I830_DRI_H - -#include "xf86drm.h" -#include "i830_common.h" - -#define I830_MAX_DRAWABLES 256 - -#define I830_MAJOR_VERSION 1 -#define I830_MINOR_VERSION 7 -#define I830_PATCHLEVEL 2 - -#define I830_REG_SIZE 0x80000 - -typedef struct _I830DRIRec { - drm_handle_t regs; - drmSize regsSize; - - drmSize unused1; /* backbufferSize */ - drm_handle_t unused2; /* backbuffer */ - - drmSize unused3; /* depthbufferSize */ - drm_handle_t unused4; /* depthbuffer */ - - drmSize unused5; /* rotatedSize */ - drm_handle_t unused6; /* rotatedbuffer */ - - drm_handle_t unused7; /* textures */ - int unused8; /* textureSize */ - - drm_handle_t unused9; /* agp_buffers */ - drmSize unused10; /* agp_buf_size */ - - int deviceID; - int width; - int height; - int mem; - int cpp; - int bitsPerPixel; - - int unused11[8]; /* was front/back/depth/rotated offset/pitch */ - - int unused12; /* logTextureGranularity */ - int unused13; /* textureOffset */ - - int irq; - int sarea_priv_offset; -} I830DRIRec, *I830DRIPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} I830ConfigPrivRec, *I830ConfigPrivPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} I830DRIContextRec, *I830DRIContextPtr; - - -#endif diff --git a/src/mesa/drivers/dri/i915/server/intel.h b/src/mesa/drivers/dri/i915/server/intel.h deleted file mode 100644 index 6ea72499c1c..00000000000 --- a/src/mesa/drivers/dri/i915/server/intel.h +++ /dev/null @@ -1,331 +0,0 @@ -#ifndef _INTEL_H_ -#define _INTEL_H_ - -#include "xf86drm.h" /* drm_handle_t, etc */ - -/* Intel */ -#ifndef PCI_CHIP_I810 -#define PCI_CHIP_I810 0x7121 -#define PCI_CHIP_I810_DC100 0x7123 -#define PCI_CHIP_I810_E 0x7125 -#define PCI_CHIP_I815 0x1132 -#define PCI_CHIP_I810_BRIDGE 0x7120 -#define PCI_CHIP_I810_DC100_BRIDGE 0x7122 -#define PCI_CHIP_I810_E_BRIDGE 0x7124 -#define PCI_CHIP_I815_BRIDGE 0x1130 -#endif - -#define PCI_CHIP_845_G 0x2562 -#define PCI_CHIP_I830_M 0x3577 - -#ifndef PCI_CHIP_I855_GM -#define PCI_CHIP_I855_GM 0x3582 -#define PCI_CHIP_I855_GM_BRIDGE 0x3580 -#endif - -#ifndef PCI_CHIP_I865_G -#define PCI_CHIP_I865_G 0x2572 -#define PCI_CHIP_I865_G_BRIDGE 0x2570 -#endif - -#ifndef PCI_CHIP_I915_G -#define PCI_CHIP_I915_G 0x2582 -#define PCI_CHIP_I915_G_BRIDGE 0x2580 -#endif - -#ifndef PCI_CHIP_I915_GM -#define PCI_CHIP_I915_GM 0x2592 -#define PCI_CHIP_I915_GM_BRIDGE 0x2590 -#endif - -#ifndef PCI_CHIP_E7221_G -#define PCI_CHIP_E7221_G 0x258A -/* Same as I915_G_BRIDGE */ -#define PCI_CHIP_E7221_G_BRIDGE 0x2580 -#endif - -#ifndef PCI_CHIP_I945_G -#define PCI_CHIP_I945_G 0x2772 -#define PCI_CHIP_I945_G_BRIDGE 0x2770 -#endif - -#ifndef PCI_CHIP_I945_GM -#define PCI_CHIP_I945_GM 0x27A2 -#define PCI_CHIP_I945_GM_BRIDGE 0x27A0 -#endif - -#define IS_I810(pI810) (pI810->Chipset == PCI_CHIP_I810 || \ - pI810->Chipset == PCI_CHIP_I810_DC100 || \ - pI810->Chipset == PCI_CHIP_I810_E) -#define IS_I815(pI810) (pI810->Chipset == PCI_CHIP_I815) -#define IS_I830(pI810) (pI810->Chipset == PCI_CHIP_I830_M) -#define IS_845G(pI810) (pI810->Chipset == PCI_CHIP_845_G) -#define IS_I85X(pI810) (pI810->Chipset == PCI_CHIP_I855_GM) -#define IS_I852(pI810) (pI810->Chipset == PCI_CHIP_I855_GM && (pI810->variant == I852_GM || pI810->variant == I852_GME)) -#define IS_I855(pI810) (pI810->Chipset == PCI_CHIP_I855_GM && (pI810->variant == I855_GM || pI810->variant == I855_GME)) -#define IS_I865G(pI810) (pI810->Chipset == PCI_CHIP_I865_G) - -#define IS_I915G(pI810) (pI810->Chipset == PCI_CHIP_I915_G || pI810->Chipset == PCI_CHIP_E7221_G) -#define IS_I915GM(pI810) (pI810->Chipset == PCI_CHIP_I915_GM) -#define IS_I945G(pI810) (pI810->Chipset == PCI_CHIP_I945_G) -#define IS_I945GM(pI810) (pI810->Chipset == PCI_CHIP_I945_GM) -#define IS_I9XX(pI810) (IS_I915G(pI810) || IS_I915GM(pI810) || IS_I945G(pI810) || IS_I945GM(pI810)) - -#define IS_MOBILE(pI810) (IS_I830(pI810) || IS_I85X(pI810) || IS_I915GM(pI810) || IS_I945GM(pI810)) - -#define I830_GMCH_CTRL 0x52 - -#define I830_GMCH_MEM_MASK 0x1 -#define I830_GMCH_MEM_64M 0x1 -#define I830_GMCH_MEM_128M 0 - -#define I830_GMCH_GMS_MASK 0x70 -#define I830_GMCH_GMS_DISABLED 0x00 -#define I830_GMCH_GMS_LOCAL 0x10 -#define I830_GMCH_GMS_STOLEN_512 0x20 -#define I830_GMCH_GMS_STOLEN_1024 0x30 -#define I830_GMCH_GMS_STOLEN_8192 0x40 - -#define I855_GMCH_GMS_MASK (0x7 << 4) -#define I855_GMCH_GMS_DISABLED 0x00 -#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4) -#define I855_GMCH_GMS_STOLEN_4M (0x2 << 4) -#define I855_GMCH_GMS_STOLEN_8M (0x3 << 4) -#define I855_GMCH_GMS_STOLEN_16M (0x4 << 4) -#define I855_GMCH_GMS_STOLEN_32M (0x5 << 4) -#define I915G_GMCH_GMS_STOLEN_48M (0x6 << 4) -#define I915G_GMCH_GMS_STOLEN_64M (0x7 << 4) - -typedef unsigned char Bool; -#define TRUE 1 -#define FALSE 0 - -#define PIPE_NONE 0<<0 -#define PIPE_CRT 1<<0 -#define PIPE_TV 1<<1 -#define PIPE_DFP 1<<2 -#define PIPE_LFP 1<<3 -#define PIPE_CRT2 1<<4 -#define PIPE_TV2 1<<5 -#define PIPE_DFP2 1<<6 -#define PIPE_LFP2 1<<7 - -typedef struct _I830MemPool *I830MemPoolPtr; -typedef struct _I830MemRange *I830MemRangePtr; -typedef struct _I830MemRange { - long Start; - long End; - long Size; - unsigned long Physical; - unsigned long Offset; /* Offset of AGP-allocated portion */ - unsigned long Alignment; - drm_handle_t Key; - unsigned long Pitch; // add pitch - I830MemPoolPtr Pool; -} I830MemRange; - -typedef struct _I830MemPool { - I830MemRange Total; - I830MemRange Free; - I830MemRange Fixed; - I830MemRange Allocated; -} I830MemPool; - -typedef struct { - int tail_mask; - I830MemRange mem; - unsigned char *virtual_start; - int head; - int tail; - int space; -} I830RingBuffer; - -typedef struct _I830Rec { - unsigned char *MMIOBase; - unsigned char *FbBase; - int cpp; - uint32_t aper_size; - unsigned int bios_version; - - /* These are set in PreInit and never changed. */ - long FbMapSize; - long TotalVideoRam; - I830MemRange StolenMemory; /* pre-allocated memory */ - long BIOSMemorySize; /* min stolen pool size */ - int BIOSMemSizeLoc; - - /* These change according to what has been allocated. */ - long FreeMemory; - I830MemRange MemoryAperture; - I830MemPool StolenPool; - long allocatedMemory; - - /* Regions allocated either from the above pools, or from agpgart. */ - /* for single and dual head configurations */ - I830MemRange FrontBuffer; - I830MemRange FrontBuffer2; - I830MemRange Scratch; - I830MemRange Scratch2; - - I830RingBuffer *LpRing; - - I830MemRange BackBuffer; - I830MemRange DepthBuffer; - I830MemRange TexMem; - int TexGranularity; - I830MemRange ContextMem; - int drmMinor; - Bool have3DWindows; - - Bool NeedRingBufferLow; - Bool allowPageFlip; - Bool disableTiling; - - int Chipset; - unsigned long LinearAddr; - unsigned long MMIOAddr; - - drmSize registerSize; /**< \brief MMIO register map size */ - drm_handle_t registerHandle; /**< \brief MMIO register map handle */ - // IOADDRESS ioBase; - int irq; /**< \brief IRQ number */ - int GttBound; - - drm_handle_t ring_map; - unsigned int Fence[8]; - -} I830Rec; - -/* - * 12288 is set as the maximum, chosen because it is enough for - * 1920x1440@32bpp with a 2048 pixel line pitch with some to spare. - */ -#define I830_MAXIMUM_VBIOS_MEM 12288 -#define I830_DEFAULT_VIDEOMEM_2D (MB(32) / 1024) -#define I830_DEFAULT_VIDEOMEM_3D (MB(64) / 1024) - -/* Flags for memory allocation function */ -#define FROM_ANYWHERE 0x00000000 -#define FROM_POOL_ONLY 0x00000001 -#define FROM_NEW_ONLY 0x00000002 -#define FROM_MASK 0x0000000f - -#define ALLOCATE_AT_TOP 0x00000010 -#define ALLOCATE_AT_BOTTOM 0x00000020 -#define FORCE_GAPS 0x00000040 - -#define NEED_PHYSICAL_ADDR 0x00000100 -#define ALIGN_BOTH_ENDS 0x00000200 -#define FORCE_LOW 0x00000400 - -#define ALLOC_NO_TILING 0x00001000 -#define ALLOC_INITIAL 0x00002000 - -#define ALLOCATE_DRY_RUN 0x80000000 - -/* Chipset registers for VIDEO BIOS memory RW access */ -#define _855_DRAM_RW_CONTROL 0x58 -#define _845_DRAM_RW_CONTROL 0x90 -#define DRAM_WRITE 0x33330000 - -#define KB(x) ((x) * 1024) -#define MB(x) ((x) * KB(1024)) - -#define GTT_PAGE_SIZE KB(4) -#define ROUND_TO(x, y) (((x) + (y) - 1) / (y) * (y)) -#define ROUND_DOWN_TO(x, y) ((x) / (y) * (y)) -#define ROUND_TO_PAGE(x) ROUND_TO((x), GTT_PAGE_SIZE) -#define ROUND_TO_MB(x) ROUND_TO((x), MB(1)) -#define PRIMARY_RINGBUFFER_SIZE KB(128) - - -/* Ring buffer registers, p277, overview p19 - */ -#define LP_RING 0x2030 -#define HP_RING 0x2040 - -#define RING_TAIL 0x00 -#define TAIL_ADDR 0x000FFFF8 -#define I830_TAIL_MASK 0x001FFFF8 - -#define RING_HEAD 0x04 -#define HEAD_WRAP_COUNT 0xFFE00000 -#define HEAD_WRAP_ONE 0x00200000 -#define HEAD_ADDR 0x001FFFFC -#define I830_HEAD_MASK 0x001FFFFC - -#define RING_START 0x08 -#define START_ADDR 0x03FFFFF8 -#define I830_RING_START_MASK 0xFFFFF000 - -#define RING_LEN 0x0C -#define RING_NR_PAGES 0x001FF000 -#define I830_RING_NR_PAGES 0x001FF000 -#define RING_REPORT_MASK 0x00000006 -#define RING_REPORT_64K 0x00000002 -#define RING_REPORT_128K 0x00000004 -#define RING_NO_REPORT 0x00000000 -#define RING_VALID_MASK 0x00000001 -#define RING_VALID 0x00000001 -#define RING_INVALID 0x00000000 - - -/* Fence/Tiling ranges [0..7] - */ -#define FENCE 0x2000 -#define FENCE_NR 8 - -#define I915G_FENCE_START_MASK 0x0ff00000 - -#define I830_FENCE_START_MASK 0x07f80000 - -#define FENCE_START_MASK 0x03F80000 -#define FENCE_X_MAJOR 0x00000000 -#define FENCE_Y_MAJOR 0x00001000 -#define FENCE_SIZE_MASK 0x00000700 -#define FENCE_SIZE_512K 0x00000000 -#define FENCE_SIZE_1M 0x00000100 -#define FENCE_SIZE_2M 0x00000200 -#define FENCE_SIZE_4M 0x00000300 -#define FENCE_SIZE_8M 0x00000400 -#define FENCE_SIZE_16M 0x00000500 -#define FENCE_SIZE_32M 0x00000600 -#define FENCE_SIZE_64M 0x00000700 -#define I915G_FENCE_SIZE_1M 0x00000000 -#define I915G_FENCE_SIZE_2M 0x00000100 -#define I915G_FENCE_SIZE_4M 0x00000200 -#define I915G_FENCE_SIZE_8M 0x00000300 -#define I915G_FENCE_SIZE_16M 0x00000400 -#define I915G_FENCE_SIZE_32M 0x00000500 -#define I915G_FENCE_SIZE_64M 0x00000600 -#define I915G_FENCE_SIZE_128M 0x00000700 -#define FENCE_PITCH_1 0x00000000 -#define FENCE_PITCH_2 0x00000010 -#define FENCE_PITCH_4 0x00000020 -#define FENCE_PITCH_8 0x00000030 -#define FENCE_PITCH_16 0x00000040 -#define FENCE_PITCH_32 0x00000050 -#define FENCE_PITCH_64 0x00000060 -#define FENCE_VALID 0x00000001 - -#include - -# define MMIO_IN8(base, offset) \ - *(volatile unsigned char *)(((unsigned char*)(base)) + (offset)) -# define MMIO_IN32(base, offset) \ - read_MMIO_LE32(base, offset) -# define MMIO_OUT8(base, offset, val) \ - *(volatile unsigned char *)(((unsigned char*)(base)) + (offset)) = (val) -# define MMIO_OUT32(base, offset, val) \ - *(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset)) = CPU_TO_LE32(val) - - - /* Memory mapped register access macros */ -#define INREG8(addr) MMIO_IN8(MMIO, addr) -#define INREG(addr) MMIO_IN32(MMIO, addr) -#define OUTREG8(addr, val) MMIO_OUT8(MMIO, addr, val) -#define OUTREG(addr, val) MMIO_OUT32(MMIO, addr, val) - -#define DSPABASE 0x70184 - -#endif diff --git a/src/mesa/drivers/dri/i915/server/intel_dri.c b/src/mesa/drivers/dri/i915/server/intel_dri.c deleted file mode 100644 index e49c4214ad4..00000000000 --- a/src/mesa/drivers/dri/i915/server/intel_dri.c +++ /dev/null @@ -1,1306 +0,0 @@ -/** - * \file server/intel_dri.c - * \brief File to perform the device-specific initialization tasks typically - * done in the X server. - * - * Here they are converted to run in the client (or perhaps a standalone - * process), and to work with the frame buffer device rather than the X - * server infrastructure. - * - * Copyright (C) 2006 Dave Airlie (airlied@linux.ie) - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sub license, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial portions - of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR - ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include -#include -#include -#include -#include - -#include "driver.h" -#include "drm.h" - -#include "intel.h" -#include "i830_dri.h" - -#include "memops.h" -#include "pciaccess.h" - -static size_t drm_page_size; -static int nextTile = 0; -#define xf86DrvMsg(...) do {} while(0) - -static const int pitches[] = { - 128 * 8, - 128 * 16, - 128 * 32, - 128 * 64, - 0 -}; - -static Bool I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea); - -static unsigned long -GetBestTileAlignment(unsigned long size) -{ - unsigned long i; - - for (i = KB(512); i < size; i <<= 1) - ; - - if (i > MB(64)) - i = MB(64); - - return i; -} - -static void SetFenceRegs(const DRIDriverContext *ctx, I830Rec *pI830) -{ - int i; - unsigned char *MMIO = ctx->MMIOAddress; - - for (i = 0; i < 8; i++) { - OUTREG(FENCE + i * 4, pI830->Fence[i]); - // if (I810_DEBUG & DEBUG_VERBOSE_VGA) - fprintf(stderr,"Fence Register : %x\n", pI830->Fence[i]); - } -} - -/* Tiled memory is good... really, really good... - * - * Need to make it less likely that we miss out on this - probably - * need to move the frontbuffer away from the 'guarenteed' alignment - * of the first memory segment, or perhaps allocate a discontigous - * framebuffer to get more alignment 'sweet spots'. - */ -static void -SetFence(const DRIDriverContext *ctx, I830Rec *pI830, - int nr, unsigned int start, unsigned int pitch, - unsigned int size) -{ - unsigned int val; - unsigned int fence_mask = 0; - unsigned int fence_pitch; - - if (nr < 0 || nr > 7) { - fprintf(stderr, - "SetFence: fence %d out of range\n",nr); - return; - } - - pI830->Fence[nr] = 0; - - if (IS_I9XX(pI830)) - fence_mask = ~I915G_FENCE_START_MASK; - else - fence_mask = ~I830_FENCE_START_MASK; - - if (start & fence_mask) { - fprintf(stderr, - "SetFence: %d: start (0x%08x) is not %s aligned\n", - nr, start, (IS_I9XX(pI830)) ? "1MB" : "512k"); - return; - } - - if (start % size) { - fprintf(stderr, - "SetFence: %d: start (0x%08x) is not size (%dk) aligned\n", - nr, start, size / 1024); - return; - } - - if (pitch & 127) { - fprintf(stderr, - "SetFence: %d: pitch (%d) not a multiple of 128 bytes\n", - nr, pitch); - return; - } - - val = (start | FENCE_X_MAJOR | FENCE_VALID); - - if (IS_I9XX(pI830)) { - switch (size) { - case MB(1): - val |= I915G_FENCE_SIZE_1M; - break; - case MB(2): - val |= I915G_FENCE_SIZE_2M; - break; - case MB(4): - val |= I915G_FENCE_SIZE_4M; - break; - case MB(8): - val |= I915G_FENCE_SIZE_8M; - break; - case MB(16): - val |= I915G_FENCE_SIZE_16M; - break; - case MB(32): - val |= I915G_FENCE_SIZE_32M; - break; - case MB(64): - val |= I915G_FENCE_SIZE_64M; - break; - default: - fprintf(stderr, - "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024); - return; - } - } else { - switch (size) { - case KB(512): - val |= FENCE_SIZE_512K; - break; - case MB(1): - val |= FENCE_SIZE_1M; - break; - case MB(2): - val |= FENCE_SIZE_2M; - break; - case MB(4): - val |= FENCE_SIZE_4M; - break; - case MB(8): - val |= FENCE_SIZE_8M; - break; - case MB(16): - val |= FENCE_SIZE_16M; - break; - case MB(32): - val |= FENCE_SIZE_32M; - break; - case MB(64): - val |= FENCE_SIZE_64M; - break; - default: - fprintf(stderr, - "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024); - return; - } - } - - if (IS_I9XX(pI830)) - fence_pitch = pitch / 512; - else - fence_pitch = pitch / 128; - - switch (fence_pitch) { - case 1: - val |= FENCE_PITCH_1; - break; - case 2: - val |= FENCE_PITCH_2; - break; - case 4: - val |= FENCE_PITCH_4; - break; - case 8: - val |= FENCE_PITCH_8; - break; - case 16: - val |= FENCE_PITCH_16; - break; - case 32: - val |= FENCE_PITCH_32; - break; - case 64: - val |= FENCE_PITCH_64; - break; - default: - fprintf(stderr, - "SetFence: %d: illegal pitch (%d)\n", nr, pitch); - return; - } - - pI830->Fence[nr] = val; -} - -static Bool -MakeTiles(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *pMem) -{ - int pitch, ntiles, i; - - pitch = pMem->Pitch * ctx->cpp; - /* - * Simply try to break the region up into at most four pieces of size - * equal to the alignment. - */ - ntiles = ROUND_TO(pMem->Size, pMem->Alignment) / pMem->Alignment; - if (ntiles >= 4) { - return FALSE; - } - - for (i = 0; i < ntiles; i++, nextTile++) { - SetFence(ctx, pI830, nextTile, pMem->Start + i * pMem->Alignment, - pitch, pMem->Alignment); - } - return TRUE; -} - -static void I830SetupMemoryTiling(const DRIDriverContext *ctx, I830Rec *pI830) -{ - int i; - - /* Clear out */ - for (i = 0; i < 8; i++) - pI830->Fence[i] = 0; - - nextTile = 0; - - if (pI830->BackBuffer.Alignment >= KB(512)) { - if (MakeTiles(ctx, pI830, &(pI830->BackBuffer))) { - fprintf(stderr, - "Activating tiled memory for the back buffer.\n"); - } else { - fprintf(stderr, - "MakeTiles failed for the back buffer.\n"); - pI830->allowPageFlip = FALSE; - } - } - - if (pI830->DepthBuffer.Alignment >= KB(512)) { - if (MakeTiles(ctx, pI830, &(pI830->DepthBuffer))) { - fprintf(stderr, - "Activating tiled memory for the depth buffer.\n"); - } else { - fprintf(stderr, - "MakeTiles failed for the depth buffer.\n"); - } - } - - return; -} - -static int I830DetectMemory(const DRIDriverContext *ctx, I830Rec *pI830) -{ - struct pci_device host_bridge, ig_dev; - uint32_t gmch_ctrl; - int memsize = 0; - int range; - uint32_t aper_size; - uint32_t membase2 = 0; - - memset(&host_bridge, 0, sizeof(host_bridge)); - memset(&ig_dev, 0, sizeof(ig_dev)); - - ig_dev.dev = 2; - - pci_device_cfg_read_u32(&host_bridge, &gmch_ctrl, I830_GMCH_CTRL); - - if (IS_I830(pI830) || IS_845G(pI830)) { - if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) { - aper_size = 0x80000000; - } else { - aper_size = 0x40000000; - } - } else { - if (IS_I9XX(pI830)) { - int ret; - ret = pci_device_cfg_read_u32(&ig_dev, &membase2, 0x18); - if (membase2 & 0x08000000) - aper_size = 0x8000000; - else - aper_size = 0x10000000; - - fprintf(stderr,"aper size is %08X %08x %d\n", aper_size, membase2, ret); - } else - aper_size = 0x8000000; - } - - pI830->aper_size = aper_size; - - - /* We need to reduce the stolen size, by the GTT and the popup. - * The GTT varying according the the FbMapSize and the popup is 4KB */ - range = (ctx->shared.fbSize / (1024*1024)) + 4; - - if (IS_I85X(pI830) || IS_I865G(pI830) || IS_I9XX(pI830)) { - switch (gmch_ctrl & I830_GMCH_GMS_MASK) { - case I855_GMCH_GMS_STOLEN_1M: - memsize = MB(1) - KB(range); - break; - case I855_GMCH_GMS_STOLEN_4M: - memsize = MB(4) - KB(range); - break; - case I855_GMCH_GMS_STOLEN_8M: - memsize = MB(8) - KB(range); - break; - case I855_GMCH_GMS_STOLEN_16M: - memsize = MB(16) - KB(range); - break; - case I855_GMCH_GMS_STOLEN_32M: - memsize = MB(32) - KB(range); - break; - case I915G_GMCH_GMS_STOLEN_48M: - if (IS_I9XX(pI830)) - memsize = MB(48) - KB(range); - break; - case I915G_GMCH_GMS_STOLEN_64M: - if (IS_I9XX(pI830)) - memsize = MB(64) - KB(range); - break; - } - } else { - switch (gmch_ctrl & I830_GMCH_GMS_MASK) { - case I830_GMCH_GMS_STOLEN_512: - memsize = KB(512) - KB(range); - break; - case I830_GMCH_GMS_STOLEN_1024: - memsize = MB(1) - KB(range); - break; - case I830_GMCH_GMS_STOLEN_8192: - memsize = MB(8) - KB(range); - break; - case I830_GMCH_GMS_LOCAL: - memsize = 0; - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Local memory found, but won't be used.\n"); - break; - } - } - if (memsize > 0) { - fprintf(stderr, - "detected %d kB stolen memory.\n", memsize / 1024); - } else { - fprintf(stderr, - "no video memory detected.\n"); - } - return memsize; -} - -static int AgpInit(const DRIDriverContext *ctx, I830Rec *info) -{ - unsigned long mode = 0x4; - - if (drmAgpAcquire(ctx->drmFD) < 0) { - fprintf(stderr, "[gart] AGP not available\n"); - return 0; - } - - if (drmAgpEnable(ctx->drmFD, mode) < 0) { - fprintf(stderr, "[gart] AGP not enabled\n"); - drmAgpRelease(ctx->drmFD); - return 0; - } - else - fprintf(stderr, "[gart] AGP enabled at %dx\n", ctx->agpmode); - - return 1; -} - -/* - * Allocate memory from the given pool. Grow the pool if needed and if - * possible. - */ -static unsigned long -AllocFromPool(const DRIDriverContext *ctx, I830Rec *pI830, - I830MemRange *result, I830MemPool *pool, - long size, unsigned long alignment, int flags) -{ - long needed, start, end; - - if (!result || !pool || !size) - return 0; - - /* Calculate how much space is needed. */ - if (alignment <= GTT_PAGE_SIZE) - needed = size; - else { - start = ROUND_TO(pool->Free.Start, alignment); - end = ROUND_TO(start + size, alignment); - needed = end - pool->Free.Start; - } - if (needed > pool->Free.Size) { - return 0; - } - - result->Start = ROUND_TO(pool->Free.Start, alignment); - pool->Free.Start += needed; - result->End = pool->Free.Start; - - pool->Free.Size = pool->Free.End - pool->Free.Start; - result->Size = result->End - result->Start; - result->Pool = pool; - result->Alignment = alignment; - return needed; -} - -static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, long size, unsigned long alignment, I830MemRange *result) -{ - unsigned long start, end; - unsigned long newApStart, newApEnd; - int ret; - if (!result || !size) - return 0; - - if (!alignment) - alignment = 4; - - start = ROUND_TO(pI830->MemoryAperture.Start, alignment); - end = ROUND_TO(start + size, alignment); - newApStart = end; - newApEnd = pI830->MemoryAperture.End; - - ret=drmAgpAlloc(ctx->drmFD, size, 0, &(result->Physical), (drm_handle_t *)&(result->Key)); - - if (ret) - { - fprintf(stderr,"drmAgpAlloc failed %d\n", ret); - return 0; - } - pI830->allocatedMemory += size; - pI830->MemoryAperture.Start = newApStart; - pI830->MemoryAperture.End = newApEnd; - pI830->MemoryAperture.Size = newApEnd - newApStart; - // pI830->FreeMemory -= size; - result->Start = start; - result->End = start + size; - result->Size = size; - result->Offset = start; - result->Alignment = alignment; - result->Pool = NULL; - - return size; -} - -unsigned long -I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, - I830MemRange *result, I830MemPool *pool, long size, - unsigned long alignment, int flags) -{ - unsigned long ret; - - if (!result) - return 0; - - /* Make sure these are initialised. */ - result->Size = 0; - result->Key = -1; - - if (!size) { - return 0; - } - - if (pool->Free.Size < size) { - ret = AllocFromAGP(ctx, pI830, size, alignment, result); - } - else { - ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags); - if (ret == 0) - ret = AllocFromAGP(ctx, pI830, size, alignment, result); - } - return ret; -} - -static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem) -{ - if (!mem) - return FALSE; - - if (mem->Key == -1) - return TRUE; - - return !drmAgpBind(ctx->drmFD, mem->Key, mem->Offset); -} - -/* simple memory allocation routines needed */ -/* put ring buffer in low memory */ -/* need to allocate front, back, depth buffers aligned correctly, - allocate ring buffer, -*/ - -/* */ -static Bool -I830AllocateMemory(const DRIDriverContext *ctx, I830Rec *pI830) -{ - unsigned long size, ret; - unsigned long lines, lineSize, align; - - /* allocate ring buffer */ - memset(pI830->LpRing, 0, sizeof(I830RingBuffer)); - pI830->LpRing->mem.Key = -1; - - size = PRIMARY_RINGBUFFER_SIZE; - - ret = I830AllocVidMem(ctx, pI830, &pI830->LpRing->mem, &pI830->StolenPool, size, 0x1000, 0); - - if (ret != size) - { - fprintf(stderr,"unable to allocate ring buffer %ld\n", ret); - return FALSE; - } - - pI830->LpRing->tail_mask = pI830->LpRing->mem.Size - 1; - - - /* allocate front buffer */ - memset(&(pI830->FrontBuffer), 0, sizeof(pI830->FrontBuffer)); - pI830->FrontBuffer.Key = -1; - pI830->FrontBuffer.Pitch = ctx->shared.virtualWidth; - - align = KB(512); - - lineSize = ctx->shared.virtualWidth * ctx->cpp; - lines = (ctx->shared.virtualHeight + 15) / 16 * 16; - size = lineSize * lines; - size = ROUND_TO_PAGE(size); - - align = GetBestTileAlignment(size); - - ret = I830AllocVidMem(ctx, pI830, &pI830->FrontBuffer, &pI830->StolenPool, size, align, 0); - if (ret < size) - { - fprintf(stderr,"unable to allocate front buffer %ld\n", ret); - return FALSE; - } - - memset(&(pI830->BackBuffer), 0, sizeof(pI830->BackBuffer)); - pI830->BackBuffer.Key = -1; - pI830->BackBuffer.Pitch = ctx->shared.virtualWidth; - - ret = I830AllocVidMem(ctx, pI830, &pI830->BackBuffer, &pI830->StolenPool, size, align, 0); - if (ret < size) - { - fprintf(stderr,"unable to allocate back buffer %ld\n", ret); - return FALSE; - } - - memset(&(pI830->DepthBuffer), 0, sizeof(pI830->DepthBuffer)); - pI830->DepthBuffer.Key = -1; - pI830->DepthBuffer.Pitch = ctx->shared.virtualWidth; - - ret = I830AllocVidMem(ctx, pI830, &pI830->DepthBuffer, &pI830->StolenPool, size, align, 0); - if (ret < size) - { - fprintf(stderr,"unable to allocate depth buffer %ld\n", ret); - return FALSE; - } - - memset(&(pI830->ContextMem), 0, sizeof(pI830->ContextMem)); - pI830->ContextMem.Key = -1; - size = KB(32); - - ret = I830AllocVidMem(ctx, pI830, &pI830->ContextMem, &pI830->StolenPool, size, align, 0); - if (ret < size) - { - fprintf(stderr,"unable to allocate context buffer %ld\n", ret); - return FALSE; - } - -#if 0 - memset(&(pI830->TexMem), 0, sizeof(pI830->TexMem)); - pI830->TexMem.Key = -1; - - size = 32768 * 1024; - ret = AllocFromAGP(ctx, pI830, size, align, &pI830->TexMem); - if (ret < size) - { - fprintf(stderr,"unable to allocate texture memory %ld\n", ret); - return FALSE; - } -#endif - - return TRUE; -} - -static Bool -I830BindMemory(const DRIDriverContext *ctx, I830Rec *pI830) -{ - if (!BindAgpRange(ctx, &pI830->LpRing->mem)) - return FALSE; - if (!BindAgpRange(ctx, &pI830->FrontBuffer)) - return FALSE; - if (!BindAgpRange(ctx, &pI830->BackBuffer)) - return FALSE; - if (!BindAgpRange(ctx, &pI830->DepthBuffer)) - return FALSE; - if (!BindAgpRange(ctx, &pI830->ContextMem)) - return FALSE; -#if 0 - if (!BindAgpRange(ctx, &pI830->TexMem)) - return FALSE; -#endif - return TRUE; -} - -static void SetupDRIMM(const DRIDriverContext *ctx, I830Rec *pI830) -{ - unsigned long aperEnd = ROUND_DOWN_TO(pI830->aper_size, GTT_PAGE_SIZE) / GTT_PAGE_SIZE; - unsigned long aperStart = ROUND_TO(pI830->aper_size - KB(32768), GTT_PAGE_SIZE) / GTT_PAGE_SIZE; - - fprintf(stderr, "aper size is %08X\n", ctx->shared.fbSize); - if (drmMMInit(ctx->drmFD, aperStart, aperEnd - aperStart, DRM_BO_MEM_TT)) { - fprintf(stderr, - "DRM MM Initialization Failed\n"); - } else { - fprintf(stderr, - "DRM MM Initialized at offset 0x%lx length %d page\n", aperStart, aperEnd-aperStart); - } - -} - -static Bool -I830CleanupDma(const DRIDriverContext *ctx) -{ - drmI830Init info; - - memset(&info, 0, sizeof(drmI830Init)); - info.func = I830_CLEANUP_DMA; - - if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT, - &info, sizeof(drmI830Init))) { - fprintf(stderr, "I830 Dma Cleanup Failed\n"); - return FALSE; - } - - return TRUE; -} - -static Bool -I830InitDma(const DRIDriverContext *ctx, I830Rec *pI830) -{ - I830RingBuffer *ring = pI830->LpRing; - drmI830Init info; - - memset(&info, 0, sizeof(drmI830Init)); - info.func = I830_INIT_DMA; - - info.ring_start = ring->mem.Start + pI830->LinearAddr; - info.ring_end = ring->mem.End + pI830->LinearAddr; - info.ring_size = ring->mem.Size; - - info.mmio_offset = (unsigned int)ctx->MMIOStart; - - info.sarea_priv_offset = sizeof(drm_sarea_t); - - info.front_offset = pI830->FrontBuffer.Start; - info.back_offset = pI830->BackBuffer.Start; - info.depth_offset = pI830->DepthBuffer.Start; - info.w = ctx->shared.virtualWidth; - info.h = ctx->shared.virtualHeight; - info.pitch = ctx->shared.virtualWidth; - info.back_pitch = pI830->BackBuffer.Pitch; - info.depth_pitch = pI830->DepthBuffer.Pitch; - info.cpp = ctx->cpp; - - if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT, - &info, sizeof(drmI830Init))) { - fprintf(stderr, - "I830 Dma Initialization Failed\n"); - return FALSE; - } - - return TRUE; -} - -static int I830CheckDRMVersion( const DRIDriverContext *ctx, - I830Rec *pI830 ) -{ - drmVersionPtr version; - - version = drmGetVersion(ctx->drmFD); - - if (version) { - int req_minor, req_patch; - - req_minor = 4; - req_patch = 0; - - if (version->version_major != 1 || - version->version_minor < req_minor || - (version->version_minor == req_minor && - version->version_patchlevel < req_patch)) { - /* Incompatible drm version */ - fprintf(stderr, - "[dri] I830DRIScreenInit failed because of a version " - "mismatch.\n" - "[dri] i915.o kernel module version is %d.%d.%d " - "but version 1.%d.%d or newer is needed.\n" - "[dri] Disabling DRI.\n", - version->version_major, - version->version_minor, - version->version_patchlevel, - req_minor, - req_patch); - drmFreeVersion(version); - return 0; - } - - pI830->drmMinor = version->version_minor; - drmFreeVersion(version); - } - return 1; -} - -static void -I830SetRingRegs(const DRIDriverContext *ctx, I830Rec *pI830) -{ - unsigned int itemp; - unsigned char *MMIO = ctx->MMIOAddress; - - OUTREG(LP_RING + RING_LEN, 0); - OUTREG(LP_RING + RING_TAIL, 0); - OUTREG(LP_RING + RING_HEAD, 0); - - if ((long)(pI830->LpRing->mem.Start & I830_RING_START_MASK) != - pI830->LpRing->mem.Start) { - fprintf(stderr, - "I830SetRingRegs: Ring buffer start (%lx) violates its " - "mask (%x)\n", pI830->LpRing->mem.Start, I830_RING_START_MASK); - } - /* Don't care about the old value. Reserved bits must be zero anyway. */ - itemp = pI830->LpRing->mem.Start & I830_RING_START_MASK; - OUTREG(LP_RING + RING_START, itemp); - - if (((pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES) != - pI830->LpRing->mem.Size - 4096) { - fprintf(stderr, - "I830SetRingRegs: Ring buffer size - 4096 (%lx) violates its " - "mask (%x)\n", pI830->LpRing->mem.Size - 4096, - I830_RING_NR_PAGES); - } - /* Don't care about the old value. Reserved bits must be zero anyway. */ - itemp = (pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES; - itemp |= (RING_NO_REPORT | RING_VALID); - OUTREG(LP_RING + RING_LEN, itemp); - - pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; - pI830->LpRing->tail = INREG(LP_RING + RING_TAIL); - pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8); - if (pI830->LpRing->space < 0) - pI830->LpRing->space += pI830->LpRing->mem.Size; - - SetFenceRegs(ctx, pI830); - - /* RESET THE DISPLAY PIPE TO POINT TO THE FRONTBUFFER - hacky - hacky hacky */ - OUTREG(DSPABASE, pI830->FrontBuffer.Start + pI830->LinearAddr); - -} - -static Bool -I830SetParam(const DRIDriverContext *ctx, int param, int value) -{ - drmI830SetParam sp; - - memset(&sp, 0, sizeof(sp)); - sp.param = param; - sp.value = value; - - if (drmCommandWrite(ctx->drmFD, DRM_I830_SETPARAM, &sp, sizeof(sp))) { - fprintf(stderr, "I830 SetParam Failed\n"); - return FALSE; - } - - return TRUE; -} - -static Bool -I830DRIMapScreenRegions(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) -{ - fprintf(stderr, - "[drm] Mapping front buffer\n"); - - if (drmAddMap(ctx->drmFD, - (drm_handle_t)(sarea->front_offset + pI830->LinearAddr), - sarea->front_size, - DRM_FRAME_BUFFER, /*DRM_AGP,*/ - 0, - &sarea->front_handle) < 0) { - fprintf(stderr, - "[drm] drmAddMap(front_handle) failed. Disabling DRI\n"); - return FALSE; - } - ctx->shared.hFrameBuffer = sarea->front_handle; - ctx->shared.fbSize = sarea->front_size; - fprintf(stderr, "[drm] Front Buffer = 0x%08x\n", - sarea->front_handle); - - if (drmAddMap(ctx->drmFD, - (drm_handle_t)(sarea->back_offset), - sarea->back_size, DRM_AGP, 0, - &sarea->back_handle) < 0) { - fprintf(stderr, - "[drm] drmAddMap(back_handle) failed. Disabling DRI\n"); - return FALSE; - } - fprintf(stderr, "[drm] Back Buffer = 0x%08x\n", - sarea->back_handle); - - if (drmAddMap(ctx->drmFD, - (drm_handle_t)sarea->depth_offset, - sarea->depth_size, DRM_AGP, 0, - &sarea->depth_handle) < 0) { - fprintf(stderr, - "[drm] drmAddMap(depth_handle) failed. Disabling DRI\n"); - return FALSE; - } - fprintf(stderr, "[drm] Depth Buffer = 0x%08x\n", - sarea->depth_handle); - -#if 0 - if (drmAddMap(ctx->drmFD, - (drm_handle_t)sarea->tex_offset, - sarea->tex_size, DRM_AGP, 0, - &sarea->tex_handle) < 0) { - fprintf(stderr, - "[drm] drmAddMap(tex_handle) failed. Disabling DRI\n"); - return FALSE; - } - fprintf(stderr, "[drm] textures = 0x%08x\n", - sarea->tex_handle); -#endif - return TRUE; -} - - -static void -I830DRIUnmapScreenRegions(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) -{ -#if 1 - if (sarea->front_handle) { - drmRmMap(ctx->drmFD, sarea->front_handle); - sarea->front_handle = 0; - } -#endif - if (sarea->back_handle) { - drmRmMap(ctx->drmFD, sarea->back_handle); - sarea->back_handle = 0; - } - if (sarea->depth_handle) { - drmRmMap(ctx->drmFD, sarea->depth_handle); - sarea->depth_handle = 0; - } - if (sarea->tex_handle) { - drmRmMap(ctx->drmFD, sarea->tex_handle); - sarea->tex_handle = 0; - } -} - -static Bool -I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) -{ - if (drmAddMap(ctx->drmFD, - (drm_handle_t)pI830->LpRing->mem.Start, - pI830->LpRing->mem.Size, DRM_AGP, 0, - &pI830->ring_map) < 0) { - fprintf(stderr, - "[drm] drmAddMap(ring_map) failed. Disabling DRI\n"); - return FALSE; - } - fprintf(stderr, "[drm] ring buffer = 0x%08x\n", - pI830->ring_map); - - if (I830InitDma(ctx, pI830) == FALSE) { - return FALSE; - } - - /* init to zero to be safe */ - - I830DRIMapScreenRegions(ctx, pI830, sarea); - SetupDRIMM(ctx, pI830); - - if (ctx->pciDevice != PCI_CHIP_845_G && - ctx->pciDevice != PCI_CHIP_I830_M) { - I830SetParam(ctx, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 ); - } - - /* Okay now initialize the dma engine */ - { - pI830->irq = drmGetInterruptFromBusID(ctx->drmFD, - ctx->pciBus, - ctx->pciDevice, - ctx->pciFunc); - - if (drmCtlInstHandler(ctx->drmFD, pI830->irq)) { - fprintf(stderr, - "[drm] failure adding irq handler\n"); - pI830->irq = 0; - return FALSE; - } - else - fprintf(stderr, - "[drm] dma control initialized, using IRQ %d\n", - pI830->irq); - } - - fprintf(stderr, "[dri] visual configs initialized\n"); - - return TRUE; -} - -static Bool -I830ClearScreen(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) -{ - /* need to drmMap front and back buffers and zero them */ - drmAddress map_addr; - int ret; - - ret = drmMap(ctx->drmFD, - sarea->front_handle, - sarea->front_size, - &map_addr); - - if (ret) - { - fprintf(stderr, "Unable to map front buffer\n"); - return FALSE; - } - - drimemsetio((char *)map_addr, - 0, - sarea->front_size); - drmUnmap(map_addr, sarea->front_size); - - - ret = drmMap(ctx->drmFD, - sarea->back_handle, - sarea->back_size, - &map_addr); - - if (ret) - { - fprintf(stderr, "Unable to map back buffer\n"); - return FALSE; - } - - drimemsetio((char *)map_addr, - 0, - sarea->back_size); - drmUnmap(map_addr, sarea->back_size); - - return TRUE; -} - -static Bool -I830ScreenInit(DRIDriverContext *ctx, I830Rec *pI830) - -{ - I830DRIPtr pI830DRI; - drmI830Sarea *pSAREAPriv; - int err; - - drm_page_size = getpagesize(); - - pI830->registerSize = ctx->MMIOSize; - /* This is a hack for now. We have to have more than a 4k page here - * because of the size of the state. However, the state should be - * in a per-context mapping. This will be added in the Mesa 3.5 port - * of the I830 driver. - */ - ctx->shared.SAREASize = SAREA_MAX; - - /* Note that drmOpen will try to load the kernel module, if needed. */ - ctx->drmFD = drmOpen("i915", NULL ); - if (ctx->drmFD < 0) { - fprintf(stderr, "[drm] drmOpen failed\n"); - return 0; - } - - if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) { - fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n", - ctx->drmFD, ctx->pciBusID, strerror(-err)); - return 0; - } - - if (drmAddMap( ctx->drmFD, - 0, - ctx->shared.SAREASize, - DRM_SHM, - DRM_CONTAINS_LOCK, - &ctx->shared.hSAREA) < 0) - { - fprintf(stderr, "[drm] drmAddMap failed\n"); - return 0; - } - - fprintf(stderr, "[drm] added %d byte SAREA at 0x%08x\n", - ctx->shared.SAREASize, ctx->shared.hSAREA); - - if (drmMap( ctx->drmFD, - ctx->shared.hSAREA, - ctx->shared.SAREASize, - (drmAddressPtr)(&ctx->pSAREA)) < 0) - { - fprintf(stderr, "[drm] drmMap failed\n"); - return 0; - - } - - memset(ctx->pSAREA, 0, ctx->shared.SAREASize); - fprintf(stderr, "[drm] mapped SAREA 0x%08x to %p, size %d\n", - ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize); - - - if (drmAddMap(ctx->drmFD, - ctx->MMIOStart, - ctx->MMIOSize, - DRM_REGISTERS, - DRM_READ_ONLY, - &pI830->registerHandle) < 0) { - fprintf(stderr, "[drm] drmAddMap mmio failed\n"); - return 0; - } - fprintf(stderr, - "[drm] register handle = 0x%08x\n", pI830->registerHandle); - - - if (!I830CheckDRMVersion(ctx, pI830)) { - return FALSE; - } - - /* Create a 'server' context so we can grab the lock for - * initialization ioctls. - */ - if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) { - fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err); - return 0; - } - - DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0); - - /* Initialize the SAREA private data structure */ - pSAREAPriv = (drmI830Sarea *)(((char*)ctx->pSAREA) + - sizeof(drm_sarea_t)); - memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); - - pI830->StolenMemory.Size = I830DetectMemory(ctx, pI830); - pI830->StolenMemory.Start = 0; - pI830->StolenMemory.End = pI830->StolenMemory.Size; - - pI830->MemoryAperture.Start = pI830->StolenMemory.End; - pI830->MemoryAperture.End = KB(40000); - pI830->MemoryAperture.Size = pI830->MemoryAperture.End - pI830->MemoryAperture.Start; - - pI830->StolenPool.Fixed = pI830->StolenMemory; - pI830->StolenPool.Total = pI830->StolenMemory; - pI830->StolenPool.Free = pI830->StolenPool.Total; - pI830->FreeMemory = pI830->StolenPool.Total.Size; - - if (!AgpInit(ctx, pI830)) - return FALSE; - - if (I830AllocateMemory(ctx, pI830) == FALSE) - { - return FALSE; - } - - if (I830BindMemory(ctx, pI830) == FALSE) - { - return FALSE; - } - - pSAREAPriv->rotated_offset = -1; - pSAREAPriv->rotated_size = 0; - pSAREAPriv->rotated_pitch = ctx->shared.virtualWidth; - - pSAREAPriv->front_offset = pI830->FrontBuffer.Start; - pSAREAPriv->front_size = pI830->FrontBuffer.Size; - pSAREAPriv->width = ctx->shared.virtualWidth; - pSAREAPriv->height = ctx->shared.virtualHeight; - pSAREAPriv->pitch = ctx->shared.virtualWidth; - pSAREAPriv->virtualX = ctx->shared.virtualWidth; - pSAREAPriv->virtualY = ctx->shared.virtualHeight; - pSAREAPriv->back_offset = pI830->BackBuffer.Start; - pSAREAPriv->back_size = pI830->BackBuffer.Size; - pSAREAPriv->depth_offset = pI830->DepthBuffer.Start; - pSAREAPriv->depth_size = pI830->DepthBuffer.Size; -#if 0 - pSAREAPriv->tex_offset = pI830->TexMem.Start; - pSAREAPriv->tex_size = pI830->TexMem.Size; -#endif - pSAREAPriv->log_tex_granularity = pI830->TexGranularity; - - ctx->driverClientMsg = malloc(sizeof(I830DRIRec)); - ctx->driverClientMsgSize = sizeof(I830DRIRec); - pI830DRI = (I830DRIPtr)ctx->driverClientMsg; - pI830DRI->deviceID = pI830->Chipset; - pI830DRI->regsSize = I830_REG_SIZE; - pI830DRI->width = ctx->shared.virtualWidth; - pI830DRI->height = ctx->shared.virtualHeight; - pI830DRI->mem = ctx->shared.fbSize; - pI830DRI->cpp = ctx->cpp; - - pI830DRI->bitsPerPixel = ctx->bpp; - pI830DRI->sarea_priv_offset = sizeof(drm_sarea_t); - - err = I830DRIDoMappings(ctx, pI830, pSAREAPriv); - if (err == FALSE) - return FALSE; - - I830SetupMemoryTiling(ctx, pI830); - - /* Quick hack to clear the front & back buffers. Could also use - * the clear ioctl to do this, but would need to setup hw state - * first. - */ - I830ClearScreen(ctx, pI830, pSAREAPriv); - - I830SetRingRegs(ctx, pI830); - - return TRUE; -} - - -/** - * \brief Validate the fbdev mode. - * - * \param ctx display handle. - * - * \return one on success, or zero on failure. - * - * Saves some registers and returns 1. - * - * \sa radeonValidateMode(). - */ -static int i830ValidateMode( const DRIDriverContext *ctx ) -{ - return 1; -} - -/** - * \brief Examine mode returned by fbdev. - * - * \param ctx display handle. - * - * \return one on success, or zero on failure. - * - * Restores registers that fbdev has clobbered and returns 1. - * - * \sa i810ValidateMode(). - */ -static int i830PostValidateMode( const DRIDriverContext *ctx ) -{ - I830Rec *pI830 = ctx->driverPrivate; - - I830SetRingRegs(ctx, pI830); - return 1; -} - - -/** - * \brief Initialize the framebuffer device mode - * - * \param ctx display handle. - * - * \return one on success, or zero on failure. - * - * Fills in \p info with some default values and some information from \p ctx - * and then calls I810ScreenInit() for the screen initialization. - * - * Before exiting clears the framebuffer memory accessing it directly. - */ -static int i830InitFBDev( DRIDriverContext *ctx ) -{ - I830Rec *pI830 = calloc(1, sizeof(I830Rec)); - int i; - - { - int dummy = ctx->shared.virtualWidth; - - switch (ctx->bpp / 8) { - case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break; - case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break; - case 3: - case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break; - } - - ctx->shared.virtualWidth = dummy; - ctx->shared.Width = ctx->shared.virtualWidth; - } - - - for (i = 0; pitches[i] != 0; i++) { - if (pitches[i] >= ctx->shared.virtualWidth) { - ctx->shared.virtualWidth = pitches[i]; - break; - } - } - - ctx->driverPrivate = (void *)pI830; - - pI830->LpRing = calloc(1, sizeof(I830RingBuffer)); - pI830->Chipset = ctx->chipset; - pI830->LinearAddr = ctx->FBStart; - - if (!I830ScreenInit( ctx, pI830 )) - return 0; - - - return 1; -} - - -/** - * \brief The screen is being closed, so clean up any state and free any - * resources used by the DRI. - * - * \param ctx display handle. - * - * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver - * private data. - */ -static void i830HaltFBDev( DRIDriverContext *ctx ) -{ - drmI830Sarea *pSAREAPriv; - I830Rec *pI830 = ctx->driverPrivate; - - if (pI830->irq) { - drmCtlUninstHandler(ctx->drmFD); - pI830->irq = 0; } - - I830CleanupDma(ctx); - - pSAREAPriv = (drmI830Sarea *)(((char*)ctx->pSAREA) + - sizeof(drm_sarea_t)); - - I830DRIUnmapScreenRegions(ctx, pI830, pSAREAPriv); - drmUnmap( ctx->pSAREA, ctx->shared.SAREASize ); - drmClose(ctx->drmFD); - - if (ctx->driverPrivate) { - free(ctx->driverPrivate); - ctx->driverPrivate = 0; - } -} - - -extern void i810NotifyFocus( int ); - -/** - * \brief Exported driver interface for Mini GLX. - * - * \sa DRIDriverRec. - */ -const struct DRIDriverRec __driDriver = { - i830ValidateMode, - i830PostValidateMode, - i830InitFBDev, - i830HaltFBDev, - NULL,//I830EngineShutdown, - NULL, //I830EngineRestore, -#ifndef _EMBEDDED - 0, -#else - i810NotifyFocus, -#endif -}; diff --git a/src/mesa/drivers/dri/i915/server/intel_dri.c b/src/mesa/drivers/dri/i915/server/intel_dri.c new file mode 120000 index 00000000000..a2043afb47a --- /dev/null +++ b/src/mesa/drivers/dri/i915/server/intel_dri.c @@ -0,0 +1 @@ +../intel/server/intel_dri.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 7e07bc9c1a5..73cc9667c64 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -76,12 +76,6 @@ DRIVER_SOURCES = \ brw_wm_state.c \ brw_wm_surface_state.c -SYMLINKS = \ - server/i830_dri.h \ - server/i830_common.h \ - server/intel_dri.c \ - server/intel.h - C_SOURCES = \ $(COMMON_SOURCES) \ $(MINIGLX_SOURCES) \ @@ -89,17 +83,10 @@ C_SOURCES = \ ASM_SOURCES = -DRIVER_DEFINES = -I../intel +DRIVER_DEFINES = -I../intel -I../intel/server include ../Makefile.template +symlinks: intel_decode.o: ../intel/intel_decode.c intel_tex_layout.o: ../intel/intel_tex_layout.c - -server: - mkdir -p server - -$(SYMLINKS): server - @[ -e $@ ] || ln -sf ../../i915/$@ server/ - -symlinks: $(SYMLINKS) diff --git a/src/mesa/drivers/dri/i965/server/intel_dri.c b/src/mesa/drivers/dri/i965/server/intel_dri.c new file mode 120000 index 00000000000..a2043afb47a --- /dev/null +++ b/src/mesa/drivers/dri/i965/server/intel_dri.c @@ -0,0 +1 @@ +../intel/server/intel_dri.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/intel/server/i830_common.h b/src/mesa/drivers/dri/intel/server/i830_common.h new file mode 100644 index 00000000000..f1fd3939ab9 --- /dev/null +++ b/src/mesa/drivers/dri/intel/server/i830_common.h @@ -0,0 +1,256 @@ +/************************************************************************** + +Copyright 2001 VA Linux Systems Inc., Fremont, California. +Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas. + +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +on the rights to use, copy, modify, merge, publish, distribute, sub +license, and/or sell copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_common.h,v 1.1 2002/09/11 00:29:32 dawes Exp $ */ + +#ifndef _I830_COMMON_H_ +#define _I830_COMMON_H_ + + +#define I830_NR_TEX_REGIONS 255 /* maximum due to use of chars for next/prev */ +#define I830_LOG_MIN_TEX_REGION_SIZE 14 + + +/* Driver specific DRM command indices + * NOTE: these are not OS specific, but they are driver specific + */ +#define DRM_I830_INIT 0x00 +#define DRM_I830_FLUSH 0x01 +#define DRM_I830_FLIP 0x02 +#define DRM_I830_BATCHBUFFER 0x03 +#define DRM_I830_IRQ_EMIT 0x04 +#define DRM_I830_IRQ_WAIT 0x05 +#define DRM_I830_GETPARAM 0x06 +#define DRM_I830_SETPARAM 0x07 +#define DRM_I830_ALLOC 0x08 +#define DRM_I830_FREE 0x09 +#define DRM_I830_INIT_HEAP 0x0a +#define DRM_I830_CMDBUFFER 0x0b +#define DRM_I830_DESTROY_HEAP 0x0c +#define DRM_I830_SET_VBLANK_PIPE 0x0d +#define DRM_I830_GET_VBLANK_PIPE 0x0e +#define DRM_I830_MMIO 0x10 + +typedef struct { + enum { + I830_INIT_DMA = 0x01, + I830_CLEANUP_DMA = 0x02, + I830_RESUME_DMA = 0x03 + } func; + unsigned int mmio_offset; + int sarea_priv_offset; + unsigned int ring_start; + unsigned int ring_end; + unsigned int ring_size; + unsigned int front_offset; + unsigned int back_offset; + unsigned int depth_offset; + unsigned int w; + unsigned int h; + unsigned int pitch; + unsigned int pitch_bits; + unsigned int back_pitch; + unsigned int depth_pitch; + unsigned int cpp; + unsigned int chipset; +} drmI830Init; + +typedef struct { + drmTextureRegion texList[I830_NR_TEX_REGIONS+1]; + int last_upload; /* last time texture was uploaded */ + int last_enqueue; /* last time a buffer was enqueued */ + int last_dispatch; /* age of the most recently dispatched buffer */ + int ctxOwner; /* last context to upload state */ + /** Last context that used the buffer manager. */ + int texAge; + int pf_enabled; /* is pageflipping allowed? */ + int pf_active; + int pf_current_page; /* which buffer is being displayed? */ + int perf_boxes; /* performance boxes to be displayed */ + int width, height; /* screen size in pixels */ + + drm_handle_t front_handle; + int front_offset; + int front_size; + + drm_handle_t back_handle; + int back_offset; + int back_size; + + drm_handle_t depth_handle; + int depth_offset; + int depth_size; + + drm_handle_t tex_handle; + int tex_offset; + int tex_size; + int log_tex_granularity; + int pitch; + int rotation; /* 0, 90, 180 or 270 */ + int rotated_offset; + int rotated_size; + int rotated_pitch; + int virtualX, virtualY; + + unsigned int front_tiled; + unsigned int back_tiled; + unsigned int depth_tiled; + unsigned int rotated_tiled; + unsigned int rotated2_tiled; + + int planeA_x; + int planeA_y; + int planeA_w; + int planeA_h; + int planeB_x; + int planeB_y; + int planeB_w; + int planeB_h; + + /* Triple buffering */ + drm_handle_t third_handle; + int third_offset; + int third_size; + unsigned int third_tiled; + + /* buffer object handles for the static buffers. May change + * over the lifetime of the client, though it doesn't in our current + * implementation. + */ + unsigned int front_bo_handle; + unsigned int back_bo_handle; + unsigned int third_bo_handle; + unsigned int depth_bo_handle; +} drmI830Sarea; + +/* Flags for perf_boxes + */ +#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */ +#define I830_BOX_FLIP 0x2 /* populated by kernel */ +#define I830_BOX_WAIT 0x4 /* populated by kernel & client */ +#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */ +#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */ + + +typedef struct { + int start; /* agp offset */ + int used; /* nr bytes in use */ + int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ + int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/ + int num_cliprects; /* mulitpass with multiple cliprects? */ + drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */ +} drmI830BatchBuffer; + +typedef struct { + char *buf; /* agp offset */ + int sz; /* nr bytes in use */ + int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ + int DR4; /* window origin for GFX_OP_DRAWRECT_INFO*/ + int num_cliprects; /* mulitpass with multiple cliprects? */ + drm_clip_rect_t *cliprects; /* pointer to userspace cliprects */ +} drmI830CmdBuffer; + +typedef struct { + int *irq_seq; +} drmI830IrqEmit; + +typedef struct { + int irq_seq; +} drmI830IrqWait; + +typedef struct { + int param; + int *value; +} drmI830GetParam; + +#define I830_PARAM_IRQ_ACTIVE 1 +#define I830_PARAM_ALLOW_BATCHBUFFER 2 + +typedef struct { + int param; + int value; +} drmI830SetParam; + +#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1 +#define I830_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 +#define I830_SETPARAM_ALLOW_BATCHBUFFER 3 + + +/* A memory manager for regions of shared memory: + */ +#define I830_MEM_REGION_AGP 1 + +typedef struct { + int region; + int alignment; + int size; + int *region_offset; /* offset from start of fb or agp */ +} drmI830MemAlloc; + +typedef struct { + int region; + int region_offset; +} drmI830MemFree; + +typedef struct { + int region; + int size; + int start; +} drmI830MemInitHeap; + +typedef struct { + int region; +} drmI830MemDestroyHeap; + +#define DRM_I830_VBLANK_PIPE_A 1 +#define DRM_I830_VBLANK_PIPE_B 2 + +typedef struct { + int pipe; +} drmI830VBlankPipe; + +#define MMIO_READ 0 +#define MMIO_WRITE 1 + +#define MMIO_REGS_IA_PRIMATIVES_COUNT 0 +#define MMIO_REGS_IA_VERTICES_COUNT 1 +#define MMIO_REGS_VS_INVOCATION_COUNT 2 +#define MMIO_REGS_GS_PRIMITIVES_COUNT 3 +#define MMIO_REGS_GS_INVOCATION_COUNT 4 +#define MMIO_REGS_CL_PRIMITIVES_COUNT 5 +#define MMIO_REGS_CL_INVOCATION_COUNT 6 +#define MMIO_REGS_PS_INVOCATION_COUNT 7 +#define MMIO_REGS_PS_DEPTH_COUNT 8 + +typedef struct { + unsigned int read_write:1; + unsigned int reg:31; + void __user *data; +} drmI830MMIO; + +#endif /* _I830_DRM_H_ */ diff --git a/src/mesa/drivers/dri/intel/server/i830_dri.h b/src/mesa/drivers/dri/intel/server/i830_dri.h new file mode 100644 index 00000000000..c2a3af8cbf7 --- /dev/null +++ b/src/mesa/drivers/dri/intel/server/i830_dri.h @@ -0,0 +1,63 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_dri.h,v 1.4 2002/10/30 12:52:18 alanh Exp $ */ + +#ifndef _I830_DRI_H +#define _I830_DRI_H + +#include "xf86drm.h" +#include "i830_common.h" + +#define I830_MAX_DRAWABLES 256 + +#define I830_MAJOR_VERSION 1 +#define I830_MINOR_VERSION 7 +#define I830_PATCHLEVEL 2 + +#define I830_REG_SIZE 0x80000 + +typedef struct _I830DRIRec { + drm_handle_t regs; + drmSize regsSize; + + drmSize unused1; /* backbufferSize */ + drm_handle_t unused2; /* backbuffer */ + + drmSize unused3; /* depthbufferSize */ + drm_handle_t unused4; /* depthbuffer */ + + drmSize unused5; /* rotatedSize */ + drm_handle_t unused6; /* rotatedbuffer */ + + drm_handle_t unused7; /* textures */ + int unused8; /* textureSize */ + + drm_handle_t unused9; /* agp_buffers */ + drmSize unused10; /* agp_buf_size */ + + int deviceID; + int width; + int height; + int mem; + int cpp; + int bitsPerPixel; + + int unused11[8]; /* was front/back/depth/rotated offset/pitch */ + + int unused12; /* logTextureGranularity */ + int unused13; /* textureOffset */ + + int irq; + int sarea_priv_offset; +} I830DRIRec, *I830DRIPtr; + +typedef struct { + /* Nothing here yet */ + int dummy; +} I830ConfigPrivRec, *I830ConfigPrivPtr; + +typedef struct { + /* Nothing here yet */ + int dummy; +} I830DRIContextRec, *I830DRIContextPtr; + + +#endif diff --git a/src/mesa/drivers/dri/intel/server/intel.h b/src/mesa/drivers/dri/intel/server/intel.h new file mode 100644 index 00000000000..6ea72499c1c --- /dev/null +++ b/src/mesa/drivers/dri/intel/server/intel.h @@ -0,0 +1,331 @@ +#ifndef _INTEL_H_ +#define _INTEL_H_ + +#include "xf86drm.h" /* drm_handle_t, etc */ + +/* Intel */ +#ifndef PCI_CHIP_I810 +#define PCI_CHIP_I810 0x7121 +#define PCI_CHIP_I810_DC100 0x7123 +#define PCI_CHIP_I810_E 0x7125 +#define PCI_CHIP_I815 0x1132 +#define PCI_CHIP_I810_BRIDGE 0x7120 +#define PCI_CHIP_I810_DC100_BRIDGE 0x7122 +#define PCI_CHIP_I810_E_BRIDGE 0x7124 +#define PCI_CHIP_I815_BRIDGE 0x1130 +#endif + +#define PCI_CHIP_845_G 0x2562 +#define PCI_CHIP_I830_M 0x3577 + +#ifndef PCI_CHIP_I855_GM +#define PCI_CHIP_I855_GM 0x3582 +#define PCI_CHIP_I855_GM_BRIDGE 0x3580 +#endif + +#ifndef PCI_CHIP_I865_G +#define PCI_CHIP_I865_G 0x2572 +#define PCI_CHIP_I865_G_BRIDGE 0x2570 +#endif + +#ifndef PCI_CHIP_I915_G +#define PCI_CHIP_I915_G 0x2582 +#define PCI_CHIP_I915_G_BRIDGE 0x2580 +#endif + +#ifndef PCI_CHIP_I915_GM +#define PCI_CHIP_I915_GM 0x2592 +#define PCI_CHIP_I915_GM_BRIDGE 0x2590 +#endif + +#ifndef PCI_CHIP_E7221_G +#define PCI_CHIP_E7221_G 0x258A +/* Same as I915_G_BRIDGE */ +#define PCI_CHIP_E7221_G_BRIDGE 0x2580 +#endif + +#ifndef PCI_CHIP_I945_G +#define PCI_CHIP_I945_G 0x2772 +#define PCI_CHIP_I945_G_BRIDGE 0x2770 +#endif + +#ifndef PCI_CHIP_I945_GM +#define PCI_CHIP_I945_GM 0x27A2 +#define PCI_CHIP_I945_GM_BRIDGE 0x27A0 +#endif + +#define IS_I810(pI810) (pI810->Chipset == PCI_CHIP_I810 || \ + pI810->Chipset == PCI_CHIP_I810_DC100 || \ + pI810->Chipset == PCI_CHIP_I810_E) +#define IS_I815(pI810) (pI810->Chipset == PCI_CHIP_I815) +#define IS_I830(pI810) (pI810->Chipset == PCI_CHIP_I830_M) +#define IS_845G(pI810) (pI810->Chipset == PCI_CHIP_845_G) +#define IS_I85X(pI810) (pI810->Chipset == PCI_CHIP_I855_GM) +#define IS_I852(pI810) (pI810->Chipset == PCI_CHIP_I855_GM && (pI810->variant == I852_GM || pI810->variant == I852_GME)) +#define IS_I855(pI810) (pI810->Chipset == PCI_CHIP_I855_GM && (pI810->variant == I855_GM || pI810->variant == I855_GME)) +#define IS_I865G(pI810) (pI810->Chipset == PCI_CHIP_I865_G) + +#define IS_I915G(pI810) (pI810->Chipset == PCI_CHIP_I915_G || pI810->Chipset == PCI_CHIP_E7221_G) +#define IS_I915GM(pI810) (pI810->Chipset == PCI_CHIP_I915_GM) +#define IS_I945G(pI810) (pI810->Chipset == PCI_CHIP_I945_G) +#define IS_I945GM(pI810) (pI810->Chipset == PCI_CHIP_I945_GM) +#define IS_I9XX(pI810) (IS_I915G(pI810) || IS_I915GM(pI810) || IS_I945G(pI810) || IS_I945GM(pI810)) + +#define IS_MOBILE(pI810) (IS_I830(pI810) || IS_I85X(pI810) || IS_I915GM(pI810) || IS_I945GM(pI810)) + +#define I830_GMCH_CTRL 0x52 + +#define I830_GMCH_MEM_MASK 0x1 +#define I830_GMCH_MEM_64M 0x1 +#define I830_GMCH_MEM_128M 0 + +#define I830_GMCH_GMS_MASK 0x70 +#define I830_GMCH_GMS_DISABLED 0x00 +#define I830_GMCH_GMS_LOCAL 0x10 +#define I830_GMCH_GMS_STOLEN_512 0x20 +#define I830_GMCH_GMS_STOLEN_1024 0x30 +#define I830_GMCH_GMS_STOLEN_8192 0x40 + +#define I855_GMCH_GMS_MASK (0x7 << 4) +#define I855_GMCH_GMS_DISABLED 0x00 +#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4) +#define I855_GMCH_GMS_STOLEN_4M (0x2 << 4) +#define I855_GMCH_GMS_STOLEN_8M (0x3 << 4) +#define I855_GMCH_GMS_STOLEN_16M (0x4 << 4) +#define I855_GMCH_GMS_STOLEN_32M (0x5 << 4) +#define I915G_GMCH_GMS_STOLEN_48M (0x6 << 4) +#define I915G_GMCH_GMS_STOLEN_64M (0x7 << 4) + +typedef unsigned char Bool; +#define TRUE 1 +#define FALSE 0 + +#define PIPE_NONE 0<<0 +#define PIPE_CRT 1<<0 +#define PIPE_TV 1<<1 +#define PIPE_DFP 1<<2 +#define PIPE_LFP 1<<3 +#define PIPE_CRT2 1<<4 +#define PIPE_TV2 1<<5 +#define PIPE_DFP2 1<<6 +#define PIPE_LFP2 1<<7 + +typedef struct _I830MemPool *I830MemPoolPtr; +typedef struct _I830MemRange *I830MemRangePtr; +typedef struct _I830MemRange { + long Start; + long End; + long Size; + unsigned long Physical; + unsigned long Offset; /* Offset of AGP-allocated portion */ + unsigned long Alignment; + drm_handle_t Key; + unsigned long Pitch; // add pitch + I830MemPoolPtr Pool; +} I830MemRange; + +typedef struct _I830MemPool { + I830MemRange Total; + I830MemRange Free; + I830MemRange Fixed; + I830MemRange Allocated; +} I830MemPool; + +typedef struct { + int tail_mask; + I830MemRange mem; + unsigned char *virtual_start; + int head; + int tail; + int space; +} I830RingBuffer; + +typedef struct _I830Rec { + unsigned char *MMIOBase; + unsigned char *FbBase; + int cpp; + uint32_t aper_size; + unsigned int bios_version; + + /* These are set in PreInit and never changed. */ + long FbMapSize; + long TotalVideoRam; + I830MemRange StolenMemory; /* pre-allocated memory */ + long BIOSMemorySize; /* min stolen pool size */ + int BIOSMemSizeLoc; + + /* These change according to what has been allocated. */ + long FreeMemory; + I830MemRange MemoryAperture; + I830MemPool StolenPool; + long allocatedMemory; + + /* Regions allocated either from the above pools, or from agpgart. */ + /* for single and dual head configurations */ + I830MemRange FrontBuffer; + I830MemRange FrontBuffer2; + I830MemRange Scratch; + I830MemRange Scratch2; + + I830RingBuffer *LpRing; + + I830MemRange BackBuffer; + I830MemRange DepthBuffer; + I830MemRange TexMem; + int TexGranularity; + I830MemRange ContextMem; + int drmMinor; + Bool have3DWindows; + + Bool NeedRingBufferLow; + Bool allowPageFlip; + Bool disableTiling; + + int Chipset; + unsigned long LinearAddr; + unsigned long MMIOAddr; + + drmSize registerSize; /**< \brief MMIO register map size */ + drm_handle_t registerHandle; /**< \brief MMIO register map handle */ + // IOADDRESS ioBase; + int irq; /**< \brief IRQ number */ + int GttBound; + + drm_handle_t ring_map; + unsigned int Fence[8]; + +} I830Rec; + +/* + * 12288 is set as the maximum, chosen because it is enough for + * 1920x1440@32bpp with a 2048 pixel line pitch with some to spare. + */ +#define I830_MAXIMUM_VBIOS_MEM 12288 +#define I830_DEFAULT_VIDEOMEM_2D (MB(32) / 1024) +#define I830_DEFAULT_VIDEOMEM_3D (MB(64) / 1024) + +/* Flags for memory allocation function */ +#define FROM_ANYWHERE 0x00000000 +#define FROM_POOL_ONLY 0x00000001 +#define FROM_NEW_ONLY 0x00000002 +#define FROM_MASK 0x0000000f + +#define ALLOCATE_AT_TOP 0x00000010 +#define ALLOCATE_AT_BOTTOM 0x00000020 +#define FORCE_GAPS 0x00000040 + +#define NEED_PHYSICAL_ADDR 0x00000100 +#define ALIGN_BOTH_ENDS 0x00000200 +#define FORCE_LOW 0x00000400 + +#define ALLOC_NO_TILING 0x00001000 +#define ALLOC_INITIAL 0x00002000 + +#define ALLOCATE_DRY_RUN 0x80000000 + +/* Chipset registers for VIDEO BIOS memory RW access */ +#define _855_DRAM_RW_CONTROL 0x58 +#define _845_DRAM_RW_CONTROL 0x90 +#define DRAM_WRITE 0x33330000 + +#define KB(x) ((x) * 1024) +#define MB(x) ((x) * KB(1024)) + +#define GTT_PAGE_SIZE KB(4) +#define ROUND_TO(x, y) (((x) + (y) - 1) / (y) * (y)) +#define ROUND_DOWN_TO(x, y) ((x) / (y) * (y)) +#define ROUND_TO_PAGE(x) ROUND_TO((x), GTT_PAGE_SIZE) +#define ROUND_TO_MB(x) ROUND_TO((x), MB(1)) +#define PRIMARY_RINGBUFFER_SIZE KB(128) + + +/* Ring buffer registers, p277, overview p19 + */ +#define LP_RING 0x2030 +#define HP_RING 0x2040 + +#define RING_TAIL 0x00 +#define TAIL_ADDR 0x000FFFF8 +#define I830_TAIL_MASK 0x001FFFF8 + +#define RING_HEAD 0x04 +#define HEAD_WRAP_COUNT 0xFFE00000 +#define HEAD_WRAP_ONE 0x00200000 +#define HEAD_ADDR 0x001FFFFC +#define I830_HEAD_MASK 0x001FFFFC + +#define RING_START 0x08 +#define START_ADDR 0x03FFFFF8 +#define I830_RING_START_MASK 0xFFFFF000 + +#define RING_LEN 0x0C +#define RING_NR_PAGES 0x001FF000 +#define I830_RING_NR_PAGES 0x001FF000 +#define RING_REPORT_MASK 0x00000006 +#define RING_REPORT_64K 0x00000002 +#define RING_REPORT_128K 0x00000004 +#define RING_NO_REPORT 0x00000000 +#define RING_VALID_MASK 0x00000001 +#define RING_VALID 0x00000001 +#define RING_INVALID 0x00000000 + + +/* Fence/Tiling ranges [0..7] + */ +#define FENCE 0x2000 +#define FENCE_NR 8 + +#define I915G_FENCE_START_MASK 0x0ff00000 + +#define I830_FENCE_START_MASK 0x07f80000 + +#define FENCE_START_MASK 0x03F80000 +#define FENCE_X_MAJOR 0x00000000 +#define FENCE_Y_MAJOR 0x00001000 +#define FENCE_SIZE_MASK 0x00000700 +#define FENCE_SIZE_512K 0x00000000 +#define FENCE_SIZE_1M 0x00000100 +#define FENCE_SIZE_2M 0x00000200 +#define FENCE_SIZE_4M 0x00000300 +#define FENCE_SIZE_8M 0x00000400 +#define FENCE_SIZE_16M 0x00000500 +#define FENCE_SIZE_32M 0x00000600 +#define FENCE_SIZE_64M 0x00000700 +#define I915G_FENCE_SIZE_1M 0x00000000 +#define I915G_FENCE_SIZE_2M 0x00000100 +#define I915G_FENCE_SIZE_4M 0x00000200 +#define I915G_FENCE_SIZE_8M 0x00000300 +#define I915G_FENCE_SIZE_16M 0x00000400 +#define I915G_FENCE_SIZE_32M 0x00000500 +#define I915G_FENCE_SIZE_64M 0x00000600 +#define I915G_FENCE_SIZE_128M 0x00000700 +#define FENCE_PITCH_1 0x00000000 +#define FENCE_PITCH_2 0x00000010 +#define FENCE_PITCH_4 0x00000020 +#define FENCE_PITCH_8 0x00000030 +#define FENCE_PITCH_16 0x00000040 +#define FENCE_PITCH_32 0x00000050 +#define FENCE_PITCH_64 0x00000060 +#define FENCE_VALID 0x00000001 + +#include + +# define MMIO_IN8(base, offset) \ + *(volatile unsigned char *)(((unsigned char*)(base)) + (offset)) +# define MMIO_IN32(base, offset) \ + read_MMIO_LE32(base, offset) +# define MMIO_OUT8(base, offset, val) \ + *(volatile unsigned char *)(((unsigned char*)(base)) + (offset)) = (val) +# define MMIO_OUT32(base, offset, val) \ + *(volatile unsigned int *)(void *)(((unsigned char*)(base)) + (offset)) = CPU_TO_LE32(val) + + + /* Memory mapped register access macros */ +#define INREG8(addr) MMIO_IN8(MMIO, addr) +#define INREG(addr) MMIO_IN32(MMIO, addr) +#define OUTREG8(addr, val) MMIO_OUT8(MMIO, addr, val) +#define OUTREG(addr, val) MMIO_OUT32(MMIO, addr, val) + +#define DSPABASE 0x70184 + +#endif diff --git a/src/mesa/drivers/dri/intel/server/intel_dri.c b/src/mesa/drivers/dri/intel/server/intel_dri.c new file mode 100644 index 00000000000..e49c4214ad4 --- /dev/null +++ b/src/mesa/drivers/dri/intel/server/intel_dri.c @@ -0,0 +1,1306 @@ +/** + * \file server/intel_dri.c + * \brief File to perform the device-specific initialization tasks typically + * done in the X server. + * + * Here they are converted to run in the client (or perhaps a standalone + * process), and to work with the frame buffer device rather than the X + * server infrastructure. + * + * Copyright (C) 2006 Dave Airlie (airlied@linux.ie) + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sub license, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial portions + of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR + ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include +#include +#include +#include +#include + +#include "driver.h" +#include "drm.h" + +#include "intel.h" +#include "i830_dri.h" + +#include "memops.h" +#include "pciaccess.h" + +static size_t drm_page_size; +static int nextTile = 0; +#define xf86DrvMsg(...) do {} while(0) + +static const int pitches[] = { + 128 * 8, + 128 * 16, + 128 * 32, + 128 * 64, + 0 +}; + +static Bool I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea); + +static unsigned long +GetBestTileAlignment(unsigned long size) +{ + unsigned long i; + + for (i = KB(512); i < size; i <<= 1) + ; + + if (i > MB(64)) + i = MB(64); + + return i; +} + +static void SetFenceRegs(const DRIDriverContext *ctx, I830Rec *pI830) +{ + int i; + unsigned char *MMIO = ctx->MMIOAddress; + + for (i = 0; i < 8; i++) { + OUTREG(FENCE + i * 4, pI830->Fence[i]); + // if (I810_DEBUG & DEBUG_VERBOSE_VGA) + fprintf(stderr,"Fence Register : %x\n", pI830->Fence[i]); + } +} + +/* Tiled memory is good... really, really good... + * + * Need to make it less likely that we miss out on this - probably + * need to move the frontbuffer away from the 'guarenteed' alignment + * of the first memory segment, or perhaps allocate a discontigous + * framebuffer to get more alignment 'sweet spots'. + */ +static void +SetFence(const DRIDriverContext *ctx, I830Rec *pI830, + int nr, unsigned int start, unsigned int pitch, + unsigned int size) +{ + unsigned int val; + unsigned int fence_mask = 0; + unsigned int fence_pitch; + + if (nr < 0 || nr > 7) { + fprintf(stderr, + "SetFence: fence %d out of range\n",nr); + return; + } + + pI830->Fence[nr] = 0; + + if (IS_I9XX(pI830)) + fence_mask = ~I915G_FENCE_START_MASK; + else + fence_mask = ~I830_FENCE_START_MASK; + + if (start & fence_mask) { + fprintf(stderr, + "SetFence: %d: start (0x%08x) is not %s aligned\n", + nr, start, (IS_I9XX(pI830)) ? "1MB" : "512k"); + return; + } + + if (start % size) { + fprintf(stderr, + "SetFence: %d: start (0x%08x) is not size (%dk) aligned\n", + nr, start, size / 1024); + return; + } + + if (pitch & 127) { + fprintf(stderr, + "SetFence: %d: pitch (%d) not a multiple of 128 bytes\n", + nr, pitch); + return; + } + + val = (start | FENCE_X_MAJOR | FENCE_VALID); + + if (IS_I9XX(pI830)) { + switch (size) { + case MB(1): + val |= I915G_FENCE_SIZE_1M; + break; + case MB(2): + val |= I915G_FENCE_SIZE_2M; + break; + case MB(4): + val |= I915G_FENCE_SIZE_4M; + break; + case MB(8): + val |= I915G_FENCE_SIZE_8M; + break; + case MB(16): + val |= I915G_FENCE_SIZE_16M; + break; + case MB(32): + val |= I915G_FENCE_SIZE_32M; + break; + case MB(64): + val |= I915G_FENCE_SIZE_64M; + break; + default: + fprintf(stderr, + "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024); + return; + } + } else { + switch (size) { + case KB(512): + val |= FENCE_SIZE_512K; + break; + case MB(1): + val |= FENCE_SIZE_1M; + break; + case MB(2): + val |= FENCE_SIZE_2M; + break; + case MB(4): + val |= FENCE_SIZE_4M; + break; + case MB(8): + val |= FENCE_SIZE_8M; + break; + case MB(16): + val |= FENCE_SIZE_16M; + break; + case MB(32): + val |= FENCE_SIZE_32M; + break; + case MB(64): + val |= FENCE_SIZE_64M; + break; + default: + fprintf(stderr, + "SetFence: %d: illegal size (%d kByte)\n", nr, size / 1024); + return; + } + } + + if (IS_I9XX(pI830)) + fence_pitch = pitch / 512; + else + fence_pitch = pitch / 128; + + switch (fence_pitch) { + case 1: + val |= FENCE_PITCH_1; + break; + case 2: + val |= FENCE_PITCH_2; + break; + case 4: + val |= FENCE_PITCH_4; + break; + case 8: + val |= FENCE_PITCH_8; + break; + case 16: + val |= FENCE_PITCH_16; + break; + case 32: + val |= FENCE_PITCH_32; + break; + case 64: + val |= FENCE_PITCH_64; + break; + default: + fprintf(stderr, + "SetFence: %d: illegal pitch (%d)\n", nr, pitch); + return; + } + + pI830->Fence[nr] = val; +} + +static Bool +MakeTiles(const DRIDriverContext *ctx, I830Rec *pI830, I830MemRange *pMem) +{ + int pitch, ntiles, i; + + pitch = pMem->Pitch * ctx->cpp; + /* + * Simply try to break the region up into at most four pieces of size + * equal to the alignment. + */ + ntiles = ROUND_TO(pMem->Size, pMem->Alignment) / pMem->Alignment; + if (ntiles >= 4) { + return FALSE; + } + + for (i = 0; i < ntiles; i++, nextTile++) { + SetFence(ctx, pI830, nextTile, pMem->Start + i * pMem->Alignment, + pitch, pMem->Alignment); + } + return TRUE; +} + +static void I830SetupMemoryTiling(const DRIDriverContext *ctx, I830Rec *pI830) +{ + int i; + + /* Clear out */ + for (i = 0; i < 8; i++) + pI830->Fence[i] = 0; + + nextTile = 0; + + if (pI830->BackBuffer.Alignment >= KB(512)) { + if (MakeTiles(ctx, pI830, &(pI830->BackBuffer))) { + fprintf(stderr, + "Activating tiled memory for the back buffer.\n"); + } else { + fprintf(stderr, + "MakeTiles failed for the back buffer.\n"); + pI830->allowPageFlip = FALSE; + } + } + + if (pI830->DepthBuffer.Alignment >= KB(512)) { + if (MakeTiles(ctx, pI830, &(pI830->DepthBuffer))) { + fprintf(stderr, + "Activating tiled memory for the depth buffer.\n"); + } else { + fprintf(stderr, + "MakeTiles failed for the depth buffer.\n"); + } + } + + return; +} + +static int I830DetectMemory(const DRIDriverContext *ctx, I830Rec *pI830) +{ + struct pci_device host_bridge, ig_dev; + uint32_t gmch_ctrl; + int memsize = 0; + int range; + uint32_t aper_size; + uint32_t membase2 = 0; + + memset(&host_bridge, 0, sizeof(host_bridge)); + memset(&ig_dev, 0, sizeof(ig_dev)); + + ig_dev.dev = 2; + + pci_device_cfg_read_u32(&host_bridge, &gmch_ctrl, I830_GMCH_CTRL); + + if (IS_I830(pI830) || IS_845G(pI830)) { + if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) { + aper_size = 0x80000000; + } else { + aper_size = 0x40000000; + } + } else { + if (IS_I9XX(pI830)) { + int ret; + ret = pci_device_cfg_read_u32(&ig_dev, &membase2, 0x18); + if (membase2 & 0x08000000) + aper_size = 0x8000000; + else + aper_size = 0x10000000; + + fprintf(stderr,"aper size is %08X %08x %d\n", aper_size, membase2, ret); + } else + aper_size = 0x8000000; + } + + pI830->aper_size = aper_size; + + + /* We need to reduce the stolen size, by the GTT and the popup. + * The GTT varying according the the FbMapSize and the popup is 4KB */ + range = (ctx->shared.fbSize / (1024*1024)) + 4; + + if (IS_I85X(pI830) || IS_I865G(pI830) || IS_I9XX(pI830)) { + switch (gmch_ctrl & I830_GMCH_GMS_MASK) { + case I855_GMCH_GMS_STOLEN_1M: + memsize = MB(1) - KB(range); + break; + case I855_GMCH_GMS_STOLEN_4M: + memsize = MB(4) - KB(range); + break; + case I855_GMCH_GMS_STOLEN_8M: + memsize = MB(8) - KB(range); + break; + case I855_GMCH_GMS_STOLEN_16M: + memsize = MB(16) - KB(range); + break; + case I855_GMCH_GMS_STOLEN_32M: + memsize = MB(32) - KB(range); + break; + case I915G_GMCH_GMS_STOLEN_48M: + if (IS_I9XX(pI830)) + memsize = MB(48) - KB(range); + break; + case I915G_GMCH_GMS_STOLEN_64M: + if (IS_I9XX(pI830)) + memsize = MB(64) - KB(range); + break; + } + } else { + switch (gmch_ctrl & I830_GMCH_GMS_MASK) { + case I830_GMCH_GMS_STOLEN_512: + memsize = KB(512) - KB(range); + break; + case I830_GMCH_GMS_STOLEN_1024: + memsize = MB(1) - KB(range); + break; + case I830_GMCH_GMS_STOLEN_8192: + memsize = MB(8) - KB(range); + break; + case I830_GMCH_GMS_LOCAL: + memsize = 0; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Local memory found, but won't be used.\n"); + break; + } + } + if (memsize > 0) { + fprintf(stderr, + "detected %d kB stolen memory.\n", memsize / 1024); + } else { + fprintf(stderr, + "no video memory detected.\n"); + } + return memsize; +} + +static int AgpInit(const DRIDriverContext *ctx, I830Rec *info) +{ + unsigned long mode = 0x4; + + if (drmAgpAcquire(ctx->drmFD) < 0) { + fprintf(stderr, "[gart] AGP not available\n"); + return 0; + } + + if (drmAgpEnable(ctx->drmFD, mode) < 0) { + fprintf(stderr, "[gart] AGP not enabled\n"); + drmAgpRelease(ctx->drmFD); + return 0; + } + else + fprintf(stderr, "[gart] AGP enabled at %dx\n", ctx->agpmode); + + return 1; +} + +/* + * Allocate memory from the given pool. Grow the pool if needed and if + * possible. + */ +static unsigned long +AllocFromPool(const DRIDriverContext *ctx, I830Rec *pI830, + I830MemRange *result, I830MemPool *pool, + long size, unsigned long alignment, int flags) +{ + long needed, start, end; + + if (!result || !pool || !size) + return 0; + + /* Calculate how much space is needed. */ + if (alignment <= GTT_PAGE_SIZE) + needed = size; + else { + start = ROUND_TO(pool->Free.Start, alignment); + end = ROUND_TO(start + size, alignment); + needed = end - pool->Free.Start; + } + if (needed > pool->Free.Size) { + return 0; + } + + result->Start = ROUND_TO(pool->Free.Start, alignment); + pool->Free.Start += needed; + result->End = pool->Free.Start; + + pool->Free.Size = pool->Free.End - pool->Free.Start; + result->Size = result->End - result->Start; + result->Pool = pool; + result->Alignment = alignment; + return needed; +} + +static unsigned long AllocFromAGP(const DRIDriverContext *ctx, I830Rec *pI830, long size, unsigned long alignment, I830MemRange *result) +{ + unsigned long start, end; + unsigned long newApStart, newApEnd; + int ret; + if (!result || !size) + return 0; + + if (!alignment) + alignment = 4; + + start = ROUND_TO(pI830->MemoryAperture.Start, alignment); + end = ROUND_TO(start + size, alignment); + newApStart = end; + newApEnd = pI830->MemoryAperture.End; + + ret=drmAgpAlloc(ctx->drmFD, size, 0, &(result->Physical), (drm_handle_t *)&(result->Key)); + + if (ret) + { + fprintf(stderr,"drmAgpAlloc failed %d\n", ret); + return 0; + } + pI830->allocatedMemory += size; + pI830->MemoryAperture.Start = newApStart; + pI830->MemoryAperture.End = newApEnd; + pI830->MemoryAperture.Size = newApEnd - newApStart; + // pI830->FreeMemory -= size; + result->Start = start; + result->End = start + size; + result->Size = size; + result->Offset = start; + result->Alignment = alignment; + result->Pool = NULL; + + return size; +} + +unsigned long +I830AllocVidMem(const DRIDriverContext *ctx, I830Rec *pI830, + I830MemRange *result, I830MemPool *pool, long size, + unsigned long alignment, int flags) +{ + unsigned long ret; + + if (!result) + return 0; + + /* Make sure these are initialised. */ + result->Size = 0; + result->Key = -1; + + if (!size) { + return 0; + } + + if (pool->Free.Size < size) { + ret = AllocFromAGP(ctx, pI830, size, alignment, result); + } + else { + ret = AllocFromPool(ctx, pI830, result, pool, size, alignment, flags); + if (ret == 0) + ret = AllocFromAGP(ctx, pI830, size, alignment, result); + } + return ret; +} + +static Bool BindAgpRange(const DRIDriverContext *ctx, I830MemRange *mem) +{ + if (!mem) + return FALSE; + + if (mem->Key == -1) + return TRUE; + + return !drmAgpBind(ctx->drmFD, mem->Key, mem->Offset); +} + +/* simple memory allocation routines needed */ +/* put ring buffer in low memory */ +/* need to allocate front, back, depth buffers aligned correctly, + allocate ring buffer, +*/ + +/* */ +static Bool +I830AllocateMemory(const DRIDriverContext *ctx, I830Rec *pI830) +{ + unsigned long size, ret; + unsigned long lines, lineSize, align; + + /* allocate ring buffer */ + memset(pI830->LpRing, 0, sizeof(I830RingBuffer)); + pI830->LpRing->mem.Key = -1; + + size = PRIMARY_RINGBUFFER_SIZE; + + ret = I830AllocVidMem(ctx, pI830, &pI830->LpRing->mem, &pI830->StolenPool, size, 0x1000, 0); + + if (ret != size) + { + fprintf(stderr,"unable to allocate ring buffer %ld\n", ret); + return FALSE; + } + + pI830->LpRing->tail_mask = pI830->LpRing->mem.Size - 1; + + + /* allocate front buffer */ + memset(&(pI830->FrontBuffer), 0, sizeof(pI830->FrontBuffer)); + pI830->FrontBuffer.Key = -1; + pI830->FrontBuffer.Pitch = ctx->shared.virtualWidth; + + align = KB(512); + + lineSize = ctx->shared.virtualWidth * ctx->cpp; + lines = (ctx->shared.virtualHeight + 15) / 16 * 16; + size = lineSize * lines; + size = ROUND_TO_PAGE(size); + + align = GetBestTileAlignment(size); + + ret = I830AllocVidMem(ctx, pI830, &pI830->FrontBuffer, &pI830->StolenPool, size, align, 0); + if (ret < size) + { + fprintf(stderr,"unable to allocate front buffer %ld\n", ret); + return FALSE; + } + + memset(&(pI830->BackBuffer), 0, sizeof(pI830->BackBuffer)); + pI830->BackBuffer.Key = -1; + pI830->BackBuffer.Pitch = ctx->shared.virtualWidth; + + ret = I830AllocVidMem(ctx, pI830, &pI830->BackBuffer, &pI830->StolenPool, size, align, 0); + if (ret < size) + { + fprintf(stderr,"unable to allocate back buffer %ld\n", ret); + return FALSE; + } + + memset(&(pI830->DepthBuffer), 0, sizeof(pI830->DepthBuffer)); + pI830->DepthBuffer.Key = -1; + pI830->DepthBuffer.Pitch = ctx->shared.virtualWidth; + + ret = I830AllocVidMem(ctx, pI830, &pI830->DepthBuffer, &pI830->StolenPool, size, align, 0); + if (ret < size) + { + fprintf(stderr,"unable to allocate depth buffer %ld\n", ret); + return FALSE; + } + + memset(&(pI830->ContextMem), 0, sizeof(pI830->ContextMem)); + pI830->ContextMem.Key = -1; + size = KB(32); + + ret = I830AllocVidMem(ctx, pI830, &pI830->ContextMem, &pI830->StolenPool, size, align, 0); + if (ret < size) + { + fprintf(stderr,"unable to allocate context buffer %ld\n", ret); + return FALSE; + } + +#if 0 + memset(&(pI830->TexMem), 0, sizeof(pI830->TexMem)); + pI830->TexMem.Key = -1; + + size = 32768 * 1024; + ret = AllocFromAGP(ctx, pI830, size, align, &pI830->TexMem); + if (ret < size) + { + fprintf(stderr,"unable to allocate texture memory %ld\n", ret); + return FALSE; + } +#endif + + return TRUE; +} + +static Bool +I830BindMemory(const DRIDriverContext *ctx, I830Rec *pI830) +{ + if (!BindAgpRange(ctx, &pI830->LpRing->mem)) + return FALSE; + if (!BindAgpRange(ctx, &pI830->FrontBuffer)) + return FALSE; + if (!BindAgpRange(ctx, &pI830->BackBuffer)) + return FALSE; + if (!BindAgpRange(ctx, &pI830->DepthBuffer)) + return FALSE; + if (!BindAgpRange(ctx, &pI830->ContextMem)) + return FALSE; +#if 0 + if (!BindAgpRange(ctx, &pI830->TexMem)) + return FALSE; +#endif + return TRUE; +} + +static void SetupDRIMM(const DRIDriverContext *ctx, I830Rec *pI830) +{ + unsigned long aperEnd = ROUND_DOWN_TO(pI830->aper_size, GTT_PAGE_SIZE) / GTT_PAGE_SIZE; + unsigned long aperStart = ROUND_TO(pI830->aper_size - KB(32768), GTT_PAGE_SIZE) / GTT_PAGE_SIZE; + + fprintf(stderr, "aper size is %08X\n", ctx->shared.fbSize); + if (drmMMInit(ctx->drmFD, aperStart, aperEnd - aperStart, DRM_BO_MEM_TT)) { + fprintf(stderr, + "DRM MM Initialization Failed\n"); + } else { + fprintf(stderr, + "DRM MM Initialized at offset 0x%lx length %d page\n", aperStart, aperEnd-aperStart); + } + +} + +static Bool +I830CleanupDma(const DRIDriverContext *ctx) +{ + drmI830Init info; + + memset(&info, 0, sizeof(drmI830Init)); + info.func = I830_CLEANUP_DMA; + + if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT, + &info, sizeof(drmI830Init))) { + fprintf(stderr, "I830 Dma Cleanup Failed\n"); + return FALSE; + } + + return TRUE; +} + +static Bool +I830InitDma(const DRIDriverContext *ctx, I830Rec *pI830) +{ + I830RingBuffer *ring = pI830->LpRing; + drmI830Init info; + + memset(&info, 0, sizeof(drmI830Init)); + info.func = I830_INIT_DMA; + + info.ring_start = ring->mem.Start + pI830->LinearAddr; + info.ring_end = ring->mem.End + pI830->LinearAddr; + info.ring_size = ring->mem.Size; + + info.mmio_offset = (unsigned int)ctx->MMIOStart; + + info.sarea_priv_offset = sizeof(drm_sarea_t); + + info.front_offset = pI830->FrontBuffer.Start; + info.back_offset = pI830->BackBuffer.Start; + info.depth_offset = pI830->DepthBuffer.Start; + info.w = ctx->shared.virtualWidth; + info.h = ctx->shared.virtualHeight; + info.pitch = ctx->shared.virtualWidth; + info.back_pitch = pI830->BackBuffer.Pitch; + info.depth_pitch = pI830->DepthBuffer.Pitch; + info.cpp = ctx->cpp; + + if (drmCommandWrite(ctx->drmFD, DRM_I830_INIT, + &info, sizeof(drmI830Init))) { + fprintf(stderr, + "I830 Dma Initialization Failed\n"); + return FALSE; + } + + return TRUE; +} + +static int I830CheckDRMVersion( const DRIDriverContext *ctx, + I830Rec *pI830 ) +{ + drmVersionPtr version; + + version = drmGetVersion(ctx->drmFD); + + if (version) { + int req_minor, req_patch; + + req_minor = 4; + req_patch = 0; + + if (version->version_major != 1 || + version->version_minor < req_minor || + (version->version_minor == req_minor && + version->version_patchlevel < req_patch)) { + /* Incompatible drm version */ + fprintf(stderr, + "[dri] I830DRIScreenInit failed because of a version " + "mismatch.\n" + "[dri] i915.o kernel module version is %d.%d.%d " + "but version 1.%d.%d or newer is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel, + req_minor, + req_patch); + drmFreeVersion(version); + return 0; + } + + pI830->drmMinor = version->version_minor; + drmFreeVersion(version); + } + return 1; +} + +static void +I830SetRingRegs(const DRIDriverContext *ctx, I830Rec *pI830) +{ + unsigned int itemp; + unsigned char *MMIO = ctx->MMIOAddress; + + OUTREG(LP_RING + RING_LEN, 0); + OUTREG(LP_RING + RING_TAIL, 0); + OUTREG(LP_RING + RING_HEAD, 0); + + if ((long)(pI830->LpRing->mem.Start & I830_RING_START_MASK) != + pI830->LpRing->mem.Start) { + fprintf(stderr, + "I830SetRingRegs: Ring buffer start (%lx) violates its " + "mask (%x)\n", pI830->LpRing->mem.Start, I830_RING_START_MASK); + } + /* Don't care about the old value. Reserved bits must be zero anyway. */ + itemp = pI830->LpRing->mem.Start & I830_RING_START_MASK; + OUTREG(LP_RING + RING_START, itemp); + + if (((pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES) != + pI830->LpRing->mem.Size - 4096) { + fprintf(stderr, + "I830SetRingRegs: Ring buffer size - 4096 (%lx) violates its " + "mask (%x)\n", pI830->LpRing->mem.Size - 4096, + I830_RING_NR_PAGES); + } + /* Don't care about the old value. Reserved bits must be zero anyway. */ + itemp = (pI830->LpRing->mem.Size - 4096) & I830_RING_NR_PAGES; + itemp |= (RING_NO_REPORT | RING_VALID); + OUTREG(LP_RING + RING_LEN, itemp); + + pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; + pI830->LpRing->tail = INREG(LP_RING + RING_TAIL); + pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8); + if (pI830->LpRing->space < 0) + pI830->LpRing->space += pI830->LpRing->mem.Size; + + SetFenceRegs(ctx, pI830); + + /* RESET THE DISPLAY PIPE TO POINT TO THE FRONTBUFFER - hacky + hacky hacky */ + OUTREG(DSPABASE, pI830->FrontBuffer.Start + pI830->LinearAddr); + +} + +static Bool +I830SetParam(const DRIDriverContext *ctx, int param, int value) +{ + drmI830SetParam sp; + + memset(&sp, 0, sizeof(sp)); + sp.param = param; + sp.value = value; + + if (drmCommandWrite(ctx->drmFD, DRM_I830_SETPARAM, &sp, sizeof(sp))) { + fprintf(stderr, "I830 SetParam Failed\n"); + return FALSE; + } + + return TRUE; +} + +static Bool +I830DRIMapScreenRegions(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) +{ + fprintf(stderr, + "[drm] Mapping front buffer\n"); + + if (drmAddMap(ctx->drmFD, + (drm_handle_t)(sarea->front_offset + pI830->LinearAddr), + sarea->front_size, + DRM_FRAME_BUFFER, /*DRM_AGP,*/ + 0, + &sarea->front_handle) < 0) { + fprintf(stderr, + "[drm] drmAddMap(front_handle) failed. Disabling DRI\n"); + return FALSE; + } + ctx->shared.hFrameBuffer = sarea->front_handle; + ctx->shared.fbSize = sarea->front_size; + fprintf(stderr, "[drm] Front Buffer = 0x%08x\n", + sarea->front_handle); + + if (drmAddMap(ctx->drmFD, + (drm_handle_t)(sarea->back_offset), + sarea->back_size, DRM_AGP, 0, + &sarea->back_handle) < 0) { + fprintf(stderr, + "[drm] drmAddMap(back_handle) failed. Disabling DRI\n"); + return FALSE; + } + fprintf(stderr, "[drm] Back Buffer = 0x%08x\n", + sarea->back_handle); + + if (drmAddMap(ctx->drmFD, + (drm_handle_t)sarea->depth_offset, + sarea->depth_size, DRM_AGP, 0, + &sarea->depth_handle) < 0) { + fprintf(stderr, + "[drm] drmAddMap(depth_handle) failed. Disabling DRI\n"); + return FALSE; + } + fprintf(stderr, "[drm] Depth Buffer = 0x%08x\n", + sarea->depth_handle); + +#if 0 + if (drmAddMap(ctx->drmFD, + (drm_handle_t)sarea->tex_offset, + sarea->tex_size, DRM_AGP, 0, + &sarea->tex_handle) < 0) { + fprintf(stderr, + "[drm] drmAddMap(tex_handle) failed. Disabling DRI\n"); + return FALSE; + } + fprintf(stderr, "[drm] textures = 0x%08x\n", + sarea->tex_handle); +#endif + return TRUE; +} + + +static void +I830DRIUnmapScreenRegions(const DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) +{ +#if 1 + if (sarea->front_handle) { + drmRmMap(ctx->drmFD, sarea->front_handle); + sarea->front_handle = 0; + } +#endif + if (sarea->back_handle) { + drmRmMap(ctx->drmFD, sarea->back_handle); + sarea->back_handle = 0; + } + if (sarea->depth_handle) { + drmRmMap(ctx->drmFD, sarea->depth_handle); + sarea->depth_handle = 0; + } + if (sarea->tex_handle) { + drmRmMap(ctx->drmFD, sarea->tex_handle); + sarea->tex_handle = 0; + } +} + +static Bool +I830DRIDoMappings(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) +{ + if (drmAddMap(ctx->drmFD, + (drm_handle_t)pI830->LpRing->mem.Start, + pI830->LpRing->mem.Size, DRM_AGP, 0, + &pI830->ring_map) < 0) { + fprintf(stderr, + "[drm] drmAddMap(ring_map) failed. Disabling DRI\n"); + return FALSE; + } + fprintf(stderr, "[drm] ring buffer = 0x%08x\n", + pI830->ring_map); + + if (I830InitDma(ctx, pI830) == FALSE) { + return FALSE; + } + + /* init to zero to be safe */ + + I830DRIMapScreenRegions(ctx, pI830, sarea); + SetupDRIMM(ctx, pI830); + + if (ctx->pciDevice != PCI_CHIP_845_G && + ctx->pciDevice != PCI_CHIP_I830_M) { + I830SetParam(ctx, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 ); + } + + /* Okay now initialize the dma engine */ + { + pI830->irq = drmGetInterruptFromBusID(ctx->drmFD, + ctx->pciBus, + ctx->pciDevice, + ctx->pciFunc); + + if (drmCtlInstHandler(ctx->drmFD, pI830->irq)) { + fprintf(stderr, + "[drm] failure adding irq handler\n"); + pI830->irq = 0; + return FALSE; + } + else + fprintf(stderr, + "[drm] dma control initialized, using IRQ %d\n", + pI830->irq); + } + + fprintf(stderr, "[dri] visual configs initialized\n"); + + return TRUE; +} + +static Bool +I830ClearScreen(DRIDriverContext *ctx, I830Rec *pI830, drmI830Sarea *sarea) +{ + /* need to drmMap front and back buffers and zero them */ + drmAddress map_addr; + int ret; + + ret = drmMap(ctx->drmFD, + sarea->front_handle, + sarea->front_size, + &map_addr); + + if (ret) + { + fprintf(stderr, "Unable to map front buffer\n"); + return FALSE; + } + + drimemsetio((char *)map_addr, + 0, + sarea->front_size); + drmUnmap(map_addr, sarea->front_size); + + + ret = drmMap(ctx->drmFD, + sarea->back_handle, + sarea->back_size, + &map_addr); + + if (ret) + { + fprintf(stderr, "Unable to map back buffer\n"); + return FALSE; + } + + drimemsetio((char *)map_addr, + 0, + sarea->back_size); + drmUnmap(map_addr, sarea->back_size); + + return TRUE; +} + +static Bool +I830ScreenInit(DRIDriverContext *ctx, I830Rec *pI830) + +{ + I830DRIPtr pI830DRI; + drmI830Sarea *pSAREAPriv; + int err; + + drm_page_size = getpagesize(); + + pI830->registerSize = ctx->MMIOSize; + /* This is a hack for now. We have to have more than a 4k page here + * because of the size of the state. However, the state should be + * in a per-context mapping. This will be added in the Mesa 3.5 port + * of the I830 driver. + */ + ctx->shared.SAREASize = SAREA_MAX; + + /* Note that drmOpen will try to load the kernel module, if needed. */ + ctx->drmFD = drmOpen("i915", NULL ); + if (ctx->drmFD < 0) { + fprintf(stderr, "[drm] drmOpen failed\n"); + return 0; + } + + if ((err = drmSetBusid(ctx->drmFD, ctx->pciBusID)) < 0) { + fprintf(stderr, "[drm] drmSetBusid failed (%d, %s), %s\n", + ctx->drmFD, ctx->pciBusID, strerror(-err)); + return 0; + } + + if (drmAddMap( ctx->drmFD, + 0, + ctx->shared.SAREASize, + DRM_SHM, + DRM_CONTAINS_LOCK, + &ctx->shared.hSAREA) < 0) + { + fprintf(stderr, "[drm] drmAddMap failed\n"); + return 0; + } + + fprintf(stderr, "[drm] added %d byte SAREA at 0x%08x\n", + ctx->shared.SAREASize, ctx->shared.hSAREA); + + if (drmMap( ctx->drmFD, + ctx->shared.hSAREA, + ctx->shared.SAREASize, + (drmAddressPtr)(&ctx->pSAREA)) < 0) + { + fprintf(stderr, "[drm] drmMap failed\n"); + return 0; + + } + + memset(ctx->pSAREA, 0, ctx->shared.SAREASize); + fprintf(stderr, "[drm] mapped SAREA 0x%08x to %p, size %d\n", + ctx->shared.hSAREA, ctx->pSAREA, ctx->shared.SAREASize); + + + if (drmAddMap(ctx->drmFD, + ctx->MMIOStart, + ctx->MMIOSize, + DRM_REGISTERS, + DRM_READ_ONLY, + &pI830->registerHandle) < 0) { + fprintf(stderr, "[drm] drmAddMap mmio failed\n"); + return 0; + } + fprintf(stderr, + "[drm] register handle = 0x%08x\n", pI830->registerHandle); + + + if (!I830CheckDRMVersion(ctx, pI830)) { + return FALSE; + } + + /* Create a 'server' context so we can grab the lock for + * initialization ioctls. + */ + if ((err = drmCreateContext(ctx->drmFD, &ctx->serverContext)) != 0) { + fprintf(stderr, "%s: drmCreateContext failed %d\n", __FUNCTION__, err); + return 0; + } + + DRM_LOCK(ctx->drmFD, ctx->pSAREA, ctx->serverContext, 0); + + /* Initialize the SAREA private data structure */ + pSAREAPriv = (drmI830Sarea *)(((char*)ctx->pSAREA) + + sizeof(drm_sarea_t)); + memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); + + pI830->StolenMemory.Size = I830DetectMemory(ctx, pI830); + pI830->StolenMemory.Start = 0; + pI830->StolenMemory.End = pI830->StolenMemory.Size; + + pI830->MemoryAperture.Start = pI830->StolenMemory.End; + pI830->MemoryAperture.End = KB(40000); + pI830->MemoryAperture.Size = pI830->MemoryAperture.End - pI830->MemoryAperture.Start; + + pI830->StolenPool.Fixed = pI830->StolenMemory; + pI830->StolenPool.Total = pI830->StolenMemory; + pI830->StolenPool.Free = pI830->StolenPool.Total; + pI830->FreeMemory = pI830->StolenPool.Total.Size; + + if (!AgpInit(ctx, pI830)) + return FALSE; + + if (I830AllocateMemory(ctx, pI830) == FALSE) + { + return FALSE; + } + + if (I830BindMemory(ctx, pI830) == FALSE) + { + return FALSE; + } + + pSAREAPriv->rotated_offset = -1; + pSAREAPriv->rotated_size = 0; + pSAREAPriv->rotated_pitch = ctx->shared.virtualWidth; + + pSAREAPriv->front_offset = pI830->FrontBuffer.Start; + pSAREAPriv->front_size = pI830->FrontBuffer.Size; + pSAREAPriv->width = ctx->shared.virtualWidth; + pSAREAPriv->height = ctx->shared.virtualHeight; + pSAREAPriv->pitch = ctx->shared.virtualWidth; + pSAREAPriv->virtualX = ctx->shared.virtualWidth; + pSAREAPriv->virtualY = ctx->shared.virtualHeight; + pSAREAPriv->back_offset = pI830->BackBuffer.Start; + pSAREAPriv->back_size = pI830->BackBuffer.Size; + pSAREAPriv->depth_offset = pI830->DepthBuffer.Start; + pSAREAPriv->depth_size = pI830->DepthBuffer.Size; +#if 0 + pSAREAPriv->tex_offset = pI830->TexMem.Start; + pSAREAPriv->tex_size = pI830->TexMem.Size; +#endif + pSAREAPriv->log_tex_granularity = pI830->TexGranularity; + + ctx->driverClientMsg = malloc(sizeof(I830DRIRec)); + ctx->driverClientMsgSize = sizeof(I830DRIRec); + pI830DRI = (I830DRIPtr)ctx->driverClientMsg; + pI830DRI->deviceID = pI830->Chipset; + pI830DRI->regsSize = I830_REG_SIZE; + pI830DRI->width = ctx->shared.virtualWidth; + pI830DRI->height = ctx->shared.virtualHeight; + pI830DRI->mem = ctx->shared.fbSize; + pI830DRI->cpp = ctx->cpp; + + pI830DRI->bitsPerPixel = ctx->bpp; + pI830DRI->sarea_priv_offset = sizeof(drm_sarea_t); + + err = I830DRIDoMappings(ctx, pI830, pSAREAPriv); + if (err == FALSE) + return FALSE; + + I830SetupMemoryTiling(ctx, pI830); + + /* Quick hack to clear the front & back buffers. Could also use + * the clear ioctl to do this, but would need to setup hw state + * first. + */ + I830ClearScreen(ctx, pI830, pSAREAPriv); + + I830SetRingRegs(ctx, pI830); + + return TRUE; +} + + +/** + * \brief Validate the fbdev mode. + * + * \param ctx display handle. + * + * \return one on success, or zero on failure. + * + * Saves some registers and returns 1. + * + * \sa radeonValidateMode(). + */ +static int i830ValidateMode( const DRIDriverContext *ctx ) +{ + return 1; +} + +/** + * \brief Examine mode returned by fbdev. + * + * \param ctx display handle. + * + * \return one on success, or zero on failure. + * + * Restores registers that fbdev has clobbered and returns 1. + * + * \sa i810ValidateMode(). + */ +static int i830PostValidateMode( const DRIDriverContext *ctx ) +{ + I830Rec *pI830 = ctx->driverPrivate; + + I830SetRingRegs(ctx, pI830); + return 1; +} + + +/** + * \brief Initialize the framebuffer device mode + * + * \param ctx display handle. + * + * \return one on success, or zero on failure. + * + * Fills in \p info with some default values and some information from \p ctx + * and then calls I810ScreenInit() for the screen initialization. + * + * Before exiting clears the framebuffer memory accessing it directly. + */ +static int i830InitFBDev( DRIDriverContext *ctx ) +{ + I830Rec *pI830 = calloc(1, sizeof(I830Rec)); + int i; + + { + int dummy = ctx->shared.virtualWidth; + + switch (ctx->bpp / 8) { + case 1: dummy = (ctx->shared.virtualWidth + 127) & ~127; break; + case 2: dummy = (ctx->shared.virtualWidth + 31) & ~31; break; + case 3: + case 4: dummy = (ctx->shared.virtualWidth + 15) & ~15; break; + } + + ctx->shared.virtualWidth = dummy; + ctx->shared.Width = ctx->shared.virtualWidth; + } + + + for (i = 0; pitches[i] != 0; i++) { + if (pitches[i] >= ctx->shared.virtualWidth) { + ctx->shared.virtualWidth = pitches[i]; + break; + } + } + + ctx->driverPrivate = (void *)pI830; + + pI830->LpRing = calloc(1, sizeof(I830RingBuffer)); + pI830->Chipset = ctx->chipset; + pI830->LinearAddr = ctx->FBStart; + + if (!I830ScreenInit( ctx, pI830 )) + return 0; + + + return 1; +} + + +/** + * \brief The screen is being closed, so clean up any state and free any + * resources used by the DRI. + * + * \param ctx display handle. + * + * Unmaps the SAREA, closes the DRM device file descriptor and frees the driver + * private data. + */ +static void i830HaltFBDev( DRIDriverContext *ctx ) +{ + drmI830Sarea *pSAREAPriv; + I830Rec *pI830 = ctx->driverPrivate; + + if (pI830->irq) { + drmCtlUninstHandler(ctx->drmFD); + pI830->irq = 0; } + + I830CleanupDma(ctx); + + pSAREAPriv = (drmI830Sarea *)(((char*)ctx->pSAREA) + + sizeof(drm_sarea_t)); + + I830DRIUnmapScreenRegions(ctx, pI830, pSAREAPriv); + drmUnmap( ctx->pSAREA, ctx->shared.SAREASize ); + drmClose(ctx->drmFD); + + if (ctx->driverPrivate) { + free(ctx->driverPrivate); + ctx->driverPrivate = 0; + } +} + + +extern void i810NotifyFocus( int ); + +/** + * \brief Exported driver interface for Mini GLX. + * + * \sa DRIDriverRec. + */ +const struct DRIDriverRec __driDriver = { + i830ValidateMode, + i830PostValidateMode, + i830InitFBDev, + i830HaltFBDev, + NULL,//I830EngineShutdown, + NULL, //I830EngineRestore, +#ifndef _EMBEDDED + 0, +#else + i810NotifyFocus, +#endif +}; -- cgit v1.2.3 From b4531121330fa85a072f129d11e8432b5294c789 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Wed, 17 Oct 2007 18:26:31 +0200 Subject: i915: Don't emit 'empty' blit rectangles. The hardware seems to interpret them differently and produce unexpected results... --- src/mesa/drivers/dri/i915/intel_blit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_blit.c b/src/mesa/drivers/dri/i915/intel_blit.c index b00b0d9e1b5..2d4d00edefd 100644 --- a/src/mesa/drivers/dri/i915/intel_blit.c +++ b/src/mesa/drivers/dri/i915/intel_blit.c @@ -402,6 +402,9 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask) b = *box; } + if (b.x1 >= b.x2 || b.y1 >= b.y2) + continue; + if (0) _mesa_printf("clear %d,%d..%d,%d, mask %x\n", b.x1, b.y1, b.x2, b.y2, mask); -- cgit v1.2.3 From 86b81ef5aa14a2fa7be6e5c319c00324028a1761 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Wed, 17 Oct 2007 18:28:03 +0200 Subject: Don't call the driver clear hook when the effective scissor rectangle is empty. --- src/mesa/main/buffers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index cbbe3e8698b..d9c18bfaafc 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -140,7 +140,9 @@ _mesa_Clear( GLbitfield mask ) return; } - if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0) + if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0 || + ctx->DrawBuffer->_Xmin >= ctx->DrawBuffer->_Xmax || + ctx->DrawBuffer->_Ymin >= ctx->DrawBuffer->_Ymax) return; if (ctx->RenderMode == GL_RENDER) { -- cgit v1.2.3 From ad053d90f01852ee27e36a21402543562bf46ad6 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 17 Oct 2007 14:30:18 -0600 Subject: Replace repeat_remainder() with a simpler macro that just casts args to unsigned. --- src/mesa/swrast/s_texfilter.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index c2a7512388e..bb4e38623c9 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -213,17 +213,10 @@ lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c, /** - * Compute the remainder of a divided by b, but be careful with - * negative values so that GL_REPEAT mode works right. + * If A is a signed integer, A % B doesn't give the right value for A < 0 + * (in terms of texture repeat). Just casting to unsigned fixes that. */ -static INLINE GLint -repeat_remainder(GLint a, GLint b) -{ - if (a >= 0) - return a % b; - else - return (a + 1) % b + b - 1; -} +#define REMAINDER(A, B) ((unsigned) (A) % (unsigned) (B)) /** @@ -246,8 +239,8 @@ repeat_remainder(GLint a, GLint b) I1 = (I0 + 1) & (SIZE - 1); \ } \ else { \ - I0 = repeat_remainder(IFLOOR(U), SIZE); \ - I1 = repeat_remainder(I0 + 1, SIZE); \ + I0 = REMAINDER(IFLOOR(U), SIZE); \ + I1 = REMAINDER(I0 + 1, SIZE); \ } \ break; \ case GL_CLAMP_TO_EDGE: \ @@ -366,7 +359,7 @@ repeat_remainder(GLint a, GLint b) if (img->_IsPowerOfTwo) \ I &= (SIZE - 1); \ else \ - I = repeat_remainder(I, SIZE); \ + I = REMAINDER(I, SIZE); \ break; \ case GL_CLAMP_TO_EDGE: \ { \ -- cgit v1.2.3 From 366b2c690295ed4bd4dda429be945db814a069d6 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 17 Oct 2007 10:36:48 -0700 Subject: mga: Enable (trivial) support for GL_EXT_gpu_program_parameters. --- src/mesa/drivers/dri/mga/mga_xmesa.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 99a2ea04911..a6d78d0bf01 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -75,6 +75,7 @@ #define need_GL_ARB_vertex_buffer_object #define need_GL_ARB_vertex_program #define need_GL_EXT_fog_coord +#define need_GL_EXT_gpu_program_parameters #define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_secondary_color #if 0 @@ -416,8 +417,9 @@ static const struct dri_extension card_extensions[] = { NULL, NULL } }; -static const struct dri_extension ARB_vp_extension[] = { +static const struct dri_extension ARB_vp_extensions[] = { { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, + { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, { NULL, NULL } }; @@ -622,7 +624,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis, } if ( driQueryOptionb( &mmesa->optionCache, "arb_vertex_program" ) ) { - driInitSingleExtension( ctx, ARB_vp_extension ); + driInitExtensions(ctx, ARB_vp_extensions, GL_FALSE); } if ( driQueryOptionb( &mmesa->optionCache, "nv_vertex_program" ) ) { @@ -985,7 +987,7 @@ __GLcontextModes *__driDriverInitScreen(__DRIscreenPrivate *psp) driInitExtensions( NULL, card_extensions, GL_FALSE ); driInitExtensions( NULL, g400_extensions, GL_FALSE ); - driInitSingleExtension( NULL, ARB_vp_extension ); + driInitExtensions(NULL, ARB_vp_extensions, GL_FALSE); driInitExtensions( NULL, NV_vp_extensions, GL_FALSE ); if (!mgaInitDriver(psp)) -- cgit v1.2.3 From 374158b0440b24b71389d06fdf306b176c1186e7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 17 Oct 2007 10:39:24 -0700 Subject: mga: Enable (trivial) support for GL_APPLE_vertex_array_object, bump DRIVER_DATE --- src/mesa/drivers/dri/mga/mga_xmesa.c | 2 ++ src/mesa/drivers/dri/mga/mgadd.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index a6d78d0bf01..2f3516fd38c 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -81,6 +81,7 @@ #if 0 #define need_GL_EXT_paletted_texture #endif +#define need_GL_APPLE_vertex_array_object #define need_GL_NV_vertex_program #include "extension_helper.h" @@ -412,6 +413,7 @@ static const struct dri_extension card_extensions[] = #endif { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions }, { "GL_EXT_stencil_wrap", NULL }, + { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, { "GL_MESA_ycbcr_texture", NULL }, { "GL_SGIS_generate_mipmap", NULL }, { NULL, NULL } diff --git a/src/mesa/drivers/dri/mga/mgadd.c b/src/mesa/drivers/dri/mga/mgadd.c index b1d5e0c48fc..6d18bd83d8e 100644 --- a/src/mesa/drivers/dri/mga/mgadd.c +++ b/src/mesa/drivers/dri/mga/mgadd.c @@ -41,7 +41,7 @@ #include "mga_xmesa.h" #include "utils.h" -#define DRIVER_DATE "20061030" +#define DRIVER_DATE "20071017" /*************************************** -- cgit v1.2.3 From 42a4386a4c18932221c59607e6d22b864a2577fb Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 17 Oct 2007 12:07:04 -0700 Subject: Initial support for ARB_depth_texture Currently only GL_DEPTH_COMPONENT16 are supported. I don't know what the hardware bits are to select the other formats, but it shouldn't be too hard to figure out. --- src/mesa/drivers/dri/r300/r300_context.c | 4 ++- src/mesa/drivers/dri/r300/r300_tex.c | 32 ++++++++++++++++++++++++ src/mesa/drivers/dri/r300/r300_tex.h | 2 ++ src/mesa/drivers/dri/r300/r300_texstate.c | 41 ++++++++++++++++++++++++++++++- 4 files changed, 77 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 14e0f052fd5..d2ed3105d1c 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -93,6 +93,8 @@ int hw_tcl_on = 1; const struct dri_extension card_extensions[] = { /* *INDENT-OFF* */ + {"GL_ARB_depth_texture", NULL}, + {"GL_ARB_fragment_program", NULL}, {"GL_ARB_multisample", GL_ARB_multisample_functions}, {"GL_ARB_multitexture", NULL}, {"GL_ARB_texture_border_clamp", NULL}, @@ -105,7 +107,6 @@ const struct dri_extension card_extensions[] = { {"GL_ARB_texture_mirrored_repeat", NULL}, {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, - {"GL_ARB_fragment_program", NULL}, {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions}, {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions}, {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, @@ -130,6 +131,7 @@ const struct dri_extension card_extensions[] = { {"GL_NV_blend_square", NULL}, {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, {"GL_SGIS_generate_mipmap", NULL}, + {"GL_SGIX_depth_texture", NULL}, {NULL, NULL} /* *INDENT-ON* */ }; diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 1805cecd0af..adf69a3c257 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -482,6 +482,25 @@ static const struct gl_texture_format *r300ChooseTextureFormat(GLcontext * ctx, case GL_RGBA32F_ARB: return &_mesa_texformat_rgba_float32; + case GL_DEPTH_COMPONENT: + case GL_DEPTH_COMPONENT16: + case GL_DEPTH_COMPONENT24: + case GL_DEPTH_COMPONENT32: +#if 0 + switch (type) { + case GL_UNSIGNED_BYTE: + case GL_UNSIGNED_SHORT: + return &_mesa_texformat_z16; + case GL_UNSIGNED_INT: + return &_mesa_texformat_z32; + case GL_UNSIGNED_INT_24_8_EXT: + default: + return &_mesa_texformat_z24_s8; + } +#else + return &_mesa_texformat_z16; +#endif + default: _mesa_problem(ctx, "unexpected internalFormat 0x%x in r300ChooseTextureFormat", @@ -1057,6 +1076,19 @@ static void r300TexParameter(GLcontext * ctx, GLenum target, driSwapOutTextureObject((driTextureObject *) t); break; + case GL_DEPTH_TEXTURE_MODE: + if (texObj->Image[0][texObj->BaseLevel]->TexFormat->BaseFormat + == GL_DEPTH_COMPONENT) { + r300SetDepthTexMode(texObj); + break; + } else { + /* If the texture isn't a depth texture, changing this + * state won't cause any changes to the hardware. + * Don't force a flush of texture state. + */ + return; + } + default: return; } diff --git a/src/mesa/drivers/dri/r300/r300_tex.h b/src/mesa/drivers/dri/r300/r300_tex.h index f67a8e6ba65..b86d45bfe05 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.h +++ b/src/mesa/drivers/dri/r300/r300_tex.h @@ -35,6 +35,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef __r300_TEX_H__ #define __r300_TEX_H__ +extern void r300SetDepthTexMode(struct gl_texture_object *tObj); + extern void r300SetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 1d2909fd214..1c9851afb2a 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -115,11 +115,45 @@ static const struct tx_table { _ASSIGN(LUMINANCE_ALPHA_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, Y, FL_I16A16)), _ASSIGN(INTENSITY_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, X, FL_I32)), _ASSIGN(INTENSITY_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, X, FL_I16)), + _ASSIGN(Z16, R300_EASY_TX_FORMAT(X, X, X, X, X16)), +#if 0 + _ASSIGN(Z24_S8, R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8)), + _ASSIGN(Z32, R300_EASY_TX_FORMAT(X, X, X, X, X32)), +#endif /* *INDENT-ON* */ }; #undef _ASSIGN +void r300SetDepthTexMode(struct gl_texture_object *tObj) +{ + r300TexObjPtr t; + + if (!tObj) + return; + + t = (r300TexObjPtr) tObj->DriverData; + + switch (tObj->DepthMode) { + case GL_LUMINANCE: + t->format = R300_EASY_TX_FORMAT(X, X, X, X, X16); + break; + case GL_INTENSITY: + t->format = R300_EASY_TX_FORMAT(X, X, X, ONE, X16); + break; + case GL_ALPHA: + t->format = R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X16); + break; + default: + /* Error...which should have already been caught by higher + * levels of Mesa. + */ + ASSERT(0); + break; + } +} + + /** * This function computes the number of bytes of storage needed for * the given texture object (all mipmap levels, all cube faces). @@ -146,7 +180,12 @@ static void r300SetTexImages(r300ContextPtr rmesa, */ if (!t->image_override && VALID_FORMAT(baseImage->TexFormat->MesaFormat)) { - t->format = tx_table[baseImage->TexFormat->MesaFormat].format; + if (baseImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) { + r300SetDepthTexMode(tObj); + } else { + t->format = tx_table[baseImage->TexFormat->MesaFormat].format; + } + t->filter |= tx_table[baseImage->TexFormat->MesaFormat].filter; } else if (!t->image_override) { _mesa_problem(NULL, "unexpected texture format in %s", -- cgit v1.2.3 From a663e846b63c33685a9e88c8904f5e3a225f6e85 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 17 Oct 2007 13:11:01 -0700 Subject: Framework for supporting z24_s8 and z32 depth textures on r300. --- src/mesa/drivers/dri/r300/r300_reg.h | 8 ++++++ src/mesa/drivers/dri/r300/r300_texstate.c | 47 +++++++++++++++++++++++++++---- 2 files changed, 49 insertions(+), 6 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 1baa74c5269..ee556d347e0 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -886,6 +886,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_FORMAT_A8R8G8B8 0x13 /* no swizzle */ # define R300_TX_FORMAT_B8G8_B8G8 0x14 /* no swizzle */ # define R300_TX_FORMAT_G8R8_G8B8 0x15 /* no swizzle */ + + /* These two values are wrong, but they're the only values that + * produce any even vaguely correct results. Can r300 only do 16-bit + * depth textures? + */ +# define R300_TX_FORMAT_X24_Y8 0x1e +# define R300_TX_FORMAT_X32 0x1e + /* 0x16 - some 16 bit green format.. ?? */ # define R300_TX_FORMAT_UNK25 (1 << 25) /* no swizzle */ # define R300_TX_FORMAT_CUBIC_MAP (1 << 26) diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 1c9851afb2a..efa201a52d5 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -116,10 +116,8 @@ static const struct tx_table { _ASSIGN(INTENSITY_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, X, FL_I32)), _ASSIGN(INTENSITY_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, X, FL_I16)), _ASSIGN(Z16, R300_EASY_TX_FORMAT(X, X, X, X, X16)), -#if 0 _ASSIGN(Z24_S8, R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8)), _ASSIGN(Z32, R300_EASY_TX_FORMAT(X, X, X, X, X32)), -#endif /* *INDENT-ON* */ }; @@ -127,6 +125,24 @@ static const struct tx_table { void r300SetDepthTexMode(struct gl_texture_object *tObj) { + static const GLuint formats[3][3] = { + { + R300_EASY_TX_FORMAT(X, X, X, X, X16), + R300_EASY_TX_FORMAT(X, X, X, ONE, X16), + R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X16), + }, + { + R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8), + R300_EASY_TX_FORMAT(X, X, X, ONE, X24_Y8), + R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X24_Y8), + }, + { + R300_EASY_TX_FORMAT(X, X, X, X, X32), + R300_EASY_TX_FORMAT(X, X, X, ONE, X32), + R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X32), + }, + }; + const GLuint *format; r300TexObjPtr t; if (!tObj) @@ -134,22 +150,41 @@ void r300SetDepthTexMode(struct gl_texture_object *tObj) t = (r300TexObjPtr) tObj->DriverData; + + switch (tObj->Image[0][tObj->BaseLevel]->TexFormat->MesaFormat) { + case MESA_FORMAT_Z16: + format = formats[0]; + break; + case MESA_FORMAT_Z24_S8: + format = formats[1]; + break; + case MESA_FORMAT_Z32: + format = formats[2]; + break; + default: + /* Error...which should have already been caught by higher + * levels of Mesa. + */ + ASSERT(0); + return; + } + switch (tObj->DepthMode) { case GL_LUMINANCE: - t->format = R300_EASY_TX_FORMAT(X, X, X, X, X16); + t->format = format[0]; break; case GL_INTENSITY: - t->format = R300_EASY_TX_FORMAT(X, X, X, ONE, X16); + t->format = format[1]; break; case GL_ALPHA: - t->format = R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X16); + t->format = format[2]; break; default: /* Error...which should have already been caught by higher * levels of Mesa. */ ASSERT(0); - break; + return; } } -- cgit v1.2.3 From 950fff0f9a330c50a627ced2e8cff2fb4689bee0 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 18 Oct 2007 18:30:15 +0200 Subject: i915: Add some sanity checks to blit command debugging code. --- src/mesa/drivers/dri/i915/i915_debug.c | 37 +++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/i915_debug.c b/src/mesa/drivers/dri/i915/i915_debug.c index c0e1242a0ea..8eb1c5b49e1 100644 --- a/src/mesa/drivers/dri/i915/i915_debug.c +++ b/src/mesa/drivers/dri/i915/i915_debug.c @@ -376,20 +376,25 @@ static void BR13( struct debug_stream *stream, } -static void BR22( struct debug_stream *stream, - GLuint val ) +static void BR2223( struct debug_stream *stream, + GLuint val22, GLuint val23 ) { - PRINTF("\t0x%08x\n", val); - BITS(val, 31, 16, "dest y1"); - BITS(val, 15, 0, "dest x1"); -} + union { GLuint val; short field[2]; } BR22, BR23; -static void BR23( struct debug_stream *stream, - GLuint val ) -{ - PRINTF("\t0x%08x\n", val); - BITS(val, 31, 16, "dest y2"); - BITS(val, 15, 0, "dest x2"); + BR22.val = val22; + BR23.val = val23; + + PRINTF("\t0x%08x\n", val22); + BITS(val22, 31, 16, "dest y1"); + BITS(val22, 15, 0, "dest x1"); + + PRINTF("\t0x%08x\n", val23); + BITS(val23, 31, 16, "dest y2"); + BITS(val23, 15, 0, "dest x2"); + + /* The blit engine may produce unexpected results when these aren't met */ + assert(BR22.field[0] < BR23.field[0]); + assert(BR22.field[1] < BR23.field[1]); } static void BR09( struct debug_stream *stream, @@ -436,8 +441,8 @@ static GLboolean debug_copy_blit( struct debug_stream *stream, PRINTF("\t0x%08x\n", ptr[j++]); BR13(stream, ptr[j++]); - BR22(stream, ptr[j++]); - BR23(stream, ptr[j++]); + BR2223(stream, ptr[j], ptr[j+1]); + j += 2; BR09(stream, ptr[j++]); BR26(stream, ptr[j++]); BR11(stream, ptr[j++]); @@ -459,8 +464,8 @@ static GLboolean debug_color_blit( struct debug_stream *stream, PRINTF("\t0x%08x\n", ptr[j++]); BR13(stream, ptr[j++]); - BR22(stream, ptr[j++]); - BR23(stream, ptr[j++]); + BR2223(stream, ptr[j], ptr[j+1]); + j += 2; BR09(stream, ptr[j++]); BR16(stream, ptr[j++]); -- cgit v1.2.3 From 2667e5642ffb2081450a167af1213899280da42d Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 22 Oct 2007 17:50:17 -0600 Subject: don't apply ColorMask to main gc --- src/mesa/drivers/x11/xm_dd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index c8546236fbf..4c8bf5f656d 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -159,7 +159,6 @@ index_mask( GLcontext *ctx, GLuint mask ) m = (unsigned long) mask; } XMesaSetPlaneMask( xmesa->display, xmbuf->cleargc, m ); - XMesaSetPlaneMask( xmesa->display, xmbuf->gc, m ); } } @@ -191,7 +190,6 @@ color_mask(GLcontext *ctx, if (bmask) m |= GET_BLUEMASK(xmesa->xm_visual); } XMesaSetPlaneMask( xmesa->display, xmbuf->cleargc, m ); - XMesaSetPlaneMask( xmesa->display, xmbuf->gc, m ); } } @@ -450,13 +448,13 @@ xmesa_DrawPixels_8R8G8B( GLcontext *ctx, ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */ ctx->Pixel.ZoomX == 1.0 && /* no zooming */ ctx->Pixel.ZoomY == 1.0 && - xrb->pixmap && + xrb->pixmap && /* drawing to pixmap or window */ xrb->Base.AlphaBits == 0) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); XMesaDisplay *dpy = xmesa->xm_visual->display; - const XMesaGC gc = xmbuf->gc; + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ int dstX = x; int dstY = y; int w = width; @@ -551,7 +549,7 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, const SWcontext *swrast = SWRAST_CONTEXT( ctx ); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - const XMesaGC gc = xmbuf->gc; + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ ASSERT(dpy); ASSERT(gc); @@ -560,7 +558,7 @@ xmesa_DrawPixels_5R6G5B( GLcontext *ctx, if (swrast->NewState) _swrast_validate_derived( ctx ); - if (xrb->pixmap && + if (xrb->pixmap && /* drawing to pixmap or window */ format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 && !ctx->Color.DitherFlag && /* no dithering */ @@ -651,7 +649,8 @@ xmesa_CopyPixels( GLcontext *ctx, const XMesaContext xmesa = XMESA_CONTEXT(ctx); const SWcontext *swrast = SWRAST_CONTEXT( ctx ); XMesaDisplay *dpy = xmesa->xm_visual->display; - const XMesaGC gc = ((XMesaBuffer) ctx->DrawBuffer)->gc; + XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); + const XMesaGC gc = xmbuf->cleargc; /* effected by glColorMask */ struct xmesa_renderbuffer *srcXrb = xmesa_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer->Wrapped); struct xmesa_renderbuffer *dstXrb -- cgit v1.2.3 From 2a8e9bb00f8cf830783cbc20a2a57f31b19491ea Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 23 Oct 2007 10:24:53 -0600 Subject: bump up MAX_INSTRUCTIONS and add an assertion to catch emitting too many instructions --- src/mesa/main/texenvprogram.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 9c84da985e0..935eb44a321 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -35,10 +35,11 @@ #include "texenvprogram.h" /** - * According to Glean's texCombine test, no more than 21 instructions - * are needed. Allow a few extra just in case. + * This MAX is probably a bit generous, but that's OK. There can be + * up to four instructions per texture unit (TEX + 3 for combine), + * then there's fog and specular add. */ -#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 6) + 10) /* see bug 9829 */ +#define MAX_INSTRUCTIONS ((MAX_TEXTURE_UNITS * 4) + 12) #define DISASSEM (MESA_VERBOSE & VERBOSE_DISASSEM) @@ -476,7 +477,9 @@ emit_op(struct texenv_fragment_program *p, { GLuint nr = p->program->Base.NumInstructions++; struct prog_instruction *inst = &p->program->Base.Instructions[nr]; - + + assert(nr < MAX_INSTRUCTIONS); + _mesa_init_instructions(inst, 1); inst->Opcode = op; -- cgit v1.2.3 From c9d495c6f064aacd1e072033b9c17a83b8c37fa1 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 23 Oct 2007 10:55:24 -0600 Subject: properly init dst reg's CondMask/Swizzle fields --- src/mesa/main/texenvprogram.c | 4 ++-- src/mesa/tnl/t_vp_build.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 935eb44a321..38be0390841 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -461,8 +461,8 @@ static void emit_dst( struct prog_dst_register *dst, dst->File = ureg.file; dst->Index = ureg.idx; dst->WriteMask = mask; - dst->CondMask = 0; - dst->CondSwizzle = 0; + dst->CondMask = COND_TR; /* always pass cond test */ + dst->CondSwizzle = SWIZZLE_NOOP; } static struct prog_instruction * diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c index 6a6db06285e..b7bc1977237 100644 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@ -489,8 +489,8 @@ static void emit_dst( struct prog_dst_register *dst, dst->Index = reg.idx; /* allow zero as a shorthand for xyzw */ dst->WriteMask = mask ? mask : WRITEMASK_XYZW; - dst->CondMask = COND_TR; - dst->CondSwizzle = 0; + dst->CondMask = COND_TR; /* always pass cond test */ + dst->CondSwizzle = SWIZZLE_NOOP; dst->CondSrc = 0; dst->pad = 0; } @@ -513,7 +513,7 @@ static void debug_insn( struct prog_instruction *inst, const char *fn, static void emit_op3fn(struct tnl_program *p, - GLuint op, + enum prog_opcode op, struct ureg dest, GLuint mask, struct ureg src0, -- cgit v1.2.3 From e48f0b09abe42aa3393a492af07e53b76ad0ff3c Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 24 Oct 2007 11:37:05 -0600 Subject: Implement gl_PointCoord attribute for GLSL fragment shaders. Contains the normalized fragment position within a point sprite. --- src/mesa/shader/slang/slang_codegen.c | 6 +- src/mesa/shader/slang/slang_compile.c | 11 ++++ src/mesa/swrast/s_fog.c | 1 - src/mesa/swrast/s_fragprog.c | 1 + src/mesa/swrast/s_points.c | 117 +++++++++++++++++++--------------- src/mesa/swrast/s_span.c | 2 +- 6 files changed, 85 insertions(+), 53 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index d368009ca50..a44e42b6d6d 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -282,6 +282,8 @@ sampler_to_texture_index(const slang_type_specifier_type type) } +#define SWIZZLE_ZWWW MAKE_SWIZZLE4(SWIZZLE_Z, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W) + /** * Return the VERT_ATTRIB_* or FRAG_ATTRIB_* value that corresponds to * a vertex or fragment program input variable. Return -1 if the input @@ -316,9 +318,11 @@ _slang_input_index(const char *name, GLenum target, GLuint *swizzleOut) { "gl_FragCoord", FRAG_ATTRIB_WPOS, SWIZZLE_NOOP }, { "gl_Color", FRAG_ATTRIB_COL0, SWIZZLE_NOOP }, { "gl_SecondaryColor", FRAG_ATTRIB_COL1, SWIZZLE_NOOP }, - { "gl_FogFragCoord", FRAG_ATTRIB_FOGC, SWIZZLE_XXXX }, { "gl_TexCoord", FRAG_ATTRIB_TEX0, SWIZZLE_NOOP }, + /* note: we're packing several quantities into the fogcoord vector */ + { "gl_FogFragCoord", FRAG_ATTRIB_FOGC, SWIZZLE_XXXX }, { "gl_FrontFacing", FRAG_ATTRIB_FOGC, SWIZZLE_YYYY }, /*XXX*/ + { "gl_PointCoord", FRAG_ATTRIB_FOGC, SWIZZLE_ZWWW }, { NULL, 0, SWIZZLE_NOOP } }; GLuint i; diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 4e29e8dcc90..2be89a5ce05 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -1983,6 +1983,10 @@ static const byte slang_120_core_gc[] = { #include "library/slang_120_core_gc.h" }; +static const byte slang_120_fragment_gc[] = { +#include "library/slang_builtin_120_fragment_gc.h" +}; + static const byte slang_common_builtin_gc[] = { #include "library/slang_common_builtin_gc.h" }; @@ -2059,6 +2063,13 @@ compile_object(grammar * id, const char *source, slang_code_object * object, SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL, &object->builtin[SLANG_BUILTIN_COMMON], NULL)) return GL_FALSE; +#if FEATURE_ARB_shading_language_120 + if (!compile_binary(slang_120_fragment_gc, + &object->builtin[SLANG_BUILTIN_TARGET], + SLANG_UNIT_FRAGMENT_BUILTIN, infolog, NULL, + &object->builtin[SLANG_BUILTIN_COMMON], NULL)) + return GL_FALSE; +#endif } else if (type == SLANG_UNIT_VERTEX_SHADER) { if (!compile_binary(slang_vertex_builtin_gc, diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c index ed47964a66a..7b143f6e5bb 100644 --- a/src/mesa/swrast/s_fog.c +++ b/src/mesa/swrast/s_fog.c @@ -168,7 +168,6 @@ _swrast_fog_rgba_span( const GLcontext *ctx, SWspan *span ) GLfloat rFog, gFog, bFog; ASSERT(swrast->_FogEnabled); - ASSERT(swrast->_ActiveAttribMask & FRAG_BIT_FOGC); ASSERT(span->arrayMask & SPAN_RGBA); /* compute (scaled) fog color */ diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 14c9868c180..6656ebc0d0c 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -113,6 +113,7 @@ init_machine(GLcontext *ctx, struct gl_program_machine *machine, machine->DerivY = (GLfloat (*)[4]) span->attrStepY; machine->NumDeriv = FRAG_ATTRIB_MAX; + /* if running a GLSL program (not ARB_fragment_program) */ if (ctx->Shader.CurrentProgram) { /* Store front/back facing value in register FOGC.Y */ machine->Attribs[FRAG_ATTRIB_FOGC][col][1] = (GLfloat) ctx->_Facing; diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c index d54adc8fd18..ce73365a4ea 100644 --- a/src/mesa/swrast/s_points.c +++ b/src/mesa/swrast/s_points.c @@ -55,7 +55,7 @@ sprite_point(GLcontext *ctx, const SWvertex *vert) SWcontext *swrast = SWRAST_CONTEXT(ctx); SWspan span; GLfloat size; - GLuint tCoords[MAX_TEXTURE_COORD_UNITS]; + GLuint tCoords[MAX_TEXTURE_COORD_UNITS + 1]; GLuint numTcoords = 0; GLfloat t0, dtdy; @@ -99,57 +99,71 @@ sprite_point(GLcontext *ctx, const SWvertex *vert) span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; - ATTRIB_LOOP_BEGIN - if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0) { - const GLuint u = attr - FRAG_ATTRIB_TEX0; - /* a texcoord */ - if (ctx->Point.CoordReplace[u]) { - GLfloat s, r, dsdx; - - s = 0.0; - dsdx = 1.0 / size; - - if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) { - t0 = 0.0; - dtdy = 1.0 / size; - } - else { - /* GL_UPPER_LEFT */ - t0 = 1.0; - dtdy = -1.0 / size; - } - tCoords[numTcoords++] = attr; - - if (ctx->Point.SpriteRMode == GL_ZERO) - r = 0.0F; - else if (ctx->Point.SpriteRMode == GL_S) - r = vert->attrib[attr][0]; - else /* GL_R */ - r = vert->attrib[attr][2]; - - span.attrStart[attr][0] = s; - span.attrStart[attr][1] = 0.0; /* overwritten below */ - span.attrStart[attr][2] = r; - span.attrStart[attr][3] = 1.0; - - span.attrStepX[attr][0] = dsdx; - span.attrStepX[attr][1] = 0.0; - span.attrStepX[attr][2] = 0.0; - span.attrStepX[attr][3] = 0.0; - - span.attrStepY[attr][0] = 0.0; - span.attrStepY[attr][1] = dtdy; - span.attrStepY[attr][2] = 0.0; - span.attrStepY[attr][3] = 0.0; + { + GLfloat s, r, dsdx; + + /* texcoord / pointcoord interpolants */ + s = 0.0; + dsdx = 1.0 / size; + if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT) { + t0 = 0.0; + dtdy = 1.0 / size; + } + else { + /* GL_UPPER_LEFT */ + t0 = 1.0; + dtdy = -1.0 / size; + } + ATTRIB_LOOP_BEGIN + if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0) { + const GLuint u = attr - FRAG_ATTRIB_TEX0; + /* a texcoord */ + if (ctx->Point.CoordReplace[u]) { + tCoords[numTcoords++] = attr; + + if (ctx->Point.SpriteRMode == GL_ZERO) + r = 0.0F; + else if (ctx->Point.SpriteRMode == GL_S) + r = vert->attrib[attr][0]; + else /* GL_R */ + r = vert->attrib[attr][2]; + + span.attrStart[attr][0] = s; + span.attrStart[attr][1] = 0.0; /* overwritten below */ + span.attrStart[attr][2] = r; + span.attrStart[attr][3] = 1.0; + + span.attrStepX[attr][0] = dsdx; + span.attrStepX[attr][1] = 0.0; + span.attrStepX[attr][2] = 0.0; + span.attrStepX[attr][3] = 0.0; + + span.attrStepY[attr][0] = 0.0; + span.attrStepY[attr][1] = dtdy; + span.attrStepY[attr][2] = 0.0; + span.attrStepY[attr][3] = 0.0; + + continue; + } + } + else if (attr == FRAG_ATTRIB_FOGC) { + /* GLSL gl_PointCoord is stored in fog.zw */ + span.attrStart[FRAG_ATTRIB_FOGC][2] = 0.0; + span.attrStart[FRAG_ATTRIB_FOGC][3] = 0.0; /* t0 set below */ + span.attrStepX[FRAG_ATTRIB_FOGC][2] = dsdx; + span.attrStepX[FRAG_ATTRIB_FOGC][3] = 0.0; + span.attrStepY[FRAG_ATTRIB_FOGC][2] = 0.0; + span.attrStepY[FRAG_ATTRIB_FOGC][3] = dtdy; + tCoords[numTcoords++] = FRAG_ATTRIB_FOGC; continue; } - } - /* use vertex's texcoord/attrib */ - COPY_4V(span.attrStart[attr], vert->attrib[attr]); - ASSIGN_4V(span.attrStepX[attr], 0, 0, 0, 0); - ASSIGN_4V(span.attrStepY[attr], 0, 0, 0, 0); - ATTRIB_LOOP_END + /* use vertex's texcoord/attrib */ + COPY_4V(span.attrStart[attr], vert->attrib[attr]); + ASSIGN_4V(span.attrStepX[attr], 0, 0, 0, 0); + ASSIGN_4V(span.attrStepY[attr], 0, 0, 0, 0); + ATTRIB_LOOP_END; + } /* compute pos, bounds and render */ { @@ -184,7 +198,10 @@ sprite_point(GLcontext *ctx, const SWvertex *vert) GLuint i; /* setup texcoord T for this row */ for (i = 0; i < numTcoords; i++) { - span.attrStart[tCoords[i]][1] = tcoord; + if (tCoords[i] == FRAG_ATTRIB_FOGC) + span.attrStart[FRAG_ATTRIB_FOGC][3] = tcoord; + else + span.attrStart[tCoords[i]][1] = tcoord; } /* these might get changed by span clipping */ diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index f1e58bd3d81..000e192a4a5 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1183,7 +1183,7 @@ shade_texture_span(GLcontext *ctx, SWspan *span) if (span->primitive == GL_BITMAP && span->array->ChanType != GL_FLOAT) { convert_color_type(span, GL_FLOAT, 0); } - if (span->primitive != GL_POINT) { + if (span->primitive != GL_POINT || ctx->Point.PointSprite) { /* for points, we populated the arrays already */ interpolate_active_attribs(ctx, span, ~0); } -- cgit v1.2.3 From 5e9272c748fba836c716346f1c527e7d139083a4 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 24 Oct 2007 12:43:02 -0600 Subject: add to git --- .../slang/library/slang_builtin_120_common_gc.h | 104 +++++++++++++++++++++ .../slang/library/slang_builtin_120_fragment_gc.h | 5 + 2 files changed, 109 insertions(+) create mode 100644 src/mesa/shader/slang/library/slang_builtin_120_common_gc.h create mode 100644 src/mesa/shader/slang/library/slang_builtin_120_fragment_gc.h (limited to 'src/mesa') diff --git a/src/mesa/shader/slang/library/slang_builtin_120_common_gc.h b/src/mesa/shader/slang/library/slang_builtin_120_common_gc.h new file mode 100644 index 00000000000..fc1a9442177 --- /dev/null +++ b/src/mesa/shader/slang/library/slang_builtin_120_common_gc.h @@ -0,0 +1,104 @@ + +/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */ +/* slang_builtin_120_common.gc */ + +3,1,0,26,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,26,109,0,0,1,0,0,26,110,0, +0,0,1,8,58,109,97,116,50,120,51,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10, +49,0,57,18,110,0,16,10,49,0,57,48,0,0,0,0,1,0,28,0,109,97,116,114,105,120,67,111,109,112,77,117, +108,116,0,1,0,0,28,109,0,0,1,0,0,28,110,0,0,0,1,8,58,109,97,116,50,120,52,0,18,109,0,16,8,48,0,57, +18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,0,0,0,1,0,27,0,109, +97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,27,109,0,0,1,0,0,27,110,0,0,0,1,8,58,109, +97,116,51,120,50,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110, +0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,0,0,0,1,0,30,0,109,97,116, +114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,30,109,0,0,1,0,0,30,110,0,0,0,1,8,58,109,97,116, +51,120,52,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10, +49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,0,0,0,1,0,29,0,109,97,116,114,105, +120,67,111,109,112,77,117,108,116,0,1,0,0,29,109,0,0,1,0,0,29,110,0,0,0,1,8,58,109,97,116,52,120, +50,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48,0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0, +57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57,48,0,18,109,0,16,10,51,0,57,18,110,0,16,10, +51,0,57,48,0,0,0,0,1,0,31,0,109,97,116,114,105,120,67,111,109,112,77,117,108,116,0,1,0,0,31,109,0, +0,1,0,0,31,110,0,0,0,1,8,58,109,97,116,52,120,51,0,18,109,0,16,8,48,0,57,18,110,0,16,8,48,0,57,48, +0,18,109,0,16,10,49,0,57,18,110,0,16,10,49,0,57,48,0,18,109,0,16,10,50,0,57,18,110,0,16,10,50,0,57, +48,0,18,109,0,16,10,51,0,57,18,110,0,16,10,51,0,57,48,0,0,0,0,1,0,13,0,111,117,116,101,114,80,114, +111,100,117,99,116,0,1,0,0,10,99,0,0,1,0,0,10,114,0,0,0,1,8,58,109,97,116,50,0,18,99,0,59,120,0,18, +114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48, +0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,0,0,0,1,0,14,0,111,117,116,101,114,80,114,111,100,117,99, +116,0,1,0,0,11,99,0,0,1,0,0,11,114,0,0,0,1,8,58,109,97,116,51,0,18,99,0,59,120,0,18,114,0,59,120,0, +48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59, +120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59, +121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0, +59,122,0,18,114,0,59,122,0,48,0,0,0,0,1,0,15,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0, +0,12,99,0,0,1,0,0,12,114,0,0,0,1,8,58,109,97,116,52,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18, +99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,119,0,18, +114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48, +0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,119,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0, +18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0, +48,0,18,99,0,59,119,0,18,114,0,59,122,0,48,0,18,99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59, +121,0,18,114,0,59,119,0,48,0,18,99,0,59,122,0,18,114,0,59,119,0,48,0,18,99,0,59,119,0,18,114,0,59, +119,0,48,0,0,0,0,1,0,26,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,11,99,0,0,1,0,0,10, +114,0,0,0,1,8,58,109,97,116,50,120,51,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0, +18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0, +48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,0,0,0,1,0,27, +0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,10,99,0,0,1,0,0,11,114,0,0,0,1,8,58,109,97, +116,51,120,50,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18, +99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18, +114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,0,0,0,1,0,28,0,111,117,116,101,114,80, +114,111,100,117,99,116,0,1,0,0,12,99,0,0,1,0,0,10,114,0,0,0,1,8,58,109,97,116,50,120,52,0,18,99,0, +59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,122,0,18,114,0, +59,120,0,48,0,18,99,0,59,119,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18, +99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,119,0,18, +114,0,59,121,0,48,0,0,0,0,1,0,29,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,10,99,0,0, +1,0,0,12,114,0,0,0,1,8,58,109,97,116,52,120,50,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0, +59,121,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18,99,0,59,121,0,18,114,0, +59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18, +99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,121,0,18,114,0,59,119,0,48,0,0,0,0,1,0,30,0,111, +117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,12,99,0,0,1,0,0,11,114,0,0,0,1,8,58,109,97,116, +51,120,52,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0,59,120,0,48,0,18,99, +0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,119,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114, +0,59,121,0,48,0,18,99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18, +99,0,59,119,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18,114,0,59,122,0,48,0,18,99,0,59,121,0,18, +114,0,59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0,48,0,18,99,0,59,119,0,18,114,0,59,122,0,48, +0,0,0,0,1,0,31,0,111,117,116,101,114,80,114,111,100,117,99,116,0,1,0,0,11,99,0,0,1,0,0,12,114,0,0, +0,1,8,58,109,97,116,52,120,51,0,18,99,0,59,120,0,18,114,0,59,120,0,48,0,18,99,0,59,121,0,18,114,0, +59,120,0,48,0,18,99,0,59,122,0,18,114,0,59,120,0,48,0,18,99,0,59,120,0,18,114,0,59,121,0,48,0,18, +99,0,59,121,0,18,114,0,59,121,0,48,0,18,99,0,59,122,0,18,114,0,59,121,0,48,0,18,99,0,59,120,0,18, +114,0,59,122,0,48,0,18,99,0,59,121,0,18,114,0,59,122,0,48,0,18,99,0,59,122,0,18,114,0,59,122,0,48, +0,18,99,0,59,120,0,18,114,0,59,119,0,48,0,18,99,0,59,121,0,18,114,0,59,119,0,48,0,18,99,0,59,122,0, +18,114,0,59,119,0,48,0,0,0,0,1,0,13,0,116,114,97,110,115,112,111,115,101,0,1,0,0,13,109,0,0,0,1,8, +58,109,97,116,50,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16, +8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,0,0,0,1,0,14,0,116,114,97,110,115,112,111, +115,101,0,1,0,0,14,109,0,0,0,1,8,58,109,97,116,51,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16, +10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0, +16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109, +0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57,59,122,0,0,0,0,0,1,0,15,0,116,114,97,110,115,112, +111,115,101,0,1,0,0,15,109,0,0,0,1,8,58,109,97,116,52,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0, +16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,10,51,0,57,59,120,0,0,18, +109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0, +18,109,0,16,10,51,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0,57,59,122,0, +0,18,109,0,16,10,50,0,57,59,122,0,0,18,109,0,16,10,51,0,57,59,122,0,0,18,109,0,16,8,48,0,57,59,119, +0,0,18,109,0,16,10,49,0,57,59,119,0,0,18,109,0,16,10,50,0,57,59,119,0,0,18,109,0,16,10,51,0,57,59, +119,0,0,0,0,0,1,0,26,0,116,114,97,110,115,112,111,115,101,0,1,0,0,27,109,0,0,0,1,8,58,109,97,116, +50,120,51,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0, +57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50, +0,57,59,121,0,0,0,0,0,1,0,27,0,116,114,97,110,115,112,111,115,101,0,1,0,0,26,109,0,0,0,1,8,58,109, +97,116,51,120,50,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16, +8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0, +16,10,49,0,57,59,122,0,0,0,0,0,1,0,28,0,116,114,97,110,115,112,111,115,101,0,1,0,0,29,109,0,0,0,1, +8,58,109,97,116,50,120,52,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18, +109,0,16,10,50,0,57,59,120,0,0,18,109,0,16,10,51,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0, +18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59,121,0,0,18,109,0,16,10,51,0,57,59,121, +0,0,0,0,0,1,0,29,0,116,114,97,110,115,112,111,115,101,0,1,0,0,28,109,0,0,0,1,8,58,109,97,116,52, +120,50,0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,8,48,0,57, +59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0, +57,59,122,0,0,18,109,0,16,8,48,0,57,59,119,0,0,18,109,0,16,10,49,0,57,59,119,0,0,0,0,0,1,0,30,0, +116,114,97,110,115,112,111,115,101,0,1,0,0,31,109,0,0,0,1,8,58,109,97,116,51,120,52,0,18,109,0,16, +8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120,0,0,18,109,0, +16,10,51,0,57,59,120,0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109, +0,16,10,50,0,57,59,121,0,0,18,109,0,16,10,51,0,57,59,121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18, +109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57,59,122,0,0,18,109,0,16,10,51,0,57,59,122,0,0, +0,0,0,1,0,31,0,116,114,97,110,115,112,111,115,101,0,1,0,0,30,109,0,0,0,1,8,58,109,97,116,52,120,51, +0,18,109,0,16,8,48,0,57,59,120,0,0,18,109,0,16,10,49,0,57,59,120,0,0,18,109,0,16,10,50,0,57,59,120, +0,0,18,109,0,16,8,48,0,57,59,121,0,0,18,109,0,16,10,49,0,57,59,121,0,0,18,109,0,16,10,50,0,57,59, +121,0,0,18,109,0,16,8,48,0,57,59,122,0,0,18,109,0,16,10,49,0,57,59,122,0,0,18,109,0,16,10,50,0,57, +59,122,0,0,18,109,0,16,8,48,0,57,59,119,0,0,18,109,0,16,10,49,0,57,59,119,0,0,18,109,0,16,10,50,0, +57,59,119,0,0,0,0,0,0 diff --git a/src/mesa/shader/slang/library/slang_builtin_120_fragment_gc.h b/src/mesa/shader/slang/library/slang_builtin_120_fragment_gc.h new file mode 100644 index 00000000000..2400b273d82 --- /dev/null +++ b/src/mesa/shader/slang/library/slang_builtin_120_fragment_gc.h @@ -0,0 +1,5 @@ + +/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE FOLLOWING FILE: */ +/* slang_builtin_120_fragment.gc */ + +3,2,2,3,10,1,103,108,95,80,111,105,110,116,67,111,111,114,100,0,0,0,0 -- cgit v1.2.3 From 26479fa3b3a7c911617192c56e54fbe298fdd7f3 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 24 Oct 2007 16:24:06 -0600 Subject: don't build x86, x86-64 dirs if not needed --- src/mesa/Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/Makefile b/src/mesa/Makefile index a47cd4c023d..3722593f21b 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -153,8 +153,13 @@ depend: $(ALL_SOURCES) subdirs: - @ (cd x86 ; $(MAKE)) - @ (cd x86-64 ; $(MAKE)) + @ if [ `echo $(ASM_FLAGS) | grep USE_X86_ASM` ] ; then \ + (cd x86 ; $(MAKE)) ; \ + fi + @ if [ `echo $(ASM_FLAGS) | grep USE_X86_64_ASM` ] ; then \ + (cd x86 ; $(MAKE)) ; \ + (cd x86-64 ; $(MAKE)) ; \ + fi install: default gl.pc -- cgit v1.2.3 From 6dcf65ff0d6fcea9c7e3ae51d51eac6f9a030e47 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 25 Oct 2007 11:10:10 -0600 Subject: simplify/fix the ASM_FLAGS tests (bug 12931) --- src/mesa/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 3722593f21b..8e35efb7dca 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -153,10 +153,10 @@ depend: $(ALL_SOURCES) subdirs: - @ if [ `echo $(ASM_FLAGS) | grep USE_X86_ASM` ] ; then \ + @ if echo $(ASM_FLAGS) | grep USE_X86_ASM ; then \ (cd x86 ; $(MAKE)) ; \ fi - @ if [ `echo $(ASM_FLAGS) | grep USE_X86_64_ASM` ] ; then \ + @ if echo $(ASM_FLAGS) | grep USE_X86_64_ASM ; then \ (cd x86 ; $(MAKE)) ; \ (cd x86-64 ; $(MAKE)) ; \ fi -- cgit v1.2.3 From ff042bfdeeeb0a3d658d5ab1dbdcac7b67aac0f8 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 25 Oct 2007 14:46:35 -0600 Subject: use grep -q --- src/mesa/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 8e35efb7dca..77bb7be4806 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -153,10 +153,10 @@ depend: $(ALL_SOURCES) subdirs: - @ if echo $(ASM_FLAGS) | grep USE_X86_ASM ; then \ + @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \ (cd x86 ; $(MAKE)) ; \ fi - @ if echo $(ASM_FLAGS) | grep USE_X86_64_ASM ; then \ + @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \ (cd x86 ; $(MAKE)) ; \ (cd x86-64 ; $(MAKE)) ; \ fi -- cgit v1.2.3 From b59dbd822f353cbf0db404f14c2721c79cde79fc Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Sun, 28 Oct 2007 20:07:37 +0000 Subject: Only set R_MODE with NV_point_sprite --- src/mesa/main/attrib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 3199c9b426b..07ec285eeb7 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1102,7 +1102,8 @@ _mesa_PopAttrib(void) (GLint) point->CoordReplace[u]); } _mesa_set_enable(ctx, GL_POINT_SPRITE_NV,point->PointSprite); - _mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV, + if (ctx->Extensions.NV_point_sprite) + _mesa_PointParameteriNV(GL_POINT_SPRITE_R_MODE_NV, ctx->Point.SpriteRMode); _mesa_PointParameterfEXT(GL_POINT_SPRITE_COORD_ORIGIN, (GLfloat)ctx->Point.SpriteOrigin); -- cgit v1.2.3 From 40133487dbdd14456a8a4f6a5716f57a36eb1ea7 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 29 Oct 2007 10:01:15 -0600 Subject: disable ctx->Driver.NewProgram() call in _mesa_new_program() This was causing infinite recursive calls w/ software drivers. All vertex/fragment shaders should be allocated by calling ctx->Driver.NewProgram(), not by calling _mesa_new_program(). --- src/mesa/shader/program.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 11330e24322..43e6fb0be02 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -285,8 +285,13 @@ _mesa_init_vertex_program( GLcontext *ctx, struct gl_vertex_program *prog, struct gl_program * _mesa_new_program(GLcontext *ctx, GLenum target, GLuint id) { +#if 0 + /* This was added by Nan hai Zou but disabled by BrianP since it + * causes infinite recursive calls. + */ if (ctx->Driver.NewProgram) return ctx->Driver.NewProgram(ctx, target, id); +#endif switch (target) { case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */ return _mesa_init_vertex_program(ctx, CALLOC_STRUCT(gl_vertex_program), -- cgit v1.2.3 From 38fdb47d26055e19d50cd407266b56ed4317ae0a Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Mon, 29 Oct 2007 11:56:31 -0700 Subject: Refactor and fix core vblank support Consolidate support for synchronizing to and retrieving vblank counters. Also fix the core vblank code to return monotonic MSC counters, which are required by some GLX extensions. Adding support for multiple pipes to a low level driver is fairly easy, the Intel 965 driver provides simple example code (see intel_buffers.c:intelWindowMoved()). The new code bumps the media stream counter extension version to 2 and adds a new getDrawableMSC callback. This callback takes a drawablePrivate pointer, which is used to calculate the MSC value seen by clients based on the actual vblank counter(s) returned from the kernel. The new drawable private fields are as follows: - vblSeq - used for tracking vblank counts for buffer swapping - vblFlags - flags (e.g. current pipe), updated by low level driver - msc_base - MSC counter from the last time the current pipe changed - vblank_base - kernel DRM vblank counter from the last time the pipe changed Using the above variables, the core vblank code (in vblank.c) can calculate a monotonic MSC value. The low level DRI drivers are responsible for updating the current pipe (by setting VBLANK_FLAG_SECONDARY for example in vblFlags) along with msc_base and vblank_base whenever the pipe associated with a given drawable changes (again, see intelWindowMoved for an example of this). Drivers should fill in the GetDrawableMSC DriverAPIRec field to point to driDrawableGetMSC32 and add code for pipe switching as outlined above to fully support the new scheme. --- include/GL/internal/dri_interface.h | 14 +++- src/glx/x11/glxcmds.c | 43 +++++++----- src/mesa/drivers/dri/common/dri_util.c | 14 +++- src/mesa/drivers/dri/common/dri_util.h | 34 ++++++++++ src/mesa/drivers/dri/common/vblank.c | 94 +++++++++++++++++++++----- src/mesa/drivers/dri/common/vblank.h | 6 +- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 1 + src/mesa/drivers/dri/i810/i810screen.c | 1 + src/mesa/drivers/dri/i915/intel_buffers.c | 55 +++++++++------ src/mesa/drivers/dri/i915/intel_context.c | 16 ++--- src/mesa/drivers/dri/i915/intel_fbo.h | 2 - src/mesa/drivers/dri/i915/intel_screen.c | 1 + src/mesa/drivers/dri/i965/intel_blit.c | 3 +- src/mesa/drivers/dri/i965/intel_buffers.c | 46 +++++++++++++ src/mesa/drivers/dri/i965/intel_context.c | 17 +++-- src/mesa/drivers/dri/i965/intel_context.h | 5 -- src/mesa/drivers/dri/i965/intel_screen.c | 1 + src/mesa/drivers/dri/mach64/mach64_context.c | 6 +- src/mesa/drivers/dri/mach64/mach64_context.h | 2 - src/mesa/drivers/dri/mach64/mach64_ioctl.c | 4 +- src/mesa/drivers/dri/mach64/mach64_ioctl.h | 2 +- src/mesa/drivers/dri/mach64/mach64_screen.c | 1 + src/mesa/drivers/dri/mga/mga_xmesa.c | 8 ++- src/mesa/drivers/dri/mga/mgacontext.h | 5 -- src/mesa/drivers/dri/mga/mgaioctl.c | 3 +- src/mesa/drivers/dri/nouveau/nouveau_context.c | 2 +- src/mesa/drivers/dri/nouveau/nouveau_context.h | 4 -- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 1 + src/mesa/drivers/dri/r128/r128_context.c | 6 +- src/mesa/drivers/dri/r128/r128_context.h | 5 -- src/mesa/drivers/dri/r128/r128_ioctl.c | 8 +-- src/mesa/drivers/dri/r128/r128_ioctl.h | 4 +- src/mesa/drivers/dri/r128/r128_screen.c | 1 + src/mesa/drivers/dri/r200/r200_context.c | 6 +- src/mesa/drivers/dri/r200/r200_context.h | 5 +- src/mesa/drivers/dri/r200/r200_ioctl.c | 8 +-- src/mesa/drivers/dri/r200/r200_ioctl.h | 4 +- src/mesa/drivers/dri/r300/radeon_context.c | 7 +- src/mesa/drivers/dri/r300/radeon_context.h | 5 +- src/mesa/drivers/dri/r300/radeon_ioctl.c | 8 +-- src/mesa/drivers/dri/r300/radeon_ioctl.h | 4 +- src/mesa/drivers/dri/radeon/radeon_context.c | 3 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 2 + src/mesa/drivers/dri/sis/sis_screen.c | 1 + src/mesa/drivers/dri/tdfx/tdfx_screen.c | 1 + src/mesa/drivers/dri/unichrome/via_context.c | 6 +- src/mesa/drivers/dri/unichrome/via_context.h | 3 - src/mesa/drivers/dri/unichrome/via_ioctl.c | 14 ++-- src/mesa/drivers/dri/unichrome/via_ioctl.h | 4 +- src/mesa/drivers/dri/unichrome/via_screen.c | 1 + 50 files changed, 332 insertions(+), 165 deletions(-) (limited to 'src/mesa') diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index e7fbf8e8b8b..1b637afaf38 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -170,7 +170,7 @@ struct __DRIframeTrackingExtensionRec { * Used by drivers that implement the GLX_SGI_video_sync extension. */ #define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter" -#define __DRI_MEDIA_STREAM_COUNTER_VERSION 1 +#define __DRI_MEDIA_STREAM_COUNTER_VERSION 2 struct __DRImediaStreamCounterExtensionRec { __DRIextension base; @@ -189,6 +189,18 @@ struct __DRImediaStreamCounterExtensionRec { int (*waitForMSC)(__DRIdrawable *drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc, int64_t * sbc); + + /** + * Like the screen version of getMSC, but also takes a drawable so that + * the appropriate pipe's counter can be retrieved. + * + * Get the number of vertical refreshes since some point in time before + * this function was first called (i.e., system start up). + * + * \since Internal API version 2 + */ + int (*getDrawableMSC)(__DRIscreen *screen, void *drawablePrivate, + int64_t *msc); }; diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index 707e398d1d6..7e8a0c146d5 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1941,13 +1941,24 @@ static int __glXGetVideoSyncSGI(unsigned int *count) if ( (gc != NULL) && gc->isDirect ) { __GLXscreenConfigs * const psc = GetGLXScreenConfigs( gc->currentDpy, gc->screen ); - if (psc->msc != NULL && psc->driScreen.private != NULL) { - int ret; - int64_t temp; - - ret = psc->msc->getMSC(&psc->driScreen, &temp); - *count = (unsigned) temp; - return (ret == 0) ? 0 : GLX_BAD_CONTEXT; + if ( psc->msc && psc->driScreen.private ) { + __DRIdrawable * const pdraw = + GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); + int64_t temp; + int ret; + + /* + * Try to use getDrawableMSC first so we get the right + * counter... + */ + if (psc->msc->base.version >= 2 && psc->msc->getDrawableMSC) + ret = (*psc->msc->getDrawableMSC)( &psc->driScreen, + pdraw->private, + & temp); + else + ret = (*psc->msc->getMSC)( &psc->driScreen, & temp); + *count = (unsigned) temp; + return (ret == 0) ? 0 : GLX_BAD_CONTEXT; } } #else @@ -1970,16 +1981,14 @@ static int __glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count if (psc->msc != NULL && psc->driScreen.private ) { __DRIdrawable * const pdraw = GetDRIDrawable(gc->currentDpy, gc->currentDrawable, NULL); - if (pdraw != NULL) { - int ret; - int64_t msc; - int64_t sbc; - - ret = (*psc->msc->waitForMSC)(pdraw, 0, - divisor, remainder, &msc, &sbc); - *count = (unsigned) msc; - return (ret == 0) ? 0 : GLX_BAD_CONTEXT; - } + int ret; + int64_t msc; + int64_t sbc; + + ret = (*psc->msc->waitForMSC)(pdraw, 0, divisor, remainder, &msc, + &sbc); + *count = (unsigned) msc; + return (ret == 0) ? 0 : GLX_BAD_CONTEXT; } } #else diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index d59ea0ddad0..2e2e64c4d18 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -356,10 +356,18 @@ static void driSwapBuffers(__DRIdrawable *drawable) &rect, 1, GL_TRUE); } +static int driDrawableGetMSC( __DRIscreen *screen, void *drawablePrivate, + int64_t *msc ) +{ + __DRIscreenPrivate *sPriv = screen->private; + + return sPriv->DriverAPI.GetDrawableMSC( sPriv, drawablePrivate, msc ); +} + /** * Called directly from a number of higher-level GLX functions. */ -static int driGetMSC( __DRIscreen *screen, int64_t *msc ) +static int driGetMSC( __DRIscreen *screen, void *drawablePrivate, int64_t *msc ) { __DRIscreenPrivate *sPriv = screen->private; @@ -396,6 +404,7 @@ const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = { { __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION }, driGetMSC, driWaitForMSC, + driDrawableGetMSC, }; static void driCopySubBuffer(__DRIdrawable *drawable, @@ -471,6 +480,8 @@ static void *driCreateNewDrawable(__DRIscreen *screen, pdp->numBackClipRects = 0; pdp->pClipRects = NULL; pdp->pBackClipRects = NULL; + pdp->vblSeq = 0; + pdp->vblFlags = 0; psp = (__DRIscreenPrivate *)screen->private; pdp->driScreenPriv = psp; @@ -485,6 +496,7 @@ static void *driCreateNewDrawable(__DRIscreen *screen, pdraw->private = pdp; pdraw->destroyDrawable = driDestroyDrawable; pdraw->swapBuffers = driSwapBuffers; /* called by glXSwapBuffers() */ + pdp->msc_base = 0; /* This special default value is replaced with the configured * default value when the drawable is first bound to a direct diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 91992a9a242..def07758398 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -206,6 +206,14 @@ struct __DriverAPIRec { */ void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); + + /** + * New version of GetMSC so we can pass drawable data to the low level + * DRM driver (e.g. pipe info). + */ + int (*GetDrawableMSC) ( __DRIscreenPrivate * priv, + __DRIdrawablePrivate *drawablePrivate, + int64_t *count); }; @@ -317,6 +325,32 @@ struct __DRIdrawablePrivateRec { drm_clip_rect_t *pBackClipRects; /*@}*/ + /** + * \name Vertical blank tracking information + * Used for waiting on vertical blank events. + */ + /*@{*/ + unsigned int vblSeq; + unsigned int vblFlags; + /*@}*/ + + /** + * \name Monotonic MSC tracking + * + * Low level driver is responsible for updating msc_base and + * vblSeq values so that higher level code can calculate + * a new msc value or msc target for a WaitMSC call. The new value + * will be: + * msc = msc_base + get_vblank_count() - vblank_base; + * + * And for waiting on a value, core code will use: + * actual_target = target_msc - msc_base + vblank_base; + */ + /*@{*/ + int64_t vblank_base; + int64_t msc_base; + /*@}*/ + /** * Pointer to context to which this drawable is currently bound. */ diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index 3b5acfecb12..05964404632 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -35,6 +35,16 @@ #include "vblank.h" #include "xmlpool.h" +static unsigned int msc_to_vblank(__DRIdrawablePrivate * dPriv, int64_t msc) +{ + return (unsigned int)(msc - dPriv->msc_base + dPriv->vblank_base); +} + +static int64_t vblank_to_msc(__DRIdrawablePrivate * dPriv, unsigned int vblank) +{ + return (int64_t)(vblank - dPriv->vblank_base + dPriv->msc_base); +} + /****************************************************************************/ /** @@ -42,7 +52,7 @@ * * Stores the 64-bit count of vertical refreshes since some (arbitrary) * point in time in \c count. Unless the value wraps around, which it - * may, it will never decrease. + * may, it will never decrease for a given drawable. * * \warning This function is called from \c glXGetVideoSyncSGI, which expects * a \c count of type \c unsigned (32-bit), and \c glXGetSyncValuesOML, which @@ -50,11 +60,14 @@ * currently always returns a \c sequence of type \c unsigned. * * \param priv Pointer to the DRI screen private struct. + * \param dPriv Pointer to the DRI drawable private struct * \param count Storage to hold MSC counter. * \return Zero is returned on success. A negative errno value * is returned on failure. */ -int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ) +int driDrawableGetMSC32( __DRIscreenPrivate * priv, + __DRIdrawablePrivate * dPriv, + int64_t * count) { drmVBlank vbl; int ret; @@ -63,13 +76,46 @@ int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ) vbl.request.type = DRM_VBLANK_RELATIVE; vbl.request.sequence = 0; + if ( dPriv && dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; ret = drmWaitVBlank( priv->fd, &vbl ); - *count = (int64_t)vbl.reply.sequence; + + if (dPriv) { + *count = vblank_to_msc(dPriv, vbl.reply.sequence); + } else { + /* Old driver (no knowledge of drawable MSC callback) */ + *count = vbl.reply.sequence; + } return ret; } +/** + * Get the current MSC refresh counter. + * + * Stores the 64-bit count of vertical refreshes since some (arbitrary) + * point in time in \c count. Unless the value wraps around, which it + * may, it will never decrease. + * + * \warning This function is called from \c glXGetVideoSyncSGI, which expects + * a \c count of type \c unsigned (32-bit), and \c glXGetSyncValuesOML, which + * expects a \c count of type \c int64_t (signed 64-bit). The kernel ioctl + * currently always returns a \c sequence of type \c unsigned. + * + * Since this function doesn't take a drawable, it may end up getting the MSC + * value from a pipe not associated with the caller's context, resuling in + * undesired behavior. + * + * \param priv Pointer to the DRI screen private struct. + * \param count Storage to hold MSC counter. + * \return Zero is returned on success. A negative errno value + * is returned on failure. + */ +int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ) +{ + return driDrawableGetMSC32(priv, NULL, count); +} /****************************************************************************/ /** @@ -123,7 +169,9 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv, */ vbl.request.type = dont_wait ? DRM_VBLANK_RELATIVE : DRM_VBLANK_ABSOLUTE; - vbl.request.sequence = next; + vbl.request.sequence = next ? msc_to_vblank(priv, next) : 0; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) { /* FIXME: This doesn't seem like the right thing to return here. @@ -131,8 +179,10 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv, return GLX_BAD_CONTEXT; } + *msc = vblank_to_msc(priv, vbl.reply.sequence); + dont_wait = 0; - if (target_msc != 0 && vbl.reply.sequence == target) + if (target_msc != 0 && *msc == target) break; /* Assuming the wait-done test fails, the next refresh to wait for @@ -142,9 +192,9 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv, * If this refresh has already happened, we add divisor to obtain * the next refresh after the current one that will satisfy it. */ - r = (vbl.reply.sequence % (unsigned int)divisor); - next = (vbl.reply.sequence - r + (unsigned int)remainder); - if (next <= vbl.reply.sequence) next += (unsigned int)divisor; + r = (*msc % (unsigned int)divisor); + next = (*msc - r + (unsigned int)remainder); + if (next <= *msc) next += (unsigned int)divisor; } while ( r != (unsigned int)remainder ); } @@ -154,7 +204,10 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv, */ vbl.request.type = DRM_VBLANK_ABSOLUTE; - vbl.request.sequence = target_msc; + vbl.request.sequence = target_msc ? msc_to_vblank(priv, target_msc) : 0; + + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) { /* FIXME: This doesn't seem like the right thing to return here. @@ -163,8 +216,8 @@ int driWaitForMSC32( __DRIdrawablePrivate *priv, } } - *msc = (target_msc & 0xffffffff00000000LL); - *msc |= vbl.reply.sequence; + *msc = vblank_to_msc(priv, vbl.reply.sequence); + if ( *msc < target_msc ) { *msc += 0x0000000100000000LL; } @@ -252,16 +305,21 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd ) * direct rendering context. */ -void driDrawableInitVBlank( __DRIdrawablePrivate *priv, GLuint flags, - GLuint *vbl_seq ) +void driDrawableInitVBlank( __DRIdrawablePrivate *priv ) { if ( priv->swap_interval == (unsigned)-1 ) { /* Get current vertical blank sequence */ - drmVBlank vbl = { .request={ .type = DRM_VBLANK_RELATIVE, .sequence = 0 } }; - do_wait( &vbl, vbl_seq, priv->driScreenPriv->fd ); - - priv->swap_interval = (flags & (VBLANK_FLAG_THROTTLE | - VBLANK_FLAG_SYNC)) != 0 ? 1 : 0; + drmVBlank vbl; + + vbl.request.type = DRM_VBLANK_RELATIVE; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; + vbl.request.sequence = 0; + do_wait( &vbl, &priv->vblSeq, priv->driScreenPriv->fd ); + priv->vblank_base = priv->vblSeq; + + priv->swap_interval = + (priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) ? 1 : 0; } } diff --git a/src/mesa/drivers/dri/common/vblank.h b/src/mesa/drivers/dri/common/vblank.h index ec83adc78dd..e8550b28124 100644 --- a/src/mesa/drivers/dri/common/vblank.h +++ b/src/mesa/drivers/dri/common/vblank.h @@ -46,11 +46,13 @@ */ extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ); +extern int driDrawableGetMSC32( __DRIscreenPrivate * priv, + __DRIdrawablePrivate * drawablePrivate, + int64_t * count); extern int driWaitForMSC32( __DRIdrawablePrivate *priv, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc ); extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ); -extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv, GLuint flags, - GLuint *vbl_seq ); +extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv ); extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv, GLuint flags ); extern void driGetCurrentVBlank( const __DRIdrawablePrivate *priv, diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 3a5551eeb37..173c5fa952a 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -615,6 +615,7 @@ static const struct __DriverAPIRec ffbAPI = { .UnbindContext = ffbUnbindContext, .GetSwapInfo = NULL, .GetMSC = NULL, + .GetDrawableMSC = NULL, .WaitForMSC = NULL, .WaitForSBC = NULL, .SwapBuffersMSC = NULL diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 3c7ec96ff3d..1a0d3c33d7b 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -413,6 +413,7 @@ static const struct __DriverAPIRec i810API = { .UnbindContext = i810UnbindContext, .GetSwapInfo = NULL, .GetMSC = NULL, + .GetDrawableMSC = NULL, .WaitForMSC = NULL, .WaitForSBC = NULL, .SwapBuffersMSC = NULL diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c b/src/mesa/drivers/dri/i915/intel_buffers.c index 46a67b141e7..faa13adbcb3 100644 --- a/src/mesa/drivers/dri/i915/intel_buffers.c +++ b/src/mesa/drivers/dri/i915/intel_buffers.c @@ -243,7 +243,7 @@ intelWindowMoved(struct intel_context *intel) .y2 = sarea->planeB_y + sarea->planeB_h }; GLint areaA = driIntersectArea( drw_rect, planeA_rect ); GLint areaB = driIntersectArea( drw_rect, planeB_rect ); - GLuint flags = intel_fb->vblank_flags; + GLuint flags = dPriv->vblFlags; GLboolean pf_active; GLint pf_planes; @@ -311,19 +311,24 @@ intelWindowMoved(struct intel_context *intel) /* Update vblank info */ if (areaB > areaA || (areaA == areaB && areaB > 0)) { - flags = intel_fb->vblank_flags | VBLANK_FLAG_SECONDARY; + flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY; } else { - flags = intel_fb->vblank_flags & ~VBLANK_FLAG_SECONDARY; + flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY; } - if (flags != intel_fb->vblank_flags && intel_fb->vblank_flags && - !(intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ)) { + /* Check to see if we changed pipes */ + if (flags != dPriv->vblFlags && dPriv->vblFlags && + !(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ)) { + int64_t count; drmVBlank vbl; int i; + /* + * Deal with page flipping + */ vbl.request.type = DRM_VBLANK_ABSOLUTE; - if ( intel_fb->vblank_flags & VBLANK_FLAG_SECONDARY ) { + if ( dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) { vbl.request.type |= DRM_VBLANK_SECONDARY; } @@ -337,9 +342,19 @@ intelWindowMoved(struct intel_context *intel) drmWaitVBlank(intel->driFd, &vbl); } - intel_fb->vblank_flags = flags; - driGetCurrentVBlank(dPriv, intel_fb->vblank_flags, &intel_fb->vbl_seq); - intel_fb->vbl_waited = intel_fb->vbl_seq; + /* + * Update msc_base from old pipe + */ + driDrawableGetMSC32(dPriv->driScreenPriv, dPriv, &count); + dPriv->msc_base = count; + /* + * Then get new vblank_base and vblSeq values + */ + dPriv->vblFlags = flags; + driGetCurrentVBlank(dPriv, dPriv->vblFlags, &dPriv->vblSeq); + dPriv->vblank_base = dPriv->vblSeq; + + intel_fb->vbl_waited = dPriv->vblSeq; for (i = 0; i < intel_fb->pf_num_pages; i++) { if (intel_fb->color_rb[i]) @@ -347,7 +362,7 @@ intelWindowMoved(struct intel_context *intel) } } } else { - intel_fb->vblank_flags &= ~VBLANK_FLAG_SECONDARY; + dPriv->vblFlags &= ~VBLANK_FLAG_SECONDARY; } /* Update Mesa's notion of window size */ @@ -820,10 +835,10 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv) */ static GLboolean -intelScheduleSwap(const __DRIdrawablePrivate * dPriv, GLboolean *missed_target) +intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target) { struct intel_framebuffer *intel_fb = dPriv->driverPrivate; - unsigned int interval = driGetVBlankInterval(dPriv, intel_fb->vblank_flags); + unsigned int interval = driGetVBlankInterval(dPriv, dPriv->vblFlags); struct intel_context *intel = intelScreenContext(dPriv->driScreenPriv->private); const intelScreenPrivate *intelScreen = intel->intelScreen; @@ -831,24 +846,24 @@ intelScheduleSwap(const __DRIdrawablePrivate * dPriv, GLboolean *missed_target) drm_i915_vblank_swap_t swap; GLboolean ret; - if (!intel_fb->vblank_flags || - (intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ) || + if (!dPriv->vblFlags || + (dPriv->vblFlags & VBLANK_FLAG_NO_IRQ) || intelScreen->current_rotation != 0 || intelScreen->drmMinor < (intel_fb->pf_active ? 9 : 6)) return GL_FALSE; swap.seqtype = DRM_VBLANK_ABSOLUTE; - if (intel_fb->vblank_flags & VBLANK_FLAG_SYNC) { + if (dPriv->vblFlags & VBLANK_FLAG_SYNC) { swap.seqtype |= DRM_VBLANK_NEXTONMISS; } else if (interval == 0) { return GL_FALSE; } swap.drawable = dPriv->hHWDrawable; - target = swap.sequence = intel_fb->vbl_seq + interval; + target = swap.sequence = dPriv->vblSeq + interval; - if ( intel_fb->vblank_flags & VBLANK_FLAG_SECONDARY ) { + if ( dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) { swap.seqtype |= DRM_VBLANK_SECONDARY; } @@ -866,14 +881,14 @@ intelScheduleSwap(const __DRIdrawablePrivate * dPriv, GLboolean *missed_target) if (!drmCommandWriteRead(intel->driFd, DRM_I915_VBLANK_SWAP, &swap, sizeof(swap))) { - intel_fb->vbl_seq = swap.sequence; + dPriv->vblSeq = swap.sequence; swap.sequence -= target; *missed_target = swap.sequence > 0 && swap.sequence <= (1 << 23); intel_get_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT)->vbl_pending = intel_get_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT)->vbl_pending = - intel_fb->vbl_seq; + dPriv->vblSeq; if (swap.seqtype & DRM_VBLANK_FLIP) { intel_flip_renderbuffers(intel_fb); @@ -918,7 +933,7 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv) if (screen->current_rotation != 0 || !intelScheduleSwap(dPriv, &missed_target)) { - driWaitForVBlank(dPriv, &intel_fb->vbl_seq, intel_fb->vblank_flags, + driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target); if (screen->current_rotation != 0 || !intelPageFlip(dPriv)) { diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index d7af432ad6b..b85b0c2939c 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -616,18 +616,17 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, if (driDrawPriv->swap_interval == (unsigned)-1) { int i; - intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0) + driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0) ? driGetDefaultVBlankFlags(&intel->optionCache) : VBLANK_FLAG_NO_IRQ; (*dri_interface->getUST) (&intel_fb->swap_ust); - driDrawableInitVBlank(driDrawPriv, intel_fb->vblank_flags, - &intel_fb->vbl_seq); - intel_fb->vbl_waited = intel_fb->vbl_seq; + driDrawableInitVBlank(driDrawPriv); + intel_fb->vbl_waited = driDrawPriv->vblSeq; for (i = 0; i < (intel->intelScreen->third.handle ? 3 : 2); i++) { if (intel_fb->color_rb[i]) - intel_fb->color_rb[i]->vbl_pending = intel_fb->vbl_seq; + intel_fb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq; } } intel->driDrawable = driDrawPriv; @@ -731,6 +730,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags) */ void LOCK_HARDWARE( struct intel_context *intel ) { + __DRIdrawablePrivate *dPriv = intel->driDrawable; char __ret=0; struct intel_framebuffer *intel_fb = NULL; struct intel_renderbuffer *intel_rb = NULL; @@ -748,14 +748,14 @@ void LOCK_HARDWARE( struct intel_context *intel ) BUFFER_BACK_LEFT); } - if (intel_rb && intel_fb->vblank_flags && - !(intel_fb->vblank_flags & VBLANK_FLAG_NO_IRQ) && + if (intel_rb && dPriv->vblFlags && + !(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ) && (intel_fb->vbl_waited - intel_rb->vbl_pending) > (1<<23)) { drmVBlank vbl; vbl.request.type = DRM_VBLANK_ABSOLUTE; - if ( intel_fb->vblank_flags & VBLANK_FLAG_SECONDARY ) { + if ( dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) { vbl.request.type |= DRM_VBLANK_SECONDARY; } diff --git a/src/mesa/drivers/dri/i915/intel_fbo.h b/src/mesa/drivers/dri/i915/intel_fbo.h index 411d6342317..f9a11d02e30 100644 --- a/src/mesa/drivers/dri/i915/intel_fbo.h +++ b/src/mesa/drivers/dri/i915/intel_fbo.h @@ -50,8 +50,6 @@ struct intel_framebuffer /* VBI */ - GLuint vbl_seq; - GLuint vblank_flags; GLuint vbl_waited; int64_t swap_ust; diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 8be5d910a0b..25f5efa7bcf 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -790,6 +790,7 @@ static const struct __DriverAPIRec intelAPI = { .UnbindContext = intelUnbindContext, .GetSwapInfo = intelGetSwapInfo, .GetMSC = driGetMSC32, + .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, .SwapBuffersMSC = NULL, diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c index d1c1c8afb6a..6343f613cc9 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.c +++ b/src/mesa/drivers/dri/i965/intel_blit.c @@ -76,7 +76,8 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv, if (!rect) { UNLOCK_HARDWARE( intel ); - driWaitForVBlank( dPriv, &intel->vbl_seq, intel->vblank_flags, & missed_target ); + driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, + &missed_target ); LOCK_HARDWARE( intel ); } diff --git a/src/mesa/drivers/dri/i965/intel_buffers.c b/src/mesa/drivers/dri/i965/intel_buffers.c index 6c8b0735026..96ef9d8c208 100644 --- a/src/mesa/drivers/dri/i965/intel_buffers.c +++ b/src/mesa/drivers/dri/i965/intel_buffers.c @@ -33,6 +33,8 @@ #include "context.h" #include "framebuffer.h" #include "macros.h" +#include "utils.h" +#include "vblank.h" #include "swrast/swrast.h" GLboolean intel_intersect_cliprects( drm_clip_rect_t *dst, @@ -190,6 +192,50 @@ void intelWindowMoved( struct intel_context *intel ) } } + /* Get updated plane info so we sync against the right vblank counter */ + if (intel->intelScreen->driScrnPriv->ddx_version.minor >= 7) { + drmI830Sarea *sarea = intel->sarea; + drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w, + .y1 = dPriv->y, .y2 = dPriv->y + dPriv->h }; + drm_clip_rect_t planeA_rect = { .x1 = sarea->planeA_x, .y1 = sarea->planeA_y, + .x2 = sarea->planeA_x + sarea->planeA_w, + .y2 = sarea->planeA_y + sarea->planeA_h }; + drm_clip_rect_t planeB_rect = { .x1 = sarea->planeB_x, .y1 = sarea->planeB_y, + .x2 = sarea->planeB_x + sarea->planeB_w, + .y2 = sarea->planeB_y + sarea->planeB_h }; + GLint areaA = driIntersectArea( drw_rect, planeA_rect ); + GLint areaB = driIntersectArea( drw_rect, planeB_rect ); + GLuint flags = dPriv->vblFlags; + + /* Update vblank info + */ + if (areaB > areaA || (areaA == areaB && areaB > 0)) { + flags = dPriv->vblFlags | VBLANK_FLAG_SECONDARY; + } else { + flags = dPriv->vblFlags & ~VBLANK_FLAG_SECONDARY; + } + + /* Check to see if we changed pipes */ + if (flags != dPriv->vblFlags && dPriv->vblFlags && + !(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ)) { + int64_t count; + + /* + * Update msc_base from old pipe + */ + driDrawableGetMSC32(dPriv->driScreenPriv, dPriv, &count); + dPriv->msc_base = count; + /* + * Then get new vblank_base and vblSeq values + */ + dPriv->vblFlags = flags; + driGetCurrentVBlank(dPriv, dPriv->vblFlags, &dPriv->vblSeq); + dPriv->vblank_base = dPriv->vblSeq; + } + } else { + dPriv->vblFlags &= ~VBLANK_FLAG_SECONDARY; + } + _mesa_resize_framebuffer(&intel->ctx, (GLframebuffer*)dPriv->driverPrivate, dPriv->w, dPriv->h); diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index 9850997aad1..d654d2d30de 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -342,8 +342,8 @@ GLboolean intelInitContext( struct intel_context *intel, GLcontext *shareCtx = (GLcontext *) sharedContextPrivate; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private; - volatile drmI830Sarea *saPriv = (volatile drmI830Sarea *) - (((GLubyte *)sPriv->pSAREA)+intelScreen->sarea_priv_offset); + volatile drmI830Sarea *saPriv = (drmI830Sarea *) + (((GLubyte *)sPriv->pSAREA)+intelScreen->sarea_priv_offset); if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx, @@ -361,9 +361,6 @@ GLboolean intelInitContext( struct intel_context *intel, driParseConfigFiles (&intel->optionCache, &intelScreen->optionCache, intel->driScreen->myNum, "i965"); - intel->vblank_flags = (intel->intelScreen->irq_active != 0) - ? driGetDefaultVBlankFlags(&intel->optionCache) : VBLANK_FLAG_NO_IRQ; - ctx->Const.MaxTextureMaxAnisotropy = 2.0; if (getenv("INTEL_STRICT_CONFORMANCE")) { @@ -592,17 +589,19 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv, if (driContextPriv) { struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate; + driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0) + ? driGetDefaultVBlankFlags(&intel->optionCache) : VBLANK_FLAG_NO_IRQ; + + if (intel->driReadDrawable != driReadPriv) { intel->driReadDrawable = driReadPriv; } if ( intel->driDrawable != driDrawPriv ) { - /* Shouldn't the readbuffer be stored also? */ - driDrawableInitVBlank( driDrawPriv, intel->vblank_flags, - &intel->vbl_seq ); - intel->driDrawable = driDrawPriv; intelWindowMoved( intel ); + /* Shouldn't the readbuffer be stored also? */ + driDrawableInitVBlank( driDrawPriv ); } _mesa_make_current(&intel->ctx, diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h index 65898caaa75..5848d0c1ba0 100644 --- a/src/mesa/drivers/dri/i965/intel_context.h +++ b/src/mesa/drivers/dri/i965/intel_context.h @@ -231,11 +231,6 @@ struct intel_context */ driOptionCache optionCache; - /* VBI - */ - GLuint vbl_seq; - GLuint vblank_flags; - int64_t swap_ust; int64_t swap_missed_ust; diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index e35f7da9387..77fd9e386a6 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -549,6 +549,7 @@ static const struct __DriverAPIRec intelAPI = { .UnbindContext = intelUnbindContext, .GetSwapInfo = intelGetSwapInfo, .GetMSC = driGetMSC32, + .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, .SwapBuffersMSC = NULL, diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index ad661e198cd..138e84decb9 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -100,6 +100,7 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual, { GLcontext *ctx, *shareCtx; __DRIscreenPrivate *driScreen = driContextPriv->driScreenPriv; + __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; struct dd_function_table functions; mach64ContextPtr mmesa; mach64ScreenPtr mach64Screen; @@ -253,7 +254,7 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual, mmesa->do_irqs = (mmesa->mach64Screen->irq && !getenv("MACH64_NO_IRQS")); - mmesa->vblank_flags = (mmesa->do_irqs) + dPriv->vblFlags = (mmesa->do_irqs) ? driGetDefaultVBlankFlags(&mmesa->optionCache) : VBLANK_FLAG_NO_IRQ; driContextPriv->driverPrivate = (void *)mmesa; @@ -330,8 +331,7 @@ mach64MakeCurrent( __DRIcontextPrivate *driContextPriv, } - driDrawableInitVBlank( driDrawPriv, newMach64Ctx->vblank_flags, - &newMach64Ctx->vbl_seq ); + driDrawableInitVBlank( driDrawPriv ); if ( newMach64Ctx->driDrawable != driDrawPriv ) { newMach64Ctx->driDrawable = driDrawPriv; diff --git a/src/mesa/drivers/dri/mach64/mach64_context.h b/src/mesa/drivers/dri/mach64/mach64_context.h index 8d89452412b..c6023330245 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.h +++ b/src/mesa/drivers/dri/mach64/mach64_context.h @@ -263,8 +263,6 @@ struct mach64_context { /* VBI */ - GLuint vbl_seq; - GLuint vblank_flags; GLuint do_irqs; /* Configuration cache diff --git a/src/mesa/drivers/dri/mach64/mach64_ioctl.c b/src/mesa/drivers/dri/mach64/mach64_ioctl.c index 36e7d3c5d3d..7405a27f8eb 100644 --- a/src/mesa/drivers/dri/mach64/mach64_ioctl.c +++ b/src/mesa/drivers/dri/mach64/mach64_ioctl.c @@ -279,7 +279,7 @@ static int mach64WaitForFrameCompletion( mach64ContextPtr mmesa ) /* Copy the back color buffer to the front color buffer. */ -void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv ) +void mach64CopyBuffer( __DRIdrawablePrivate *dPriv ) { mach64ContextPtr mmesa; GLint nbox, i, ret; @@ -320,7 +320,7 @@ void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv ) #endif UNLOCK_HARDWARE( mmesa ); - driWaitForVBlank( dPriv, &mmesa->vbl_seq, mmesa->vblank_flags, &missed_target ); + driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target ); LOCK_HARDWARE( mmesa ); /* use front buffer cliprects */ diff --git a/src/mesa/drivers/dri/mach64/mach64_ioctl.h b/src/mesa/drivers/dri/mach64/mach64_ioctl.h index 52fe8634845..c28bf31c49f 100644 --- a/src/mesa/drivers/dri/mach64/mach64_ioctl.h +++ b/src/mesa/drivers/dri/mach64/mach64_ioctl.h @@ -78,7 +78,7 @@ extern void mach64FireBlitLocked( mach64ContextPtr mmesa, void *buffer, GLint offset, GLint pitch, GLint format, GLint x, GLint y, GLint width, GLint height ); -extern void mach64CopyBuffer( const __DRIdrawablePrivate *dPriv ); +extern void mach64CopyBuffer( __DRIdrawablePrivate *dPriv ); #if ENABLE_PERF_BOXES extern void mach64PerformanceCounters( mach64ContextPtr mmesa ); extern void mach64PerformanceBoxesLocked( mach64ContextPtr mmesa ); diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 04eb0815149..a04b7754842 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -484,6 +484,7 @@ static struct __DriverAPIRec mach64API = { .UnbindContext = mach64UnbindContext, .GetSwapInfo = NULL, .GetMSC = driGetMSC32, + .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, .SwapBuffersMSC = NULL diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 2f3516fd38c..31042f9739b 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -452,6 +452,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis, GLcontext *ctx, *shareCtx; mgaContextPtr mmesa; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; + __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private; drm_mga_sarea_t *saPriv = (drm_mga_sarea_t *)(((char*)sPriv->pSAREA)+ mgaScreen->sarea_priv_offset); @@ -650,7 +651,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis, debug_control ); #endif - mmesa->vblank_flags = (mmesa->mgaScreen->irq == 0) + dPriv->vblFlags = (mmesa->mgaScreen->irq == 0) ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache); (*dri_interface->getUST)( & mmesa->swap_ust ); @@ -882,8 +883,8 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv, mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate; if (mmesa->driDrawable != driDrawPriv) { - driDrawableInitVBlank( driDrawPriv, mmesa->vblank_flags, - &mmesa->vbl_seq ); + driDrawableInitVBlank( driDrawPriv ); + mmesa->driDrawable = driDrawPriv; mmesa->dirty = ~0; mmesa->dirty_cliprects = (MGA_FRONT|MGA_BACK); @@ -948,6 +949,7 @@ static const struct __DriverAPIRec mgaAPI = { .UnbindContext = mgaUnbindContext, .GetSwapInfo = getSwapInfo, .GetMSC = driGetMSC32, + .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, .SwapBuffersMSC = NULL diff --git a/src/mesa/drivers/dri/mga/mgacontext.h b/src/mesa/drivers/dri/mga/mgacontext.h index 2124006ade6..2681976fc2b 100644 --- a/src/mesa/drivers/dri/mga/mgacontext.h +++ b/src/mesa/drivers/dri/mga/mgacontext.h @@ -258,11 +258,6 @@ struct mga_context_t { drmBufPtr vertex_dma_buffer; drmBufPtr iload_buffer; - /* VBI - */ - GLuint vbl_seq; - GLuint vblank_flags; - int64_t swap_ust; int64_t swap_missed_ust; diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c index 679d6889259..94126a31f91 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.c +++ b/src/mesa/drivers/dri/mga/mgaioctl.c @@ -428,8 +428,7 @@ void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv ) FLUSH_BATCH( mmesa ); mgaWaitForFrameCompletion( mmesa ); - driWaitForVBlank( dPriv, & mmesa->vbl_seq, mmesa->vblank_flags, - & missed_target ); + driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target ); if ( missed_target ) { mmesa->swap_missed_count++; (void) (*dri_interface->getUST)( & mmesa->swap_missed_ust ); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index a8569a9f153..5ef24d82706 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -283,7 +283,7 @@ GLboolean nouveauMakeCurrent( __DRIcontextPrivate *driContextPriv, struct gl_framebuffer *read_fb = (struct gl_framebuffer*)driReadPriv->driverPrivate; - driDrawableInitVBlank(driDrawPriv, nmesa->vblank_flags, &nmesa->vblank_seq ); + driDrawableInitVBlank(driDrawPriv); nmesa->driDrawable = driDrawPriv; _mesa_resize_framebuffer(nmesa->glCtx, draw_fb, diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.h b/src/mesa/drivers/dri/nouveau/nouveau_context.h index 9aff0ee668b..a617dd62826 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.h @@ -182,10 +182,6 @@ typedef struct nouveau_context { /* Configuration cache */ driOptionCache optionCache; - /* vblank stuff */ - uint32_t vblank_flags; - uint32_t vblank_seq; - GLuint new_state; GLuint new_render_state; GLuint render_index; diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index 3e7bab63f34..533b4b1e6e1 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -205,6 +205,7 @@ static const struct __DriverAPIRec nouveauAPI = { .UnbindContext = nouveauUnbindContext, .GetSwapInfo = nouveauGetSwapInfo, .GetMSC = driGetMSC32, + .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, .SwapBuffersMSC = NULL, diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index c9fe11f38bd..25efe5e4cd7 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -113,6 +113,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, { GLcontext *ctx, *shareCtx; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; + __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; struct dd_function_table functions; r128ContextPtr rmesa; r128ScreenPtr r128scrn; @@ -262,7 +263,7 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, r128DDInitSpanFuncs( ctx ); r128DDInitState( rmesa ); - rmesa->vblank_flags = (rmesa->r128Screen->irq != 0) + dPriv->vblFlags = (rmesa->r128Screen->irq != 0) ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; driContextPriv->driverPrivate = (void *)rmesa; @@ -347,8 +348,7 @@ r128MakeCurrent( __DRIcontextPrivate *driContextPriv, newR128Ctx->dirty = R128_UPLOAD_ALL; } - driDrawableInitVBlank( driDrawPriv, newR128Ctx->vblank_flags, - &newR128Ctx->vbl_seq ); + driDrawableInitVBlank( driDrawPriv ); newR128Ctx->driDrawable = driDrawPriv; _mesa_make_current( newR128Ctx->glCtx, diff --git a/src/mesa/drivers/dri/r128/r128_context.h b/src/mesa/drivers/dri/r128/r128_context.h index c51dd7fa58d..3f7416e9cc9 100644 --- a/src/mesa/drivers/dri/r128/r128_context.h +++ b/src/mesa/drivers/dri/r128/r128_context.h @@ -210,11 +210,6 @@ struct r128_context { GLuint c_textureBytes; GLuint c_vertexBuffers; - /* VBI - */ - GLuint vbl_seq; - GLuint vblank_flags; - /* Configuration cache */ driOptionCache optionCache; diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c index b0dba7d04e1..e04c0872f0d 100644 --- a/src/mesa/drivers/dri/r128/r128_ioctl.c +++ b/src/mesa/drivers/dri/r128/r128_ioctl.c @@ -249,7 +249,7 @@ static int r128WaitForFrameCompletion( r128ContextPtr rmesa ) /* Copy the back color buffer to the front color buffer. */ -void r128CopyBuffer( const __DRIdrawablePrivate *dPriv ) +void r128CopyBuffer( __DRIdrawablePrivate *dPriv ) { r128ContextPtr rmesa; GLint nbox, i, ret; @@ -282,7 +282,7 @@ void r128CopyBuffer( const __DRIdrawablePrivate *dPriv ) } UNLOCK_HARDWARE( rmesa ); - driWaitForVBlank( dPriv, &rmesa->vbl_seq, rmesa->vblank_flags, &missed_target ); + driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target ); LOCK_HARDWARE( rmesa ); nbox = dPriv->numClipRects; /* must be in locked region */ @@ -328,7 +328,7 @@ void r128CopyBuffer( const __DRIdrawablePrivate *dPriv ) #endif } -void r128PageFlip( const __DRIdrawablePrivate *dPriv ) +void r128PageFlip( __DRIdrawablePrivate *dPriv ) { r128ContextPtr rmesa; GLint ret; @@ -359,7 +359,7 @@ void r128PageFlip( const __DRIdrawablePrivate *dPriv ) } UNLOCK_HARDWARE( rmesa ); - driWaitForVBlank( dPriv, &rmesa->vbl_seq, rmesa->vblank_flags, &missed_target ); + driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target ); LOCK_HARDWARE( rmesa ); /* The kernel will have been initialized to perform page flipping diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.h b/src/mesa/drivers/dri/r128/r128_ioctl.h index 95779f09bef..0f9d11fe699 100644 --- a/src/mesa/drivers/dri/r128/r128_ioctl.h +++ b/src/mesa/drivers/dri/r128/r128_ioctl.h @@ -86,8 +86,8 @@ extern void r128ReadDepthSpanLocked( r128ContextPtr rmesa, extern void r128ReadDepthPixelsLocked( r128ContextPtr rmesa, GLuint n, const GLint x[], const GLint y[] ); -extern void r128CopyBuffer( const __DRIdrawablePrivate *dPriv ); -extern void r128PageFlip( const __DRIdrawablePrivate *dPriv ); +extern void r128CopyBuffer( __DRIdrawablePrivate *dPriv ); +extern void r128PageFlip( __DRIdrawablePrivate *dPriv ); void r128WaitForVBlank( r128ContextPtr rmesa ); extern void r128WaitForIdleLocked( r128ContextPtr rmesa ); diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index 9d65ebddf7d..719f9367c01 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -411,6 +411,7 @@ static struct __DriverAPIRec r128API = { .UnbindContext = r128UnbindContext, .GetSwapInfo = NULL, .GetMSC = driGetMSC32, + .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, .SwapBuffersMSC = NULL diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 8f43a2f3128..2b188897f1e 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -248,6 +248,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, void *sharedContextPrivate) { __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; + __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private); struct dd_function_table functions; r200ContextPtr rmesa; @@ -499,7 +500,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, fthrottle_mode, rmesa->r200Screen->irq); - rmesa->vblank_flags = (rmesa->r200Screen->irq != 0) + dPriv->vblFlags = (rmesa->r200Screen->irq != 0) ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; rmesa->prefer_gart_client_texturing = @@ -667,8 +668,7 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv, fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)newCtx->glCtx); if ( newCtx->dri.drawable != driDrawPriv ) { - driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags, - &newCtx->vbl_seq ); + driDrawableInitVBlank( driDrawPriv ); } newCtx->dri.readable = driReadPriv; diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index c80180bdbcc..be73507995b 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -893,11 +893,8 @@ struct r200_context { GLuint TexGenCompSel; GLmatrix tmpmat; - /* VBI / buffer swap + /* buffer swap */ - GLuint vbl_seq; - GLuint vblank_flags; - int64_t swap_ust; int64_t swap_missed_ust; diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index c9c5a861722..2ab9ff8a467 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -419,7 +419,7 @@ static void r200WaitForFrameCompletion( r200ContextPtr rmesa ) /* Copy the back color buffer to the front color buffer. */ -void r200CopyBuffer( const __DRIdrawablePrivate *dPriv, +void r200CopyBuffer( __DRIdrawablePrivate *dPriv, const drm_clip_rect_t *rect) { r200ContextPtr rmesa; @@ -449,7 +449,7 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv, if (!rect) { UNLOCK_HARDWARE( rmesa ); - driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target ); + driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target ); LOCK_HARDWARE( rmesa ); } @@ -513,7 +513,7 @@ void r200CopyBuffer( const __DRIdrawablePrivate *dPriv, } } -void r200PageFlip( const __DRIdrawablePrivate *dPriv ) +void r200PageFlip( __DRIdrawablePrivate *dPriv ) { r200ContextPtr rmesa; GLint ret; @@ -553,7 +553,7 @@ void r200PageFlip( const __DRIdrawablePrivate *dPriv ) */ r200WaitForFrameCompletion( rmesa ); UNLOCK_HARDWARE( rmesa ); - driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target ); + driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target ); if ( missed_target ) { rmesa->swap_missed_count++; (void) (*dri_interface->getUST)( & rmesa->swap_missed_ust ); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.h b/src/mesa/drivers/dri/r200/r200_ioctl.h index bf126799472..4521fbabf1d 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.h +++ b/src/mesa/drivers/dri/r200/r200_ioctl.h @@ -89,9 +89,9 @@ extern void r200ReleaseDmaRegion( r200ContextPtr rmesa, struct r200_dma_region *region, const char *caller ); -extern void r200CopyBuffer( const __DRIdrawablePrivate *drawable, +extern void r200CopyBuffer( __DRIdrawablePrivate *drawable, const drm_clip_rect_t *rect); -extern void r200PageFlip( const __DRIdrawablePrivate *drawable ); +extern void r200PageFlip( __DRIdrawablePrivate *drawable ); extern void r200Flush( GLcontext *ctx ); extern void r200Finish( GLcontext *ctx ); extern void r200WaitForIdleLocked( r200ContextPtr rmesa ); diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index 6dfaf3c6472..8316b745cef 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -127,6 +127,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, void *sharedContextPrivate) { __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; + __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private); GLcontext* ctx; GLcontext* shareCtx; @@ -177,7 +178,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, radeon->do_usleeps ? "usleeps" : "busy waits", fthrottle_mode, radeon->radeonScreen->irq); - radeon->vblank_flags = (radeon->radeonScreen->irq != 0) + dPriv->vblFlags = (radeon->radeonScreen->irq != 0) ? driGetDefaultVBlankFlags(&radeon->optionCache) : VBLANK_FLAG_NO_IRQ; (*dri_interface->getUST) (&radeon->swap_ust); @@ -277,9 +278,7 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, radeon->glCtx); if (radeon->dri.drawable != driDrawPriv) { - driDrawableInitVBlank(driDrawPriv, - radeon->vblank_flags, - &radeon->vbl_seq); + driDrawableInitVBlank(driDrawPriv); } radeon->dri.readable = driReadPriv; diff --git a/src/mesa/drivers/dri/r300/radeon_context.h b/src/mesa/drivers/dri/r300/radeon_context.h index 2f239417a97..38d89306016 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.h +++ b/src/mesa/drivers/dri/r300/radeon_context.h @@ -182,10 +182,7 @@ struct radeon_context { GLuint irqsEmitted; drm_radeon_irq_wait_t iw; - /* VBI / buffer swap */ - GLuint vbl_seq; - GLuint vblank_flags; - + /* buffer swap */ int64_t swap_ust; int64_t swap_missed_ust; diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.c b/src/mesa/drivers/dri/r300/radeon_ioctl.c index 0b8656b9c1d..eeef71aaaff 100644 --- a/src/mesa/drivers/dri/r300/radeon_ioctl.c +++ b/src/mesa/drivers/dri/r300/radeon_ioctl.c @@ -157,7 +157,7 @@ static void radeonWaitForFrameCompletion(radeonContextPtr radeon) /* Copy the back color buffer to the front color buffer. */ -void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv, +void radeonCopyBuffer(__DRIdrawablePrivate * dPriv, const drm_clip_rect_t * rect) { radeonContextPtr radeon; @@ -187,7 +187,7 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv, if (!rect) { UNLOCK_HARDWARE(radeon); - driWaitForVBlank(dPriv, &radeon->vbl_seq, radeon->vblank_flags, + driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target); LOCK_HARDWARE(radeon); } @@ -253,7 +253,7 @@ void radeonCopyBuffer(const __DRIdrawablePrivate * dPriv, } } -void radeonPageFlip(const __DRIdrawablePrivate * dPriv) +void radeonPageFlip(__DRIdrawablePrivate * dPriv) { radeonContextPtr radeon; GLint ret; @@ -293,7 +293,7 @@ void radeonPageFlip(const __DRIdrawablePrivate * dPriv) */ radeonWaitForFrameCompletion(radeon); UNLOCK_HARDWARE(radeon); - driWaitForVBlank(dPriv, &radeon->vbl_seq, radeon->vblank_flags, + driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target); if (missed_target) { radeon->swap_missed_count++; diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.h b/src/mesa/drivers/dri/r300/radeon_ioctl.h index 3a80d36c622..210001e8e07 100644 --- a/src/mesa/drivers/dri/r300/radeon_ioctl.h +++ b/src/mesa/drivers/dri/r300/radeon_ioctl.h @@ -46,9 +46,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif #include "radeon_drm.h" -extern void radeonCopyBuffer(const __DRIdrawablePrivate * drawable, +extern void radeonCopyBuffer(__DRIdrawablePrivate * drawable, const drm_clip_rect_t * rect); -extern void radeonPageFlip(const __DRIdrawablePrivate * drawable); +extern void radeonPageFlip(__DRIdrawablePrivate * drawable); extern void radeonFlush(GLcontext * ctx); extern void radeonFinish(GLcontext * ctx); extern void radeonWaitForIdleLocked(radeonContextPtr radeon); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index defc82fa26b..fe6d3c21b80 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -594,8 +594,7 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv, if ( newCtx->dri.drawable != driDrawPriv ) { /* XXX we may need to validate the drawable here!!! */ - driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags, - &newCtx->vbl_seq ); + driDrawableInitVBlank( driDrawPriv ); } newCtx->dri.readable = driReadPriv; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 10d3c2b27ca..4cc87a95aef 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -961,6 +961,7 @@ static struct __DriverAPIRec radeonAPI = { .UnbindContext = radeonUnbindContext, .GetSwapInfo = getSwapInfo, .GetMSC = driGetMSC32, + .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, .SwapBuffersMSC = NULL, @@ -978,6 +979,7 @@ static const struct __DriverAPIRec r200API = { .UnbindContext = r200UnbindContext, .GetSwapInfo = getSwapInfo, .GetMSC = driGetMSC32, + .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, .SwapBuffersMSC = NULL, diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index 79682a72530..671193577d4 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -314,6 +314,7 @@ static struct __DriverAPIRec sisAPI = { .UnbindContext = sisUnbindContext, .GetSwapInfo = NULL, .GetMSC = NULL, + .GetDrawableMSC = NULL, .WaitForMSC = NULL, .WaitForSBC = NULL, .SwapBuffersMSC = NULL diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 5bdb446d155..6298de82f40 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -355,6 +355,7 @@ static const struct __DriverAPIRec tdfxAPI = { .UnbindContext = tdfxUnbindContext, .GetSwapInfo = NULL, .GetMSC = NULL, + .GetDrawableMSC = NULL, .WaitForMSC = NULL, .WaitForSBC = NULL, .SwapBuffersMSC = NULL diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 66e92cc602e..5d95d97d539 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -465,6 +465,7 @@ viaCreateContext(const __GLcontextModes *visual, GLcontext *ctx, *shareCtx; struct via_context *vmesa; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; + __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private; drm_via_sarea_t *saPriv = (drm_via_sarea_t *) (((GLubyte *)sPriv->pSAREA) + viaScreen->sareaPrivOffset); @@ -658,7 +659,7 @@ viaCreateContext(const __GLcontextModes *visual, driQueryOptionb(&vmesa->optionCache, "no_rast")) FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1); - vmesa->vblank_flags = + dPriv->vblFlags = vmesa->viaScreen->irqEnabled ? driGetDefaultVBlankFlags(&vmesa->optionCache) : VBLANK_FLAG_NO_IRQ; @@ -838,8 +839,7 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv, readBuffer = (GLframebuffer *)driReadPriv->driverPrivate; if (vmesa->driDrawable != driDrawPriv) { - driDrawableInitVBlank(driDrawPriv, vmesa->vblank_flags, - &vmesa->vbl_seq); + driDrawableInitVBlank(driDrawPriv); } if ((vmesa->driDrawable != driDrawPriv) diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index 63217136882..acd6f2e2b1c 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -321,9 +321,6 @@ struct via_context { */ driOptionCache optionCache; - GLuint vblank_flags; - GLuint vbl_seq; - int64_t swap_ust; int64_t swap_missed_ust; diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 4a733fb00c2..3c7dafd0e6b 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -507,7 +507,7 @@ void viaWaitIdleLocked( struct via_context *vmesa, GLboolean light ) * except that WAIT_IDLE() will spin the CPU polling, while this is * IRQ driven. */ -static void viaWaitIdleVBlank( const __DRIdrawablePrivate *dPriv, +static void viaWaitIdleVBlank( __DRIdrawablePrivate *dPriv, struct via_context *vmesa, GLuint value ) { @@ -523,8 +523,8 @@ static void viaWaitIdleVBlank( const __DRIdrawablePrivate *dPriv, vmesa->thrashing) viaSwapOutWork(vmesa); - driWaitForVBlank( dPriv, & vmesa->vbl_seq, - vmesa->vblank_flags, & missed_target ); + driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, + & missed_target ); if ( missed_target ) { vmesa->swap_missed_count++; (*dri_interface->getUST)( &vmesa->swap_missed_ust ); @@ -591,7 +591,7 @@ void viaResetPageFlippingLocked(struct via_context *vmesa) /* * Copy the back buffer to the front buffer. */ -void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) +void viaCopyBuffer(__DRIdrawablePrivate *dPriv) { struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; @@ -607,7 +607,7 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) VIA_FLUSH_DMA(vmesa); - if (vmesa->vblank_flags == VBLANK_FLAG_SYNC && + if (dPriv->vblFlags == VBLANK_FLAG_SYNC && vmesa->lastBreadcrumbWrite > 1) viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite-1); else @@ -634,14 +634,14 @@ void viaCopyBuffer(const __DRIdrawablePrivate *dPriv) } -void viaPageFlip(const __DRIdrawablePrivate *dPriv) +void viaPageFlip(__DRIdrawablePrivate *dPriv) { struct via_context *vmesa = (struct via_context *)dPriv->driContextPriv->driverPrivate; struct via_renderbuffer buffer_tmp; VIA_FLUSH_DMA(vmesa); - if (vmesa->vblank_flags == VBLANK_FLAG_SYNC && + if (dPriv->vblFlags == VBLANK_FLAG_SYNC && vmesa->lastBreadcrumbWrite > 1) viaWaitIdleVBlank(dPriv, vmesa, vmesa->lastBreadcrumbWrite - 1); else diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.h b/src/mesa/drivers/dri/unichrome/via_ioctl.h index a81b427d807..44fc439c9fd 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.h +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.h @@ -33,8 +33,8 @@ void viaFlushDma(struct via_context *vmesa); void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags); void viaInitIoctlFuncs(GLcontext *ctx); -void viaCopyBuffer(const __DRIdrawablePrivate *dpriv); -void viaPageFlip(const __DRIdrawablePrivate *dpriv); +void viaCopyBuffer(__DRIdrawablePrivate *dpriv); +void viaPageFlip(__DRIdrawablePrivate *dpriv); void viaCheckDma(struct via_context *vmesa, GLuint bytes); void viaResetPageFlippingLocked(struct via_context *vmesa); void viaWaitIdle(struct via_context *vmesa, GLboolean light); diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index f3912ac3521..0ad18b43009 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -334,6 +334,7 @@ static struct __DriverAPIRec viaAPI = { .UnbindContext = viaUnbindContext, .GetSwapInfo = getSwapInfo, .GetMSC = driGetMSC32, + .GetDrawableMSC = driDrawableGetMSC32, .WaitForMSC = driWaitForMSC32, .WaitForSBC = NULL, .SwapBuffersMSC = NULL -- cgit v1.2.3 From dc1264970e585c0939606922b3e964db4b9c28b3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 29 Oct 2007 11:56:50 -0700 Subject: [i915] Include header to pick up intel_ttm_bo_create_from_handle() proto. --- src/mesa/drivers/dri/i915/intel_regions.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_regions.c b/src/mesa/drivers/dri/i915/intel_regions.c index 187ccf17764..7799fdbb116 100644 --- a/src/mesa/drivers/dri/i915/intel_regions.c +++ b/src/mesa/drivers/dri/i915/intel_regions.c @@ -44,6 +44,7 @@ #include "intel_blit.h" #include "intel_buffer_objects.h" #include "dri_bufmgr.h" +#include "intel_bufmgr_ttm.h" #include "intel_batchbuffer.h" #define FILE_DEBUG_FLAG DEBUG_REGION -- cgit v1.2.3 From 3177b4e2cf7d2fff7428cb6057bebbe60ff5cc6c Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 30 Oct 2007 13:16:50 +0100 Subject: More vblank cleanups. * Fix crash at context creation in most drivers supporting vblank. * Don't pass vblank sequence or flags to functions that get passed the drawable private already. * Attempt to initialize vblank related drawable private fields just once per drawable. May need more work in some drivers. --- src/mesa/drivers/dri/common/vblank.c | 85 ++++++++++++++------------ src/mesa/drivers/dri/common/vblank.h | 10 ++- src/mesa/drivers/dri/i915/intel_blit.c | 1 - src/mesa/drivers/dri/i915/intel_buffers.c | 9 +-- src/mesa/drivers/dri/i965/intel_blit.c | 5 +- src/mesa/drivers/dri/i965/intel_blit.h | 2 +- src/mesa/drivers/dri/i965/intel_buffers.c | 2 +- src/mesa/drivers/dri/i965/intel_context.c | 12 ++-- src/mesa/drivers/dri/mach64/mach64_context.c | 14 +++-- src/mesa/drivers/dri/mach64/mach64_ioctl.c | 2 +- src/mesa/drivers/dri/mga/mga_xmesa.c | 12 ++-- src/mesa/drivers/dri/mga/mgaioctl.c | 4 +- src/mesa/drivers/dri/mga/mgaioctl.h | 2 +- src/mesa/drivers/dri/nouveau/nouveau_context.c | 8 ++- src/mesa/drivers/dri/r128/r128_context.c | 12 ++-- src/mesa/drivers/dri/r128/r128_ioctl.c | 4 +- src/mesa/drivers/dri/r200/r200_context.c | 16 ++--- src/mesa/drivers/dri/r200/r200_ioctl.c | 4 +- src/mesa/drivers/dri/r300/radeon_context.c | 14 +++-- src/mesa/drivers/dri/r300/radeon_ioctl.c | 6 +- src/mesa/drivers/dri/radeon/radeon_context.c | 16 ++--- src/mesa/drivers/dri/radeon/radeon_context.h | 3 - src/mesa/drivers/dri/radeon/radeon_ioctl.c | 8 +-- src/mesa/drivers/dri/radeon/radeon_ioctl.h | 4 +- src/mesa/drivers/dri/unichrome/via_context.c | 18 +++--- src/mesa/drivers/dri/unichrome/via_ioctl.c | 3 +- 26 files changed, 147 insertions(+), 129 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/vblank.c b/src/mesa/drivers/dri/common/vblank.c index 05964404632..8f8d94853ea 100644 --- a/src/mesa/drivers/dri/common/vblank.c +++ b/src/mesa/drivers/dri/common/vblank.c @@ -299,6 +299,23 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd ) } +/****************************************************************************/ +/** + * Returns the default swap interval of the given drawable. + */ + +static unsigned +driGetDefaultVBlankInterval( const __DRIdrawablePrivate *priv ) +{ + if ( (priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) { + return 1; + } + else { + return 0; + } +} + + /****************************************************************************/ /** * Sets the default swap interval when the drawable is first bound to a @@ -307,7 +324,8 @@ static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd ) void driDrawableInitVBlank( __DRIdrawablePrivate *priv ) { - if ( priv->swap_interval == (unsigned)-1 ) { + if ( priv->swap_interval == (unsigned)-1 && + !( priv->vblFlags & VBLANK_FLAG_NO_IRQ ) ) { /* Get current vertical blank sequence */ drmVBlank vbl; @@ -318,8 +336,7 @@ void driDrawableInitVBlank( __DRIdrawablePrivate *priv ) do_wait( &vbl, &priv->vblSeq, priv->driScreenPriv->fd ); priv->vblank_base = priv->vblSeq; - priv->swap_interval = - (priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) ? 1 : 0; + priv->swap_interval = driGetDefaultVBlankInterval( priv ); } } @@ -330,21 +347,17 @@ void driDrawableInitVBlank( __DRIdrawablePrivate *priv ) */ unsigned -driGetVBlankInterval( const __DRIdrawablePrivate *priv, GLuint flags ) +driGetVBlankInterval( const __DRIdrawablePrivate *priv ) { - if ( (flags & VBLANK_FLAG_INTERVAL) != 0 ) { + if ( (priv->vblFlags & VBLANK_FLAG_INTERVAL) != 0 ) { /* this must have been initialized when the drawable was first bound * to a direct rendering context. */ assert ( priv->swap_interval != (unsigned)-1 ); return priv->swap_interval; } - else if ( (flags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) { - return 1; - } - else { - return 0; - } + else + return driGetDefaultVBlankInterval( priv ); } @@ -354,18 +367,17 @@ driGetVBlankInterval( const __DRIdrawablePrivate *priv, GLuint flags ) */ void -driGetCurrentVBlank( const __DRIdrawablePrivate *priv, GLuint flags, - GLuint *vbl_seq ) +driGetCurrentVBlank( __DRIdrawablePrivate *priv ) { drmVBlank vbl; vbl.request.type = DRM_VBLANK_RELATIVE; - if ( flags & VBLANK_FLAG_SECONDARY ) { + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) { vbl.request.type |= DRM_VBLANK_SECONDARY; } vbl.request.sequence = 0; - (void) do_wait( &vbl, vbl_seq, priv->driScreenPriv->fd ); + (void) do_wait( &vbl, &priv->vblSeq, priv->driScreenPriv->fd ); } @@ -373,19 +385,15 @@ driGetCurrentVBlank( const __DRIdrawablePrivate *priv, GLuint flags, /** * Waits for the vertical blank for use with glXSwapBuffers. * - * \param vbl_seq Vertical blank sequence number (MSC) after the last buffer - * swap. Updated after this wait. - * \param flags \c VBLANK_FLAG bits that control how long to wait. * \param missed_deadline Set to \c GL_TRUE if the MSC after waiting is later - * than the "target" based on \c flags. The idea is that if - * \c missed_deadline is set, then the application is not - * achieving its desired framerate. + * than the "target" based on \c priv->vblFlags. The idea is + * that if \c missed_deadline is set, then the application is + * not achieving its desired framerate. * \return Zero on success, -1 on error. */ int -driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq, - GLuint flags, GLboolean * missed_deadline ) +driWaitForVBlank( __DRIdrawablePrivate *priv, GLboolean * missed_deadline ) { drmVBlank vbl; unsigned original_seq; @@ -394,10 +402,10 @@ driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq, unsigned diff; *missed_deadline = GL_FALSE; - if ( (flags & (VBLANK_FLAG_INTERVAL | - VBLANK_FLAG_THROTTLE | - VBLANK_FLAG_SYNC)) == 0 || - (flags & VBLANK_FLAG_NO_IRQ) != 0 ) { + if ( (priv->vblFlags & (VBLANK_FLAG_INTERVAL | + VBLANK_FLAG_THROTTLE | + VBLANK_FLAG_SYNC)) == 0 || + (priv->vblFlags & VBLANK_FLAG_NO_IRQ) != 0 ) { return 0; } @@ -408,44 +416,45 @@ driWaitForVBlank( const __DRIdrawablePrivate *priv, GLuint * vbl_seq, * * VBLANK_FLAG_INTERVAL and VBLANK_FLAG_THROTTLE mean to wait for at * least one vertical blank since the last wait. Since do_wait modifies - * vbl_seq, we have to save the original value of vbl_seq for the + * priv->vblSeq, we have to save the original value of priv->vblSeq for the * VBLANK_FLAG_INTERVAL / VBLANK_FLAG_THROTTLE calculation later. */ - original_seq = *vbl_seq; - interval = driGetVBlankInterval(priv, flags); + original_seq = priv->vblSeq; + interval = driGetVBlankInterval(priv); deadline = original_seq + interval; vbl.request.type = DRM_VBLANK_RELATIVE; - if ( flags & VBLANK_FLAG_SECONDARY ) { + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) { vbl.request.type |= DRM_VBLANK_SECONDARY; } - vbl.request.sequence = ((flags & VBLANK_FLAG_SYNC) != 0) ? 1 : 0; + vbl.request.sequence = ((priv->vblFlags & VBLANK_FLAG_SYNC) != 0) ? 1 : 0; - if ( do_wait( & vbl, vbl_seq, priv->driScreenPriv->fd ) != 0 ) { + if ( do_wait( & vbl, &priv->vblSeq, priv->driScreenPriv->fd ) != 0 ) { return -1; } - diff = *vbl_seq - deadline; + diff = priv->vblSeq - deadline; /* No need to wait again if we've already reached the target */ if (diff <= (1 << 23)) { - *missed_deadline = (flags & VBLANK_FLAG_SYNC) ? (diff > 0) : GL_TRUE; + *missed_deadline = (priv->vblFlags & VBLANK_FLAG_SYNC) ? (diff > 0) : + GL_TRUE; return 0; } /* Wait until the target vertical blank. */ vbl.request.type = DRM_VBLANK_ABSOLUTE; - if ( flags & VBLANK_FLAG_SECONDARY ) { + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) { vbl.request.type |= DRM_VBLANK_SECONDARY; } vbl.request.sequence = deadline; - if ( do_wait( & vbl, vbl_seq, priv->driScreenPriv->fd ) != 0 ) { + if ( do_wait( & vbl, &priv->vblSeq, priv->driScreenPriv->fd ) != 0 ) { return -1; } - diff = *vbl_seq - deadline; + diff = priv->vblSeq - deadline; *missed_deadline = diff > 0 && diff <= (1 << 23); return 0; diff --git a/src/mesa/drivers/dri/common/vblank.h b/src/mesa/drivers/dri/common/vblank.h index e8550b28124..4613c09222e 100644 --- a/src/mesa/drivers/dri/common/vblank.h +++ b/src/mesa/drivers/dri/common/vblank.h @@ -53,12 +53,10 @@ extern int driWaitForMSC32( __DRIdrawablePrivate *priv, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc ); extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ); extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv ); -extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv, - GLuint flags ); -extern void driGetCurrentVBlank( const __DRIdrawablePrivate *priv, - GLuint flags, GLuint *vbl_seq ); -extern int driWaitForVBlank( const __DRIdrawablePrivate *priv, - GLuint * vbl_seq, GLuint flags, GLboolean * missed_deadline ); +extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv ); +extern void driGetCurrentVBlank( __DRIdrawablePrivate *priv ); +extern int driWaitForVBlank( __DRIdrawablePrivate *priv, + GLboolean * missed_deadline ); #undef usleep #include /* for usleep() */ diff --git a/src/mesa/drivers/dri/i915/intel_blit.c b/src/mesa/drivers/dri/i915/intel_blit.c index 2d4d00edefd..2761136f47f 100644 --- a/src/mesa/drivers/dri/i915/intel_blit.c +++ b/src/mesa/drivers/dri/i915/intel_blit.c @@ -40,7 +40,6 @@ #include "intel_fbo.h" #include "intel_reg.h" #include "intel_regions.h" -#include "vblank.h" #define FILE_DEBUG_FLAG DEBUG_BLIT diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c b/src/mesa/drivers/dri/i915/intel_buffers.c index faa13adbcb3..1ae8b5feb4c 100644 --- a/src/mesa/drivers/dri/i915/intel_buffers.c +++ b/src/mesa/drivers/dri/i915/intel_buffers.c @@ -351,7 +351,7 @@ intelWindowMoved(struct intel_context *intel) * Then get new vblank_base and vblSeq values */ dPriv->vblFlags = flags; - driGetCurrentVBlank(dPriv, dPriv->vblFlags, &dPriv->vblSeq); + driGetCurrentVBlank(dPriv); dPriv->vblank_base = dPriv->vblSeq; intel_fb->vbl_waited = dPriv->vblSeq; @@ -838,7 +838,7 @@ static GLboolean intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target) { struct intel_framebuffer *intel_fb = dPriv->driverPrivate; - unsigned int interval = driGetVBlankInterval(dPriv, dPriv->vblFlags); + unsigned int interval; struct intel_context *intel = intelScreenContext(dPriv->driScreenPriv->private); const intelScreenPrivate *intelScreen = intel->intelScreen; @@ -852,6 +852,8 @@ intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target) intelScreen->drmMinor < (intel_fb->pf_active ? 9 : 6)) return GL_FALSE; + interval = driGetVBlankInterval(dPriv); + swap.seqtype = DRM_VBLANK_ABSOLUTE; if (dPriv->vblFlags & VBLANK_FLAG_SYNC) { @@ -933,8 +935,7 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv) if (screen->current_rotation != 0 || !intelScheduleSwap(dPriv, &missed_target)) { - driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags, - &missed_target); + driWaitForVBlank(dPriv, &missed_target); if (screen->current_rotation != 0 || !intelPageFlip(dPriv)) { intelCopyBuffer(dPriv, NULL); diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c index 6343f613cc9..31fe20fb2ad 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.c +++ b/src/mesa/drivers/dri/i965/intel_blit.c @@ -49,7 +49,7 @@ /* * Copy the back buffer to the front buffer. */ -void intelCopyBuffer( const __DRIdrawablePrivate *dPriv, +void intelCopyBuffer( __DRIdrawablePrivate *dPriv, const drm_clip_rect_t *rect ) { struct intel_context *intel; @@ -76,8 +76,7 @@ void intelCopyBuffer( const __DRIdrawablePrivate *dPriv, if (!rect) { UNLOCK_HARDWARE( intel ); - driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, - &missed_target ); + driWaitForVBlank( dPriv, &missed_target ); LOCK_HARDWARE( intel ); } diff --git a/src/mesa/drivers/dri/i965/intel_blit.h b/src/mesa/drivers/dri/i965/intel_blit.h index e361545c8fa..1412baf1c0f 100644 --- a/src/mesa/drivers/dri/i965/intel_blit.h +++ b/src/mesa/drivers/dri/i965/intel_blit.h @@ -33,7 +33,7 @@ struct buffer; -extern void intelCopyBuffer( const __DRIdrawablePrivate *dpriv, +extern void intelCopyBuffer( __DRIdrawablePrivate *dpriv, const drm_clip_rect_t *rect ); extern void intelClearWithBlit(GLcontext *ctx, GLbitfield mask); diff --git a/src/mesa/drivers/dri/i965/intel_buffers.c b/src/mesa/drivers/dri/i965/intel_buffers.c index 96ef9d8c208..406aa93d06d 100644 --- a/src/mesa/drivers/dri/i965/intel_buffers.c +++ b/src/mesa/drivers/dri/i965/intel_buffers.c @@ -229,7 +229,7 @@ void intelWindowMoved( struct intel_context *intel ) * Then get new vblank_base and vblSeq values */ dPriv->vblFlags = flags; - driGetCurrentVBlank(dPriv, dPriv->vblFlags, &dPriv->vblSeq); + driGetCurrentVBlank(dPriv); dPriv->vblank_base = dPriv->vblSeq; } } else { diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index d654d2d30de..49431b2a0b2 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -589,19 +589,21 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv, if (driContextPriv) { struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate; - driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0) - ? driGetDefaultVBlankFlags(&intel->optionCache) : VBLANK_FLAG_NO_IRQ; - - if (intel->driReadDrawable != driReadPriv) { intel->driReadDrawable = driReadPriv; } if ( intel->driDrawable != driDrawPriv ) { + if (driDrawPriv->swap_interval == (unsigned)-1) { + driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0) + ? driGetDefaultVBlankFlags(&intel->optionCache) + : VBLANK_FLAG_NO_IRQ; + driDrawableInitVBlank( driDrawPriv ); + } + intel->driDrawable = driDrawPriv; intelWindowMoved( intel ); /* Shouldn't the readbuffer be stored also? */ - driDrawableInitVBlank( driDrawPriv ); } _mesa_make_current(&intel->ctx, diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index 138e84decb9..f730c831e4d 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -100,7 +100,6 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual, { GLcontext *ctx, *shareCtx; __DRIscreenPrivate *driScreen = driContextPriv->driScreenPriv; - __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; struct dd_function_table functions; mach64ContextPtr mmesa; mach64ScreenPtr mach64Screen; @@ -254,9 +253,6 @@ GLboolean mach64CreateContext( const __GLcontextModes *glVisual, mmesa->do_irqs = (mmesa->mach64Screen->irq && !getenv("MACH64_NO_IRQS")); - dPriv->vblFlags = (mmesa->do_irqs) - ? driGetDefaultVBlankFlags(&mmesa->optionCache) : VBLANK_FLAG_NO_IRQ; - driContextPriv->driverPrivate = (void *)mmesa; if (driQueryOptionb(&mmesa->optionCache, "no_rast")) { @@ -331,9 +327,15 @@ mach64MakeCurrent( __DRIcontextPrivate *driContextPriv, } - driDrawableInitVBlank( driDrawPriv ); - if ( newMach64Ctx->driDrawable != driDrawPriv ) { + if (driDrawPriv->swap_interval == (unsigned)-1) { + driDrawPriv->vblFlags = (newMach64Ctx->do_irqs) + ? driGetDefaultVBlankFlags(&newMach64Ctx->optionCache) + : VBLANK_FLAG_NO_IRQ; + + driDrawableInitVBlank( driDrawPriv ); + } + newMach64Ctx->driDrawable = driDrawPriv; mach64CalcViewport( newMach64Ctx->glCtx ); } diff --git a/src/mesa/drivers/dri/mach64/mach64_ioctl.c b/src/mesa/drivers/dri/mach64/mach64_ioctl.c index 7405a27f8eb..3bcec50cf81 100644 --- a/src/mesa/drivers/dri/mach64/mach64_ioctl.c +++ b/src/mesa/drivers/dri/mach64/mach64_ioctl.c @@ -320,7 +320,7 @@ void mach64CopyBuffer( __DRIdrawablePrivate *dPriv ) #endif UNLOCK_HARDWARE( mmesa ); - driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target ); + driWaitForVBlank( dPriv, &missed_target ); LOCK_HARDWARE( mmesa ); /* use front buffer cliprects */ diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 31042f9739b..896f2d94fc6 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -452,7 +452,6 @@ mgaCreateContext( const __GLcontextModes *mesaVis, GLcontext *ctx, *shareCtx; mgaContextPtr mmesa; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private; drm_mga_sarea_t *saPriv = (drm_mga_sarea_t *)(((char*)sPriv->pSAREA)+ mgaScreen->sarea_priv_offset); @@ -651,9 +650,6 @@ mgaCreateContext( const __GLcontextModes *mesaVis, debug_control ); #endif - dPriv->vblFlags = (mmesa->mgaScreen->irq == 0) - ? VBLANK_FLAG_NO_IRQ : driGetDefaultVBlankFlags(&mmesa->optionCache); - (*dri_interface->getUST)( & mmesa->swap_ust ); if (driQueryOptionb(&mmesa->optionCache, "no_rast")) { @@ -883,7 +879,13 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv, mgaContextPtr mmesa = (mgaContextPtr) driContextPriv->driverPrivate; if (mmesa->driDrawable != driDrawPriv) { - driDrawableInitVBlank( driDrawPriv ); + if (driDrawPriv->swap_interval == (unsigned)-1) { + driDrawPriv->vblFlags = (mmesa->mgaScreen->irq == 0) + ? VBLANK_FLAG_NO_IRQ + : driGetDefaultVBlankFlags(&mmesa->optionCache); + + driDrawableInitVBlank( driDrawPriv ); + } mmesa->driDrawable = driDrawPriv; mmesa->dirty = ~0; diff --git a/src/mesa/drivers/dri/mga/mgaioctl.c b/src/mesa/drivers/dri/mga/mgaioctl.c index 94126a31f91..ff26b9475b9 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.c +++ b/src/mesa/drivers/dri/mga/mgaioctl.c @@ -409,7 +409,7 @@ static void mgaWaitForFrameCompletion( mgaContextPtr mmesa ) /* * Copy the back buffer to the front buffer. */ -void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv ) +void mgaCopyBuffer( __DRIdrawablePrivate *dPriv ) { mgaContextPtr mmesa; drm_clip_rect_t *pbox; @@ -428,7 +428,7 @@ void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv ) FLUSH_BATCH( mmesa ); mgaWaitForFrameCompletion( mmesa ); - driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target ); + driWaitForVBlank( dPriv, & missed_target ); if ( missed_target ) { mmesa->swap_missed_count++; (void) (*dri_interface->getUST)( & mmesa->swap_missed_ust ); diff --git a/src/mesa/drivers/dri/mga/mgaioctl.h b/src/mesa/drivers/dri/mga/mgaioctl.h index f3ae749ca99..0ea0ba1acd4 100644 --- a/src/mesa/drivers/dri/mga/mgaioctl.h +++ b/src/mesa/drivers/dri/mga/mgaioctl.h @@ -33,7 +33,7 @@ #include "mgacontext.h" #include "mga_xmesa.h" -void mgaCopyBuffer( const __DRIdrawablePrivate *dPriv ); +void mgaCopyBuffer( __DRIdrawablePrivate *dPriv ); void mgaWaitForVBlank( mgaContextPtr mmesa ); void mgaGetILoadBufferLocked( mgaContextPtr mmesa ); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 5ef24d82706..4f4128c875d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -283,7 +283,13 @@ GLboolean nouveauMakeCurrent( __DRIcontextPrivate *driContextPriv, struct gl_framebuffer *read_fb = (struct gl_framebuffer*)driReadPriv->driverPrivate; - driDrawableInitVBlank(driDrawPriv); + if (driDrawPriv->swap_interval == (unsigned)-1) { + driDrawPriv->vblFlags = + driGetDefaultVBlankFlags(&nmesa->optionCache); + + driDrawableInitVBlank(driDrawPriv); + } + nmesa->driDrawable = driDrawPriv; _mesa_resize_framebuffer(nmesa->glCtx, draw_fb, diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index 25efe5e4cd7..cdea77642bd 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -113,7 +113,6 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, { GLcontext *ctx, *shareCtx; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; struct dd_function_table functions; r128ContextPtr rmesa; r128ScreenPtr r128scrn; @@ -263,9 +262,6 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, r128DDInitSpanFuncs( ctx ); r128DDInitState( rmesa ); - dPriv->vblFlags = (rmesa->r128Screen->irq != 0) - ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; - driContextPriv->driverPrivate = (void *)rmesa; #if DO_DEBUG @@ -348,7 +344,13 @@ r128MakeCurrent( __DRIcontextPrivate *driContextPriv, newR128Ctx->dirty = R128_UPLOAD_ALL; } - driDrawableInitVBlank( driDrawPriv ); + if (driDrawPriv->swap_interval == (unsigned)-1) { + driDrawPriv->vblFlags = (newR128Ctx->r128Screen->irq != 0) + ? driGetDefaultVBlankFlags(&newR128Ctx->optionCache) + : VBLANK_FLAG_NO_IRQ; + + driDrawableInitVBlank( driDrawPriv ); + } newR128Ctx->driDrawable = driDrawPriv; _mesa_make_current( newR128Ctx->glCtx, diff --git a/src/mesa/drivers/dri/r128/r128_ioctl.c b/src/mesa/drivers/dri/r128/r128_ioctl.c index e04c0872f0d..034261a5354 100644 --- a/src/mesa/drivers/dri/r128/r128_ioctl.c +++ b/src/mesa/drivers/dri/r128/r128_ioctl.c @@ -282,7 +282,7 @@ void r128CopyBuffer( __DRIdrawablePrivate *dPriv ) } UNLOCK_HARDWARE( rmesa ); - driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target ); + driWaitForVBlank( dPriv, &missed_target ); LOCK_HARDWARE( rmesa ); nbox = dPriv->numClipRects; /* must be in locked region */ @@ -359,7 +359,7 @@ void r128PageFlip( __DRIdrawablePrivate *dPriv ) } UNLOCK_HARDWARE( rmesa ); - driWaitForVBlank( dPriv, &dPriv->vblSeq, dPriv->vblFlags, &missed_target ); + driWaitForVBlank( dPriv, &missed_target ); LOCK_HARDWARE( rmesa ); /* The kernel will have been initialized to perform page flipping diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 2b188897f1e..982bd9e62a8 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -248,7 +248,6 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, void *sharedContextPrivate) { __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private); struct dd_function_table functions; r200ContextPtr rmesa; @@ -500,9 +499,6 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, fthrottle_mode, rmesa->r200Screen->irq); - dPriv->vblFlags = (rmesa->r200Screen->irq != 0) - ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; - rmesa->prefer_gart_client_texturing = (getenv("R200_GART_CLIENT_TEXTURES") != 0); @@ -667,14 +663,18 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv, if (R200_DEBUG & DEBUG_DRI) fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *)newCtx->glCtx); - if ( newCtx->dri.drawable != driDrawPriv ) { - driDrawableInitVBlank( driDrawPriv ); - } - newCtx->dri.readable = driReadPriv; if ( newCtx->dri.drawable != driDrawPriv || newCtx->lastStamp != driDrawPriv->lastStamp ) { + if (driDrawPriv->swap_interval == (unsigned)-1) { + driDrawPriv->vblFlags = (newCtx->r200Screen->irq != 0) + ? driGetDefaultVBlankFlags(&newCtx->optionCache) + : VBLANK_FLAG_NO_IRQ; + + driDrawableInitVBlank( driDrawPriv ); + } + newCtx->dri.drawable = driDrawPriv; r200SetCliprects(newCtx); diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 2ab9ff8a467..34e7ada34b4 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -449,7 +449,7 @@ void r200CopyBuffer( __DRIdrawablePrivate *dPriv, if (!rect) { UNLOCK_HARDWARE( rmesa ); - driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target ); + driWaitForVBlank( dPriv, & missed_target ); LOCK_HARDWARE( rmesa ); } @@ -553,7 +553,7 @@ void r200PageFlip( __DRIdrawablePrivate *dPriv ) */ r200WaitForFrameCompletion( rmesa ); UNLOCK_HARDWARE( rmesa ); - driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, & missed_target ); + driWaitForVBlank( dPriv, & missed_target ); if ( missed_target ) { rmesa->swap_missed_count++; (void) (*dri_interface->getUST)( & rmesa->swap_missed_ust ); diff --git a/src/mesa/drivers/dri/r300/radeon_context.c b/src/mesa/drivers/dri/r300/radeon_context.c index 8316b745cef..787d4b5c57c 100644 --- a/src/mesa/drivers/dri/r300/radeon_context.c +++ b/src/mesa/drivers/dri/r300/radeon_context.c @@ -127,7 +127,6 @@ GLboolean radeonInitContext(radeonContextPtr radeon, void *sharedContextPrivate) { __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private); GLcontext* ctx; GLcontext* shareCtx; @@ -178,9 +177,6 @@ GLboolean radeonInitContext(radeonContextPtr radeon, radeon->do_usleeps ? "usleeps" : "busy waits", fthrottle_mode, radeon->radeonScreen->irq); - dPriv->vblFlags = (radeon->radeonScreen->irq != 0) - ? driGetDefaultVBlankFlags(&radeon->optionCache) : VBLANK_FLAG_NO_IRQ; - (*dri_interface->getUST) (&radeon->swap_ust); return GL_TRUE; @@ -278,7 +274,15 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, radeon->glCtx); if (radeon->dri.drawable != driDrawPriv) { - driDrawableInitVBlank(driDrawPriv); + if (driDrawPriv->swap_interval == (unsigned)-1) { + driDrawPriv->vblFlags = + (radeon->radeonScreen->irq != 0) + ? driGetDefaultVBlankFlags(&radeon-> + optionCache) + : VBLANK_FLAG_NO_IRQ; + + driDrawableInitVBlank(driDrawPriv); + } } radeon->dri.readable = driReadPriv; diff --git a/src/mesa/drivers/dri/r300/radeon_ioctl.c b/src/mesa/drivers/dri/r300/radeon_ioctl.c index eeef71aaaff..866b1deaa05 100644 --- a/src/mesa/drivers/dri/r300/radeon_ioctl.c +++ b/src/mesa/drivers/dri/r300/radeon_ioctl.c @@ -187,8 +187,7 @@ void radeonCopyBuffer(__DRIdrawablePrivate * dPriv, if (!rect) { UNLOCK_HARDWARE(radeon); - driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags, - &missed_target); + driWaitForVBlank(dPriv, &missed_target); LOCK_HARDWARE(radeon); } @@ -293,8 +292,7 @@ void radeonPageFlip(__DRIdrawablePrivate * dPriv) */ radeonWaitForFrameCompletion(radeon); UNLOCK_HARDWARE(radeon); - driWaitForVBlank(dPriv, &dPriv->vblSeq, dPriv->vblFlags, - &missed_target); + driWaitForVBlank(dPriv, &missed_target); if (missed_target) { radeon->swap_missed_count++; (void)(*dri_interface->getUST) (&radeon->swap_missed_ust); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index fe6d3c21b80..18d9b0b65a5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -424,9 +424,6 @@ radeonCreateContext( const __GLcontextModes *glVisual, rmesa->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); - rmesa->vblank_flags = (rmesa->radeonScreen->irq != 0) - ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; - (*dri_interface->getUST)( & rmesa->swap_ust ); @@ -592,15 +589,18 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv, if (RADEON_DEBUG & DEBUG_DRI) fprintf(stderr, "%s ctx %p\n", __FUNCTION__, (void *) newCtx->glCtx); - if ( newCtx->dri.drawable != driDrawPriv ) { - /* XXX we may need to validate the drawable here!!! */ - driDrawableInitVBlank( driDrawPriv ); - } - newCtx->dri.readable = driReadPriv; if ( (newCtx->dri.drawable != driDrawPriv) || newCtx->lastStamp != driDrawPriv->lastStamp ) { + if (driDrawPriv->swap_interval == (unsigned)-1) { + driDrawPriv->vblFlags = (newCtx->radeonScreen->irq != 0) + ? driGetDefaultVBlankFlags(&newCtx->optionCache) + : VBLANK_FLAG_NO_IRQ; + + driDrawableInitVBlank( driDrawPriv ); + } + newCtx->dri.drawable = driDrawPriv; radeonSetCliprects(newCtx); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index 8dedd66f563..b4ffde5d540 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -667,9 +667,6 @@ struct radeon_context { /* VBI */ - GLuint vbl_seq; - GLuint vblank_flags; - int64_t swap_ust; int64_t swap_missed_ust; diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 4c64bc201ae..2430158db2d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -863,7 +863,7 @@ static void radeonWaitForFrameCompletion( radeonContextPtr rmesa ) /* Copy the back color buffer to the front color buffer. */ -void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv, +void radeonCopyBuffer( __DRIdrawablePrivate *dPriv, const drm_clip_rect_t *rect) { radeonContextPtr rmesa; @@ -891,7 +891,7 @@ void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv, if (!rect) { UNLOCK_HARDWARE( rmesa ); - driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target ); + driWaitForVBlank( dPriv, & missed_target ); LOCK_HARDWARE( rmesa ); } @@ -952,7 +952,7 @@ void radeonCopyBuffer( const __DRIdrawablePrivate *dPriv, } } -void radeonPageFlip( const __DRIdrawablePrivate *dPriv ) +void radeonPageFlip( __DRIdrawablePrivate *dPriv ) { radeonContextPtr rmesa; GLint ret; @@ -987,7 +987,7 @@ void radeonPageFlip( const __DRIdrawablePrivate *dPriv ) */ radeonWaitForFrameCompletion( rmesa ); UNLOCK_HARDWARE( rmesa ); - driWaitForVBlank( dPriv, & rmesa->vbl_seq, rmesa->vblank_flags, & missed_target ); + driWaitForVBlank( dPriv, & missed_target ); if ( missed_target ) { rmesa->swap_missed_count++; (void) (*dri_interface->getUST)( & rmesa->swap_missed_ust ); diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.h b/src/mesa/drivers/dri/radeon/radeon_ioctl.h index 11a7d02b1b7..b8d68eec867 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.h +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.h @@ -87,9 +87,9 @@ extern void radeonReleaseDmaRegion( radeonContextPtr rmesa, struct radeon_dma_region *region, const char *caller ); -extern void radeonCopyBuffer( const __DRIdrawablePrivate *drawable, +extern void radeonCopyBuffer( __DRIdrawablePrivate *drawable, const drm_clip_rect_t *rect); -extern void radeonPageFlip( const __DRIdrawablePrivate *drawable ); +extern void radeonPageFlip( __DRIdrawablePrivate *drawable ); extern void radeonFlush( GLcontext *ctx ); extern void radeonFinish( GLcontext *ctx ); extern void radeonWaitForIdleLocked( radeonContextPtr rmesa ); diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 5d95d97d539..1551be5e751 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -465,7 +465,6 @@ viaCreateContext(const __GLcontextModes *visual, GLcontext *ctx, *shareCtx; struct via_context *vmesa; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - __DRIdrawablePrivate *dPriv = driContextPriv->driDrawablePriv; viaScreenPrivate *viaScreen = (viaScreenPrivate *)sPriv->private; drm_via_sarea_t *saPriv = (drm_via_sarea_t *) (((GLubyte *)sPriv->pSAREA) + viaScreen->sareaPrivOffset); @@ -659,10 +658,6 @@ viaCreateContext(const __GLcontextModes *visual, driQueryOptionb(&vmesa->optionCache, "no_rast")) FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1); - dPriv->vblFlags = - vmesa->viaScreen->irqEnabled ? - driGetDefaultVBlankFlags(&vmesa->optionCache) : VBLANK_FLAG_NO_IRQ; - if (getenv("VIA_PAGEFLIP")) vmesa->allowPageFlip = 1; @@ -838,12 +833,17 @@ viaMakeCurrent(__DRIcontextPrivate *driContextPriv, drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate; readBuffer = (GLframebuffer *)driReadPriv->driverPrivate; - if (vmesa->driDrawable != driDrawPriv) { - driDrawableInitVBlank(driDrawPriv); - } - if ((vmesa->driDrawable != driDrawPriv) || (vmesa->driReadable != driReadPriv)) { + if (driDrawPriv->swap_interval == (unsigned)-1) { + driDrawPriv->vblFlags = + vmesa->viaScreen->irqEnabled ? + driGetDefaultVBlankFlags(&vmesa->optionCache) : + VBLANK_FLAG_NO_IRQ; + + driDrawableInitVBlank(driDrawPriv); + } + vmesa->driDrawable = driDrawPriv; vmesa->driReadable = driReadPriv; diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 3c7dafd0e6b..a14a4613d3e 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -523,8 +523,7 @@ static void viaWaitIdleVBlank( __DRIdrawablePrivate *dPriv, vmesa->thrashing) viaSwapOutWork(vmesa); - driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags, - & missed_target ); + driWaitForVBlank( dPriv, & missed_target ); if ( missed_target ) { vmesa->swap_missed_count++; (*dri_interface->getUST)( &vmesa->swap_missed_ust ); -- cgit v1.2.3 From 4c53635aab587e1d832b602b88aaf17bc5c8301e Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 30 Oct 2007 14:09:17 +0100 Subject: add missing _mesa_StencilFuncSeparateATI function --- src/mesa/main/stencil.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/stencil.h | 2 ++ 2 files changed, 77 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index e61eb0030c0..ca7f6eaf88b 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -82,6 +82,81 @@ _mesa_ClearStencil( GLint s ) } +/** + * Set the function and reference value for stencil testing. + * + * \param frontfunc front test function. + * \param backfunc back test function. + * \param ref front and back reference value. + * \param mask front and back bitmask. + * + * \sa glStencilFunc(). + * + * Verifies the parameters and updates the respective values in + * __GLcontextRec::Stencil. On change flushes the vertices and notifies the + * driver via the dd_function_table::StencilFunc callback. + */ +void GLAPIENTRY +_mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask ) +{ + GET_CURRENT_CONTEXT(ctx); + const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; + ASSERT_OUTSIDE_BEGIN_END(ctx); + + switch (frontfunc) { + case GL_NEVER: + case GL_LESS: + case GL_LEQUAL: + case GL_GREATER: + case GL_GEQUAL: + case GL_EQUAL: + case GL_NOTEQUAL: + case GL_ALWAYS: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFuncSeparateATI (0x%04x)", frontfunc ); + return; + } + + switch (backfunc) { + case GL_NEVER: + case GL_LESS: + case GL_LEQUAL: + case GL_GREATER: + case GL_GEQUAL: + case GL_EQUAL: + case GL_NOTEQUAL: + case GL_ALWAYS: + break; + default: + _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFuncSeparateATI (0x%04x)", backfunc ); + return; + } + + ref = CLAMP( ref, 0, stencilMax ); + + /* set both front and back state */ + if (ctx->Stencil.Function[0] == frontfunc && + ctx->Stencil.Function[1] == backfunc && + ctx->Stencil.ValueMask[0] == mask && + ctx->Stencil.ValueMask[1] == mask && + ctx->Stencil.Ref[0] == ref && + ctx->Stencil.Ref[1] == ref) + return; + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.Function[0] = frontfunc; + ctx->Stencil.Function[1] = backfunc; + ctx->Stencil.Ref[0] = ctx->Stencil.Ref[1] = ref; + ctx->Stencil.ValueMask[0] = ctx->Stencil.ValueMask[1] = mask; + if (ctx->Driver.StencilFuncSeparate) { + ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT, + frontfunc, ref, mask); + ctx->Driver.StencilFuncSeparate(ctx, GL_BACK, + backfunc, ref, mask); + } +} + + /** * Set the function and reference value for stencil testing. * diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h index 27c6362023c..0be98100053 100644 --- a/src/mesa/main/stencil.h +++ b/src/mesa/main/stencil.h @@ -62,6 +62,8 @@ _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); extern void GLAPIENTRY _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); +extern void GLAPIENTRY +_mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); extern void GLAPIENTRY _mesa_StencilMaskSeparate(GLenum face, GLuint mask); -- cgit v1.2.3 From f70ca96ba9eaeb380861fb657fca99f129b7f232 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 30 Oct 2007 09:13:58 -0600 Subject: Finish up ATI_separate_stencil Add entrypoints to glapi XML file and regenerate files. Implement glStencilOpSeparateATI(). Consolidate some code in stencil.c --- src/mesa/drivers/dri/common/extension_helper.h | 22 + src/mesa/glapi/dispatch.h | 24 +- src/mesa/glapi/gl_API.xml | 29 + src/mesa/glapi/glapioffsets.h | 14 +- src/mesa/glapi/glapitable.h | 10 +- src/mesa/glapi/glapitemp.h | 32 +- src/mesa/glapi/glprocs.h | 564 +++++------ src/mesa/main/enums.c | 1224 ++++++++++++------------ src/mesa/main/state.c | 4 + src/mesa/main/stencil.c | 289 +++--- src/mesa/main/stencil.h | 8 +- src/mesa/sparc/glapi_sparc.S | 4 + src/mesa/x86-64/glapi_x86-64.S | 92 ++ src/mesa/x86/glapi_x86.S | 16 +- 14 files changed, 1258 insertions(+), 1074 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h index bf103a3931f..726d9900c3a 100644 --- a/src/mesa/drivers/dri/common/extension_helper.h +++ b/src/mesa/drivers/dri/common/extension_helper.h @@ -3839,6 +3839,13 @@ static const char Binormal3svEXT_names[] = ""; #endif +#if defined(need_GL_ATI_separate_stencil) +static const char StencilOpSeparateATI_names[] = + "iiii\0" /* Parameter signature */ + "glStencilOpSeparateATI\0" + ""; +#endif + #if defined(need_GL_EXT_light_texture) static const char ApplyTextureEXT_names[] = "i\0" /* Parameter signature */ @@ -4179,6 +4186,13 @@ static const char ActiveStencilFaceEXT_names[] = ""; #endif +#if defined(need_GL_ATI_separate_stencil) +static const char StencilFuncSeparateATI_names[] = + "iiii\0" /* Parameter signature */ + "glStencilFuncSeparateATI\0" + ""; +#endif + #if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) static const char GetShaderSourceARB_names[] = "iipp\0" /* Parameter signature */ @@ -5182,6 +5196,14 @@ static const struct dri_extension_function GL_ATI_fragment_shader_functions[] = }; #endif +#if defined(need_GL_ATI_separate_stencil) +static const struct dri_extension_function GL_ATI_separate_stencil_functions[] = { + { StencilOpSeparateATI_names, StencilOpSeparateATI_remap_index, -1 }, + { StencilFuncSeparateATI_names, StencilFuncSeparateATI_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + #if defined(need_GL_EXT_blend_color) static const struct dri_extension_function GL_EXT_blend_color_functions[] = { { BlendColor_names, -1, 336 }, diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index 0ce59f7b99c..e46f159f943 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -2365,6 +2365,12 @@ #define CALL_FramebufferTextureLayerEXT(disp, parameters) (*((disp)->FramebufferTextureLayerEXT)) parameters #define GET_FramebufferTextureLayerEXT(disp) ((disp)->FramebufferTextureLayerEXT) #define SET_FramebufferTextureLayerEXT(disp, fn) ((disp)->FramebufferTextureLayerEXT = fn) +#define CALL_StencilFuncSeparateATI(disp, parameters) (*((disp)->StencilFuncSeparateATI)) parameters +#define GET_StencilFuncSeparateATI(disp) ((disp)->StencilFuncSeparateATI) +#define SET_StencilFuncSeparateATI(disp, fn) ((disp)->StencilFuncSeparateATI = fn) +#define CALL_StencilOpSeparateATI(disp, parameters) (*((disp)->StencilOpSeparateATI)) parameters +#define GET_StencilOpSeparateATI(disp) ((disp)->StencilOpSeparateATI) +#define SET_StencilOpSeparateATI(disp, fn) ((disp)->StencilOpSeparateATI = fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) (*((disp)->ProgramEnvParameters4fvEXT)) parameters #define GET_ProgramEnvParameters4fvEXT(disp) ((disp)->ProgramEnvParameters4fvEXT) #define SET_ProgramEnvParameters4fvEXT(disp, fn) ((disp)->ProgramEnvParameters4fvEXT = fn) @@ -2380,7 +2386,7 @@ #else -#define driDispatchRemapTable_size 365 +#define driDispatchRemapTable_size 367 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define AttachShader_remap_index 0 @@ -2744,10 +2750,12 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define RenderbufferStorageEXT_remap_index 358 #define BlitFramebufferEXT_remap_index 359 #define FramebufferTextureLayerEXT_remap_index 360 -#define ProgramEnvParameters4fvEXT_remap_index 361 -#define ProgramLocalParameters4fvEXT_remap_index 362 -#define GetQueryObjecti64vEXT_remap_index 363 -#define GetQueryObjectui64vEXT_remap_index 364 +#define StencilFuncSeparateATI_remap_index 361 +#define StencilOpSeparateATI_remap_index 362 +#define ProgramEnvParameters4fvEXT_remap_index 363 +#define ProgramLocalParameters4fvEXT_remap_index 364 +#define GetQueryObjecti64vEXT_remap_index 365 +#define GetQueryObjectui64vEXT_remap_index 366 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) @@ -3832,6 +3840,12 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_FramebufferTextureLayerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLuint, GLint, GLint)), driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index], parameters) #define GET_FramebufferTextureLayerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index]) #define SET_FramebufferTextureLayerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index], fn) +#define CALL_StencilFuncSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparateATI_remap_index], parameters) +#define GET_StencilFuncSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index]) +#define SET_StencilFuncSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index], fn) +#define CALL_StencilOpSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[StencilOpSeparateATI_remap_index], parameters) +#define GET_StencilOpSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilOpSeparateATI_remap_index]) +#define SET_StencilOpSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilOpSeparateATI_remap_index], fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], parameters) #define GET_ProgramEnvParameters4fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]) #define SET_ProgramEnvParameters4fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], fn) diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index 4bd3b2f0fb7..e16ffe870f6 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -12156,6 +12156,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mesa/glapi/glapioffsets.h b/src/mesa/glapi/glapioffsets.h index c207a06ac46..a2db342ffe0 100644 --- a/src/mesa/glapi/glapioffsets.h +++ b/src/mesa/glapi/glapioffsets.h @@ -801,11 +801,13 @@ #define _gloffset_RenderbufferStorageEXT 766 #define _gloffset_BlitFramebufferEXT 767 #define _gloffset_FramebufferTextureLayerEXT 768 -#define _gloffset_ProgramEnvParameters4fvEXT 769 -#define _gloffset_ProgramLocalParameters4fvEXT 770 -#define _gloffset_GetQueryObjecti64vEXT 771 -#define _gloffset_GetQueryObjectui64vEXT 772 -#define _gloffset_FIRST_DYNAMIC 773 +#define _gloffset_StencilFuncSeparateATI 769 +#define _gloffset_StencilOpSeparateATI 770 +#define _gloffset_ProgramEnvParameters4fvEXT 771 +#define _gloffset_ProgramLocalParameters4fvEXT 772 +#define _gloffset_GetQueryObjecti64vEXT 773 +#define _gloffset_GetQueryObjectui64vEXT 774 +#define _gloffset_FIRST_DYNAMIC 775 #else @@ -1170,6 +1172,8 @@ #define _gloffset_RenderbufferStorageEXT driDispatchRemapTable[RenderbufferStorageEXT_remap_index] #define _gloffset_BlitFramebufferEXT driDispatchRemapTable[BlitFramebufferEXT_remap_index] #define _gloffset_FramebufferTextureLayerEXT driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index] +#define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index] +#define _gloffset_StencilOpSeparateATI driDispatchRemapTable[StencilOpSeparateATI_remap_index] #define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index] #define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index] #define _gloffset_GetQueryObjecti64vEXT driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index] diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h index 1e4c2949e46..148aa96b88d 100644 --- a/src/mesa/glapi/glapitable.h +++ b/src/mesa/glapi/glapitable.h @@ -810,10 +810,12 @@ struct _glapi_table void (GLAPIENTRYP RenderbufferStorageEXT)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 766 */ void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 767 */ void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 768 */ - void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 769 */ - void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 770 */ - void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 771 */ - void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 772 */ + void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 769 */ + void (GLAPIENTRYP StencilOpSeparateATI)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); /* 770 */ + void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 771 */ + void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 772 */ + void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 773 */ + void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 774 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h index 10af9b30858..cd420fdee57 100644 --- a/src/mesa/glapi/glapitemp.h +++ b/src/mesa/glapi/glapitemp.h @@ -5446,30 +5446,44 @@ KEYWORD1 void KEYWORD2 NAME(FramebufferTextureLayerEXT)(GLenum target, GLenum at DISPATCH(FramebufferTextureLayerEXT, (target, attachment, texture, level, layer), (F, "glFramebufferTextureLayerEXT(0x%x, 0x%x, %d, %d, %d);\n", target, attachment, texture, level, layer)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) +{ + DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask)); +} + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +{ + DISPATCH(StencilOpSeparateATI, (face, sfail, zfail, zpass), (F, "glStencilOpSeparateATI(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); +} + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLuint id, GLenum pname, GLint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params) { DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLuint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLuint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params) { DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } @@ -6261,6 +6275,8 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(_dispatch_stub_770), TABLE_ENTRY(_dispatch_stub_771), TABLE_ENTRY(_dispatch_stub_772), + TABLE_ENTRY(_dispatch_stub_773), + TABLE_ENTRY(_dispatch_stub_774), /* A whole bunch of no-op functions. These might be called * when someone tries to call a dynamically-registered * extension function without a current rendering context. diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h index c461333c51e..657b74e5783 100644 --- a/src/mesa/glapi/glprocs.h +++ b/src/mesa/glapi/glprocs.h @@ -821,6 +821,8 @@ static const char gl_string_table[] = "glRenderbufferStorageEXT\0" "glBlitFramebufferEXT\0" "glFramebufferTextureLayerEXT\0" + "glStencilFuncSeparateATI\0" + "glStencilOpSeparateATI\0" "glProgramEnvParameters4fvEXT\0" "glProgramLocalParameters4fvEXT\0" "glGetQueryObjecti64vEXT\0" @@ -1148,6 +1150,8 @@ static const char gl_string_table[] = #define gl_dispatch_stub_770 mgl_dispatch_stub_770 #define gl_dispatch_stub_771 mgl_dispatch_stub_771 #define gl_dispatch_stub_772 mgl_dispatch_stub_772 +#define gl_dispatch_stub_773 mgl_dispatch_stub_773 +#define gl_dispatch_stub_774 mgl_dispatch_stub_774 #endif /* USE_MGL_NAMESPACE */ @@ -1198,6 +1202,8 @@ extern void gl_dispatch_stub_769(void); extern void gl_dispatch_stub_770(void); extern void gl_dispatch_stub_771(void); extern void gl_dispatch_stub_772(void); +extern void gl_dispatch_stub_773(void); +extern void gl_dispatch_stub_774(void); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { @@ -1970,284 +1976,286 @@ static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET(13424, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), NAME_FUNC_OFFSET(13449, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_BlitFramebufferEXT), NAME_FUNC_OFFSET(13470, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), - NAME_FUNC_OFFSET(13499, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_ProgramEnvParameters4fvEXT), - NAME_FUNC_OFFSET(13528, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_ProgramLocalParameters4fvEXT), - NAME_FUNC_OFFSET(13559, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_GetQueryObjecti64vEXT), - NAME_FUNC_OFFSET(13583, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_GetQueryObjectui64vEXT), - NAME_FUNC_OFFSET(13608, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), - NAME_FUNC_OFFSET(13626, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), - NAME_FUNC_OFFSET(13643, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), - NAME_FUNC_OFFSET(13659, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), - NAME_FUNC_OFFSET(13684, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), - NAME_FUNC_OFFSET(13704, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), - NAME_FUNC_OFFSET(13724, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), - NAME_FUNC_OFFSET(13747, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), - NAME_FUNC_OFFSET(13770, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), - NAME_FUNC_OFFSET(13790, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), - NAME_FUNC_OFFSET(13807, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), - NAME_FUNC_OFFSET(13824, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), - NAME_FUNC_OFFSET(13839, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), - NAME_FUNC_OFFSET(13863, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), - NAME_FUNC_OFFSET(13882, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), - NAME_FUNC_OFFSET(13901, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), - NAME_FUNC_OFFSET(13917, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), - NAME_FUNC_OFFSET(13936, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), - NAME_FUNC_OFFSET(13959, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(13975, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(13991, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), - NAME_FUNC_OFFSET(14018, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), - NAME_FUNC_OFFSET(14045, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), - NAME_FUNC_OFFSET(14065, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14084, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14103, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14133, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14163, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14193, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14223, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), - NAME_FUNC_OFFSET(14242, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), - NAME_FUNC_OFFSET(14265, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), - NAME_FUNC_OFFSET(14290, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), - NAME_FUNC_OFFSET(14315, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), - NAME_FUNC_OFFSET(14342, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), - NAME_FUNC_OFFSET(14370, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), - NAME_FUNC_OFFSET(14397, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), - NAME_FUNC_OFFSET(14425, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), - NAME_FUNC_OFFSET(14454, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), - NAME_FUNC_OFFSET(14483, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), - NAME_FUNC_OFFSET(14509, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), - NAME_FUNC_OFFSET(14540, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), - NAME_FUNC_OFFSET(14571, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), - NAME_FUNC_OFFSET(14595, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), - NAME_FUNC_OFFSET(14618, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), - NAME_FUNC_OFFSET(14636, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), - NAME_FUNC_OFFSET(14665, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), - NAME_FUNC_OFFSET(14694, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), - NAME_FUNC_OFFSET(14709, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), - NAME_FUNC_OFFSET(14735, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), - NAME_FUNC_OFFSET(14761, glHistogram, glHistogram, NULL, _gloffset_Histogram), - NAME_FUNC_OFFSET(14776, glMinmax, glMinmax, NULL, _gloffset_Minmax), - NAME_FUNC_OFFSET(14788, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), - NAME_FUNC_OFFSET(14808, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), - NAME_FUNC_OFFSET(14825, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), - NAME_FUNC_OFFSET(14841, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), - NAME_FUNC_OFFSET(14860, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), - NAME_FUNC_OFFSET(14883, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), - NAME_FUNC_OFFSET(14899, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), - NAME_FUNC_OFFSET(14921, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), - NAME_FUNC_OFFSET(14939, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), - NAME_FUNC_OFFSET(14958, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), - NAME_FUNC_OFFSET(14976, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), - NAME_FUNC_OFFSET(14995, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), - NAME_FUNC_OFFSET(15013, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), - NAME_FUNC_OFFSET(15032, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), - NAME_FUNC_OFFSET(15050, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), - NAME_FUNC_OFFSET(15069, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), - NAME_FUNC_OFFSET(15087, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), - NAME_FUNC_OFFSET(15106, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), - NAME_FUNC_OFFSET(15124, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), - NAME_FUNC_OFFSET(15143, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), - NAME_FUNC_OFFSET(15161, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), - NAME_FUNC_OFFSET(15180, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), - NAME_FUNC_OFFSET(15198, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), - NAME_FUNC_OFFSET(15217, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), - NAME_FUNC_OFFSET(15235, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), - NAME_FUNC_OFFSET(15254, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), - NAME_FUNC_OFFSET(15272, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), - NAME_FUNC_OFFSET(15291, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), - NAME_FUNC_OFFSET(15309, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), - NAME_FUNC_OFFSET(15328, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), - NAME_FUNC_OFFSET(15346, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), - NAME_FUNC_OFFSET(15365, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), - NAME_FUNC_OFFSET(15383, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), - NAME_FUNC_OFFSET(15402, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), - NAME_FUNC_OFFSET(15420, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), - NAME_FUNC_OFFSET(15439, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), - NAME_FUNC_OFFSET(15457, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), - NAME_FUNC_OFFSET(15476, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), - NAME_FUNC_OFFSET(15494, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), - NAME_FUNC_OFFSET(15513, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), - NAME_FUNC_OFFSET(15536, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), - NAME_FUNC_OFFSET(15559, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), - NAME_FUNC_OFFSET(15582, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), - NAME_FUNC_OFFSET(15605, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), - NAME_FUNC_OFFSET(15622, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), - NAME_FUNC_OFFSET(15645, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), - NAME_FUNC_OFFSET(15668, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), - NAME_FUNC_OFFSET(15691, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), - NAME_FUNC_OFFSET(15717, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), - NAME_FUNC_OFFSET(15743, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), - NAME_FUNC_OFFSET(15769, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), - NAME_FUNC_OFFSET(15793, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15820, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), - NAME_FUNC_OFFSET(15846, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), - NAME_FUNC_OFFSET(15866, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), - NAME_FUNC_OFFSET(15886, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), - NAME_FUNC_OFFSET(15906, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), - NAME_FUNC_OFFSET(15923, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), - NAME_FUNC_OFFSET(15941, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), - NAME_FUNC_OFFSET(15958, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), - NAME_FUNC_OFFSET(15976, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), - NAME_FUNC_OFFSET(15993, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), - NAME_FUNC_OFFSET(16011, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), - NAME_FUNC_OFFSET(16028, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), - NAME_FUNC_OFFSET(16046, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), - NAME_FUNC_OFFSET(16063, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), - NAME_FUNC_OFFSET(16081, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), - NAME_FUNC_OFFSET(16098, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), - NAME_FUNC_OFFSET(16116, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), - NAME_FUNC_OFFSET(16133, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), - NAME_FUNC_OFFSET(16151, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), - NAME_FUNC_OFFSET(16168, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), - NAME_FUNC_OFFSET(16186, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), - NAME_FUNC_OFFSET(16203, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), - NAME_FUNC_OFFSET(16221, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), - NAME_FUNC_OFFSET(16240, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), - NAME_FUNC_OFFSET(16259, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), - NAME_FUNC_OFFSET(16278, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), - NAME_FUNC_OFFSET(16297, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), - NAME_FUNC_OFFSET(16317, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), - NAME_FUNC_OFFSET(16337, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), - NAME_FUNC_OFFSET(16357, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), - NAME_FUNC_OFFSET(16375, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), - NAME_FUNC_OFFSET(16392, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), - NAME_FUNC_OFFSET(16410, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), - NAME_FUNC_OFFSET(16427, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), - NAME_FUNC_OFFSET(16445, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), - NAME_FUNC_OFFSET(16463, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), - NAME_FUNC_OFFSET(16480, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), - NAME_FUNC_OFFSET(16498, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), - NAME_FUNC_OFFSET(16517, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), - NAME_FUNC_OFFSET(16536, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), - NAME_FUNC_OFFSET(16555, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), - NAME_FUNC_OFFSET(16577, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), - NAME_FUNC_OFFSET(16590, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), - NAME_FUNC_OFFSET(16603, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), - NAME_FUNC_OFFSET(16619, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), - NAME_FUNC_OFFSET(16635, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), - NAME_FUNC_OFFSET(16648, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), - NAME_FUNC_OFFSET(16671, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), - NAME_FUNC_OFFSET(16691, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), - NAME_FUNC_OFFSET(16710, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), - NAME_FUNC_OFFSET(16721, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), - NAME_FUNC_OFFSET(16733, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), - NAME_FUNC_OFFSET(16747, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), - NAME_FUNC_OFFSET(16760, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), - NAME_FUNC_OFFSET(16776, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), - NAME_FUNC_OFFSET(16787, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), - NAME_FUNC_OFFSET(16800, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), - NAME_FUNC_OFFSET(16819, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), - NAME_FUNC_OFFSET(16839, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), - NAME_FUNC_OFFSET(16852, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), - NAME_FUNC_OFFSET(16862, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), - NAME_FUNC_OFFSET(16878, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), - NAME_FUNC_OFFSET(16897, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), - NAME_FUNC_OFFSET(16915, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), - NAME_FUNC_OFFSET(16936, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), - NAME_FUNC_OFFSET(16951, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), - NAME_FUNC_OFFSET(16966, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), - NAME_FUNC_OFFSET(16980, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), - NAME_FUNC_OFFSET(16995, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), - NAME_FUNC_OFFSET(17007, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), - NAME_FUNC_OFFSET(17020, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), - NAME_FUNC_OFFSET(17032, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), - NAME_FUNC_OFFSET(17045, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), - NAME_FUNC_OFFSET(17057, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), - NAME_FUNC_OFFSET(17070, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), - NAME_FUNC_OFFSET(17082, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), - NAME_FUNC_OFFSET(17095, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), - NAME_FUNC_OFFSET(17107, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), - NAME_FUNC_OFFSET(17120, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), - NAME_FUNC_OFFSET(17132, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), - NAME_FUNC_OFFSET(17145, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), - NAME_FUNC_OFFSET(17157, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), - NAME_FUNC_OFFSET(17170, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), - NAME_FUNC_OFFSET(17182, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), - NAME_FUNC_OFFSET(17195, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), - NAME_FUNC_OFFSET(17214, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), - NAME_FUNC_OFFSET(17233, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), - NAME_FUNC_OFFSET(17252, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), - NAME_FUNC_OFFSET(17265, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), - NAME_FUNC_OFFSET(17283, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), - NAME_FUNC_OFFSET(17304, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), - NAME_FUNC_OFFSET(17322, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), - NAME_FUNC_OFFSET(17342, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17356, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17373, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(17389, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(17408, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17426, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17447, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(17469, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17488, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17510, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(17533, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(17552, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(17572, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(17591, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(17611, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(17630, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(17650, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(17669, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(17689, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(17708, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(17728, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(17748, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(17769, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(17789, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(17810, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(17830, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(17851, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(17875, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(17893, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(17913, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(17931, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(17943, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(17956, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(17968, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(17981, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18001, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18025, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18039, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18056, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18071, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18089, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18103, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18120, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18135, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18153, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18167, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18184, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18199, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18217, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18231, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18248, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18263, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18281, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18295, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18312, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18327, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18345, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18359, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18376, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18391, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18409, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18423, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(18440, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18455, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(18473, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18487, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(18504, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18519, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(18537, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(18554, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(18574, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(18591, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18617, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(18646, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(18661, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(18679, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(18698, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(18722, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(13499, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_StencilFuncSeparateATI), + NAME_FUNC_OFFSET(13524, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_StencilOpSeparateATI), + NAME_FUNC_OFFSET(13547, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_ProgramEnvParameters4fvEXT), + NAME_FUNC_OFFSET(13576, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_ProgramLocalParameters4fvEXT), + NAME_FUNC_OFFSET(13607, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_GetQueryObjecti64vEXT), + NAME_FUNC_OFFSET(13631, gl_dispatch_stub_774, gl_dispatch_stub_774, NULL, _gloffset_GetQueryObjectui64vEXT), + NAME_FUNC_OFFSET(13656, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), + NAME_FUNC_OFFSET(13674, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), + NAME_FUNC_OFFSET(13691, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), + NAME_FUNC_OFFSET(13707, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), + NAME_FUNC_OFFSET(13732, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), + NAME_FUNC_OFFSET(13752, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), + NAME_FUNC_OFFSET(13772, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), + NAME_FUNC_OFFSET(13795, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), + NAME_FUNC_OFFSET(13818, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), + NAME_FUNC_OFFSET(13838, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), + NAME_FUNC_OFFSET(13855, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), + NAME_FUNC_OFFSET(13872, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), + NAME_FUNC_OFFSET(13887, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), + NAME_FUNC_OFFSET(13911, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), + NAME_FUNC_OFFSET(13930, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), + NAME_FUNC_OFFSET(13949, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), + NAME_FUNC_OFFSET(13965, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), + NAME_FUNC_OFFSET(13984, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), + NAME_FUNC_OFFSET(14007, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14023, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14039, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), + NAME_FUNC_OFFSET(14066, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), + NAME_FUNC_OFFSET(14093, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), + NAME_FUNC_OFFSET(14113, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14132, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14151, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14181, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14211, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14241, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14271, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), + NAME_FUNC_OFFSET(14290, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), + NAME_FUNC_OFFSET(14313, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), + NAME_FUNC_OFFSET(14338, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), + NAME_FUNC_OFFSET(14363, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), + NAME_FUNC_OFFSET(14390, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), + NAME_FUNC_OFFSET(14418, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), + NAME_FUNC_OFFSET(14445, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), + NAME_FUNC_OFFSET(14473, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), + NAME_FUNC_OFFSET(14502, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), + NAME_FUNC_OFFSET(14531, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), + NAME_FUNC_OFFSET(14557, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), + NAME_FUNC_OFFSET(14588, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), + NAME_FUNC_OFFSET(14619, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), + NAME_FUNC_OFFSET(14643, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), + NAME_FUNC_OFFSET(14666, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), + NAME_FUNC_OFFSET(14684, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), + NAME_FUNC_OFFSET(14713, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), + NAME_FUNC_OFFSET(14742, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), + NAME_FUNC_OFFSET(14757, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), + NAME_FUNC_OFFSET(14783, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), + NAME_FUNC_OFFSET(14809, glHistogram, glHistogram, NULL, _gloffset_Histogram), + NAME_FUNC_OFFSET(14824, glMinmax, glMinmax, NULL, _gloffset_Minmax), + NAME_FUNC_OFFSET(14836, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), + NAME_FUNC_OFFSET(14856, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), + NAME_FUNC_OFFSET(14873, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), + NAME_FUNC_OFFSET(14889, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), + NAME_FUNC_OFFSET(14908, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), + NAME_FUNC_OFFSET(14931, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), + NAME_FUNC_OFFSET(14947, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), + NAME_FUNC_OFFSET(14969, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), + NAME_FUNC_OFFSET(14987, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), + NAME_FUNC_OFFSET(15006, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), + NAME_FUNC_OFFSET(15024, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), + NAME_FUNC_OFFSET(15043, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), + NAME_FUNC_OFFSET(15061, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), + NAME_FUNC_OFFSET(15080, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), + NAME_FUNC_OFFSET(15098, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), + NAME_FUNC_OFFSET(15117, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), + NAME_FUNC_OFFSET(15135, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), + NAME_FUNC_OFFSET(15154, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), + NAME_FUNC_OFFSET(15172, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), + NAME_FUNC_OFFSET(15191, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), + NAME_FUNC_OFFSET(15209, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), + NAME_FUNC_OFFSET(15228, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), + NAME_FUNC_OFFSET(15246, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), + NAME_FUNC_OFFSET(15265, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), + NAME_FUNC_OFFSET(15283, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), + NAME_FUNC_OFFSET(15302, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), + NAME_FUNC_OFFSET(15320, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), + NAME_FUNC_OFFSET(15339, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), + NAME_FUNC_OFFSET(15357, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), + NAME_FUNC_OFFSET(15376, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), + NAME_FUNC_OFFSET(15394, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), + NAME_FUNC_OFFSET(15413, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), + NAME_FUNC_OFFSET(15431, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), + NAME_FUNC_OFFSET(15450, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), + NAME_FUNC_OFFSET(15468, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), + NAME_FUNC_OFFSET(15487, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), + NAME_FUNC_OFFSET(15505, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), + NAME_FUNC_OFFSET(15524, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), + NAME_FUNC_OFFSET(15542, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(15561, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), + NAME_FUNC_OFFSET(15584, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), + NAME_FUNC_OFFSET(15607, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), + NAME_FUNC_OFFSET(15630, glMultTransposeMatrixfARB, glMultTransposeMatrixfARB, NULL, _gloffset_MultTransposeMatrixfARB), + NAME_FUNC_OFFSET(15653, glSampleCoverageARB, glSampleCoverageARB, NULL, _gloffset_SampleCoverageARB), + NAME_FUNC_OFFSET(15670, glCompressedTexImage1DARB, glCompressedTexImage1DARB, NULL, _gloffset_CompressedTexImage1DARB), + NAME_FUNC_OFFSET(15693, glCompressedTexImage2DARB, glCompressedTexImage2DARB, NULL, _gloffset_CompressedTexImage2DARB), + NAME_FUNC_OFFSET(15716, glCompressedTexImage3DARB, glCompressedTexImage3DARB, NULL, _gloffset_CompressedTexImage3DARB), + NAME_FUNC_OFFSET(15739, glCompressedTexSubImage1DARB, glCompressedTexSubImage1DARB, NULL, _gloffset_CompressedTexSubImage1DARB), + NAME_FUNC_OFFSET(15765, glCompressedTexSubImage2DARB, glCompressedTexSubImage2DARB, NULL, _gloffset_CompressedTexSubImage2DARB), + NAME_FUNC_OFFSET(15791, glCompressedTexSubImage3DARB, glCompressedTexSubImage3DARB, NULL, _gloffset_CompressedTexSubImage3DARB), + NAME_FUNC_OFFSET(15817, glGetCompressedTexImageARB, glGetCompressedTexImageARB, NULL, _gloffset_GetCompressedTexImageARB), + NAME_FUNC_OFFSET(15841, glDisableVertexAttribArrayARB, glDisableVertexAttribArrayARB, NULL, _gloffset_DisableVertexAttribArrayARB), + NAME_FUNC_OFFSET(15868, glEnableVertexAttribArrayARB, glEnableVertexAttribArrayARB, NULL, _gloffset_EnableVertexAttribArrayARB), + NAME_FUNC_OFFSET(15894, glGetVertexAttribdvARB, glGetVertexAttribdvARB, NULL, _gloffset_GetVertexAttribdvARB), + NAME_FUNC_OFFSET(15914, glGetVertexAttribfvARB, glGetVertexAttribfvARB, NULL, _gloffset_GetVertexAttribfvARB), + NAME_FUNC_OFFSET(15934, glGetVertexAttribivARB, glGetVertexAttribivARB, NULL, _gloffset_GetVertexAttribivARB), + NAME_FUNC_OFFSET(15954, glVertexAttrib1dARB, glVertexAttrib1dARB, NULL, _gloffset_VertexAttrib1dARB), + NAME_FUNC_OFFSET(15971, glVertexAttrib1dvARB, glVertexAttrib1dvARB, NULL, _gloffset_VertexAttrib1dvARB), + NAME_FUNC_OFFSET(15989, glVertexAttrib1fARB, glVertexAttrib1fARB, NULL, _gloffset_VertexAttrib1fARB), + NAME_FUNC_OFFSET(16006, glVertexAttrib1fvARB, glVertexAttrib1fvARB, NULL, _gloffset_VertexAttrib1fvARB), + NAME_FUNC_OFFSET(16024, glVertexAttrib1sARB, glVertexAttrib1sARB, NULL, _gloffset_VertexAttrib1sARB), + NAME_FUNC_OFFSET(16041, glVertexAttrib1svARB, glVertexAttrib1svARB, NULL, _gloffset_VertexAttrib1svARB), + NAME_FUNC_OFFSET(16059, glVertexAttrib2dARB, glVertexAttrib2dARB, NULL, _gloffset_VertexAttrib2dARB), + NAME_FUNC_OFFSET(16076, glVertexAttrib2dvARB, glVertexAttrib2dvARB, NULL, _gloffset_VertexAttrib2dvARB), + NAME_FUNC_OFFSET(16094, glVertexAttrib2fARB, glVertexAttrib2fARB, NULL, _gloffset_VertexAttrib2fARB), + NAME_FUNC_OFFSET(16111, glVertexAttrib2fvARB, glVertexAttrib2fvARB, NULL, _gloffset_VertexAttrib2fvARB), + NAME_FUNC_OFFSET(16129, glVertexAttrib2sARB, glVertexAttrib2sARB, NULL, _gloffset_VertexAttrib2sARB), + NAME_FUNC_OFFSET(16146, glVertexAttrib2svARB, glVertexAttrib2svARB, NULL, _gloffset_VertexAttrib2svARB), + NAME_FUNC_OFFSET(16164, glVertexAttrib3dARB, glVertexAttrib3dARB, NULL, _gloffset_VertexAttrib3dARB), + NAME_FUNC_OFFSET(16181, glVertexAttrib3dvARB, glVertexAttrib3dvARB, NULL, _gloffset_VertexAttrib3dvARB), + NAME_FUNC_OFFSET(16199, glVertexAttrib3fARB, glVertexAttrib3fARB, NULL, _gloffset_VertexAttrib3fARB), + NAME_FUNC_OFFSET(16216, glVertexAttrib3fvARB, glVertexAttrib3fvARB, NULL, _gloffset_VertexAttrib3fvARB), + NAME_FUNC_OFFSET(16234, glVertexAttrib3sARB, glVertexAttrib3sARB, NULL, _gloffset_VertexAttrib3sARB), + NAME_FUNC_OFFSET(16251, glVertexAttrib3svARB, glVertexAttrib3svARB, NULL, _gloffset_VertexAttrib3svARB), + NAME_FUNC_OFFSET(16269, glVertexAttrib4NbvARB, glVertexAttrib4NbvARB, NULL, _gloffset_VertexAttrib4NbvARB), + NAME_FUNC_OFFSET(16288, glVertexAttrib4NivARB, glVertexAttrib4NivARB, NULL, _gloffset_VertexAttrib4NivARB), + NAME_FUNC_OFFSET(16307, glVertexAttrib4NsvARB, glVertexAttrib4NsvARB, NULL, _gloffset_VertexAttrib4NsvARB), + NAME_FUNC_OFFSET(16326, glVertexAttrib4NubARB, glVertexAttrib4NubARB, NULL, _gloffset_VertexAttrib4NubARB), + NAME_FUNC_OFFSET(16345, glVertexAttrib4NubvARB, glVertexAttrib4NubvARB, NULL, _gloffset_VertexAttrib4NubvARB), + NAME_FUNC_OFFSET(16365, glVertexAttrib4NuivARB, glVertexAttrib4NuivARB, NULL, _gloffset_VertexAttrib4NuivARB), + NAME_FUNC_OFFSET(16385, glVertexAttrib4NusvARB, glVertexAttrib4NusvARB, NULL, _gloffset_VertexAttrib4NusvARB), + NAME_FUNC_OFFSET(16405, glVertexAttrib4bvARB, glVertexAttrib4bvARB, NULL, _gloffset_VertexAttrib4bvARB), + NAME_FUNC_OFFSET(16423, glVertexAttrib4dARB, glVertexAttrib4dARB, NULL, _gloffset_VertexAttrib4dARB), + NAME_FUNC_OFFSET(16440, glVertexAttrib4dvARB, glVertexAttrib4dvARB, NULL, _gloffset_VertexAttrib4dvARB), + NAME_FUNC_OFFSET(16458, glVertexAttrib4fARB, glVertexAttrib4fARB, NULL, _gloffset_VertexAttrib4fARB), + NAME_FUNC_OFFSET(16475, glVertexAttrib4fvARB, glVertexAttrib4fvARB, NULL, _gloffset_VertexAttrib4fvARB), + NAME_FUNC_OFFSET(16493, glVertexAttrib4ivARB, glVertexAttrib4ivARB, NULL, _gloffset_VertexAttrib4ivARB), + NAME_FUNC_OFFSET(16511, glVertexAttrib4sARB, glVertexAttrib4sARB, NULL, _gloffset_VertexAttrib4sARB), + NAME_FUNC_OFFSET(16528, glVertexAttrib4svARB, glVertexAttrib4svARB, NULL, _gloffset_VertexAttrib4svARB), + NAME_FUNC_OFFSET(16546, glVertexAttrib4ubvARB, glVertexAttrib4ubvARB, NULL, _gloffset_VertexAttrib4ubvARB), + NAME_FUNC_OFFSET(16565, glVertexAttrib4uivARB, glVertexAttrib4uivARB, NULL, _gloffset_VertexAttrib4uivARB), + NAME_FUNC_OFFSET(16584, glVertexAttrib4usvARB, glVertexAttrib4usvARB, NULL, _gloffset_VertexAttrib4usvARB), + NAME_FUNC_OFFSET(16603, glVertexAttribPointerARB, glVertexAttribPointerARB, NULL, _gloffset_VertexAttribPointerARB), + NAME_FUNC_OFFSET(16625, glBindBufferARB, glBindBufferARB, NULL, _gloffset_BindBufferARB), + NAME_FUNC_OFFSET(16638, glBufferDataARB, glBufferDataARB, NULL, _gloffset_BufferDataARB), + NAME_FUNC_OFFSET(16651, glBufferSubDataARB, glBufferSubDataARB, NULL, _gloffset_BufferSubDataARB), + NAME_FUNC_OFFSET(16667, glDeleteBuffersARB, glDeleteBuffersARB, NULL, _gloffset_DeleteBuffersARB), + NAME_FUNC_OFFSET(16683, glGenBuffersARB, glGenBuffersARB, NULL, _gloffset_GenBuffersARB), + NAME_FUNC_OFFSET(16696, glGetBufferParameterivARB, glGetBufferParameterivARB, NULL, _gloffset_GetBufferParameterivARB), + NAME_FUNC_OFFSET(16719, glGetBufferPointervARB, glGetBufferPointervARB, NULL, _gloffset_GetBufferPointervARB), + NAME_FUNC_OFFSET(16739, glGetBufferSubDataARB, glGetBufferSubDataARB, NULL, _gloffset_GetBufferSubDataARB), + NAME_FUNC_OFFSET(16758, glIsBufferARB, glIsBufferARB, NULL, _gloffset_IsBufferARB), + NAME_FUNC_OFFSET(16769, glMapBufferARB, glMapBufferARB, NULL, _gloffset_MapBufferARB), + NAME_FUNC_OFFSET(16781, glUnmapBufferARB, glUnmapBufferARB, NULL, _gloffset_UnmapBufferARB), + NAME_FUNC_OFFSET(16795, glBeginQueryARB, glBeginQueryARB, NULL, _gloffset_BeginQueryARB), + NAME_FUNC_OFFSET(16808, glDeleteQueriesARB, glDeleteQueriesARB, NULL, _gloffset_DeleteQueriesARB), + NAME_FUNC_OFFSET(16824, glEndQueryARB, glEndQueryARB, NULL, _gloffset_EndQueryARB), + NAME_FUNC_OFFSET(16835, glGenQueriesARB, glGenQueriesARB, NULL, _gloffset_GenQueriesARB), + NAME_FUNC_OFFSET(16848, glGetQueryObjectivARB, glGetQueryObjectivARB, NULL, _gloffset_GetQueryObjectivARB), + NAME_FUNC_OFFSET(16867, glGetQueryObjectuivARB, glGetQueryObjectuivARB, NULL, _gloffset_GetQueryObjectuivARB), + NAME_FUNC_OFFSET(16887, glGetQueryivARB, glGetQueryivARB, NULL, _gloffset_GetQueryivARB), + NAME_FUNC_OFFSET(16900, glIsQueryARB, glIsQueryARB, NULL, _gloffset_IsQueryARB), + NAME_FUNC_OFFSET(16910, glCompileShaderARB, glCompileShaderARB, NULL, _gloffset_CompileShaderARB), + NAME_FUNC_OFFSET(16926, glGetActiveUniformARB, glGetActiveUniformARB, NULL, _gloffset_GetActiveUniformARB), + NAME_FUNC_OFFSET(16945, glGetShaderSourceARB, glGetShaderSourceARB, NULL, _gloffset_GetShaderSourceARB), + NAME_FUNC_OFFSET(16963, glGetUniformLocationARB, glGetUniformLocationARB, NULL, _gloffset_GetUniformLocationARB), + NAME_FUNC_OFFSET(16984, glGetUniformfvARB, glGetUniformfvARB, NULL, _gloffset_GetUniformfvARB), + NAME_FUNC_OFFSET(16999, glGetUniformivARB, glGetUniformivARB, NULL, _gloffset_GetUniformivARB), + NAME_FUNC_OFFSET(17014, glLinkProgramARB, glLinkProgramARB, NULL, _gloffset_LinkProgramARB), + NAME_FUNC_OFFSET(17028, glShaderSourceARB, glShaderSourceARB, NULL, _gloffset_ShaderSourceARB), + NAME_FUNC_OFFSET(17043, glUniform1fARB, glUniform1fARB, NULL, _gloffset_Uniform1fARB), + NAME_FUNC_OFFSET(17055, glUniform1fvARB, glUniform1fvARB, NULL, _gloffset_Uniform1fvARB), + NAME_FUNC_OFFSET(17068, glUniform1iARB, glUniform1iARB, NULL, _gloffset_Uniform1iARB), + NAME_FUNC_OFFSET(17080, glUniform1ivARB, glUniform1ivARB, NULL, _gloffset_Uniform1ivARB), + NAME_FUNC_OFFSET(17093, glUniform2fARB, glUniform2fARB, NULL, _gloffset_Uniform2fARB), + NAME_FUNC_OFFSET(17105, glUniform2fvARB, glUniform2fvARB, NULL, _gloffset_Uniform2fvARB), + NAME_FUNC_OFFSET(17118, glUniform2iARB, glUniform2iARB, NULL, _gloffset_Uniform2iARB), + NAME_FUNC_OFFSET(17130, glUniform2ivARB, glUniform2ivARB, NULL, _gloffset_Uniform2ivARB), + NAME_FUNC_OFFSET(17143, glUniform3fARB, glUniform3fARB, NULL, _gloffset_Uniform3fARB), + NAME_FUNC_OFFSET(17155, glUniform3fvARB, glUniform3fvARB, NULL, _gloffset_Uniform3fvARB), + NAME_FUNC_OFFSET(17168, glUniform3iARB, glUniform3iARB, NULL, _gloffset_Uniform3iARB), + NAME_FUNC_OFFSET(17180, glUniform3ivARB, glUniform3ivARB, NULL, _gloffset_Uniform3ivARB), + NAME_FUNC_OFFSET(17193, glUniform4fARB, glUniform4fARB, NULL, _gloffset_Uniform4fARB), + NAME_FUNC_OFFSET(17205, glUniform4fvARB, glUniform4fvARB, NULL, _gloffset_Uniform4fvARB), + NAME_FUNC_OFFSET(17218, glUniform4iARB, glUniform4iARB, NULL, _gloffset_Uniform4iARB), + NAME_FUNC_OFFSET(17230, glUniform4ivARB, glUniform4ivARB, NULL, _gloffset_Uniform4ivARB), + NAME_FUNC_OFFSET(17243, glUniformMatrix2fvARB, glUniformMatrix2fvARB, NULL, _gloffset_UniformMatrix2fvARB), + NAME_FUNC_OFFSET(17262, glUniformMatrix3fvARB, glUniformMatrix3fvARB, NULL, _gloffset_UniformMatrix3fvARB), + NAME_FUNC_OFFSET(17281, glUniformMatrix4fvARB, glUniformMatrix4fvARB, NULL, _gloffset_UniformMatrix4fvARB), + NAME_FUNC_OFFSET(17300, glUseProgramObjectARB, glUseProgramObjectARB, NULL, _gloffset_UseProgramObjectARB), + NAME_FUNC_OFFSET(17313, glValidateProgramARB, glValidateProgramARB, NULL, _gloffset_ValidateProgramARB), + NAME_FUNC_OFFSET(17331, glBindAttribLocationARB, glBindAttribLocationARB, NULL, _gloffset_BindAttribLocationARB), + NAME_FUNC_OFFSET(17352, glGetActiveAttribARB, glGetActiveAttribARB, NULL, _gloffset_GetActiveAttribARB), + NAME_FUNC_OFFSET(17370, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), + NAME_FUNC_OFFSET(17390, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17404, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), + NAME_FUNC_OFFSET(17421, gl_dispatch_stub_568, gl_dispatch_stub_568, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(17437, gl_dispatch_stub_569, gl_dispatch_stub_569, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(17456, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17474, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17495, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(17517, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17536, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17558, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(17581, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(17600, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(17620, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(17639, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(17659, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(17678, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(17698, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(17717, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(17737, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(17756, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(17776, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(17796, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(17817, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(17837, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(17858, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(17878, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(17899, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(17923, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(17941, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(17961, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(17979, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(17991, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(18004, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(18016, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(18029, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18049, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18073, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18087, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18104, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18119, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18137, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18151, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18168, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18183, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18201, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18215, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18232, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18247, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18265, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18279, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18296, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18311, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18329, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18343, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18360, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18375, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18393, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18407, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18424, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18439, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(18457, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18471, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(18488, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18503, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(18521, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18535, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(18552, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18567, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(18585, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(18602, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(18622, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(18639, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18665, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(18694, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(18709, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(18727, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(18746, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(18770, gl_dispatch_stub_749, gl_dispatch_stub_749, NULL, _gloffset_BlendEquationSeparateEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index d5019ae045a..6aeb18fa272 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -1433,9 +1433,13 @@ LONGSTRING static const char enum_string_table[] = "GL_STENCIL\0" "GL_STENCIL_ATTACHMENT_EXT\0" "GL_STENCIL_BACK_FAIL\0" + "GL_STENCIL_BACK_FAIL_ATI\0" "GL_STENCIL_BACK_FUNC\0" + "GL_STENCIL_BACK_FUNC_ATI\0" "GL_STENCIL_BACK_PASS_DEPTH_FAIL\0" + "GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI\0" "GL_STENCIL_BACK_PASS_DEPTH_PASS\0" + "GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI\0" "GL_STENCIL_BACK_REF\0" "GL_STENCIL_BACK_VALUE_MASK\0" "GL_STENCIL_BACK_WRITEMASK\0" @@ -1783,7 +1787,7 @@ LONGSTRING static const char enum_string_table[] = "GL_ZOOM_Y\0" ; -static const enum_elt all_enums[1746] = +static const enum_elt all_enums[1750] = { { 0, 0x00000600 }, /* GL_2D */ { 6, 0x00001407 }, /* GL_2_BYTES */ @@ -3183,354 +3187,358 @@ static const enum_elt all_enums[1746] = { 29675, 0x00001802 }, /* GL_STENCIL */ { 29686, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ { 29712, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ - { 29733, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ - { 29754, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - { 29786, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - { 29818, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ - { 29838, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ - { 29865, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ - { 29891, 0x00000D57 }, /* GL_STENCIL_BITS */ - { 29907, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ - { 29929, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ - { 29952, 0x00000B94 }, /* GL_STENCIL_FAIL */ - { 29968, 0x00000B92 }, /* GL_STENCIL_FUNC */ - { 29984, 0x00001901 }, /* GL_STENCIL_INDEX */ - { 30001, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ - { 30024, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ - { 30046, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ - { 30068, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ - { 30090, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ - { 30111, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ - { 30138, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ - { 30165, 0x00000B97 }, /* GL_STENCIL_REF */ - { 30180, 0x00000B90 }, /* GL_STENCIL_TEST */ - { 30196, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ - { 30225, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ - { 30247, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ - { 30268, 0x00000C33 }, /* GL_STEREO */ - { 30278, 0x000088E2 }, /* GL_STREAM_COPY */ - { 30293, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ - { 30312, 0x000088E0 }, /* GL_STREAM_DRAW */ - { 30327, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ - { 30346, 0x000088E1 }, /* GL_STREAM_READ */ - { 30361, 0x000088E1 }, /* GL_STREAM_READ_ARB */ - { 30380, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ - { 30397, 0x000084E7 }, /* GL_SUBTRACT */ - { 30409, 0x000084E7 }, /* GL_SUBTRACT_ARB */ - { 30425, 0x00002001 }, /* GL_T */ - { 30430, 0x00002A2A }, /* GL_T2F_C3F_V3F */ - { 30445, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ - { 30464, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ - { 30480, 0x00002A2B }, /* GL_T2F_N3F_V3F */ - { 30495, 0x00002A27 }, /* GL_T2F_V3F */ - { 30506, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ - { 30525, 0x00002A28 }, /* GL_T4F_V4F */ - { 30536, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ - { 30559, 0x00001702 }, /* GL_TEXTURE */ - { 30570, 0x000084C0 }, /* GL_TEXTURE0 */ - { 30582, 0x000084C0 }, /* GL_TEXTURE0_ARB */ - { 30598, 0x000084C1 }, /* GL_TEXTURE1 */ - { 30610, 0x000084CA }, /* GL_TEXTURE10 */ - { 30623, 0x000084CA }, /* GL_TEXTURE10_ARB */ - { 30640, 0x000084CB }, /* GL_TEXTURE11 */ - { 30653, 0x000084CB }, /* GL_TEXTURE11_ARB */ - { 30670, 0x000084CC }, /* GL_TEXTURE12 */ - { 30683, 0x000084CC }, /* GL_TEXTURE12_ARB */ - { 30700, 0x000084CD }, /* GL_TEXTURE13 */ - { 30713, 0x000084CD }, /* GL_TEXTURE13_ARB */ - { 30730, 0x000084CE }, /* GL_TEXTURE14 */ - { 30743, 0x000084CE }, /* GL_TEXTURE14_ARB */ - { 30760, 0x000084CF }, /* GL_TEXTURE15 */ - { 30773, 0x000084CF }, /* GL_TEXTURE15_ARB */ - { 30790, 0x000084D0 }, /* GL_TEXTURE16 */ - { 30803, 0x000084D0 }, /* GL_TEXTURE16_ARB */ - { 30820, 0x000084D1 }, /* GL_TEXTURE17 */ - { 30833, 0x000084D1 }, /* GL_TEXTURE17_ARB */ - { 30850, 0x000084D2 }, /* GL_TEXTURE18 */ - { 30863, 0x000084D2 }, /* GL_TEXTURE18_ARB */ - { 30880, 0x000084D3 }, /* GL_TEXTURE19 */ - { 30893, 0x000084D3 }, /* GL_TEXTURE19_ARB */ - { 30910, 0x000084C1 }, /* GL_TEXTURE1_ARB */ - { 30926, 0x000084C2 }, /* GL_TEXTURE2 */ - { 30938, 0x000084D4 }, /* GL_TEXTURE20 */ - { 30951, 0x000084D4 }, /* GL_TEXTURE20_ARB */ - { 30968, 0x000084D5 }, /* GL_TEXTURE21 */ - { 30981, 0x000084D5 }, /* GL_TEXTURE21_ARB */ - { 30998, 0x000084D6 }, /* GL_TEXTURE22 */ - { 31011, 0x000084D6 }, /* GL_TEXTURE22_ARB */ - { 31028, 0x000084D7 }, /* GL_TEXTURE23 */ - { 31041, 0x000084D7 }, /* GL_TEXTURE23_ARB */ - { 31058, 0x000084D8 }, /* GL_TEXTURE24 */ - { 31071, 0x000084D8 }, /* GL_TEXTURE24_ARB */ - { 31088, 0x000084D9 }, /* GL_TEXTURE25 */ - { 31101, 0x000084D9 }, /* GL_TEXTURE25_ARB */ - { 31118, 0x000084DA }, /* GL_TEXTURE26 */ - { 31131, 0x000084DA }, /* GL_TEXTURE26_ARB */ - { 31148, 0x000084DB }, /* GL_TEXTURE27 */ - { 31161, 0x000084DB }, /* GL_TEXTURE27_ARB */ - { 31178, 0x000084DC }, /* GL_TEXTURE28 */ - { 31191, 0x000084DC }, /* GL_TEXTURE28_ARB */ - { 31208, 0x000084DD }, /* GL_TEXTURE29 */ - { 31221, 0x000084DD }, /* GL_TEXTURE29_ARB */ - { 31238, 0x000084C2 }, /* GL_TEXTURE2_ARB */ - { 31254, 0x000084C3 }, /* GL_TEXTURE3 */ - { 31266, 0x000084DE }, /* GL_TEXTURE30 */ - { 31279, 0x000084DE }, /* GL_TEXTURE30_ARB */ - { 31296, 0x000084DF }, /* GL_TEXTURE31 */ - { 31309, 0x000084DF }, /* GL_TEXTURE31_ARB */ - { 31326, 0x000084C3 }, /* GL_TEXTURE3_ARB */ - { 31342, 0x000084C4 }, /* GL_TEXTURE4 */ - { 31354, 0x000084C4 }, /* GL_TEXTURE4_ARB */ - { 31370, 0x000084C5 }, /* GL_TEXTURE5 */ - { 31382, 0x000084C5 }, /* GL_TEXTURE5_ARB */ - { 31398, 0x000084C6 }, /* GL_TEXTURE6 */ - { 31410, 0x000084C6 }, /* GL_TEXTURE6_ARB */ - { 31426, 0x000084C7 }, /* GL_TEXTURE7 */ - { 31438, 0x000084C7 }, /* GL_TEXTURE7_ARB */ - { 31454, 0x000084C8 }, /* GL_TEXTURE8 */ - { 31466, 0x000084C8 }, /* GL_TEXTURE8_ARB */ - { 31482, 0x000084C9 }, /* GL_TEXTURE9 */ - { 31494, 0x000084C9 }, /* GL_TEXTURE9_ARB */ - { 31510, 0x00000DE0 }, /* GL_TEXTURE_1D */ - { 31524, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ - { 31548, 0x00000DE1 }, /* GL_TEXTURE_2D */ - { 31562, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ - { 31586, 0x0000806F }, /* GL_TEXTURE_3D */ - { 31600, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ - { 31622, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ - { 31648, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ - { 31670, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ - { 31692, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - { 31724, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ - { 31746, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - { 31778, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ - { 31800, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ - { 31828, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ - { 31860, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - { 31893, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ - { 31925, 0x00040000 }, /* GL_TEXTURE_BIT */ - { 31940, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ - { 31961, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ - { 31986, 0x00001005 }, /* GL_TEXTURE_BORDER */ - { 32004, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ - { 32028, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - { 32059, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - { 32089, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - { 32119, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - { 32154, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - { 32185, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 32223, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ - { 32250, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - { 32282, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - { 32316, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ - { 32340, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ - { 32368, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ - { 32392, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ - { 32420, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - { 32453, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ - { 32477, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ - { 32499, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ - { 32521, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ - { 32547, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ - { 32581, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - { 32614, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ - { 32651, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ - { 32679, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ - { 32711, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ - { 32734, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - { 32772, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ - { 32814, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - { 32845, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - { 32873, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - { 32903, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - { 32931, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ - { 32951, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ - { 32975, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - { 33006, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ - { 33041, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - { 33072, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ - { 33107, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - { 33138, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ - { 33173, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - { 33204, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ - { 33239, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - { 33270, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ - { 33305, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - { 33336, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ - { 33371, 0x00008071 }, /* GL_TEXTURE_DEPTH */ - { 33388, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ - { 33410, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ - { 33436, 0x00002300 }, /* GL_TEXTURE_ENV */ - { 33451, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ - { 33472, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ - { 33492, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ - { 33518, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ - { 33538, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ - { 33555, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ - { 33572, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ - { 33589, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ - { 33606, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ - { 33631, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ - { 33653, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ - { 33679, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ - { 33697, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ - { 33723, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ - { 33749, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ - { 33779, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ - { 33806, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ - { 33831, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ - { 33851, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ - { 33875, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - { 33902, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - { 33929, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - { 33956, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ - { 33982, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ - { 34012, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ - { 34034, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ - { 34052, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - { 34082, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - { 34110, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - { 34138, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - { 34166, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ - { 34187, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ - { 34206, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ - { 34228, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ - { 34247, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ - { 34267, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ - { 34292, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ - { 34316, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ - { 34336, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ - { 34360, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ - { 34380, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ - { 34403, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ - { 34428, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - { 34462, 0x00001000 }, /* GL_TEXTURE_WIDTH */ - { 34479, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ - { 34497, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ - { 34515, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ - { 34533, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ - { 34553, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ - { 34572, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - { 34601, 0x00001000 }, /* GL_TRANSFORM_BIT */ - { 34618, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ - { 34644, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ - { 34674, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - { 34706, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - { 34736, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ - { 34770, 0x0000862C }, /* GL_TRANSPOSE_NV */ - { 34786, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - { 34817, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ - { 34852, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - { 34880, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ - { 34912, 0x00000004 }, /* GL_TRIANGLES */ - { 34925, 0x00000006 }, /* GL_TRIANGLE_FAN */ - { 34941, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ - { 34962, 0x00000005 }, /* GL_TRIANGLE_STRIP */ - { 34980, 0x00000001 }, /* GL_TRUE */ - { 34988, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ - { 35008, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ - { 35031, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ - { 35051, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ - { 35072, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ - { 35094, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ - { 35116, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ - { 35136, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ - { 35157, 0x00001401 }, /* GL_UNSIGNED_BYTE */ - { 35174, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - { 35201, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ - { 35224, 0x00001405 }, /* GL_UNSIGNED_INT */ - { 35240, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ - { 35267, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ - { 35291, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - { 35322, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ - { 35346, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - { 35374, 0x00001403 }, /* GL_UNSIGNED_SHORT */ - { 35392, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - { 35422, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - { 35448, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - { 35478, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - { 35504, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ - { 35528, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - { 35556, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - { 35584, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ - { 35611, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - { 35643, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ - { 35674, 0x00008CA2 }, /* GL_UPPER_LEFT */ - { 35688, 0x00002A20 }, /* GL_V2F */ - { 35695, 0x00002A21 }, /* GL_V3F */ - { 35702, 0x00008B83 }, /* GL_VALIDATE_STATUS */ - { 35721, 0x00001F00 }, /* GL_VENDOR */ - { 35731, 0x00001F02 }, /* GL_VERSION */ - { 35742, 0x00008074 }, /* GL_VERTEX_ARRAY */ - { 35758, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - { 35788, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - { 35819, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ - { 35854, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ - { 35878, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ - { 35899, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ - { 35922, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ - { 35943, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - { 35970, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - { 35998, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - { 36026, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - { 36054, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - { 36082, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - { 36110, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - { 36138, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - { 36165, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - { 36192, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - { 36219, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - { 36246, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - { 36273, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - { 36300, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - { 36327, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - { 36354, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - { 36381, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - { 36419, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ - { 36461, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - { 36492, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ - { 36527, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - { 36561, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ - { 36599, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - { 36630, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ - { 36665, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - { 36693, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ - { 36725, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - { 36755, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ - { 36789, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - { 36817, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ - { 36849, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ - { 36869, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ - { 36891, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ - { 36920, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ - { 36941, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - { 36970, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ - { 37003, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ - { 37035, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - { 37062, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ - { 37093, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ - { 37123, 0x00008B31 }, /* GL_VERTEX_SHADER */ - { 37140, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ - { 37161, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ - { 37188, 0x00000BA2 }, /* GL_VIEWPORT */ - { 37200, 0x00000800 }, /* GL_VIEWPORT_BIT */ - { 37216, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ - { 37236, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - { 37267, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ - { 37302, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - { 37330, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - { 37355, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - { 37382, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - { 37407, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ - { 37431, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ - { 37450, 0x000088B9 }, /* GL_WRITE_ONLY */ - { 37464, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ - { 37482, 0x00001506 }, /* GL_XOR */ - { 37489, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ - { 37508, 0x00008757 }, /* GL_YCBCR_MESA */ - { 37522, 0x00000000 }, /* GL_ZERO */ - { 37530, 0x00000D16 }, /* GL_ZOOM_X */ - { 37540, 0x00000D17 }, /* GL_ZOOM_Y */ + { 29733, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ + { 29758, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ + { 29779, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ + { 29804, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + { 29836, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ + { 29872, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + { 29904, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ + { 29940, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ + { 29960, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ + { 29987, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ + { 30013, 0x00000D57 }, /* GL_STENCIL_BITS */ + { 30029, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ + { 30051, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ + { 30074, 0x00000B94 }, /* GL_STENCIL_FAIL */ + { 30090, 0x00000B92 }, /* GL_STENCIL_FUNC */ + { 30106, 0x00001901 }, /* GL_STENCIL_INDEX */ + { 30123, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ + { 30146, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ + { 30168, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ + { 30190, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ + { 30212, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ + { 30233, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ + { 30260, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ + { 30287, 0x00000B97 }, /* GL_STENCIL_REF */ + { 30302, 0x00000B90 }, /* GL_STENCIL_TEST */ + { 30318, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + { 30347, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ + { 30369, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ + { 30390, 0x00000C33 }, /* GL_STEREO */ + { 30400, 0x000088E2 }, /* GL_STREAM_COPY */ + { 30415, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ + { 30434, 0x000088E0 }, /* GL_STREAM_DRAW */ + { 30449, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ + { 30468, 0x000088E1 }, /* GL_STREAM_READ */ + { 30483, 0x000088E1 }, /* GL_STREAM_READ_ARB */ + { 30502, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ + { 30519, 0x000084E7 }, /* GL_SUBTRACT */ + { 30531, 0x000084E7 }, /* GL_SUBTRACT_ARB */ + { 30547, 0x00002001 }, /* GL_T */ + { 30552, 0x00002A2A }, /* GL_T2F_C3F_V3F */ + { 30567, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ + { 30586, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ + { 30602, 0x00002A2B }, /* GL_T2F_N3F_V3F */ + { 30617, 0x00002A27 }, /* GL_T2F_V3F */ + { 30628, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ + { 30647, 0x00002A28 }, /* GL_T4F_V4F */ + { 30658, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ + { 30681, 0x00001702 }, /* GL_TEXTURE */ + { 30692, 0x000084C0 }, /* GL_TEXTURE0 */ + { 30704, 0x000084C0 }, /* GL_TEXTURE0_ARB */ + { 30720, 0x000084C1 }, /* GL_TEXTURE1 */ + { 30732, 0x000084CA }, /* GL_TEXTURE10 */ + { 30745, 0x000084CA }, /* GL_TEXTURE10_ARB */ + { 30762, 0x000084CB }, /* GL_TEXTURE11 */ + { 30775, 0x000084CB }, /* GL_TEXTURE11_ARB */ + { 30792, 0x000084CC }, /* GL_TEXTURE12 */ + { 30805, 0x000084CC }, /* GL_TEXTURE12_ARB */ + { 30822, 0x000084CD }, /* GL_TEXTURE13 */ + { 30835, 0x000084CD }, /* GL_TEXTURE13_ARB */ + { 30852, 0x000084CE }, /* GL_TEXTURE14 */ + { 30865, 0x000084CE }, /* GL_TEXTURE14_ARB */ + { 30882, 0x000084CF }, /* GL_TEXTURE15 */ + { 30895, 0x000084CF }, /* GL_TEXTURE15_ARB */ + { 30912, 0x000084D0 }, /* GL_TEXTURE16 */ + { 30925, 0x000084D0 }, /* GL_TEXTURE16_ARB */ + { 30942, 0x000084D1 }, /* GL_TEXTURE17 */ + { 30955, 0x000084D1 }, /* GL_TEXTURE17_ARB */ + { 30972, 0x000084D2 }, /* GL_TEXTURE18 */ + { 30985, 0x000084D2 }, /* GL_TEXTURE18_ARB */ + { 31002, 0x000084D3 }, /* GL_TEXTURE19 */ + { 31015, 0x000084D3 }, /* GL_TEXTURE19_ARB */ + { 31032, 0x000084C1 }, /* GL_TEXTURE1_ARB */ + { 31048, 0x000084C2 }, /* GL_TEXTURE2 */ + { 31060, 0x000084D4 }, /* GL_TEXTURE20 */ + { 31073, 0x000084D4 }, /* GL_TEXTURE20_ARB */ + { 31090, 0x000084D5 }, /* GL_TEXTURE21 */ + { 31103, 0x000084D5 }, /* GL_TEXTURE21_ARB */ + { 31120, 0x000084D6 }, /* GL_TEXTURE22 */ + { 31133, 0x000084D6 }, /* GL_TEXTURE22_ARB */ + { 31150, 0x000084D7 }, /* GL_TEXTURE23 */ + { 31163, 0x000084D7 }, /* GL_TEXTURE23_ARB */ + { 31180, 0x000084D8 }, /* GL_TEXTURE24 */ + { 31193, 0x000084D8 }, /* GL_TEXTURE24_ARB */ + { 31210, 0x000084D9 }, /* GL_TEXTURE25 */ + { 31223, 0x000084D9 }, /* GL_TEXTURE25_ARB */ + { 31240, 0x000084DA }, /* GL_TEXTURE26 */ + { 31253, 0x000084DA }, /* GL_TEXTURE26_ARB */ + { 31270, 0x000084DB }, /* GL_TEXTURE27 */ + { 31283, 0x000084DB }, /* GL_TEXTURE27_ARB */ + { 31300, 0x000084DC }, /* GL_TEXTURE28 */ + { 31313, 0x000084DC }, /* GL_TEXTURE28_ARB */ + { 31330, 0x000084DD }, /* GL_TEXTURE29 */ + { 31343, 0x000084DD }, /* GL_TEXTURE29_ARB */ + { 31360, 0x000084C2 }, /* GL_TEXTURE2_ARB */ + { 31376, 0x000084C3 }, /* GL_TEXTURE3 */ + { 31388, 0x000084DE }, /* GL_TEXTURE30 */ + { 31401, 0x000084DE }, /* GL_TEXTURE30_ARB */ + { 31418, 0x000084DF }, /* GL_TEXTURE31 */ + { 31431, 0x000084DF }, /* GL_TEXTURE31_ARB */ + { 31448, 0x000084C3 }, /* GL_TEXTURE3_ARB */ + { 31464, 0x000084C4 }, /* GL_TEXTURE4 */ + { 31476, 0x000084C4 }, /* GL_TEXTURE4_ARB */ + { 31492, 0x000084C5 }, /* GL_TEXTURE5 */ + { 31504, 0x000084C5 }, /* GL_TEXTURE5_ARB */ + { 31520, 0x000084C6 }, /* GL_TEXTURE6 */ + { 31532, 0x000084C6 }, /* GL_TEXTURE6_ARB */ + { 31548, 0x000084C7 }, /* GL_TEXTURE7 */ + { 31560, 0x000084C7 }, /* GL_TEXTURE7_ARB */ + { 31576, 0x000084C8 }, /* GL_TEXTURE8 */ + { 31588, 0x000084C8 }, /* GL_TEXTURE8_ARB */ + { 31604, 0x000084C9 }, /* GL_TEXTURE9 */ + { 31616, 0x000084C9 }, /* GL_TEXTURE9_ARB */ + { 31632, 0x00000DE0 }, /* GL_TEXTURE_1D */ + { 31646, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ + { 31670, 0x00000DE1 }, /* GL_TEXTURE_2D */ + { 31684, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ + { 31708, 0x0000806F }, /* GL_TEXTURE_3D */ + { 31722, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ + { 31744, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ + { 31770, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ + { 31792, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ + { 31814, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + { 31846, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ + { 31868, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + { 31900, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ + { 31922, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ + { 31950, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ + { 31982, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + { 32015, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ + { 32047, 0x00040000 }, /* GL_TEXTURE_BIT */ + { 32062, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ + { 32083, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ + { 32108, 0x00001005 }, /* GL_TEXTURE_BORDER */ + { 32126, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ + { 32150, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + { 32181, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + { 32211, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + { 32241, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + { 32276, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + { 32307, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 32345, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ + { 32372, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + { 32404, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + { 32438, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ + { 32462, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ + { 32490, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ + { 32514, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ + { 32542, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + { 32575, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ + { 32599, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ + { 32621, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ + { 32643, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ + { 32669, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 32703, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + { 32736, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ + { 32773, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ + { 32801, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ + { 32833, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ + { 32856, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + { 32894, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ + { 32936, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + { 32967, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + { 32995, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + { 33025, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + { 33053, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ + { 33073, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ + { 33097, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + { 33128, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ + { 33163, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + { 33194, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ + { 33229, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + { 33260, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ + { 33295, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + { 33326, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ + { 33361, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + { 33392, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ + { 33427, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + { 33458, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ + { 33493, 0x00008071 }, /* GL_TEXTURE_DEPTH */ + { 33510, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ + { 33532, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ + { 33558, 0x00002300 }, /* GL_TEXTURE_ENV */ + { 33573, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ + { 33594, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ + { 33614, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ + { 33640, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ + { 33660, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ + { 33677, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ + { 33694, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ + { 33711, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ + { 33728, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ + { 33753, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ + { 33775, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ + { 33801, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ + { 33819, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ + { 33845, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ + { 33871, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ + { 33901, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ + { 33928, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ + { 33953, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ + { 33973, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ + { 33997, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + { 34024, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + { 34051, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + { 34078, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ + { 34104, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ + { 34134, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ + { 34156, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ + { 34174, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + { 34204, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + { 34232, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + { 34260, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + { 34288, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ + { 34309, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ + { 34328, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ + { 34350, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ + { 34369, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ + { 34389, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ + { 34414, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ + { 34438, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ + { 34458, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ + { 34482, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ + { 34502, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ + { 34525, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ + { 34550, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + { 34584, 0x00001000 }, /* GL_TEXTURE_WIDTH */ + { 34601, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ + { 34619, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ + { 34637, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ + { 34655, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ + { 34675, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ + { 34694, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + { 34723, 0x00001000 }, /* GL_TRANSFORM_BIT */ + { 34740, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ + { 34766, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ + { 34796, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + { 34828, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + { 34858, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ + { 34892, 0x0000862C }, /* GL_TRANSPOSE_NV */ + { 34908, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + { 34939, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ + { 34974, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + { 35002, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ + { 35034, 0x00000004 }, /* GL_TRIANGLES */ + { 35047, 0x00000006 }, /* GL_TRIANGLE_FAN */ + { 35063, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ + { 35084, 0x00000005 }, /* GL_TRIANGLE_STRIP */ + { 35102, 0x00000001 }, /* GL_TRUE */ + { 35110, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ + { 35130, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ + { 35153, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ + { 35173, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ + { 35194, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ + { 35216, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ + { 35238, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ + { 35258, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ + { 35279, 0x00001401 }, /* GL_UNSIGNED_BYTE */ + { 35296, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + { 35323, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ + { 35346, 0x00001405 }, /* GL_UNSIGNED_INT */ + { 35362, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ + { 35389, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ + { 35413, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + { 35444, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ + { 35468, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + { 35496, 0x00001403 }, /* GL_UNSIGNED_SHORT */ + { 35514, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + { 35544, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + { 35570, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + { 35600, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + { 35626, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ + { 35650, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + { 35678, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + { 35706, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ + { 35733, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + { 35765, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ + { 35796, 0x00008CA2 }, /* GL_UPPER_LEFT */ + { 35810, 0x00002A20 }, /* GL_V2F */ + { 35817, 0x00002A21 }, /* GL_V3F */ + { 35824, 0x00008B83 }, /* GL_VALIDATE_STATUS */ + { 35843, 0x00001F00 }, /* GL_VENDOR */ + { 35853, 0x00001F02 }, /* GL_VERSION */ + { 35864, 0x00008074 }, /* GL_VERTEX_ARRAY */ + { 35880, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + { 35910, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + { 35941, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ + { 35976, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ + { 36000, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ + { 36021, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ + { 36044, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ + { 36065, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + { 36092, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + { 36120, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + { 36148, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + { 36176, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + { 36204, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + { 36232, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + { 36260, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + { 36287, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + { 36314, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + { 36341, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + { 36368, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + { 36395, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + { 36422, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + { 36449, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + { 36476, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + { 36503, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + { 36541, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ + { 36583, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + { 36614, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + { 36649, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + { 36683, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + { 36721, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + { 36752, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + { 36787, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + { 36815, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + { 36847, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + { 36877, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + { 36911, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + { 36939, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + { 36971, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ + { 36991, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ + { 37013, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ + { 37042, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ + { 37063, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + { 37092, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + { 37125, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + { 37157, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + { 37184, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + { 37215, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + { 37245, 0x00008B31 }, /* GL_VERTEX_SHADER */ + { 37262, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ + { 37283, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ + { 37310, 0x00000BA2 }, /* GL_VIEWPORT */ + { 37322, 0x00000800 }, /* GL_VIEWPORT_BIT */ + { 37338, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ + { 37358, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + { 37389, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ + { 37424, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + { 37452, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + { 37477, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + { 37504, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + { 37529, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ + { 37553, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ + { 37572, 0x000088B9 }, /* GL_WRITE_ONLY */ + { 37586, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ + { 37604, 0x00001506 }, /* GL_XOR */ + { 37611, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ + { 37630, 0x00008757 }, /* GL_YCBCR_MESA */ + { 37644, 0x00000000 }, /* GL_ZERO */ + { 37652, 0x00000D16 }, /* GL_ZOOM_X */ + { 37662, 0x00000D17 }, /* GL_ZOOM_Y */ }; static const unsigned reduced_enums[1284] = @@ -3539,9 +3547,9 @@ static const unsigned reduced_enums[1284] = 645, /* GL_LINES */ 647, /* GL_LINE_LOOP */ 654, /* GL_LINE_STRIP */ - 1637, /* GL_TRIANGLES */ - 1640, /* GL_TRIANGLE_STRIP */ - 1638, /* GL_TRIANGLE_FAN */ + 1641, /* GL_TRIANGLES */ + 1644, /* GL_TRIANGLE_STRIP */ + 1642, /* GL_TRIANGLE_FAN */ 1211, /* GL_QUADS */ 1213, /* GL_QUAD_STRIP */ 1099, /* GL_POLYGON */ @@ -3664,24 +3672,24 @@ static const unsigned reduced_enums[1284] = 321, /* GL_DEPTH_CLEAR_VALUE */ 332, /* GL_DEPTH_FUNC */ 12, /* GL_ACCUM_CLEAR_VALUE */ - 1418, /* GL_STENCIL_TEST */ - 1406, /* GL_STENCIL_CLEAR_VALUE */ - 1408, /* GL_STENCIL_FUNC */ - 1420, /* GL_STENCIL_VALUE_MASK */ - 1407, /* GL_STENCIL_FAIL */ - 1415, /* GL_STENCIL_PASS_DEPTH_FAIL */ - 1416, /* GL_STENCIL_PASS_DEPTH_PASS */ - 1417, /* GL_STENCIL_REF */ - 1421, /* GL_STENCIL_WRITEMASK */ + 1422, /* GL_STENCIL_TEST */ + 1410, /* GL_STENCIL_CLEAR_VALUE */ + 1412, /* GL_STENCIL_FUNC */ + 1424, /* GL_STENCIL_VALUE_MASK */ + 1411, /* GL_STENCIL_FAIL */ + 1419, /* GL_STENCIL_PASS_DEPTH_FAIL */ + 1420, /* GL_STENCIL_PASS_DEPTH_PASS */ + 1421, /* GL_STENCIL_REF */ + 1425, /* GL_STENCIL_WRITEMASK */ 791, /* GL_MATRIX_MODE */ 958, /* GL_NORMALIZE */ - 1727, /* GL_VIEWPORT */ + 1731, /* GL_VIEWPORT */ 932, /* GL_MODELVIEW_STACK_DEPTH */ 1191, /* GL_PROJECTION_STACK_DEPTH */ - 1616, /* GL_TEXTURE_STACK_DEPTH */ + 1620, /* GL_TEXTURE_STACK_DEPTH */ 930, /* GL_MODELVIEW_MATRIX */ 1190, /* GL_PROJECTION_MATRIX */ - 1601, /* GL_TEXTURE_MATRIX */ + 1605, /* GL_TEXTURE_MATRIX */ 61, /* GL_ATTRIB_STACK_DEPTH */ 127, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ 43, /* GL_ALPHA_TEST */ @@ -3706,17 +3714,17 @@ static const unsigned reduced_enums[1284] = 587, /* GL_INDEX_MODE */ 1287, /* GL_RGBA_MODE */ 353, /* GL_DOUBLEBUFFER */ - 1422, /* GL_STEREO */ + 1426, /* GL_STEREO */ 1246, /* GL_RENDER_MODE */ 1043, /* GL_PERSPECTIVE_CORRECTION_HINT */ 1092, /* GL_POINT_SMOOTH_HINT */ 650, /* GL_LINE_SMOOTH_HINT */ 1109, /* GL_POLYGON_SMOOTH_HINT */ 478, /* GL_FOG_HINT */ - 1582, /* GL_TEXTURE_GEN_S */ - 1583, /* GL_TEXTURE_GEN_T */ - 1581, /* GL_TEXTURE_GEN_R */ - 1580, /* GL_TEXTURE_GEN_Q */ + 1586, /* GL_TEXTURE_GEN_S */ + 1587, /* GL_TEXTURE_GEN_T */ + 1585, /* GL_TEXTURE_GEN_R */ + 1584, /* GL_TEXTURE_GEN_Q */ 1056, /* GL_PIXEL_MAP_I_TO_I */ 1062, /* GL_PIXEL_MAP_S_TO_S */ 1058, /* GL_PIXEL_MAP_I_TO_R */ @@ -3737,12 +3745,12 @@ static const unsigned reduced_enums[1284] = 1049, /* GL_PIXEL_MAP_G_TO_G_SIZE */ 1047, /* GL_PIXEL_MAP_B_TO_B_SIZE */ 1045, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - 1649, /* GL_UNPACK_SWAP_BYTES */ - 1644, /* GL_UNPACK_LSB_FIRST */ - 1645, /* GL_UNPACK_ROW_LENGTH */ - 1648, /* GL_UNPACK_SKIP_ROWS */ - 1647, /* GL_UNPACK_SKIP_PIXELS */ - 1642, /* GL_UNPACK_ALIGNMENT */ + 1653, /* GL_UNPACK_SWAP_BYTES */ + 1648, /* GL_UNPACK_LSB_FIRST */ + 1649, /* GL_UNPACK_ROW_LENGTH */ + 1652, /* GL_UNPACK_SKIP_ROWS */ + 1651, /* GL_UNPACK_SKIP_PIXELS */ + 1646, /* GL_UNPACK_ALIGNMENT */ 1031, /* GL_PACK_SWAP_BYTES */ 1026, /* GL_PACK_LSB_FIRST */ 1027, /* GL_PACK_ROW_LENGTH */ @@ -3755,8 +3763,8 @@ static const unsigned reduced_enums[1284] = 588, /* GL_INDEX_OFFSET */ 1235, /* GL_RED_SCALE */ 1233, /* GL_RED_BIAS */ - 1744, /* GL_ZOOM_X */ - 1745, /* GL_ZOOM_Y */ + 1748, /* GL_ZOOM_X */ + 1749, /* GL_ZOOM_Y */ 551, /* GL_GREEN_SCALE */ 549, /* GL_GREEN_BIAS */ 92, /* GL_BLUE_SCALE */ @@ -3777,14 +3785,14 @@ static const unsigned reduced_enums[1284] = 866, /* GL_MAX_TEXTURE_STACK_DEPTH */ 880, /* GL_MAX_VIEWPORT_DIMS */ 797, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - 1429, /* GL_SUBPIXEL_BITS */ + 1433, /* GL_SUBPIXEL_BITS */ 584, /* GL_INDEX_BITS */ 1234, /* GL_RED_BITS */ 550, /* GL_GREEN_BITS */ 91, /* GL_BLUE_BITS */ 41, /* GL_ALPHA_BITS */ 316, /* GL_DEPTH_BITS */ - 1404, /* GL_STENCIL_BITS */ + 1408, /* GL_STENCIL_BITS */ 14, /* GL_ACCUM_RED_BITS */ 13, /* GL_ACCUM_GREEN_BITS */ 10, /* GL_ACCUM_BLUE_BITS */ @@ -3813,18 +3821,18 @@ static const unsigned reduced_enums[1284] = 692, /* GL_MAP1_GRID_SEGMENTS */ 718, /* GL_MAP2_GRID_DOMAIN */ 719, /* GL_MAP2_GRID_SEGMENTS */ - 1506, /* GL_TEXTURE_1D */ - 1508, /* GL_TEXTURE_2D */ + 1510, /* GL_TEXTURE_1D */ + 1512, /* GL_TEXTURE_2D */ 439, /* GL_FEEDBACK_BUFFER_POINTER */ 440, /* GL_FEEDBACK_BUFFER_SIZE */ 441, /* GL_FEEDBACK_BUFFER_TYPE */ 1330, /* GL_SELECTION_BUFFER_POINTER */ 1331, /* GL_SELECTION_BUFFER_SIZE */ - 1619, /* GL_TEXTURE_WIDTH */ - 1587, /* GL_TEXTURE_HEIGHT */ - 1543, /* GL_TEXTURE_COMPONENTS */ - 1527, /* GL_TEXTURE_BORDER_COLOR */ - 1526, /* GL_TEXTURE_BORDER */ + 1623, /* GL_TEXTURE_WIDTH */ + 1591, /* GL_TEXTURE_HEIGHT */ + 1547, /* GL_TEXTURE_COMPONENTS */ + 1531, /* GL_TEXTURE_BORDER_COLOR */ + 1530, /* GL_TEXTURE_BORDER */ 345, /* GL_DONT_CARE */ 437, /* GL_FASTEST */ 954, /* GL_NICEST */ @@ -3841,11 +3849,11 @@ static const unsigned reduced_enums[1284] = 219, /* GL_COMPILE */ 220, /* GL_COMPILE_AND_EXECUTE */ 111, /* GL_BYTE */ - 1650, /* GL_UNSIGNED_BYTE */ + 1654, /* GL_UNSIGNED_BYTE */ 1344, /* GL_SHORT */ - 1659, /* GL_UNSIGNED_SHORT */ + 1663, /* GL_UNSIGNED_SHORT */ 592, /* GL_INT */ - 1653, /* GL_UNSIGNED_INT */ + 1657, /* GL_UNSIGNED_INT */ 444, /* GL_FLOAT */ 1, /* GL_2_BYTES */ 5, /* GL_3_BYTES */ @@ -3857,7 +3865,7 @@ static const unsigned reduced_enums[1284] = 269, /* GL_COPY */ 50, /* GL_AND_INVERTED */ 956, /* GL_NOOP */ - 1740, /* GL_XOR */ + 1744, /* GL_XOR */ 1018, /* GL_OR */ 957, /* GL_NOR */ 427, /* GL_EQUIV */ @@ -3873,12 +3881,12 @@ static const unsigned reduced_enums[1284] = 165, /* GL_COLOR_INDEXES */ 897, /* GL_MODELVIEW */ 1189, /* GL_PROJECTION */ - 1441, /* GL_TEXTURE */ + 1445, /* GL_TEXTURE */ 138, /* GL_COLOR */ 313, /* GL_DEPTH */ 1395, /* GL_STENCIL */ 164, /* GL_COLOR_INDEX */ - 1409, /* GL_STENCIL_INDEX */ + 1413, /* GL_STENCIL_INDEX */ 322, /* GL_DEPTH_COMPONENT */ 1230, /* GL_RED */ 548, /* GL_GREEN */ @@ -3901,23 +3909,23 @@ static const unsigned reduced_enums[1284] = 1248, /* GL_REPLACE */ 575, /* GL_INCR */ 309, /* GL_DECR */ - 1674, /* GL_VENDOR */ + 1678, /* GL_VENDOR */ 1245, /* GL_RENDERER */ - 1675, /* GL_VERSION */ + 1679, /* GL_VERSION */ 431, /* GL_EXTENSIONS */ 1294, /* GL_S */ - 1432, /* GL_T */ + 1436, /* GL_T */ 1220, /* GL_R */ 1209, /* GL_Q */ 933, /* GL_MODULATE */ 308, /* GL_DECAL */ - 1577, /* GL_TEXTURE_ENV_MODE */ - 1576, /* GL_TEXTURE_ENV_COLOR */ - 1575, /* GL_TEXTURE_ENV */ + 1581, /* GL_TEXTURE_ENV_MODE */ + 1580, /* GL_TEXTURE_ENV_COLOR */ + 1579, /* GL_TEXTURE_ENV */ 432, /* GL_EYE_LINEAR */ 980, /* GL_OBJECT_LINEAR */ 1374, /* GL_SPHERE_MAP */ - 1579, /* GL_TEXTURE_GEN_MODE */ + 1583, /* GL_TEXTURE_GEN_MODE */ 982, /* GL_OBJECT_PLANE */ 433, /* GL_EYE_PLANE */ 948, /* GL_NEAREST */ @@ -3926,30 +3934,30 @@ static const unsigned reduced_enums[1284] = 644, /* GL_LINEAR_MIPMAP_NEAREST */ 951, /* GL_NEAREST_MIPMAP_LINEAR */ 643, /* GL_LINEAR_MIPMAP_LINEAR */ - 1600, /* GL_TEXTURE_MAG_FILTER */ - 1608, /* GL_TEXTURE_MIN_FILTER */ - 1621, /* GL_TEXTURE_WRAP_S */ - 1622, /* GL_TEXTURE_WRAP_T */ + 1604, /* GL_TEXTURE_MAG_FILTER */ + 1612, /* GL_TEXTURE_MIN_FILTER */ + 1625, /* GL_TEXTURE_WRAP_S */ + 1626, /* GL_TEXTURE_WRAP_T */ 117, /* GL_CLAMP */ 1247, /* GL_REPEAT */ 1107, /* GL_POLYGON_OFFSET_UNITS */ 1106, /* GL_POLYGON_OFFSET_POINT */ 1105, /* GL_POLYGON_OFFSET_LINE */ 1221, /* GL_R3_G3_B2 */ - 1671, /* GL_V2F */ - 1672, /* GL_V3F */ + 1675, /* GL_V2F */ + 1676, /* GL_V3F */ 114, /* GL_C4UB_V2F */ 115, /* GL_C4UB_V3F */ 112, /* GL_C3F_V3F */ 945, /* GL_N3F_V3F */ 113, /* GL_C4F_N3F_V3F */ - 1437, /* GL_T2F_V3F */ - 1439, /* GL_T4F_V4F */ - 1435, /* GL_T2F_C4UB_V3F */ - 1433, /* GL_T2F_C3F_V3F */ - 1436, /* GL_T2F_N3F_V3F */ - 1434, /* GL_T2F_C4F_N3F_V3F */ - 1438, /* GL_T4F_C4F_N3F_V4F */ + 1441, /* GL_T2F_V3F */ + 1443, /* GL_T4F_V4F */ + 1439, /* GL_T2F_C4UB_V3F */ + 1437, /* GL_T2F_C3F_V3F */ + 1440, /* GL_T2F_N3F_V3F */ + 1438, /* GL_T2F_C4F_N3F_V3F */ + 1442, /* GL_T4F_C4F_N3F_V4F */ 130, /* GL_CLIP_PLANE0 */ 131, /* GL_CLIP_PLANE1 */ 132, /* GL_CLIP_PLANE2 */ @@ -4009,12 +4017,12 @@ static const unsigned reduced_enums[1284] = 882, /* GL_MINMAX */ 884, /* GL_MINMAX_FORMAT */ 886, /* GL_MINMAX_SINK */ - 1440, /* GL_TABLE_TOO_LARGE_EXT */ - 1652, /* GL_UNSIGNED_BYTE_3_3_2 */ - 1661, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - 1663, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - 1657, /* GL_UNSIGNED_INT_8_8_8_8 */ - 1654, /* GL_UNSIGNED_INT_10_10_10_2 */ + 1444, /* GL_TABLE_TOO_LARGE_EXT */ + 1656, /* GL_UNSIGNED_BYTE_3_3_2 */ + 1665, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + 1667, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + 1661, /* GL_UNSIGNED_INT_8_8_8_8 */ + 1658, /* GL_UNSIGNED_INT_10_10_10_2 */ 1104, /* GL_POLYGON_OFFSET_FILL */ 1103, /* GL_POLYGON_OFFSET_FACTOR */ 1102, /* GL_POLYGON_OFFSET_BIAS */ @@ -4052,39 +4060,39 @@ static const unsigned reduced_enums[1284] = 1256, /* GL_RGB10_A2 */ 1274, /* GL_RGBA12 */ 1276, /* GL_RGBA16 */ - 1613, /* GL_TEXTURE_RED_SIZE */ - 1585, /* GL_TEXTURE_GREEN_SIZE */ - 1524, /* GL_TEXTURE_BLUE_SIZE */ - 1511, /* GL_TEXTURE_ALPHA_SIZE */ - 1598, /* GL_TEXTURE_LUMINANCE_SIZE */ - 1589, /* GL_TEXTURE_INTENSITY_SIZE */ + 1617, /* GL_TEXTURE_RED_SIZE */ + 1589, /* GL_TEXTURE_GREEN_SIZE */ + 1528, /* GL_TEXTURE_BLUE_SIZE */ + 1515, /* GL_TEXTURE_ALPHA_SIZE */ + 1602, /* GL_TEXTURE_LUMINANCE_SIZE */ + 1593, /* GL_TEXTURE_INTENSITY_SIZE */ 1249, /* GL_REPLACE_EXT */ 1197, /* GL_PROXY_TEXTURE_1D */ 1200, /* GL_PROXY_TEXTURE_2D */ - 1617, /* GL_TEXTURE_TOO_LARGE_EXT */ - 1610, /* GL_TEXTURE_PRIORITY */ - 1615, /* GL_TEXTURE_RESIDENT */ - 1514, /* GL_TEXTURE_BINDING_1D */ - 1516, /* GL_TEXTURE_BINDING_2D */ - 1518, /* GL_TEXTURE_BINDING_3D */ + 1621, /* GL_TEXTURE_TOO_LARGE_EXT */ + 1614, /* GL_TEXTURE_PRIORITY */ + 1619, /* GL_TEXTURE_RESIDENT */ + 1518, /* GL_TEXTURE_BINDING_1D */ + 1520, /* GL_TEXTURE_BINDING_2D */ + 1522, /* GL_TEXTURE_BINDING_3D */ 1028, /* GL_PACK_SKIP_IMAGES */ 1024, /* GL_PACK_IMAGE_HEIGHT */ - 1646, /* GL_UNPACK_SKIP_IMAGES */ - 1643, /* GL_UNPACK_IMAGE_HEIGHT */ - 1510, /* GL_TEXTURE_3D */ + 1650, /* GL_UNPACK_SKIP_IMAGES */ + 1647, /* GL_UNPACK_IMAGE_HEIGHT */ + 1514, /* GL_TEXTURE_3D */ 1203, /* GL_PROXY_TEXTURE_3D */ - 1572, /* GL_TEXTURE_DEPTH */ - 1620, /* GL_TEXTURE_WRAP_R */ + 1576, /* GL_TEXTURE_DEPTH */ + 1624, /* GL_TEXTURE_WRAP_R */ 794, /* GL_MAX_3D_TEXTURE_SIZE */ - 1676, /* GL_VERTEX_ARRAY */ + 1680, /* GL_VERTEX_ARRAY */ 959, /* GL_NORMAL_ARRAY */ 139, /* GL_COLOR_ARRAY */ 578, /* GL_INDEX_ARRAY */ - 1551, /* GL_TEXTURE_COORD_ARRAY */ + 1555, /* GL_TEXTURE_COORD_ARRAY */ 415, /* GL_EDGE_FLAG_ARRAY */ - 1681, /* GL_VERTEX_ARRAY_SIZE */ - 1683, /* GL_VERTEX_ARRAY_TYPE */ - 1682, /* GL_VERTEX_ARRAY_STRIDE */ + 1685, /* GL_VERTEX_ARRAY_SIZE */ + 1687, /* GL_VERTEX_ARRAY_TYPE */ + 1686, /* GL_VERTEX_ARRAY_STRIDE */ 964, /* GL_NORMAL_ARRAY_TYPE */ 963, /* GL_NORMAL_ARRAY_STRIDE */ 143, /* GL_COLOR_ARRAY_SIZE */ @@ -4092,15 +4100,15 @@ static const unsigned reduced_enums[1284] = 144, /* GL_COLOR_ARRAY_STRIDE */ 583, /* GL_INDEX_ARRAY_TYPE */ 582, /* GL_INDEX_ARRAY_STRIDE */ - 1555, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - 1557, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - 1556, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + 1559, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + 1561, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + 1560, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ 419, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - 1680, /* GL_VERTEX_ARRAY_POINTER */ + 1684, /* GL_VERTEX_ARRAY_POINTER */ 962, /* GL_NORMAL_ARRAY_POINTER */ 142, /* GL_COLOR_ARRAY_POINTER */ 581, /* GL_INDEX_ARRAY_POINTER */ - 1554, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + 1558, /* GL_TEXTURE_COORD_ARRAY_POINTER */ 418, /* GL_EDGE_FLAG_ARRAY_POINTER */ 938, /* GL_MULTISAMPLE */ 1306, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ @@ -4121,9 +4129,9 @@ static const unsigned reduced_enums[1284] = 1123, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ 1118, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ 1114, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - 1534, /* GL_TEXTURE_COLOR_TABLE_SGI */ + 1538, /* GL_TEXTURE_COLOR_TABLE_SGI */ 1204, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - 1536, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + 1540, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ 80, /* GL_BLEND_DST_RGB */ 88, /* GL_BLEND_SRC_RGB */ 79, /* GL_BLEND_DST_ALPHA */ @@ -4148,7 +4156,7 @@ static const unsigned reduced_enums[1284] = 72, /* GL_BGRA */ 816, /* GL_MAX_ELEMENTS_VERTICES */ 815, /* GL_MAX_ELEMENTS_INDICES */ - 1588, /* GL_TEXTURE_INDEX_SIZE_EXT */ + 1592, /* GL_TEXTURE_INDEX_SIZE_EXT */ 136, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ 1086, /* GL_POINT_SIZE_MIN */ 1082, /* GL_POINT_SIZE_MAX */ @@ -4156,10 +4164,10 @@ static const unsigned reduced_enums[1284] = 1072, /* GL_POINT_DISTANCE_ATTENUATION */ 118, /* GL_CLAMP_TO_BORDER */ 121, /* GL_CLAMP_TO_EDGE */ - 1609, /* GL_TEXTURE_MIN_LOD */ - 1607, /* GL_TEXTURE_MAX_LOD */ - 1513, /* GL_TEXTURE_BASE_LEVEL */ - 1606, /* GL_TEXTURE_MAX_LEVEL */ + 1613, /* GL_TEXTURE_MIN_LOD */ + 1611, /* GL_TEXTURE_MAX_LOD */ + 1517, /* GL_TEXTURE_BASE_LEVEL */ + 1610, /* GL_TEXTURE_MAX_LEVEL */ 572, /* GL_IGNORE_BORDER_HP */ 246, /* GL_CONSTANT_BORDER_HP */ 1250, /* GL_REPLICATE_BORDER_HP */ @@ -4167,51 +4175,51 @@ static const unsigned reduced_enums[1284] = 987, /* GL_OCCLUSION_TEST_HP */ 988, /* GL_OCCLUSION_TEST_RESULT_HP */ 641, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - 1528, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - 1530, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - 1532, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - 1533, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1531, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - 1529, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + 1532, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + 1534, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + 1536, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + 1537, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1535, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + 1533, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ 798, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ 799, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ 1149, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ 1151, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ 1148, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ 1150, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - 1596, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - 1597, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - 1595, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + 1600, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + 1601, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + 1599, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ 518, /* GL_GENERATE_MIPMAP */ 519, /* GL_GENERATE_MIPMAP_HINT */ 481, /* GL_FOG_OFFSET_SGIX */ 482, /* GL_FOG_OFFSET_VALUE_SGIX */ - 1542, /* GL_TEXTURE_COMPARE_SGIX */ - 1541, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - 1592, /* GL_TEXTURE_LEQUAL_R_SGIX */ - 1584, /* GL_TEXTURE_GEQUAL_R_SGIX */ + 1546, /* GL_TEXTURE_COMPARE_SGIX */ + 1545, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + 1596, /* GL_TEXTURE_LEQUAL_R_SGIX */ + 1588, /* GL_TEXTURE_GEQUAL_R_SGIX */ 323, /* GL_DEPTH_COMPONENT16 */ 326, /* GL_DEPTH_COMPONENT24 */ 329, /* GL_DEPTH_COMPONENT32 */ 274, /* GL_CULL_VERTEX_EXT */ 276, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ 275, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - 1737, /* GL_WRAP_BORDER_SUN */ - 1535, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + 1741, /* GL_WRAP_BORDER_SUN */ + 1539, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ 634, /* GL_LIGHT_MODEL_COLOR_CONTROL */ 1345, /* GL_SINGLE_COLOR */ 1333, /* GL_SEPARATE_SPECULAR_COLOR */ 1342, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - 1651, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - 1664, /* GL_UNSIGNED_SHORT_5_6_5 */ - 1665, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - 1662, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - 1660, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - 1658, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - 1656, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - 1604, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - 1605, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - 1603, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + 1655, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + 1668, /* GL_UNSIGNED_SHORT_5_6_5 */ + 1669, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + 1666, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + 1664, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + 1662, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + 1660, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + 1608, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + 1609, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + 1607, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ 889, /* GL_MIRRORED_REPEAT */ 1289, /* GL_RGB_S3TC */ 1266, /* GL_RGB4_S3TC */ @@ -4244,46 +4252,46 @@ static const unsigned reduced_enums[1284] = 528, /* GL_GL_CURRENT_RASTER_SECONDARY_COLOR */ 28, /* GL_ALIASED_POINT_SIZE_RANGE */ 27, /* GL_ALIASED_LINE_WIDTH_RANGE */ - 1442, /* GL_TEXTURE0 */ - 1444, /* GL_TEXTURE1 */ - 1466, /* GL_TEXTURE2 */ - 1488, /* GL_TEXTURE3 */ - 1494, /* GL_TEXTURE4 */ - 1496, /* GL_TEXTURE5 */ - 1498, /* GL_TEXTURE6 */ - 1500, /* GL_TEXTURE7 */ - 1502, /* GL_TEXTURE8 */ - 1504, /* GL_TEXTURE9 */ - 1445, /* GL_TEXTURE10 */ - 1447, /* GL_TEXTURE11 */ - 1449, /* GL_TEXTURE12 */ - 1451, /* GL_TEXTURE13 */ - 1453, /* GL_TEXTURE14 */ - 1455, /* GL_TEXTURE15 */ - 1457, /* GL_TEXTURE16 */ - 1459, /* GL_TEXTURE17 */ - 1461, /* GL_TEXTURE18 */ - 1463, /* GL_TEXTURE19 */ - 1467, /* GL_TEXTURE20 */ - 1469, /* GL_TEXTURE21 */ - 1471, /* GL_TEXTURE22 */ - 1473, /* GL_TEXTURE23 */ - 1475, /* GL_TEXTURE24 */ - 1477, /* GL_TEXTURE25 */ - 1479, /* GL_TEXTURE26 */ - 1481, /* GL_TEXTURE27 */ - 1483, /* GL_TEXTURE28 */ - 1485, /* GL_TEXTURE29 */ - 1489, /* GL_TEXTURE30 */ - 1491, /* GL_TEXTURE31 */ + 1446, /* GL_TEXTURE0 */ + 1448, /* GL_TEXTURE1 */ + 1470, /* GL_TEXTURE2 */ + 1492, /* GL_TEXTURE3 */ + 1498, /* GL_TEXTURE4 */ + 1500, /* GL_TEXTURE5 */ + 1502, /* GL_TEXTURE6 */ + 1504, /* GL_TEXTURE7 */ + 1506, /* GL_TEXTURE8 */ + 1508, /* GL_TEXTURE9 */ + 1449, /* GL_TEXTURE10 */ + 1451, /* GL_TEXTURE11 */ + 1453, /* GL_TEXTURE12 */ + 1455, /* GL_TEXTURE13 */ + 1457, /* GL_TEXTURE14 */ + 1459, /* GL_TEXTURE15 */ + 1461, /* GL_TEXTURE16 */ + 1463, /* GL_TEXTURE17 */ + 1465, /* GL_TEXTURE18 */ + 1467, /* GL_TEXTURE19 */ + 1471, /* GL_TEXTURE20 */ + 1473, /* GL_TEXTURE21 */ + 1475, /* GL_TEXTURE22 */ + 1477, /* GL_TEXTURE23 */ + 1479, /* GL_TEXTURE24 */ + 1481, /* GL_TEXTURE25 */ + 1483, /* GL_TEXTURE26 */ + 1485, /* GL_TEXTURE27 */ + 1487, /* GL_TEXTURE28 */ + 1489, /* GL_TEXTURE29 */ + 1493, /* GL_TEXTURE30 */ + 1495, /* GL_TEXTURE31 */ 18, /* GL_ACTIVE_TEXTURE */ 124, /* GL_CLIENT_ACTIVE_TEXTURE */ 867, /* GL_MAX_TEXTURE_UNITS */ - 1630, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - 1633, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - 1635, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - 1627, /* GL_TRANSPOSE_COLOR_MATRIX */ - 1430, /* GL_SUBTRACT */ + 1634, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + 1637, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + 1639, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + 1631, /* GL_TRANSPOSE_COLOR_MATRIX */ + 1434, /* GL_SUBTRACT */ 856, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ 222, /* GL_COMPRESSED_ALPHA */ 226, /* GL_COMPRESSED_LUMINANCE */ @@ -4291,18 +4299,18 @@ static const unsigned reduced_enums[1284] = 224, /* GL_COMPRESSED_INTENSITY */ 230, /* GL_COMPRESSED_RGB */ 231, /* GL_COMPRESSED_RGBA */ - 1549, /* GL_TEXTURE_COMPRESSION_HINT */ - 1611, /* GL_TEXTURE_RECTANGLE_ARB */ - 1521, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + 1553, /* GL_TEXTURE_COMPRESSION_HINT */ + 1615, /* GL_TEXTURE_RECTANGLE_ARB */ + 1525, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ 1207, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ 854, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ 335, /* GL_DEPTH_STENCIL_NV */ - 1655, /* GL_UNSIGNED_INT_24_8_NV */ + 1659, /* GL_UNSIGNED_INT_24_8_NV */ 863, /* GL_MAX_TEXTURE_LOD_BIAS */ - 1602, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + 1606, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ 864, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - 1578, /* GL_TEXTURE_FILTER_CONTROL */ - 1593, /* GL_TEXTURE_LOD_BIAS */ + 1582, /* GL_TEXTURE_FILTER_CONTROL */ + 1597, /* GL_TEXTURE_LOD_BIAS */ 207, /* GL_COMBINE4 */ 857, /* GL_MAX_SHININESS_NV */ 858, /* GL_MAX_SPOT_EXPONENT_NV */ @@ -4311,14 +4319,14 @@ static const unsigned reduced_enums[1284] = 909, /* GL_MODELVIEW1_ARB */ 965, /* GL_NORMAL_MAP */ 1236, /* GL_REFLECTION_MAP */ - 1558, /* GL_TEXTURE_CUBE_MAP */ - 1519, /* GL_TEXTURE_BINDING_CUBE_MAP */ - 1566, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - 1560, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - 1568, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - 1562, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - 1570, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - 1564, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + 1562, /* GL_TEXTURE_CUBE_MAP */ + 1523, /* GL_TEXTURE_BINDING_CUBE_MAP */ + 1570, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + 1564, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + 1572, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + 1566, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + 1574, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + 1568, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ 1205, /* GL_PROXY_TEXTURE_CUBE_MAP */ 810, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ 944, /* GL_MULTISAMPLE_FILTER_HINT_NV */ @@ -4350,26 +4358,26 @@ static const unsigned reduced_enums[1284] = 1004, /* GL_OPERAND1_ALPHA */ 1010, /* GL_OPERAND2_ALPHA */ 1016, /* GL_OPERAND3_ALPHA_NV */ - 1677, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - 1741, /* GL_YCBCR_422_APPLE */ - 1666, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - 1668, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + 1681, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + 1745, /* GL_YCBCR_422_APPLE */ + 1670, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + 1672, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ 1347, /* GL_SLICE_ACCUM_SUN */ 1212, /* GL_QUAD_MESH_SUN */ - 1639, /* GL_TRIANGLE_MESH_SUN */ - 1715, /* GL_VERTEX_PROGRAM_ARB */ - 1726, /* GL_VERTEX_STATE_PROGRAM_NV */ - 1702, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - 1708, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - 1710, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - 1712, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + 1643, /* GL_TRIANGLE_MESH_SUN */ + 1719, /* GL_VERTEX_PROGRAM_ARB */ + 1730, /* GL_VERTEX_STATE_PROGRAM_NV */ + 1706, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + 1712, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + 1714, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + 1716, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ 301, /* GL_CURRENT_VERTEX_ATTRIB */ 1168, /* GL_PROGRAM_LENGTH_ARB */ 1182, /* GL_PROGRAM_STRING_ARB */ 931, /* GL_MODELVIEW_PROJECTION_NV */ 571, /* GL_IDENTITY_NV */ 616, /* GL_INVERSE_NV */ - 1632, /* GL_TRANSPOSE_NV */ + 1636, /* GL_TRANSPOSE_NV */ 617, /* GL_INVERSE_TRANSPOSE_NV */ 840, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ 839, /* GL_MAX_PROGRAM_MATRICES_ARB */ @@ -4383,33 +4391,33 @@ static const unsigned reduced_enums[1284] = 783, /* GL_MATRIX7_NV */ 286, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ 283, /* GL_CURRENT_MATRIX_ARB */ - 1718, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - 1721, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + 1722, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + 1725, /* GL_VERTEX_PROGRAM_TWO_SIDE */ 1180, /* GL_PROGRAM_PARAMETER_NV */ - 1706, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + 1710, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ 1184, /* GL_PROGRAM_TARGET_NV */ 1181, /* GL_PROGRAM_RESIDENT_NV */ - 1624, /* GL_TRACK_MATRIX_NV */ - 1625, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - 1716, /* GL_VERTEX_PROGRAM_BINDING_NV */ + 1628, /* GL_TRACK_MATRIX_NV */ + 1629, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + 1720, /* GL_VERTEX_PROGRAM_BINDING_NV */ 1162, /* GL_PROGRAM_ERROR_POSITION_ARB */ 320, /* GL_DEPTH_CLAMP_NV */ - 1684, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - 1691, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - 1692, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - 1693, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - 1694, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - 1695, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - 1696, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - 1697, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - 1698, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - 1699, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - 1685, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - 1686, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - 1687, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - 1688, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - 1689, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - 1690, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + 1688, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + 1695, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + 1696, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + 1697, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + 1698, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + 1699, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + 1700, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + 1701, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + 1702, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + 1703, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + 1689, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + 1690, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + 1691, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + 1692, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + 1693, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + 1694, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ 701, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ 708, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ 709, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ @@ -4442,20 +4450,20 @@ static const unsigned reduced_enums[1284] = 732, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ 733, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ 734, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - 1547, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - 1544, /* GL_TEXTURE_COMPRESSED */ + 1551, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + 1548, /* GL_TEXTURE_COMPRESSED */ 970, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ 240, /* GL_COMPRESSED_TEXTURE_FORMATS */ 879, /* GL_MAX_VERTEX_UNITS_ARB */ 22, /* GL_ACTIVE_VERTEX_UNITS_ARB */ - 1736, /* GL_WEIGHT_SUM_UNITY_ARB */ - 1714, /* GL_VERTEX_BLEND_ARB */ + 1740, /* GL_WEIGHT_SUM_UNITY_ARB */ + 1718, /* GL_VERTEX_BLEND_ARB */ 303, /* GL_CURRENT_WEIGHT_ARB */ - 1735, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - 1734, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - 1733, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - 1732, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - 1729, /* GL_WEIGHT_ARRAY_ARB */ + 1739, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + 1738, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + 1737, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + 1736, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + 1733, /* GL_WEIGHT_ARRAY_ARB */ 346, /* GL_DOT3_RGB */ 347, /* GL_DOT3_RGBA */ 238, /* GL_COMPRESSED_RGB_FXT1_3DFX */ @@ -4500,17 +4508,17 @@ static const unsigned reduced_enums[1284] = 934, /* GL_MODULATE_ADD_ATI */ 935, /* GL_MODULATE_SIGNED_ADD_ATI */ 936, /* GL_MODULATE_SUBTRACT_ATI */ - 1742, /* GL_YCBCR_MESA */ + 1746, /* GL_YCBCR_MESA */ 1025, /* GL_PACK_INVERT_MESA */ 306, /* GL_DEBUG_OBJECT_MESA */ 307, /* GL_DEBUG_PRINT_MESA */ 305, /* GL_DEBUG_ASSERT_MESA */ 107, /* GL_BUFFER_SIZE */ 109, /* GL_BUFFER_USAGE */ - 1398, /* GL_STENCIL_BACK_FUNC */ + 1399, /* GL_STENCIL_BACK_FUNC */ 1397, /* GL_STENCIL_BACK_FAIL */ - 1399, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - 1400, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + 1401, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + 1403, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ 485, /* GL_FRAGMENT_PROGRAM_ARB */ 1159, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ 1187, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ @@ -4552,10 +4560,10 @@ static const unsigned reduced_enums[1284] = 790, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ 789, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ 787, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - 1573, /* GL_TEXTURE_DEPTH_SIZE */ + 1577, /* GL_TEXTURE_DEPTH_SIZE */ 339, /* GL_DEPTH_TEXTURE_MODE */ - 1539, /* GL_TEXTURE_COMPARE_MODE */ - 1537, /* GL_TEXTURE_COMPARE_FUNC */ + 1543, /* GL_TEXTURE_COMPARE_MODE */ + 1541, /* GL_TEXTURE_COMPARE_FUNC */ 217, /* GL_COMPARE_R_TO_TEXTURE */ 1093, /* GL_POINT_SPRITE */ 266, /* GL_COORD_REPLACE */ @@ -4565,7 +4573,7 @@ static const unsigned reduced_enums[1284] = 1216, /* GL_QUERY_RESULT */ 1218, /* GL_QUERY_RESULT_AVAILABLE */ 873, /* GL_MAX_VERTEX_ATTRIBS */ - 1704, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + 1708, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ 337, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ 336, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ 859, /* GL_MAX_TEXTURE_COORDS */ @@ -4573,23 +4581,23 @@ static const unsigned reduced_enums[1284] = 1164, /* GL_PROGRAM_ERROR_STRING_ARB */ 1166, /* GL_PROGRAM_FORMAT_ASCII_ARB */ 1165, /* GL_PROGRAM_FORMAT_ARB */ - 1618, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + 1622, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ 318, /* GL_DEPTH_BOUNDS_TEST_EXT */ 317, /* GL_DEPTH_BOUNDS_EXT */ 52, /* GL_ARRAY_BUFFER */ 420, /* GL_ELEMENT_ARRAY_BUFFER */ 54, /* GL_ARRAY_BUFFER_BINDING */ 422, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - 1678, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + 1682, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ 960, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ 140, /* GL_COLOR_ARRAY_BUFFER_BINDING */ 579, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - 1552, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + 1556, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ 416, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ 1323, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ 463, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - 1730, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - 1700, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + 1734, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + 1704, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ 1167, /* GL_PROGRAM_INSTRUCTIONS_ARB */ 835, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ 1173, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ @@ -4613,14 +4621,14 @@ static const unsigned reduced_enums[1284] = 836, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ 832, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ 1188, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - 1629, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + 1633, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ 1226, /* GL_READ_ONLY */ - 1738, /* GL_WRITE_ONLY */ + 1742, /* GL_WRITE_ONLY */ 1228, /* GL_READ_WRITE */ 101, /* GL_BUFFER_ACCESS */ 103, /* GL_BUFFER_MAPPED */ 105, /* GL_BUFFER_MAP_POINTER */ - 1623, /* GL_TIME_ELAPSED_EXT */ + 1627, /* GL_TIME_ELAPSED_EXT */ 746, /* GL_MATRIX0_ARB */ 758, /* GL_MATRIX1_ARB */ 770, /* GL_MATRIX2_ARB */ @@ -4653,9 +4661,9 @@ static const unsigned reduced_enums[1284] = 769, /* GL_MATRIX29_ARB */ 772, /* GL_MATRIX30_ARB */ 773, /* GL_MATRIX31_ARB */ - 1425, /* GL_STREAM_DRAW */ - 1427, /* GL_STREAM_READ */ - 1423, /* GL_STREAM_COPY */ + 1429, /* GL_STREAM_DRAW */ + 1431, /* GL_STREAM_READ */ + 1427, /* GL_STREAM_COPY */ 1391, /* GL_STATIC_DRAW */ 1393, /* GL_STATIC_READ */ 1389, /* GL_STATIC_COPY */ @@ -4672,12 +4680,12 @@ static const unsigned reduced_enums[1284] = 838, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ 837, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ 795, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - 1419, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + 1423, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ 17, /* GL_ACTIVE_STENCIL_FACE_EXT */ 894, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ 1304, /* GL_SAMPLES_PASSED */ 486, /* GL_FRAGMENT_SHADER */ - 1724, /* GL_VERTEX_SHADER */ + 1728, /* GL_VERTEX_SHADER */ 1178, /* GL_PROGRAM_OBJECT_ARB */ 1336, /* GL_SHADER_OBJECT_ARB */ 819, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ @@ -4715,7 +4723,7 @@ static const unsigned reduced_enums[1284] = 312, /* GL_DELETE_STATUS */ 221, /* GL_COMPILE_STATUS */ 659, /* GL_LINK_STATUS */ - 1673, /* GL_VALIDATE_STATUS */ + 1677, /* GL_VALIDATE_STATUS */ 591, /* GL_INFO_LOG_LENGTH */ 56, /* GL_ATTACHED_SHADERS */ 20, /* GL_ACTIVE_UNIFORMS */ @@ -4738,12 +4746,12 @@ static const unsigned reduced_enums[1284] = 1038, /* GL_PALETTE8_RGB5_A1_OES */ 574, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ 573, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - 1507, /* GL_TEXTURE_1D_ARRAY_EXT */ + 1511, /* GL_TEXTURE_1D_ARRAY_EXT */ 1198, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - 1509, /* GL_TEXTURE_2D_ARRAY_EXT */ + 1513, /* GL_TEXTURE_2D_ARRAY_EXT */ 1201, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - 1515, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - 1517, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + 1519, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + 1521, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ 543, /* GL_GL_SRGB */ 544, /* GL_GL_SRGB8 */ 546, /* GL_GL_SRGB_ALPHA */ @@ -4758,10 +4766,10 @@ static const unsigned reduced_enums[1284] = 525, /* GL_GL_COMPRESSED_SLUMINANCE_ALPHA */ 1095, /* GL_POINT_SPRITE_COORD_ORIGIN */ 667, /* GL_LOWER_LEFT */ - 1670, /* GL_UPPER_LEFT */ - 1401, /* GL_STENCIL_BACK_REF */ - 1402, /* GL_STENCIL_BACK_VALUE_MASK */ - 1403, /* GL_STENCIL_BACK_WRITEMASK */ + 1674, /* GL_UPPER_LEFT */ + 1405, /* GL_STENCIL_BACK_REF */ + 1406, /* GL_STENCIL_BACK_VALUE_MASK */ + 1407, /* GL_STENCIL_BACK_WRITEMASK */ 403, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ 1240, /* GL_RENDERBUFFER_BINDING_EXT */ 1225, /* GL_READ_FRAMEBUFFER_EXT */ @@ -4806,15 +4814,15 @@ static const unsigned reduced_enums[1284] = 1244, /* GL_RENDERBUFFER_WIDTH_EXT */ 1242, /* GL_RENDERBUFFER_HEIGHT_EXT */ 1243, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ - 1414, /* GL_STENCIL_INDEX_EXT */ - 1411, /* GL_STENCIL_INDEX1_EXT */ - 1412, /* GL_STENCIL_INDEX4_EXT */ - 1413, /* GL_STENCIL_INDEX8_EXT */ - 1410, /* GL_STENCIL_INDEX16_EXT */ + 1418, /* GL_STENCIL_INDEX_EXT */ + 1415, /* GL_STENCIL_INDEX1_EXT */ + 1416, /* GL_STENCIL_INDEX4_EXT */ + 1417, /* GL_STENCIL_INDEX8_EXT */ + 1414, /* GL_STENCIL_INDEX16_EXT */ 428, /* GL_EVAL_BIT */ 1222, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ 661, /* GL_LIST_BIT */ - 1523, /* GL_TEXTURE_BIT */ + 1527, /* GL_TEXTURE_BIT */ 1319, /* GL_SCISSOR_BIT */ 29, /* GL_ALL_ATTRIB_BITS */ 941, /* GL_MULTISAMPLE_BIT */ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 40100202656..85c8cf1f54f 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -817,6 +817,10 @@ _mesa_init_exec_table(struct _glapi_table *exec) #if FEATURE_EXT_framebuffer_object SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT); #endif + + /* GL_ATI_separate_stencil */ + SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI); + SET_StencilOpSeparateATI(exec, _mesa_StencilOpSeparateATI); } diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index ca7f6eaf88b..17464310b1a 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.2 + * Version: 7.1 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -53,6 +53,48 @@ #include "mtypes.h" +static GLboolean +validate_stencil_op(GLcontext *ctx, GLenum op) +{ + switch (op) { + case GL_KEEP: + case GL_ZERO: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + return GL_TRUE; + case GL_INCR_WRAP_EXT: + case GL_DECR_WRAP_EXT: + if (ctx->Extensions.EXT_stencil_wrap) { + return GL_TRUE; + } + /* FALL-THROUGH */ + default: + return GL_FALSE; + } +} + + +static GLboolean +validate_stencil_func(GLcontext *ctx, GLenum func) +{ + switch (func) { + case GL_NEVER: + case GL_LESS: + case GL_LEQUAL: + case GL_GREATER: + case GL_GEQUAL: + case GL_EQUAL: + case GL_NOTEQUAL: + case GL_ALWAYS: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + /** * Set the clear value for the stencil buffer. * @@ -103,34 +145,15 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; ASSERT_OUTSIDE_BEGIN_END(ctx); - switch (frontfunc) { - case GL_NEVER: - case GL_LESS: - case GL_LEQUAL: - case GL_GREATER: - case GL_GEQUAL: - case GL_EQUAL: - case GL_NOTEQUAL: - case GL_ALWAYS: - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFuncSeparateATI (0x%04x)", frontfunc ); - return; + if (!validate_stencil_func(ctx, frontfunc)) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glStencilFuncSeparateATI(frontfunc)"); + return; } - - switch (backfunc) { - case GL_NEVER: - case GL_LESS: - case GL_LEQUAL: - case GL_GREATER: - case GL_GEQUAL: - case GL_EQUAL: - case GL_NOTEQUAL: - case GL_ALWAYS: - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFuncSeparateATI (0x%04x)", backfunc ); - return; + if (!validate_stencil_func(ctx, backfunc)) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glStencilFuncSeparateATI(backfunc)"); + return; } ref = CLAMP( ref, 0, stencilMax ); @@ -157,6 +180,61 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui } +void APIENTRY +_mesa_StencilOpSeparateATI(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +{ + GLboolean set = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!validate_stencil_op(ctx, sfail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(sfail)"); + return; + } + if (!validate_stencil_op(ctx, zfail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(zfail)"); + return; + } + if (!validate_stencil_op(ctx, zpass)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(zpass)"); + return; + } + if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(face)"); + return; + } + + if (face != GL_BACK) { + /* set front */ + if (ctx->Stencil.ZFailFunc[0] != zfail || + ctx->Stencil.ZPassFunc[0] != zpass || + ctx->Stencil.FailFunc[0] != sfail){ + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ZFailFunc[0] = zfail; + ctx->Stencil.ZPassFunc[0] = zpass; + ctx->Stencil.FailFunc[0] = sfail; + set = GL_TRUE; + } + } + if (face != GL_FRONT) { + /* set back */ + if (ctx->Stencil.ZFailFunc[1] != zfail || + ctx->Stencil.ZPassFunc[1] != zpass || + ctx->Stencil.FailFunc[1] != sfail) { + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ZFailFunc[1] = zfail; + ctx->Stencil.ZPassFunc[1] = zpass; + ctx->Stencil.FailFunc[1] = sfail; + set = GL_TRUE; + } + } + if (set && ctx->Driver.StencilOpSeparate) { + ctx->Driver.StencilOpSeparate(ctx, face, sfail, zfail, zpass); + } +} + + + /** * Set the function and reference value for stencil testing. * @@ -177,19 +255,9 @@ _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask ) const GLint stencilMax = (1 << ctx->DrawBuffer->Visual.stencilBits) - 1; ASSERT_OUTSIDE_BEGIN_END(ctx); - switch (func) { - case GL_NEVER: - case GL_LESS: - case GL_LEQUAL: - case GL_GREATER: - case GL_GEQUAL: - case GL_EQUAL: - case GL_NOTEQUAL: - case GL_ALWAYS: - break; - default: - _mesa_error( ctx, GL_INVALID_ENUM, "glStencilFunc (0x%04x)", func ); - return; + if (!validate_stencil_func(ctx, func)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFunc(func)"); + return; } ref = CLAMP( ref, 0, stencilMax ); @@ -293,59 +361,17 @@ _mesa_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - switch (fail) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); - return; + if (!validate_stencil_op(ctx, fail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(sfail)"); + return; } - switch (zfail) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); - return; + if (!validate_stencil_op(ctx, zfail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(zfail)"); + return; } - switch (zpass) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp"); - return; + if (!validate_stencil_op(ctx, zpass)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOp(zpass)"); + return; } if (ctx->Extensions.ATI_separate_stencil) { @@ -428,59 +454,17 @@ _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) return; } - switch (fail) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(fail)"); - return; + if (!validate_stencil_op(ctx, fail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(sfail)"); + return; } - switch (zfail) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zfail)"); - return; + if (!validate_stencil_op(ctx, zfail)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zfail)"); + return; } - switch (zpass) { - case GL_KEEP: - case GL_ZERO: - case GL_REPLACE: - case GL_INCR: - case GL_DECR: - case GL_INVERT: - break; - case GL_INCR_WRAP_EXT: - case GL_DECR_WRAP_EXT: - if (ctx->Extensions.EXT_stencil_wrap) { - break; - } - /* FALL-THROUGH */ - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)"); - return; + if (!validate_stencil_op(ctx, zpass)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)"); + return; } FLUSH_VERTICES(ctx, _NEW_STENCIL); @@ -513,20 +497,9 @@ _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(face)"); return; } - - switch (func) { - case GL_NEVER: - case GL_LESS: - case GL_LEQUAL: - case GL_GREATER: - case GL_GEQUAL: - case GL_EQUAL: - case GL_NOTEQUAL: - case GL_ALWAYS: - break; - default: - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(func)"); - return; + if (!validate_stencil_func(ctx, func)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilFuncSeparate(func)"); + return; } ref = CLAMP(ref, 0, stencilMax); diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h index 0be98100053..15a65dbcac0 100644 --- a/src/mesa/main/stencil.h +++ b/src/mesa/main/stencil.h @@ -5,9 +5,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.1 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -62,6 +62,10 @@ _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); extern void GLAPIENTRY _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); + +extern void APIENTRY +_mesa_StencilOpSeparateATI(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); + extern void GLAPIENTRY _mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S index 8725c7ee4d3..91dc8c17925 100644 --- a/src/mesa/sparc/glapi_sparc.S +++ b/src/mesa/sparc/glapi_sparc.S @@ -838,6 +838,8 @@ __glapi_sparc_icache_flush: /* %o0 = insn_addr */ .globl gl_dispatch_stub_770 ; .type gl_dispatch_stub_770,#function .globl gl_dispatch_stub_771 ; .type gl_dispatch_stub_771,#function .globl gl_dispatch_stub_772 ; .type gl_dispatch_stub_772,#function + .globl gl_dispatch_stub_773 ; .type gl_dispatch_stub_773,#function + .globl gl_dispatch_stub_774 ; .type gl_dispatch_stub_774,#function .globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function _mesa_sparc_glapi_begin: @@ -1614,6 +1616,8 @@ _mesa_sparc_glapi_begin: GL_STUB(gl_dispatch_stub_770, _gloffset__dispatch_stub_770) GL_STUB(gl_dispatch_stub_771, _gloffset__dispatch_stub_771) GL_STUB(gl_dispatch_stub_772, _gloffset__dispatch_stub_772) + GL_STUB(gl_dispatch_stub_773, _gloffset__dispatch_stub_773) + GL_STUB(gl_dispatch_stub_774, _gloffset__dispatch_stub_774) .globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function _mesa_sparc_glapi_end: diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S index 171e95d1b83..041ced02684 100644 --- a/src/mesa/x86-64/glapi_x86-64.S +++ b/src/mesa/x86-64/glapi_x86-64.S @@ -29220,7 +29220,11 @@ GL_PREFIX(_dispatch_stub_771): pushq %rdi pushq %rsi pushq %rdx + pushq %rcx + pushq %rbp call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx popq %rdx popq %rsi popq %rdi @@ -29236,7 +29240,11 @@ GL_PREFIX(_dispatch_stub_771): pushq %rdi pushq %rsi pushq %rdx + pushq %rcx + pushq %rbp call _glapi_get_dispatch + popq %rbp + popq %rcx popq %rdx popq %rsi popq %rdi @@ -29258,7 +29266,11 @@ GL_PREFIX(_dispatch_stub_772): pushq %rdi pushq %rsi pushq %rdx + pushq %rcx + pushq %rbp call _x86_64_get_dispatch@PLT + popq %rbp + popq %rcx popq %rdx popq %rsi popq %rdi @@ -29274,7 +29286,11 @@ GL_PREFIX(_dispatch_stub_772): pushq %rdi pushq %rsi pushq %rdx + pushq %rcx + pushq %rbp call _glapi_get_dispatch + popq %rbp + popq %rcx popq %rdx popq %rsi popq %rdi @@ -29283,6 +29299,82 @@ GL_PREFIX(_dispatch_stub_772): #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(_dispatch_stub_772), .-GL_PREFIX(_dispatch_stub_772) + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_773) + .type GL_PREFIX(_dispatch_stub_773), @function + HIDDEN(GL_PREFIX(_dispatch_stub_773)) +GL_PREFIX(_dispatch_stub_773): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6184(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6184(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6184(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6184(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_773), .-GL_PREFIX(_dispatch_stub_773) + + .p2align 4,,15 + .globl GL_PREFIX(_dispatch_stub_774) + .type GL_PREFIX(_dispatch_stub_774), @function + HIDDEN(GL_PREFIX(_dispatch_stub_774)) +GL_PREFIX(_dispatch_stub_774): +#if defined(GLX_USE_TLS) + call _x86_64_get_dispatch@PLT + movq 6192(%rax), %r11 + jmp *%r11 +#elif defined(PTHREADS) + pushq %rdi + pushq %rsi + pushq %rdx + call _x86_64_get_dispatch@PLT + popq %rdx + popq %rsi + popq %rdi + movq 6192(%rax), %r11 + jmp *%r11 +#else + movq _glapi_Dispatch(%rip), %rax + testq %rax, %rax + je 1f + movq 6192(%rax), %r11 + jmp *%r11 +1: + pushq %rdi + pushq %rsi + pushq %rdx + call _glapi_get_dispatch + popq %rdx + popq %rsi + popq %rdi + movq 6192(%rax), %r11 + jmp *%r11 +#endif /* defined(GLX_USE_TLS) */ + .size GL_PREFIX(_dispatch_stub_774), .-GL_PREFIX(_dispatch_stub_774) + .globl GL_PREFIX(ArrayElementEXT) ; .set GL_PREFIX(ArrayElementEXT), GL_PREFIX(ArrayElement) .globl GL_PREFIX(BindTextureEXT) ; .set GL_PREFIX(BindTextureEXT), GL_PREFIX(BindTexture) .globl GL_PREFIX(DrawArraysEXT) ; .set GL_PREFIX(DrawArraysEXT), GL_PREFIX(DrawArrays) diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index 1d04779d148..41b8e0c1d23 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -948,14 +948,18 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(_dispatch_stub_767, _gloffset_BlitFramebufferEXT, _dispatch_stub_767@40) HIDDEN(GL_PREFIX(_dispatch_stub_767, _dispatch_stub_767@40)) GL_STUB(FramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) - GL_STUB(_dispatch_stub_769, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_769@16) + GL_STUB(_dispatch_stub_769, _gloffset_StencilFuncSeparateATI, _dispatch_stub_769@16) HIDDEN(GL_PREFIX(_dispatch_stub_769, _dispatch_stub_769@16)) - GL_STUB(_dispatch_stub_770, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_770@16) + GL_STUB(_dispatch_stub_770, _gloffset_StencilOpSeparateATI, _dispatch_stub_770@16) HIDDEN(GL_PREFIX(_dispatch_stub_770, _dispatch_stub_770@16)) - GL_STUB(_dispatch_stub_771, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_771@12) - HIDDEN(GL_PREFIX(_dispatch_stub_771, _dispatch_stub_771@12)) - GL_STUB(_dispatch_stub_772, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_772@12) - HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@12)) + GL_STUB(_dispatch_stub_771, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_771@16) + HIDDEN(GL_PREFIX(_dispatch_stub_771, _dispatch_stub_771@16)) + GL_STUB(_dispatch_stub_772, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_772@16) + HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@16)) + GL_STUB(_dispatch_stub_773, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_773@12) + HIDDEN(GL_PREFIX(_dispatch_stub_773, _dispatch_stub_773@12)) + GL_STUB(_dispatch_stub_774, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_774@12) + HIDDEN(GL_PREFIX(_dispatch_stub_774, _dispatch_stub_774@12)) GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4) GL_STUB_ALIAS(BindTextureEXT, _gloffset_BindTexture, BindTextureEXT@8, BindTexture, BindTexture@8) GL_STUB_ALIAS(DrawArraysEXT, _gloffset_DrawArrays, DrawArraysEXT@12, DrawArrays, DrawArrays@12) -- cgit v1.2.3 From a7f64635a640f49011cf78af766f90ae6588989a Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 30 Oct 2007 10:24:34 -0600 Subject: Alias glStencilOpSeparateATI with glStencilOpSeparate. --- src/mesa/drivers/dri/common/extension_helper.h | 12 +- src/mesa/glapi/dispatch.h | 17 +-- src/mesa/glapi/gl_API.xml | 4 +- src/mesa/glapi/glapioffsets.h | 12 +- src/mesa/glapi/glapitable.h | 11 +- src/mesa/glapi/glapitemp.h | 33 ++--- src/mesa/glapi/glprocs.h | 196 ++++++++++++------------- src/mesa/main/state.c | 1 - src/mesa/main/stencil.c | 101 ++++--------- src/mesa/main/stencil.h | 3 - src/mesa/sparc/glapi_sparc.S | 2 - src/mesa/x86-64/glapi_x86-64.S | 46 ------ src/mesa/x86/glapi_x86.S | 13 +- 13 files changed, 168 insertions(+), 283 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h index 726d9900c3a..065c5d8dae7 100644 --- a/src/mesa/drivers/dri/common/extension_helper.h +++ b/src/mesa/drivers/dri/common/extension_helper.h @@ -1105,10 +1105,11 @@ static const char IsRenderbufferEXT_names[] = ""; #endif -#if defined(need_GL_VERSION_2_0) +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ATI_separate_stencil) static const char StencilOpSeparate_names[] = "iiii\0" /* Parameter signature */ "glStencilOpSeparate\0" + "glStencilOpSeparateATI\0" ""; #endif @@ -3839,13 +3840,6 @@ static const char Binormal3svEXT_names[] = ""; #endif -#if defined(need_GL_ATI_separate_stencil) -static const char StencilOpSeparateATI_names[] = - "iiii\0" /* Parameter signature */ - "glStencilOpSeparateATI\0" - ""; -#endif - #if defined(need_GL_EXT_light_texture) static const char ApplyTextureEXT_names[] = "i\0" /* Parameter signature */ @@ -5198,7 +5192,7 @@ static const struct dri_extension_function GL_ATI_fragment_shader_functions[] = #if defined(need_GL_ATI_separate_stencil) static const struct dri_extension_function GL_ATI_separate_stencil_functions[] = { - { StencilOpSeparateATI_names, StencilOpSeparateATI_remap_index, -1 }, + { StencilOpSeparate_names, StencilOpSeparate_remap_index, -1 }, { StencilFuncSeparateATI_names, StencilFuncSeparateATI_remap_index, -1 }, { NULL, 0, 0 } }; diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index e46f159f943..db23e44396d 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -2368,9 +2368,6 @@ #define CALL_StencilFuncSeparateATI(disp, parameters) (*((disp)->StencilFuncSeparateATI)) parameters #define GET_StencilFuncSeparateATI(disp) ((disp)->StencilFuncSeparateATI) #define SET_StencilFuncSeparateATI(disp, fn) ((disp)->StencilFuncSeparateATI = fn) -#define CALL_StencilOpSeparateATI(disp, parameters) (*((disp)->StencilOpSeparateATI)) parameters -#define GET_StencilOpSeparateATI(disp) ((disp)->StencilOpSeparateATI) -#define SET_StencilOpSeparateATI(disp, fn) ((disp)->StencilOpSeparateATI = fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) (*((disp)->ProgramEnvParameters4fvEXT)) parameters #define GET_ProgramEnvParameters4fvEXT(disp) ((disp)->ProgramEnvParameters4fvEXT) #define SET_ProgramEnvParameters4fvEXT(disp, fn) ((disp)->ProgramEnvParameters4fvEXT = fn) @@ -2386,7 +2383,7 @@ #else -#define driDispatchRemapTable_size 367 +#define driDispatchRemapTable_size 366 extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define AttachShader_remap_index 0 @@ -2751,11 +2748,10 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define BlitFramebufferEXT_remap_index 359 #define FramebufferTextureLayerEXT_remap_index 360 #define StencilFuncSeparateATI_remap_index 361 -#define StencilOpSeparateATI_remap_index 362 -#define ProgramEnvParameters4fvEXT_remap_index 363 -#define ProgramLocalParameters4fvEXT_remap_index 364 -#define GetQueryObjecti64vEXT_remap_index 365 -#define GetQueryObjectui64vEXT_remap_index 366 +#define ProgramEnvParameters4fvEXT_remap_index 362 +#define ProgramLocalParameters4fvEXT_remap_index 363 +#define GetQueryObjecti64vEXT_remap_index 364 +#define GetQueryObjectui64vEXT_remap_index 365 #define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) #define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) @@ -3843,9 +3839,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define CALL_StencilFuncSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparateATI_remap_index], parameters) #define GET_StencilFuncSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index]) #define SET_StencilFuncSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index], fn) -#define CALL_StencilOpSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[StencilOpSeparateATI_remap_index], parameters) -#define GET_StencilOpSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilOpSeparateATI_remap_index]) -#define SET_StencilOpSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilOpSeparateATI_remap_index], fn) #define CALL_ProgramEnvParameters4fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], parameters) #define GET_ProgramEnvParameters4fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]) #define SET_ProgramEnvParameters4fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], fn) diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index e16ffe870f6..3d47e6f2cef 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -5138,7 +5138,7 @@ - + @@ -12170,7 +12170,7 @@ - + diff --git a/src/mesa/glapi/glapioffsets.h b/src/mesa/glapi/glapioffsets.h index a2db342ffe0..4799fd3076e 100644 --- a/src/mesa/glapi/glapioffsets.h +++ b/src/mesa/glapi/glapioffsets.h @@ -802,12 +802,11 @@ #define _gloffset_BlitFramebufferEXT 767 #define _gloffset_FramebufferTextureLayerEXT 768 #define _gloffset_StencilFuncSeparateATI 769 -#define _gloffset_StencilOpSeparateATI 770 -#define _gloffset_ProgramEnvParameters4fvEXT 771 -#define _gloffset_ProgramLocalParameters4fvEXT 772 -#define _gloffset_GetQueryObjecti64vEXT 773 -#define _gloffset_GetQueryObjectui64vEXT 774 -#define _gloffset_FIRST_DYNAMIC 775 +#define _gloffset_ProgramEnvParameters4fvEXT 770 +#define _gloffset_ProgramLocalParameters4fvEXT 771 +#define _gloffset_GetQueryObjecti64vEXT 772 +#define _gloffset_GetQueryObjectui64vEXT 773 +#define _gloffset_FIRST_DYNAMIC 774 #else @@ -1173,7 +1172,6 @@ #define _gloffset_BlitFramebufferEXT driDispatchRemapTable[BlitFramebufferEXT_remap_index] #define _gloffset_FramebufferTextureLayerEXT driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index] #define _gloffset_StencilFuncSeparateATI driDispatchRemapTable[StencilFuncSeparateATI_remap_index] -#define _gloffset_StencilOpSeparateATI driDispatchRemapTable[StencilOpSeparateATI_remap_index] #define _gloffset_ProgramEnvParameters4fvEXT driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index] #define _gloffset_ProgramLocalParameters4fvEXT driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index] #define _gloffset_GetQueryObjecti64vEXT driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index] diff --git a/src/mesa/glapi/glapitable.h b/src/mesa/glapi/glapitable.h index 148aa96b88d..22c2dc2f69f 100644 --- a/src/mesa/glapi/glapitable.h +++ b/src/mesa/glapi/glapitable.h @@ -464,7 +464,7 @@ struct _glapi_table GLboolean (GLAPIENTRYP IsShader)(GLuint shader); /* 420 */ void (GLAPIENTRYP StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask); /* 421 */ void (GLAPIENTRYP StencilMaskSeparate)(GLenum face, GLuint mask); /* 422 */ - void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); /* 423 */ + void (GLAPIENTRYP StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); /* 423 */ void (GLAPIENTRYP UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 424 */ void (GLAPIENTRYP UniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 425 */ void (GLAPIENTRYP UniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); /* 426 */ @@ -811,11 +811,10 @@ struct _glapi_table void (GLAPIENTRYP BlitFramebufferEXT)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); /* 767 */ void (GLAPIENTRYP FramebufferTextureLayerEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); /* 768 */ void (GLAPIENTRYP StencilFuncSeparateATI)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); /* 769 */ - void (GLAPIENTRYP StencilOpSeparateATI)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); /* 770 */ - void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 771 */ - void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 772 */ - void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 773 */ - void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 774 */ + void (GLAPIENTRYP ProgramEnvParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 770 */ + void (GLAPIENTRYP ProgramLocalParameters4fvEXT)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); /* 771 */ + void (GLAPIENTRYP GetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64EXT * params); /* 772 */ + void (GLAPIENTRYP GetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64EXT * params); /* 773 */ }; #endif /* !defined( _GLAPI_TABLE_H_ ) */ diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h index cd420fdee57..6ded362c0ef 100644 --- a/src/mesa/glapi/glapitemp.h +++ b/src/mesa/glapi/glapitemp.h @@ -2754,9 +2754,16 @@ KEYWORD1 void KEYWORD2 NAME(StencilMaskSeparate)(GLenum face, GLuint mask) DISPATCH(StencilMaskSeparate, (face, mask), (F, "glStencilMaskSeparate(0x%x, %d);\n", face, mask)); } -KEYWORD1 void KEYWORD2 NAME(StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +KEYWORD1 void KEYWORD2 NAME(StencilOpSeparate)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) { - DISPATCH(StencilOpSeparate, (face, fail, zfail, zpass), (F, "glStencilOpSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", face, fail, zfail, zpass)); + DISPATCH(StencilOpSeparate, (face, sfail, zfail, zpass), (F, "glStencilOpSeparate(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); +} + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_423)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); + +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_423)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +{ + DISPATCH(StencilOpSeparate, (face, sfail, zfail, zpass), (F, "glStencilOpSeparateATI(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); } KEYWORD1 void KEYWORD2 NAME(UniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) @@ -5453,37 +5460,30 @@ KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_769)(GLenum frontfunc, GLenum bac DISPATCH(StencilFuncSeparateATI, (frontfunc, backfunc, ref, mask), (F, "glStencilFuncSeparateATI(0x%x, 0x%x, %d, %d);\n", frontfunc, backfunc, ref, mask)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_770)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { - DISPATCH(StencilOpSeparateATI, (face, sfail, zfail, zpass), (F, "glStencilOpSeparateATI(0x%x, 0x%x, 0x%x, 0x%x);\n", face, sfail, zfail, zpass)); + DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_771)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) -{ - DISPATCH(ProgramEnvParameters4fvEXT, (target, index, count, params), (F, "glProgramEnvParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); -} - -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params); - -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLenum target, GLuint index, GLsizei count, const GLfloat * params) { DISPATCH(ProgramLocalParameters4fvEXT, (target, index, count, params), (F, "glProgramLocalParameters4fvEXT(0x%x, %d, %d, %p);\n", target, index, count, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_772)(GLuint id, GLenum pname, GLint64EXT * params) { DISPATCH(GetQueryObjecti64vEXT, (id, pname, params), (F, "glGetQueryObjecti64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params); +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLuint64EXT * params); -KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_774)(GLuint id, GLenum pname, GLuint64EXT * params) +KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_773)(GLuint id, GLenum pname, GLuint64EXT * params) { DISPATCH(GetQueryObjectui64vEXT, (id, pname, params), (F, "glGetQueryObjectui64vEXT(%d, 0x%x, %p);\n", id, pname, (const void *) params)); } @@ -6276,7 +6276,6 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = { TABLE_ENTRY(_dispatch_stub_771), TABLE_ENTRY(_dispatch_stub_772), TABLE_ENTRY(_dispatch_stub_773), - TABLE_ENTRY(_dispatch_stub_774), /* A whole bunch of no-op functions. These might be called * when someone tries to call a dynamically-registered * extension function without a current rendering context. diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h index 657b74e5783..abc22a9a042 100644 --- a/src/mesa/glapi/glprocs.h +++ b/src/mesa/glapi/glprocs.h @@ -822,7 +822,6 @@ static const char gl_string_table[] = "glBlitFramebufferEXT\0" "glFramebufferTextureLayerEXT\0" "glStencilFuncSeparateATI\0" - "glStencilOpSeparateATI\0" "glProgramEnvParameters4fvEXT\0" "glProgramLocalParameters4fvEXT\0" "glGetQueryObjecti64vEXT\0" @@ -918,6 +917,7 @@ static const char gl_string_table[] = "glMultiTexCoord4iv\0" "glMultiTexCoord4s\0" "glMultiTexCoord4sv\0" + "glStencilOpSeparateATI\0" "glLoadTransposeMatrixd\0" "glLoadTransposeMatrixf\0" "glMultTransposeMatrixd\0" @@ -1151,7 +1151,6 @@ static const char gl_string_table[] = #define gl_dispatch_stub_771 mgl_dispatch_stub_771 #define gl_dispatch_stub_772 mgl_dispatch_stub_772 #define gl_dispatch_stub_773 mgl_dispatch_stub_773 -#define gl_dispatch_stub_774 mgl_dispatch_stub_774 #endif /* USE_MGL_NAMESPACE */ @@ -1203,7 +1202,6 @@ extern void gl_dispatch_stub_770(void); extern void gl_dispatch_stub_771(void); extern void gl_dispatch_stub_772(void); extern void gl_dispatch_stub_773(void); -extern void gl_dispatch_stub_774(void); #endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */ static const glprocs_table_t static_functions[] = { @@ -1977,102 +1975,102 @@ static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET(13449, gl_dispatch_stub_767, gl_dispatch_stub_767, NULL, _gloffset_BlitFramebufferEXT), NAME_FUNC_OFFSET(13470, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), NAME_FUNC_OFFSET(13499, gl_dispatch_stub_769, gl_dispatch_stub_769, NULL, _gloffset_StencilFuncSeparateATI), - NAME_FUNC_OFFSET(13524, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_StencilOpSeparateATI), - NAME_FUNC_OFFSET(13547, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_ProgramEnvParameters4fvEXT), - NAME_FUNC_OFFSET(13576, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_ProgramLocalParameters4fvEXT), - NAME_FUNC_OFFSET(13607, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_GetQueryObjecti64vEXT), - NAME_FUNC_OFFSET(13631, gl_dispatch_stub_774, gl_dispatch_stub_774, NULL, _gloffset_GetQueryObjectui64vEXT), - NAME_FUNC_OFFSET(13656, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), - NAME_FUNC_OFFSET(13674, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), - NAME_FUNC_OFFSET(13691, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), - NAME_FUNC_OFFSET(13707, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), - NAME_FUNC_OFFSET(13732, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), - NAME_FUNC_OFFSET(13752, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), - NAME_FUNC_OFFSET(13772, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), - NAME_FUNC_OFFSET(13795, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), - NAME_FUNC_OFFSET(13818, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), - NAME_FUNC_OFFSET(13838, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), - NAME_FUNC_OFFSET(13855, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), - NAME_FUNC_OFFSET(13872, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), - NAME_FUNC_OFFSET(13887, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), - NAME_FUNC_OFFSET(13911, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), - NAME_FUNC_OFFSET(13930, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), - NAME_FUNC_OFFSET(13949, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), - NAME_FUNC_OFFSET(13965, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), - NAME_FUNC_OFFSET(13984, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), - NAME_FUNC_OFFSET(14007, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(14023, glColorTable, glColorTable, NULL, _gloffset_ColorTable), - NAME_FUNC_OFFSET(14039, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), - NAME_FUNC_OFFSET(14066, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), - NAME_FUNC_OFFSET(14093, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), - NAME_FUNC_OFFSET(14113, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14132, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), - NAME_FUNC_OFFSET(14151, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14181, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), - NAME_FUNC_OFFSET(14211, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14241, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), - NAME_FUNC_OFFSET(14271, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), - NAME_FUNC_OFFSET(14290, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), - NAME_FUNC_OFFSET(14313, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), - NAME_FUNC_OFFSET(14338, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), - NAME_FUNC_OFFSET(14363, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), - NAME_FUNC_OFFSET(14390, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), - NAME_FUNC_OFFSET(14418, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), - NAME_FUNC_OFFSET(14445, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), - NAME_FUNC_OFFSET(14473, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), - NAME_FUNC_OFFSET(14502, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), - NAME_FUNC_OFFSET(14531, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), - NAME_FUNC_OFFSET(14557, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), - NAME_FUNC_OFFSET(14588, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), - NAME_FUNC_OFFSET(14619, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), - NAME_FUNC_OFFSET(14643, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), - NAME_FUNC_OFFSET(14666, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), - NAME_FUNC_OFFSET(14684, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), - NAME_FUNC_OFFSET(14713, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), - NAME_FUNC_OFFSET(14742, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), - NAME_FUNC_OFFSET(14757, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), - NAME_FUNC_OFFSET(14783, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), - NAME_FUNC_OFFSET(14809, glHistogram, glHistogram, NULL, _gloffset_Histogram), - NAME_FUNC_OFFSET(14824, glMinmax, glMinmax, NULL, _gloffset_Minmax), - NAME_FUNC_OFFSET(14836, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), - NAME_FUNC_OFFSET(14856, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), - NAME_FUNC_OFFSET(14873, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), - NAME_FUNC_OFFSET(14889, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), - NAME_FUNC_OFFSET(14908, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), - NAME_FUNC_OFFSET(14931, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), - NAME_FUNC_OFFSET(14947, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), - NAME_FUNC_OFFSET(14969, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), - NAME_FUNC_OFFSET(14987, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), - NAME_FUNC_OFFSET(15006, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), - NAME_FUNC_OFFSET(15024, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), - NAME_FUNC_OFFSET(15043, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), - NAME_FUNC_OFFSET(15061, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), - NAME_FUNC_OFFSET(15080, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), - NAME_FUNC_OFFSET(15098, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), - NAME_FUNC_OFFSET(15117, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), - NAME_FUNC_OFFSET(15135, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), - NAME_FUNC_OFFSET(15154, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), - NAME_FUNC_OFFSET(15172, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), - NAME_FUNC_OFFSET(15191, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), - NAME_FUNC_OFFSET(15209, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), - NAME_FUNC_OFFSET(15228, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), - NAME_FUNC_OFFSET(15246, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), - NAME_FUNC_OFFSET(15265, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), - NAME_FUNC_OFFSET(15283, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), - NAME_FUNC_OFFSET(15302, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), - NAME_FUNC_OFFSET(15320, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), - NAME_FUNC_OFFSET(15339, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), - NAME_FUNC_OFFSET(15357, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), - NAME_FUNC_OFFSET(15376, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), - NAME_FUNC_OFFSET(15394, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), - NAME_FUNC_OFFSET(15413, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), - NAME_FUNC_OFFSET(15431, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), - NAME_FUNC_OFFSET(15450, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), - NAME_FUNC_OFFSET(15468, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), - NAME_FUNC_OFFSET(15487, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), - NAME_FUNC_OFFSET(15505, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), - NAME_FUNC_OFFSET(15524, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), - NAME_FUNC_OFFSET(15542, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(13524, gl_dispatch_stub_770, gl_dispatch_stub_770, NULL, _gloffset_ProgramEnvParameters4fvEXT), + NAME_FUNC_OFFSET(13553, gl_dispatch_stub_771, gl_dispatch_stub_771, NULL, _gloffset_ProgramLocalParameters4fvEXT), + NAME_FUNC_OFFSET(13584, gl_dispatch_stub_772, gl_dispatch_stub_772, NULL, _gloffset_GetQueryObjecti64vEXT), + NAME_FUNC_OFFSET(13608, gl_dispatch_stub_773, gl_dispatch_stub_773, NULL, _gloffset_GetQueryObjectui64vEXT), + NAME_FUNC_OFFSET(13633, glArrayElement, glArrayElement, NULL, _gloffset_ArrayElement), + NAME_FUNC_OFFSET(13651, glBindTexture, glBindTexture, NULL, _gloffset_BindTexture), + NAME_FUNC_OFFSET(13668, glDrawArrays, glDrawArrays, NULL, _gloffset_DrawArrays), + NAME_FUNC_OFFSET(13684, glAreTexturesResident, glAreTexturesResidentEXT, glAreTexturesResidentEXT, _gloffset_AreTexturesResident), + NAME_FUNC_OFFSET(13709, glCopyTexImage1D, glCopyTexImage1D, NULL, _gloffset_CopyTexImage1D), + NAME_FUNC_OFFSET(13729, glCopyTexImage2D, glCopyTexImage2D, NULL, _gloffset_CopyTexImage2D), + NAME_FUNC_OFFSET(13749, glCopyTexSubImage1D, glCopyTexSubImage1D, NULL, _gloffset_CopyTexSubImage1D), + NAME_FUNC_OFFSET(13772, glCopyTexSubImage2D, glCopyTexSubImage2D, NULL, _gloffset_CopyTexSubImage2D), + NAME_FUNC_OFFSET(13795, glDeleteTextures, glDeleteTexturesEXT, glDeleteTexturesEXT, _gloffset_DeleteTextures), + NAME_FUNC_OFFSET(13815, glGenTextures, glGenTexturesEXT, glGenTexturesEXT, _gloffset_GenTextures), + NAME_FUNC_OFFSET(13832, glGetPointerv, glGetPointerv, NULL, _gloffset_GetPointerv), + NAME_FUNC_OFFSET(13849, glIsTexture, glIsTextureEXT, glIsTextureEXT, _gloffset_IsTexture), + NAME_FUNC_OFFSET(13864, glPrioritizeTextures, glPrioritizeTextures, NULL, _gloffset_PrioritizeTextures), + NAME_FUNC_OFFSET(13888, glTexSubImage1D, glTexSubImage1D, NULL, _gloffset_TexSubImage1D), + NAME_FUNC_OFFSET(13907, glTexSubImage2D, glTexSubImage2D, NULL, _gloffset_TexSubImage2D), + NAME_FUNC_OFFSET(13926, glBlendColor, glBlendColor, NULL, _gloffset_BlendColor), + NAME_FUNC_OFFSET(13942, glBlendEquation, glBlendEquation, NULL, _gloffset_BlendEquation), + NAME_FUNC_OFFSET(13961, glDrawRangeElements, glDrawRangeElements, NULL, _gloffset_DrawRangeElements), + NAME_FUNC_OFFSET(13984, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14000, glColorTable, glColorTable, NULL, _gloffset_ColorTable), + NAME_FUNC_OFFSET(14016, glColorTableParameterfv, glColorTableParameterfv, NULL, _gloffset_ColorTableParameterfv), + NAME_FUNC_OFFSET(14043, glColorTableParameteriv, glColorTableParameteriv, NULL, _gloffset_ColorTableParameteriv), + NAME_FUNC_OFFSET(14070, glCopyColorTable, glCopyColorTable, NULL, _gloffset_CopyColorTable), + NAME_FUNC_OFFSET(14090, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14109, glGetColorTable, glGetColorTableEXT, glGetColorTableEXT, _gloffset_GetColorTable), + NAME_FUNC_OFFSET(14128, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14158, glGetColorTableParameterfv, glGetColorTableParameterfvEXT, glGetColorTableParameterfvEXT, _gloffset_GetColorTableParameterfv), + NAME_FUNC_OFFSET(14188, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14218, glGetColorTableParameteriv, glGetColorTableParameterivEXT, glGetColorTableParameterivEXT, _gloffset_GetColorTableParameteriv), + NAME_FUNC_OFFSET(14248, glColorSubTable, glColorSubTable, NULL, _gloffset_ColorSubTable), + NAME_FUNC_OFFSET(14267, glCopyColorSubTable, glCopyColorSubTable, NULL, _gloffset_CopyColorSubTable), + NAME_FUNC_OFFSET(14290, glConvolutionFilter1D, glConvolutionFilter1D, NULL, _gloffset_ConvolutionFilter1D), + NAME_FUNC_OFFSET(14315, glConvolutionFilter2D, glConvolutionFilter2D, NULL, _gloffset_ConvolutionFilter2D), + NAME_FUNC_OFFSET(14340, glConvolutionParameterf, glConvolutionParameterf, NULL, _gloffset_ConvolutionParameterf), + NAME_FUNC_OFFSET(14367, glConvolutionParameterfv, glConvolutionParameterfv, NULL, _gloffset_ConvolutionParameterfv), + NAME_FUNC_OFFSET(14395, glConvolutionParameteri, glConvolutionParameteri, NULL, _gloffset_ConvolutionParameteri), + NAME_FUNC_OFFSET(14422, glConvolutionParameteriv, glConvolutionParameteriv, NULL, _gloffset_ConvolutionParameteriv), + NAME_FUNC_OFFSET(14450, glCopyConvolutionFilter1D, glCopyConvolutionFilter1D, NULL, _gloffset_CopyConvolutionFilter1D), + NAME_FUNC_OFFSET(14479, glCopyConvolutionFilter2D, glCopyConvolutionFilter2D, NULL, _gloffset_CopyConvolutionFilter2D), + NAME_FUNC_OFFSET(14508, glGetConvolutionFilter, gl_dispatch_stub_356, gl_dispatch_stub_356, _gloffset_GetConvolutionFilter), + NAME_FUNC_OFFSET(14534, glGetConvolutionParameterfv, gl_dispatch_stub_357, gl_dispatch_stub_357, _gloffset_GetConvolutionParameterfv), + NAME_FUNC_OFFSET(14565, glGetConvolutionParameteriv, gl_dispatch_stub_358, gl_dispatch_stub_358, _gloffset_GetConvolutionParameteriv), + NAME_FUNC_OFFSET(14596, glGetSeparableFilter, gl_dispatch_stub_359, gl_dispatch_stub_359, _gloffset_GetSeparableFilter), + NAME_FUNC_OFFSET(14620, glSeparableFilter2D, glSeparableFilter2D, NULL, _gloffset_SeparableFilter2D), + NAME_FUNC_OFFSET(14643, glGetHistogram, gl_dispatch_stub_361, gl_dispatch_stub_361, _gloffset_GetHistogram), + NAME_FUNC_OFFSET(14661, glGetHistogramParameterfv, gl_dispatch_stub_362, gl_dispatch_stub_362, _gloffset_GetHistogramParameterfv), + NAME_FUNC_OFFSET(14690, glGetHistogramParameteriv, gl_dispatch_stub_363, gl_dispatch_stub_363, _gloffset_GetHistogramParameteriv), + NAME_FUNC_OFFSET(14719, glGetMinmax, gl_dispatch_stub_364, gl_dispatch_stub_364, _gloffset_GetMinmax), + NAME_FUNC_OFFSET(14734, glGetMinmaxParameterfv, gl_dispatch_stub_365, gl_dispatch_stub_365, _gloffset_GetMinmaxParameterfv), + NAME_FUNC_OFFSET(14760, glGetMinmaxParameteriv, gl_dispatch_stub_366, gl_dispatch_stub_366, _gloffset_GetMinmaxParameteriv), + NAME_FUNC_OFFSET(14786, glHistogram, glHistogram, NULL, _gloffset_Histogram), + NAME_FUNC_OFFSET(14801, glMinmax, glMinmax, NULL, _gloffset_Minmax), + NAME_FUNC_OFFSET(14813, glResetHistogram, glResetHistogram, NULL, _gloffset_ResetHistogram), + NAME_FUNC_OFFSET(14833, glResetMinmax, glResetMinmax, NULL, _gloffset_ResetMinmax), + NAME_FUNC_OFFSET(14850, glTexImage3D, glTexImage3D, NULL, _gloffset_TexImage3D), + NAME_FUNC_OFFSET(14866, glTexSubImage3D, glTexSubImage3D, NULL, _gloffset_TexSubImage3D), + NAME_FUNC_OFFSET(14885, glCopyTexSubImage3D, glCopyTexSubImage3D, NULL, _gloffset_CopyTexSubImage3D), + NAME_FUNC_OFFSET(14908, glActiveTextureARB, glActiveTextureARB, NULL, _gloffset_ActiveTextureARB), + NAME_FUNC_OFFSET(14924, glClientActiveTextureARB, glClientActiveTextureARB, NULL, _gloffset_ClientActiveTextureARB), + NAME_FUNC_OFFSET(14946, glMultiTexCoord1dARB, glMultiTexCoord1dARB, NULL, _gloffset_MultiTexCoord1dARB), + NAME_FUNC_OFFSET(14964, glMultiTexCoord1dvARB, glMultiTexCoord1dvARB, NULL, _gloffset_MultiTexCoord1dvARB), + NAME_FUNC_OFFSET(14983, glMultiTexCoord1fARB, glMultiTexCoord1fARB, NULL, _gloffset_MultiTexCoord1fARB), + NAME_FUNC_OFFSET(15001, glMultiTexCoord1fvARB, glMultiTexCoord1fvARB, NULL, _gloffset_MultiTexCoord1fvARB), + NAME_FUNC_OFFSET(15020, glMultiTexCoord1iARB, glMultiTexCoord1iARB, NULL, _gloffset_MultiTexCoord1iARB), + NAME_FUNC_OFFSET(15038, glMultiTexCoord1ivARB, glMultiTexCoord1ivARB, NULL, _gloffset_MultiTexCoord1ivARB), + NAME_FUNC_OFFSET(15057, glMultiTexCoord1sARB, glMultiTexCoord1sARB, NULL, _gloffset_MultiTexCoord1sARB), + NAME_FUNC_OFFSET(15075, glMultiTexCoord1svARB, glMultiTexCoord1svARB, NULL, _gloffset_MultiTexCoord1svARB), + NAME_FUNC_OFFSET(15094, glMultiTexCoord2dARB, glMultiTexCoord2dARB, NULL, _gloffset_MultiTexCoord2dARB), + NAME_FUNC_OFFSET(15112, glMultiTexCoord2dvARB, glMultiTexCoord2dvARB, NULL, _gloffset_MultiTexCoord2dvARB), + NAME_FUNC_OFFSET(15131, glMultiTexCoord2fARB, glMultiTexCoord2fARB, NULL, _gloffset_MultiTexCoord2fARB), + NAME_FUNC_OFFSET(15149, glMultiTexCoord2fvARB, glMultiTexCoord2fvARB, NULL, _gloffset_MultiTexCoord2fvARB), + NAME_FUNC_OFFSET(15168, glMultiTexCoord2iARB, glMultiTexCoord2iARB, NULL, _gloffset_MultiTexCoord2iARB), + NAME_FUNC_OFFSET(15186, glMultiTexCoord2ivARB, glMultiTexCoord2ivARB, NULL, _gloffset_MultiTexCoord2ivARB), + NAME_FUNC_OFFSET(15205, glMultiTexCoord2sARB, glMultiTexCoord2sARB, NULL, _gloffset_MultiTexCoord2sARB), + NAME_FUNC_OFFSET(15223, glMultiTexCoord2svARB, glMultiTexCoord2svARB, NULL, _gloffset_MultiTexCoord2svARB), + NAME_FUNC_OFFSET(15242, glMultiTexCoord3dARB, glMultiTexCoord3dARB, NULL, _gloffset_MultiTexCoord3dARB), + NAME_FUNC_OFFSET(15260, glMultiTexCoord3dvARB, glMultiTexCoord3dvARB, NULL, _gloffset_MultiTexCoord3dvARB), + NAME_FUNC_OFFSET(15279, glMultiTexCoord3fARB, glMultiTexCoord3fARB, NULL, _gloffset_MultiTexCoord3fARB), + NAME_FUNC_OFFSET(15297, glMultiTexCoord3fvARB, glMultiTexCoord3fvARB, NULL, _gloffset_MultiTexCoord3fvARB), + NAME_FUNC_OFFSET(15316, glMultiTexCoord3iARB, glMultiTexCoord3iARB, NULL, _gloffset_MultiTexCoord3iARB), + NAME_FUNC_OFFSET(15334, glMultiTexCoord3ivARB, glMultiTexCoord3ivARB, NULL, _gloffset_MultiTexCoord3ivARB), + NAME_FUNC_OFFSET(15353, glMultiTexCoord3sARB, glMultiTexCoord3sARB, NULL, _gloffset_MultiTexCoord3sARB), + NAME_FUNC_OFFSET(15371, glMultiTexCoord3svARB, glMultiTexCoord3svARB, NULL, _gloffset_MultiTexCoord3svARB), + NAME_FUNC_OFFSET(15390, glMultiTexCoord4dARB, glMultiTexCoord4dARB, NULL, _gloffset_MultiTexCoord4dARB), + NAME_FUNC_OFFSET(15408, glMultiTexCoord4dvARB, glMultiTexCoord4dvARB, NULL, _gloffset_MultiTexCoord4dvARB), + NAME_FUNC_OFFSET(15427, glMultiTexCoord4fARB, glMultiTexCoord4fARB, NULL, _gloffset_MultiTexCoord4fARB), + NAME_FUNC_OFFSET(15445, glMultiTexCoord4fvARB, glMultiTexCoord4fvARB, NULL, _gloffset_MultiTexCoord4fvARB), + NAME_FUNC_OFFSET(15464, glMultiTexCoord4iARB, glMultiTexCoord4iARB, NULL, _gloffset_MultiTexCoord4iARB), + NAME_FUNC_OFFSET(15482, glMultiTexCoord4ivARB, glMultiTexCoord4ivARB, NULL, _gloffset_MultiTexCoord4ivARB), + NAME_FUNC_OFFSET(15501, glMultiTexCoord4sARB, glMultiTexCoord4sARB, NULL, _gloffset_MultiTexCoord4sARB), + NAME_FUNC_OFFSET(15519, glMultiTexCoord4svARB, glMultiTexCoord4svARB, NULL, _gloffset_MultiTexCoord4svARB), + NAME_FUNC_OFFSET(15538, glStencilOpSeparate, glStencilOpSeparate, NULL, _gloffset_StencilOpSeparate), NAME_FUNC_OFFSET(15561, glLoadTransposeMatrixdARB, glLoadTransposeMatrixdARB, NULL, _gloffset_LoadTransposeMatrixdARB), NAME_FUNC_OFFSET(15584, glLoadTransposeMatrixfARB, glLoadTransposeMatrixfARB, NULL, _gloffset_LoadTransposeMatrixfARB), NAME_FUNC_OFFSET(15607, glMultTransposeMatrixdARB, glMultTransposeMatrixdARB, NULL, _gloffset_MultTransposeMatrixdARB), diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 85c8cf1f54f..cabc3d8a44a 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -820,7 +820,6 @@ _mesa_init_exec_table(struct _glapi_table *exec) /* GL_ATI_separate_stencil */ SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI); - SET_StencilOpSeparateATI(exec, _mesa_StencilOpSeparateATI); } diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index 17464310b1a..c1906197de1 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -180,61 +180,6 @@ _mesa_StencilFuncSeparateATI( GLenum frontfunc, GLenum backfunc, GLint ref, GLui } -void APIENTRY -_mesa_StencilOpSeparateATI(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) -{ - GLboolean set = GL_FALSE; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); - - if (!validate_stencil_op(ctx, sfail)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(sfail)"); - return; - } - if (!validate_stencil_op(ctx, zfail)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(zfail)"); - return; - } - if (!validate_stencil_op(ctx, zpass)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(zpass)"); - return; - } - if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparateATI(face)"); - return; - } - - if (face != GL_BACK) { - /* set front */ - if (ctx->Stencil.ZFailFunc[0] != zfail || - ctx->Stencil.ZPassFunc[0] != zpass || - ctx->Stencil.FailFunc[0] != sfail){ - FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.ZFailFunc[0] = zfail; - ctx->Stencil.ZPassFunc[0] = zpass; - ctx->Stencil.FailFunc[0] = sfail; - set = GL_TRUE; - } - } - if (face != GL_FRONT) { - /* set back */ - if (ctx->Stencil.ZFailFunc[1] != zfail || - ctx->Stencil.ZPassFunc[1] != zpass || - ctx->Stencil.FailFunc[1] != sfail) { - FLUSH_VERTICES(ctx, _NEW_STENCIL); - ctx->Stencil.ZFailFunc[1] = zfail; - ctx->Stencil.ZPassFunc[1] = zpass; - ctx->Stencil.FailFunc[1] = sfail; - set = GL_TRUE; - } - } - if (set && ctx->Driver.StencilOpSeparate) { - ctx->Driver.StencilOpSeparate(ctx, face, sfail, zfail, zpass); - } -} - - - /** * Set the function and reference value for stencil testing. * @@ -444,17 +389,13 @@ _mesa_ActiveStencilFaceEXT(GLenum face) * instead. */ void GLAPIENTRY -_mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +_mesa_StencilOpSeparate(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass) { + GLboolean set = GL_FALSE; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { - _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(face)"); - return; - } - - if (!validate_stencil_op(ctx, fail)) { + if (!validate_stencil_op(ctx, sfail)) { _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(sfail)"); return; } @@ -466,21 +407,37 @@ _mesa_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(zpass)"); return; } - - FLUSH_VERTICES(ctx, _NEW_STENCIL); + if (face != GL_FRONT && face != GL_BACK && face != GL_FRONT_AND_BACK) { + _mesa_error(ctx, GL_INVALID_ENUM, "glStencilOpSeparate(face)"); + return; + } if (face != GL_BACK) { - ctx->Stencil.FailFunc[0] = fail; - ctx->Stencil.ZFailFunc[0] = zfail; - ctx->Stencil.ZPassFunc[0] = zpass; + /* set front */ + if (ctx->Stencil.ZFailFunc[0] != zfail || + ctx->Stencil.ZPassFunc[0] != zpass || + ctx->Stencil.FailFunc[0] != sfail){ + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ZFailFunc[0] = zfail; + ctx->Stencil.ZPassFunc[0] = zpass; + ctx->Stencil.FailFunc[0] = sfail; + set = GL_TRUE; + } } if (face != GL_FRONT) { - ctx->Stencil.FailFunc[1] = fail; - ctx->Stencil.ZFailFunc[1] = zfail; - ctx->Stencil.ZPassFunc[1] = zpass; + /* set back */ + if (ctx->Stencil.ZFailFunc[1] != zfail || + ctx->Stencil.ZPassFunc[1] != zpass || + ctx->Stencil.FailFunc[1] != sfail) { + FLUSH_VERTICES(ctx, _NEW_STENCIL); + ctx->Stencil.ZFailFunc[1] = zfail; + ctx->Stencil.ZPassFunc[1] = zpass; + ctx->Stencil.FailFunc[1] = sfail; + set = GL_TRUE; + } } - if (ctx->Driver.StencilOpSeparate) { - ctx->Driver.StencilOpSeparate(ctx, face, fail, zfail, zpass); + if (set && ctx->Driver.StencilOpSeparate) { + ctx->Driver.StencilOpSeparate(ctx, face, sfail, zfail, zpass); } } diff --git a/src/mesa/main/stencil.h b/src/mesa/main/stencil.h index 15a65dbcac0..252ac932acd 100644 --- a/src/mesa/main/stencil.h +++ b/src/mesa/main/stencil.h @@ -63,9 +63,6 @@ extern void GLAPIENTRY _mesa_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); -extern void APIENTRY -_mesa_StencilOpSeparateATI(GLenum face, GLenum sfail, GLenum zfail, GLenum zpass); - extern void GLAPIENTRY _mesa_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S index 91dc8c17925..b214bef54de 100644 --- a/src/mesa/sparc/glapi_sparc.S +++ b/src/mesa/sparc/glapi_sparc.S @@ -839,7 +839,6 @@ __glapi_sparc_icache_flush: /* %o0 = insn_addr */ .globl gl_dispatch_stub_771 ; .type gl_dispatch_stub_771,#function .globl gl_dispatch_stub_772 ; .type gl_dispatch_stub_772,#function .globl gl_dispatch_stub_773 ; .type gl_dispatch_stub_773,#function - .globl gl_dispatch_stub_774 ; .type gl_dispatch_stub_774,#function .globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function _mesa_sparc_glapi_begin: @@ -1617,7 +1616,6 @@ _mesa_sparc_glapi_begin: GL_STUB(gl_dispatch_stub_771, _gloffset__dispatch_stub_771) GL_STUB(gl_dispatch_stub_772, _gloffset__dispatch_stub_772) GL_STUB(gl_dispatch_stub_773, _gloffset__dispatch_stub_773) - GL_STUB(gl_dispatch_stub_774, _gloffset__dispatch_stub_774) .globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function _mesa_sparc_glapi_end: diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S index 041ced02684..a239a6749d5 100644 --- a/src/mesa/x86-64/glapi_x86-64.S +++ b/src/mesa/x86-64/glapi_x86-64.S @@ -29266,11 +29266,7 @@ GL_PREFIX(_dispatch_stub_772): pushq %rdi pushq %rsi pushq %rdx - pushq %rcx - pushq %rbp call _x86_64_get_dispatch@PLT - popq %rbp - popq %rcx popq %rdx popq %rsi popq %rdi @@ -29286,11 +29282,7 @@ GL_PREFIX(_dispatch_stub_772): pushq %rdi pushq %rsi pushq %rdx - pushq %rcx - pushq %rbp call _glapi_get_dispatch - popq %rbp - popq %rcx popq %rdx popq %rsi popq %rdi @@ -29337,44 +29329,6 @@ GL_PREFIX(_dispatch_stub_773): #endif /* defined(GLX_USE_TLS) */ .size GL_PREFIX(_dispatch_stub_773), .-GL_PREFIX(_dispatch_stub_773) - .p2align 4,,15 - .globl GL_PREFIX(_dispatch_stub_774) - .type GL_PREFIX(_dispatch_stub_774), @function - HIDDEN(GL_PREFIX(_dispatch_stub_774)) -GL_PREFIX(_dispatch_stub_774): -#if defined(GLX_USE_TLS) - call _x86_64_get_dispatch@PLT - movq 6192(%rax), %r11 - jmp *%r11 -#elif defined(PTHREADS) - pushq %rdi - pushq %rsi - pushq %rdx - call _x86_64_get_dispatch@PLT - popq %rdx - popq %rsi - popq %rdi - movq 6192(%rax), %r11 - jmp *%r11 -#else - movq _glapi_Dispatch(%rip), %rax - testq %rax, %rax - je 1f - movq 6192(%rax), %r11 - jmp *%r11 -1: - pushq %rdi - pushq %rsi - pushq %rdx - call _glapi_get_dispatch - popq %rdx - popq %rsi - popq %rdi - movq 6192(%rax), %r11 - jmp *%r11 -#endif /* defined(GLX_USE_TLS) */ - .size GL_PREFIX(_dispatch_stub_774), .-GL_PREFIX(_dispatch_stub_774) - .globl GL_PREFIX(ArrayElementEXT) ; .set GL_PREFIX(ArrayElementEXT), GL_PREFIX(ArrayElement) .globl GL_PREFIX(BindTextureEXT) ; .set GL_PREFIX(BindTextureEXT), GL_PREFIX(BindTexture) .globl GL_PREFIX(DrawArraysEXT) ; .set GL_PREFIX(DrawArraysEXT), GL_PREFIX(DrawArrays) diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index 41b8e0c1d23..0fe625bc9dd 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -950,16 +950,14 @@ GLNAME(gl_dispatch_functions_start): GL_STUB(FramebufferTextureLayerEXT, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) GL_STUB(_dispatch_stub_769, _gloffset_StencilFuncSeparateATI, _dispatch_stub_769@16) HIDDEN(GL_PREFIX(_dispatch_stub_769, _dispatch_stub_769@16)) - GL_STUB(_dispatch_stub_770, _gloffset_StencilOpSeparateATI, _dispatch_stub_770@16) + GL_STUB(_dispatch_stub_770, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_770@16) HIDDEN(GL_PREFIX(_dispatch_stub_770, _dispatch_stub_770@16)) - GL_STUB(_dispatch_stub_771, _gloffset_ProgramEnvParameters4fvEXT, _dispatch_stub_771@16) + GL_STUB(_dispatch_stub_771, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_771@16) HIDDEN(GL_PREFIX(_dispatch_stub_771, _dispatch_stub_771@16)) - GL_STUB(_dispatch_stub_772, _gloffset_ProgramLocalParameters4fvEXT, _dispatch_stub_772@16) - HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@16)) - GL_STUB(_dispatch_stub_773, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_773@12) + GL_STUB(_dispatch_stub_772, _gloffset_GetQueryObjecti64vEXT, _dispatch_stub_772@12) + HIDDEN(GL_PREFIX(_dispatch_stub_772, _dispatch_stub_772@12)) + GL_STUB(_dispatch_stub_773, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_773@12) HIDDEN(GL_PREFIX(_dispatch_stub_773, _dispatch_stub_773@12)) - GL_STUB(_dispatch_stub_774, _gloffset_GetQueryObjectui64vEXT, _dispatch_stub_774@12) - HIDDEN(GL_PREFIX(_dispatch_stub_774, _dispatch_stub_774@12)) GL_STUB_ALIAS(ArrayElementEXT, _gloffset_ArrayElement, ArrayElementEXT@4, ArrayElement, ArrayElement@4) GL_STUB_ALIAS(BindTextureEXT, _gloffset_BindTexture, BindTextureEXT@8, BindTexture, BindTexture@8) GL_STUB_ALIAS(DrawArraysEXT, _gloffset_DrawArrays, DrawArraysEXT@12, DrawArrays, DrawArrays@12) @@ -1091,6 +1089,7 @@ GLNAME(gl_dispatch_functions_start): GL_STUB_ALIAS(MultiTexCoord4iv, _gloffset_MultiTexCoord4ivARB, MultiTexCoord4iv@8, MultiTexCoord4ivARB, MultiTexCoord4ivARB@8) GL_STUB_ALIAS(MultiTexCoord4s, _gloffset_MultiTexCoord4sARB, MultiTexCoord4s@20, MultiTexCoord4sARB, MultiTexCoord4sARB@20) GL_STUB_ALIAS(MultiTexCoord4sv, _gloffset_MultiTexCoord4svARB, MultiTexCoord4sv@8, MultiTexCoord4svARB, MultiTexCoord4svARB@8) + GL_STUB_ALIAS(StencilOpSeparateATI, _gloffset_StencilOpSeparate, StencilOpSeparateATI@16, StencilOpSeparate, StencilOpSeparate@16) GL_STUB_ALIAS(LoadTransposeMatrixd, _gloffset_LoadTransposeMatrixdARB, LoadTransposeMatrixd@4, LoadTransposeMatrixdARB, LoadTransposeMatrixdARB@4) GL_STUB_ALIAS(LoadTransposeMatrixf, _gloffset_LoadTransposeMatrixfARB, LoadTransposeMatrixf@4, LoadTransposeMatrixfARB, LoadTransposeMatrixfARB@4) GL_STUB_ALIAS(MultTransposeMatrixd, _gloffset_MultTransposeMatrixdARB, MultTransposeMatrixd@4, MultTransposeMatrixdARB, MultTransposeMatrixdARB@4) -- cgit v1.2.3 From d2f19a554a9089fddb5e978e3a732bbf71d77f93 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Tue, 30 Oct 2007 17:47:17 +0100 Subject: Fix some build warnings, mostly with XCB. --- src/glx/x11/glxext.c | 3 +- src/glx/x11/indirect.c | 101 ++++++++++++++++++++++++++++++++++++++- src/mesa/glapi/glX_proto_send.py | 14 ++++-- 3 files changed, 111 insertions(+), 7 deletions(-) (limited to 'src/mesa') diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c index 4b78ca85c68..4fcf6e5df07 100644 --- a/src/glx/x11/glxext.c +++ b/src/glx/x11/glxext.c @@ -1361,7 +1361,8 @@ GLubyte *__glXFlushRenderBuffer(__GLXcontext *ctx, GLubyte *pc) if ( (dpy != NULL) && (size > 0) ) { #ifdef USE_XCB - xcb_glx_render(c, ctx->currentContextTag, size, (char *)ctx->buf); + xcb_glx_render(c, ctx->currentContextTag, size, + (const uint8_t *)ctx->buf); #else /* Send the entire buffer as an X request */ LockDisplay(dpy); diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index 87c523383b5..0d66296ab9e 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -300,7 +300,9 @@ __indirect_glNewList(GLuint list, GLenum mode) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -324,7 +326,9 @@ __indirect_glEndList(void) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 0; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -393,7 +397,9 @@ __indirect_glDeleteLists(GLuint list, GLsizei range) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -418,7 +424,9 @@ __indirect_glGenLists(GLsizei range) __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLuint retval = (GLuint) 0; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -3716,7 +3724,9 @@ __indirect_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 28; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -3808,7 +3818,9 @@ __indirect_glGetClipPlane(GLenum plane, GLdouble * equation) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -3841,7 +3853,9 @@ __indirect_glGetLightfv(GLenum light, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -3879,7 +3893,9 @@ __indirect_glGetLightiv(GLenum light, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -3917,7 +3933,9 @@ __indirect_glGetMapdv(GLenum target, GLenum query, GLdouble * v) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -3953,7 +3971,9 @@ __indirect_glGetMapfv(GLenum target, GLenum query, GLfloat * v) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -3989,7 +4009,9 @@ __indirect_glGetMapiv(GLenum target, GLenum query, GLint * v) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4025,7 +4047,9 @@ __indirect_glGetMaterialfv(GLenum face, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4063,7 +4087,9 @@ __indirect_glGetMaterialiv(GLenum face, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4101,7 +4127,9 @@ __indirect_glGetPixelMapfv(GLenum map, GLfloat * values) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4137,7 +4165,9 @@ __indirect_glGetPixelMapuiv(GLenum map, GLuint * values) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4174,7 +4204,9 @@ __indirect_glGetPixelMapusv(GLenum map, GLushort * values) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4210,9 +4242,10 @@ void __indirect_glGetPolygonStipple(GLubyte *mask) { __GLXcontext *const gc = __glXGetCurrentContext(); - const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4247,7 +4280,9 @@ __indirect_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4285,7 +4320,9 @@ __indirect_glGetTexEnviv(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4323,7 +4360,9 @@ __indirect_glGetTexGendv(GLenum coord, GLenum pname, GLdouble * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4361,7 +4400,9 @@ __indirect_glGetTexGenfv(GLenum coord, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4399,7 +4440,9 @@ __indirect_glGetTexGeniv(GLenum coord, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4439,7 +4482,9 @@ __indirect_glGetTexImage(GLenum target, GLint level, GLenum format, __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 20; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4483,7 +4528,9 @@ __indirect_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4522,7 +4569,9 @@ __indirect_glGetTexParameteriv(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4562,7 +4611,9 @@ __indirect_glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 12; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4603,7 +4654,9 @@ __indirect_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 12; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -4644,7 +4697,9 @@ __indirect_glIsList(GLuint list) __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLboolean retval = (GLboolean) 0; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -5012,7 +5067,9 @@ __indirect_glAreTexturesResident(GLsizei n, const GLuint * textures, __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLboolean retval = (GLboolean) 0; +#ifndef USE_XCB const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); +#endif if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -5163,7 +5220,9 @@ __indirect_glDeleteTextures(GLsizei n, const GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); +#endif if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -5212,7 +5271,9 @@ __indirect_glGenTextures(GLsizei n, GLuint * textures) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -5271,7 +5332,9 @@ __indirect_glIsTexture(GLuint texture) __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLboolean retval = (GLboolean) 0; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -5565,7 +5628,9 @@ __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type, __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 16; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -5641,7 +5706,9 @@ __indirect_glGetColorTableParameterfv(GLenum target, GLenum pname, { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -5709,7 +5776,9 @@ __indirect_glGetColorTableParameteriv(GLenum target, GLenum pname, { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -6029,7 +6098,9 @@ __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type, __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 16; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -6103,7 +6174,9 @@ __indirect_glGetConvolutionParameterfv(GLenum target, GLenum pname, { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -6171,7 +6244,9 @@ __indirect_glGetConvolutionParameteriv(GLenum target, GLenum pname, { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -6240,7 +6315,9 @@ __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format, __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 16; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -6319,7 +6396,9 @@ __indirect_glGetHistogramParameterfv(GLenum target, GLenum pname, { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -6385,7 +6464,9 @@ __indirect_glGetHistogramParameteriv(GLenum target, GLenum pname, { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -6452,7 +6533,9 @@ __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format, __GLXcontext *const gc = __glXGetCurrentContext(); const __GLXattribute *const state = gc->client_state_private; Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 16; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -6526,7 +6609,9 @@ __indirect_glGetMinmaxParameterfv(GLenum target, GLenum pname, { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -6589,7 +6674,9 @@ __indirect_glGetMinmaxParameteriv(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -8240,7 +8327,9 @@ __indirect_glDeleteQueriesARB(GLsizei n, const GLuint * ids) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 4 + __GLX_PAD((n * 4)); +#endif if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -8278,7 +8367,9 @@ __indirect_glGenQueriesARB(GLsizei n, GLuint * ids) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -8311,7 +8402,9 @@ __indirect_glGetQueryObjectivARB(GLuint id, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -8347,7 +8440,9 @@ __indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -8383,7 +8478,9 @@ __indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params) { __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; +#ifndef USE_XCB const GLuint cmdlen = 8; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); @@ -8423,7 +8520,9 @@ __indirect_glIsQueryARB(GLuint id) __GLXcontext *const gc = __glXGetCurrentContext(); Display *const dpy = gc->currentDpy; GLboolean retval = (GLboolean) 0; +#ifndef USE_XCB const GLuint cmdlen = 4; +#endif if (__builtin_expect(dpy != NULL, 1)) { #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py index 1b6a5f3890c..0fa0f7e8706 100644 --- a/src/mesa/glapi/glX_proto_send.py +++ b/src/mesa/glapi/glX_proto_send.py @@ -511,7 +511,7 @@ generic_%u_byte( GLint rop, const void * ptr ) return - def common_func_print_just_start(self, f): + def common_func_print_just_start(self, f, name): print ' __GLXcontext * const gc = __glXGetCurrentContext();' # The only reason that single and vendor private commands need @@ -529,7 +529,7 @@ generic_%u_byte( GLint rop, const void * ptr ) if not f.glx_rop: for p in f.parameterIterateOutputs(): - if p.is_image(): + if p.is_image() and (p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP"): print ' const __GLXattribute * const state = gc->client_state_private;' break @@ -545,7 +545,11 @@ generic_%u_byte( GLint rop, const void * ptr ) print ' %s retval = (%s) 0;' % (f.return_type, f.return_type) + if name != None and name not in f.glx_vendorpriv_names: + print '#ifndef USE_XCB' self.emit_packet_size_calculation(f, 0) + if name != None and name not in f.glx_vendorpriv_names: + print '#endif' condition_list = [] for p in f.parameterIterateCounters(): @@ -567,7 +571,7 @@ generic_%u_byte( GLint rop, const void * ptr ) def printSingleFunction(self, f, name): - self.common_func_print_just_start(f) + self.common_func_print_just_start(f, name) if self.debug: print ' printf( "Enter %%s...\\n", "gl%s" );' % (f.name) @@ -739,7 +743,7 @@ generic_%u_byte( GLint rop, const void * ptr ) return - if self.common_func_print_just_start(f): + if self.common_func_print_just_start(f, None): trailer = " }" else: trailer = None @@ -791,7 +795,7 @@ generic_%u_byte( GLint rop, const void * ptr ) print ' generic_%u_byte( %s, %s );' % (cmdlen, f.opcode_real_name(), p.name) return - if self.common_func_print_just_start(f): + if self.common_func_print_just_start(f, None): trailer = " }" else: trailer = None -- cgit v1.2.3