i915: fix vbl swap for multi-master
authorDave Airlie <airlied@linux.ie>
Thu, 8 May 2008 06:14:33 +0000 (16:14 +1000)
committerDave Airlie <airlied@linux.ie>
Thu, 8 May 2008 06:14:33 +0000 (16:14 +1000)
patch from F9 tree

shared-core/i915_irq.c

index 0ee0c44..ea2c88a 100644 (file)
@@ -198,9 +198,6 @@ static void i915_vblank_tasklet(struct drm_device *dev)
                if ((counter[pipe] - vbl_swap->sequence) > (1<<23))
                        continue;
 
-               master_priv = vbl_swap->minor->master->driver_priv;
-               sarea_priv = master_priv->sarea_priv;
-               
                list_del(list);
                dev_priv->swaps_pending--;
                drm_vblank_put(dev, pipe);
@@ -249,16 +246,6 @@ static void i915_vblank_tasklet(struct drm_device *dev)
 
        i915_kernel_lost_context(dev);
 
-       upper[0] = upper[1] = 0;
-       slice[0] = max(sarea_priv->planeA_h / nhits, 1);
-       slice[1] = max(sarea_priv->planeB_h / nhits, 1);
-       lower[0] = sarea_priv->planeA_y + slice[0];
-       lower[1] = sarea_priv->planeB_y + slice[0];
-
-       offsets[0] = sarea_priv->front_offset;
-       offsets[1] = sarea_priv->back_offset;
-       offsets[2] = sarea_priv->third_offset;
-       num_pages = sarea_priv->third_handle ? 3 : 2;
 
        DRM_SPINLOCK(&dev->drw_lock);
 
@@ -272,8 +259,6 @@ static void i915_vblank_tasklet(struct drm_device *dev)
             upper[1] = lower[1], lower[1] += slice[1]) {
                int init_drawrect = 1;
 
-               if (i == nhits)
-                       lower[0] = lower[1] = sarea_priv->height;
 
                list_for_each(hit, &hits) {
                        struct drm_i915_vbl_swap *swap_hit =
@@ -282,6 +267,24 @@ static void i915_vblank_tasklet(struct drm_device *dev)
                        int num_rects, plane, front, back;
                        unsigned short top, bottom;
 
+                       sarea_priv = master_priv->sarea_priv;
+
+                       upper[0] = upper[1] = 0;
+                       slice[0] = max(sarea_priv->planeA_h / nhits, 1);
+                       slice[1] = max(sarea_priv->planeB_h / nhits, 1);
+                       lower[0] = sarea_priv->planeA_y + slice[0];
+                       lower[1] = sarea_priv->planeB_y + slice[0];
+
+                       offsets[0] = sarea_priv->front_offset;
+                       offsets[1] = sarea_priv->back_offset;
+                       offsets[2] = sarea_priv->third_offset;
+                       num_pages = sarea_priv->third_handle ? 3 : 2;
+                       if (i == nhits)
+                               lower[0] = lower[1] = sarea_priv->height;
+
+                       pitchropcpp = (sarea_priv->pitch * cpp) | (0xcc << 16) |
+                                       (cpp << 23) | (1 << 24);
+
                        drw = drm_get_drawable_info(dev, swap_hit->drw_id);
 
                        if (!drw)
@@ -294,6 +297,8 @@ static void i915_vblank_tasklet(struct drm_device *dev)
                                continue;
                        }
 
+                       master_priv = swap_hit->minor->master->driver_priv;
+
                        if (init_drawrect) {
                                int width  = sarea_priv->width;
                                int height = sarea_priv->height;
@@ -332,6 +337,8 @@ static void i915_vblank_tasklet(struct drm_device *dev)
                                 (2 * plane)) & 0x3;
                        back = (front + 1) % num_pages;
 
+               
+
                        for (num_rects = drw->num_rects; num_rects--; rect++) {
                                int y1 = max(rect->y1, top);
                                int y2 = min(rect->y2, bottom);