<HTML>
<HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<META content="OPENWEBMAIL" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>

<div><font face="tahoma,arial,helvetica,sans-serif">Hi Daniel,</font></div>

<div>
<br /></div>

<div><font face="tahoma,arial,helvetica,sans-serif">My application, as I described, requires a display protocol to run. And it is using wayland.
<br /></font></div>

<div><font face="tahoma,arial,helvetica,sans-serif">Because if I stop weston and run my application, it throws me following error:</font></div>

<div>
<br /></div>

<div><font face="tahoma,arial,helvetica,sans-serif">Error- Unable to init SDL: No available video device
<br />
<br /></font></div>

<div><font face="tahoma,arial,helvetica,sans-serif">Also, I just checked $WAYLAND_DISPLAY environment variable and it is already set to 'wayland-0'.</font></div>

<div>
<br /></div>

<div><font face="tahoma,arial,helvetica,sans-serif">The fact that eglinfo works perfectly after stopping weston makes me think that my application uses SDL_EGL_ChooseConfig() to set some EGL parameters/attributes and then calls _this->egl_data->eglChooseConfig() to see if it matches any available egl configurations but is not able to match with configurations returned by this function. And in my opinion, the reason behind this is _this->egl_data->eglChooseConfig() somehow calls eglinfo it doesn't return available egl configurations on the EVM and hence matching fails and egl surface is not created.
<br /></font></div>

<div>
<br /></div>

<div>Please check and revert.
<br /></div>

<div>
<br /></div>

<div><font size="2"><b>On Fri, 31 Jan 2020 08:27:50 +0000, Daniel Stone wrote</b></font></div>
<font size="2">Hi Devashish, 

<br /> 

It sounds like your application, as well as eglinfo, are not even 
<br /> 

trying to use Wayland. Maybe they are autodetecting the platform 
<br /> 

incorrectly and trying to use GBM instead. This could perhaps be 
<br /> 

solved by setting the $WAYLAND_DISPLAY environment variable to the 
<br /> 

name of the socket Weston uses (usually 'wayland-0'). However you 
<br /> 

should probably contact The Qt Company for support in using Qt, and 
<br /> 

you should contact TI (or your BSP vendor) for support with the 
<br /> 

proprietary Imagination EGL/GLES driver. 
<br /> 
<br /> 

Cheers, 
<br /> 

Daniel 
<br /> 
<br /> 

On Fri, 31 Jan 2020 at 08:12, Devashish Tiwari <devashish@cdot.in> wrote: 

<br /> 


<br /> 

> Hello, 
<br /> 


<br /> 


<br /> 

> I have built a simple application using QT & SDL that has a button 
which opens a preview on clicking, whenever camera (system/usb) is connected to 
the EVM. 
<br /> 


<br /> 

> My app successfully receives correct parameters related to camera 
(resolution, frame rate, frame format) and I have verified it using debug 
prints. However, when I click on preview button, it crashes and throws error 
related to EGL. 
<br /> 


<br /> 


<br /> 

> On executing it with gdb, I found out that it is not able to get a valid 
EGL configuration. The eglChooseConfig function (in SDL_egl.c) doesn't find a 
matching EGL config and it fails to create a surface and open the preview. 
<br /> 


<br /> 

> Also, I do not get any "EGL 1.4 Initialised" prints when my app 
executes. This print, on the contrary, is visible when I run OGLES2ChameleonMan 
in /usr/bin/SGX/demos/Wayland. 
<br /> 


<br /> 


<br /> 

> On digging further, I found that the "eglinfo" command displays 
the egl configurations on the terminal. 
<br /> 


<br /> 

> However, when it returns EGL_BAD_ALLOC on my EVM, if I run it without 
stopping weston. It runs successfully only after stopping weston. I am assuming 
this is the reason why my application is not able to find a matching EGL config 
because it runs over weston. 
<br /> 


<br /> 


----------------------------------------------------------------------------------- 

<br /> 


<br /> 

> root@am57xx-evm:/mnt# eglinfo 
<br /> 


<br /> 

> eglGetConfigs(): 
====================================================================== 
********************************** EGL config number: 0 EGL vendor string: 
Imagination Technologies EGL version string: 1.4 build 1.14@3699939 (MAIN) EGL 
extensions: EGL_IMG_client_api_ogl EGL_KHR_image EGL_KHR_image_base 
EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image 
EGL_KHR_gl_renderbuffer_image EGL_KHR_vg_parent_image EGL_IMG_cl_image 
EGL_KHR_fence_sync EGL_IMG_context_priority EGL_IMG_hibernate_process 
EGL_IMG_image_plane_attribs EGL_KHR_surfaceless_context EGL_KHR_wait_sync 
EGL_KHR_create_context EGL_WL_bind_wayland_display EGL_EXT_image_dma_buf_import 
EGL client APIs are: OpenGL_ES EGL config Attributes: EGL_CONFIG_ID = 0x1 
EGL_BUFFER_SIZE = 0x20 EGL_RED_SIZE = 0x8 EGL_GREEN_SIZE = 0x8 EGL_BLUE_SIZE = 
0x8 EGL_LUMINANCE_SIZE = 0x0 EGL_ALPHA_SIZE = 0x8 EGL_ALPHA_MASK_SIZE = 0x0 
EGL_BIND_TO_TEXTURE_RGB = 0x1 EGL_BIND_TO_TEXTURE_RGBA = 0x1 
EGL_COLOR_BUFFER_TYPE = 0x308e EGL_CONFIG_CAVEAT = 0x3038 EGL_CONFORMANT = 0x1 
EGL_DEPTH_SIZE = 0x18 EGL_LEVEL = 0x0 EGL_MAX_PBUFFER_WIDTH = 0x1000 
EGL_MAX_PBUFFER_HEIGHT = 0x1000 EGL_MAX_PBUFFER_PIXELS = 0x1000000 
EGL_MAX_SWAP_INTERVAL = 0xa EGL_MIN_SWAP_INTERVAL = 0x1 EGL_NATIVE_RENDERABLE = 
0x0 EGL_NATIVE_VISUAL_ID = 0x0 EGL_NATIVE_VISUAL_TYPE = 0x0 EGL_RENDERABLE_TYPE 
= 0x1 EGL_OPENGL_ES_BIT EGL_SAMPLE_BUFFERS = 0x0 EGL_SAMPLES = 0x0 
EGL_STENCIL_SIZE = 0x8 EGL_SURFACE_TYPE = 0x5 EGL_PBUFFER_BIT EGL_WINDOW_BIT 
EGL_TRANSPARENT_TYPE = 0x3038 EGL_TRANSPARENT_RED_VALUE = 0x0 
EGL_TRANSPARENT_GREEN_VALUE = 0x0 EGL_TRANSPARENT_BLUE_VALUE = 0x0 Creating 
Window surface.. PVR:(Error): WSEGL_CreateWindowDrawable: Couldn't set CRTC: 
Permission denied [0, ] Unable to create surface egl error 'EGL_BAD_ALLOC' 
(0x3003) 
<br /> 


----------------------------------------------------------------------------------- 

<br /> 


<br /> 


<br /> 

> Does anyone has any idea about this strange behaviour? 
<br /> 


<br /> 

> Also, Is there any way to run eglinfo command without stopping weston? 
Because I think my application is polling available egl configurations at the 
run time, but is not returning anything as it runs over weston. 
<br /> 


<br /> 


<br /> 

> The ldd of my application returns: 
<br /> 


<br /> 


----------------------------------------------------------------------------------- 

<br /> 


<br /> 

> root@am57xx-evm:/mnt# ldd cam_preview 
<br /> 

> linux-vdso.so.1 (0xbec50000) 
<br /> 

> libpjsua.so.2 => /usr/local/PJSIP_ONLY/libpjsua.so.2 (0xb6e6e000) 
<br /> 

> libpjsip-ua.so.2 => /usr/local/PJSIP_ONLY/libpjsip-ua.so.2 (0xb6e48000) 

<br /> 

> libpjsip-simple.so.2 => /usr/local/PJSIP_ONLY/libpjsip-simple.so.2 
(0xb6e28000) 
<br /> 

> libpjsip.so.2 => /usr/local/PJSIP_ONLY/libpjsip.so.2 (0xb6dda000) 
<br /> 

> libpjmedia-codec.so.2 => /usr/local/PJSIP_ONLY/libpjmedia-codec.so.2 
(0xb6dba000) 
<br /> 

> libpjmedia-videodev.so.2 => 
/usr/local/PJSIP_ONLY/libpjmedia-videodev.so.2 (0xb6d9e000) 
<br /> 

> libpjmedia-audiodev.so.2 => 
/usr/local/PJSIP_ONLY/libpjmedia-audiodev.so.2 (0xb6d88000) 
<br /> 

> libpjmedia.so.2 => /usr/local/PJSIP_ONLY/libpjmedia.so.2 (0xb6d12000) 

<br /> 

> libpjnath.so.2 => /usr/local/PJSIP_ONLY/libpjnath.so.2 (0xb6cdf000) 
<br /> 

> libpjlib-util.so.2 => /usr/local/PJSIP_ONLY/libpjlib-util.so.2 
(0xb6cab000) 
<br /> 

> libsrtp.so.2 => /usr/local/PJSIP_ONLY/libsrtp.so.2 (0xb6c87000) 
<br /> 

> libresample.so.2 => /usr/local/PJSIP_ONLY/libresample.so.2 (0xb6c6a000) 

<br /> 

> libgsmcodec.so.2 => /usr/local/PJSIP_ONLY/libgsmcodec.so.2 (0xb6c4c000) 

<br /> 

> libspeex.so.2 => /usr/local/PJSIP_ONLY/libspeex.so.2 (0xb6c13000) 
<br /> 

> libilbccodec.so.2 => /usr/local/PJSIP_ONLY/libilbccodec.so.2 
(0xb6bf4000) 
<br /> 

> libg7221codec.so.2 => /usr/local/PJSIP_ONLY/libg7221codec.so.2 
(0xb6bd4000) 
<br /> 

> libyuv.so.2 => /usr/local/PJSIP_ONLY/libyuv.so.2 (0xb6ba5000) 
<br /> 

> libpj.so.2 => /usr/local/PJSIP_ONLY/libpj.so.2 (0xb6b77000) 
<br /> 

> libopenh264.so.5 => /usr/local/PJSIP_ONLY/libopenh264.so.5 (0xb6a94000) 

<br /> 

> libstdc++.so.6 => /lib/libstdc++.so.6 (0xb6978000) 
<br /> 

> libuuid.so.1 => /lib/libuuid.so.1 (0xb6964000) 
<br /> 

> librt.so.1 => /lib/librt.so.1 (0xb694e000) 
<br /> 

> libasound.so.2 => /usr/lib/libasound.so.2 (0xb686a000) 
<br /> 

> libSDL2-2.0.so.0 => /usr/local/SDL_ONLY/libSDL2-2.0.so.0 (0xb6783000) 

<br /> 

> libv4l2.so.0 => /usr/lib/libv4l2.so.0 (0xb6767000) 
<br /> 

> libQt5Widgets.so.5 => /usr/lib/libQt5Widgets.so.5 (0xb625e000) 
<br /> 

> libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0xb5d71000) 
<br /> 

> libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0xb5887000) 
<br /> 

> libpthread.so.0 => /lib/libpthread.so.0 (0xb5863000) 
<br /> 

> libGLESv2.so.2 => /usr/lib/libGLESv2.so.2 (0xb57e8000) 
<br /> 

> libQt5X11Extras.so.5 => /usr/local/PJSIP_ONLY/libQt5X11Extras.so.5 
(0xb6f30000) 
<br /> 

> libX11.so.6 => /usr/lib/libX11.so.6 (0xb56cb000) 
<br /> 

> libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb569b000) 
<br /> 

> libXau.so.6 => /usr/lib/libXau.so.6 (0xb5688000) 
<br /> 

> libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb5673000) 
<br /> 

> libm.so.6 => /lib/libm.so.6 (0xb55f7000) 
<br /> 

> libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb55ce000) 
<br /> 

> libc.so.6 => /lib/libc.so.6 (0xb54e1000) 
<br /> 

> /lib/ld-linux-armhf.so.3 (0xb6f16000) 
<br /> 

> libdl.so.2 => /lib/libdl.so.2 (0xb54ce000) 
<br /> 

> libwayland-client.so.0 => /usr/lib/libwayland-client.so.0 (0xb54b4000) 

<br /> 

> libpvr_wlegl.so.1 => /usr/lib/libpvr_wlegl.so.1 (0xb54a3000) 
<br /> 

> libwayland-cursor.so.0 => /usr/lib/libwayland-cursor.so.0 (0xb548c000) 

<br /> 

> libxkbcommon.so.0 => /usr/lib/libxkbcommon.so.0 (0xb5444000) 
<br /> 

> libv4lconvert.so.0 => /usr/lib/libv4lconvert.so.0 (0xb53c0000) 
<br /> 

> libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0xb537c000) 
<br /> 

> libsrv_um.so.1 => /usr/lib/libsrv_um.so.1 (0xb5338000) 
<br /> 

> libpng16.so.16 => /usr/lib/libpng16.so.16 (0xb52ff000) 
<br /> 

> libz.so.1 => /lib/libz.so.1 (0xb52db000) 
<br /> 

> libicui18n.so.59 => /usr/lib/libicui18n.so.59 (0xb50db000) 
<br /> 

> libicuuc.so.59 => /usr/lib/libicuuc.so.59 (0xb4f71000) 
<br /> 

> libicudata.so.59 => /usr/lib/libicudata.so.59 (0xb364c000) 
<br /> 

> libdrm.so.2 => /usr/lib/libdrm.so.2 (0xb362f000) 
<br /> 

> libgbm.so.2 => /usr/lib/libgbm.so.2 (0xb361c000) 
<br /> 

> libudev.so.1 => /lib/libudev.so.1 (0xb3600000) 
<br /> 

> libwayland-server.so.0 => /usr/lib/libwayland-server.so.0 (0xb35e3000) 

<br /> 

> libdrm_omap.so.1 => /usr/lib/libdrm_omap.so.1 (0xb35d0000) 
<br /> 

> libffi.so.6 => /usr/lib/libffi.so.6 (0xb35b9000) 
<br /> 

> libIMGegl.so.1 => /usr/lib/libIMGegl.so.1 (0xb3593000) 
<br /> 

> libpvr2d.so.1 => /usr/lib/libpvr2d.so.1 (0xb357f000) 
<br /> 

> libresolv.so.2 => /lib/libresolv.so.2 (0xb355e000) 
<br /> 

> libcap.so.2 => /lib/libcap.so.2 (0xb3549000) 
<br /> 

> libdbm.so.1 => /usr/lib/libdbm.so.1 (0xb3537000) 
<br /> 


<br /> 


--------------------------------------------------------------------------------------------- 

<br /> 


<br /> 

> -- 
<br /> 


<br /> 

> Thanks & Regards, 
<br /> 


<br /> 

> Devashish Tiwari 
<br /> 


<br /> 

> CDOT India 
<br /> 


<br /> 

> _______________________________________________ 
<br /> 

> mesa-dev mailing list 
<br /> 

> mesa-dev@lists.freedesktop.org 
<br /> 

> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a> 

<br />
<br />
<br />--  

<br />
 
<br />
Thanks & Regards, 

<br />
 
<br />
Devashish Tiwari 

<br />CDOT India
<br />

<br />
</font>

</BODY>
</HTML>