ia64/linux-2.6.18-xen.hg

changeset 783:c9783c08495c

xenfb: fix xenfb_update_screen bogus rect
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jan 28 13:41:33 2009 +0000 (2009-01-28)
parents 83b71f4b5cb2
children 51decc39e5e7
files drivers/xen/fbfront/xenfb.c
line diff
     1.1 --- a/drivers/xen/fbfront/xenfb.c	Tue Jan 20 13:28:35 2009 +0000
     1.2 +++ b/drivers/xen/fbfront/xenfb.c	Wed Jan 28 13:41:33 2009 +0000
     1.3 @@ -213,17 +213,23 @@ static void xenfb_update_screen(struct x
     1.4  	if (xenfb_queue_full(info))
     1.5  		return;
     1.6  
     1.7 -	mutex_lock(&info->mm_lock);
     1.8 -
     1.9  	spin_lock_irqsave(&info->dirty_lock, flags);
    1.10 -	y1 = info->y1;
    1.11 -	y2 = info->y2;
    1.12 -	x1 = info->x1;
    1.13 -	x2 = info->x2;
    1.14 -	info->x1 = info->y1 = INT_MAX;
    1.15 -	info->x2 = info->y2 = 0;
    1.16 +	if (info->dirty){
    1.17 +		info->dirty = 0;
    1.18 +		y1 = info->y1;
    1.19 +		y2 = info->y2;
    1.20 +		x1 = info->x1;
    1.21 +		x2 = info->x2;
    1.22 +		info->x1 = info->y1 = INT_MAX;
    1.23 +		info->x2 = info->y2 = 0;
    1.24 +	} else {
    1.25 +		spin_unlock_irqrestore(&info->dirty_lock, flags);
    1.26 +		return;
    1.27 +	}
    1.28  	spin_unlock_irqrestore(&info->dirty_lock, flags);
    1.29  
    1.30 +	mutex_lock(&info->mm_lock);
    1.31 +	
    1.32  	list_for_each_entry(map, &info->mappings, link) {
    1.33  		if (!map->faults)
    1.34  			continue;
    1.35 @@ -262,10 +268,7 @@ static int xenfb_thread(void *data)
    1.36  
    1.37  	while (!kthread_should_stop()) {
    1.38  		xenfb_handle_resize_dpy(info);
    1.39 -		if (info->dirty) {
    1.40 -			info->dirty = 0;
    1.41 -			xenfb_update_screen(info);
    1.42 -		}
    1.43 +		xenfb_update_screen(info);
    1.44  		wait_event_interruptible(info->wq,
    1.45  			kthread_should_stop() || info->dirty);
    1.46  		try_to_freeze();
    1.47 @@ -666,15 +669,6 @@ static int __devinit xenfb_probe(struct 
    1.48  	if (ret < 0)
    1.49  		goto error;
    1.50  
    1.51 -	/* FIXME should this be delayed until backend XenbusStateConnected? */
    1.52 -	info->kthread = kthread_run(xenfb_thread, info, "xenfb thread");
    1.53 -	if (IS_ERR(info->kthread)) {
    1.54 -		ret = PTR_ERR(info->kthread);
    1.55 -		info->kthread = NULL;
    1.56 -		xenbus_dev_fatal(dev, ret, "register_framebuffer");
    1.57 -		goto error;
    1.58 -	}
    1.59 -
    1.60  	return 0;
    1.61  
    1.62   error_nomem:
    1.63 @@ -839,6 +833,13 @@ static void xenfb_backend_changed(struct
    1.64  					"feature-resize", "%d", &val) < 0)
    1.65  			val = 0;
    1.66  		info->feature_resize = val;
    1.67 +
    1.68 +		info->kthread = kthread_run(xenfb_thread, info, "xenfb thread");
    1.69 +		if (IS_ERR(info->kthread)) {
    1.70 +			info->kthread = NULL;
    1.71 +			xenbus_dev_fatal(dev, PTR_ERR(info->kthread),
    1.72 +					"register_framebuffer");
    1.73 +		}
    1.74  		break;
    1.75  
    1.76  	case XenbusStateClosing: