From: Colin D Bennett <colin@gibibit.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] GSoC #07 VBE double buffering (vs r1885)
Date: Sun, 5 Oct 2008 09:16:59 -0700 [thread overview]
Message-ID: <20081005091659.78e70113@gibibit.com> (raw)
In-Reply-To: <48E88038.6090201@nic.fi>
[-- Attachment #1: Type: text/plain, Size: 3158 bytes --]
On Sun, 05 Oct 2008 11:52:08 +0300
Vesa J____skel__inen <chaac@nic.fi> wrote:
> Colin D Bennett wrote:
> > Clean patch against trunk SVN revision 1885.
> >
> > Regards,
> > Colin
>
> Thanks for the re-base.
>
> In your opinion how should rendering of double buffered screen be
> different from single buffered?
>
> Eg. who is responsible to handle those differences?
>
> Thanks,
> Vesa J__skel_inen
Generally, the client code should (IMO) do the following, which will
work for both a double-buffered and a non-double-buffered video mode:
(by 'client', I mean the code that is using the video API)
// Render the graphical elements to the back buffer.
grub_video_fill_rect (...);
grub_video_draw_string (...);
grub_video_blit_bitmap (...);
// Make the back buffer contents visible.
grub_video_swap_buffers (); // NOP in single buffered mode
For double buffered mode, this properly renders the graphics using
double buffering. For non double buffered mode, the "back buffer" and
the "front buffer" are one and the same, and the 'swap_buffers'
operation does nothing.
I think the main difference between rendering to a single buffered
versus a double buffered screen is the fact that when rendering using
single buffering, the client code can update only the changed parts of
the screen, but for double buffering it must update the whole screen.
In single buffered mode, you can incrementally modify the video memory
contents based on the last rendered frame. However, in double buffered
mode the last rendered frame might not be in the back buffer after
calling swap_buffers, depending on the double buffering strategy
selected at runtime:
1. when page flipping is in use, the back buffer will contain the
contents of the screen before the *prior* call to swap_buffers.
2. when the back buffer is in main memory (the blit strategy), the back
buffer will actually retain its contents after swap_buffers, since
the buffers cannot actually be swapped (thus perhaps the
'swap_buffers' name is not the most accurate description of the
essence of this function, but it gets the general message across).
In the gfxmenu code, I decided that, at least to start with, to always
render complete frames on the screen. In this way, the code functions
properly whether or not double buffering is in use, and it is kept
simple. This worked well for the menu screen, and has good performance
in my tests even on my 1 GHz VIA C3 machine. I figure that it's more
important to get it working properly, and then optimize the
performance later where it might be needed.
The main current performance problem lies in the way that the gfxterm
works when embedded in the double buffered gfxmenu screen. It is causing
a full screen redraw every time a character or a string is changed on
the terminal. I've thought about this a lot in the past and I don't
have a simple answer, though I have a lot of ideas (switch to single
buffering temporarily (--), pre-render a bitmap of the rest of
the screen (-), coalesce updates to the gfxterm (++), ...).
Regards,
Colin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2008-10-05 16:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-31 6:58 [PATCH] GSoC #07 VBE double buffering Colin D Bennett
2008-10-05 4:43 ` [PATCH] GSoC #07 VBE double buffering (vs r1885) Colin D Bennett
2008-10-05 8:52 ` Vesa Jääskeläinen
2008-10-05 16:16 ` Colin D Bennett [this message]
[not found] <1745824252.39921223234235570.JavaMail.root@aczmb1>
2008-10-05 19:17 ` Andy Goth
2008-10-05 19:47 ` Colin D Bennett
2008-10-05 19:57 ` Andy Goth
2008-10-06 19:02 ` Vesa Jääskeläinen
2008-10-13 16:48 ` Colin D Bennett
2008-10-13 17:12 ` Colin D Bennett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081005091659.78e70113@gibibit.com \
--to=colin@gibibit.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.