Commit Graph

1369 Commits

Author SHA1 Message Date
Emmanuele Bassi
b0300a6247 cogl: Pack ClutterStageCogl a bit more
We should rearrange the fields a bit so they get packed without holes,
and aligned with cacheline boundaries.
2015-07-08 11:15:54 +01:00
Jasper St. Pierre
21ce9bc08b clutter-stage-cogl: Match EGL's behavior of eglSwapBuffersWithDamage
-1 is explicitly an invalid value to pass to eglSwapBuffersWithDamage,
and the specification admits as much:

                                                         If
    eglSwapBuffersWithDamageEXT is called and <n_rects>, is less
    than zero or <n_rects> is greater than zero but <rects> is
    NULL, EGL_BAD_PARAMETER is generated.

Fix up our usage of SwapBuffersWithDamage to match the behavior in the
EGL specification.

https://bugzilla.gnome.org/show_bug.cgi?id=745512
2015-04-29 22:41:58 +01:00
Emmanuele Bassi
83caeaae9b stage-cogl: Abort realize() if there's no CoglContext
There's no point in trying to go ahead if we don't have a context to
create the CoglOnscreen framebuffer, and Cogl will crash anyway if we
pass NULL to the constructor.
2015-03-17 13:47:08 +00:00
Chris Wilson
239280f855 stage-cogl: Fix damage tracking with varying buffer ages
With server-side buffer allocation, buffers may be returned out of order
(e.g. they may be held onto by external references or hardware). As such
we may see older buffers the frame after we discard the history from
seeing a very young buffer. To overcome this we want to keep the history
in a ring so we can keep track of older entries without keeping an
unbounded list. After converting to a ring, the maximum buffer age
observed during testing was 5 (expected value of 4), but before we could
see ages as high as 9 due to the huge latency spikes caused by doing full
buffer redraws (compounded by external listeners doing readback on the
damaged areas, for example vnc, drm/udl, prime). For this reason, a
maximum age of 16 was chosen to be suitably large enough to prevent these
worst cases from taxing the system.

v2: Fix off-by-one in combining the damage histroy into the clipping
rectangle, and apply copious whitespace fixes.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=745512
References: https://bugzilla.gnome.org/show_bug.cgi?id=724788
References: https://bugzilla.gnome.org/show_bug.cgi?id=669122
2015-03-15 14:46:42 +00:00
Chris Wilson
55c957267e stage-cogl: Use swap buffers with damage
cogl provides an interface to pass along damage with the swap buffers
request. This is useful for the display servers and hardware to minimise
the work done in updating the screen and also reducing the work done by
external listeners (such as vnc, drm/udl and PRIME).

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=745512
2015-03-15 14:45:53 +00:00
Emmanuele Bassi
253292802c Drop the UProf dependency
Nobody has been compiling Clutter with profiling enabled in a long time.

UProf itself hasn't been updated in 5 years, and it still depends on
deprecated components like dbus-glib, with no port to GDBus in sight.

The profiling code was moderately useful in the past, but these days
it's probably better to profile Cogl than Clutter itself; timing
information can be extracted by the timestamp on each diagnostic message
that is now available by default in the CLUTTER_NOTE macro, and we can
add ad hoc counters where needed.
2015-03-03 17:44:15 +00:00
Emmanuele Bassi
3879bacc78 Avoid a compiler warning
Initialize a pointer variable.
2014-12-03 12:05:37 +00:00
Adel Gadllah
3517c11c9b stage-cogl: Don't mess with the damage_history list when buffer_age is not available 2014-04-10 21:30:15 +02:00
Adel Gadllah
06387c3fd7 stage-cogl: Fix feature check in clutter_stage_cogl_redraw
We do not strictly require the 'swap-region' Cogl feature in order to use
clipped redraws: they work equally well with just the 'buffer-age' Cogl
feature.

https://bugzilla.gnome.org/show_bug.cgi?id=726313
2014-03-14 17:56:40 +01:00
Adel Gadllah
2639395533 stage-cogl: Fix buffer_age code path
Currently we where checking whether the damage_history list contains
more or equal then buffer_age entries. This is wrong because we prepend
our current clip to the list just before the check.

Fix that to check whether we have more entries instead of more or equal.

https://bugzilla.gnome.org/show_bug.cgi?id=724788
2014-02-20 12:00:20 +01:00
Adel Gadllah
197d170364 stage_cogl: Don't scale the current_damage when adding to the damage_list
Otherwise we will union the scaled rectange with the clip_region which is
unscaled causing us to redraw a larger area.
2014-02-14 13:16:52 +01:00
Owen W. Taylor
cbb9d1e062 ClutterStageCogl: Ignore a clip the size of the stage
If the clip region includes the entire stage, ignore it - we aren't
actually clipped.

https://bugzilla.gnome.org/show_bug.cgi?id=719901
2013-12-05 08:38:16 -05:00
Owen W. Taylor
97dcb108d0 ClutterStageCogl: Clip in the right coordinate system
Our clip coordinates are relative to the stage, not model-view
transformed. cogl_framebuffer_push_rectangle_clip() was accidentally
used instead of cogl_framebuffer_push_scissor_clip() when porting
to the framebuffer clip API.

https://bugzilla.gnome.org/show_bug.cgi?id=719900
2013-12-05 08:38:16 -05:00
Emmanuele Bassi
705640367a Use the non-deprecated Cogl clipping API
Cogl 1.18 deprecated the global clipping API in favour of the
per-framebuffer one, but since we're using the 2.0 API internally we
don't have access to the deprecated symbols any more.

This is pretty much a mechanical port for all the places where we're
still using the old 1.x API.
2013-12-04 16:07:17 +00:00
Emmanuele Bassi
a26690a73d cogl: Compensate for window scaling
The common stage window code that we share on Cogl-based backends should
also use the scaling factor.

https://bugzilla.gnome.org/show_bug.cgi?id=705915
2013-09-19 22:51:52 +01:00
Emmanuele Bassi
1f37798b4c Revert "cogl: Replace deprecated Cogl API"
This reverts commit 6dd9da05c7.

Windowing system features we need are not mapped on cogl_has_feature().

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
2013-07-04 16:12:27 +01:00
Emmanuele Bassi
6dd9da05c7 cogl: Replace deprecated Cogl API 2013-07-03 18:35:55 +01:00
Owen W. Taylor
b248941af5 Add clutter_stage_set_sync_delay()
New experimental API is added to allow changing the way that redraws
are timed for a stage to include a "sync delay" - a period after
the vertical blanking period where Clutter simply waits for updates.

In detail, the algorithm is that when the master clock is restarted
after drawing a frame (in the case where there are timelines running)
or started fresh in response to a queued redraw or relayout, the
start is scheduled at the next sync point (sync_delay ms after the
predicted vblank period) rather than done immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=692901
2013-02-13 09:27:17 -05:00
Adel Gadllah
b9ad93ad8d stage-cogl: Reuse backbuffer contents
Use the buffer_age extension when available to recycle backbuffer contents
instead of blitting from the back to front buffer when doing clipped redraws.

The picking is now done in a pixel that is going to be repaired during the next
redraw cycle for non static scences.

This should improve performance and avoid tearing.

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

https://bugzilla.gnome.org/show_bug.cgi?id=669122
2013-02-06 18:21:27 +01:00
Adel Gadllah
60f20e8a7e stage-window: make it possible to damage the back buffer
This allows us to report to the backend that the stage's back buffer has been trashed
while handling picking. If the backend is keeping track of the contents of back buffers
so it can minimize how much of the stage is redrawn then it needs to know when we do pick
renders so it can invalidate the back buffer.

Based on patch from Robert Bragg <robert@linux.intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=669122
2013-02-06 18:20:49 +01:00
Emmanuele Bassi
550168eee3 Clean up deprecated header inclusion
The build should not add deprecated/ into the default INCLUDE paths, so
that deprecated headers are clearly separated; this will make it easier
to get rid of them when we branch out for 2.0.
2012-06-23 08:23:11 +01:00
Neil Roberts
107f43a838 clutter-stage-cogl: Use CoglPrimitive for the debug redraw code
CoglVertexBuffer is deprecated so here is a fairly simple replacement
to use the experimental CoglPrimitive API.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-04-25 17:30:17 +01:00
Robert Bragg
671ead6681 Rename cogl_framebuffer_swap_* apis to cogl_onscreen_swap_*
Recently the cogl_framebuffer_swap_* apis were moved into the
cogl_onscreen_* namespace since only CoglOnscreen framebuffers can be
double buffered. This renames all uses of the cogl_framebuffer_swap_*
apis in Clutter.
2012-02-21 17:46:11 +00:00
Robert Bragg
fbf94310fc Pass a CoglContext when calling cogl_pipeline_new
The experimental cogl_pipeline_new() api was recently changed so it
explicitly takes a CoglContext. This updates all calls to
cogl_pipeline_new() in clutter accordingly.
2012-02-21 17:46:11 +00:00
Florian Müllner
02a020a7fd Add missing include
clutter-profile.h used to be included via clutter-debug.h, but no
more (8a4dc3c011) ...
2011-11-18 22:06:30 +01:00
Emmanuele Bassi
9c038ebefb stage-window: Add :backend and :wrapper properties
All StageWindow implementation already have back pointers, but we need a
unified API to actually set them from the generic code path; we can use
properties on the StageWindow interface — though this requires fixing
all backends at the same time, to avoid GObject complaining.
2011-11-10 14:55:03 +00:00
Emmanuele Bassi
5c9cafb411 cogl/backend: Remove the ClutterBackendCogl class
All the functionality that ClutterBackendCogl provided has been moved
into ClutterBackend itself, so there is no need to have this class
around in the source.

Cogl-based backends can derive directly from ClutterBackend.
2011-11-10 14:55:03 +00:00
Emmanuele Bassi
5ac0cf1c28 cogl/backend: Remove pre/post_parse
The CLUTTER_VBLANK environment variable is now handled in the common
code path.
2011-11-10 14:55:02 +00:00
Emmanuele Bassi
db211a2131 Remove per-backend CLUTTER_VBLANK envvar
We have a global flag we can use.
2011-11-10 14:55:02 +00:00
Emmanuele Bassi
80fdbeb954 backend: Provide a default get_features() implementation
Continue gutting ClutterBackendCogl; get_features() is the last bit that
still does something, but now we can use the Cogl API.
2011-11-10 14:42:41 +00:00
Emmanuele Bassi
0c02e8adb3 cogl/backend: Remove ensure_context()
We have a default implementation for it, now.
2011-11-10 14:42:40 +00:00
Emmanuele Bassi
405e72f2e4 egl: First attempt at cleaning up the EGL native backend
At least, let's make it compile when built along with the other
backends. In reality, it still needs to be verified as working.
2011-11-03 13:45:20 +00:00
Emmanuele Bassi
19508132df build: Move EGL-related files under egl/
Including the clutter-cex100.h.in header.
2011-11-03 13:45:20 +00:00
Emmanuele Bassi
fedfac3b7c Remove the X11-specific bit in ClutterStageCogl
Let's use a new virtual function in ClutterStageWindow to check whether
a platform-specific implementation does support clipped redraws.
2011-11-03 13:45:19 +00:00
Emmanuele Bassi
a09bbffd92 Implement multi-backend support
The Clutter backend split is opaque enough that should allow us to just
build all possible backends inside the same shared object, and select
the wanted backend at initialization time.

This requires some work in the build system, as well as the
initialization code, to remove duplicate functions that might cause
conflicts at build and link time. We also need to defer all the checks
of the internal state of the platform-specific API to run-time type
checks.
2011-11-03 13:45:19 +00:00
Giovanni Campagna
9c102b7c51 Rework the interaction between the Cogl and GDK / X11 backends.
Previously, the Cogl backend was at times a subclass of the X11
backend, and at times a standalone one. Now it is the other way
round, with GDK and X11 backends providing the concrete classes,
layered on top of the generic Cogl backend. A new EglNative backend
was introduced for direct to framebuffer rendering. This greatly
simplifies the API design (at the expense of some casts needed)
and reduces the amount of #ifdefs, without duplicating code.

https://bugzilla.gnome.org/show_bug.cgi?id=657434
2011-11-03 13:45:17 +00:00
Giovanni Campagna
610a9c17ba Add a new GDK backend
This commit introduces a new flavour for Clutter, that uses GDK
for handling all window system specific interactions (except for
creating the cogl context, as cogl does not know about GDK), including
in particular events. This is not compatible with the X11 (glx)
flavour, and this is reflected by the different soname (libclutter-gdk-1.0.so),
as all X11 specific functions and classes are not available. If you
wish to be compatible, you should check for CLUTTER_WINDOWING_X11.
Other than that, this backend should be on feature parity with X11,
including XInput 2, XSettings and EMWH (with much, much less code)

https://bugzilla.gnome.org/show_bug.cgi?id=657434
2011-11-03 13:42:13 +00:00
Robert Bragg
db53ca382c cogl: fallback to non-transparent stages if unsupported
If our check of the CoglOnscreenTemplate during initialization fails
then we disable the request for an alpha component in the swap chain and
try the check again.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-11-02 17:38:56 +00:00
Emmanuele Bassi
4ce95306a3 tslib: Remove mention of clutter-stage-egl.h
That header has long since disappeared from the build.
2011-11-02 13:00:47 +00:00
Robert Bragg
6e28121ff3 cogl: include <cogl/cogl-xlib.h> for xlib specific symbols
Since Xlib.h is such a terrible citizen when it comes to symbol
namespacing it's not desirable to include Xlib.h if it is not absolutely
required. Cogl now has a standalone cogl-xlib.h that should be included
whenever any xlib specific symbols are required.

This patch updates clutter to include <cogl/cogl-xlib.h> wherever
clutter needs to use xlib specific cogl apis.

Acked-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-11-01 16:24:00 +00:00
Emmanuele Bassi
09de87b0e5 backend: Remove atexit handlers
The g_atexit() function has been deprecated in GLib as it is a fairly
bad idea in basically all cases.

We could probably use a GCC destructor if we didn't care about
portability, but for the time being we just remove the atexit() handler
that disposed the backend.
2011-10-31 10:33:46 +00:00
Emmanuele Bassi
af7afc29a7 Add a Clutter-specific deprecation macro for symbols
Just like GLIB_DEPRECATED and GLIB_DEPRECATED_FOR, Clutter should have
its own wrappers for G_DEPRECATED and G_DEPRECATED_FOR, to allow opting
out of deprecation warnings.

Deprecation warnings are enabled by default, now, even when building
Clutter.
2011-10-11 23:03:09 +01:00
Emmanuele Bassi
1776ac8ed5 Remove internal usage of ClutterGeometry in StageWindow
The ClutterGeometry type is a poor substitute of cairo_rectangle_int_t,
with unsigned integers for width and height to complicate matters.

Let's remove the internal usage of ClutterGeometry and switch to the
rectangle type from Cairo.

https://bugzilla.gnome.org/show_bug.cgi?id=656663
2011-09-26 12:05:55 +01:00
Emmanuele Bassi
598e7a4a7e cogl/stage: Protect against multiple invocation of unrealize() 2011-09-09 13:52:55 +01:00
Robert Bragg
d2763fd8a4 stage-cogl: pass top-left relative swap_region coords
All 2D coordinate spaces in Cogl have their origin at the top-left so we
shouldn't be flipping the coordinates we pass to
cogl_framebuffer_swap_region to be relative to the bottom of the
framebuffer.

This bumps the Cogl version requirement to 1.7.5 since we've had to fix
a bug in the semantics of cogl_framebuffer_swap_region.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:42:42 +01:00
Robert Bragg
672bc337ba build: don't explicitly include and egl or gl headers
This avoids explicitly including gl or egl headers in
clutter-egl-headers.h. We were getting build failures when building
clutter against a libcogl that has runtime support for GL and GLES
because cogl-defines.h was including gl.h and then clutter-egl-headers.h
was later including GLES2/gl.h with typedef conflicts. Clutter relies on
Cogl to abstract GL and GLES and the winsys APIs like EGL and GLX so
Clutter should just rely on cogl.h to include the appropriate egl.h in
clutter-egl-headers.h.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-18 17:07:40 +01:00
Neil Roberts
a72237b876 clutter-stage: Add clutter_stage_get_redraw_clip_bounds
This adds a public function to get the bounds of the current clipped
redraw on a stage. This should only be called while the stage is being
painted. The function diverts to a virtual function on the
ClutterStageWindow implementation. If the function isn't implemented
or it returns FALSE then the entire stage is reported. The clip bounds
are in integer pixel coordinates in the stage's coordinate space.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2421
2011-07-13 13:54:50 +01:00
Robert Bragg
ab6be41ea0 build: update cogl_onscreen_x11 syms to cogl_x11_onscreen
Cogl recently renamed symbols with the form
cogl_onscreen_<platform>_blah to be consistent with other platform
specific APIs so they are now named like cogl_<platform>_onscreen_blah.
This makes the corresponding change to clutter.
2011-07-11 16:59:26 +01:00
Robert Bragg
d182d5a171 backend-cogl: update _get_egl_context symbol name
Cogl changed has changed the name of cogl_context_egl_get_egl_context to
cogl_egl_context_get_egl_context to be consistent with other platform
specific symbols.
2011-07-11 16:59:26 +01:00
Robert Bragg
71d0872b76 don't call cogl_set_default_context since it's been removed
cogl_set_default_context has been removed from Cogl so this updates
Clutter in-line with that change.
2011-07-11 16:59:26 +01:00