Bug 108967 - DRM : eglCreatePbufferSurface failed with error EGL_BAD_MATCH
Summary: DRM : eglCreatePbufferSurface failed with error EGL_BAD_MATCH
Status: NEW
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/etnaviv (show other bugs)
Version: 18.3
Hardware: ARM Linux (All)
: medium major
Assignee: Etnaviv Developers
QA Contact: Etnaviv Developers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-07 12:07 UTC by Vishwanath Chandapur
Modified: 2019-01-17 12:29 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Screen (3.65 MB, image/jpeg)
2019-01-15 18:14 UTC, Vishwanath Chandapur
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vishwanath Chandapur 2018-12-07 12:07:41 UTC
We use qtwebengine ,Currently failing to initialize with 
error:
--------------------------------------------------------------------------------
gl_surface_qt.cpp(480)] eglCreatePbufferSurface failed with error EGL_BAD_MATCH
gl_surface_qt.cpp(480)] eglCreatePbufferSurface failed with error EGL_BAD_MATCH
-------------------------------------------------------------------------------

mesa is configured with platform drm and wayland (Below config).
It seems mesa egl doesn't support "PbufferSurface" for both wayland and drm platform.
But qt is expecting to have pBuffers.
Is possible to have any alternative to fix this issue.

Hardware:imx6qdl
Linux kernel version: 4.14
QT Version: 5.9
mesa Version:17.3.8

mesa-17.3.8- configure: 

        prefix:          /usr
        exec_prefix:     /usr
        libdir:          /usr/lib
        includedir:      /usr/include

        OpenGL:          yes (ES1: yes ES2: yes)

        OSMesa:          no

        DRI platform:    drm
        DRI drivers:     swrast 
        DRI driver dir:  ${libdir}/dri
        GLX:             no

        EGL:             yes
        EGL drivers:     builtin:egl_dri2
        GBM:             yes
        EGL/Vulkan/VL platforms:   wayland drm

        Vulkan drivers:  no

        llvm:            no

        Gallium drivers: etnaviv imx
        Gallium st:      mesa

        HUD extra stats: no
        HUD lmsensors:   no


        Shared libs:     yes
        Static libs:     no
        Shared-glapi:    yes
Comment 1 Vishwanath Chandapur 2018-12-11 10:20:15 UTC
Below is response we got from QT development team.

---------------------------------------------------------------------------------------
WebEngie tryies to create pbuffer, if does not work it will try to use EGL_KHR_surfaceless_context extension. this error means that pbuffer was not created and most likely there is no EGL_KHR_surfaceless_context extension
-------------------------------------------------------------------------------------

Could please let us know EGL_KHR_surfaceless_context is supported by mesa or how to use for surface less .
Comment 2 Tapani Pälli 2018-12-11 11:38:54 UTC
Surfaceless is supported, I can see from your configure that it has not been enabled though. You need to pass "--with-platforms=wayland,drm,surfaceless" (as example) for it to be enabled.
Comment 3 Vishwanath Chandapur 2018-12-12 09:58:09 UTC
I have enabled surfaceless as you mentioned but got same ERROR.

configure: 
        prefix:          /usr
        exec_prefix:     /usr
        libdir:          /usr/lib
        includedir:      /usr/include
        OpenGL:          yes (ES1: yes ES2: yes)
        OSMesa:          no
        DRI platform:    drm
        DRI drivers:     swrast 
        DRI driver dir:  ${libdir}/dri
        GLX:             no
        EGL:             yes
        EGL drivers:     builtin:egl_dri2
        GBM:             yes
        EGL/Vulkan/VL platforms:   wayland drm surfaceless  
        Vulkan drivers:  no
        llvm:            no
        Gallium drivers: etnaviv imx
        Gallium st:      mesa
        HUD extra stats: no
        HUD lmsensors:   no
        Shared libs:     yes
        Static libs:     no
        Shared-glapi:    yes


I few quires 
By enabling surfaceless platform is "EGL_KHR_surfaceless_context" API available.?
                           OR
We need "MESA_platform_surfaceless" in application?
Comment 4 Tapani Pälli 2018-12-12 10:58:52 UTC
(In reply to Vishwanath Chandapur from comment #3)
> I have enabled surfaceless as you mentioned but got same ERROR.
> 
> configure: 
>         prefix:          /usr
>         exec_prefix:     /usr
>         libdir:          /usr/lib
>         includedir:      /usr/include
>         OpenGL:          yes (ES1: yes ES2: yes)
>         OSMesa:          no
>         DRI platform:    drm
>         DRI drivers:     swrast 
>         DRI driver dir:  ${libdir}/dri
>         GLX:             no
>         EGL:             yes
>         EGL drivers:     builtin:egl_dri2
>         GBM:             yes
>         EGL/Vulkan/VL platforms:   wayland drm surfaceless  
>         Vulkan drivers:  no
>         llvm:            no
>         Gallium drivers: etnaviv imx
>         Gallium st:      mesa
>         HUD extra stats: no
>         HUD lmsensors:   no
>         Shared libs:     yes
>         Static libs:     no
>         Shared-glapi:    yes
> 
> 
> I few quires 
> By enabling surfaceless platform is "EGL_KHR_surfaceless_context" API
> available.?
>                            OR
> We need "MESA_platform_surfaceless" in application?

Both of these should be available for you:

EGL_KHR_surfaceless_context
GL_OES_surfaceless_context
Comment 5 Vishwanath Chandapur 2018-12-12 11:27:19 UTC
As of now we are still getting same error "eglCreatePbufferSurface failed with error EGL_BAD_MATCH"

And we are using "EGL_KHR_surfaceless_context" API .Is there any way we can check in mesa is using surfaceless_context.
Comment 6 Tapani Pälli 2018-12-12 11:35:28 UTC
(In reply to Vishwanath Chandapur from comment #5)
> As of now we are still getting same error "eglCreatePbufferSurface failed
> with error EGL_BAD_MATCH"
> 
> And we are using "EGL_KHR_surfaceless_context" API .Is there any way we can
> check in mesa is using surfaceless_context.

Oops sorry it seems I got confused about 'surfaceless' as a platform and 'surfaceless' as an EGL extension. You don't need to enable 'surfaceless' platform in the configure. The EGL_KHR_surfaceless_context should be there, supported by all EGL dri2 based implementations. You may try to catch eglMakeCurrent calls made by Qt to see if it passes EGL_NO_SURFACE for both read and write surface, this would mean that it does not try to initialize a real surface such as pbuffer.
Comment 7 Vishwanath Chandapur 2018-12-20 12:21:26 UTC
Hi,

Qtwebegine has already has support of EGL_KHR_surfaceless_context.

And also when we enabled more debug logs we found mesa driver is failing with below error.when this error occurs we see black square-box on screen  

Note:Same application is working with disabled gpu.

Logs:
*ERROR* BO at index 117 already on submit list.
Comment 8 Vishwanath Chandapur 2019-01-02 14:46:59 UTC
[ 1458.370916] [drm:etnaviv_ioctl_gem_submit] *ERROR* BO at index 96 already on submit list
[ 1465.955216] [drm:etnaviv_ioctl_gem_submit] *ERROR* BO at index 122 already on submit list
[ 1465.988983] [drm:etnaviv_ioctl_gem_submit] *ERROR* BO at index 122 already on submit list
[ 1466.124379] [drm:etnaviv_ioctl_gem_submit] *ERROR* BO at index 122 already on submit list
Comment 9 Vishwanath Chandapur 2019-01-02 14:47:38 UTC
By looking mesa driver is causing the issue with webGL.
Comment 10 Vishwanath Chandapur 2019-01-07 12:02:48 UTC
Hi Etnaviv Team

Could you please us help on this.

With Regards
Vishwa
Comment 11 Vishwanath Chandapur 2019-01-14 06:42:44 UTC
Hi,

We updated mesa version 18.1.9 but issue still occurring.

With Regards
Vishwa
Comment 12 Vishwanath Chandapur 2019-01-15 18:14:13 UTC
Created attachment 143134 [details]
Screen
Comment 13 Vishwanath Chandapur 2019-01-15 18:17:57 UTC
We updated kernel 4.19.15  but issue still occurring.


Summary:
Mesa:18.1.0
Kernel:4.19.15
Qt qtwebengine :5.11
Chrome:65

issue:
Rectangle black box on screen.

Attached screen shot in previous screen.
Comment 14 Vishwanath Chandapur 2019-01-15 22:48:17 UTC
Hi 
I have enabled -DEBUG flag in mesa driver

below part of code is crashing.

Log:
etnaviv_resource.c:634:etna_resource_used: Assertion `(rsc->pending_ctx == ctx) || !rsc->pending_ctx' failed.

Code:
   /* TODO resources can actually be shared across contexts,
    * so I'm not sure a single list-head will do the trick? */
   debug_assert((rsc->pending_ctx == ctx) || !rsc->pending_ctx); 
   list_delinit(&rsc->list);
   list_addtail(&rsc->list, &ctx->used_resources);
   rsc->pending_ctx = ctx;


Need your help to solve this issue
With Regards
Vishwa
Comment 15 Vishwanath Chandapur 2019-01-16 15:06:51 UTC
Hi 

Below part is the rootcause of rectangle box.

Code:
src/gallium/drivers/etnaviv/etnaviv_resource.c
debug_assert((rsc->pending_ctx == ctx) || !rsc->pending_ctx);
Comment 16 Christian Gmeiner 2019-01-16 15:42:41 UTC
Could you try the following patch?

https://patchwork.freedesktop.org/patch/277031/
Comment 17 Vishwanath Chandapur 2019-01-17 12:29:58 UTC
Hi
thanks for patch.
I have tried the patch but still blackbox still appearing.

With Regards
Vishwa


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.