Hi, I think you can refer to this example code [1] in weston for ideas about how to initialize EGL in wayland, which I think is quite easy to understand.
Regards, Boyan Ding [1] http://cgit.freedesktop.org/wayland/weston/tree/clients/simple-egl.c#n318 On Mon, 2014-06-23 at 11:13 +0800, Jacky (ZhiJun) Ni wrote: > Hi all, > > I’m now porting my opengles application to wayland platform, > what do I need to prepare while I’m calling “eglGetDisplay” and > “eglCreateWindowSurface”? > > I’ve tryied the following codes in my program, > > Step1: wl_display_connect(NULL) à return a global g_nativeDisplay > object, I see someone do it, so that I do it. > > Step2: wl_display_get_registry, wl_registry_add_listener, > wl_display_dispatch -> some APIs I’m not familiar, I see someone do > it, so that I do it. > > Step3: wl_egl_window_create(NULL,1280,720) à return a nativeWindow > object which will be passed for EGL to Create Window Surface, I > believe that the “NULL”(wl_surface*) parameter lead to the crash. But > I have no idea how to get a wl_surface object. > > Step4: eglGetDisplay, eglInitialize, eglChooseConfig, > eglCreateContext, eglCreateWindowSurface, eglMakeCurrent, > eglQuerySurface, these APIs all work fine, return no error. > > Step4: eglSwapBuffers, lead to the crash, trace the bt, I find that it > is because wl_surface is NULL, > > (gdb) bt > > #0 0xb7e35a85 in wl_proxy_create () from /lib/libwayland-client.so.0 > > #1 0xb7e1ac10 in wl_surface_frame (wl_surface=0x0) > > at /home/jacky/Apps/Wayland/include/wayland-client-protocol.h:1355 > > #2 0xb7e1bfbb in dri2_wl_swap_buffers_with_damage (drv=0x8730f88, > > disp=0x8730300, draw=0x87cc380, rects=0x0, n_rects=0) > > at platform_wayland.c:617 > > #3 0xb7e1c309 in dri2_wl_swap_buffers (drv=0x8730f88, > disp=0x8730300, > > draw=0x87cc380) at platform_wayland.c:702 > > #4 0xb7e19739 in dri2_swap_buffers (drv=0x8730f88, dpy=0x8730300, > > surf=0x87cc380) at egl_dri2.c:1074 > > #5 0xb7e0cd03 in eglSwapBuffers (dpy=0x8730300, surface=0x87cc380) > > at eglapi.c:811 > > > > I searched the internet but get less useful information, even now , I > plan to make some fake data to initialize the wl_surface, but I have > not got the definition for the struct “wl_surface”, just a > url(http://wayland.freedesktop.org/docs/html/protocol-spec-interface-wl_surface.html > ) describe how to use its function, no initialize function… > > > > It is so different from X11 who only need to prepare a window passed > to EGL, So far, I’ve learned I need prepare a ”wl_egl_window” and a > “wl_surface” for EGL on wayland, wl_egl_window need three parameters > “wl_surface”, “width” and “height” to create, but “wl_surface” seems > need compositor(API:”wl_compositor_create_surface” )to create, so > compositor need what to create? May I need to create a compositor > firstly? > > > > > > > > > > Best Regards, > > Jacky Ni > > > > > CONFIDENTIALITY NOTICE: The information contained in this message may > be privileged and/or confidential. If you are not the intended > recipient, or responsible for delivering this message to the intended > recipient, any review, forwarding, dissemination, distribution or > copying of this communication or any attachment(s) is strictly > prohibited. If you have received this message in error, please notify > the sender immediately, and delete it and all attachments from your > computer and network. > > _______________________________________________ > wayland-devel mailing list > wayland-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel