[Mesa-users] Need help getting start with EGL/DRM/KMS/GLES2

Jean-François Doyon jfdoyon at gmail.com
Tue Sep 1 11:19:26 PDT 2015


OK, so here is the backtrace from the segfault:

Program received signal SIGSEGV, Segmentation fault.
0x00000000009c0ad0 in ?? ()
(gdb) bt
#0  0x00000000009c0ad0 in ?? ()
#1  0x00007f43036121bd in gbm_bo_destroy (bo=0x9f9770) at main/gbm.c:323
#2  0x00007f4302fea297 in dri2_drm_destroy_surface (drv=0x976170,
    disp=0x975ba0, surf=0x9f92d0) at platform_drm.c:195
#3  0x00007f4302fe7bf5 in dri2_destroy_surface (drv=0x976170, dpy=0x975ba0,
    surf=0x9f92d0) at egl_dri2.c:1110
#4  0x00007f4302fdd84c in eglDestroySurface (dpy=0x975ba0, surface=0x9f92d0)
    at eglapi.c:806
#5  0x0000000000401908 in main ()

It would appear that my call to eglDestroySurface was in turn calling
gbm_bo_destroy, but since I had already called that function earlier, it
bombed.  At least that's my deduction ...

I removed my direct call to gbm_bo_destroy and the segfault disappeared.

Still finding it rather odd that you didn't get the error however ...

And still not seeing red!

Cheers,
J.F.



On Tue, Sep 1, 2015 at 1:16 PM, Jean-François Doyon <jfdoyon at gmail.com>
wrote:

> Albert,
>
> Thanks for taking the time to investigate ... I'm afraid that made no
> difference on my end.  I guess there's something about my software stack or
> environment that's causing this then, now that I know I wasn't crazy and my
> code was indeed supposed to work!
>
> Can I ask what your environment is like? Were you using the vmwgfx driver?
> What version of Mesa, libdrm, kernel, etc?
>
> I'll try to get gdb into my image to see if I can glean some more details
> ...
>
> I did try to use buildroot's included libdrm/mesa configs (instead of my
> own "recipes"), which are also slightly older versions, but that changed
> nothing either ...
>
> Thanks,
> J.F.
>
> On Tue, Sep 1, 2015 at 12:10 AM, Albert Freeman <albertwdfreeman at gmail.com
> > wrote:
>
>> Well with these quick and dirty changes I made, it works fine on my
>> system, no segfault and the screen displays red.
>>
>> --- gleskmsorg.c    2015-09-01 14:04:32.853672410 +0000
>> +++ gleskms.c    2015-09-01 14:03:57.797005474 +0000
>> @@ -24,8 +24,6 @@ EGL_CONFORMANT, EGL_OPENGL_ES2_BIT,
>>  EGL_NONE };
>>
>>  static const char device_name[] = "/dev/dri/card0";
>> -static const uint32_t drm_mode_connector_id = 18;
>> -static const uint32_t drm_mode_crtc_id = 21;
>>
>>  int main(void) {
>>
>> @@ -86,10 +84,12 @@ int main(void) {
>>          exit(EXIT_FAILURE);
>>      }
>>
>> +    drmModeRes *res;
>>      drmModeConnector *conn;
>>      uint32_t conn_id, width, height;
>>      drmModeModeInfo modeinfo;
>> -    conn = drmModeGetConnector(fd, drm_mode_connector_id);
>> +    res = drmModeGetResources(fd);
>> +    conn = drmModeGetConnector(fd, *res->connectors);
>>      conn_id = conn->connector_id;
>>      width = conn->modes[0].hdisplay;
>>      height = conn->modes[0].vdisplay;
>> @@ -129,7 +129,7 @@ int main(void) {
>>          exit(EXIT_FAILURE);
>>      }
>>
>> -    ret = drmModeSetCrtc(fd, drm_mode_crtc_id, drm_fb_id, 0, 0,
>> &conn_id, 1,
>> +    ret = drmModeSetCrtc(fd, *res->crtcs, drm_fb_id, 0, 0, &conn_id, 1,
>>              &modeinfo);
>>      if (ret) {
>>          printf("failed to set mode: %m\n");
>> @@ -143,8 +143,8 @@ int main(void) {
>>      gbm_surface_destroy(gs);
>>      eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
>>      eglDestroyContext(dpy, ctx);
>> -//    eglDestroySurface(dpy, surface);
>> -//    eglTerminate(dpy);
>> +    eglDestroySurface(dpy, surface);
>> +    eglTerminate(dpy);
>>      gbm_device_destroy(gbm);
>>      close(fd);
>>      return 0;
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-users/attachments/20150901/dabd82b9/attachment.html>


More information about the mesa-users mailing list