[PATCH weston] simple-shm: honour wl_buffer.release
Pekka Paalanen
ppaalanen at gmail.com
Tue Nov 20 23:26:25 PST 2012
On Tue, 20 Nov 2012 10:26:41 -0800
Bill Spitzak <spitzak at gmail.com> wrote:
> Pekka Paalanen wrote:
> > On Mon, 19 Nov 2012 15:56:23 -0500
> > Kristian Høgsberg <hoegsberg at gmail.com> wrote:
> >
> >> On Mon, Nov 19, 2012 at 03:29:09PM +0200, Pekka Paalanen wrote:
> >>> Change simple-shm to properly process the wl_buffer.release event, and
> >>> not reuse a buffer until it is released by the server, as specified in
> >>> the protocol.
> >>>
> >>> In case the server has not released the buffer, but signals that it has
> >>> been shown (frame callback), allocate a second buffer. Simple-shm will
> >>> now automatically do double-buffering if needed.
> >> Looks fine, but simple-shm is less and less simple.
> >
> > Yes, I know, but this is really required by the core protocol. Not
> > just nice to have, nor optional.
>
> It sounds like Wayland clients *must* do double buffering, is this correct?
They should be prepared to allocate a second buffer, if the compositor
does not release the first buffer by the time the client needs to draw
again.
> I was under the impression that a client could draw over it's buffer at
> any time, with the caveat that what will get composited to the screen
> may be unpredictable.
It can do that, and then it gets what it deserves: unpredictable output.
> Is it now illegal to write to the memory that the compositor is looking
> at? That makes sense but conflicts with the first few pages of the
> wayland documentation.
Well, it is not technically fatal. The spec wording implies that a
client may not re-use the buffer's storage until the compositor
releases it. If a client chooses to do it, I'd say it is similar to
misusing an API.
We need to fix the docs, then. Where, exactly?
> If it is ok to write over the memory (just not pretty) I would leave the
> "simple" program as simple as possible.
I'd rather we didn't have incorrect demo programs. It would be quite
strange to have an example program, and then find a comment inside
saying that instead of what we do here, you should do [hand waving].
Thanks,
pq
More information about the wayland-devel
mailing list