[patch] bbsplash

Denys Vlasenko vda.linux at googlemail.com
Wed Mar 26 06:18:56 PDT 2008


On Tuesday 25 March 2008 08:47, Michele Sanges wrote:
> please, can you consider the bbsplash patch I sent on march 7.
> I try to resend it.

Sorry for the delay.

+// BUG: can go into infinite loop.
+// Imagine a file with the following contents: "P6 123"

This had to be addressed! Grrr

                if (strlen(head) + strlen(s) >= sizeof(head))
                        exit(3);
...and user have no idea why it doesn't work...


                        fread(pix, 1, 3, G.theme_file);
error check?

+static void fb_drawfullrectangle(int nx1pos, int ny1pos, int nx2pos, int ny2pos,
+       unsigned char nred, unsigned char ngreen, unsigned char nblue)
+{
...
+       cnt1 = ny2pos - ny1pos;
+       nypos = ny1pos;
+       do {
+               ptr = (DATA*)(G.addr + (nypos * G.screen_infovar.xres + nx1pos) * BYTES_PER_PIXEL);
+               cnt2 = nx2pos - nx1pos;
+               do {
+                       *ptr++ = thispix;
+               } while (--cnt2 >= 0);
+
+               nypos++;
+       } while(--cnt1 >= 0);

Now it looks much better!

                for (i = 1; i < (G.nbar_height - 1); i++)
                        fb_drawfullrectangle(
                                        G.nbar_posx + 1,
                                        G.nbar_posy + i,
                                        G.nbar_posx + 1 + (G.nbar_width - 2)*nPercent/100,
                                        G.nbar_posy + (i+1),
                                        200-(100*(i-1))/(G.nbar_height - 2),
                                        200-(100*(i-1))/(G.nbar_height - 2),
                                        200-(100*(i-1))/(G.nbar_height - 2));

And this does NOT look better. Comments would be nice here.
And it can divide by zero...

+                       fread(pix, 1, 3, G.theme_file);

This was making it slow. Zillions of 3-byte reads...
with this fixed, it finally works as expected -
displays 640x480 image in qemu in a blink of an eye.

I edited it a lot and going to apply attached patch to svn.

NB: I renamed it "fbsplash", and changed command line handling.
If fifo is not specified, there will be no fifo at all.
If fifo is "-", stdin is used. fifo is not created -
user have to use mkfifo first if they need it.
There is no default ini file now. Added option "-s IMAGEFILE",
so that it can be used just for displaying an image on fb dev.

Debug output file will be created in /tmp, not /dev.

Now we need testers with real small and slow embedded devices.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.patch
Type: text/x-diff
Size: 16874 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20080326/a0a485a6/attachment-0001.patch 


More information about the busybox mailing list