[Mesa-dev] [Mesa-stable] [PATCH] egl/wayland: Don't use DRM format codes for SHM
Emil Velikov
emil.l.velikov at gmail.com
Mon Feb 13 17:27:27 UTC 2017
On 13 February 2017 at 14:06, Daniel Stone <daniels at collabora.com> wrote:
> The wl_drm interface (akin to X11's DRI2) uses the standard set of DRM
> FourCC format codes. wl_shm copies this, except for ARGB8888/XRGB8888,
> which use their own definitions.
>
> Make sure we only use wl_shm format codes when we're working with
> wl_shm. Otherwise, using swrast with 32bpp formats would fail with an
> error.
>
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Cc: Emil Velikov <emil.velikov at collabora.com>
> Cc: mesa-stable at lists.freedesktop.org
> Fixes: cb5e799448 ("egl/wayland: unify dri2_wl_create_surface implementations")
The amount of bugs in the universe stays constant :-\
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99791
Cc: Cédric Legrand <egrand.cedric.01 at gmail.com>
> ---
> src/egl/drivers/dri2/platform_wayland.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> index 37360c7..0bc4e87 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -1402,15 +1402,30 @@ os_create_anonymous_file(off_t size)
>
> static EGLBoolean
> dri2_wl_swrast_allocate_buffer(struct dri2_egl_display *dri2_dpy,
> - int format, int w, int h,
> + int drm_format, int w, int h,
> void **data, int *size,
> struct wl_buffer **buffer)
> {
> struct wl_shm_pool *pool;
> + uint32_t shm_format;
> int fd, stride, size_map;
> void *data_map;
>
> - stride = dri2_wl_swrast_get_stride_for_format(format, w);
> + switch (drm_format) {
> + case WL_DRM_FORMAT_RGB565:
> + shm_format = WL_SHM_FORMAT_RGB565;
> + break;
> + case WL_DRM_FORMAT_ARGB8888:
> + shm_format = WL_SHM_FORMAT_ARGB8888;
> + break;
> + case WL_DRM_FORMAT_XRGB8888:
> + shm_format = WL_SHM_FORMAT_XRGB8888;
> + break;
> + default:
> + return EGL_FALSE;
> + }
> +
Wouldn't it be better to have this in dri2_wl_create_window_surface() ?
As-is we're passing the DRM formats on the wire, which is quite likely
to cause issues elsewhere.
-Emil
More information about the mesa-dev
mailing list