[Mesa-dev] [PATCH] wayland-drm: Implement wl_buffer.damage in old versions of Wayland

Kristian Hoegsberg hoegsberg at gmail.com
Thu Apr 12 18:48:31 PDT 2012


On Wed, Apr 11, 2012 at 05:07:56PM +0100, Neil Roberts wrote:
> Commit 272bc48976 removed the damage implementation for the
> wl_buffer_interface because that has been removed from git master of
> Wayland. However this breaks building with the 0.85 branch of Wayland
> because it would end up initialising the struct incorrectly.
> 
> For the time being it's quite convenient for some compositors to track
> the 0.85 branch of Wayland because the protocol is stable but they
> will also want to track the master branch of Mesa so that they can use
> the gbm surface changes.
> 
> This patch adds a compile-time check for the version of Wayland so
> that it can work with either Wayland master or the 0.85 branch.

Thanks Neil, that looks good.  I did edit your patch a little to make
the #define just HAS_WAYLAND_0_85 and made it also account for the API
changes that I just landed today.  mesa master should now work with both
wayland master and the tip of the wayland 0.85 branch.

Kristian

> ---
>  src/egl/wayland/wayland-drm/wayland-drm.c |   26 ++++++++++++++++++++++++++
>  1 files changed, 26 insertions(+), 0 deletions(-)
> 
> diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
> index 101b2c4..f5c31db 100644
> --- a/src/egl/wayland/wayland-drm/wayland-drm.c
> +++ b/src/egl/wayland/wayland-drm/wayland-drm.c
> @@ -70,7 +70,33 @@ buffer_destroy(struct wl_client *client, struct wl_resource *resource)
>  	wl_resource_destroy(resource, 0);
>  }
>  
> +/* In Git master of Wayland, the damage member of wl_buffer_interface
> + * has been removed. For the time being, it's convenient to be able to
> + * build Mesa against both master and 0.85.0 of Wayland so to make
> + * this work we'll do a compile-time version check and add a dummy
> + * damage implementation for old Wayland */
> +#define VERSION_ENCODE(major, minor, micro)     \
> +  (((major) << 20) | ((minor) << 10) | (micro))
> +#if !defined (WAYLAND_VERSION_MAJOR) ||         \
> +  VERSION_ENCODE (WAYLAND_VERSION_MAJOR,        \
> +                  WAYLAND_VERSION_MINOR,        \
> +                  WAYLAND_VERSION_MICRO) <      \
> +  VERSION_ENCODE (0, 99, 0)
> +#define BUFFER_INTERFACE_HAS_DAMAGE
> +#endif
> +
> +#ifdef BUFFER_INTERFACE_HAS_DAMAGE
> +static void
> +buffer_damage(struct wl_client *client, struct wl_resource *buffer,
> +              int32_t x, int32_t y, int32_t width, int32_t height)
> +{
> +}
> +#endif
> +
>  const static struct wl_buffer_interface drm_buffer_interface = {
> +#ifdef BUFFER_INTERFACE_HAS_DAMAGE
> +	buffer_damage,
> +#endif
>  	buffer_destroy
>  };
>  
> -- 
> 1.7.3.16.g9464b
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list