nvc0: add NV_viewport_swizzle support for GM200+
authorIlia Mirkin <imirkin@alum.mit.edu>
Mon, 6 Apr 2020 06:52:26 +0000 (02:52 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 12 Apr 2020 16:01:46 +0000 (12:01 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4519>

src/gallium/drivers/nouveau/nvc0/nvc0_3d.xml.h
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c

index c5456e48b586d96c547e67a713bc3214b32b11b0..33a5310b27e11307f724e4aa392ba71c6545d247 100644 (file)
@@ -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
index 80af8f0d52cb104c5e2b4b5d3e170f73f98de985..9b241c6c39e38821e6b5098f56514380591380f5 100644 (file)
@@ -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;
index c7513f96f22c6600fa59a37c012cff5b05199988..48d81f197db124abd3feee0159bfcfc7db1d1ede 100644 (file)
@@ -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;
 }