From: Markus Armbruster <armbru@redhat.com>
To: Samuel Thibault <samuel.thibault@eu.citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [RFC] PVFB: Add refresh period to XenStore parameters?
Date: Fri, 09 May 2008 10:43:15 +0200 [thread overview]
Message-ID: <87hcd7c1gc.fsf@pike.pond.sub.org> (raw)
In-Reply-To: <20080508150146.GO4365@implementation.uk.xensource.com> (Samuel Thibault's message of "Thu\, 8 May 2008 16\:01\:46 +0100")
Samuel Thibault <samuel.thibault@eu.citrix.com> writes:
> Hello,
>
> Markus Armbruster, le Thu 08 May 2008 10:25:32 +0200, a écrit :
>> Strictly speaking, frame buffer update and update notification events
>> are separate things.
>
> Right, let's call the first one "refresh".
>
>> What you seem to need is *not* a way to control *notifications*, but a
>> way to control *updates*. Because your shared framebuffer isn't
>> really a framebuffer, but some shadow of the real framebuffer.
>> Correct?
>
> Yes. Here is an updated patch.
Looks like we're down to clarifying comments. See inline.
> pvfb/ioemu: transmit refresh interval advice from backend to frontend
> which permits the frontend to avoid useless polls.
>
> Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
>
[diff extras/mini-os/... I got nothing useful to say about that...]
> diff -r b0d7780794eb tools/ioemu/hw/xenfb.c
> --- a/tools/ioemu/hw/xenfb.c Thu May 08 13:40:40 2008 +0100
> +++ b/tools/ioemu/hw/xenfb.c Thu May 08 15:47:13 2008 +0100
> @@ -59,6 +59,7 @@ struct xenfb {
> int offset; /* offset of the framebuffer */
> int abs_pointer_wanted; /* Whether guest supports absolute pointer */
> int button_state; /* Last seen pointer button state */
> + int refresh_period; /* The refresh period we have advised */
> char protocol[64]; /* frontend protocol */
> };
>
> @@ -536,6 +537,41 @@ static void xenfb_on_fb_event(struct xen
> xc_evtchn_notify(xenfb->evt_xch, xenfb->fb.port);
> }
>
> +static int xenfb_queue_full(struct xenfb *xenfb)
> +{
> + struct xenfb_page *page = xenfb->fb.page;
> + uint32_t cons, prod;
> +
> + prod = page->in_prod;
> + cons = page->in_cons;
> + return prod - cons == XENFB_IN_RING_LEN;
> +}
> +
> +static void xenfb_send_event(struct xenfb *xenfb, union xenfb_in_event *event)
> +{
> + uint32_t prod;
> + struct xenfb_page *page = xenfb->fb.page;
> +
> + prod = page->in_prod;
> + /* caller ensures !xenfb_queue_full() */
> + xen_mb(); /* ensure ring space available */
> + XENFB_IN_RING_REF(page, prod) = *event;
> + xen_wmb(); /* ensure ring contents visible */
> + page->in_prod = prod + 1;
> +
> + xc_evtchn_notify(xenfb->evt_xch, xenfb->fb.port);
> +}
> +
> +static void xenfb_send_refresh_period(struct xenfb *xenfb, int period)
> +{
> + union xenfb_in_event event;
> +
> + memset(&event, 0, sizeof(event));
> + event.type = XENFB_TYPE_REFRESH_PERIOD;
> + event.refresh_period.period = period;
> + xenfb_send_event(xenfb, &event);
> +}
> +
> static void xenfb_on_kbd_event(struct xenfb *xenfb)
> {
> struct xenkbd_page *page = xenfb->kbd.page;
> @@ -707,6 +743,7 @@ static int xenfb_read_frontend_fb_config
> xenfb->protocol) < 0)
> xenfb->protocol[0] = '\0';
> xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "request-update", "1");
> + xenfb->refresh_period = -1;
>
> /* TODO check for permitted ranges */
> fb_page = xenfb->fb.page;
> @@ -1185,10 +1222,28 @@ static void xenfb_guest_copy(struct xenf
> dpy_update(xenfb->ds, x, y, w, h);
> }
>
> -/* Periodic update of display, no need for any in our case */
> +/* Periodic update of display, transmit the refresh interval to the frontend */
> static void xenfb_update(void *opaque)
> {
> struct xenfb *xenfb = opaque;
> + int period;
> +
> + if (xenfb_queue_full(xenfb))
> + return;
> +
> + if (xenfb->ds->idle)
> + period = 0;
> + else {
> + period = xenfb->ds->gui_timer_interval;
> + if (!period)
> + period = GUI_REFRESH_INTERVAL;
> + }
> +
> + /* Will have to be disabled for frontends without feature-update */
I think I asked you to put this comment here, but is it still correct
for current XENFB_TYPE_REFRESH_PERIOD semantics?
> + if (xenfb->refresh_period != period) {
> + xenfb_send_refresh_period(xenfb, period);
> + xenfb->refresh_period = period;
> + }
> }
>
> /* QEMU display state changed, so refresh the framebuffer copy */
[CONFIG_STUBDOM stuff snipped, I'm too ignorant about that to comment...]
> diff -r b0d7780794eb tools/ioemu/sdl.c
[more snippage due to ignorance...]
> diff -r b0d7780794eb tools/ioemu/vl.c
[ditto...]
> diff -r b0d7780794eb tools/ioemu/vl.h
[ditto...]
> diff -r b0d7780794eb tools/ioemu/vnc.c
[ditto...]
> diff -r b0d7780794eb xen/include/public/io/fbif.h
> --- a/xen/include/public/io/fbif.h Thu May 08 13:40:40 2008 +0100
> +++ b/xen/include/public/io/fbif.h Thu May 08 15:47:13 2008 +0100
> @@ -79,15 +79,27 @@ union xenfb_out_event
> /* In events (backend -> frontend) */
>
> /*
> - * Frontends should ignore unknown in events.
> - * No in events currently defined.
> + * Framebuffer refresh period advice
> + * Backend sends it to advise the frontend the period of refresh it should use,
> + * i.e how often it should take care to update the FB with its internal state.
> + *
> + * If the frontend uses the advice, it should refresh and send an update event
> + * in response to this event.
> */
You delete the bit about ignoring unknown events. Oops.
What about this:
/* In events (backend -> frontend) */
/*
* Frontends should ignore unknown in events.
*/
/*
* Framebuffer refresh period advice
* Backend sends it to advise the frontend their preferred period of
* refresh. Frontends that keep the framebuffer constantly up-to-date
* just ignore it. Frontends that use the advice should immediately
* refresh the framebuffer (and send an update notification event if
* those have been requested), then use the update frequency to guide
* their periodical refreshs.
*/
#define XENFB_TYPE_REFRESH_PERIOD 1
> +#define XENFB_TYPE_REFRESH_PERIOD 1
> +
> +struct xenfb_refresh_period
> +{
> + uint8_t type; /* XENFB_TYPE_UPDATE_PERIOD */
> + uint32_t period; /* period of refresh, in ms, 0 if no refresh is needed */
> +};
>
> #define XENFB_IN_EVENT_SIZE 40
>
> union xenfb_in_event
> {
> uint8_t type;
> + struct xenfb_refresh_period refresh_period;
Time unit? Needs a comment! Make sure to explain the special value
for "no updates please".
I'd be tempted to use a frequency instead of a period, just because
that doesn't require a special value for "no updates". Strictly a
matter of taste.
> char pad[XENFB_IN_EVENT_SIZE];
> };
>
next prev parent reply other threads:[~2008-05-09 8:43 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-29 12:08 [RFC] PVFB: Add refresh period to XenStore parameters? Samuel Thibault
2008-03-03 11:07 ` Samuel Thibault
2008-03-03 18:03 ` Markus Armbruster
2008-03-03 19:18 ` Samuel Thibault
2008-03-04 12:36 ` Trolle Selander
2008-03-04 14:32 ` Markus Armbruster
2008-03-04 14:49 ` Samuel Thibault
2008-03-04 15:11 ` Samuel Thibault
2008-03-04 15:48 ` Markus Armbruster
2008-03-04 16:12 ` Samuel Thibault
2008-03-04 17:06 ` Markus Armbruster
2008-03-04 17:19 ` Samuel Thibault
2008-03-05 8:03 ` Markus Armbruster
2008-03-05 9:59 ` Samuel Thibault
2008-05-01 17:55 ` Samuel Thibault
2008-05-02 16:06 ` Samuel Thibault
2008-05-05 8:26 ` Markus Armbruster
2008-05-05 9:18 ` Samuel Thibault
2008-05-05 9:58 ` Markus Armbruster
2008-05-05 10:21 ` Samuel Thibault
2008-05-05 16:50 ` Samuel Thibault
2008-05-06 13:50 ` Markus Armbruster
2008-05-06 14:07 ` Keir Fraser
2008-05-06 16:32 ` Samuel Thibault
2008-05-06 16:50 ` Markus Armbruster
2008-05-06 17:29 ` Samuel Thibault
2008-05-07 14:43 ` Markus Armbruster
2008-05-07 14:54 ` Samuel Thibault
2008-05-08 8:25 ` Markus Armbruster
2008-05-08 15:01 ` Samuel Thibault
2008-05-09 8:43 ` Markus Armbruster [this message]
2008-05-09 10:31 ` Samuel Thibault
2008-05-09 10:48 ` Markus Armbruster
2008-05-09 13:43 ` Samuel Thibault
2008-03-05 11:19 ` Markus Armbruster
2008-03-05 11:27 ` Samuel Thibault
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=87hcd7c1gc.fsf@pike.pond.sub.org \
--to=armbru@redhat.com \
--cc=samuel.thibault@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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.