Mesa (master): nvc0: add NV_viewport_swizzle support for GM200+

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Apr 12 16:26:41 UTC 2020


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

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Mon Apr  6 02:52:26 2020 -0400

nvc0: add NV_viewport_swizzle support for GM200+

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4519>

---

 src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h         | 4 ++++
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c         | 1 +
 src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 9 +++++++++
 3 files changed, 14 insertions(+)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h b/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
index c5456e48b58..33a5310b27e 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
@@ -447,6 +447,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define NVC0_3D_VIEWPORT_TRANSLATE_Z__ESIZE			0x00000020
 #define NVC0_3D_VIEWPORT_TRANSLATE_Z__LEN			0x00000010
 
+#define NVC0_3D_VIEWPORT_SWIZZLE(i0)			       (0x00000a18 + 0x20*(i0))
+#define NVC0_3D_VIEWPORT_SWIZZLE__ESIZE				0x00000020
+#define NVC0_3D_VIEWPORT_SWIZZLE__LEN				0x00000010
+
 #define NVC0_3D_SUBPIXEL_PRECISION(i0)			       (0x00000a1c + 0x20*(i0))
 #define NVC0_3D_SUBPIXEL_PRECISION__ESIZE			0x00000020
 #define NVC0_3D_SUBPIXEL_PRECISION__LEN				0x00000010
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 80af8f0d52c..9b241c6c39e 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -313,6 +313,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES:
    case PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE:
    case PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS:
+   case PIPE_CAP_VIEWPORT_SWIZZLE:
       return class_3d >= GM200_3D_CLASS;
    case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES:
       return class_3d >= GP100_3D_CLASS;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
index c7513f96f22..48d81f197db 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
@@ -391,6 +391,7 @@ static void
 nvc0_validate_viewport(struct nvc0_context *nvc0)
 {
    struct nouveau_pushbuf *push = nvc0->base.pushbuf;
+   uint16_t class_3d = nvc0->screen->base.class_3d;
    int x, y, w, h, i;
    float zmin, zmax;
 
@@ -431,6 +432,14 @@ nvc0_validate_viewport(struct nvc0_context *nvc0)
       BEGIN_NVC0(push, NVC0_3D(DEPTH_RANGE_NEAR(i)), 2);
       PUSH_DATAf(push, zmin);
       PUSH_DATAf(push, zmax);
+
+      if (class_3d >= GM200_3D_CLASS) {
+         BEGIN_NVC0(push, NVC0_3D(VIEWPORT_SWIZZLE(i)), 1);
+         PUSH_DATA (push, vp->swizzle_x << 0 |
+                          vp->swizzle_y << 4 |
+                          vp->swizzle_z << 8 |
+                          vp->swizzle_w << 12);
+      }
    }
    nvc0->viewports_dirty = 0;
 }



More information about the mesa-commit mailing list