FBDEV: Small impact patch for fbdev

FBDEV: Small impact patch for fbdev

Post by Antonino Dapla » Wed, 11 Dec 2002 21:30:17



Hi,

Here's a diff to correct several small things that escaped through the
cracks.

1.  The YNOMOVE scrollmode for non-accelerated drivers is just very slow
because of a lot of block moves (leads to slow and jerky scrolling in
vesafb with ypanning enabled).  Depending on var->accel_flags, set the
scrollmode to either YREDRAW or YNOMOVE. For drivers with hardware
acceleration, set var->accel_flags to nonzero for max speed.

2.  fb_pan_display() always returns an error.  User apps will complain.

3.  case FBIO_GETCMAP in fb_ioctl does not return immediately.  User
apps will complain.

4.  vgastate.c is not saving the correct blocks.

5.  logo drawing for monochrome displays is just incorrect.(alterations
were done by eyeballing only, no hardware for testing).

The above will only have a very small effect on the general state of
fbdev/fbcon.  Patch is against 2.5.51.

Tony

diff -Naur linux-2.5.51/drivers/video/console/fbcon.c linux/drivers/video/console/fbcon.c
--- linux-2.5.51/drivers/video/console/fbcon.c  2002-12-10 21:55:41.000000000 +0000

        struct display *display = fb_display + con;

        display->can_soft_blank = info->fbops->fb_blank ? 1 : 0;
-       display->scrollmode = SCROLL_YNOMOVE;
+       if (info->var.accel_flags)
+               display->scrollmode = SCROLL_YNOMOVE;
+       else
+               display->scrollmode = SCROLL_YREDRAW;
        fbcon_changevar(con);
        return;

        default:
                for (i = 0; i < (LOGO_W * LOGO_H)/8; i++)
                        for (j = 0; j < 8; j++)
-                               logo[i*2] = (linux_logo_bw[i] &  (7 - j)) ?
+                               logo[i*8+j] = (linux_logo_bw[i] &  (7 - j)) ?
                                        ((needs_logo == 1) ? 1 : 0) :
                                        ((needs_logo == 1) ? 0 : 1);

diff -Naur linux-2.5.51/drivers/video/fbmem.c linux/drivers/video/fbmem.c
--- linux-2.5.51/drivers/video/fbmem.c  2002-12-10 21:55:15.000000000 +0000

             yoffset + info->var.yres > info->var.yres_virtual)
                 return -EINVAL;
         if (info->fbops->fb_pan_display) {
-                if ((err = info->fbops->fb_pan_display(var, info)))
-                        return err;
-                else
-                        return -EINVAL;
-        }
+               err = info->fbops->fb_pan_display(var, info);
+               if (err) return err;
+       }
         info->var.xoffset = var->xoffset;
         info->var.yoffset = var->yoffset;

                if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
                        return -EFAULT;
                fb_copy_cmap(&info->cmap, &cmap, 0);
+               return 0;
        case FBIOPAN_DISPLAY:
                if (copy_from_user(&var, (void *) arg, sizeof(var)))
                        return -EFAULT;
diff -Naur linux-2.5.51/drivers/video/vgastate.c linux/drivers/video/vgastate.c
--- linux-2.5.51/drivers/video/vgastate.c       2002-12-10 21:55:20.000000000 +0000

                vga_wgfx(state->vgabase, VGA_GFX_MODE, 0x0);
                vga_wgfx(state->vgabase, VGA_GFX_MISC, 0x5);
                for (i = 0; i < 8192; i++)
-                       saved->vga_text[i] = vga_r(fbbase + 2 * 8192, i);
+                       saved->vga_text[8192+i] = vga_r(fbbase, i);
        }


                vga_wgfx(state->vgabase, VGA_GFX_PLANE_READ, 0x3);
                vga_wgfx(state->vgabase, VGA_GFX_MODE, 0x0);
                vga_wgfx(state->vgabase, VGA_GFX_MISC, 0x5);
-               for (i = 0; i < 4 * 8192; i++)
+               for (i = 0; i < state->memsize; i++)
                        vga_w(fbbase, i, saved->vga_font1[i]);
        }

                vga_wgfx(state->vgabase, VGA_GFX_MODE, 0x0);
                vga_wgfx(state->vgabase, VGA_GFX_MISC, 0x5);
                for (i = 0; i < 8192; i++)
-                       vga_w(fbbase + 2 * 8192, i,
-                             saved->vga_text[i]);
+                       vga_w(fbbase, i, saved->vga_text[8192+i]);
        }

        /* unblank screen */

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

FBDEV: Small impact patch for fbdev

Post by James Simmon » Thu, 12 Dec 2002 07:10:06


Quote:> Here's a diff to correct several small things that escaped through the
> cracks.

Ug. Now that a wider test base is being done and more drivers actually
compile we are going to see more cracks.

Quote:> 1.  The YNOMOVE scrollmode for non-accelerated drivers is just very slow
> because of a lot of block moves (leads to slow and jerky scrolling in
> vesafb with ypanning enabled).  Depending on var->accel_flags, set the
> scrollmode to either YREDRAW or YNOMOVE. For drivers with hardware
> acceleration, set var->accel_flags to nonzero for max speed.

Thanks. I have had several emails complementing the speed improvements.
Another speed boost will be a plus.

Quote:> 2.  fb_pan_display() always returns an error.  User apps will complain.

Fixed. Actually I used the following code.

int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
{
        int xoffset = var->xoffset;
        int yoffset = var->yoffset;
        int err;

        if (xoffset < 0 || yoffset < 0 || info->fbops->fb_pan_display ||
            xoffset + info->var.xres > info->var.xres_virtual ||
            yoffset + info->var.yres > info->var.yres_virtual)
                return -EINVAL;
        if ((err = info->fbops->fb_pan_display(var, info)))
                return err;
        info->var.xoffset = var->xoffset;
        info->var.yoffset = var->yoffset;
        if (var->vmode & FB_VMODE_YWRAP)

instead. The reason is I didn't like the idea of xoffset and yoffset being
changed even if the hardware panning function failed. Comments?

Quote:> 3.  case FBIO_GETCMAP in fb_ioctl does not return immediately.  User
> apps will complain.

Fixed.

Quote:> 4.  vgastate.c is not saving the correct blocks.

Fixed.

Quote:> 5.  logo drawing for monochrome displays is just incorrect.(alterations
> were done by eyeballing only, no hardware for testing).

Will test on hgafb driver.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

FBDEV: Small impact patch for fbdev

Post by Antonino Dapla » Thu, 12 Dec 2002 10:00:12



> > Here's a diff to correct several small things that escaped through the
> > cracks.

> Ug. Now that a wider test base is being done and more drivers actually
> compile we are going to see more cracks.

> > 1.  The YNOMOVE scrollmode for non-accelerated drivers is just very slow
> > because of a lot of block moves (leads to slow and jerky scrolling in
> > vesafb with ypanning enabled).  Depending on var->accel_flags, set the
> > scrollmode to either YREDRAW or YNOMOVE. For drivers with hardware
> > acceleration, set var->accel_flags to nonzero for max speed.

I think the scrollmode is better determined on a case-to-case basis, but
the above should be a good enough differentiation.

Quote:> Thanks. I have had several emails complementing the speed improvements.
> Another speed boost will be a plus.

Yes, probably not much at low pixel depths, but at high pixel depths and
resolutions, 2.5 should be much better than 2.4 (even 2-3x faster in
some cases).  And for drivers with hardware acceleration, whatever the
color depth, it will be much better because they were written
specifically for them.

Personally, the performance gain is just a minor side-effect. The
greatest benefit in all this is the separation of the fbdev-fbcon
structure into components, where each component has a defined use and
function, and very much independent of each other.  This really makes it
easier to understand the code, port or write drivers too it, write
smaller and more efficient code, and even debug.  And you basically did
all this, so great job :-)  

 > > 2.  fb_pan_display() always returns an error.  User apps will
complain.

Quote:

> Fixed. Actually I used the following code.

> int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
> {
>         int xoffset = var->xoffset;
>         int yoffset = var->yoffset;
>         int err;

>         if (xoffset < 0 || yoffset < 0 || info->fbops->fb_pan_display ||
>             xoffset + info->var.xres > info->var.xres_virtual ||
>             yoffset + info->var.yres > info->var.yres_virtual)
>                 return -EINVAL;
>         if ((err = info->fbops->fb_pan_display(var, info)))
>                 return err;
>         info->var.xoffset = var->xoffset;
>         info->var.yoffset = var->yoffset;
>         if (var->vmode & FB_VMODE_YWRAP)

> instead. The reason is I didn't like the idea of xoffset and yoffset being
> changed even if the hardware panning function failed. Comments?

Yes, I think thats better.

Tony

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

FBDEV: Small impact patch for fbdev

Post by Petr Vandrove » Thu, 12 Dec 2002 14:30:14



Quote:> Fixed. Actually I used the following code.

> int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
> {
>         int xoffset = var->xoffset;
>         int yoffset = var->yoffset;
>         int err;

>         if (xoffset < 0 || yoffset < 0 || info->fbops->fb_pan_display ||

I'm probably missing something important, but do not you want
                                           !info->fbops->fb_pan_display
instead?
                                                            Petr

Quote:>             xoffset + info->var.xres > info->var.xres_virtual ||
>             yoffset + info->var.yres > info->var.yres_virtual)
>                 return -EINVAL;
>         if ((err = info->fbops->fb_pan_display(var, info)))
>                 return err;
>         info->var.xoffset = var->xoffset;
>         info->var.yoffset = var->yoffset;
>         if (var->vmode & FB_VMODE_YWRAP)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
 
 
 

FBDEV: Small impact patch for fbdev

Post by James Simmon » Thu, 12 Dec 2002 16:00:09


Quote:> > int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
> > {
> >         int xoffset = var->xoffset;
> >         int yoffset = var->yoffset;
> >         int err;

> >         if (xoffset < 0 || yoffset < 0 || info->fbops->fb_pan_display ||

> I'm probably missing something important, but do not you want
>                                            !info->fbops->fb_pan_display
> instead?

Oops. Typo to the screen. That wasn't commited :-)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
 
 

1. [Linux-fbdev-devel] [PATCH] FBDev: vga16fb port

FYI, I'm going to unsubscribe myself from linux-fbdev-devel.
I'm not interested in reading messages on list which is not public:
I get again an error that my message is waiting for moderator approval,
and as such list is unsuitable for any realtime discussion.

If you want to discuss matroxfb specific things, enhandcements, or
bugreports, please do it on linux-kernel, or with me personally.
                                                    Bye,
                                                        Petr Vandrovec

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. 2.4.19rc2 -> 2.4.19rc3 : no more eth

3. 2.5.66 fbdev performance (was Re: Re: FBdev updates)

4. Help! XF86Config ?!

5. To FBDEV or not to FBDEV ?

6. What does /dev/ksyms do?

7. [PATCh} FBDev: rivafb port

8. Xsun is soaking 95% of CPU useage

9. Fbdev patch

10. [PATCH][FBDEV]: Setting fbcon's windows size

11. [RFC][PATCH][FBDEV]: Setting fbcon's windows size

12. FBDEV patch for testing.

13. [PATCH 1/3: FBDEV: VGA State Save/Restore module