Re: How can we gracefully handle Cogl and GL out of memory conditions?



Hi Reza,

Cogl 1.14 should be able to gracefully report out of memory conditions when allocating textures and framebuffers. The recommended way would be to use cogl_texture_allocate() and cogl_framebuffer_allocate() to explicitly try and allocate texture and framebuffer resources which can report a CoglError if there was a problem.

If you are using Cogl's high level texture constructors like cogl_texture_new_with_size or cogl_texture_new_from_data then these apis should return NULL if there was a problem allocating the texture due to lack of memory but in Cogl 1.14 it looks like we broke these semantics and it's possible for cogl_texture_new_with_size to return a CoglTexture object which doesn't yet have an associated allocation and you could hit an error later if you try to create a framebuffer from that texture if it turns out you don't have enough memory.

I think Clutter 1.14 uses cogl_texture_new_with_size for the offscreen effects and it is expecting it to return NULL if there is an error. Similarly Clutter uses cogl_offscreen_new_to_texture() and expects that to return NULL on failure to allocate. I'm afraid that we also broke the semantics of this api too :-/

I've just push a wip/cogl-14-fixes branch with a couple of patches that may help you by fixing both of those regressions on the 1.14 branch.

I hope that helps,
Robert



On Sat, Oct 12, 2013 at 12:00 AM, Reza Ghassemi <reza robin1 gmail com> wrote:
Sorry, somehow sent this before I was done.  
To conclude:
The output below shows Clutter warning when the texture for the 2nd offscreen effect (blur) on an actor tree could not be allocated.  The first effect (desaturate) did get allocated and applied and displayed properly. However when an animated page turn effect on a stack of 5 actors was attempted the GL out of memory errors occurred and parts or the entire screen went black.

Question: Any recommendations how to deal with this?  Is this a bug in cogl or clutter?  Is this expected?  We want to just not do the effect if memory is going to run out and avoid the black screen.  Should we do some memory queries and keep track of how much we might need and catch potential problems in application code?

Upgrading to 1.16 is going to take some effect do to dependency changes and deprecated function use so we'd like to avoid that if possible.

Thanks again.

Reza



On Fri, Oct 11, 2013 at 3:36 PM, Reza Ghassemi <reza robin1 gmail com> wrote:
Hello Clutter users and developers,

Using the top of 1.14 branch when trying to use 2 offscreen effects such as blur and desaturate on a full HD screen sized actor and then after that trying to do a page turn effect on a smaller actor we run out of  video RAM (I'm assuming) on our OpenGL ES device  and get errors from Cogl when it calls GL calls to render attributes or allocate texture memory for resulting in black actor(s).

    While we might be able to fix this particular issue by making sure to remove/destroy the effects from the actor before applying another effect on another actor, we want a graceful general way to handle tight memory situations and not just display black to support other party developement with our script driven driven system.  It seems that you can eat up most of your memory with an effect and then memory runs out just trying to draw normal actors with no effects

Clutter-WARNING **: Unable to allocate texture for offscreen effect: Out of memory

However we get into a situation where we're getting errors from GL out of memory I guess when trying to use more than one offscreen effect in the same scene and when some of them are failing.  This results in black textures.  It seems that the memory isn't recovered until the actors are deleted and a new scene is constructed.

(.:1836): Cogl-WARNING **: ./driver/gl/cogl-framebuffer-gl.c:1072: GL error (1285): Out of memory


(.:1836): Cogl-WARNING **: ./driver/gl/cogl-framebuffer-gl.c:1072: GL error (1285): Out of memory


(.:1836): Cogl-WARNING **: ./driver/gl/cogl-framebuffer-gl.c:1139: GL error (1285): Out of memory


(.:1836): Cogl-WARNING **: ./driver/gl/cogl-framebuffer-gl.c:1072: GL error (1285): Out of memory


(.:1836): Cogl-WARNING **: ./driver/gl/cogl-framebuffer-gl.c:1072: GL error (1285): Out of memory


(.:1836): Cogl-WARNING **: ./driver/gl/cogl-framebuffer-gl.c:1139: GL error (1285): Out of memory


(.:1836): Cogl-WARNING **: ./driver/gl/cogl-framebuffer-gl.c:1072: GL error (1285): Out of memory


_______________________________________________
clutter-list mailing list
clutter-list gnome org
https://mail.gnome.org/mailman/listinfo/clutter-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]