[Mesa-users] Mesa 17 Wayland EGL changes

Pekka Paalanen ppaalanen at gmail.com
Mon Feb 13 14:40:34 UTC 2017


On Mon, 13 Feb 2017 13:47:05 +0100
Cédric Legrand <legrand.cedric.01 at gmail.com> wrote:

> 2017-02-13 13:13 GMT+01:00 Pekka Paalanen <ppaalanen at gmail.com>:
> 
> > On Mon, 13 Feb 2017 12:49:59 +0100
> > Cédric Legrand <legrand.cedric.01 at gmail.com> wrote:
> >  
> > > 2017-02-13 12:23 GMT+01:00 Pekka Paalanen <ppaalanen at gmail.com>:
> > >  
> > > > On Mon, 13 Feb 2017 11:59:01 +0100
> > > > Cédric Legrand <legrand.cedric.01 at gmail.com> wrote:
> > > >  
> > > > > Hello,
> > > > >
> > > > > I'm working on a Wayland compositor and the latest Mesa update broke  
> > my  
> > > > > work. After investigating, I found that I need to use the
> > > > > EGL_WL_wayland_bind_display extension, otherwise my compositor  
> > crashes  
> > > > with  
> > > > > wl_shm reporting an invalid format. I'm not an OpenGL expert, but I  
> > spent  
> > > > > the last few days reading documentation, inspecting weston's source  
> > code  
> > > > > and googling with no luck.
> > > > >
> > > > > Question 1: Is it necessary to have the extension? Why don't Mesa  
> > support  
> > > > > plain old wl_shm anymore? Unless I missed something, this means we  
> > can't  
> > > > > use OpenGL anymore for software rendering in Wayland, am I right?  
> > > >
> > > > Hi,
> > > >
> > > > that sounds like a new bug in Mesa, but what is this "invalid format"
> > > > error you mention?  
> > >
> > >
> > > Sorry, I was a little vague on this one. The error is the wl_shm protocol
> > > error:  
> > >  -> wl_display at 1.error(wl_shm_pool at 14, 0, "invalid format 0x34325258")  
> > >
> > > I inspected Mesa code and it seems that it is asking for a  
> > WL_DRM_FORMAT_*  
> > > buffer, independently from the availability of the wl_drm interface.  
> > There  
> > > is no instance of WL_SHM_FORMAT_* in its source code. Of course, without
> > > the interface, the server wl_shm knows nothing about these formats and
> > > throws the error.  
> >
> > The WL_SHM and WL_DRM formats are identical, except for two very
> > unfortunate differences: argb8888 and xrgb8888 - the two formats that
> > are required to be supported by the compositor and are most used.
> >
> > Hence most DRM formats are valid and correct also as wl_shm formats (by
> > design), except the ones that are most popular (by historical accident).
> >  
> 
> My system is using ARGB8888. If I got everything correctly, this means that
> Mesa should fallback to WL_SHM_FORMAT_ARGB8888 when wl_drm is not
> available, right? Or should the compositor have to support
> WL_DRM_FORMAT_[XA]RGB8888 (even if this is implementation specific)?

That is a very good question.

I am looking at some 12.0 branch of Mesa, and it clearly has:

src/egl/drivers/dri2/platform_wayland.c=1245=dri2_wl_swrast_get_stride_for_format(int format, int w)
src/egl/drivers/dri2/platform_wayland.c:1247:   if (format == WL_SHM_FORMAT_RGB565)
src/egl/drivers/dri2/platform_wayland.c=1667=dri2_wl_swrast_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
src/egl/drivers/dri2/platform_wayland.c:1689:      dri2_surf->format = WL_SHM_FORMAT_RGB565;
src/egl/drivers/dri2/platform_wayland.c:1691:      dri2_surf->format = WL_SHM_FORMAT_XRGB8888;
src/egl/drivers/dri2/platform_wayland.c:1693:      dri2_surf->format = WL_SHM_FORMAT_ARGB8888;
src/egl/drivers/dri2/platform_wayland.c=1735=shm_handle_format(void *data, struct wl_shm *shm, uint32_t format)
src/egl/drivers/dri2/platform_wayland.c:1740:   case WL_SHM_FORMAT_ARGB8888:
src/egl/drivers/dri2/platform_wayland.c:1743:   case WL_SHM_FORMAT_XRGB8888:
src/egl/drivers/dri2/platform_wayland.c:1746:   case WL_SHM_FORMAT_RGB565:


OTOH I could not find any code in Weston to handle wl_shm formats
'XR24' (xrgb8888) or 'AR24' (argb8888), so I do not think compositors
are expected to handle them without advertising.

Commit cb5e799448c959fa9f0d7ea76999ac6f8c0ad88e in Mesa seems to have
dropped the format special-casing.

I'll put this info also in the bug
https://bugs.freedesktop.org/show_bug.cgi?id=99791 you opened.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-users/attachments/20170213/61f38356/attachment.sig>


More information about the mesa-users mailing list