> Date: Wed, 25 Nov 2015 16:18:52 +0000
> Subject: Re: Process for implementing a double buffer on Wayland
> From: [email protected]
> To: [email protected]
> CC: [email protected]
>
> Hi Mike,
>
> On 25 November 2015 at 16:06, Mike Johnson <[email protected]> wrote:
> > I've created 2 buffers of the same size (800x600 pixels). So I want the
> > input buffer to get filled off-screen, while the output buffer will show the
> > content on-screen.
> >
> > First of all what sort of content could be used to illustrate this
> > technique, and secondly, what mechanisms are available to:
> >
> > a) Notify that the input buffer is full
> > b) Copy the content to the output buffer so that it shows on-screen
>
> It's quite simple. wl_surface_attach(surf, buf) +
> wl_surface_commit(surf) will display 'buf' for that surface. At that
> point, the compositor owns that buffer, so you should stop drawing on
> it. When the compositor has finished with a buffer, it will send you a
> wl_buffer.release event. You can sync your paint clock to the
> compositor's repaint loop with wl_surface_frame.
>
> So, the normal workflow is:
> - create surface S, buffer A, buffer B
> - draw first frame into buffer A
> - call wl_surface_frame(S) + wl_surface_attach(S, A) +
> wl_surface_commit(S) + wl_display_flush()
> - go to sleep
> - receive completion for wl_surface_frame callback
> - draw second frame into buffer B
> - call wl_surface_frame(S) + wl_surface_attach(S, B) +
> wl_surface_commit(S) + wl_display_flush()
> - compositor now owns both buffers, so don't touch any
> - receive wl_buffer.release event for buffer A - now unused
> - receive completion for wl_surface_frame callback
> - draw third frame into buffer A
> - ...
>
> Hope that helps. You can see the weston-simple-shm client for a pretty
> straightforward example.
>
> Cheers,
> Daniel
Hi Daniel,
Many thanks for the detailed and quick response. You've shown me a couple of
functions I hadn't thought of using.
I'll give it a go.
Kind regards
Mike
_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel