Roy Spliet
2012-May-12 01:42 UTC
[Nouveau] [Patches] mesa/nv30: Diverse set of patches that improve NV3x render quality V2
A reworked version of 3 out of 4 patches mentioned earlier. [1/4]: Fixes nearly all piglit vertprog testcases, due to now being able to pass the results on to the fragment shader. V2: rename samplers to texcoords. [2/4]: Fixes shader compiler assertion errors, as some source registers do not exist for certain operations. Fixes several piglit tests when mesa is compiled with --enable-debug [3/4]: unchanged [4/4]: Dropped, requires a more substantial fix. As a quick-fix it's still useable though. Testers welcome!
Roy Spliet
2012-May-12 01:42 UTC
[Nouveau] [PATCH 1/4] nv30: Fix generic passing to fragment program in NV34
fixes over 800 piglit cases in quick-driver suite for NV34 Signed-off-by: Roy Spliet <r.spliet at student.tudelft.nl> --- src/gallium/drivers/nv30/nv30_fragprog.c | 2 +- src/gallium/drivers/nv30/nv30_state.h | 2 +- src/gallium/drivers/nv30/nvfx_fragprog.c | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index 865c828..cfaafd5 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -117,7 +117,7 @@ nv30_fragprog_validate(struct nv30_context *nv30) BEGIN_NV04(push, NV30_3D(FP_REG_CONTROL), 1); PUSH_DATA (push, 0x00010004); BEGIN_NV04(push, NV30_3D(TEX_UNITS_ENABLE), 1); - PUSH_DATA (push, fp->samplers); + PUSH_DATA (push, fp->texcoords); } else { BEGIN_NV04(push, SUBC_3D(0x0b40), 1); PUSH_DATA (push, 0x00000000); diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h index a219bf2..df3b696 100644 --- a/src/gallium/drivers/nv30/nv30_state.h +++ b/src/gallium/drivers/nv30/nv30_state.h @@ -115,6 +115,7 @@ struct nv30_fragprog { unsigned insn_len; uint16_t texcoord[10]; + uint32_t texcoords; struct nv30_fragprog_data *consts; unsigned nr_consts; @@ -123,7 +124,6 @@ struct nv30_fragprog { uint32_t fp_control; uint32_t point_sprite_control; uint32_t coord_conventions; - uint32_t samplers; uint32_t rt_enable; }; diff --git a/src/gallium/drivers/nv30/nvfx_fragprog.c b/src/gallium/drivers/nv30/nvfx_fragprog.c index 592ad21..915b926 100644 --- a/src/gallium/drivers/nv30/nvfx_fragprog.c +++ b/src/gallium/drivers/nv30/nvfx_fragprog.c @@ -217,7 +217,7 @@ nvfx_fp_emit(struct nvfx_fpc *fpc, struct nvfx_insn insn) if(insn.unit >= 0) { hw[0] |= (insn.unit << NVFX_FP_OP_TEX_UNIT_SHIFT); - fp->samplers |= (1 << insn.unit); + fp->texcoords |= (1 << insn.unit); } emit_dst(fpc, insn.dst); @@ -959,8 +959,12 @@ nvfx_fragprog_assign_generic(struct nv30_context *nvfx, struct nvfx_fpc *fpc, for (hw = 0; hw < num_texcoords; hw++) { if (fpc->fp->texcoord[hw] == 0xffff) { fpc->fp->texcoord[hw] = fdec->Semantic.Index; - if (hw <= 7) fpc->fp->vp_or |= (0x00004000 << hw); - else fpc->fp->vp_or |= (0x00001000 << (hw - 8)); + if (hw <= 7) { + fpc->fp->vp_or |= (0x00004000 << hw); + fpc->fp->texcoords |= (0x1 << hw); + } else { + fpc->fp->vp_or |= (0x00001000 << (hw - 8)); + } if (fdec->Semantic.Index == 9) fpc->fp->point_sprite_control |= (0x00000100 << hw); hw = NVFX_FP_OP_INPUT_SRC_TC(hw); -- 1.7.7.6
Roy Spliet
2012-May-12 01:42 UTC
[Nouveau] [PATCH 2/4] nv30/shader: SSG, LIT only requires one source register
Fixes crashing due to assertion error Signed-off-by: Roy Spliet <r.spliet at student.tudelft.nl> --- src/gallium/drivers/nv30/nvfx_fragprog.c | 2 +- src/gallium/drivers/nv30/nvfx_vertprog.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/nv30/nvfx_fragprog.c b/src/gallium/drivers/nv30/nvfx_fragprog.c index 915b926..121c623 100644 --- a/src/gallium/drivers/nv30/nvfx_fragprog.c +++ b/src/gallium/drivers/nv30/nvfx_fragprog.c @@ -623,7 +623,7 @@ nvfx_fragprog_parse_instruction(struct nv30_context* nvfx, struct nvfx_fpc *fpc, break; case TGSI_OPCODE_LIT: if(!nvfx->is_nv4x) - nvfx_fp_emit(fpc, arith(sat, LIT_NV30, dst, mask, src[0], src[1], src[2])); + nvfx_fp_emit(fpc, arith(sat, LIT_NV30, dst, mask, src[0], none, none)); else { /* we use FLT_MIN, so that log2 never gives -infinity, and thus multiplication by * specular 0 always gives 0, so that ex2 gives 1, to satisfy the 0^0 = 1 requirement diff --git a/src/gallium/drivers/nv30/nvfx_vertprog.c b/src/gallium/drivers/nv30/nvfx_vertprog.c index 82972b3..f41f82d 100644 --- a/src/gallium/drivers/nv30/nvfx_vertprog.c +++ b/src/gallium/drivers/nv30/nvfx_vertprog.c @@ -668,7 +668,7 @@ nvfx_vertprog_parse_instruction(struct nv30_context *nv30, struct nvfx_vpc *vpc, nvfx_vp_emit(vpc, arith(sat, VEC, SNE, dst, mask, src[0], src[1], none)); break; case TGSI_OPCODE_SSG: - nvfx_vp_emit(vpc, arith(sat, VEC, SSG, dst, mask, src[0], src[1], none)); + nvfx_vp_emit(vpc, arith(sat, VEC, SSG, dst, mask, src[0], none, none)); break; case TGSI_OPCODE_STR: nvfx_vp_emit(vpc, arith(sat, VEC, STR, dst, mask, src[0], src[1], none)); -- 1.7.7.6
Signed-off-by: Roy Spliet <r.spliet at student.tudelft.nl> --- src/gallium/drivers/nv30/nv30_screen.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index c3e50a5..f5120e7 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -116,6 +116,10 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: return 0; + case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: + case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: + case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: + return 1; default: debug_printf("unknown param %d\n", param); return 0; -- 1.7.7.6
Ben Skeggs
2012-May-12 02:44 UTC
[Nouveau] [Patches] mesa/nv30: Diverse set of patches that improve NV3x render quality V2
Am Samstag, den 12.05.2012, 03:42 +0200 schrieb Roy Spliet:> A reworked version of 3 out of 4 patches mentioned earlier. > > [1/4]: Fixes nearly all piglit vertprog testcases, due to now being able to pass the results on to the fragment shader. V2: rename samplers to texcoords. > [2/4]: Fixes shader compiler assertion errors, as some source registers do not exist for certain operations. Fixes several piglit tests when mesa is compiled with --enable-debug > [3/4]: unchanged2/3 pushed to mesa git! Thanks again! Ben.> [4/4]: Dropped, requires a more substantial fix. As a quick-fix it's still useable though. > > Testers welcome! > > _______________________________________________ > Nouveau mailing list > Nouveau at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/nouveau
Roy Spliet
2012-May-16 09:06 UTC
[Nouveau] [Patches] mesa/nv30: Diverse set of patches that improve NV3x render quality V3
Restored the original placement of texcoords in nv30_state.h. The other proposal (removing the fp->texcoords assignment in nvfx_fragprog_emit) breaks texturing in general and as such is not altered. Try running gnome-shell with that line commented out and see what I mean :-) [2/3]: Quick ad-hoc fix for null-ptr deref, introduced by userbufs.
Roy Spliet
2012-May-16 09:06 UTC
[Nouveau] [PATCH 1/3] nv30: Fix generic passing to fragment program in NV34
fixes over 800 piglit cases in quick-driver suite for NV34 Signed-off-by: Roy Spliet <r.spliet at student.tudelft.nl> --- src/gallium/drivers/nv30/nv30_fragprog.c | 2 +- src/gallium/drivers/nv30/nv30_state.h | 2 +- src/gallium/drivers/nv30/nvfx_fragprog.c | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index 865c828..cfaafd5 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -117,7 +117,7 @@ nv30_fragprog_validate(struct nv30_context *nv30) BEGIN_NV04(push, NV30_3D(FP_REG_CONTROL), 1); PUSH_DATA (push, 0x00010004); BEGIN_NV04(push, NV30_3D(TEX_UNITS_ENABLE), 1); - PUSH_DATA (push, fp->samplers); + PUSH_DATA (push, fp->texcoords); } else { BEGIN_NV04(push, SUBC_3D(0x0b40), 1); PUSH_DATA (push, 0x00000000); diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h index a219bf2..964676a 100644 --- a/src/gallium/drivers/nv30/nv30_state.h +++ b/src/gallium/drivers/nv30/nv30_state.h @@ -123,7 +123,7 @@ struct nv30_fragprog { uint32_t fp_control; uint32_t point_sprite_control; uint32_t coord_conventions; - uint32_t samplers; + uint32_t texcoords; uint32_t rt_enable; }; diff --git a/src/gallium/drivers/nv30/nvfx_fragprog.c b/src/gallium/drivers/nv30/nvfx_fragprog.c index 320efbb..121c623 100644 --- a/src/gallium/drivers/nv30/nvfx_fragprog.c +++ b/src/gallium/drivers/nv30/nvfx_fragprog.c @@ -217,7 +217,7 @@ nvfx_fp_emit(struct nvfx_fpc *fpc, struct nvfx_insn insn) if(insn.unit >= 0) { hw[0] |= (insn.unit << NVFX_FP_OP_TEX_UNIT_SHIFT); - fp->samplers |= (1 << insn.unit); + fp->texcoords |= (1 << insn.unit); } emit_dst(fpc, insn.dst); @@ -959,8 +959,12 @@ nvfx_fragprog_assign_generic(struct nv30_context *nvfx, struct nvfx_fpc *fpc, for (hw = 0; hw < num_texcoords; hw++) { if (fpc->fp->texcoord[hw] == 0xffff) { fpc->fp->texcoord[hw] = fdec->Semantic.Index; - if (hw <= 7) fpc->fp->vp_or |= (0x00004000 << hw); - else fpc->fp->vp_or |= (0x00001000 << (hw - 8)); + if (hw <= 7) { + fpc->fp->vp_or |= (0x00004000 << hw); + fpc->fp->texcoords |= (0x1 << hw); + } else { + fpc->fp->vp_or |= (0x00001000 << (hw - 8)); + } if (fdec->Semantic.Index == 9) fpc->fp->point_sprite_control |= (0x00000100 << hw); hw = NVFX_FP_OP_INPUT_SRC_TC(hw); -- 1.7.7.6
Roy Spliet
2012-May-16 09:06 UTC
[Nouveau] [PATCH 2/3] nv30: Avoid Null-pointer deref with possible empty vtxbuf
Signed-off-by: Roy Spliet <r.spliet at student.tudelft.nl> --- src/gallium/drivers/nv30/nv30_vbo.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c index 43914f7..db25991 100644 --- a/src/gallium/drivers/nv30/nv30_vbo.c +++ b/src/gallium/drivers/nv30/nv30_vbo.c @@ -104,7 +104,7 @@ nv30_prevalidate_vbufs(struct nv30_context *nv30) buf = nv04_resource(vb->buffer); /* NOTE: user buffers with temporary storage count as mapped by GPU */ - if (!nouveau_resource_mapped_by_gpu(vb->buffer)) { + if (buf && !nouveau_resource_mapped_by_gpu(vb->buffer)) { if (nv30->vbo_push_hint) { nv30->vbo_fifo = ~0; continue; -- 1.7.7.6
Reasonably Related Threads
- [PATCH 1/4] nv30: remove use_nv4x, it is identical to is_nv4x
- [Patches]mesa/nv30: Diverse set of patches that improve NV3x render quality
- [PATCH 2/2] nv30/draw: switch varying hookup logic to know about texcoords
- [PATCH 2/2] nv30/draw: switch varying hookup logic to know about texcoords
- [PATCH 1/2] nv30/draw: rework some of the output vertex buffer logic