Commit Graph

68 Commits

Author SHA1 Message Date
Jean-Philippe Andre fecc487b3b Evas GL: Fix CRI message on shutdown
Just a simple log domain issue (EvasGL was not initialized, so
ERR() would trigger a fatal error). EvasGL is now initialized
on demand when a new GL surface is requested.
2015-03-05 16:19:18 +09:00
Jean-Philippe Andre bea9567d0e Evas GL: Kill runtime warnings caused by auto fallback
The previous commit modifies the concept of direct rendering
vs. indirect rendering, so some runtime checks (in debug mode
only) will fail.

This commit introduces two new engine functions:
 - gl_get_pixels_pre
 - gl_get_pixels_post

The latter will be used in a later patch for optimization.
2015-03-03 20:08:16 +09:00
Jean-Philippe Andre a14492ef73 Evas GL: Automatic fallback to indirect rendering when the scene has
not changed.

Automatically fallback to indirect rendering on FBO or X11 Pixmap
if the Evas Object Image is not marked as dirty. This should
improve the performance and/or power consumption in those
rare cases where this area of the canvas needs to be redrawn
but the GL content has not changed.

@feature
2015-03-03 18:11:32 +09:00
Jean-Philippe Andre 964d6e559f Evas GL: Fix leak of surfaces with GLES 1.1
When destroying a GLES 1.1 surface, it is necessary to also
destroy and remove the main surface from the list.

This issue probably never really showed up because people
don't:
- use GLES 1.1
- constantly create & destroy new Evas GL surfaces
- but mostly no one cares about 1.1 anymore :)

@fix
2015-02-25 15:01:45 +09:00
Jean-Philippe Andre 29da1113ee Evas GL: Restore viewport and scissor test for GLESv1
This is necessary when switching back to direct rendering.
But I suspect there are other corner cases that we didn't spot.
2015-02-24 22:18:53 +09:00
Jean-Philippe Andre ae2061dbe2 Evas GL: Fix support for GLES 1.1 indirect rendering
This requires a special context that matches the configuration
required for GLES 1.1. Otherwise eglMakeCurrent() would fail
miserably with EGL_BAD_MATCH in case of indirect rendering
(at least on some drivers).
2015-02-24 22:12:00 +09:00
Jean-Philippe Andre 93d167ac87 Evas GL: Add hidden config values for direct rendering options
Those 2 new values are here to avoid using environment variables
that have side effects on the whole application.

I'm actually wondering if we shouldn't just kill off the env
vars altogether. Also, direct override is a terrible option that
should never be used.
Memory optimization can make sense (needs more testing tho).
2015-02-24 22:12:00 +09:00
Minkyoung Kim c972994e01 evas: Evas GL - add glGetError() after surface capability test.
Summary:
After using gl funcs, must call glGetError().
To prevent wrong error catch for subsequent glGetError().

Test Plan: Local tests

Reviewers: raster, jpeg, Hermet, cedric

Reviewed By: cedric

Subscribers: spacegrapher, wonsik, cedric

Differential Revision: https://phab.enlightenment.org/D1978

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-02-16 11:54:27 +01:00
Jean-Philippe Andre 651f0ae241 Evas GL common: Improve code readability (simplify macro)
The exact same ugly macro would appear hundreds of times in the GL
code:
  GLERR(__FUNCTION__, __FILE__, __LINE__, "");

Instead, override the common GL functions iif GL_ERRORS is defined.
This greatly simplifies code and removes tons of useless lines.
Also, this will give better debugging output as the exact code line
is printed, and the function name is also printed.

Also, fix linking to the glerr function.

This is a code cleanup. Hopefully I didn't break anything with this
big operation of find & replace.
2015-02-12 11:23:03 +09:00
mythri.venugopal 48d8cdb4dd Evas GL: Fix GLES1.1 extension initialisation bug
Summary:
Extension function pointer initialisation requires glGetString(GL_EXTENSIONS).
To get GLESv1 extension string, GLESv1 context has to be bound.
Change involves updating extensions after GLESv1 context has been bound.

Reviewers: jpeg

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1946

Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
2015-02-09 14:28:16 +09:00
Jean-Philippe Andre 8f6b34d4cc Evas GL: Fix list of GLES 1.1 extensions
We should use GLESv1 functions in a GLESv1 context to scan for
GLESv1 extensions. Makes sense yeah?

This should expose the proper list... especially enabling FBO
extension when it's supported by the driver.
2014-12-19 18:14:25 +09:00
Jean-Philippe Andre 4cf2d75715 Evas GL: Fix direct rendering with client-side rotation
There was a problem when checking whether the current surface
is compatible with direct rendering. In case of client-side
rotation (it's a flag set on the surface by the app), a surface
can be directly rendered even if the rotation is not 0.

But, before this patch, it was assumed that the surface was
current. Which doesn't make sense because make_current is
called by the pixel callback, from the application, and this
happens *after* we check for direct rendering.

As a consequence, it was not possible to mix directly rendered
surfaces with FBO-based ones, and use client-side rotation.

This patch should solve that issue.
2014-12-10 10:52:22 +09:00
Jean-Philippe Andre 2a69980959 Evas GL: Fix current FBO after make_current(0, 0)
Example scenario:
- Create a direct rendered Evas GL 'sfc' 'ctx'
- Create a PBuffer dummy surface, make it current
- Do some stuff
- Make current (NULL, NULL) to go back to no target
- Make current (sfc, ctx)
--> glClear() will not render anything on screen

Reason:
The current FBO binding is still set to the implicit FBO
bound to the PBuffer surface (it could be any surface, really).
2014-12-09 18:38:08 +09:00
Jean-Philippe Andre 0514cbc1a3 Evas GL: Add preventive padding after Evas_GL_API
Since this struct is likely to grow in size over time, client apps
built against future versions of EFL might start indexing fields
that are not present in the current form.

Also, don't reset the struct memory as this would break
multithreaded GL applications.

While this is not exactly a fix, I'll backport this.

@fix
2014-12-03 16:57:49 +09:00
Jean-Philippe Andre e2a6f5129c Evas GL: Remove useless field
- fbo_attached is not used.
- buffers_allocated is just a bool
2014-11-27 16:46:31 +09:00
Jean-Philippe Andre 8771c78a90 Evas GL: Fix indirect rendering surfaces for GLES 1.1
Carefully select the requested EGL config and match it with
the available visual from X, including the following options:
- Stencil
- Depth
- MSAA

TODO: The same thing for GLX. And fix direct rendering as well.
2014-11-26 22:56:06 +09:00
Jean-Philippe Andre 1a403849dc Evas GL: Wrap glGetString for VERSION
- glGetString(GL_VERSION) should not return "OpenGL ES 3.0" because
  GLESv3 is not supported yet.

- GL_EXTENSIONS should return only the list of supported extensions
  --> disabled for now as the whitelist of safe extensions is way
      too small.
2014-11-19 16:22:37 +09:00
Jean-Philippe Andre 1608d30390 Evas GL: Create TLS during make_current if there isn't any
Apps would crash if they call make current without creating
a surface in the same thread. I don't see a good reason why
we should have this a limitation.
2014-11-18 18:46:58 +09:00
Jean-Philippe Andre f663980111 Evas GL: Add some debug
It will be triggered when EVAS_GL_API_DEBUG is set.
Yeah, that's abusing the variable a bit, as it was intended for
GL calls only, but this is pretty harmless.

Also add string  "GL_DEPTH_STENCIL".
2014-11-18 18:46:58 +09:00
Jean-Philippe Andre 56a64756eb Evas GL: Introduce concept of safe extensions
This will mark some extension functions as "safe", which means
we don't need to wrap them in order to expose them.

All the known extensions from Evas_GL_API have been marked as safe
for now.

In the future, we may encounter extensions that are not safe
out of the box, but can be wrapped. At that time, we will have
to mark them as safe but return the pointer to the wrapper instead.
Until then, only whitelisted extensions will be supported.

@feature
2014-11-14 10:43:00 +09:00
Jean-Philippe Andre f3226f5e81 Evas GL: Fix potential crash
Welp, it looks like this crash actually happened once even though
it should not. glGetString() seems to have returned NULL somehow.
2014-10-29 15:12:53 +09:00
Jean-Philippe Andre 8e4dafcf28 Evas GL: Set umask before calling mkstemp
Fixes Coverity issues:
 - CID 1039609
 - CID 1039608
2014-10-28 10:54:51 +09:00
Jean-Philippe Andre c17cfbd13e Evas GL: Add support for PBuffer surfaces with GLX
Not fully tested, but allows calling evas_gl_make_current, so
it works for dummy surfaces (eg. 1x1 for a render thread).
2014-10-20 12:16:08 +09:00
Jean-Philippe Andre 47ddb889ad Evas GL: Add support for OpenGL-ES 1.1 (part 3)
This introduces XPixmap usage for indirect rendering.
Of course this works only for the gl_x11 engine... and for
now only when using EGL... and only on some drivers...
damn limitations.
Direct rendering should work on more platforms (eg. some desktop
nvidia cards with the EGL drivers).
2014-10-20 12:16:08 +09:00
Jean-Philippe Andre 4315537820 Evas GL: Add support for OpenGL-ES 1.1 (part 2)
Add version param to context_create.
Add support for 1.1 contexts in the GL_X11 engine, and checks
for version in all other engines (return NULL).
Add API wrappers for all OpenGL-ES 1.1 APIs (normal and debug
modes).
2014-10-20 12:16:08 +09:00
Jean-Philippe Andre f30f55f9f4 Evas GL: Fix compilation for EGL/GLES
Configure with --with-opengl=es --enable-egl
Fixes runtime link dependencies
2014-10-20 12:16:08 +09:00
Jean-Philippe Andre a0712e25e1 Evas GL: Add support for pbuffer surfaces
Supports only EGL for now :(

These pbuffer surfaces can be used to create dummy surfaces for
make_current and render threads.

@feature
2014-10-20 12:16:08 +09:00
Jean-Philippe Andre 29e572cdfb Evas GL: Add support for client-side rotation
This is a new feature allowing direct rendering even when
the view is rotated. In that case, the application is responsible
for rotating its view and rendering it properly given the object
geometry.

This implements support for the flag
EVAS_GL_OPTIONS_CLIENT_SIDE_ROTATION

@feature
2014-10-20 12:16:08 +09:00
Jean-Philippe Andre 28a76266c6 Evas GL: Fix runtime linking issues
There is some mess with gl common functions that need to be
called from the engine itself, eg. error set/get.
2014-10-20 12:16:07 +09:00
Jean-Philippe Andre 49f79f0a73 Evas GL: Skip glClear() with direct rendering & transparent color
When using direct rendering, glClear() should not do anything
if the ClearColor was (0,0,0,0). The application would indeed
expect a transparent output (so, see the widgets below the view),
but glClear would erase the pixels instead. So add a quick check
to skip glClear entirely in that specific case.
2014-10-20 12:16:07 +09:00
Jean-Philippe Andre 8d6f873354 Evas GL: Add API evas_gl_error_get()
Similar in meaning to eglGetError()

@feature
2014-10-20 12:16:06 +09:00
Jean-Philippe Andre 08889de92b Evas GL: Add some thread safety
This is only the core evas gl support.
TODO: gl_x11 and other engines
2014-10-20 12:16:06 +09:00
Carsten Haitzler 75a04d6c7f evas gl - remove unused pointer variable return
fixes CID1039920
2014-08-25 12:55:40 +09:00
Cedric BAIL 0d00b476cb evas: export symbol from gl_common so that loading gl_generic can expose them. 2014-07-11 15:32:51 +02:00
Carsten Haitzler c1345ade8f partial fix for T518 - fix blank display on 2+ windows with gl
this fixes @draisch's report of blankness, but doesn't fix the
garbage. it's something to do with the always render move in elm gl -
it just doesn't seem to be rendering before evas renders, or if it is,
it's failing to work/produce content.
2014-06-16 19:24:33 +09:00
Carsten Haitzler 03983be687 fix whitespace 2014-06-10 19:22:04 +09:00
Dongyeon Kim acc95afbd8 evas gl: distinguish between IMG and EXT MSAA extensions
Summary:
For drivers that support IMG_multisampled_render_to_texture,
GL_MAX_SAMPLES_IMG should be used to query max supported samples
Likewise, for drivers that support EXT_multisampled_render_to_texture,
GL_MAX_SAMPLES_EXT should be used to query max supported samples

@fix

Reviewers: seoz, Hermet, raster, cedric

Reviewed By: cedric

CC: cedric

Differential Revision: https://phab.enlightenment.org/D948
2014-06-10 19:20:17 +09:00
Sung W. Park 2b4a7b438d evas gl: added partial rendering support for qcom extension
When running in direct rendering mode, properly support partial
rendering if the extension is properly supported.

Also, fixed the SwapBufferwWithDamage rectangle coordinate bug.
It wasn't properly y-inverted before.
2014-02-15 02:33:47 +09:00
Carsten Haitzler 93da35c5ab evas - gl - core - checke for wrong context in error check
this fixes CID 1135266
2014-02-13 19:38:13 +09:00
Carsten Haitzler 153bbd8003 evas - gl core - don't access null ptr on init
this fixes CID 1135270
2014-02-13 19:19:59 +09:00
Sung W. Park 9bb4c48691 EvasGL: cleaning up unnecessary code.
Cleaning up unnecessary code.
2013-10-30 10:47:52 +09:00
Sung W. Park 7dc102c55f EvasGL: Fixed direct rendering not clipping issue
Evas GL direct rendering mode didn't properly take into account
the image object's clipping information and clip the region that
it was directly rendering to. Hence there were issues with the
direct rendering region drawing over the objects that are sitting
on top of it.

Also, cleaned up the direct rendering coordinate computation code
and a nasty dependency with image object that should have been
removed a long time ago.  Basically the evas-gl engine was directly
accessing the image object data structure for its data when it
really should have just passed along necessary information.
2013-10-24 17:42:21 +09:00
Sung W. Park b9e3e6be57 EvasGL: Fixed a bug where the wrong data variable to buffer alloc func.
It's an optional feature so it's not automatically turned on but
would have caused a segfault somewhere.  Somehow slipped notice
but fixed now.
2013-09-17 17:24:30 +09:00
Sung W. Park 4ece1a1f9f EvasGL: Fix surface destroy mismatch bug.
For EvasGL direct rendering, EvasGL does a make_current to the
surface that evas is holding on to.  When EvasGL was shutting down
it was wrongly deleting evas' surface. This issue was temporarily
fixed by Raphael before but the proper fix was added.
2013-09-10 13:53:56 +09:00
Rafael Antognolli 2e2cac43da evas/gl: Do not reassign the surface during make current.
There was already a surface created by _evgl_tls_resource_create(). If
we assign a new one here, the wrong one will be destroyed at
_evgl_tls_resource_destroy(), and later the GL window will be destroyed
before the surface, causing invalid access errors.

This fixes https://phab.enlightenment.org/T326
2013-09-04 15:20:59 -03:00
Chris Michael 6229a871de When printing this debug message, check for valid extension string get
function First.

NB: Fixes Coverity CID1039394

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-07-08 14:30:41 +01:00
Chris Michael f9348a5015 Fix klockwork possible memleak report:
If we get an error trying to "make current" an allocated surface, then
we should free that allocated surface.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2013-06-28 14:23:57 +01:00
Daniel Willmann adcde1f87e evas gl_common: Fix incorrect number of parameters in functions
_evgl_tls_resource_get() and _surface_context_list_print() don't take
parameters.

Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
2013-06-26 14:42:10 +01:00
Tom Hacohen 182dfb82d4 Evas gl: Fixed double-free when failing gl init. 2013-06-26 10:40:44 +01:00
Cedric Bail d06a0982ef evas: add support for asynchronously uploading GL texture.
NOTE: when using Evas_Object image preload infrastructure the GL texture
upload was uploaded from the main loop during the rendering stage. This
could lead to some frame drop during fast animation due to the time needed
to upload that texture.

This patch fix this problem by uploading a small texture quickly (16x16)
and waiting for going back to the main loop to be able to use the same GL
context from another thread to do the texture upload asynchronously without
blocking the main loop.
2013-06-24 12:04:18 +09:00