Commit Graph

2990 Commits

Author SHA1 Message Date
Robert Bragg
e9f721216e Add _primitive_draw to replace _framebuffer_draw_primitive
When splitting out the CoglPath api we saw that we would be left with
inconsistent drawing apis if the drawing apis in core Cogl were lumped
into the cogl_framebuffer_ api considering other Cogl sub-libraries or
that others will want to create higher level drawing apis outside of
Cogl but can't use the same namespace.

So that we can aim for a more consistent style this adds a
cogl_primitive_draw() api, comparable to cogl_path_fill() or
cogl_pango_show_layout() that's intended to replace
cogl_framebuffer_draw_primitive()

Note: the attribute and rectangle drawing apis are still in the
cogl_framebuffer_ namespace and this might potentially change but in
these cases there is no single object representing the thing being drawn
so it seems a more reasonable they they live in the framebuffer
namespace for now.

Note: the cogl_framebuffer_draw_primitive() api isn't removed by this
patch so it can more conveniently be cherry picked to the 1.16 branch so
we can mark it deprecated for a short while. Even though it's marked as
experimental api we know that there are people using the api so we'd
like to give them a chance to switch to the new api.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 418912b93ff81a47f9b38114d05335ab76277c48)

Conflicts:
	cogl-pango/cogl-pango-display-list.c
	cogl/Makefile.am
	cogl/cogl-framebuffer.c
	cogl/cogl-pipeline-layer-state.h
	cogl/cogl2-path.c
	cogl/driver/gl/cogl-clip-stack-gl.c
2013-07-29 18:31:36 +01:00
Robert Bragg
5580baeffb examples: avoid using the auto-texture apis
Instead of using cogl_texture_new_from_file/with_size in the example we
now use the cogl_texture_2d_ equivalents. This is in preparation for
removing the cogl-auto-texture apis.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 815a1c80db4132fff6ccf97fc08396e61fc31ebb)

Conflicts:
	examples/cogl-crate.c
	examples/cogl-gles2-context.c
	examples/cogl-msaa.c
2013-07-29 17:57:23 +01:00
Robert Bragg
937337993d tests: stop using cogl-auto-texture apis
The plan is to remove the cogl-auto-texture apis since they hide a bit
too much from developers but currently the conformance tests depend on
these apis in numerous places.

For the conformance tests it makes some sense to continue using high
level texture apis similar to the auto-texture apis since we may want
to make broad variations to how textures are allocated as part of the
testing running if that might help exercise more code paths.

This patch copies much of the auto-texture functionality into some
slightly more special purpose utilities in test-utils.c/h. Minor changes
include being constrained to the public Cogl api and they also don't
let you catch CoglErrors and just assume they should abort on error.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 911df79776ce6f695351c15e9872b4f1479d30bf)

Conflicts:
	tests/conform/test-atlas-migration.c
	tests/conform/test-backface-culling.c
	tests/conform/test-blend-strings.c
	tests/conform/test-color-mask.c
	tests/conform/test-just-vertex-shader.c
	tests/conform/test-npot-texture.c
	tests/conform/test-primitive.c
	tests/conform/test-snippets.c
	tests/conform/test-texture-get-set-data.c
	tests/conform/test-texture-mipmap-get-set.c
	tests/conform/test-texture-no-allocate.c
	tests/conform/test-wrap-modes.c
2013-07-29 17:56:07 +01:00
Robert Bragg
7d2e23bd75 bitmap: calc rowstride from width * bpp if 0
This updates cogl_bitmap_new_for_data() to calculate the rowstride from
the width and bpp if the given rowstride is 0, to be consistent with how
the texture apis work.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 1c809210092a8c5e223edfcab1e378b205cf35d6)
2013-07-29 16:59:37 +01:00
Robert Bragg
1255d178e0 gst: don't use cogl_texture_new_with_data
This updates cogl-gst to use cogl_texture_2d_new_with_data instead of
cogl_texture_new_with_data in preparation for removing the automagic
apis in cogl-auto-texture.c

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit d3af8dc9bf6c4c1b09a4f7559b0375f848368c10)

Conflicts:
	cogl-gst/cogl-gst-video-sink.c
2013-07-29 16:59:15 +01:00
Robert Bragg
d383bc0e61 remove internal use of cogl_texture_new_with_size
In preparation for removing the automagic cogl-auto-texture apis this
adds a more minimal version of the cogl_texture_new_with_size code to
cogl-atlas.c for creating textures used to migrate images out of an
atlas and to cogl-texture-pixmap-x11.c.

Note: It turned out that both of these minimal versions were the same so
I did consider keeping a shared utility, but since the implementations
are very small and potentially due to the differing requirements for
atlas and pixmap-x11 textures we might even want them to differ later I
chose to keep them separate.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 6d64307483713e7a5a7ef554275619def51b840f)

Conflicts:
	cogl/cogl-atlas.c
	cogl/winsys/cogl-texture-pixmap-x11.c
2013-07-29 16:57:33 +01:00
Robert Bragg
061240ef2a 2d-sliced: add _new_from_file/data/bitmap apis
This adds cogl_texture_2d_sliced_new_from_bitmap/data/file apis in
preparation for removing the cogl_texture_new_from_bitmap/file apis that
are considered a bit too magic, but we don't want to loose the
convenience they have.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 218da8e1349d7658f45c6933b9736c0d32941b8b)

Conflicts:
	cogl/cogl-auto-texture.c
2013-07-29 16:49:01 +01:00
Robert Bragg
aa92110f83 texture-2d: Add _new_from_file api
This adds a cogl_texture_2d_new_from_file() api since we are planning to
remove cogl_texture_new_from_file() but don't want to loose the
convenience it had.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 10e91aa513123ed277a8d45976f8d75445d7dc9c)
2013-07-29 16:48:49 +01:00
Robert Bragg
fc5d1a8a68 Expose CoglAtlasTexture api
This exposes the CoglAtlasTexture api, making the following public:
cogl_atlas_texture_new_with_size
cogl_atlas_texture_new_from_file
cogl_atlas_texture_new_from_data
cogl_atlas_texture_new_from_bitmap

The plan is to remove auto-texture apis like cogl_texture_new_from_file
since they are a bit too magic, but that means we need an explicit way
for users to allocate texture that will go in the atlas.

Although the _new_from_file() api is arguably redundant since you can
use _bitmap_new_from_file() followed by _atlas_texture_new_from_bitmap()
we don't want to loose any of the convenience that
cogl_texture_new_from_file() had.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit fe515e6063ba4c3ddb5cd00d2c8527d9a6336a12)

Conflicts:
	cogl/Makefile.am
2013-07-29 16:38:53 +01:00
Robert Bragg
6f480c7530 texture: remove _cogl_texture_prepare_for_upload
This removes the gl centric _cogl_texture_prepare_for_upload api from
cogl-texture.c and instead adds a _cogl_bitmap_convert_for_upload() api
which everything now uses instead. GL specific code that needed the gl
internal/format/type enums returned by _cogl_texture_prepare_for_upload
now use ->pixel_format_to_gl directly.

Since there was a special case optimization in
cogl_texture_new_from_file that aimed to avoid copying the temporary
bitmap that's created for the given file and allow conversions to
happen in-place the new _cogl_bitmap_convert_for_upload() api supports
converting in place depending on a 'can_convert_in_place' argument.

This ability to convert bitmaps in-place has been integrated across the
different components as appropriate.

In updating cogl-texture-2d-sliced.c this was able to remove a number of
other GL specific parts to how spans are setup.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit e190dd23c655da34b9c5c263a9f6006dcc0413b0)

Conflicts:
	cogl/cogl-auto-texture.c
	cogl/cogl.symbols
2013-07-29 16:31:44 +01:00
Damien Lespiau
1e4e68e069 context: Don't forget to unref() the renderer if we create it ourselves
cogl_display_new() takes a ref on the renderer, so code creating a
renderer and not keeping a pointer to it do unref later needs to drop
the ref immediately.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 5433555f19ac73f3f236026f1bafca758d63c9fa)
2013-07-29 16:06:37 +01:00
Robert Bragg
4d5af45d99 cogl-gst: adds _sink_is_ready() api
This adds a cogl_gst_video_sink_is_ready() for code to be able to
check if it's safe to call cogl_gst_video_sink_get_pipeline() or
cogl_gst_video_sink_setup_pipeline() without causing an error.
Normally an application can listen for the pipeline-ready signal but
sometimes a sink can be passed between components that didn't have an
opportunity to connect a signal handler, so they need a way to
directly check the status.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 9e7db391a87beee7c448f2a67b3e7202779ce9b2)
2013-07-25 16:46:18 +01:00
Chun-wei Fan
887d2ebf2e Update Visual Studio Property Sheets
"Install" the newly-introduced public headers that are needed.
2013-07-25 13:32:17 +08:00
Chun-wei Fan
13fe92cbbd Visual Studio Builds: Update Conformance Test Projects
We need to include the headers and built the sources in test-fixtures to
build the conformance tests properly.
2013-07-25 13:30:04 +08:00
Damien Lespiau
eb002f20e8 pipeline: Initialize unknown_color_alpha on copy
Just like:

commit f3adec1faeb651dd97095a02256932cc82761f40
Author: Neil Roberts <neil@linux.intel.com>
Date:   Thu Jul 11 13:51:28 2013 +0100

    Initialise dirty_real_blend_enable in _cogl_pipeline_copy

But this time for unknown_color_alpha.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit e6a6a2752fb1cc14860cbc559f41f25f7e7f195e)
2013-07-19 13:54:07 +01:00
Robert Bragg
8de1f83b1c gpu-info: consider "(Core Profile)" GL version annotation
Mesa annotates the GL version string with "(Core Profile)" when using
the OpenGL 3 core profile and so our heuristics that try and determine
what vendor and GPU is being used where being confused. This updates
the check_mesa_driver_package() function to consider this optional
annotation.

This adds a small unit test to verify the parsing of some example
version strings. We can update this with more real world version strings
if the format changes again in the future.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 1a074173d20857c7bedb6a862958713e5ef8d2d1)
2013-07-19 13:53:52 +01:00
Neil Roberts
2f9a0a2c97 Initialise dirty_real_blend_enable in _cogl_pipeline_copy
When making a copy of a pipeline, the flag to mark whether the real
blend enable is valid was not being initialised.

Thanks to Damien Lespiau for pointing this out

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit f3adec1faeb651dd97095a02256932cc82761f40)
2013-07-11 16:05:34 +01:00
Neil Roberts
b3cc4d26d9 wayland: Send COGL_FRAME_EVENT_SYNC based on the frame callback
Instead of queuing the frame sync event immediately after a swap, the
Wayland winsys now installs a frame callback and queues the event when
Wayland reports that the frame is complete. It also reports the
COGL_FRAME_EVENT_COMPLETE event at the same time because there is no
more information we can give.

This patch is a bit of a divergence from how the events are handled in
the GLX winsys. Instead of installing its own idle function, the
_cogl_onscreen_queue_event() function has now been made non-static so
that it can be used by the Wayland winsys. The frame callback now just
queues an event using that. The pending_frame_infos queue on the
CoglOnscreen isn't used and instead the CoglFrameInfo is immediately
popped off the queue so that it can be stored as part of the closure
data when the frame callback is set up. That way it would use the
right frame info even if somehow the Wayland callbacks were invoked in
the wrong order and the code is a bit simpler.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit f7ea370a0d5013c9f0263f37c7f892adc8a2f087)
2013-07-11 14:22:12 +01:00
Neil Roberts
737806bcee wayland: Remove the Wayland socket FD if there are any errors
Previously if the Wayland socket gets closed then Cogl would ignore
the error when dispatching events which meant the socket would be
constantly ready for reading, the main loop would never go idle and it
would sit at 100% CPU. When Wayland encounters an error it will
actually close the socket which means if something else opened another
file then we might even end up polling on a completely unrelated FD.
This patch makes it remove the FD from the main loop as soon as it
hits an error so that it will at least avoid breaking the main loop.
However I think most applications would probably want to abort in this
case so we might also want to add a way to inform the application of
this or even just abort directly.

The cogl_poll_* functions have been changed so that they can cope if
the pending and dispatch callbacks remove their own FD while they are
invoked.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 85857b10687a5a246a0a4ef42711e560c7a6f45d)
2013-07-11 14:22:12 +01:00
Robert Bragg
b2452e2bd4 Post-release version bump to 1.15.3 2013-07-10 23:31:01 +01:00
Robert Bragg
6ac58bdbc8 Release 1.15.2 (snapshot) 2013-07-10 23:03:11 +01:00
Robert Bragg
6da4875d19 Updates NEWS for the 1.15.2 release 2013-07-10 23:03:07 +01:00
Robert Bragg
c281b6dd93 release: update documentation links for release notes
The release notes now link to http://cogl3d.org/cogl2-reference/
for the experimental 2.0 api reference
2013-07-09 23:19:51 +01:00
Robert Bragg
8caa116325 README: misc updates
Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 141014b50a3106d58f476b562aeb87c087ac31c8)
2013-07-09 22:54:02 +01:00
Matthias Clasen
5e26d17ea7 Install conformance tests
Install the conformance tests, and metadata to run them
with gnome-desktop-testing-runner.

https://bugzilla.gnome.org/show_bug.cgi?id=702942

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 53f3eb421239982b69569ad03ccbfa4b4f601cf3)
2013-07-09 22:52:50 +01:00
Damien Lespiau
1c3cd74211 tests: Add a test for the RGB <-> HSL functions
Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 32d67c2bf40641b2d1d30fa2d994013c3e6ce5bc)
2013-07-09 22:52:49 +01:00
Damien Lespiau
5858cac873 color: Add HSL conversion functions
This allows to easily caculate shades of the same color or pick colors
with the same saturation/luminance. In short, all sorts of interesting
things.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit edcbeaf3c941f7a2335fbec47d5248cd9b0e8088)
2013-07-09 22:52:49 +01:00
Lionel Landwerlin
6cc9074cfb cogl-gst: move initialization code so CoglGstVideoSink can be subclassed
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 2f6068cb6783edf6e05d6e55e9700e22f31cb233)
2013-07-09 22:52:49 +01:00
Neil Roberts
3d9eaef3ac wayland: Add API to prevent Cogl from dispatching the wayland display
This adds cogl_wayland_renderer_set_event_dispatch_enabled() which can
be used to prevent Cogl from adding the socket for the Wayland display
to its list of file descriptors to poll. This can be used in
applications that want to integrate Cogl with existing code that is
reading from the Wayland socket itself.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit f5b8d98676ab3e90ad80459019c737ec2ff90aa4)
2013-07-09 15:46:46 +01:00
Neil Roberts
18ce7ad7f5 Get rid of the foreign shell and compositor APIs
The Wayland 1.0 protocol supports multiple independent components querying the
available interfaces by retreiving their own wl_registry object so the
application doesn't need to pass them down anymore.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 8ca36a1d1ab7236fec0f4d7b7361ca96e14c32be)
2013-07-09 15:46:46 +01:00
Neil Roberts
8911da794e Implicitly allocate on cogl_wayland_onscreen_get_(shell_)?surface
The idea with the framebuffer allocation is that it will lazily
allocate so that if you don't want to handle errors then you don't
have to be aware that there is an allocation step. In order for this
to work any accessors that get data that is only available after
allocation should implicitly allocate the framebuffer. This patch
makes that change for cogl_wayland_onscreen_get_surface and
cogl_wayland_onscreen_get_shell_surface.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 0c4ba78787323fedd162d7b71b86b460908b9b98)
2013-07-09 15:46:46 +01:00
Neil Roberts
3060d44365 Allow cogl_wayland_onscreen_get_surface to be used non-foreignly
cogl_wayland_onscreen_get_surface previously only worked if the
onscreen had a foreign surface on it. However there is no reason why
this shouldn't also work fine for manipulating the surface that Cogl
created as well. We may want to consider adding a separate getter for
the foreign surface that can be used before the framebuffer is
allocated.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 6bc12947a51224b70525893143bfe421723ce255)
2013-07-09 15:46:46 +01:00
Lionel Landwerlin
86cd26b67c cogl-gst: protect public API using type checks
(cherry picked from commit 9a8c6536088368060a85f74d082c3dd8487b877c)
2013-07-09 13:32:16 +01:00
Neil Roberts
7b645d51cc cogland: Use wl_resource_get_user_data instead of resource->data
wl_resource may become an opaque type in future so we should probably
be using the accessors instead of directly prodding into the struct.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 8ab07725734b8b2151470cc44bb3f88798ac5538)
2013-07-04 11:50:31 +01:00
Neil Roberts
f10c5818d3 Fix the GBM_MICRO macro
The version of gbm can sometimes be suffixed with ‘-devel’. This was
making the GBM_MICRO define come out as 0-devel which was generating a
warning when it was used in a #if check. This patch makes it chop off
anything after a ‘-’ using sed.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 64472027fb5750971e94c0b4c6c624a39e5abe2f)
2013-07-04 11:50:31 +01:00
Neil Roberts
17e0cada45 Add -I$(top_builddir) to the cogl-gst doc include flags
Otherwise make distcheck fails

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 70054199e983c51ff2e37b427c2a684dfc7b83ed)
2013-07-04 11:50:31 +01:00
Neil Roberts
1224ecb96e Remove cogl-swap-chain.xml from cogl2-docs.xml
This is no longer generated so it was breaking the build when the docs
are enabled.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 67b976cdc9bc44976c7c18fac0e872a1746de21d)
2013-07-04 11:50:31 +01:00
Neil Roberts
6187b7c29f Add test-unit.h to test-fixtures/Makefile.am
Otherwise make distcheck was breaking.

Thanks to Rico Tzschichholz for pointing this out.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit d47b4d92187b9eb1b34998e02b96955afdd84a6e)
2013-07-04 11:50:31 +01:00
Neil Roberts
b1542cf9dd Don't include cogl/cogl.h from test-utils.h
There was a circular depedency when building from a fresh git clone
where test-fixtures needs to be built before the cogl directory, but
test-fixtures also indirectly includes cogl-enum-types.h which is only
generated when building the cogl directory. If we change the header to
just include specific cogl headers instead of cogl/cogl.h then we can
break the circular dependency.

This needs a tweak to test-no-gl-header because that first undefines
COGL_COMPILATION before including test-utils.h. However it doesn't
really do any actual work so we can get away without including it.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit adb26bd13a48ed571ef4cae4de005e039b34e361)
2013-07-04 11:50:31 +01:00
Neil Roberts
9730b9d6a6 Include endian.h before checking __FLOAT_WORD_ORDER
CoglFixed was trying to use the __FLOAT_WORD_ORDER macro in order to
do some fast float conversions but it wasn't including any header that
could define it so it was giving an annoying warning. This patch
checks for the macro in endian.h in the configure script and only
checks its value if it's available.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2013-07-04 11:40:40 +01:00
Neil Roberts
823f254190 Fix the check for whether to use inline ARM assembler
Commit 839cf49763 changed the inline ARM assembler so that it
won't be used when targetting the Thumb instruction set. I manually
applied the patch but I messed up the #if so it was generating a
warning.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2013-07-04 11:40:40 +01:00
Neil Roberts
a0ea2f3aca Don't enable deprecation warnings for internal API when building Cogl
The 1.x branch needs to use some of the deprecated API internally in
order to set up some deprecated state. This was causing a lot of
annoying warnings so instead we'll just disable the deprecation
attribute when COGL_COMPLIATION is defined.

It probably wouldn't be a good idea to apply this to the 2.0 branch
because at least for now we want to get warnings if we accidentally
use deprecated API internally.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2013-07-04 11:40:39 +01:00
Yosef Or Boczko
c2964723f8 Add support for automake 1.14
https://bugzilla.gnome.org/show_bug.cgi?id=703553

(cherry picked from commit 27f00aab202b07aba64bd295c071193eef9248b4)
2013-07-03 18:11:53 +01:00
Rico Tzschichholz
09a1365c3a build: Fix doc build and make dist
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2013-07-02 14:19:05 +02:00
Neil Roberts
c063896186 Set the minimum required wayland-server version to 1.1.90
Since the Wayland server support has been updated to use wl_shm_buffer
we need the latest git version of Wayland to build. Previously the
configure.ac file only had one define for the minimum version of both
the client-side and server-side support but as they are now different
this patch splits them out.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 75d62292fc268164f8a085225033abe17e59ba1c)
2013-07-01 14:37:51 +01:00
Neil Roberts
2d5a84fc35 cogland: Use wl_client_add_object instead of wl_client_add_resource
wl_client_add_resource has been deprecated in the Wayland API in
favour of wl_client_add_object which returns a pointer to a
wl_resource which it allocates instead of the compositor having to
embed it in a larger struct. As far as I understand the idea is to
eventually make wl_resource completely opaque. This patch changes
Cogland accordingly.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit adb971954757dffb9ddecf8c9091b96756424800)
2013-07-01 13:48:24 +01:00
Neil Roberts
1ad0e81b7b wayland-server: Update because wl_shm_buffer is no longer a wl_buffer
The Wayland server API has changed so that wl_shm_buffer is no longer
a type of wl_buffer and it instead must be retrieved directly from the
resource.

cogl_wayland_texture_2d_new_from_buffer now takes a resource pointer
instead of directly taking a wl_buffer and it will do different things
depending on whether it can get a wl_shm_buffer out of the resource
instead of trying to query the buffer type.

Cogland has also been updated so that it tracks a resource for buffers
of surfaces instead of directly tracking a wl_buffer. This are pointed
to by a new CoglandBuffer struct which can be referenced by a
CoglandBufferReference. The WL_BUFFER_RELEASE event will be posted
when the last reference to the buffer is removed instead of directly
whenever a new buffer is attached. This is similar to how Weston
works.

https://bugzilla.gnome.org/show_bug.cgi?id=702999

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 9b35e1651ad0e46ed489893b60563e2c25457701)

Conflicts:
	examples/cogland.c
2013-07-01 13:48:22 +01:00
Neil Roberts
baa398b324 wayland: Always call wl_display_flush before going idle
Previously Cogl would only call wl_display_flush after doing a swap
buffers on the onscreen because that is the only place where Cogl
itself would end up queueing requests. However since commit
323fe188748 Cogl takes control of calling wl_display_dispatch as well
which effectively makes it very difficult for the application to
handle the Wayland event queue itself. Therefore it needs to rely on
Cogl to do it which means that other parts of the application may also
queue requests that need to be flushed.

This patch tries to copy the display fd handling of window.c in the
Weston example clients. wl_display_flush will always be called in
prepare function for the fd which means it will always be called
before going idle. If flushing the display causes the socket buffer to
become full, it will additionally poll for write on the FD to try
flushing again when it becomes empty.

We also need to call wl_display_dispatch_pending in the prepare
because apparently calling eglSwapBuffers can cause it to read data
from the FD to receive events for a different queue. In that case
there will be events that need to be handled but the FD will no longer
be ready for reading so we won't wake up the main loop any other way.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 962d1825105a87dd8358a765353b77f6af8fe760)
2013-07-01 13:47:48 +01:00
Neil Roberts
651a2775b5 poll: Add _cogl_poll_renderer_modify_fd
_cogl_poll_rendererer_modify_fd can be used internally to modify the
event mask on an FD to be polled. This will be used in the Wayland
backend to start blocking on write whenever flushing the display fills
the socket's buffer. Modifying the FD's events causes the poll age to
increase.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 8bc0df53ee508687b87e547c1cbac5e8d7d5fc80)
2013-07-01 13:47:48 +01:00
Neil Roberts
41b97b885a poll: Always run the prepare callbacks for all sources
Eventually the Wayland winsys will want to do useful work in its
prepare callback before the main loop goes idle. Previously
cogl_poll_renderer_get_info would stop calling any further prepare
functions if it found one with a zero timeout. That would mean the
Wayland prepare function might not get called before going idle in
some cases. This patch changes it so that it continues to call all of
the prepare functions regardless of the timeout.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 02f7fa538c9d2b383fa0f601177140b571ecf315)
2013-07-01 13:47:48 +01:00