]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
xenfb: fix xenfb_update_screen bogus rect
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 28 Jan 2009 13:41:33 +0000 (13:41 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 28 Jan 2009 13:41:33 +0000 (13:41 +0000)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
drivers/xen/fbfront/xenfb.c

index af446ea29eef420f9b6ccf1e193068530e3139c8..a9e4cfcde42e2461a1e1397861d0d808eb14a717 100644 (file)
@@ -213,17 +213,23 @@ static void xenfb_update_screen(struct xenfb_info *info)
        if (xenfb_queue_full(info))
                return;
 
-       mutex_lock(&info->mm_lock);
-
        spin_lock_irqsave(&info->dirty_lock, flags);
-       y1 = info->y1;
-       y2 = info->y2;
-       x1 = info->x1;
-       x2 = info->x2;
-       info->x1 = info->y1 = INT_MAX;
-       info->x2 = info->y2 = 0;
+       if (info->dirty){
+               info->dirty = 0;
+               y1 = info->y1;
+               y2 = info->y2;
+               x1 = info->x1;
+               x2 = info->x2;
+               info->x1 = info->y1 = INT_MAX;
+               info->x2 = info->y2 = 0;
+       } else {
+               spin_unlock_irqrestore(&info->dirty_lock, flags);
+               return;
+       }
        spin_unlock_irqrestore(&info->dirty_lock, flags);
 
+       mutex_lock(&info->mm_lock);
+       
        list_for_each_entry(map, &info->mappings, link) {
                if (!map->faults)
                        continue;
@@ -262,10 +268,7 @@ static int xenfb_thread(void *data)
 
        while (!kthread_should_stop()) {
                xenfb_handle_resize_dpy(info);
-               if (info->dirty) {
-                       info->dirty = 0;
-                       xenfb_update_screen(info);
-               }
+               xenfb_update_screen(info);
                wait_event_interruptible(info->wq,
                        kthread_should_stop() || info->dirty);
                try_to_freeze();
@@ -666,15 +669,6 @@ static int __devinit xenfb_probe(struct xenbus_device *dev,
        if (ret < 0)
                goto error;
 
-       /* FIXME should this be delayed until backend XenbusStateConnected? */
-       info->kthread = kthread_run(xenfb_thread, info, "xenfb thread");
-       if (IS_ERR(info->kthread)) {
-               ret = PTR_ERR(info->kthread);
-               info->kthread = NULL;
-               xenbus_dev_fatal(dev, ret, "register_framebuffer");
-               goto error;
-       }
-
        return 0;
 
  error_nomem:
@@ -839,6 +833,13 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
                                        "feature-resize", "%d", &val) < 0)
                        val = 0;
                info->feature_resize = val;
+
+               info->kthread = kthread_run(xenfb_thread, info, "xenfb thread");
+               if (IS_ERR(info->kthread)) {
+                       info->kthread = NULL;
+                       xenbus_dev_fatal(dev, PTR_ERR(info->kthread),
+                                       "register_framebuffer");
+               }
                break;
 
        case XenbusStateClosing: