Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NfW9G-0003B3-BZ for mharc-grub-devel@gnu.org; Thu, 11 Feb 2010 05:19:50 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfW9E-0003Ay-OC for grub-devel@gnu.org; Thu, 11 Feb 2010 05:19:48 -0500 Received: from [199.232.76.173] (port=51661 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfW9D-0003Aq-2l for grub-devel@gnu.org; Thu, 11 Feb 2010 05:19:47 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfW9C-0004GR-2P for grub-devel@gnu.org; Thu, 11 Feb 2010 05:19:46 -0500 Received: from fg-out-1718.google.com ([72.14.220.159]:6157) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfW9B-0004GL-7w for grub-devel@gnu.org; Thu, 11 Feb 2010 05:19:45 -0500 Received: by fg-out-1718.google.com with SMTP id l26so261362fgb.12 for ; Thu, 11 Feb 2010 02:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to :content-type:content-transfer-encoding; bh=zZCCtEKg/8aFQkK0tVM7z7fxy/czxJC6idVsMDBtuv4=; b=mHgneEir4aHKOj7TeAqG1+5/4HCyxLB6HXc83Xf1uKjizafInTgcJPfSXQ+bA+6lW9 vuA8+Zr4De7AVWyAtkyMhpPbohhH3k5hpwazYqj6wQw/nC7eNoGGnRyzgpw17VMpZQXh iqMvsBhGgY1HPRWv8zQuQ3F3WiSYhyvU6V/uA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type :content-transfer-encoding; b=lWxvmYihhCs9UcTERAc0AuE0L/Ox+1oSGIrpQEQ8Of9IN/+fjVJ4tT7Oh5JobvwJuX T4BK5Q94AVWd7HgZpBoSRIi4Od5BRubwdM5rkRTc0OdF5nMZ6bHkM7Gdh9n+D0CuS0Nq 5+s+I6LhbqbxmmJdnyzqcuAryIGX07z8lJvEs= MIME-Version: 1.0 Sender: hramrach@gmail.com Received: by 10.239.155.1 with SMTP id g1mr173052hbc.88.1265883584204; Thu, 11 Feb 2010 02:19:44 -0800 (PST) In-Reply-To: <4B736F82.7010005@gmail.com> References: <4B736F82.7010005@gmail.com> From: Michal Suchanek Date: Thu, 11 Feb 2010 11:19:24 +0100 X-Google-Sender-Auth: 1032b6c5c505b506 Message-ID: To: The development of GNU GRUB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: [RFC] Framebuffer rotation patch X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Feb 2010 10:19:49 -0000 2010/2/11 Vladimir '=CF=86-coder/phcoder' Serbinenko : > Michal Suchanek wrote: >> Hello >> >> Sending a preliminary framebuffer rotation patch. >> >> You can use videotest to see 4 tiles rotated from the same bitmap data. >> >> > +char leaf_data[] =3D { 0x00, 0x0f, 0xe0, 0x00, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0= x00, 0x7f, 0xfc, 0x00, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0= x01, 0xff, 0xff, 0x00, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0= x03, 0xff, 0xff, 0x80, > This is a blob. Could it be generated automatically at build time? How less of a blob it would be if it was included as a bitmap? This is just a shape used for the video tests. There are some X tools for working with bitmaps/pixmaps which could generate this from a viewable file but they are usually not available on Windows and other non-X platforms AFAIK. > + > + =C2=A0sans =3D grub_font_get ("Helvetica Bold 14"); > Please use free font rather than Helvetica I am pretty sure I did not choose the fonts, they must have been there before I started with modifications to the tests. > Could you split addition of videotests from the rest of the patch? > - =C2=A0 =C2=A0unsigned int x; > - =C2=A0 =C2=A0unsigned int y; > - =C2=A0 =C2=A0unsigned int width; > - =C2=A0 =C2=A0unsigned int height; > + =C2=A0 =C2=A0int x; > + =C2=A0 =C2=A0int y; > + =C2=A0 =C2=A0int width; > + =C2=A0 =C2=A0int height; > Why do you need negative values? I don't need the negative values everywhere but this change was to align the typing so that casts are not required. > +/* Supported operations are simple and easy to understand. > + * MIRROR =C2=A0| =C2=A0swap image across (around) the vertical axis > + * FLIP =C2=A0 =C2=A0- =C2=A0swap image across the horizontal axis - ups= ide down > + * SWAP =C2=A0 =C2=A0/ =C2=A0swap image across the x=3Dy axis - swap the= x and y coordinates > It's just a D_8 group. Could you add a comment to functions what they do > in group theoretical sense? It would make the code easier to follow and Obviously it is a group, any set of transforms closed on composition is. And according to Wikipedia it's actually called D4. > compute transformations for mathematicians. Perhaps another > representation of D_8 would result in more efficient code? If you have clearer explanation or more efficient code please share. > +static inline void grub_swap_int(int *a, int *b) { int tmp =3D *a; *a = =3D > *b; *b =3D tmp; } > +static inline void grub_swap_unsigned(unsigned *a, unsigned *b) { > unsigned tmp =3D *a; *a =3D *b; *b =3D tmp; } > + > With typeof macro this can be made type-neutral avoiding potential mistak= es. OK, I will look at typeof. > +static inline long > +grub_min (long x, long y) > +{ > + =C2=A0if (x > y) > + =C2=A0 =C2=A0return y; > + =C2=A0else > + =C2=A0 =C2=A0return x; > +} > + > Same here > + > + =C2=A0int transform; > I would prefer an enum This is a bit field. How does it transform into an enum? > Skipping term/gfxterm.c since it has to be adjusted for gfxmenu-related > gfxterm.c updates. > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 set_pixel (dst, x + i, y + j, dst_color); > - =C2=A0 =C2=A0 =C2=A0 } > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (transform & FB_TRAN_SWAP) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0set_pixel (dst, x + j*dy, y + = i*dx, dst_color); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0set_pixel (dst, x + i*dx, y + = j*dy, dst_color); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0} > Could you split it into 4 functions? I understand it's the slow fallback > function but still it should be kept as fast as possible. Perhaps you > could consider compiling same file with different #define's to obtain > function variants I would rather get a patch with minimal changes first so that it's obvious what it does. I can look into separating this later. > =C2=A0grub_err_t > -grub_video_fb_set_viewport (unsigned int x, unsigned int y, > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 unsigned int width, unsigned int height) > +grub_video_fb_set_viewport (int x, int y, int width, int height) > =C2=A0{ > You don't check for x < 0 and y < 0 Indeed, should check for those. >> Known issues: >> >> - font glyphs and terminal do not rotate properly This should be working already. Thanks Michal