[Mesa-dev] [PATCH 09/11] egl/wayland: Remove more surface specifics from create_wl_buffer

Lucas Stach l.stach at pengutronix.de
Wed Jun 28 11:00:01 UTC 2017


Am Freitag, den 16.06.2017, 18:14 +0100 schrieb Daniel Stone:
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
>  src/egl/drivers/dri2/platform_wayland.c | 32 ++++++++++++++------------------
>  1 file changed, 14 insertions(+), 18 deletions(-)
> 
> diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> index 7a85cb1073..b7197d0a75 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -648,31 +648,28 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
>                   __DRIimage *image)
>  {
>     struct wl_buffer *ret;
> -   int fd, stride, name;
> +   int width, height, fourcc;
> +
> +   dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_WIDTH, &width);
> +   dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_HEIGHT, &height);
> +   dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FOURCC, &fourcc);
>  
>     if (dri2_dpy->capabilities & WL_DRM_CAPABILITY_PRIME) {
> -      dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FD, &fd);
> -      dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
> +      int stride, fd;
>  
> +      dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
> +      dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FD, &fd);
>        ret = wl_drm_create_prime_buffer(dri2_surf->wl_drm_wrapper,
> -                                       fd,
> -                                       dri2_surf->base.Width,
> -                                       dri2_surf->base.Height,
> -                                       dri2_surf->format,
> -                                       0, stride,
> -                                       0, 0,
> -                                       0, 0);
> +                                       fd, width, height, fourcc, 0, stride,
> +                                       0, 0, 0, 0);
>        close(fd);
>     } else {
> -      dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_NAME, &name);
> -      dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
> +      int stride, name;
>  
> +      dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &stride);
> +      dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_NAME, &name);
>        ret = wl_drm_create_buffer(dri2_surf->wl_drm_wrapper,
> -                                 name,
> -                                 dri2_surf->base.Width,
> -                                 dri2_surf->base.Height,
> -                                 stride,
> -                                 dri2_surf->format);
> +                                 name, width, height, stride, fourcc);
>     }
>  
>     return ret;
> @@ -738,7 +735,6 @@ dri2_wl_swap_buffers_with_damage(_EGLDriver *drv,
>  
>     dri2_surf->back->age = 1;
>     dri2_surf->current = dri2_surf->back;
> -   dri2_surf->back = NULL;

This hunk is wrong, as it causes get_back_bo() to not return the current
front buffer, causing rendering corruptions.

Regards,
Lucas



More information about the mesa-dev mailing list