[Cogl] [PATCH 0/3] Allow apps to catch out-of-memory errors

Robert Bragg robert at sixbynine.org
Mon Nov 19 07:33:50 PST 2012


From: Robert Bragg <robert at linux.intel.com>

In general we don't report small heap allocation failures in Cogl back to the
application since chances are high that the application won't handle the error
anyway, or even if it tried it would fail due to hitting untested code. We
usually just automatically abort for these kinds of failures.

This policy isn't reasonable for much larger allocations where it's much more
likely that there isn't enough memory and where there is a good chance that
applications could handle failures gracefully and even free up resources to try
again.

These patches enable applications to gracefully catch out-of-memory problems
when allocating large resources such as textures.

Robert Bragg (3):
  Check for out-of-memory when allocating 2d textures
  Check for out-of-memory when allocating 3d textures
  Allow propogation of OOM errors to apps

 cogl-pango/cogl-pango-display-list.c           |   13 +-
 cogl-pango/cogl-pango-render.c                 |    3 +-
 cogl/Makefile.am                               |    2 +
 cogl/cogl-atlas-texture-private.h              |    5 +-
 cogl/cogl-atlas-texture.c                      |  104 +++++---
 cogl/cogl-attribute-buffer.c                   |   53 +++-
 cogl/cogl-attribute-buffer.h                   |   40 +++-
 cogl/cogl-bitmap-conversion.c                  |   34 ++-
 cogl/cogl-bitmap-private.h                     |   39 ++-
 cogl/cogl-bitmap.c                             |  105 +++++---
 cogl/cogl-bitmap.h                             |    4 +-
 cogl/cogl-blit.c                               |    5 +-
 cogl/cogl-buffer-private.h                     |   12 +-
 cogl/cogl-buffer.c                             |   87 ++++--
 cogl/cogl-buffer.h                             |   36 +++-
 cogl/cogl-driver.h                             |   14 +-
 cogl/cogl-error-private.h                      |    4 +
 cogl/cogl-error.c                              |   13 +-
 cogl/cogl-framebuffer.c                        |  191 +++++++++-----
 cogl/cogl-framebuffer.h                        |    4 +-
 cogl/cogl-indices.c                            |   10 +-
 cogl/cogl-journal.c                            |   21 +-
 cogl/cogl-path.c                               |    6 +-
 cogl/cogl-pixel-buffer.c                       |   18 +-
 cogl/cogl-pixel-buffer.h                       |    4 +-
 cogl/cogl-sub-texture.c                        |   20 +-
 cogl/cogl-texture-2d-sliced-private.h          |    5 +-
 cogl/cogl-texture-2d-sliced.c                  |  245 +++++++++++-------
 cogl/cogl-texture-2d.c                         |   37 ++--
 cogl/cogl-texture-3d.c                         |  116 ++++++---
 cogl/cogl-texture-driver.h                     |   15 +-
 cogl/cogl-texture-private.h                    |   46 ++--
 cogl/cogl-texture-rectangle.c                  |  103 +++++---
 cogl/cogl-texture.c                            |  339 +++++++++++++++---------
 cogl/cogl-texture.h                            |   28 ++-
 cogl/cogl.symbols                              |    1 -
 cogl/driver/gl/cogl-attribute-gl.c             |   12 +-
 cogl/driver/gl/cogl-buffer-gl-private.h        |   10 +-
 cogl/driver/gl/cogl-buffer-gl.c                |  144 ++++++++---
 cogl/driver/gl/cogl-framebuffer-gl.c           |    9 +-
 cogl/driver/gl/cogl-texture-2d-gl-private.h    |    5 +-
 cogl/driver/gl/cogl-texture-2d-gl.c            |  149 +++++++----
 cogl/driver/gl/cogl-util-gl-private.h          |   33 +++
 cogl/driver/gl/cogl-util-gl.c                  |   66 +++++
 cogl/driver/gl/gl/cogl-texture-driver-gl.c     |  166 ++++++++----
 cogl/driver/gl/gles/cogl-texture-driver-gles.c |  289 ++++++++++++++-------
 cogl/driver/nop/cogl-texture-2d-nop-private.h  |    5 +-
 cogl/driver/nop/cogl-texture-2d-nop.c          |    6 +-
 cogl/winsys/cogl-texture-pixmap-x11.c          |   25 ++-
 doc/reference/cogl2/cogl2-sections.txt         |    1 +
 tests/conform/test-atlas-migration.c           |    6 +-
 tests/conform/test-backface-culling.c          |    6 +-
 tests/conform/test-blend-strings.c             |    6 +-
 tests/conform/test-just-vertex-shader.c        |    6 +-
 tests/conform/test-map-buffer-range.c          |    3 +-
 tests/conform/test-pipeline-user-matrix.c      |   12 +-
 tests/conform/test-pixel-buffer.c              |   14 +-
 tests/conform/test-premult.c                   |    3 +-
 tests/conform/test-primitive.c                 |    8 +-
 tests/conform/test-snippets.c                  |    6 +-
 tests/conform/test-sub-texture.c               |    3 +-
 tests/conform/test-wrap-modes.c                |    6 +-
 tests/conform/test-write-texture-formats.c     |   12 +-
 63 files changed, 1870 insertions(+), 923 deletions(-)
 create mode 100644 cogl/driver/gl/cogl-util-gl-private.h
 create mode 100644 cogl/driver/gl/cogl-util-gl.c

-- 
1.7.7.6



More information about the Cogl mailing list