Commit Graph

1984 Commits

Author SHA1 Message Date
Adel Gadllah
4f8254f1ae winsys-glx: Add error traps in create_context
Both create_gl3_context and glXCreateNewContext can fail with an X error.

https://bugzilla.gnome.org/show_bug.cgi?id=742678
2015-07-26 16:04:14 +02:00
Emmanuele Bassi
812aba31e7 winsys: Drop xlib_get_visual_info from the vtable
We don't need the hack any more; CoglRenderer has the appropriate API
for the Xlib-based winsys backends.
2015-07-22 20:28:19 +01:00
Emmanuele Bassi
c9080b3e25 Use CoglRenderer for implementing deprecated, Clutter-only API
Instead of using the winsys vtable.
2015-07-22 20:27:33 +01:00
Emmanuele Bassi
8e9d3e92d8 onscreen: Use the CoglRenderer API for retrieving the X visual
Instead of peeking into the winsys vtable.
2015-07-22 20:21:33 +01:00
Emmanuele Bassi
e79d571453 Store the XVisualInfo in the X11-based winsys backends
Instead of freeing it after creating the relative GL contexts, store it
in the CoglXlibRenderer data.
2015-07-22 20:20:05 +01:00
Emmanuele Bassi
19ca856810 Store XVisualInfo into the Xlib renderer
We want to be able to retrieve the XVisualInfo used when creating the
GL context under GLX and EGL-X11, so that we can use the visual before
we have an onscreen frame buffer.
2015-07-22 20:17:52 +01:00
Emmanuele Bassi
0ad995746a Avoid compiler error for uninitialized value
Fixes Cogl compilation on build.gnome.org.
2015-06-10 18:42:39 +01:00
Emmanuele Bassi
3290240600 egl-x11: Fix compiler warnings
Stereo mode changed two fields in the winsys vtable, so we need to
update the signature of the implementation in the EGL-X11 winsys.
2015-06-10 15:20:17 +01:00
Emmanuele Bassi
838355afbd Fix compiler warnings
Initialize variables; GCC does not always catch all cases where the
variables are used after being initialized, especially when it comes to
out parameters.
2015-06-10 15:13:45 +01:00
Emmanuele Bassi
c5dc9542d5 Include deprecated header for cogl_read_pixels()
Avoids a compiler warning for a missing declaration.
2015-06-10 14:14:06 +01:00
Emmanuele Bassi
e7ef07652a Conditional call to g_type_init()
The explicit type system initialization has been deprecated since
GLib 2.36. It's done automatically, now.
2015-06-10 14:12:22 +01:00
Emmanuele Bassi
15b952e03e Fix compiler warnings
Simple enumeration checks.
2015-06-10 14:10:34 +01:00
Rui Matos
eb87ad165c framebuffer-deprecated: Unref the correct buffer
Looks like a thinko introduced by commit
79719347c8 .

Found by a coverity scan.

https://bugzilla.gnome.org/show_bug.cgi?id=749111
2015-05-08 15:39:27 +02:00
Jasper St. Pierre
f8cce5f6cb cogl-framebuffer-gl: Work again on GLESv2 2015-04-20 12:09:27 -07:00
Ray Strode
68d9ba3b65 kms-winsys: try to hobble along if driver doesn't support page flips
Some drivers ( like mgag200 ) don't yet support drmModePageFlip.

This commit forgoes waiting for vblank and flips right away
in those cases. That prevents the hardware from freezing up the screen,
but does mean there will be some visible tearing.

https://bugzilla.gnome.org/show_bug.cgi?id=746042
2015-03-23 10:11:46 -04:00
Robert Bragg
da0d9757e7 Add version 1.2 define + macros 2015-02-23 18:39:34 +00:00
Rui Matos
f82e9e2d22 kms-winsys: Remove a few unused variables 2015-02-23 18:36:56 +00:00
Rui Matos
200c4032ac kms-winsys: Defer setting new surfaces until swap buffers
We can't just destroy and replace the EGL and gbm surfaces while
they are still in use i.e. while there is a pending flip. In fact, in
that case, we were calling gbm_surface_destroy() on a surface that
still had the front buffer locked and then, on the flip handler,
gbm_surface_release_buffer() for a buffer that didn't belong to the
new surface.

Instead, we still allocate new surfaces when requested but they only
replace the old ones on the next swap buffers when we're sure that the
previous flip has been handled and buffers properly released.
2015-02-23 18:36:56 +00:00
Chris Wilson
5ccd2825c7 glx: Precisely wait for the next vblank
Currently the code queries the current msc then tries to approximate the
value of the next msc satisfing the modulus 2 for when to wait. This
introduces some instability as the msc may tick over during the
roundtrip leading to a 32ms wait instead of a 16ms wait. This happens
often enough to cause jerky animations, and affect gnome-shell-perf-tool.

A simpler solution is just use a single roundtrip by using WaitForMsc to
ask the driver to compute the next vblank itself.

Cc: Owen W. Taylor <otaylor@fishsoup.net>
Cc: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Robert Bragg <robert@sixbynine.org>
2015-02-04 19:31:40 +00:00
Rui Matos
b9640c091f wayland-winsys: Provide a wl_registry.global_remove callback
Otherwise libwayland-client will abort() when we get that event.

https://bugzilla.gnome.org/show_bug.cgi?id=743594
2015-01-30 16:05:41 +01:00
Rui Matos
c36e31401d kms-winsys: Mark the framebuffer to be bound when setting a new layout
We need to bind the context to the new EGL surface we just created.

https://bugzilla.gnome.org/show_bug.cgi?id=741881
2015-01-30 16:05:41 +01:00
Marco Trevisan (Treviño)
cd9676380f mir: use output names that are more conformat to the one used by Xmir
And by X itself...
2014-12-12 18:45:49 +01:00
Marco Trevisan (Treviño)
bc83282f4f mir: add renderer event listener support 2014-12-10 15:33:35 +01:00
Marco Trevisan (Treviño)
2872695fa7 mir: don't always allocate when getting the mir surface
Add proper documentation on header file
2014-12-09 22:01:32 +01:00
Marco Trevisan (Treviño)
7c71a06936 mir: fix mir surface recreation on resize, bind and update pointers
don't try to read from free'd memory allocation, copy stuff before
deinitializing the old onscreen.

Also, don't try to resize a foreign surface.
2014-12-09 20:22:53 +01:00
Marco Trevisan (Treviño)
a9a923c6f3 mir: correctly init/clear mutex and use prgname for surface 2014-12-09 20:16:36 +01:00
Marco Trevisan (Treviño)
1016fb64de mir: return proper surface / connection only when valid, without failing 2014-12-09 20:13:39 +01:00
Marco Trevisan (Treviño)
a144087085 mir: release surfaces on errors 2014-11-21 18:00:49 +01:00
Marco Trevisan (Treviño)
6aaeab0460 mir: add public method to resize a cogl onscreen
This will internally recreate a new surface with proper parameters
2014-11-21 18:00:10 +01:00
Marco Trevisan (Treviño)
bd6bfccc40 cogl.h: include mir renderer if the platform is supported 2014-11-20 19:11:05 +01:00
Marco Trevisan (Treviño)
77e28d4a77 mir: only allow to set foreign surfaces with hardware buffer
And return a CoglBool accordingly.
2014-11-20 07:18:26 +01:00
Marco Trevisan (Treviño)
8e6997db44 mir: return whether a foreign connection has been set or not 2014-11-20 07:17:19 +01:00
Marco Trevisan (Treviño)
e06a0b3d10 mir: release a connection on error 2014-11-18 22:16:38 +01:00
Marco Trevisan (Treviño)
b26466ad54 mir: improve error logging 2014-11-18 22:11:24 +01:00
Marco Trevisan (Treviño)
e5fd82e2a1 mir: use standard c types 2014-11-18 16:28:17 +01:00
Marco Trevisan (Treviño)
1cbc1c67a0 mir: add support for Mir Outputs 2014-11-17 18:50:30 +01:00
Marco Trevisan (Treviño)
a948c25116 mir: update the framebuffer size on resize events
We need to use a mutex as mir handles these on
different threads, also using an event idle prevents
to get initialization errors on cogl side.
2014-11-17 17:47:23 +01:00
Marco Trevisan (Treviño)
62f3f56d29 mir: set last state after initializing the surface 2014-11-17 17:45:59 +01:00
Marco Trevisan (Treviño)
1b9380ef3c mir: add support for foreign surfaces 2014-11-17 16:08:59 +01:00
Marco Trevisan (Treviño)
a3ae538c45 mir: add support for foreign display 2014-11-17 15:59:29 +01:00
Marco Trevisan (Treviño)
672eff0c6c cogl: add Mir EGL platform 2014-11-17 15:49:20 +01:00
Adel Gadllah
bf3954ebe3 cogl-kms-display: Fix doc comment 2014-10-03 11:50:37 +02:00
Owen W. Taylor
4d8771a8c2 CoglTexturePixmapX11: add support for stereo content
Add cogl_texture_pixmap_x11_new_left() and
cogl_texture_pixmap_x11_new_right() (which takes the left texture
as an argument) for texture pixmap rendering with stereo content.
The underlying GLXPixmap is created using a stereo visual and shared
between the left and right textures.

Reviewed-by: Robert Bragg <robert.bragg@intel.com>
2014-07-17 19:27:13 -04:00
Owen W. Taylor
d16df5a5aa Add support for setting up stereo CoglOnscreens
If we want to show quad-buffer stereo with Cogl, we need to pick an
appropriate fbconfig for creating the CoglOnscreen objects. Add
cogl_onscreen_template_set_stereo_enabled() to indicate whether
stereo support is needed.

Add cogl_framebuffer_get_stereo_mode() to see if a framebuffer was
created with stereo support.

Add cogl_framebuffer_get_stereo_mode() to pick whether to draw to
the left, right, or both buffers.

Reviewed-by: Robert Bragg <robert.bragg@intel.com>
2014-07-17 19:27:05 -04:00
Adel Gadllah
d9afc6dada kms-winsys: Add api that tells cogl to ignore a crtc
An application might for whatever reason want to control a specific output
directly and have cogl only swap the other outputs if any. So add an api that
allows setting a crtc to be ignored.

https://bugzilla.gnome.org/show_bug.cgi?id=730536
2014-06-30 20:26:05 +02:00
Adel Gadllah
fe183554ca kms_winsys: Add cogl_kms_renderer_get_gbm api
Applications might want to get the underlying gbm device so add a getter for it.

https://bugzilla.gnome.org/show_bug.cgi?id=730536
2014-06-30 20:25:52 +02:00
Neil Roberts
52a646abc5 Use the EGL_KHR_surfacless_context extension
The surfaceless context extension can be used to bind a context
without a surface. We can use this to avoid creating a dummy surface
when the CoglContext is first created. Otherwise we have to have the
dummy surface so that we can bind it before the first onscreen is
created.

The main awkward part of this patch is that theoretically according to
the GL and GLES spec if you first bind a context without a surface
then the default state for glDrawBuffers is GL_NONE instead of
GL_BACK. In practice Mesa doesn't seem to do this but we need to be
robust against a GL implementation that does. Therefore we track when
the CoglContext is first used with a CoglOnscreen and force the
glDrawBuffers state to be GL_BACK.

There is a further awkward part in that GLES2 doesn't actually have a
glDrawBuffers state but GLES3 does. GLES3 also defaults to GL_NONE in
this case so if GLES3 is available then we have to be sure to set the
state to GL_BACK. As far as I can tell that actually makes GLES3
incompatible with GLES2 because in theory if the application is not
aware of GLES3 then it should be able to assume the draw buffer is
always GL_BACK.

Reviewed-by: Robert Bragg <robert.bragg@intel.com>
(cherry picked from commit e5f28f1e75db9bdc4f2688f420a74f908f96cf76)

Conflicts:
	cogl/winsys/cogl-winsys-egl-kms.c
	cogl/winsys/cogl-winsys-egl-x11.c
2014-06-17 13:31:03 +01:00
Neil Roberts
eb7c37812a Add a COGL_EXT_IN_GLES3 option to specify extensions that are in GLES3
Some features that were previously available as an extension in GLES2
are now in core in GLES3 so we should be able to specify that with the
gles_availability mask of COGL_EXT_BEGIN so that GL implementations
advertising GLES3 don't have to additionally advertise the extension
for us to take advantage of it.

Reviewed-by: Robert Bragg <robert.bragg@intel.com>
(cherry picked from commit 4d892cd97558da61ba526f947ac0555ebab632d2)
2014-06-17 13:26:20 +01:00
Felix Riemann
5556241b67 atlas-texture: Keep reference on potential destination atlas
When a new CoglAtlasTexture tries to fit into an existing CoglAtlas
it should make sure the atlas stays valid while it expands.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 2eec9758f67e9073371c2edd63379324849373c4)
2014-05-19 12:47:09 +01:00
Kristian Høgsberg
22378d572b cogl-winsys-egl-kms: Call swap notify handler even when pageflip ioctl fails
This can happen when we dpms off the output or when login1 takes away
drm master status from our drm fd.  In either case, we need to call
the swap notify handler so that the compositor dosn't get stuck waiting
for that notification.  The compositor should stop repainting shortly in
both cases, as it's either going into dpms off mode or vt switching away.

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

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2014-04-30 16:41:09 +01:00