[Kernelloader-cvs] linux/linux-2.6.35.4-mipsel-ps2/drivers/video ps2fb.c, 1.8, 1.9
Run Linux on the Playstation 2
Brought to you by:
kloader
From: Mega M. <kl...@us...> - 2012-02-07 23:53:58
|
Update of /cvsroot/kernelloader/linux/linux-2.6.35.4-mipsel-ps2/drivers/video In directory vz-cvs-3.sog:/tmp/cvs-serv1268/drivers/video Modified Files: ps2fb.c Log Message: Don't start redraw timer before buffer is mapped by application. This reduces flicker effects. Don't allow to change video mode when buffer is mapped, because the memory will be freed. Without this procedure the can cause a kernel crash. Index: ps2fb.c =================================================================== RCS file: /cvsroot/kernelloader/linux/linux-2.6.35.4-mipsel-ps2/drivers/video/ps2fb.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ps2fb.c 5 Feb 2012 23:01:11 -0000 1.8 --- ps2fb.c 7 Feb 2012 23:53:55 -0000 1.9 *************** *** 44,47 **** --- 44,48 ---- u32 pseudo_palette[256]; u32 opencnt; + int mapped; /* TBD: add members. */ }; *************** *** 197,206 **** par = info->par; if (user) { - if (par->opencnt == 0) { - /* Start timer for redrawing screen, because application could use mmap. */ - redraw_timer.data = (unsigned long) info; - redraw_timer.expires = jiffies + HZ / 50; - add_timer(&redraw_timer); - } par->opencnt++; } --- 198,201 ---- *************** *** 235,238 **** --- 230,234 ---- /* Redrawing shouldn't be needed after closing by application. */ del_timer(&redraw_timer); + par->mapped = 0; } } *************** *** 631,634 **** --- 627,631 ---- static int ps2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { + struct ps2fb_par *par = info->par; int res; *************** *** 690,693 **** --- 687,699 ---- /* TBD: check more parameters? */ + if ((info->var.xres_virtual != var->xres_virtual) || (info->var.yres_virtual != var->yres_virtual)) { + /* Allocated memory will change. */ + /* TBD: Check when virtual memory buffer is supported. */ + if (par->mapped != 0) { + printk("ps2fb: framebuffer must be unmapped before changing mode!\n"); + return -EBUSY; + } + } + return 0; } *************** *** 1058,1061 **** --- 1064,1068 ---- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; unsigned long page, pos; + struct ps2fb_par *par; if (info->fix.smem_start == 0) { *************** *** 1067,1070 **** --- 1074,1081 ---- } + par = info->par; + + /* TBD: Allocate framebuffer only on demand, not in mode changing function? */ + pos = (unsigned long)info->fix.smem_start + offset; /* Framebuffer can't be mapped. Map normal memory instead *************** *** 1089,1092 **** --- 1100,1115 ---- vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */ + + if (par->mapped == 0) { + par->mapped = 1; + + /* Make screen black when mapped the first time. */ + memset((void *) info->fix.smem_start, 0, info->fix.smem_len); + + /* Start timer for redrawing screen, because application could use mmap. */ + redraw_timer.data = (unsigned long) info; + redraw_timer.expires = jiffies + HZ / 50; + add_timer(&redraw_timer); + } return 0; |