Remove GetMSC DriverAPI function.
[mesa.git] / src / mesa / drivers / dri / nouveau / nouveau_span.c
index 6d99728b852588c42fc19bc8a1b0cc223e4ab9c0..d62830ff53ebc9519f2988d61481ebb67bfc3f35 100644 (file)
@@ -37,12 +37,21 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define HAVE_HW_STENCIL_SPANS  0
 #define HAVE_HW_STENCIL_PIXELS 0
 
+#define HW_CLIPLOOP()                                                  \
+   do {                                                                        \
+      int _nc = nmesa->numClipRects;                                   \
+      while ( _nc-- ) {                                                        \
+        int minx = nmesa->pClipRects[_nc].x1 - nmesa->drawX;           \
+        int miny = nmesa->pClipRects[_nc].y1 - nmesa->drawY;           \
+        int maxx = nmesa->pClipRects[_nc].x2 - nmesa->drawX;           \
+        int maxy = nmesa->pClipRects[_nc].y2 - nmesa->drawY;
+
 #define LOCAL_VARS                                                     \
    nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);                     \
-   __DRIscreenPrivate *sPriv = nmesa->driScreen;                       \
-   __DRIdrawablePrivate *dPriv = nmesa->driDrawable;                   \
-   driRenderbuffer *drb = (driRenderbuffer *) rb;                      \
-   GLuint height = dPriv->h;                                           \
+   nouveau_renderbuffer_t *nrb = (nouveau_renderbuffer_t *)rb;         \
+   GLuint height = nrb->mesa.Height;                                   \
+   GLubyte *map = (GLubyte *)(nrb->map ? nrb->map : nrb->mem->map) +    \
+        (nmesa->drawY * nrb->pitch) + (nmesa->drawX * nrb->cpp);       \
    GLuint p;                                                           \
    (void) p;
 
@@ -58,14 +67,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
  * Color buffers
  */
 
-/* RGB565 */ 
+/* RGB565 */
 #define SPANTMP_PIXEL_FMT GL_RGB
 #define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5
 
 #define TAG(x)    nouveau##x##_RGB565
 #define TAG2(x,y) nouveau##x##_RGB565##y
-#define GET_PTR(X,Y) (sPriv->pFB + drb->flippedOffset          \
-     + ((dPriv->y + (Y)) * drb->flippedPitch + (dPriv->x + (X))) * drb->cpp)
+#define GET_PTR(X,Y) (map + (Y)*nrb->pitch + (X)*nrb->cpp)
 #include "spantmp2.h"
 
 
@@ -75,44 +83,41 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #define TAG(x)    nouveau##x##_ARGB8888
 #define TAG2(x,y) nouveau##x##_ARGB8888##y
-#define GET_PTR(X,Y) (sPriv->pFB + drb->flippedOffset          \
-     + ((dPriv->y + (Y)) * drb->flippedPitch + (dPriv->x + (X))) * drb->cpp)
+#define GET_PTR(X,Y) (map + (Y)*nrb->pitch + (X)*nrb->cpp)
 #include "spantmp2.h"
 
-static void
-nouveauSpanRenderStart( GLcontext *ctx )
+static void nouveauSpanRenderStart(GLcontext * ctx)
 {
-   nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
-   FIRE_RING();
-   LOCK_HARDWARE(nmesa);
-   nouveauWaitForIdleLocked( nmesa );
+       nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+       FIRE_RING();
+       LOCK_HARDWARE(nmesa);
+       nouveauWaitForIdleLocked(nmesa);
 }
 
-static void
-nouveauSpanRenderFinish( GLcontext *ctx )
+static void nouveauSpanRenderFinish(GLcontext * ctx)
 {
-   nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
-   _swrast_flush( ctx );
-   nouveauWaitForIdleLocked( nmesa );
-   UNLOCK_HARDWARE( nmesa );
+       nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+       _swrast_flush(ctx);
+       nouveauWaitForIdleLocked(nmesa);
+       UNLOCK_HARDWARE(nmesa);
 }
 
-void nouveauSpanInitFunctions( GLcontext *ctx )
+void nouveauSpanInitFunctions(GLcontext * ctx)
 {
-   struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-   swdd->SpanRenderStart       = nouveauSpanRenderStart;
-   swdd->SpanRenderFinish      = nouveauSpanRenderFinish;
+       struct swrast_device_driver *swdd =
+           _swrast_GetDeviceDriverReference(ctx);
+       swdd->SpanRenderStart = nouveauSpanRenderStart;
+       swdd->SpanRenderFinish = nouveauSpanRenderFinish;
 }
 
 
 /**
  * Plug in the Get/Put routines for the given driRenderbuffer.
  */
-void
-nouveauSpanSetFunctions(nouveau_renderbuffer *nrb, const GLvisual *vis)
+void nouveauSpanSetFunctions(nouveau_renderbuffer_t * nrb)
 {
-   if (nrb->mesa._ActualFormat == GL_RGBA8)
-      nouveauInitPointers_ARGB8888(&nrb->mesa);
-   else if (nrb->mesa._ActualFormat == GL_RGB5)
-      nouveauInitPointers_RGB565(&nrb->mesa);
+       if (nrb->mesa._ActualFormat == GL_RGBA8)
+               nouveauInitPointers_ARGB8888(&nrb->mesa);
+       else                    // if (nrb->mesa._ActualFormat == GL_RGB5)
+               nouveauInitPointers_RGB565(&nrb->mesa);
 }