Mesa (master): r300g: decide whether a flush should be asynchronous when calling it
Module: Mesa Branch: master Commit: 5650a719f0c69c00954e47bd7a7b3e9433cb551d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5650a719f0c69c00954e47bd7a7b3e9433cb551d Author: Marek Olšák Date: Tue Mar 8 08:20:31 2011 +0100 r300g: decide whether a flush should be asynchronous when calling it Thread offloading is not sometimes desirable, e.g. when mapping a buffer. --- src/gallium/drivers/r300/r300_blit.c |2 +- src/gallium/drivers/r300/r300_context.c |6 +++--- src/gallium/drivers/r300/r300_context.h |7 +-- src/gallium/drivers/r300/r300_emit.c |2 +- src/gallium/drivers/r300/r300_flush.c | 25 +++-- src/gallium/drivers/r300/r300_render.c|2 +- src/gallium/drivers/r300/r300_transfer.c | 18 +++--- src/gallium/drivers/r300/r300_winsys.h| 13 - src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 11 +++ src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 17 - src/gallium/winsys/radeon/drm/radeon_drm_cs.h |5 ++--- 11 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index 6391ea7..6682b2b 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -263,7 +263,7 @@ static void r300_clear(struct pipe_context* pipe, /* Reserve CS space. */ if (dwords > (R300_MAX_CMDBUF_DWORDS - r300->cs->cdw)) { -r300->context.flush(&r300->context, 0, NULL); +r300_flush(&r300->context, R300_FLUSH_ASYNC, NULL); } /* Emit clear packets. */ diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 48a5959..720d666 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -139,11 +139,11 @@ static void r300_destroy_context(struct pipe_context* context) FREE(r300); } -void r300_flush_cb(void *data) +static void r300_flush_callback(void *data, unsigned flags) { struct r300_context* const cs_context_copy = data; -cs_context_copy->context.flush(&cs_context_copy->context, 0, NULL); +r300_flush(&cs_context_copy->context, flags, NULL); } #define R300_INIT_ATOM(atomname, atomsize) \ @@ -453,7 +453,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300_init_render_functions(r300); r300_init_states(&r300->context); -rws->cs_set_flush(r300->cs, r300_flush_cb, r300); +rws->cs_set_flush(r300->cs, r300_flush_callback, r300); /* The KIL opcode needs the first texture unit to be enabled * on r3xx-r4xx. In order to calm down the CS checker, we bind this diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 1e28221..76ea5ee 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -665,8 +665,6 @@ static INLINE void r300_mark_atom_dirty(struct r300_context *r300, struct pipe_context* r300_create_context(struct pipe_screen* screen, void *priv); -void r300_flush_cb(void *data); - /* Context initialization. */ struct draw_stage* r300_draw_stage(struct r300_context* r300); void r300_init_blit_functions(struct r300_context *r300); @@ -681,6 +679,11 @@ void r300_decompress_zmask(struct r300_context *r300); void r300_decompress_zmask_locked_unsafe(struct r300_context *r300); void r300_decompress_zmask_locked(struct r300_context *r300); +/* r300_flush.c */ +void r300_flush(struct pipe_context *pipe, +unsigned flags, +struct pipe_fence_handle **fence); + /* r300_hyperz.c */ void r300_update_hyperz_state(struct r300_context* r300); diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 60f8305..b28be93 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -1218,7 +1218,7 @@ validate: if (flushed) return FALSE; -r300->context.flush(&r300->context, 0, NULL); +r300_flush(&r300->context, R300_FLUSH_ASYNC, NULL); flushed = TRUE; goto validate; } diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index 9c41a13..fa09268 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -31,9 +31,10 @@ #include "r300_cs.h" #include "r300_emit.h" -static void r300_flush(struct pipe_context* pipe, - unsigned flags, - struct pipe_fence_handle** fence) + +void r300_flush(struct pipe_context *pipe, +unsigned flags, +struct pipe_fence_handle **fence) { struct r300_context *r300 = r300_context(pipe); struct r300_atom *atom; @@ -61,7 +62,7 @@ static void r300_flus
Mesa (master): r300g: use pipelined transfers for RGTC textures
Module: Mesa Branch: master Commit: 6051f26b78917d430e7f4eb9b92b20de17aea4cc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6051f26b78917d430e7f4eb9b92b20de17aea4cc Author: Marek Olšák Date: Tue Mar 8 08:17:12 2011 +0100 r300g: use pipelined transfers for RGTC textures --- src/gallium/drivers/r300/r300_transfer.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c index 30de9ec..0b73162 100644 --- a/src/gallium/drivers/r300/r300_transfer.c +++ b/src/gallium/drivers/r300/r300_transfer.c @@ -100,7 +100,8 @@ r300_texture_get_transfer(struct pipe_context *ctx, } blittable = desc->layout == UTIL_FORMAT_LAYOUT_PLAIN || -desc->layout == UTIL_FORMAT_LAYOUT_S3TC; +desc->layout == UTIL_FORMAT_LAYOUT_S3TC || +desc->layout == UTIL_FORMAT_LAYOUT_RGTC; trans = CALLOC_STRUCT(r300_transfer); if (trans) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300/compiler: fix equal and notequal shadow compare functions
Module: Mesa Branch: master Commit: 4dfcf3c4fe6edd1785348f4f6fc1ef0af2fff6f6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4dfcf3c4fe6edd1785348f4f6fc1ef0af2fff6f6 Author: Marek Olšák Date: Tue Mar 8 07:36:40 2011 +0100 r300/compiler: fix equal and notequal shadow compare functions --- .../drivers/dri/r300/compiler/radeon_program_tex.c | 34 +-- 1 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index a58ef06..33f9b06 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -33,14 +33,14 @@ /* Series of transformations to be done on textures. */ static struct rc_src_register shadow_ambient(struct r300_fragment_program_compiler *compiler, - int tmu) +int tmu) { struct rc_src_register reg = { 0, }; if (compiler->enable_shadow_ambient) { reg.File = RC_FILE_CONSTANT; reg.Index = rc_constants_add_state(&compiler->Base.Program.Constants, - RC_STATE_SHADOW_AMBIENT, tmu); + RC_STATE_SHADOW_AMBIENT, tmu); reg.Swizzle = RC_SWIZZLE_; } else { reg.File = RC_FILE_NONE; @@ -137,13 +137,6 @@ int radeonTransformTEX( (compiler->state.unit[inst->U.I.TexSrcUnit].compare_mode_enabled))) { rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; - /* Fake EQUAL/NOTEQUAL, they are equal to NEVER/ALWAYS due to precision issues anyway. */ - if (comparefunc == RC_COMPARE_FUNC_EQUAL) { - comparefunc = RC_COMPARE_FUNC_NEVER; - } else if (comparefunc == RC_COMPARE_FUNC_NOTEQUAL) { - comparefunc = RC_COMPARE_FUNC_ALWAYS; - } - if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) { inst->U.I.Opcode = RC_OPCODE_MOV; @@ -157,7 +150,7 @@ int radeonTransformTEX( return 1; } else { struct rc_instruction * inst_rcp = NULL; - struct rc_instruction *inst_mul, *inst_cmp, *inst_add; + struct rc_instruction *inst_mul, *inst_add, *inst_cmp, *inst_cmp2, *inst_mul2; unsigned tmp_texsample; unsigned tmp_sum; int pass, fail; @@ -212,22 +205,27 @@ int radeonTransformTEX( inst_add->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_; inst_add->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; inst_add->U.I.SrcReg[1].Index = tmp_texsample; - inst_add->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_; + inst_add->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_; - /* Recall that SrcReg[0] is r, SrcReg[tex] is tex and: + /* Note that SrcReg[0] is r, SrcReg[1] is tex and: * LESS:r < tex <=> -tex+r < 0 * GEQUAL: r >= tex <=> not (-tex+r < 0) * GREATER: r > tex <=> tex-r < 0 * LEQUAL: r <= tex <=> not ( tex-r < 0) -* -* This negates either r or tex: */ - if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GEQUAL) +* EQUAL: GEQUAL +* NOTEQUAL:LESS +*/ + + /* This negates either r or tex: */ + if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GEQUAL || + comparefunc == RC_COMPARE_FUNC_EQUAL || comparefunc == RC_COMPARE_FUNC_NOTEQUAL) inst_add->U.I.SrcReg[1].Negate = inst_add->U.I.SrcReg[1].Negate ^ RC_MASK_XYZW; else inst_add->U.I.SrcReg[0].Negate = inst_add->U.I.SrcReg[0].Negate ^ RC_MASK_XYZW; /* This negates the whole expresion: */ - if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GREATER) { + if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GREATER || + comparefunc == RC_COMPARE_FUNC_NOTEQUAL) { pass = 1; fail = 2;
Mesa (master): r300/compiler: detect constants harder
Module: Mesa Branch: master Commit: 94818d4c6ac6585f6b036f9a8bf550f73b7ae4b4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=94818d4c6ac6585f6b036f9a8bf550f73b7ae4b4 Author: Marek Olšák Date: Tue Mar 8 06:54:14 2011 +0100 r300/compiler: detect constants harder --- .../drivers/dri/r300/compiler/radeon_optimize.c| 12 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c index 3915cb4..c4e6a5e 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c @@ -311,14 +311,18 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction * struct rc_constant * constant; struct rc_src_register newsrc; int have_real_reference; + unsigned int chan; - if (inst->U.I.SrcReg[src].Swizzle == RC_SWIZZLE_ || - inst->U.I.SrcReg[src].Swizzle == RC_SWIZZLE_ || - inst->U.I.SrcReg[src].Swizzle == RC_SWIZZLE_) { + /* If there are only 0, 0.5, 1, or _ swizzles, mark the source as a constant. */ + for (chan = 0; chan < 4; ++chan) + if (GET_SWZ(inst->U.I.SrcReg[src].Swizzle, chan) <= 3) + break; + if (chan == 4) { inst->U.I.SrcReg[src].File = RC_FILE_NONE; continue; } + /* Convert immediates to swizzles. */ if (inst->U.I.SrcReg[src].File != RC_FILE_CONSTANT || inst->U.I.SrcReg[src].RelAddr || inst->U.I.SrcReg[src].Index >= c->Program.Constants.Count) @@ -332,7 +336,7 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction * newsrc = inst->U.I.SrcReg[src]; have_real_reference = 0; - for(unsigned int chan = 0; chan < 4; ++chan) { + for (chan = 0; chan < 4; ++chan) { unsigned int swz = GET_SWZ(newsrc.Swizzle, chan); unsigned int newswz; float imm; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300/compiler: improve the detection of constants for constant folding
Module: Mesa Branch: master Commit: 4f3826117957b5ac1554b833af33d342360f655a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f3826117957b5ac1554b833af33d342360f655a Author: Marek Olšák Date: Tue Mar 8 06:37:50 2011 +0100 r300/compiler: improve the detection of constants for constant folding Now the expression V==0 generates one instruction instead of two. --- .../drivers/dri/r300/compiler/radeon_optimize.c|7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c index 5caff91..3915cb4 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c @@ -312,6 +312,13 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction * struct rc_src_register newsrc; int have_real_reference; + if (inst->U.I.SrcReg[src].Swizzle == RC_SWIZZLE_ || + inst->U.I.SrcReg[src].Swizzle == RC_SWIZZLE_ || + inst->U.I.SrcReg[src].Swizzle == RC_SWIZZLE_) { + inst->U.I.SrcReg[src].File = RC_FILE_NONE; + continue; + } + if (inst->U.I.SrcReg[src].File != RC_FILE_CONSTANT || inst->U.I.SrcReg[src].RelAddr || inst->U.I.SrcReg[src].Index >= c->Program.Constants.Count) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300/compiler: saturate Z before the shadow comparison
Module: Mesa Branch: master Commit: eb1acd16130a2945122d373357ee72585e520755 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eb1acd16130a2945122d373357ee72585e520755 Author: Marek Olšák Date: Tue Mar 8 04:00:07 2011 +0100 r300/compiler: saturate Z before the shadow comparison This fixes: https://bugs.freedesktop.org/show_bug.cgi?id=31159 NOTE: This is a candidate for the 7.9 and 7.10 branches. --- .../drivers/dri/r300/compiler/radeon_program_tex.c | 81 +++- 1 files changed, 44 insertions(+), 37 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index f9d9f34..a58ef06 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -137,6 +137,13 @@ int radeonTransformTEX( (compiler->state.unit[inst->U.I.TexSrcUnit].compare_mode_enabled))) { rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; + /* Fake EQUAL/NOTEQUAL, they are equal to NEVER/ALWAYS due to precision issues anyway. */ + if (comparefunc == RC_COMPARE_FUNC_EQUAL) { + comparefunc = RC_COMPARE_FUNC_NEVER; + } else if (comparefunc == RC_COMPARE_FUNC_NOTEQUAL) { + comparefunc = RC_COMPARE_FUNC_ALWAYS; + } + if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) { inst->U.I.Opcode = RC_OPCODE_MOV; @@ -149,14 +156,11 @@ int radeonTransformTEX( return 1; } else { - rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; struct rc_instruction * inst_rcp = NULL; - struct rc_instruction * inst_mad; - struct rc_instruction * inst_cmp; + struct rc_instruction *inst_mul, *inst_cmp, *inst_add; unsigned tmp_texsample; unsigned tmp_sum; - unsigned tmp_recip_w = 0; - int pass, fail, tex; + int pass, fail; /* Save the output register. */ struct rc_dst_register output_reg = inst->U.I.DstReg; @@ -167,49 +171,49 @@ int radeonTransformTEX( inst->U.I.DstReg.Index = tmp_texsample; inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; - if (inst->U.I.Opcode == RC_OPCODE_TXP) { - tmp_recip_w = rc_find_free_temporary(c); + tmp_sum = rc_find_free_temporary(c); + if (inst->U.I.Opcode == RC_OPCODE_TXP) { /* Compute 1/W. */ inst_rcp = rc_insert_new_instruction(c, inst); inst_rcp->U.I.Opcode = RC_OPCODE_RCP; inst_rcp->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_rcp->U.I.DstReg.Index = tmp_recip_w; + inst_rcp->U.I.DstReg.Index = tmp_sum; inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; inst_rcp->U.I.SrcReg[0].Swizzle = RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 3)); } - /* Perspective-divide Z by W (if it's TXP) and add the texture sample (see below). */ - tmp_sum = rc_find_free_temporary(c); - inst_mad = rc_insert_new_instruction(c, inst_rcp ? inst_rcp : inst); - inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mad->U.I.DstReg.Index = tmp_sum; - inst_mad->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_mad->U.I.SrcReg[0].Swizzle = + /* Divide Z by W (if it's TXP) and saturate. */ + inst_mul = rc_insert_new_instruction(c, inst_rcp ? inst_rcp : inst); + inst_mul->U.I.Opcode = inst->U.I.Opcode == RC_OPCODE_TXP ? RC_OPCODE_MUL : RC_OPCODE_MOV; + inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mul->U.I.DstReg.Index = tmp_sum; + inst_mul->U.I.DstReg.WriteMask = RC_MASK_W; + inst_mul->U.I.SaturateMode = RC_SATURATE_ZERO_ONE; + inst_mul->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mul->U.I.SrcReg[0].Swizzle = RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle
Mesa (master): softpipe: clamp texcoords in sample_compare()
Module: Mesa Branch: master Commit: 0eef561a5bb10df343837d58d37d5c0d5b708243 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0eef561a5bb10df343837d58d37d5c0d5b708243 Author: Philip Taylor Date: Mon Mar 7 18:56:51 2011 -0700 softpipe: clamp texcoords in sample_compare() This fixes http://bugs.freedesktop.org/show_bug.cgi?id=31159 for softpipe and fixes the piglit depth-tex-compare test. NOTE: This is a candidate for the 7.10 branch. Signed-off-by: Brian Paul --- src/gallium/drivers/softpipe/sp_tex_sample.c | 54 ++--- 1 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 8a4ef93..c09ce19 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1795,6 +1795,7 @@ sample_compare(struct tgsi_sampler *tgsi_sampler, const struct pipe_sampler_state *sampler = samp->sampler; int j, k0, k1, k2, k3; float val; + float pc0, pc1, pc2, pc3; samp->mip_filter(tgsi_sampler, s, t, p, c0, control, rgba); @@ -1804,43 +1805,48 @@ sample_compare(struct tgsi_sampler *tgsi_sampler, * RGBA channels. We look at the red channel here. */ + pc0 = CLAMP(p[0], 0.0F, 1.0F); + pc1 = CLAMP(p[1], 0.0F, 1.0F); + pc2 = CLAMP(p[2], 0.0F, 1.0F); + pc3 = CLAMP(p[3], 0.0F, 1.0F); + /* compare four texcoords vs. four texture samples */ switch (sampler->compare_func) { case PIPE_FUNC_LESS: - k0 = p[0] < rgba[0][0]; - k1 = p[1] < rgba[0][1]; - k2 = p[2] < rgba[0][2]; - k3 = p[3] < rgba[0][3]; + k0 = pc0 < rgba[0][0]; + k1 = pc1 < rgba[0][1]; + k2 = pc2 < rgba[0][2]; + k3 = pc3 < rgba[0][3]; break; case PIPE_FUNC_LEQUAL: - k0 = p[0] <= rgba[0][0]; - k1 = p[1] <= rgba[0][1]; - k2 = p[2] <= rgba[0][2]; - k3 = p[3] <= rgba[0][3]; + k0 = pc0 <= rgba[0][0]; + k1 = pc1 <= rgba[0][1]; + k2 = pc2 <= rgba[0][2]; + k3 = pc3 <= rgba[0][3]; break; case PIPE_FUNC_GREATER: - k0 = p[0] > rgba[0][0]; - k1 = p[1] > rgba[0][1]; - k2 = p[2] > rgba[0][2]; - k3 = p[3] > rgba[0][3]; + k0 = pc0 > rgba[0][0]; + k1 = pc1 > rgba[0][1]; + k2 = pc2 > rgba[0][2]; + k3 = pc3 > rgba[0][3]; break; case PIPE_FUNC_GEQUAL: - k0 = p[0] >= rgba[0][0]; - k1 = p[1] >= rgba[0][1]; - k2 = p[2] >= rgba[0][2]; - k3 = p[3] >= rgba[0][3]; + k0 = pc0 >= rgba[0][0]; + k1 = pc1 >= rgba[0][1]; + k2 = pc2 >= rgba[0][2]; + k3 = pc3 >= rgba[0][3]; break; case PIPE_FUNC_EQUAL: - k0 = p[0] == rgba[0][0]; - k1 = p[1] == rgba[0][1]; - k2 = p[2] == rgba[0][2]; - k3 = p[3] == rgba[0][3]; + k0 = pc0 == rgba[0][0]; + k1 = pc1 == rgba[0][1]; + k2 = pc2 == rgba[0][2]; + k3 = pc3 == rgba[0][3]; break; case PIPE_FUNC_NOTEQUAL: - k0 = p[0] != rgba[0][0]; - k1 = p[1] != rgba[0][1]; - k2 = p[2] != rgba[0][2]; - k3 = p[3] != rgba[0][3]; + k0 = pc0 != rgba[0][0]; + k1 = pc1 != rgba[0][1]; + k2 = pc2 != rgba[0][2]; + k3 = pc3 != rgba[0][3]; break; case PIPE_FUNC_ALWAYS: k0 = k1 = k2 = k3 = 1; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): llvmpipe: clamp texcoords in lp_build_sample_compare()
Module: Mesa Branch: master Commit: 2c1ef65a04de8d61fddee55c7a2f0673d69235d5 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c1ef65a04de8d61fddee55c7a2f0673d69235d5 Author: Brian Paul Date: Mon Mar 7 18:59:39 2011 -0700 llvmpipe: clamp texcoords in lp_build_sample_compare() See previous commit for more info. NOTE: This is a candidate for the 7.10 branch. --- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 1fec3ad..9961ba0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1108,6 +1108,11 @@ lp_build_sample_compare(struct lp_build_sample_context *bld, coord, tex); } + /* Clamp p coords to [0,1] */ + p = lp_build_clamp(&bld->coord_bld, p, + bld->coord_bld.zero, + bld->coord_bld.one); + /* result = (p FUNC texel) ? 1 : 0 */ res = lp_build_cmp(texel_bld, bld->static_state->compare_func, p, texel[chan]); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: return after invalidating renderbuffer
Module: Mesa Branch: master Commit: a674ef7814ea16622b6002009ffe27a55cb500bf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a674ef7814ea16622b6002009ffe27a55cb500bf Author: Marek Olšák Date: Mon Mar 7 23:33:36 2011 +0100 mesa: return after invalidating renderbuffer --- src/mesa/main/fbobject.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index be8e9d5..ffdd084 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1134,6 +1134,7 @@ invalidate_rb(GLuint key, void *data, void *userData) att->Renderbuffer == rb) { /* Mark fb status as indeterminate to force re-validation */ fb->_Status = 0; +return; } } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: fail to alloc a renderbuffer if st_choose_renderbuffer_format fails
Module: Mesa Branch: master Commit: fb5d9e1199cabe653ae1bb822bb66ce9f0ce7f55 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb5d9e1199cabe653ae1bb822bb66ce9f0ce7f55 Author: Marek Olšák Date: Sun Mar 6 05:26:13 2011 +0100 st/mesa: fail to alloc a renderbuffer if st_choose_renderbuffer_format fails This fixes: state_tracker/st_format.c:401:st_pipe_format_to_mesa_format: Assertion `0' failed. --- src/mesa/state_tracker/st_cb_fbo.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 5eda234..ae49434 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -79,7 +79,11 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, else format = st_choose_renderbuffer_format(screen, internalFormat, rb->NumSamples); - + + if (format == PIPE_FORMAT_NONE) { + return FALSE; + } + /* init renderbuffer fields */ strb->Base.Width = width; strb->Base.Height = height; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: invalidate framebuffer if internal format of renderbuffer is changed
Module: Mesa Branch: master Commit: df818d572e4ddb1ceccd22a538bf98ce01caffee URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=df818d572e4ddb1ceccd22a538bf98ce01caffee Author: Marek Olšák Date: Sun Mar 6 05:26:12 2011 +0100 mesa: invalidate framebuffer if internal format of renderbuffer is changed RenderTexture doesn't have to be called in invalidate_rb, I guess. --- src/mesa/main/fbobject.c | 35 +-- src/mesa/main/mtypes.h |2 ++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index c242e56..be8e9d5 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -384,6 +384,7 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx, assert(att); _mesa_set_renderbuffer_attachment(ctx, att, rb); } + rb->AttachedAnytime = GL_TRUE; } else { _mesa_remove_attachment(ctx, att); @@ -1115,6 +1116,30 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat) } +/** + * Invalidate a renderbuffer attachment. Called from _mesa_HashWalk(). + */ +static void +invalidate_rb(GLuint key, void *data, void *userData) +{ + struct gl_framebuffer *fb = (struct gl_framebuffer *) data; + struct gl_renderbuffer *rb = (struct gl_renderbuffer *) userData; + + /* If this is a user-created FBO */ + if (fb->Name) { + GLuint i; + for (i = 0; i < BUFFER_COUNT; i++) { + struct gl_renderbuffer_attachment *att = fb->Attachment + i; + if (att->Type == GL_RENDERBUFFER && + att->Renderbuffer == rb) { +/* Mark fb status as indeterminate to force re-validation */ +fb->_Status = 0; + } + } + } +} + + /** sentinal value, see below */ #define NO_SAMPLES 1000 @@ -1207,12 +1232,10 @@ renderbuffer_storage(GLenum target, GLenum internalFormat, rb->NumSamples = 0; } - /* - test_framebuffer_completeness(ctx, fb); - */ - /* XXX if this renderbuffer is attached anywhere, invalidate attachment -* points??? -*/ + /* Invalidate the framebuffers the renderbuffer is attached in. */ + if (rb->AttachedAnytime) { + _mesa_HashWalk(ctx->Shared->FrameBuffers, invalidate_rb, rb); + } } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index db3eba2..49ecea5 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2376,6 +2376,8 @@ struct gl_renderbuffer GLenum DataType; /**< Type of values passed to the Get/Put functions */ GLvoid *Data;/**< This may not be used by some kinds of RBs */ + GLboolean AttachedAnytime; /**< TRUE if it was attached to a framebuffer */ + /* Used to wrap one renderbuffer around another: */ struct gl_renderbuffer *Wrapped; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): mesa: initialize DummyBufferObject's mutex
Module: Mesa Branch: master Commit: f4ca12c4f1fc249d0be8f228a638748609fcf696 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4ca12c4f1fc249d0be8f228a638748609fcf696 Author: Brian Paul Date: Mon Mar 7 14:57:20 2011 -0700 mesa: initialize DummyBufferObject's mutex The mutex's fields were all zeros. That's OK on Linux, but not Windows. NOTE: This is a candidate for the 7.10 branch. --- src/mesa/main/bufferobj.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 35d9261..44072fb 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -558,6 +558,7 @@ void _mesa_init_buffer_objects( struct gl_context *ctx ) { memset(&DummyBufferObject, 0, sizeof(DummyBufferObject)); + _glthread_INIT_MUTEX(DummyBufferObject.Mutex); DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */ _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: fix incorrect version checking code
Module: Mesa Branch: master Commit: ce6f16d382dc76fd77064c6ce04ca6cc18cdfcef URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce6f16d382dc76fd77064c6ce04ca6cc18cdfcef Author: Brian Paul Date: Sat Mar 5 11:08:57 2011 -0700 st/mesa: fix incorrect version checking code --- src/mesa/state_tracker/st_manager.c |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 5c8853c..d85bcd4 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -684,8 +684,9 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, if (attribs->major > 1 || attribs->minor > 0) { _mesa_compute_version(st->ctx); - if (st->ctx->VersionMajor < attribs->major || - st->ctx->VersionMajor < attribs->minor) { + /* is the actual version less than the requested version? */ + if (st->ctx->VersionMajor * 10 + st->ctx->VersionMinor < + attribs->major * 10 + attribs->minor) { st_destroy_context(st); return NULL; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/glx: whitespace, 80-column fixes
Module: Mesa Branch: master Commit: 8329f4db6124de0578bd1def39f0d5845a9025af URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8329f4db6124de0578bd1def39f0d5845a9025af Author: Brian Paul Date: Sat Mar 5 10:23:12 2011 -0700 st/glx: whitespace, 80-column fixes --- src/gallium/state_trackers/glx/xlib/glx_api.c | 85 +++-- 1 files changed, 50 insertions(+), 35 deletions(-) diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index 205a7e3..351267b 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -1367,8 +1367,8 @@ glXSwapBuffers( Display *dpy, GLXDrawable drawable ) /*** GLX_MESA_copy_sub_buffer ***/ PUBLIC void -glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, - int x, int y, int width, int height ) +glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, + int x, int y, int width, int height) { XMesaBuffer buffer = XMesaFindBuffer( dpy, drawable ); if (buffer) { @@ -1718,8 +1718,8 @@ glXGetClientString( Display *dpy, int name ) PUBLIC int -glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, - int attribute, int *value ) +glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, + int attribute, int *value) { XMesaVisual v = (XMesaVisual) config; (void) dpy; @@ -1763,8 +1763,8 @@ glXGetFBConfigs( Display *dpy, int screen, int *nelements ) PUBLIC GLXFBConfig * -glXChooseFBConfig( Display *dpy, int screen, -const int *attribList, int *nitems ) +glXChooseFBConfig(Display *dpy, int screen, + const int *attribList, int *nitems) { XMesaVisual xmvis; @@ -1814,8 +1814,8 @@ glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) PUBLIC GLXWindow -glXCreateWindow( Display *dpy, GLXFBConfig config, Window win, - const int *attribList ) +glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, +const int *attribList) { XMesaVisual xmvis = (XMesaVisual) config; XMesaBuffer xmbuf; @@ -1845,8 +1845,8 @@ glXDestroyWindow( Display *dpy, GLXWindow window ) /* XXX untested */ PUBLIC GLXPixmap -glXCreatePixmap( Display *dpy, GLXFBConfig config, Pixmap pixmap, - const int *attribList ) +glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, +const int *attribList) { XMesaVisual v = (XMesaVisual) config; XMesaBuffer b; @@ -1965,8 +1965,7 @@ glXDestroyPixmap( Display *dpy, GLXPixmap pixmap ) PUBLIC GLXPbuffer -glXCreatePbuffer( Display *dpy, GLXFBConfig config, - const int *attribList ) +glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList) { XMesaVisual xmvis = (XMesaVisual) config; XMesaBuffer xmbuf; @@ -2038,8 +2037,8 @@ glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ) PUBLIC void -glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, - unsigned int *value ) +glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, + unsigned int *value) { GLuint width, height; XMesaBuffer xmbuf = XMesaFindBuffer(dpy, draw); @@ -2085,7 +2084,7 @@ glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, PUBLIC GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config, - int renderType, GLXContext shareList, Bool direct ) + int renderType, GLXContext shareList, Bool direct ) { GLXContext glxCtx; GLXContext shareCtx = shareList; @@ -2156,8 +2155,7 @@ glXSelectEvent( Display *dpy, GLXDrawable drawable, unsigned long mask ) PUBLIC void -glXGetSelectedEvent( Display *dpy, GLXDrawable drawable, - unsigned long *mask ) +glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask) { XMesaBuffer xmbuf = XMesaFindBuffer(dpy, drawable); if (xmbuf) @@ -2209,7 +2207,8 @@ glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) /*** GLX_SGI_make_current_read ***/ PUBLIC Bool -glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx) +glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, + GLXContext ctx) { return glXMakeContextCurrent( dpy, draw, read, ctx ); } @@ -2227,7 +2226,8 @@ glXGetCurrentReadDrawableSGI(void) #if defined(_VL_H) PUBLIC GLXVideoSourceSGIX -glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode) +glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, +VLPath path, int nodeClass, VLNode drainNode) { (void) dpy; (void) screen; @@ -2273,7 +2273,8 @@ glXImportContextEXT(Display *dpy, GLXContextID contextID) } PUBLIC int
Mesa (master): mesa: remove stray _mesa_finish() call in _mesa_CopyPixels()
Module: Mesa Branch: master Commit: 51db2045b488477230d9a31b60779f90f0f4bf64 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=51db2045b488477230d9a31b60779f90f0f4bf64 Author: Brian Paul Date: Mon Mar 7 14:01:09 2011 -0700 mesa: remove stray _mesa_finish() call in _mesa_CopyPixels() Leftover debug code from 6364d75008b4fa580c1cb47c59ba1cf3e0caa6cd. --- src/mesa/main/drawpix.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 98e82ef..fb86036 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -136,8 +136,6 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - _mesa_finish(ctx); - if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glCopyPixels(%d, %d, %d, %d, %s) // from %s to %s at %d, %d\n", ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: Simplify some swizzle lookups.
Module: Mesa Branch: master Commit: 0e4750a84dfad00c4fe1706aa42d2ede6e731295 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e4750a84dfad00c4fe1706aa42d2ede6e731295 Author: Henri Verbeet Date: Mon Mar 7 21:15:03 2011 +0100 r600g: Simplify some swizzle lookups. --- src/gallium/drivers/r600/r600_shader.c | 89 +--- 1 files changed, 14 insertions(+), 75 deletions(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 4146cb3..546e21d 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1722,37 +1722,15 @@ static int tgsi_tex(struct r600_shader_ctx *ctx) } if (inst->Texture.Texture == TGSI_TEXTURE_CUBE) { - int src_chan, src2_chan; + static const unsigned src0_swizzle[] = {2, 2, 0, 1}; + static const unsigned src1_swizzle[] = {1, 0, 2, 2}; /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */ for (i = 0; i < 4; i++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE); - switch (i) { - case 0: - src_chan = 2; - src2_chan = 1; - break; - case 1: - src_chan = 2; - src2_chan = 0; - break; - case 2: - src_chan = 0; - src2_chan = 2; - break; - case 3: - src_chan = 1; - src2_chan = 2; - break; - default: - assert(0); - src_chan = 0; - src2_chan = 0; - break; - } - r600_bc_src(&alu.src[0], &ctx->src[0], src_chan); - r600_bc_src(&alu.src[1], &ctx->src[0], src2_chan); + r600_bc_src(&alu.src[0], &ctx->src[0], src0_swizzle[i]); + r600_bc_src(&alu.src[1], &ctx->src[0], src1_swizzle[i]); alu.dst.sel = ctx->temp_reg; alu.dst.chan = i; if (i == 3) @@ -2027,6 +2005,8 @@ static int tgsi_cmp(struct r600_shader_ctx *ctx) static int tgsi_xpd(struct r600_shader_ctx *ctx) { struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction; + static const unsigned int src0_swizzle[] = {2, 0, 1}; + static const unsigned int src1_swizzle[] = {1, 2, 0}; struct r600_bc_alu alu; uint32_t use_temp = 0; int i, r; @@ -2037,33 +2017,12 @@ static int tgsi_xpd(struct r600_shader_ctx *ctx) for (i = 0; i < 4; i++) { memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL); - - switch (i) { - case 0: - r600_bc_src(&alu.src[0], &ctx->src[0], 2); - break; - case 1: - r600_bc_src(&alu.src[0], &ctx->src[0], 0); - break; - case 2: - r600_bc_src(&alu.src[0], &ctx->src[0], 1); - break; - case 3: + if (i < 3) { + r600_bc_src(&alu.src[0], &ctx->src[0], src0_swizzle[i]); + r600_bc_src(&alu.src[1], &ctx->src[1], src1_swizzle[i]); + } else { alu.src[0].sel = V_SQ_ALU_SRC_0; alu.src[0].chan = i; - } - - switch (i) { - case 0: - r600_bc_src(&alu.src[1], &ctx->src[1], 1); - break; - case 1: - r600_bc_src(&alu.src[1], &ctx->src[1], 2); - break; - case 2: - r600_bc_src(&alu.src[1], &ctx->src[1], 0); - break; - case 3: alu.src[1].sel = V_SQ_ALU_SRC_0; alu.src[1].chan = i; } @@ -2083,32 +2042,12 @@ static int tgsi_xpd(struct r600_shader_ctx *ctx) memset(&alu, 0, sizeof(struct r600_bc_alu)); alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD); - switch (i) { - case 0: - r600_bc_src(&alu.src[0], &ctx->src[0], 1); - break; - case 1: - r600_bc_src(&alu.src[0], &ctx->src[0], 2); -
Mesa (master): i915: Only invert wpos when rendering to the system framebuffer.
Module: Mesa Branch: master Commit: a8bde5c47e1e8df13b408e44a2ae79edffd5ebed URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8bde5c47e1e8df13b408e44a2ae79edffd5ebed Author: Henri Verbeet Date: Mon Mar 7 21:15:03 2011 +0100 i915: Only invert wpos when rendering to the system framebuffer. --- src/mesa/drivers/dri/i915/intel_tris.c | 22 +++--- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index cf9291c..7bcb72f 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -490,6 +490,7 @@ static void intel_wpos_triangle(struct intel_context *intel, intelVertexPtr v0, intelVertexPtr v1, intelVertexPtr v2) { + const struct gl_framebuffer *fb = intel->ctx.DrawBuffer; GLuint offset = intel->wpos_offset; GLuint size = intel->wpos_size; GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset); @@ -500,10 +501,11 @@ intel_wpos_triangle(struct intel_context *intel, __memcpy(v1_wpos, v1, size); __memcpy(v2_wpos, v2, size); - v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height; - v1_wpos[1] = -v1_wpos[1] + intel->ctx.DrawBuffer->Height; - v2_wpos[1] = -v2_wpos[1] + intel->ctx.DrawBuffer->Height; - + if (!fb->Name) { + v0_wpos[1] = -v0_wpos[1] + fb->Height; + v1_wpos[1] = -v1_wpos[1] + fb->Height; + v2_wpos[1] = -v2_wpos[1] + fb->Height; + } intel_draw_triangle(intel, v0, v1, v2); } @@ -513,6 +515,7 @@ static void intel_wpos_line(struct intel_context *intel, intelVertexPtr v0, intelVertexPtr v1) { + const struct gl_framebuffer *fb = intel->ctx.DrawBuffer; GLuint offset = intel->wpos_offset; GLuint size = intel->wpos_size; GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset); @@ -521,8 +524,10 @@ intel_wpos_line(struct intel_context *intel, __memcpy(v0_wpos, v0, size); __memcpy(v1_wpos, v1, size); - v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height; - v1_wpos[1] = -v1_wpos[1] + intel->ctx.DrawBuffer->Height; + if (!fb->Name) { + v0_wpos[1] = -v0_wpos[1] + fb->Height; + v1_wpos[1] = -v1_wpos[1] + fb->Height; + } intel_draw_line(intel, v0, v1); } @@ -531,12 +536,15 @@ intel_wpos_line(struct intel_context *intel, static void intel_wpos_point(struct intel_context *intel, intelVertexPtr v0) { + const struct gl_framebuffer *fb = intel->ctx.DrawBuffer; GLuint offset = intel->wpos_offset; GLuint size = intel->wpos_size; GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset); __memcpy(v0_wpos, v0, size); - v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height; + + if (!fb->Name) + v0_wpos[1] = -v0_wpos[1] + fb->Height; intel_draw_point(intel, v0); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: Constant buffers can contain up to 4096 constants.
Module: Mesa Branch: master Commit: eac50295fccb983281423e825e57ab4a2a5bbbfb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=eac50295fccb983281423e825e57ab4a2a5bbbfb Author: Henri Verbeet Date: Mon Mar 7 21:15:03 2011 +0100 r600g: Constant buffers can contain up to 4096 constants. --- src/gallium/drivers/r600/r600_pipe.c |2 +- src/gallium/drivers/r600/r600_pipe.h |1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 6083857..9964bb3 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -394,7 +394,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e case PIPE_SHADER_CAP_MAX_ADDRS: return 1; //max native address registers/* FIXME Isn't this equal to TEMPS? */ case PIPE_SHADER_CAP_MAX_CONSTS: - return 256; //max native parameters + return R600_MAX_CONST_BUFFER_SIZE; case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: return R600_MAX_CONST_BUFFERS; case PIPE_SHADER_CAP_MAX_PREDS: diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 5f701d8..1b78c09 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -38,6 +38,7 @@ #include "r600_resource.h" #define R600_MAX_CONST_BUFFERS 1 +#define R600_MAX_CONST_BUFFER_SIZE 4096 enum r600_pipe_state_id { R600_PIPE_STATE_BLEND = 0, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): glx: Take GLPROTO_CFLAGS into account.
Module: Mesa Branch: master Commit: c3c91a0fe5e9a497c44481bcd072093e6edaac50 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3c91a0fe5e9a497c44481bcd072093e6edaac50 Author: Henri Verbeet Date: Mon Mar 7 21:15:02 2011 +0100 glx: Take GLPROTO_CFLAGS into account. --- configs/autoconf.in |1 + src/glx/Makefile|1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/configs/autoconf.in b/configs/autoconf.in index a3c69e1..4e931a3 100644 --- a/configs/autoconf.in +++ b/configs/autoconf.in @@ -149,6 +149,7 @@ DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@ LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ LIBDRM_LIB = @LIBDRM_LIBS@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +GLPROTO_CFLAGS = @GLPROTO_CFLAGS@ EXPAT_INCLUDES = @EXPAT_INCLUDES@ # Autoconf directories diff --git a/src/glx/Makefile b/src/glx/Makefile index 3d92ebb..dd96973 100644 --- a/src/glx/Makefile +++ b/src/glx/Makefile @@ -64,6 +64,7 @@ INCLUDES = -I. \ -I$(TOP)/src/mapi/glapi \ $(LIBDRM_CFLAGS) \ $(DRI2PROTO_CFLAGS) \ + $(GLPROTO_CFLAGS) \ $(X11_INCLUDES) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i915: Derive the gl_fragment_program from i915_fragment_program.
Module: Mesa Branch: master Commit: a99b23752b0182c64ebe1dc9c18ab821550771ff URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a99b23752b0182c64ebe1dc9c18ab821550771ff Author: Henri Verbeet Date: Mon Mar 7 21:15:03 2011 +0100 i915: Derive the gl_fragment_program from i915_fragment_program. Instead of using the current gl_fragment_program. These aren't necessarily the same, for example when translate_program() is called by i915ValidateFragmentProgram(). --- src/mesa/drivers/dri/i915/i915_fragprog.c | 11 +-- 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 25f4fc3..2bfe665 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -269,7 +269,7 @@ translate_tex_src_target(struct i915_fragment_program *p, GLubyte bit) #define EMIT_TEX( OP ) \ do { \ GLuint dim = translate_tex_src_target( p, inst->TexSrcTarget ); \ - const struct gl_fragment_program *program = p->ctx->FragmentProgram._Current; \ + const struct gl_fragment_program *program = &p->FragProg; \ GLuint unit = program->Base.SamplerUnits[inst->TexSrcUnit]; \ GLuint sampler = i915_emit_decl(p, REG_TYPE_S, \ unit, dim); \ @@ -304,7 +304,7 @@ do { \ */ static void calc_live_regs( struct i915_fragment_program *p ) { -const struct gl_fragment_program *program = p->ctx->FragmentProgram._Current; +const struct gl_fragment_program *program = &p->FragProg; GLuint regsUsed = 0x; uint8_t live_components[16] = { 0, }; GLint i; @@ -344,7 +344,7 @@ static void calc_live_regs( struct i915_fragment_program *p ) static GLuint get_live_regs( struct i915_fragment_program *p, const struct prog_instruction *inst ) { -const struct gl_fragment_program *program = p->ctx->FragmentProgram._Current; +const struct gl_fragment_program *program = &p->FragProg; GLuint nr = inst - program->Base.Instructions; return p->usedRegs[nr]; @@ -365,8 +365,7 @@ static GLuint get_live_regs( struct i915_fragment_program *p, static void upload_program(struct i915_fragment_program *p) { - const struct gl_fragment_program *program = - p->ctx->FragmentProgram._Current; + const struct gl_fragment_program *program = &p->FragProg; const struct prog_instruction *inst = program->Base.Instructions; if (INTEL_DEBUG & DEBUG_WM) @@ -1166,7 +1165,7 @@ translate_program(struct i915_fragment_program *p) if (INTEL_DEBUG & DEBUG_WM) { printf("fp:\n"); - _mesa_print_program(&p->ctx->FragmentProgram._Current->Base); + _mesa_print_program(&p->FragProg.Base); printf("\n"); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel: Add some defense against bo allocation failure
Module: Mesa Branch: master Commit: f627d429bda8196fd20f2023374ad6d34e4becb6 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f627d429bda8196fd20f2023374ad6d34e4becb6 Author: Chris Wilson Date: Fri Mar 4 15:04:09 2011 + intel: Add some defense against bo allocation failure Signed-off-by: Chris Wilson --- src/mesa/drivers/dri/intel/intel_regions.c | 18 +++--- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 0857fa8..a4da1ce 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -149,11 +149,6 @@ intel_region_alloc_internal(struct intel_screen *screen, { struct intel_region *region; - if (buffer == NULL) { - _DBG("%s <-- NULL\n", __FUNCTION__); - return NULL; - } - region = calloc(sizeof(*region), 1); if (region == NULL) return region; @@ -180,6 +175,7 @@ intel_region_alloc(struct intel_screen *screen, drm_intel_bo *buffer; unsigned long flags = 0; unsigned long aligned_pitch; + struct intel_region *region; if (expect_accelerated_upload) flags |= BO_ALLOC_FOR_RENDER; @@ -187,9 +183,17 @@ intel_region_alloc(struct intel_screen *screen, buffer = drm_intel_bo_alloc_tiled(screen->bufmgr, "region", width, height, cpp, &tiling, &aligned_pitch, flags); + if (buffer == NULL) + return NULL; - return intel_region_alloc_internal(screen, cpp, width, height, - aligned_pitch / cpp, tiling, buffer); + region = intel_region_alloc_internal(screen, cpp, width, height, +aligned_pitch / cpp, tiling, buffer); + if (region == NULL) { + drm_intel_bo_unreference(buffer); + return NULL; + } + + return region; } GLboolean ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel: check for miptree allocation failure
Module: Mesa Branch: master Commit: 6547253bd138db815173c00ca2dc220e8ad20ab1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6547253bd138db815173c00ca2dc220e8ad20ab1 Author: Chris Wilson Date: Fri Mar 4 15:14:11 2011 + intel: check for miptree allocation failure Signed-off-by: Chris Wilson --- src/mesa/drivers/dri/intel/intel_tex_validate.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 8537e7f..a11b07e 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -140,6 +140,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) cpp, comp_byte, GL_TRUE); + if (!intelObj->mt) + return GL_FALSE; } /* Pull in any images not in the object's tree: ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): intel: Add some defense against buffer allocation failure for subimage blits
Module: Mesa Branch: master Commit: de7678ef521f4fb34459e407a66ab8bf8be733e1 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=de7678ef521f4fb34459e407a66ab8bf8be733e1 Author: Chris Wilson Date: Fri Mar 4 15:04:36 2011 + intel: Add some defense against buffer allocation failure for subimage blits Signed-off-by: Chris Wilson --- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 22 +++--- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index 6b7f13f..d0f8294 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -90,19 +90,19 @@ intelTexSubimage(struct gl_context * ctx, intel->gen < 6 && target == GL_TEXTURE_2D && drm_intel_bo_busy(dst_bo)) { -unsigned long pitch; -uint32_t tiling_mode = I915_TILING_NONE; -temp_bo = drm_intel_bo_alloc_tiled(intel->bufmgr, - "subimage blit bo", - width, height, - intelImage->mt->cpp, - &tiling_mode, - &pitch, - 0); -drm_intel_gem_bo_map_gtt(temp_bo); +dstRowStride = width * intelImage->mt->cpp; + temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subimage blit bo", + dstRowStride * height, 0); + if (!temp_bo) +return; + +if (drm_intel_gem_bo_map_gtt(temp_bo)) { +drm_intel_bo_unreference(temp_bo); +return; + } + texImage->Data = temp_bo->virtual; texImage->ImageOffsets[0] = 0; -dstRowStride = pitch; intel_miptree_get_image_offset(intelImage->mt, level, intelImage->face, 0, ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit