Commit Graph

34 Commits

Author SHA1 Message Date
Kristian Høgsberg
e7144fd175 compositor: Only send release event in response to wl_surface.attach
The current semantics would implicitly attach the most recently attached
buffer at commit time and send a release event when the buffer enventually
was released.  The implicit attach is a little too subtle though and this
patch changes the semantics to always only send release events in response
to an attach event.  As a consequence, once a compositor releases a buffer,
it no longer has a reference to it and wl_surfcea.damage is undefined.
Thus, the client side visible change is that damage request must always
be preceeded by a wl_surface.attach request, to ensure there's a valid buffer,
even if that means attaching the same buffer again.
2013-03-05 15:35:47 -05:00
Pekka Paalanen
0eab05d2a7 clients: add global_remove handler stubs
All the clients here were missing the global_remove handler. Because
window.c did not have it, weston-desktop-shell and weston-keyboard
segfaulted on compositor exit, as they received some
wl_registry.global_remove events.

Add more or less stub global_remove handlers, so that clients do not
crash on such events. Toytoolkit and all applications would need a lot
more code to properly handle the global object removal.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-01-24 16:42:38 -05:00
Pekka Paalanen
aac1c13332 clients: destroy wl_registry on exit
Plug an insignificant memory leak in demo programs that bother to clean
up at all.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 17:02:00 -05:00
Pekka Paalanen
99b705bb17 simple-shm: honour wl_buffer.release
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.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-19 15:55:09 -05:00
Ander Conselvan de Oliveira
d0f24cf6ec simple-shm: Don't use ret variable in main() uninitialized 2012-10-17 16:51:07 -04:00
Kristian Høgsberg
a17f7a13fd clients: Check return value of wl_display_dispatch()
The simple clients all just call wl_display_dispatch() in a while loop
without checking the return value.  Now, if the server dies or other
error occurs, we get a -1 return value instead and need to break the loop.
2012-10-16 13:17:16 -04:00
Pekka Paalanen
bc10638cd9 compositor, clients: apply wl_surface.frame on commit
Apply wl_surface.frame request only on the next wl_surface.commit
according to the new protocol.

This makes it explicit, which repaint actually triggered the frame
callback, since commit schedules a repaint. Otherwise, something causing
a repaint before a commit could trigger the frame callback too early.

Ensure all demo clients send commit after wl_surface.frame. Note, that
GL apps rely on eglSwapBuffers() sending commit. In toytoolkit, it is
assumed that window_flush() always does a commit.

compositor-wayland assumes renderer->repaint_output does a commit.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:39:11 -04:00
Pekka Paalanen
c9e00c06e9 clients: use wl_surface_commit
Use wl_surface_commit() to commit the buffer attach, as Weston now
requires.

NOTE: GL-applications are broken until you upgrade to a version of Mesa
which does wl_surface_commit() on eglSwapBuffers(). If you have
Cairo-gl, this means all toytoolkit apps, too.

simple-shm and simple-touch OTOH will work now.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-10 21:38:17 -04:00
Kristian Høgsberg
fa80e11c84 Update to new fd and wl_registry APIs
This commit updates the clients and the wayland compositor backend to
use the new wl_registry mechanism and the thread safe fd API.
2012-10-10 21:34:38 -04:00
Scott Moreau
01a9f1b992 clients: Set title for all shell surface demos. 2012-10-09 23:13:01 -04:00
Rob Bradford
371805f76e simple-shm: Draw the test motif surrounded by a white border
We can then use a wl_surface_damage to just trigger the compositor to update
just a selected region of the buffer and thus test damaging a sub region.
2012-10-04 11:34:09 -04:00
Rob Bradford
fecf332e19 simple-shm: Don't attach the buffer to the surface for every redraw
This will allow us to change just a sub region of the buffer.
2012-10-04 11:34:05 -04:00
Pekka Paalanen
1da1b8f3f1 Rewrite shm buffer file allocation v2
We had duplicated code in many places, using hardcoded paths for
temporary files into more than one path. Some cases did not bother with
O_CLOEXEC, and all hardcoded paths that might not exist.

Add an OS helper function for creating a unique anonymous file with
close-on-exec semantics. The helper uses $XDG_RUNTIME_DIR as the
directory for a file.

This patch unifies the buffer file creation in both Weston and the
clients.

As simple clients are better not linking to libshared, as it would
require e.g. Cairo, they pull the OS compatibility code directly.

Android does not have mkostemp(), so a configure test is added for it,
and a fallback used if it is not available.

Changes in v2:
	remove all the alternate possible directory definitions and use
	XDG_RUNTIME_DIR only, and fail is it is not set.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-06-06 13:26:30 -04:00
Scott Moreau
7c8b116065 simple-shm: Handle ping event.
Since simple-shm does not use toytoolkit, it needs to respond to ping events so it is not deemed unresponsive.
2012-05-14 10:02:12 -04:00
Pekka Paalanen
c3710f2379 simple-shm: no need for wayland-egl.h
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-26 15:45:13 +03:00
Pekka Paalanen
3baf946b9a simple-shm: handle shm buffer failure
Do not segfault, if creating the shm buffer fails.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-26 15:44:45 +03:00
Pekka Paalanen
313bd84a48 simple-shm: render meaningful diagnostics
Previously, simple-shm was rendering an image that looked like stride
gone wrong somewhere, and was quite confusing if you did not know it was
supposed to look like that.

Replace the drawing code. Two circles, inner and outer, now delimit
three co-centric areas. The outmost area from surface borders to outer
circle contains horizontal gradients that move (animate) to the left.
The area between outer and inner circles contains vertical gradients
that move upwards. The center disc has circular gradients moving towards
the center.

The circles are not ellipses.

Diagnostics:
The X-channel is manipulated so, that if a compositor takes the XRGB
image, and uses the X channel as alpha instead of ignoring it, the whole
image will be crossed out by two lines that either quickly saturate to
white or show through with additive blending. Does not work on black
background.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-04-26 15:42:05 +03:00
Kristian Høgsberg
16626282fd clients: Use new shm interface 2012-04-03 11:22:06 -04:00
Kristian Høgsberg
9629fe3206 Simplify shm buffer handling
There was a lot of code here to do a lot of work we didn't need to do.
If we damage a surface with a shm buffer attached, all we need to do
is to re-upload the damaged region to the texture.  As for drm buffers,
we don't assume anything changes on attach and only update the
regions the client tells us to update in the damage request.
2012-03-26 19:27:35 -04:00
Kristian Høgsberg
fcfc83f6ae clients: Use wl_display_disconnect() 2012-02-28 14:34:54 -05:00
Kristian Høgsberg
8e81df4503 Use new format codes 2012-01-11 14:24:46 -05:00
Pekka Paalanen
fb850c4e0f simple clients: flush before destroying wl_display
Flush our pending destroy requests to the server before destroying the
wl_display.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:50 +02:00
Pekka Paalanen
c4cd62acee simple-shm: implement destructors
Implement proper destructors that call the wayland destroy functions.

With this and the "client: fix a strdup memory leak" patch in Wayland
core, simple-shm now runs Valgrind-clean (memcheck).

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:50 +02:00
Pekka Paalanen
88e60fc2ba simple clients: add signal handler for clean exit
Add signal handler for SIGINT to simple-egl and simple-shm, so they can
be exited voluntarily, without killing them. Later we can add clean-up
code and destructors, and check with valgrind for leaks and errors.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-22 11:27:50 +02:00
Pekka Paalanen
9d1613eb4a wl_shell_surface adaptation
Protocol changes in Wayland core introduced a new interface
wl_shell_surface, and moved all wl_shell surface methods into it. Adapt
the compositor and its Wayland backend, shell plugin, and all clients to
the new interface.

Depends on the Wayland core commit "protocol: introduce wl_shell_surface"

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-12-04 14:54:26 -05:00
Kristian Høgsberg
a3cdf59cee simple-shm: Add a wl_shm listener
This way we properly check that WL_SHM_FORMAT_XRGB32 is available.
2011-11-17 10:27:17 -05:00
Kristian Høgsberg
f389cacc20 Move away from visuals and just use EGLConfigs or shm format tokens 2011-08-31 16:21:38 -04:00
Kristian Høgsberg
2821aaaf9c simple-shm: Fix inverted logic 2011-08-29 17:12:37 -04:00
Kristian Høgsberg
2415990461 clients: Remove a few unused variables 2011-08-29 17:12:36 -04:00
Kristian Høgsberg
f790c79ec7 Use wl_display_bind() for binding to globals 2011-08-29 17:12:36 -04:00
Kristian Høgsberg
334182062f Use the new wl_callback interface 2011-08-29 17:12:36 -04:00
Tiago Vignatti
e81fe8346c clients: simple-shm: remove unused libraries and headers
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-07-21 08:42:58 -07:00
Tiago Vignatti
79caa757c9 simple-shm: assert display conection
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
2011-07-21 08:42:58 -07:00
Kristian Høgsberg
97ba2e6015 clients: Add a simple shared memory client 2011-07-06 11:58:45 -04:00