From 0c2b3e6fd26158cb97f4210cc891e218801b4b25 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 8 Aug 2011 13:41:53 +0200 Subject: mesa xkeyboard-config git update 8 aug 2011 --- mesalib/src/mesa/main/mtypes.h | 2 - mesalib/src/mesa/main/shaderapi.c | 2 +- mesalib/src/mesa/program/ir_to_mesa.cpp | 37 ++++--- mesalib/src/mesa/program/prog_optimize.c | 8 +- mesalib/src/mesa/state_tracker/st_cb_blit.c | 4 +- mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 41 +++++--- xorg-server/xkeyboard-config/rules/base.o_s.part | 9 +- xorg-server/xkeyboard-config/rules/base.xml.in | 20 ++-- xorg-server/xkeyboard-config/symbols/ctrl | 106 +++++++++++---------- 9 files changed, 136 insertions(+), 93 deletions(-) diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index b88118366..2d5f44c1e 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2252,8 +2252,6 @@ struct gl_shader_state */ struct gl_shader_program *ActiveProgram; - void *MemPool; - GLbitfield Flags; /**< Mask of GLSL_x flags */ }; diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 8df25c3f9..74997eaaa 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -1125,7 +1125,7 @@ static void validate_program(struct gl_context *ctx, GLuint program) { struct gl_shader_program *shProg; - char errMsg[100]; + char errMsg[100] = ""; shProg = _mesa_lookup_shader_program_err(ctx, program, "glValidateProgram"); if (!shProg) { diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index debadb9a3..1ef609fe1 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -641,8 +641,6 @@ src_reg ir_to_mesa_visitor::get_temp(const glsl_type *type) { src_reg src; - int swizzle[4]; - int i; src.file = PROGRAM_TEMPORARY; src.index = next_temp; @@ -652,12 +650,7 @@ ir_to_mesa_visitor::get_temp(const glsl_type *type) if (type->is_array() || type->is_record()) { src.swizzle = SWIZZLE_NOOP; } else { - for (i = 0; i < type->vector_elements; i++) - swizzle[i] = i; - for (; i < 4; i++) - swizzle[i] = type->vector_elements - 1; - src.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], - swizzle[2], swizzle[3]); + src.swizzle = swizzle_for_size(type->vector_elements); } src.negate = 0; @@ -915,10 +908,30 @@ ir_to_mesa_visitor::try_emit_sat(ir_expression *ir) sat_src->accept(this); src_reg src = this->result; - this->result = get_temp(ir->type); - ir_to_mesa_instruction *inst; - inst = emit(ir, OPCODE_MOV, dst_reg(this->result), src); - inst->saturate = true; + /* If we generated an expression instruction into a temporary in + * processing the saturate's operand, apply the saturate to that + * instruction. Otherwise, generate a MOV to do the saturate. + * + * Note that we have to be careful to only do this optimization if + * the instruction in question was what generated src->result. For + * example, ir_dereference_array might generate a MUL instruction + * to create the reladdr, and return us a src reg using that + * reladdr. That MUL result is not the value we're trying to + * saturate. + */ + ir_expression *sat_src_expr = sat_src->as_expression(); + ir_to_mesa_instruction *new_inst; + new_inst = (ir_to_mesa_instruction *)this->instructions.get_tail(); + if (sat_src_expr && (sat_src_expr->operation == ir_binop_mul || + sat_src_expr->operation == ir_binop_add || + sat_src_expr->operation == ir_binop_dot)) { + new_inst->saturate = true; + } else { + this->result = get_temp(ir->type); + ir_to_mesa_instruction *inst; + inst = emit(ir, OPCODE_MOV, dst_reg(this->result), src); + inst->saturate = true; + } return true; } diff --git a/mesalib/src/mesa/program/prog_optimize.c b/mesalib/src/mesa/program/prog_optimize.c index f4a7a638d..3340ce049 100644 --- a/mesalib/src/mesa/program/prog_optimize.c +++ b/mesalib/src/mesa/program/prog_optimize.c @@ -472,8 +472,7 @@ can_downward_mov_be_modifed(const struct prog_instruction *mov) mov->SrcReg[0].HasIndex2 == 0 && mov->SrcReg[0].RelAddr2 == 0 && mov->DstReg.RelAddr == 0 && - mov->DstReg.CondMask == COND_TR && - mov->SaturateMode == SATURATE_OFF; + mov->DstReg.CondMask == COND_TR; } @@ -482,7 +481,8 @@ can_upward_mov_be_modifed(const struct prog_instruction *mov) { return can_downward_mov_be_modifed(mov) && - mov->DstReg.File == PROGRAM_TEMPORARY; + mov->DstReg.File == PROGRAM_TEMPORARY && + mov->SaturateMode == SATURATE_OFF; } @@ -657,6 +657,8 @@ _mesa_merge_mov_into_inst(struct prog_instruction *inst, if (mask != (inst->DstReg.WriteMask & mask)) return GL_FALSE; + inst->SaturateMode |= mov->SaturateMode; + /* Depending on the instruction, we may need to recompute the swizzles. * Also, some other instructions (like TEX) are not linear. We will only * consider completely active sources and destinations diff --git a/mesalib/src/mesa/state_tracker/st_cb_blit.c b/mesalib/src/mesa/state_tracker/st_cb_blit.c index 626db1243..750f541b5 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_blit.c +++ b/mesalib/src/mesa/state_tracker/st_cb_blit.c @@ -107,8 +107,10 @@ st_BlitFramebuffer_resolve(struct gl_context *ctx, dstRb = st_renderbuffer(dstDepth->Renderbuffer); info->mask = (mask & GL_DEPTH_BUFFER_BIT) ? PIPE_MASK_Z : 0; - if (combined && (mask & GL_STENCIL_BUFFER_BIT)) + if (combined && (mask & GL_STENCIL_BUFFER_BIT)) { + mask &= ~GL_STENCIL_BUFFER_BIT; info->mask |= PIPE_MASK_S; + } info->src.res = srcRb->texture; info->src.layer = srcRb->surface->u.tex.first_layer; diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 460bafb38..d7a1ba80e 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -949,8 +949,6 @@ st_src_reg glsl_to_tgsi_visitor::get_temp(const glsl_type *type) { st_src_reg src; - int swizzle[4]; - int i; src.type = glsl_version >= 130 ? type->base_type : GLSL_TYPE_FLOAT; src.file = PROGRAM_TEMPORARY; @@ -961,12 +959,7 @@ glsl_to_tgsi_visitor::get_temp(const glsl_type *type) if (type->is_array() || type->is_record()) { src.swizzle = SWIZZLE_NOOP; } else { - for (i = 0; i < type->vector_elements; i++) - swizzle[i] = i; - for (; i < 4; i++) - swizzle[i] = type->vector_elements - 1; - src.swizzle = MAKE_SWIZZLE4(swizzle[0], swizzle[1], - swizzle[2], swizzle[3]); + src.swizzle = swizzle_for_size(type->vector_elements); } src.negate = 0; @@ -1232,12 +1225,32 @@ glsl_to_tgsi_visitor::try_emit_sat(ir_expression *ir) sat_src->accept(this); st_src_reg src = this->result; - this->result = get_temp(ir->type); - st_dst_reg result_dst = st_dst_reg(this->result); - result_dst.writemask = (1 << ir->type->vector_elements) - 1; - glsl_to_tgsi_instruction *inst; - inst = emit(ir, TGSI_OPCODE_MOV, result_dst, src); - inst->saturate = true; + /* If we generated an expression instruction into a temporary in + * processing the saturate's operand, apply the saturate to that + * instruction. Otherwise, generate a MOV to do the saturate. + * + * Note that we have to be careful to only do this optimization if + * the instruction in question was what generated src->result. For + * example, ir_dereference_array might generate a MUL instruction + * to create the reladdr, and return us a src reg using that + * reladdr. That MUL result is not the value we're trying to + * saturate. + */ + ir_expression *sat_src_expr = sat_src->as_expression(); + if (sat_src_expr && (sat_src_expr->operation == ir_binop_mul || + sat_src_expr->operation == ir_binop_add || + sat_src_expr->operation == ir_binop_dot)) { + glsl_to_tgsi_instruction *new_inst; + new_inst = (glsl_to_tgsi_instruction *)this->instructions.get_tail(); + new_inst->saturate = true; + } else { + this->result = get_temp(ir->type); + st_dst_reg result_dst = st_dst_reg(this->result); + result_dst.writemask = (1 << ir->type->vector_elements) - 1; + glsl_to_tgsi_instruction *inst; + inst = emit(ir, TGSI_OPCODE_MOV, result_dst, src); + inst->saturate = true; + } return true; } diff --git a/xorg-server/xkeyboard-config/rules/base.o_s.part b/xorg-server/xkeyboard-config/rules/base.o_s.part index 3e23396da..6cf9f1406 100644 --- a/xorg-server/xkeyboard-config/rules/base.o_s.part +++ b/xorg-server/xkeyboard-config/rules/base.o_s.part @@ -64,10 +64,11 @@ ctrl:nocaps = +ctrl(nocaps) ctrl:lctrl_meta = +ctrl(lctrl_meta) ctrl:swapcaps = +ctrl(swapcaps) - ctrl:ctrl_ac = +ctrl(ctrl_ac) - ctrl:ctrl_aa = +ctrl(ctrl_aa) - ctrl:ctrl_ra = +ctrl(ctrl_ra) - ctrl:ctrl_menu = +ctrl(ctrl_menu) + ctrl:ac_ctrl = +ctrl(ac_ctrl) + ctrl:aa_ctrl = +ctrl(aa_ctrl) + ctrl:rctrl_ralt = +ctrl(rctrl_ralt) + ctrl:menu_rctrl = +ctrl(menu_rctrl) + ctrl:ralt_rctrl = +ctrl(ralt_rctrl) compose:ralt = +compose(ralt) compose:lwin = +compose(lwin) compose:rwin = +compose(rwin) diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in index b56551a67..062fe1d72 100644 --- a/xorg-server/xkeyboard-config/rules/base.xml.in +++ b/xorg-server/xkeyboard-config/rules/base.xml.in @@ -5602,13 +5602,13 @@ + diff --git a/xorg-server/xkeyboard-config/symbols/ctrl b/xorg-server/xkeyboard-config/symbols/ctrl index 189ce739b..09d76b551 100644 --- a/xorg-server/xkeyboard-config/symbols/ctrl +++ b/xorg-server/xkeyboard-config/symbols/ctrl @@ -1,49 +1,57 @@ -// eliminate the caps lock key completely (replace with control) -partial modifier_keys -xkb_symbols "nocaps" { - replace key { [ Control_L, Control_L ] }; - modifier_map Control { , }; -}; - -// replace left control with Meta -xkb_symbols "lctrl_meta" { - replace key { [ Meta_L ] }; -}; - -// swap the caps lock key with the left control key -partial modifier_keys -xkb_symbols "swapcaps" { - replace key { [ Control_L ] }; - replace key { [ Caps_Lock ] }; -}; - -// moves the control key to the middle row and the caps lock -// to the bottom row. Only works if the geometry or keycodes -// file has defined appropriate aliases for the keys in question. -partial modifier_keys -xkb_symbols "ctrl_ac" { - replace key { [ Control_L ] }; - replace key { [ Caps_Lock ] }; -}; - -// Moves the control key to the bottom row and the caps lock -// to the middle row. Only works if the geometry or keycodes -// file has defined appropriate aliases for the keys in question. -partial modifier_keys -xkb_symbols "ctrl_aa" { - replace key { [ Control_L ] }; - replace key { [ Caps_Lock ] }; -}; - -// Right Ctrl works as Right Alt -partial modifier_keys -xkb_symbols "ctrl_ra" { - key { symbols[Group1]= [ Alt_R ] }; -}; - -// Menu works as Right Ctrl -partial modifier_keys -xkb_symbols "ctrl_menu" { - replace key { [ Control_R, Control_R ] }; - modifier_map Control { Control_L, }; -}; +// eliminate the caps lock key completely (replace with control) +partial modifier_keys +xkb_symbols "nocaps" { + replace key { [ Control_L, Control_L ] }; + modifier_map Control { , }; +}; + +// replace left control with Meta +xkb_symbols "lctrl_meta" { + replace key { [ Meta_L ] }; +}; + +// swap the caps lock key with the left control key +partial modifier_keys +xkb_symbols "swapcaps" { + replace key { [ Control_L ] }; + replace key { [ Caps_Lock ] }; +}; + +// moves the control key to the middle row and the caps lock +// to the bottom row. Only works if the geometry or keycodes +// file has defined appropriate aliases for the keys in question. +partial modifier_keys +xkb_symbols "ac_ctrl" { + replace key { [ Control_L ] }; + replace key { [ Caps_Lock ] }; +}; + +// Moves the control key to the bottom row and the caps lock +// to the middle row. Only works if the geometry or keycodes +// file has defined appropriate aliases for the keys in question. +partial modifier_keys +xkb_symbols "aa_ctrl" { + replace key { [ Control_L ] }; + replace key { [ Caps_Lock ] }; +}; + +// Right Ctrl works as Right Alt +partial modifier_keys +xkb_symbols "rctrl_ralt" { + key { symbols[Group1]= [ Alt_R ] }; +}; + +// Menu works as Right Ctrl +partial modifier_keys +xkb_symbols "menu_rctrl" { + replace key { [ Control_R, Control_R ] }; + modifier_map Control { Control_L, }; +}; + +// right alt functions as another ctrl key +partial modifier_keys +xkb_symbols "ralt_rctrl" { + replace key { type[Group1] = "TWO_LEVEL", + symbols[Group1] = [ Control_R, Control_R ] }; + modifier_map Control { }; +}; -- cgit v1.2.3