Bug 105995 - egl driver dri2 on wayland platform can't choose config with EGL_SURFACE_TYPE, EGL_PBUFFER_BIT
Summary: egl driver dri2 on wayland platform can't choose config with EGL_SURFACE_TYPE...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: EGL/Wayland (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Wayland bug list
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-12 05:59 UTC by Errong
Modified: 2018-04-12 07:35 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
fixed patch (1.52 KB, patch)
2018-04-12 06:14 UTC, Errong
Details | Splinter Review
sample code (7.48 KB, text/plain)
2018-04-12 06:20 UTC, Errong
Details

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.