i965: Don't emit register spill offsets directly into g0.
[mesa.git] / src / mesa / drivers / dri / unichrome / via_ioctl.c
index 3c7dafd0e6baaa2777e5c785921fea3ef3e44c96..116adda18ea2d74168acd2461a2199cefc3f89a7 100644 (file)
 #include <stdio.h>
 #include <unistd.h>
 
-#include "glheader.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "dd.h"
+#include "main/glheader.h"
+#include "main/mtypes.h"
+#include "main/macros.h"
+#include "main/dd.h"
 #include "swrast/swrast.h"
 
-#include "mm.h"
+#include "main/mm.h"
 #include "via_context.h"
 #include "via_tris.h"
 #include "via_ioctl.h"
-#include "via_state.h"
 #include "via_fb.h"
 #include "via_3d_reg.h"
 
@@ -202,10 +201,10 @@ static void viaFillBuffer(struct via_context *vmesa,
 
 
 
-static void viaClear(GLcontext *ctx, GLbitfield mask)
+static void viaClear(struct gl_context *ctx, GLbitfield mask)
 {
    struct via_context *vmesa = VIA_CONTEXT(ctx);
-   __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
+   __DRIdrawable *dPriv = vmesa->driDrawable;
    struct via_renderbuffer *const vrb = 
      (struct via_renderbuffer *) dPriv->driverPrivate;
    int flag = 0;
@@ -507,11 +506,12 @@ void viaWaitIdleLocked( struct via_context *vmesa, GLboolean light )
  * except that WAIT_IDLE() will spin the CPU polling, while this is
  * IRQ driven.
  */
-static void viaWaitIdleVBlank(  __DRIdrawablePrivate *dPriv, 
+static void viaWaitIdleVBlank(  __DRIdrawable *dPriv, 
                               struct via_context *vmesa,
                               GLuint value )
 {
    GLboolean missed_target;
+   __DRIscreen *psp = dPriv->driScreenPriv;
 
    VIA_FLUSH_DMA(vmesa); 
 
@@ -523,11 +523,10 @@ static void viaWaitIdleVBlank(  __DRIdrawablePrivate *dPriv,
          vmesa->thrashing)
         viaSwapOutWork(vmesa);
 
-      driWaitForVBlank( dPriv, & dPriv->vblSeq, dPriv->vblFlags,
-                       & missed_target );
+      driWaitForVBlank( dPriv, & missed_target );
       if ( missed_target ) {
         vmesa->swap_missed_count++;
-        (*dri_interface->getUST)( &vmesa->swap_missed_ust );
+        (*psp->systemTime->getUST)( &vmesa->swap_missed_ust );
       }
    } 
    while (!viaCheckBreadcrumb(vmesa, value));   
@@ -591,10 +590,11 @@ void viaResetPageFlippingLocked(struct via_context *vmesa)
 /*
  * Copy the back buffer to the front buffer. 
  */
-void viaCopyBuffer(__DRIdrawablePrivate *dPriv)
+void viaCopyBuffer(__DRIdrawable *dPriv)
 {
    struct via_context *vmesa = 
       (struct via_context *)dPriv->driContextPriv->driverPrivate;
+   __DRIscreen *psp = dPriv->driScreenPriv;
 
    if (VIA_DEBUG & DEBUG_IOCTL)
       fprintf(stderr, 
@@ -630,15 +630,16 @@ void viaCopyBuffer(__DRIdrawablePrivate *dPriv)
    viaEmitBreadcrumbLocked(vmesa);
    UNLOCK_HARDWARE(vmesa);
 
-   (*dri_interface->getUST)( &vmesa->swap_ust );
+   (*psp->systemTime->getUST)( &vmesa->swap_ust );
 }
 
 
-void viaPageFlip(__DRIdrawablePrivate *dPriv)
+void viaPageFlip(__DRIdrawable *dPriv)
 {
     struct via_context *vmesa = 
        (struct via_context *)dPriv->driContextPriv->driverPrivate;
     struct via_renderbuffer buffer_tmp;
+    __DRIscreen *psp = dPriv->driScreenPriv;
 
     VIA_FLUSH_DMA(vmesa);
    if (dPriv->vblFlags == VBLANK_FLAG_SYNC &&
@@ -654,7 +655,7 @@ void viaPageFlip(__DRIdrawablePrivate *dPriv)
     viaEmitBreadcrumbLocked(vmesa);
     UNLOCK_HARDWARE(vmesa);
 
-    (*dri_interface->getUST)( &vmesa->swap_ust );
+    (*psp->systemTime->getUST)( &vmesa->swap_ust );
 
 
     /* KW: FIXME: When buffers are freed, could free frontbuffer by
@@ -756,6 +757,8 @@ static void via_emit_cliprect(struct via_context *vmesa,
    vb[0] = HC_HEADER2;
    vb[1] = (HC_ParaType_NotTex << 16);
 
+   assert(vmesa->driDrawable);
+
    if (vmesa->driDrawable->w == 0 || vmesa->driDrawable->h == 0) {
       vb[2] = (HC_SubA_HClipTB << 24) | 0x0;
       vb[3] = (HC_SubA_HClipLR << 24) | 0x0;
@@ -883,9 +886,6 @@ void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags)
    }
    else if (vmesa->numClipRects) {
       drm_clip_rect_t *pbox = vmesa->pClipRects;
-      __DRIdrawablePrivate *dPriv = vmesa->driDrawable;
-      struct via_renderbuffer *const vrb = 
-       (struct via_renderbuffer *) dPriv->driverPrivate;
 
       for (i = 0; i < vmesa->numClipRects; i++) {
         drm_clip_rect_t b;
@@ -951,25 +951,25 @@ void viaFlushDma(struct via_context *vmesa)
    }
 }
 
-static void viaFlush(GLcontext *ctx)
+static void viaFlush(struct gl_context *ctx)
 {
     struct via_context *vmesa = VIA_CONTEXT(ctx);
     VIA_FLUSH_DMA(vmesa);
 }
 
-static void viaFinish(GLcontext *ctx)
+static void viaFinish(struct gl_context *ctx)
 {
     struct via_context *vmesa = VIA_CONTEXT(ctx);
     VIA_FLUSH_DMA(vmesa);
     viaWaitIdle(vmesa, GL_FALSE);
 }
 
-static void viaClearStencil(GLcontext *ctx,  int s)
+static void viaClearStencil(struct gl_context *ctx,  int s)
 {
     return;
 }
 
-void viaInitIoctlFuncs(GLcontext *ctx)
+void viaInitIoctlFuncs(struct gl_context *ctx)
 {
     ctx->Driver.Flush = viaFlush;
     ctx->Driver.Clear = viaClear;