Mesa (master): nv50,nvc0: identify some line rasterization state

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Sun Apr 10 05:07:43 PDT 2011


Module: Mesa
Branch: master
Commit: 843d5391c3b7b80ff2087ce7e6440417aab623cc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=843d5391c3b7b80ff2087ce7e6440417aab623cc

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Thu Mar 31 19:04:17 2011 +0200

nv50,nvc0: identify some line rasterization state

Fixes width of non-smooth (aliased) lines on nvc0.

---

 src/gallium/drivers/nv50/nv50_3d.xml.h |    2 +-
 src/gallium/drivers/nv50/nv50_screen.c |    2 ++
 src/gallium/drivers/nv50/nv50_state.c  |    1 +
 src/gallium/drivers/nvc0/nvc0_3d.xml.h |    8 +++++++-
 src/gallium/drivers/nvc0/nvc0_screen.c |    6 ++++--
 src/gallium/drivers/nvc0/nvc0_state.c  |    8 ++++++--
 6 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_3d.xml.h b/src/gallium/drivers/nv50/nv50_3d.xml.h
index 92b97dd..e3177e0 100644
--- a/src/gallium/drivers/nv50/nv50_3d.xml.h
+++ b/src/gallium/drivers/nv50/nv50_3d.xml.h
@@ -1706,7 +1706,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define NV50_3D_CULL_FACE_BACK					0x00000405
 #define NV50_3D_CULL_FACE_FRONT_AND_BACK			0x00000408
 
-#define NV50_3D_UNK1924						0x00001924
+#define NV50_3D_LINE_LAST_PIXEL					0x00001924
 
 #define NVA3_3D_FP_MULTISAMPLE					0x00001928
 #define NVA3_3D_FP_MULTISAMPLE_EXPORT_SAMPLE_MASK		0x00000001
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index cfa49aa..439202d 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -420,6 +420,8 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
    OUT_RING  (chan, NV50_3D_MULTISAMPLE_MODE_MS1);
    BEGIN_RING(chan, RING_3D(MULTISAMPLE_CTRL), 1);
    OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D(LINE_LAST_PIXEL), 1);
+   OUT_RING  (chan, 0);
 
    BEGIN_RING(chan, RING_3D(SCREEN_Y_CONTROL), 1);
    OUT_RING  (chan, 0);
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 4c96db8..030cdcb 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -174,6 +174,7 @@ nv50_blend_state_delete(struct pipe_context *pipe, void *hwcso)
    FREE(hwcso);
 }
 
+/* NOTE: ignoring line_last_pixel, using FALSE (set on screen init) */
 static void *
 nv50_rasterizer_state_create(struct pipe_context *pipe,
                              const struct pipe_rasterizer_state *cso)
diff --git a/src/gallium/drivers/nvc0/nvc0_3d.xml.h b/src/gallium/drivers/nvc0/nvc0_3d.xml.h
index 94fa081..9a64e3f 100644
--- a/src/gallium/drivers/nvc0/nvc0_3d.xml.h
+++ b/src/gallium/drivers/nvc0/nvc0_3d.xml.h
@@ -82,6 +82,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define NVC0_3D_SERIALIZE					0x00000110
 
+#define NVC0_3D_LINE_WIDTH_SEPARATE				0x0000020c
+
 #define NVC0_3D_EARLY_FRAGMENT_TESTS				0x00000210
 
 #define NVC0_3D_MEM_BARRIER					0x0000021c
@@ -651,7 +653,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define NVC0_3D_SCREEN_Y_CONTROL_Y_NEGATE			0x00000001
 #define NVC0_3D_SCREEN_Y_CONTROL_TRIANGLE_RAST_FLIP		0x00000010
 
-#define NVC0_3D_LINE_WIDTH					0x000013b0
+#define NVC0_3D_LINE_WIDTH_SMOOTH				0x000013b0
+
+#define NVC0_3D_LINE_WIDTH_ALIASED				0x000013b4
 
 #define NVC0_3D_GP_VERTEX_OUTPUT_COUNT				0x00001420
 #define NVC0_3D_GP_VERTEX_OUTPUT_COUNT__MIN			0x00000001
@@ -977,6 +981,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define NVC0_3D_CULL_FACE_BACK					0x00000405
 #define NVC0_3D_CULL_FACE_FRONT_AND_BACK			0x00000408
 
+#define NVC0_3D_LINE_LAST_PIXEL					0x00001924
+
 #define NVC0_3D_VIEWPORT_TRANSFORM_EN				0x0000192c
 
 #define NVC0_3D_VIEW_VOLUME_CLIP_CTRL				0x0000193c
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c
index e98a4c0..17f42e6 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -294,8 +294,6 @@ nvc0_magic_3d_init(struct nouveau_channel *chan)
    OUT_RING  (chan, 1 << 12);
    BEGIN_RING(chan, RING_3D_(0x151c), 1);
    OUT_RING  (chan, 1);
-   BEGIN_RING(chan, RING_3D_(0x020c), 1);
-   OUT_RING  (chan, 1);
    BEGIN_RING(chan, RING_3D_(0x030c), 1);
    OUT_RING  (chan, 0);
    BEGIN_RING(chan, RING_3D_(0x0300), 1);
@@ -448,6 +446,10 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
    OUT_RING  (chan, NVC0_3D_MULTISAMPLE_MODE_1X);
    BEGIN_RING(chan, RING_3D(MULTISAMPLE_CTRL), 1);
    OUT_RING  (chan, 0);
+   BEGIN_RING(chan, RING_3D(LINE_WIDTH_SEPARATE), 1);
+   OUT_RING  (chan, 1);
+   BEGIN_RING(chan, RING_3D(LINE_LAST_PIXEL), 1);
+   OUT_RING  (chan, 0);
 
    nvc0_magic_3d_init(chan);
 
diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c
index c482b25..db3b78f 100644
--- a/src/gallium/drivers/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nvc0/nvc0_state.c
@@ -161,6 +161,7 @@ nvc0_blend_state_delete(struct pipe_context *pipe, void *hwcso)
     FREE(hwcso);
 }
 
+/* NOTE: ignoring line_last_pixel, using FALSE (set on screen init) */
 static void *
 nvc0_rasterizer_state_create(struct pipe_context *pipe,
                              const struct pipe_rasterizer_state *cso)
@@ -187,9 +188,12 @@ nvc0_rasterizer_state_create(struct pipe_context *pipe,
     SB_BEGIN_3D(so, FRAG_COLOR_CLAMP_EN, 1);
     SB_DATA    (so, cso->clamp_fragment_color ? 0x11111111 : 0x00000000);
 
-    SB_BEGIN_3D(so, LINE_WIDTH, 1);
-    SB_DATA    (so, fui(cso->line_width));
     SB_IMMED_3D(so, LINE_SMOOTH_ENABLE, cso->line_smooth);
+    if (cso->line_smooth)
+       SB_BEGIN_3D(so, LINE_WIDTH_SMOOTH, 1);
+    else
+       SB_BEGIN_3D(so, LINE_WIDTH_ALIASED, 1);
+    SB_DATA    (so, fui(cso->line_width));
 
     SB_BEGIN_3D(so, LINE_STIPPLE_ENABLE, 1);
     if (cso->line_stipple_enable) {



More information about the mesa-commit mailing list