Bug 105995

Summary: egl driver dri2 on wayland platform can't choose config with EGL_SURFACE_TYPE, EGL_PBUFFER_BIT
Product: Mesa Reporter: Errong <errong.leng>
Component: EGL/WaylandAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: fixed patch
sample code

Description Errong 2018-04-12 05:59:48 UTC
sample codes:
  EGLint attribute_list[] = {EGL_SURFACE_TYPE,    // this must be first
                             EGL_WINDOW_BIT | EGL_PBUFFER_BIT
                             ,
                             EGL_RED_SIZE,
                             8,
                             EGL_GREEN_SIZE,
                             8,
                             EGL_BLUE_SIZE,
                             8,
                             EGL_ALPHA_SIZE,
                             8,
                             EGL_RENDERABLE_TYPE,
                             EGL_OPENGL_ES2_BIT,
                             EGL_NONE};

Test on ubuntu 17.10, use wayland as default.
  // below call always return false
  eglChooseConfig(display, attribute_list, &config, 1, &numConfigs);

cause/solution
src/egl/drivers/dri2/platform_wayland.c

dri2_wl_add_configs_for_visuals
          dri2_conf = dri2_add_config(disp, dri2_dpy->driver_configs[i],
-               count + 1, EGL_WINDOW_BIT, NULL, dri2_wl_visuals[j].rgba_masks);
+               count + 1, EGL_WINDOW_BIT | EGL_PBUFFER_BIT | EGL_PIXMAP_BIT, NULL, dri2_wl_visuals[j].rgba_masks);
Comment 1 Daniel Stone 2018-04-12 06:05:39 UTC
That's correct, pbuffers are not supported on Wayland by Mesa. I haven't seen another driver which does support them on Wayland. Using FBOs is far better and more performant.
Comment 2 Errong 2018-04-12 06:14:02 UTC
Created attachment 138774 [details] [review]
fixed patch

someone would help to apply this patch to meas please ?
I do not know how to do it.
Comment 3 Errong 2018-04-12 06:20:12 UTC
Created attachment 138775 [details]
sample code
Comment 4 Errong 2018-04-12 06:31:34 UTC
(In reply to Daniel Stone from comment #1)
> That's correct, pbuffers are not supported on Wayland by Mesa. I haven't
> seen another driver which does support them on Wayland. Using FBOs is far
> better and more performant.

on really ?
I just modified mesa like I have mentioned.
then eglChooseConfig passed with EGL_PBUFFER_BIT.
and my simple example runs well on ubuntu 17.10 and weston(on ubuntu14.04).
and eglCreatePbufferSurface also success.

by the way, would you tell me what is FBOs please ?
Comment 5 Daniel Stone 2018-04-12 07:06:28 UTC
Pixmap surfaces can never be supported on Wayland, as there is no native pixmap type defined by Wayland.

FBOs are framebuffer objects, which allow the same thing (offscreen rendering) as pbuffers, but far more flexible, performant, and more widely supported.

Here are some resources explaining the basics of FBOs:
https://www.khronos.org/opengl/wiki/Framebuffer_Object
https://learnopengl.com/Advanced-OpenGL/Framebuffers
Comment 6 Errong 2018-04-12 07:35:50 UTC
(In reply to Daniel Stone from comment #5)
> Pixmap surfaces can never be supported on Wayland, as there is no native
> pixmap type defined by Wayland.
> 
> FBOs are framebuffer objects, which allow the same thing (offscreen
> rendering) as pbuffers, but far more flexible, performant, and more widely
> supported.
> 
> Here are some resources explaining the basics of FBOs:
> https://www.khronos.org/opengl/wiki/Framebuffer_Object
> https://learnopengl.com/Advanced-OpenGL/Framebuffers

Ok. I got it.
Thank you very much.

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.