nouveau: nv10: Move some initialization stuff
authorPatrice Mandin <pmandin@caramail.com>
Tue, 21 Aug 2007 14:55:42 +0000 (16:55 +0200)
committerPatrice Mandin <pmandin@caramail.com>
Tue, 21 Aug 2007 14:55:42 +0000 (16:55 +0200)
src/mesa/drivers/dri/nouveau/nv10_state.c

index 8bfe20c6c004512eecb5c4a35edbceb2c80c0e0c..d246daea87686f2d8ae8a7913d2bc384423c10ca 100644 (file)
@@ -701,30 +701,17 @@ static void nv10WindowMoved(nouveauContextPtr nmesa)
        GLuint h = ctx->Viewport.Height;
        GLuint x = ctx->Viewport.X + nmesa->drawX;
        GLuint y = ctx->Viewport.Y + nmesa->drawY;
-       int i;
 
         BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2);
         OUT_RING_CACHE((w << 16) | x);
         OUT_RING_CACHE((h << 16) | y);
 
-       /* something to do with clears, possibly doesn't belong here */
-       BEGIN_RING_SIZE(NvSub3D, 0x02b4, 1);
-       OUT_RING(0);
-
        BEGIN_RING_CACHE(NvSub3D,
              NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 1);
         OUT_RING_CACHE(((w+x-1) << 16) | x | 0x08000800);
        BEGIN_RING_CACHE(NvSub3D,
              NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(0), 1);
         OUT_RING_CACHE(((h+y-1) << 16) | y | 0x08000800);
-       for (i=1; i<8; i++) {
-               BEGIN_RING_CACHE(NvSub3D,
-                     NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(i), 1);
-               OUT_RING_CACHE(0);
-               BEGIN_RING_CACHE(NvSub3D,
-                     NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(i), 1);
-               OUT_RING_CACHE(0);
-       }
 
        nv10ViewportScale(nmesa);
 }
@@ -732,6 +719,8 @@ static void nv10WindowMoved(nouveauContextPtr nmesa)
 /* Initialise any card-specific non-GL related state */
 static GLboolean nv10InitCard(nouveauContextPtr nmesa)
 {
+       int i;
+
        nouveauObjectOnSubchannel(nmesa, NvSub3D, Nv3D);
 
        BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_SET_DMA_IN_MEMORY0, 2);
@@ -741,6 +730,27 @@ static GLboolean nv10InitCard(nouveauContextPtr nmesa)
        OUT_RING(NvDmaFB);      /* 194 dma_in_memory2 */
        OUT_RING(NvDmaFB);      /* 198 dma_in_memory3 */
 
+       /* 0x0 viewport size */
+        BEGIN_RING_SIZE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2);
+        OUT_RING(0);
+        OUT_RING(0);
+
+       /* Clipping regions */
+       BEGIN_RING_SIZE(NvSub3D,
+             NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 1);
+        OUT_RING(0x07ff0800);
+       BEGIN_RING_SIZE(NvSub3D,
+             NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(0), 1);
+        OUT_RING(0x07ff0800);
+       for (i=1; i<8; i++) {
+               BEGIN_RING_SIZE(NvSub3D,
+                     NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(i), 1);
+               OUT_RING(0);
+               BEGIN_RING_SIZE(NvSub3D,
+                     NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(i), 1);
+               OUT_RING(0);
+       }
+
        BEGIN_RING_SIZE(NvSub3D, 0x0290, 1);
        OUT_RING(0x00100001);
        BEGIN_RING_SIZE(NvSub3D, 0x03f4, 1);