Segmentaion fault in libEGL-dfb on i.mx6 SABRE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Segmentaion fault in libEGL-dfb on i.mx6 SABRE

2,117 Views
davidwretman
Contributor II

Hello,

I'm trying to run a simple OpenGL application with the DirectFB enabled vivante libraries from gpu-viv-bin-mx6q. When trying to initialize EGL I get a segmentation fault in what i guess is the libEGL-dfb.so. The callstack is as follows:

GetDFBSurfFormat() at gc_hal_user_dfb.c:61 0x2af52a50  

gcoOS_GetWindowInfoEx() at gc_hal_user_dfb.c:1,191 0x2af53524  

veglGetWindowInfo() at gc_egl_platform.c:139 0x2ac57ce8  

_CreateSurface() at gc_egl_surface.c:1,690 0x2ac52bd4  

eglCreateWindowSurface() at gc_egl_surface.c:2,712 0x2ac5381c  

init() at SimpleTriangle.c:213 0x9a7c  

main() at SimpleTriangle.c:353 0xa224  

I'm trying to initialize the EGL with the following code:

   DFBResult err;

   DFBSurfaceDescription dsc;

   DFBCHECK(DirectFBInit(&argc, &argv));

   // create the super interface

   DFBCHECK(DirectFBCreate(&dfb));

   // create an event buffer for all devices with these caps

   DFBCHECK(dfb->CreateInputEventBuffer(dfb, DICAPS_KEYS | DICAPS_AXES, DFB_FALSE, &events));

   // set our cooperative level to DFSCL_FULLSCREEN for exclusive access to the primary layer

   dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);

   // get the primary surface, i.e. the surface of the primary layer we have exclusive access to

   dsc.flags = DSDESC_CAPS;

   dsc.caps = DSCAPS_PRIMARY | DSCAPS_DOUBLE; // | DSCAPS_OPENGL_HINT;

   DFBCHECK(dfb->CreateSurface(dfb, &dsc, &primary));

   // get the size of the surface and fill it

   //DFBCHECK(primary->GetSize(primary, &screen_width, &screen_height));

   //DFBCHECK(primary->FillRectangle(primary, 0, 0, screen_width, screen_height));

   egldisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);

   eglInitialize(egldisplay, NULL, NULL);

   assert(eglGetError() == EGL_SUCCESS);

   eglBindAPI(EGL_OPENGL_ES_API);

   eglChooseConfig(egldisplay, s_configAttribs, &eglconfig, 1, &numconfigs);

   assert(eglGetError() == EGL_SUCCESS);

   assert(numconfigs == 1);

   eglsurface = eglCreateWindowSurface(egldisplay, eglconfig, (EGLNativeWindowType)primary, NULL);

Has anybody experienced something similar or do you have a working example with this configuration?

Regards,

David

Labels (1)
Tags (3)
0 Kudos
8 Replies

927 Views
YixingKong
Senior Contributor IV

David

Had your issue got resolved? If yes, we are going to close the discussion in 3 days. If you still need help, please feel free to reply with an update to this discussion.

Thanks,

Yixing

0 Kudos

927 Views
davidwretman
Contributor II

Hi,

Sorry haven't gotten around to testing the proposed fixes. Other projects has gotten i the way.

One question though, how do I check what Vivante driver version I am using?

Regards,

David

0 Kudos

927 Views
YixingKong
Senior Contributor IV

David

This discussion is closed since no activity. If you still need help, please feel free to reply with an update to this discussion, or create another discussion.

Thanks,

Yixing

0 Kudos

927 Views
YixingKong
Senior Contributor IV

David

Had your issue got resolved? If yes, we are going to close the discussion in 3 days. If you still need help, please feel free to reply with an update to this discussion.

Thanks,

Yixing

0 Kudos

927 Views
YixingKong
Senior Contributor IV

David

I will branch your discussion into an internal group and assign an engineer to work on it.

Regards,

Yixing

0 Kudos

927 Views
karina_valencia
NXP Apps Support
NXP Apps Support
Helpful AnswerRe: Re: Segmentaion fault in libEGL-dfb on i.mx6 SABRE

Guillermo Michel JimenezEmployee

Hi,

Is there an error displayed by DirectFB when you get the segmentation fault?

DirectFB gets it's memory from FBdev pool, to increase the memory for FBdev use fbset.

For example:

fbset -fb /dev/fb0 -g 1024 768 1024 2304 24

That may solve your issue.

Also find below our EGL code to get native display and window in the yocto BSP:

#include <directfb.h>

struct _DFBDisplay

{

    IDirectFB*            pDirectFB;

    IDirectFBDisplayLayer* pLayer;

    IDirectFBEventBuffer*  pEventBuffer;

    int        winWidth, winHeight;

};

struct _DFBWindow

{

    IDirectFBWindow*    pWindow;

    IDirectFBSurface*  pDFBSurf;

};

struct _DFBDisplay* display = NULL;

struct _DFBWindow  *DFBWindow = NULL;

IDirectFBWindow    *window = NULL;

EGLNativeDisplayType fsl_getNativeDisplay()

{

        EGLNativeDisplayType eglNativeDisplayType = NULL;

        printf("getting display \n");

        DFBDisplayLayerConfig config;

        if(DirectFBInit(NULL, NULL) != DFB_OK)

        {

                printf("DFBinit failed \n");

                return 0;

        }

        display = (struct _DFBDisplay*) malloc(sizeof (struct _DFBDisplay));

        if (display == NULL)

        {

                printf("allocation failed \n");

                return 0;

        }

        if (DirectFBCreate(&(display->pDirectFB)) != DFB_OK)

        {

                printf("DirectFBCreate failed \n");

                return 0;

        }

        if(display->pDirectFB->CreateInputEventBuffer(display->pDirectFB, DICAPS_KEYS, DFB_FALSE, &(display->pEventBuffer)) != DFB_OK)

        {

                printf("CreateInputEventBuffer failed \n");

                return 0;

        }

        if(display->pDirectFB->GetDisplayLayer( display->pDirectFB, DLID_PRIMARY, &(display->pLayer) ) != DFB_OK)

        {

                printf("GetDisplayLayer failed \n");

                return 0;

        }

        display->pLayer->GetConfiguration(display->pLayer, &config);

        display->winWidth = config.width;

        display->winHeight = config.height;

        printf("getting display succed\n");

        eglNativeDisplayType = (EGLNativeDisplayType)display;

        return eglNativeDisplayType;

}

EGLNativeWindowType fsl_createwindow(EGLDisplay egldisplay, EGLNativeDisplayType eglNativeDisplayType)

{

        EGLNativeWindowType native_window = (EGLNativeWindowType)0;

        printf("getting window \n");

        DFBWindowDescription  desc;

        display->pLayer->SetCooperativeLevel( display->pLayer, DLSCL_ADMINISTRATIVE );

        DFBWindow = (struct _DFBWindow *) malloc(sizeof(struct _DFBWindow));

        memset(DFBWindow, 0, sizeof(struct _DFBWindow));

        desc.flags = ( DWDESC_POSX | DWDESC_POSY);

        desc.posx  = 0;

        desc.posy  = 0;

        display->winWidth = 640;

        display->winHeight = 480;

        desc.flags = desc.flags | DWDESC_WIDTH | DWDESC_HEIGHT;

        desc.width  = 640;

        desc.height = 480;

        desc.surface_caps = DSCAPS_FLIPPING;

        if(display->pLayer->CreateWindow( display->pLayer, &desc, &window) != DFB_OK)

        {

                printf("CreateWindow failed \n");

                return 0;

        }

        DFBWindow->pWindow = window;

        window->SetOpacity(window, 0xFF);

        window->RaiseToTop(window);

        window->AttachEventBuffer(window, display->pEventBuffer);

        display->pLayer->EnableCursor(display->pLayer, 0);

        native_window = (EGLNativeWindowType) DFBWindow;

        assert(native_window);

        printf("getting window succed \n");

        return native_window:

}

Michel

927 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Vivante team has acknowledged and fixed these bugs . however it looks like you are using a vivante driver old version The fixes were included in the Vivante 4.6.9p11 driver, the latest bsp in FSL web includes the 4.6.13p


Also, This issue happen on Sabre board or your custom board?


Could you check your board file for the GPU reserved memory?

For example on sabreSD, the following code is used to reserve gpu memory which is limited under 1G address.

Arch/arm/mach-mx6/board-mx6q_sabresd.c

if (imx6q_gpu_pdata.reserved_mem_size) {

phys = memblock_alloc_base(imx6q_gpu_pdata.reserved_mem_size,

SZ_4K, SZ_1G);

memblock_remove(phys, imx6q_gpu_pdata.reserved_mem_size);

imx6q_gpu_pdata.reserved_mem_base = phys;

}



Hope this helps

regards


0 Kudos

927 Views
saurabh206
Senior Contributor III

Hi,

Can you please shared the link for the Vivante update?

Thanks

Saurabh

0 Kudos