swapbuffers with non-current contexts, cleanups
authorRoland Scheidegger <sroland@tungstengraphics.com>
Wed, 18 Jul 2007 13:18:43 +0000 (15:18 +0200)
committerRoland Scheidegger <sroland@tungstengraphics.com>
Wed, 18 Jul 2007 13:18:43 +0000 (15:18 +0200)
manywin got broken (when intelPageflip got no longer called).
Make sure that intelFlush is getting called when a context gets unbound,
to handle later swapbuffer calls on that context's drawable better.
Related, fix non-current cliprects getting used on unbound drawables.

src/mesa/drivers/dri/i915tex/intel_blit.c
src/mesa/drivers/dri/i915tex/intel_buffers.c
src/mesa/drivers/dri/i915tex/intel_context.c
src/mesa/drivers/dri/i915tex/intel_context.h

index 3ecd2e8e481b9dfbb2d56b32c4ff4cdc44b05559..28441f4b835ae03fab93eabacebd3efef5009ca4 100644 (file)
@@ -78,6 +78,12 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv,
     * should work regardless.
     */
    LOCK_HARDWARE(intel);
+   /* if this drawable isn't currently bound the LOCK_HARDWARE done on the
+      current context (which is what intelScreenContext should return) might
+      not get a contended lock and thus cliprects not updated (tests/manywin) */
+      if ((struct intel_context *)dPriv->driContextPriv->driverPrivate != intel)
+         DRI_VALIDATE_DRAWABLE_INFO(intel->driScreen, dPriv);
+
 
    if (dPriv && dPriv->numClipRects) {
       struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
index bcd99106b9eda9b0cc09d85a5254f5901628f6a0..0ecf3aa1d4d9a1e5d44d3cdebf6f69fed95c2975 100644 (file)
@@ -356,7 +356,8 @@ intelClearWithTris(struct intel_context *intel, GLbitfield mask)
          /* XXX: Using INTEL_BATCH_NO_CLIPRECTS here is dangerous as the
           * drawing origin may not be correctly emitted.
           */
-         intel_meta_draw_quad(intel, clear.x1, clear.x2, clear.y1, clear.y2, intel->ctx.Depth.Clear, clearColor, 0, 0, 0, 0);   /* texcoords */
+         intel_meta_draw_quad(intel, clear.x1, clear.x2, clear.y1, clear.y2,
+                              intel->ctx.Depth.Clear, clearColor, 0, 0, 0, 0);   /* texcoords */
 
          mask &=
             ~(BUFFER_BIT_BACK_LEFT | BUFFER_BIT_STENCIL | BUFFER_BIT_DEPTH);
@@ -991,16 +992,6 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb)
    /**
     ** Release old regions, reference new regions
     **/
-#if 0                           /* XXX FBO: this seems to be redundant with i915_state_draw_region() */
-   if (intel->draw_region != colorRegion) {
-      intel_region_release(&intel->draw_region);
-      intel_region_reference(&intel->draw_region, colorRegion);
-   }
-   if (intel->intelScreen->depth_region != depthRegion) {
-      intel_region_release(&intel->intelScreen->depth_region);
-      intel_region_reference(&intel->intelScreen->depth_region, depthRegion);
-   }
-#endif
 
    intel->vtbl.set_draw_region(intel, colorRegion, depthRegion);
 
index 527b33f4af71935f802e8c1a51ec3776d9a61948..5acfd923b99dd596f76079956f816868691c2605 100644 (file)
@@ -569,6 +569,9 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
 GLboolean
 intelUnbindContext(__DRIcontextPrivate * driContextPriv)
 {
+   struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate;
+   FLUSH_VERTICES((&intel->ctx), 0);
+   intelFlush(&intel->ctx);
    return GL_TRUE;
 }
 
@@ -616,14 +619,16 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
            (*dri_interface->getUST) (&intel_fb->swap_ust);
            driDrawableInitVBlank(driDrawPriv, intel_fb->vblank_flags,
                                  &intel_fb->vbl_seq);
+        }
+      }
+
+      if ((intel->driDrawable != driDrawPriv) ||
+         (intel->lastStamp != driDrawPriv->lastStamp)) {
            intel->driDrawable = driDrawPriv;
            intelWindowMoved(intel);
            intel->lastStamp = driDrawPriv->lastStamp;
-        }
-        else if (intel->lastStamp != driDrawPriv->lastStamp) {
-           intel_draw_buffer(&intel->ctx, &intel_fb->Base);
-        }
       }
+
    }
    else {
       _mesa_make_current(NULL, NULL, NULL);
index 5c8e2777996436e2a11dc1e539cc69bd96ddd1f9..628a15f8de59ce342369bebbd6ac3266705cdd89 100644 (file)
@@ -247,8 +247,6 @@ struct intel_context
    drm_clip_rect_t *pClipRects;
    drm_clip_rect_t fboRect;     /**< cliprect for rendering */
 
-   int perf_boxes;
-
    GLuint do_usleeps;
    int do_irqs;
    GLuint irqsEmitted;