Commit graph

34 commits

Author SHA1 Message Date
Emil Velikov ce5b614c80 clients/nested: use weston_check_egl_extension over strstr
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:29:04 +01:00
Emil Velikov 885a9fe4d9 client/nested: reuse weston-egl-ext.h declarations
Rather than introducing a local copy of the
EGL_WL_create_wayland_buffer_from_image (re)definition, just use the
local header.

This also gives us access to EGL_WL_bind_wayland_display which is also
used in the client, yet the C file is missing a fall-back definition.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:21:46 +01:00
U. Artie Eoff 2dd10e0c60 clients/nested: fix undefined reference to xzalloc
Include shared/xalloc.h in clients/nested.c to fix
compilation error: undefined reference to `xzalloc'

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-25 13:44:09 +03:00
Jon Cruz d618f688d5 Moved the MIN() macro to the helper include.
Removed multiple definitions of the MIN() macro from existing
locations and unified with a single definition. Updated sources
to use the shared version.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:52 -07:00
Jon Cruz 35b2eaa989 Moved helper macro to a discrete include file.
To help reduce code duplication and also 'kitchen-sink' includes
the ARRAY_LENGTH macro was moved to a stand-alone file and
referenced from the sources consuming it. Other macros will be
added in subsequent passes.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:45 -07:00
Bryce Harrington 1f6b0d1d2c clients: Update boilerplate from MIT X11 license to MIT Expat licenses 2015-06-15 13:04:18 -07:00
Michael Vetter 2a18a52844 remove trailing whitespaces
Remove trailing whitespaces because they are not needed and jumping to
the end of al ine should do just that and not jump to the whitespace.
2015-05-15 13:12:32 -07:00
Bill Spitzak 6df71aae03 Made weston-nested --help work 2014-08-19 12:19:16 +03:00
Jason Ekstrand ef5400843f Use pixman_region32_clear instead of our own empty_region
This requires pixman 0.25.2

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2014-07-05 01:03:55 -07:00
Andrew Wedgbury 9cd661e746 Make sure config.h is included before any system headers
There was an issue recently in screen-share.c where config.h was not
being included, resulting in the wrong definition for off_t being used on
32 bit systems. I checked and I don't think this problem is happening
elsewhere, but to help avoid this sort of problem in the future, I went
through and made sure that config.h is included first whenever system
headers are included.

The config.h header should be included before any system headers, failing
to do this can result in the wrong type sizes being defined on certain
systems, e.g. off_t from sys/types.h

Signed-off-by: Andrew Wedgbury <andrew.wedgbury@realvnc.com>
2014-04-07 10:22:28 -07:00
Neil Roberts 40d02288cb nested: Disable cairo on the subsurfaces
The subsurface widgets on the nested example aren't using Cairo to
render so we should turn it off to prevent the toy toolkit from
creating a redundant extra surface for it. This is particularly
important since Mesa commit 6c9d6898fdfd7e2 because the surface that
the toolkit tries to create is zero-sized and that patch prevents that
from working. This was causing weston-nested to crash.
2014-04-06 23:00:37 -07:00
U. Artie Eoff 5cda4e328d use xzalloc wrapper instead
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:01:23 -08:00
Kristian Høgsberg c2010b3af0 nested: Add EGL_WL_create_wayland_buffer_from_image compat defines
Make it possible to compile this example with EGL implementations without
this extension.
2013-12-17 10:40:01 -08:00
Neil Roberts a5059eb187 nested: Add an option to disable subsurfaces
This adds a -b option to force the nested compositor example to use
the old blit renderer even if the appropriate extensions are
available.
2013-12-04 16:34:08 -08:00
Neil Roberts 1f020a1fdb nested: Add a renderer using subsurfaces
Adds a second renderer implementation to the nested compositor example
that creates a subsurface for each of the client's surfaces. The
client buffers are directly attached to the subsurface using the
EGL_WL_create_wayland_buffer_from_image extension instead of blitting
them in the redraw_handler.

The new renderer is always used if the parent compositor supports the
wl_subcompositor protocol and the EGL extension is available.
Otherwise it will fall back to the blit renderer.
2013-12-04 16:34:07 -08:00
Neil Roberts 47b87d5ec0 nested: Add a ‘renderer’ mechanism with a vtable
Eventually the nested compositor example will want to be able to cope
with either rendering as it does now with a blit to an intermediate
surface or by attaching the client buffers directly to a subsurface
without copying. This patch moves the code that is specific to the
blitting mechanism into a separate set of functions with a vtable to
make it easier to add the second way of rendering in a later patch.
2013-12-04 16:34:07 -08:00
Neil Roberts f9b2541df1 nested: Move the frame callback list to the surface
Previously the frame callback list was tracked as part of the global
compositor state. This patch moves the list to be part of the surface
state like it is in Weston. The frame callback now iterates the list
of surfaces to flush all of the callbacks. This change will be useful
when the example is converted to use subsurfaces so that it can have a
separate frame callback for the subsurface and flush the list for an
individual client surface rather than flushing globally.
2013-12-04 16:34:07 -08:00
Neil Roberts 2855766333 nested: Add damage tracking to the nested compositor example
The nested compositor example now responds to damage requests and
tracks them in the pending buffer state. This isn't currently used for
anything and it is immediately discarded when the surface is commited
but it will be used later when the example is converted to use
subsurfaces.
2013-12-04 16:34:07 -08:00
Neil Roberts 15a8d340fd nested: Add double-buffered state semantics to the nested example
The buffer and frame callback state on the surfaces in the nested
compositor example are now double-buffered so that they only take
effect when the commit request is received. This doesn't really make
much difference for the current state that the example has but it will
be useful when more state is added in later patches.
2013-12-04 16:34:07 -08:00
Neil Roberts 6bf23879e9 nested: Add the buffer reference semantics from Weston
This copies the buffer reference busy count implementation from Weston
to the nested compositor example and adds an internal nested_buffer
struct that we could eventually use to attach data. This will be
useful to adapt the example to use subsurfaces so that we can attach
our compositor-side buffer to the resource.
2013-12-04 16:34:07 -08:00
Neil Roberts 8fbe3a68d4 nested: Remove the surface from the surface list when destroyed
Otherwise if the surface is destroyed then it will crash when it later
tries to render all of the surfaces. You can replicate this by doing
killall weston-nested-client while the example is running.
2013-12-04 16:34:07 -08:00
Jason Ekstrand ee7fefcffc Rename frame_create and frame_set_child_size with a window_ prefix
This is to avoid a collision with an actual frame structure.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-13 22:12:16 -07:00
Kristian Høgsberg e8344e3dbc nested: Cast away warnings for differing arguments to eglQueryWaylandBufferWL 2013-10-10 16:50:18 -07:00
Kristian Høgsberg 6773394000 nested: Free client struct on launch_client error paths 2013-10-10 16:50:18 -07:00
Ander Conselvan de Oliveira d224bb9218 nested: Fix skipping frames due to texture update without a context
Calls into cairo-gles may change the current context, so it was only by
chance that sometimes we had the proper one as current and updated the
correct texture in surface_attach().

In order to fix this, calling display_acquire_window_surface() before
binding the texture for setup is necessary. However this call has the
side effect of allocating a cairo surface for the window. At flush time,
the existence of this surface will cause an eglSwapBuffers(), even
if no rendering was done to it, leading to undefined contents on the
screen. This happens when the idle redraw task runs while there is a
pending frame callback.

Workaround this by moving the texture setup from surface_attach() to the
redraw handler, so that the cairo surface is only allocated when
redering is done.
2013-08-16 10:56:00 -07:00
Kristian Høgsberg 0d5fe3a231 nested: The wl_resouce is the buffer, not the wl_resource user data 2013-08-16 10:56:00 -07:00
Kristian Høgsberg e9cabc1bc3 nested: Use a void * to avoid warnings with EGL_WL_bind_wayland_display 2013-08-12 22:21:22 -07:00
Peter Hutterer f3d62276d2 malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-08 13:46:13 -07:00
Kristian Høgsberg cb61dcf2ce nested: Update to use weston-nested-client binary name 2013-08-07 09:50:12 -07:00
Kristian Høgsberg 3c17933de8 Use #define WL_HIDE_DEPRECATED to avoid deprecated warnings for wl_buffer 2013-08-06 19:27:04 -07:00
Kristian Høgsberg 919cddb0ab Convert to wl_global_create/destroy() 2013-07-09 02:02:11 -04:00
Kristian Høgsberg 1d7d8f0e95 nested: Fix direct access to resource->data 2013-06-25 16:15:27 -04:00
Kristian Høgsberg 88dab17b0e nested: Port away from old wl_resource API 2013-06-24 22:53:38 -04:00
Kristian Høgsberg 1cc5ac34b5 clients: Nested compositor example
A wayland compositor doesn't provide a mechanism for buffer sharing between
clients.  Under X, one client can render to a Pixmap and another can use it
as a source in a subsequent drawing operations.  Wayland doesn't have a
mechanims to share Pixmaps or textures between clients like that, but it's
possible for one client to act as a nested compositor to another client.

This less work than it sounds, since the nested compositor won't have to
provide input devices or even any kind of shell extension.  The nested
compositor and its client can be very tightly coupled and have very specific
expectations of what the other process should provide.

In this example, nested.c is a toytoolkit application that uses cairo-gl
for rendering and forks and execs nested-client.c.  As it execs the client,
it passes it one end of a socketpair that will be the clients connection
to the nested compositor.  The nested compositor doesn't even create a
listening socket.

The client is a minimal GLES2 application, which just renders a spinning
triangle in its frame callback.
2013-06-04 02:47:12 -04:00