Imagination PowerVR SDK Blog

Crash on calling glCheckFramebufferStatus


#1

Hi

In Galaxy S, it was not able to get status because application crashed when glCheckFramebufferStatus was called.
Output by “adb shell cat /proc/pvr/version” is as follows.

  Version 1.6.16.3947 (release) smdkc110_android
  System Version String: SGX540 S5PC110


This problem occurred in the source code such as the following.

  // create renderbuffer
  GLuint renderbuffer;
  glGenRenderbuffers( 1, &renderbuffer );
  glBindRenderbuffer( GL_RENDERBUFFER, renderbuffer );
  glRenderbufferStorage( GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 1, 1 );
  glBindRenderbuffer( GL_RENDERBUFFER, 0 );

  // create framebuffer
  GLuint framebuffer;
  glGenFramebuffers( 1, &framebuffer );
  glBindFramebuffer( GL_FRAMEBUFFER, framebuffer );
  glFramebufferRenderbuffer( GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderbuffer );
  glBindFramebuffer( GL_FRAMEBUFFER, 0 );

  // check framebuffer status
  glBindFramebuffer( GL_FRAMEBUFFER, framebuffer );
  if ( glGetError() != GL_NO_ERROR ) {
      LOGE( “GL error” );
  }
  LOGD( “Start glCheckFramebufferStatus()” );
  if ( glCheckFramebufferStatus( GL_FRAMEBUFFER ) != GL_FRAMEBUFFER_COMPLETE ) {
      LOGE( “framebuffer is incomplete!” );
  }
  LOGD( “End glCheckFramebufferStatus()” );
  glBindFramebuffer( GL_FRAMEBUFFER, 0 );


The following log is output in glCheckFramebufferStatus call in the source code above, then the application was terminated abnormally.

  Build fingerprint: ‘samsung/SC-02B/SC-02B:2.3.3/GINGERBREAD/OMKE3:user/release-keys’
  pid: 5671, tid: 5679  >>> jp.co.ddd.test701c21 <<<
  signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000144
   r0 01ad4000  r1 00000000  r2 00000000  r3 00800179
   r4 002d79a0  r5 00000000  r6 00800169  r7 00000020
   r8 00000001  r9 00000000  10 00000000  fp 00000000
   ip 01ad4000  sp 4689aad0  lr 81a1baa8  pc 81a0e3e8  cpsr 20000010
   d0  7562656d61724675  d1  7461745372656673
   d2  00530045004c0028  d3  0074006e006f0029
   d4  004c0047006d0020  d5  0065005600530045
   d6  006f006900730072  d7  0020003d0020006e
   d8  0000000000000000  d9  0000000000000000
   d10 0000000000000000  d11 0000000000000000
   d12 0000000000000000  d13 0000000000000000
   d14 0000000000000000  d15 0000000000000000
   d16 2f62696c2f6d6574  d17 3fe999999999999a
   d18 42eccefa43de3400  d19 3fbc71c71c71c71c
   d20 4008000000000000  d21 3fd99a27ad32ddf5
   d22 3fd24998d6307188  d23 3fcc7288e957b53b
   d24 3fc74721cad6b0ed  d25 3fc39a09d078c69f
   d26 0000000000000000  d27 0000000000000000
   d28 0000000000000000  d29 0000000000000000
   d30 0000000000000000  d31 0000000000000000
   scr 60000012
 
           #00  pc 0000e3e8  /system/lib/egl/libGLESv2_POWERVR_SGX540_120.so
           #01  lr 81a1baa8  /system/lib/egl/libGLESv2_POWERVR_SGX540_120.so
 
  code around pc:
  81a0e3c8 0a000005 e2466001 e1a05002 e1a06406
  81a0e3d8 e3866502 e3866069 e1833006 e5941060
  81a0e3e8 e5813144 e3003484 e5813148 e2833004
  81a0e3f8 e5813150 e2833004 e5812164 e3a02d12
  81a0e408 e5813158 e2833004 e5812140 e581c14c
 
  code around lr:
  81a1ba88 e1a01006 ebff9cc3 e5845144 e5840138
  81a1ba98 e5940124 ebff9ce3 e1a01005 ebff9cbd
  81a1baa8 ea000011 e584613c e5940120 ebff9cdd
  81a1bab8 e1a01006 ebff9cb7 e2853102 e5843144
  81a1bac8 e5840138 e5970008 ebff9caf e1a06000
 
  stack:
      4689aa90  002d0b68 
      4689aa94  002d7a10 
      4689aa98  002d7a4c 
      4689aa9c  002d7a10 
      4689aaa0  00000001 
      4689aaa4  81a0cbec  /system/lib/egl/libGLESv2_POWERVR_SGX540_120.so
      4689aaa8  002d79e0 
      4689aaac  002d79a0 
      4689aab0  00000000 
      4689aab4  00000001 
      4689aab8  00000000 
      4689aabc  00000000 
      4689aac0  00000000 
      4689aac4  00000000 
      4689aac8  df002777 
      4689aacc  e3a070ad 
  #00 4689aad0  002d7a4c 
      4689aad4  002d7a10 
      4689aad8  00000000 
      4689aadc  81a0cbec  /system/lib/egl/libGLESv2_POWERVR_SGX540_120.so
      4689aae0  002d79e0 
      4689aae4  002d0b68 
      4689aae8  00000000 
      4689aaec  00000010 
      4689aaf0  00000000 
      4689aaf4  00000000 
      4689aaf8  00000000 
      4689aafc  4679af30 
      4689ab00  801a5374 
      4689ab04  4689ab60 
      4689ab08  00000000 
      4689ab0c  4689ac10 
      4689ab10  4679af4c 
      4689ab14  4689ab40 


The complete source codes of this test application are as follows.
  http://dl.dropbox.com/u/23346852/ticket-701_21/Test701_21-source.zip
  (md5sum=ca8c268ae5bee1e822f6b3a963f63442)
 


#2

Hi,

Have you been able to resolve your problem yet?

The crash is likely due to a driver bug. Unfortunately, I'm not sure if that device will get another official driver update.

I've noticed that there seem to be some errors in your framebuffer setup. For example:
  1. You should only unbind the renderbuffer and framebuffer  at the end of the frame buffer's setup, as they must be bound during the setup
  2. You are creating a depth buffer that is 1x1. Is this correct? For a non-antialiased FBO, the resolutions of any colour, depth and stencil attachments should match

Thanks,

Joe