intel: Remove redundant fields from struct intel_context
authorKristian Høgsberg <krh@bitplanet.net>
Tue, 30 Mar 2010 18:32:10 +0000 (14:32 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 30 Mar 2010 20:48:51 +0000 (16:48 -0400)
All these pointers are in the __DRIcontext struct, which we point to.

src/mesa/drivers/dri/i915/i915_state.c
src/mesa/drivers/dri/i915/intel_tris.c
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_context.h

index 7275617a6fb98bdcca011b88c643fe8625c632d6..91b228d52b9e62a677970b3e9dc3747bc9b2f6f7 100644 (file)
@@ -374,7 +374,7 @@ intelCalcViewport(GLcontext * ctx)
    else {
       /* window buffer, y=0=top */
       yScale = -1.0;
-      yBias = (intel->driDrawable) ? intel->driDrawable->h : 0.0F;
+      yBias = ctx->DrawBuffer->Height;
    }
 
    m[MAT_SX] = v[MAT_SX];
index 81c4adeaf34e44b2675107e3496fd77093863180..9449a158dc6695273e587ba9aca49475afec5c70 100644 (file)
@@ -488,9 +488,9 @@ intel_wpos_triangle(struct intel_context *intel,
    __memcpy(v1_wpos, v1, size);
    __memcpy(v2_wpos, v2, size);
 
-   v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h;
-   v1_wpos[1] = -v1_wpos[1] + intel->driDrawable->h;
-   v2_wpos[1] = -v2_wpos[1] + intel->driDrawable->h;
+   v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height;
+   v1_wpos[1] = -v1_wpos[1] + intel->ctx.DrawBuffer->Height;
+   v2_wpos[1] = -v2_wpos[1] + intel->ctx.DrawBuffer->Height;
 
 
    intel_draw_triangle(intel, v0, v1, v2);
@@ -509,8 +509,8 @@ intel_wpos_line(struct intel_context *intel,
    __memcpy(v0_wpos, v0, size);
    __memcpy(v1_wpos, v1, size);
 
-   v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h;
-   v1_wpos[1] = -v1_wpos[1] + intel->driDrawable->h;
+   v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height;
+   v1_wpos[1] = -v1_wpos[1] + intel->ctx.DrawBuffer->Height;
 
    intel_draw_line(intel, v0, v1);
 }
@@ -524,7 +524,7 @@ intel_wpos_point(struct intel_context *intel, intelVertexPtr v0)
    GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset);
 
    __memcpy(v0_wpos, v0, size);
-   v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h;
+   v0_wpos[1] = -v0_wpos[1] + intel->ctx.DrawBuffer->Height;
 
    intel_draw_point(intel, v0);
 }
index 5289e954dbd51cc0ca3631912044a9a07a4a7b5e..176f32f3aa776948a9700505994a3547ea9f1493 100644 (file)
@@ -389,7 +389,7 @@ intel_prepare_render(struct intel_context *intel)
    __DRIcontext *driContext = intel->driContext;
    __DRIdrawable *drawable;
 
-   drawable = intel->driDrawable;
+   drawable = driContext->driDrawablePriv;
    if (drawable->dri2.stamp != driContext->dri2.draw_stamp) {
       if (drawable->lastStamp != drawable->dri2.stamp)
         intel_update_renderbuffers(driContext, drawable);
@@ -397,7 +397,7 @@ intel_prepare_render(struct intel_context *intel)
       driContext->dri2.draw_stamp = drawable->dri2.stamp;
    }
 
-   drawable = intel->driReadDrawable;
+   drawable = driContext->driReadablePriv;
    if (drawable->dri2.stamp != driContext->dri2.read_stamp) {
       if (drawable->lastStamp != drawable->dri2.stamp)
         intel_update_renderbuffers(driContext, drawable);
@@ -472,6 +472,7 @@ void
 intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
 {
    struct intel_context *intel = intel_context(ctx);
+    __DRIcontext *driContext = intel->driContext;
 
    if (intel->Fallback)
       _swrast_flush(ctx);
@@ -488,9 +489,10 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
       if (screen->dri2.loader &&
           (screen->dri2.loader->base.version >= 2)
          && (screen->dri2.loader->flushFrontBuffer != NULL) &&
-          intel->driDrawable && intel->driDrawable->loaderPrivate) {
-        (*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable,
-                                                 intel->driDrawable->loaderPrivate);
+          driContext->driDrawablePriv &&
+         driContext->driDrawablePriv->loaderPrivate) {
+        (*screen->dri2.loader->flushFrontBuffer)(driContext->driDrawablePriv,
+                                                 driContext->driDrawablePriv->loaderPrivate);
 
         /* Only clear the dirty bit if front-buffer rendering is no longer
          * enabled.  This is done so that the dirty bit can only be set in
@@ -607,7 +609,6 @@ intelInitContext(struct intel_context *intel,
 
    driContextPriv->driverPrivate = intel;
    intel->intelScreen = intelScreen;
-   intel->driScreen = sPriv;
    intel->driContext = driContextPriv;
    intel->driFd = sPriv->fd;
 
@@ -636,8 +637,7 @@ intelInitContext(struct intel_context *intel,
    }
 
    driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
-                       intel->driScreen->myNum,
-                      (intel->gen >= 4) ? "i965" : "i915");
+                       sPriv->myNum, (intel->gen >= 4) ? "i965" : "i915");
    if (intelScreen->deviceID == PCI_CHIP_I865_G)
       intel->maxBatchSize = 4096;
    else
@@ -845,14 +845,6 @@ intelDestroyContext(__DRIcontext * driContextPriv)
 GLboolean
 intelUnbindContext(__DRIcontext * driContextPriv)
 {
-   struct intel_context *intel =
-      (struct intel_context *) driContextPriv->driverPrivate;
-
-   /* Deassociate the context with the drawables.
-    */
-   intel->driDrawable = NULL;
-   intel->driReadDrawable = NULL;
-
    return GL_TRUE;
 }
 
@@ -881,8 +873,6 @@ intelMakeCurrent(__DRIcontext * driContextPriv,
       struct gl_framebuffer *fb = driDrawPriv->driverPrivate;
       struct gl_framebuffer *readFb = driReadPriv->driverPrivate;
 
-      intel->driReadDrawable = driReadPriv;
-      intel->driDrawable = driDrawPriv;
       driContextPriv->dri2.draw_stamp = driDrawPriv->dri2.stamp - 1;
       driContextPriv->dri2.read_stamp = driReadPriv->dri2.stamp - 1;
       intel_prepare_render(intel);
index 6a68c903ee0f00e6e3d941168ef3de8c254842f2..c4bb2bed8e0a72cbba4c58be4280f8e95875309c 100644 (file)
@@ -243,9 +243,6 @@ struct intel_context
    int driFd;
 
    __DRIcontext *driContext;
-   __DRIdrawable *driDrawable;
-   __DRIdrawable *driReadDrawable;
-   __DRIscreen *driScreen;
    struct intel_screen *intelScreen;
 
    /**