i.mx6q sabresd OpenGL ES API Segmentation fault

cancel
Showing results for 
Search instead for 
Did you mean: 

i.mx6q sabresd OpenGL ES API Segmentation fault

482 Views
garyyin
Contributor III

i.mx6q      linux 3.14.28

#include <unistd.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>

#include <EGL/egl.h>
#include <GLES/gl.h>
#include <math.h>
#include <time.h>

int main(int argc, char** argv)
{
   int fb;
   GLint maj, min;
   EGLDisplay m_eglDisplay;

   printf("OpenGL ES 1.1 DEMO\n");

   fb = open("/dev/fb0", O_RDWR);

   if(fb < 0)
   {
      printf("device fb0 open failed[%d : %d]!\n", fb, errno);
      goto exit0;
   }

   m_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);

   if(EGL_NO_DISPLAY == m_eglDisplay)
   {
      printf("error: eglGetDisplay returns EGL_NO_DISPLAY\n");
      goto exit1;
   }

   printf("eglGetDisplay() success\n");

   if(EGL_FALSE == eglInitialize(m_eglDisplay, &maj, &min))
   {
      printf("error: eglInitialize() returns EGL_FALSE\n");
      goto exit1;
   }

   printf("eglInitialize() success[%d.%d]\n", maj, min);

... ...

}

Compile options:

CFLAGS += -DLINUX -DEGL_API_FB

LIBS += -lGLESv1_CM -lGAL -lEGL -lVSC -lGAL_egl -lX11
LIBS += -lXdamage -lXfixes -lXext -lxcb -lXau -lXdmcp

Run the app:
root@imx6qsabresd:~# ./gles_demo 
OpenGL ES 1.1 DEMO
eglGetDisplay() success
Segmentation fault

So the API call "eglInitialize(m_eglDisplay, &maj, &min)" causes the Segmentation fault. Why?

Labels (4)
Tags (3)
0 Kudos
2 Replies

84 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Gary

one can try GPU SDK

Software Development Kits (4)
 i.MX6DQP/DQ/DL/SL/SX GPU Demo Framework SDK (REV 2.3)
This package contains binary of NXP® GPU demo-framework 2.3 SDK source and tools
to generate and build demo frame work applications.
http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/i.mx-applications-process...

also please check that correct bsp is used:

i.MX 6 Series Software and Development Tool|NXP 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

84 Views
garyyin
Contributor III

Hi igor,

I found the demo code in my L3.14.28 yocto project, tmp/work/cortexa9hf-vfp-neon-mx6qdl-poky-linux-gnueabi/fsl-gpu-sdk/2.0.1-r0/fsl-gpu-sdk-2.0.1/DemoApps.

I can use 'bitbake -c compile -f fsl-gpu-sdk' cmd to compile the code.

Now, I want to rewrite the main() entry function, only the core OpenGL ES code is needed.

Q1: I can't find the main() function anywhere. How can I do so?

Q2: Should I override the main() function? But I don't know how to make the related class(es) work.

0 Kudos