9.0.0-4 (patches unapplied)

Imported using git-ubuntu import.
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
deleted file mode 100644
index 9c24dd8..0000000
--- a/.gitlab-ci.yml
+++ /dev/null
@@ -1,111 +0,0 @@
-# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:
-
-variables:
-  FDO_UPSTREAM_REPO: wayland/weston
-
-
-include:
-  - project: 'freedesktop/ci-templates'
-    ref: 59de540b620c45739871d1a073d76d5521989d11
-    file: '/templates/debian.yml'
-
-
-stages:
-  - container_prep
-  - build
-  - pages
-
-
-.debian:
-  variables:
-    FDO_DISTRIBUTION_VERSION: buster
-    FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/debian-install.sh'
-    FDO_DISTRIBUTION_TAG: '2020-06-24.0'
-
-
-container_prep:
-  extends:
-    - .debian
-    - .fdo.container-build@debian
-  stage: container_prep
-
-
-.build-native:
-  extends:
-    - .debian
-    - .fdo.distribution-image@debian
-  stage: build
-  before_script:
-  - git clone --depth=1 https://gitlab.freedesktop.org/wayland/wayland-protocols
-  - export WAYLAND_PROTOCOLS_DIR="$(pwd)/prefix-wayland-protocols"
-  - export PKG_CONFIG_PATH="$WAYLAND_PROTOCOLS_DIR/share/pkgconfig:$PKG_CONFIG_PATH"
-  - export MAKEFLAGS="-j4"
-  - cd wayland-protocols
-  - git show -s HEAD
-  - mkdir build
-  - cd build
-  - ../autogen.sh --prefix="$WAYLAND_PROTOCOLS_DIR"
-  - make install
-  - cd ../../
-  - export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
-  - export BUILD_ID="weston-$CI_JOB_NAME"
-  - export PREFIX="$(pwd)/prefix-$BUILD_ID"
-  - export BUILDDIR="$(pwd)/build-$BUILD_ID"
-  - export TESTS_RES_PATH="$BUILDDIR/tests-res.txt"
-  - mkdir "$BUILDDIR" "$PREFIX"
-
-.build-native-meson:
-  extends: .build-native
-  tags:
-    - kvm
-  script:
-  - export PATH=~/.local/bin:$PATH
-  - cd "$BUILDDIR"
-  - meson --prefix="$PREFIX" ${MESON_OPTIONS} ..
-  - ninja -k0
-  - ninja install
-  - virtme-run --rw --pwd --kimg /weston-virtme/bzImage --script-dir ../.gitlab-ci/virtme-scripts
-  - TEST_RES=$(cat $TESTS_RES_PATH)
-  - rm $TESTS_RES_PATH
-  - ninja clean
-  - cp -R /weston-virtme ./
-  - rm weston-virtme/bzImage
-  - exit $TEST_RES
-  artifacts:
-    name: weston-$CI_COMMIT_SHA
-    when: always
-    paths:
-    - build-*/meson-logs
-    - build-*/weston-virtme
-    - prefix-*
-
-build-native-meson-default-options:
-  variables:
-    MESON_OPTIONS: >
-      -Dwerror=true
-      -Ddoc=true
-  extends: .build-native-meson
-
-build-native-meson-no-gl-renderer:
-  variables:
-    MESON_OPTIONS: >
-      -Dsimple-clients=damage,im,shm,touch,dmabuf-v4l
-      -Drenderer-gl=false
-      -Dremoting=false
-      -Dpipewire=false
-      -Dwerror=true
-  extends: .build-native-meson
-
-pages:
-  stage: pages
-  dependencies:
-    - build-native-meson-default-options
-  script:
-  - export PREFIX=$(pwd)/prefix-weston-build-native-meson-default-options
-  - mkdir public
-  - cp -R $PREFIX/share/doc/weston/* public/
-  artifacts:
-    paths:
-    - public
-  only:
-    - master
diff --git a/.gitlab-ci/debian-install.sh b/.gitlab-ci/debian-install.sh
deleted file mode 100644
index 12fb4e3..0000000
--- a/.gitlab-ci/debian-install.sh
+++ /dev/null
@@ -1,150 +0,0 @@
-#!/bin/bash
-
-set -o xtrace -o errexit
-
-# These get temporary installed for building Linux and then force-removed.
-LINUX_DEV_PKGS="
-	bc
-	bison
-	flex
-	libelf-dev
-"
-
-# These get temporary installed for building Mesa and then force-removed.
-MESA_DEV_PKGS="
-	bison
-	flex
-	gettext
-	libwayland-egl-backend-dev
-	libxrandr-dev
-	llvm-8-dev
-	python-mako
-	python3-mako
-	wayland-protocols
-"
-
-# Needed for running the custom-built mesa
-MESA_RUNTIME_PKGS="
-	libllvm8
-"
-
-echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list
-apt-get update
-apt-get -y --no-install-recommends install \
-	autoconf \
-	automake \
-	build-essential \
-	curl \
-	doxygen \
-	freerdp2-dev \
-	git \
-	libcairo2-dev \
-	libcolord-dev \
-	libdbus-1-dev \
-	libegl1-mesa-dev \
-	libevdev-dev \
-	libexpat1-dev \
-	libffi-dev \
-	libgbm-dev \
-	libgdk-pixbuf2.0-dev \
-	libgles2-mesa-dev \
-	libglu1-mesa-dev \
-	libgstreamer1.0-dev \
-	libgstreamer-plugins-base1.0-dev \
-	libinput-dev \
-	libjpeg-dev \
-	libjpeg-dev \
-	liblcms2-dev \
-	libmtdev-dev \
-	libpam0g-dev \
-	libpango1.0-dev \
-	libpipewire-0.2-dev \
-	libpixman-1-dev \
-	libpng-dev \
-	libsystemd-dev \
-	libtool \
-	libudev-dev \
-	libva-dev \
-	libvpx-dev \
-	libwayland-dev \
-	libwebp-dev \
-	libx11-dev \
-	libx11-xcb-dev \
-	libxcb1-dev \
-	libxcb-composite0-dev \
-	libxcb-xfixes0-dev \
-	libxcb-xkb-dev \
-	libxcursor-dev \
-	libxkbcommon-dev \
-	libxml2-dev \
-	mesa-common-dev \
-	ninja-build \
-	pkg-config \
-	python3-pip \
-	python3-setuptools \
-	qemu-system \
-	sysvinit-core \
-	xwayland \
-	$MESA_RUNTIME_PKGS
-
-
-pip3 install --user git+https://github.com/mesonbuild/meson.git@0.49
-export PATH=$HOME/.local/bin:$PATH
-# for documentation
-pip3 install sphinx==2.1.0 --user
-pip3 install breathe==4.13.0.post0 --user
-pip3 install sphinx_rtd_theme==0.4.3 --user
-
-apt-get -y --no-install-recommends install $LINUX_DEV_PKGS
-git clone --depth=1 --branch=drm-next-2020-06-11-1 https://anongit.freedesktop.org/git/drm/drm.git linux
-cd linux
-make x86_64_defconfig
-make kvmconfig
-./scripts/config --enable CONFIG_DRM_VKMS
-make oldconfig
-make -j8
-cd ..
-mkdir /weston-virtme
-mv linux/arch/x86/boot/bzImage /weston-virtme/bzImage
-mv linux/.config /weston-virtme/.config
-rm -rf linux
-
-# Link to upstream virtme: https://github.com/amluto/virtme
-#
-# The reason why we are using a fork here is that it adds a patch to have the
-# --script-dir command line option. With that we can run scripts that are in a
-# certain folder when virtme starts, which is necessary in our use case.
-#
-# The upstream also has some commands that could help us to reach the same
-# results: --script-sh and --script-exec. Unfornutately they are not completely
-# implemented yet, so we had some trouble to use them and it was becoming
-# hackery.
-#
-git clone https://github.com/ezequielgarcia/virtme
-cd virtme
-git checkout -b snapshot 69e3cb83b3405edc99fcf9611f50012a4f210f78
-./setup.py install
-cd ..
-
-git clone --branch 1.17.0 --depth=1 https://gitlab.freedesktop.org/wayland/wayland
-export MAKEFLAGS="-j4"
-cd wayland
-git show -s HEAD
-mkdir build
-cd build
-../autogen.sh --disable-documentation
-make install
-cd ../../
-
-apt-get -y --no-install-recommends install $MESA_DEV_PKGS
-git clone --single-branch --branch master --shallow-since='2020-02-15' https://gitlab.freedesktop.org/mesa/mesa.git mesa
-cd mesa
-git checkout -b snapshot c7617d8908a970124321ce731b43d5996c3c5775
-meson build -Dauto_features=disabled \
-	-Dgallium-drivers=swrast -Dvulkan-drivers= -Ddri-drivers=
-ninja -C build install
-cd ..
-rm -rf mesa
-
-apt-get -y --autoremove purge $LINUX_DEV_PKGS
-apt-get -y --autoremove purge $MESA_DEV_PKGS
\ No newline at end of file
diff --git a/.gitlab-ci/virtme-scripts/run-weston-tests.sh b/.gitlab-ci/virtme-scripts/run-weston-tests.sh
deleted file mode 100644
index bbcebfd..0000000
--- a/.gitlab-ci/virtme-scripts/run-weston-tests.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-# folders that are necessary to run Weston tests
-mkdir -p /tmp/tests
-mkdir -p /tmp/.X11-unix
-chmod -R 0700 /tmp
-
-# set environment variables to run Weston tests
-export XDG_RUNTIME_DIR=/tmp/tests
-export WESTON_TEST_SUITE_DRM_DEVICE=card0
-
-# ninja test depends on meson, and meson itself looks for its modules on folder
-# $HOME/.local/lib/pythonX.Y/site-packages (the Python version may differ).
-# virtme starts with HOME=/tmp/roothome, but as we installed meson on user root,
-# meson can not find its modules. So we change the HOME env var to fix that.
-export HOME=/root
-
-# run the tests and save the exit status
-ninja test
-TEST_RES=$?
-
-# create a file to keep the result of this script:
-#   - 0 means the script succeeded
-#   - 1 means the tests failed, so the job itself should fail
-TESTS_RES_PATH=$(pwd)/tests-res.txt
-echo $TEST_RES > $TESTS_RES_PATH
-
-# shutdown virtme
-sync
-poweroff -f
diff --git a/debian/changelog b/debian/changelog
index 665ae25..2f5c872 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,18 @@
+weston (9.0.0-4) unstable; urgency=high
+
+  * debian/rules: make tests non fatal
+    - Xwayland test needs a proper environment to run.
+
+ -- Héctor Orón Martínez <zumbi@debian.org>  Thu, 04 Mar 2021 22:12:48 +0100
+
+weston (9.0.0-3) unstable; urgency=high
+
+  * re-enable pipewire support with new ABI (0.3)
+  * set XDG_RUNTIME_DIR for testsuite at build daemons
+    - failing tests are fatal for build.
+
+ -- Héctor Orón Martínez <zumbi@debian.org>  Thu, 04 Mar 2021 20:01:52 +0100
+
 weston (9.0.0-2) unstable; urgency=medium
 
   * debian/libweston-9-dev.install: drop libexec_weston (Closes: #970134)
diff --git a/debian/control b/debian/control
index 1013204..1b774f1 100644
--- a/debian/control
+++ b/debian/control
@@ -24,6 +24,7 @@
                libpam0g-dev,
                libpango1.0-dev,
                libpixman-1-dev (>= 0.25.2),
+               libpipewire-0.3-dev,
                libpng-dev,
                libsystemd-dev,
                libudev-dev (>= 136),
diff --git a/debian/libweston-9-0.install b/debian/libweston-9-0.install
index f3340ef..92ff4e1 100644
--- a/debian/libweston-9-0.install
+++ b/debian/libweston-9-0.install
@@ -3,8 +3,7 @@
 usr/lib/*/libweston-9/fbdev-backend.so
 usr/lib/*/libweston-9/gl-renderer.so
 usr/lib/*/libweston-9/headless-backend.so
-# re-enable once upstream supports pipewire-0.3
-# usr/lib/*/libweston-9/pipewire-plugin.so
+usr/lib/*/libweston-9/pipewire-plugin.so
 usr/lib/*/libweston-9/rdp-backend.so
 usr/lib/*/libweston-9/remoting-plugin.so
 usr/lib/*/libweston-9/wayland-backend.so
diff --git a/debian/rules b/debian/rules
index c3a5dfd..88f4b2a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,12 +2,11 @@
 
 override_dh_auto_configure:
 	dh_auto_configure -- -Dscreenshare=true \
-		-Dsystemd=true -Dsimple-dmabuf-drm=auto \
-		-Dpipewire=false
+		-Dsystemd=true -Dsimple-dmabuf-drm=auto
 
 override_dh_auto_test:
-	# the test suite does not 100% pass in headless mode
-	dh_auto_test || true
+	mkdir -p $(CURDIR)/debian/tmp/tmp/xdgruntimedir
+	XDG_RUNTIME_DIR=$(CURDIR)/debian/tmp/tmp/xdgruntimedir dh_auto_test || true
 
 override_dh_missing:
 	dh_missing --fail-missing -X.la
diff --git a/pipewire/meson.build b/pipewire/meson.build
index 3d3374b..e30a0b6 100644
--- a/pipewire/meson.build
+++ b/pipewire/meson.build
@@ -5,17 +5,25 @@
 		error('Attempting to build the pipewire plugin without the required DRM backend. ' + user_hint)
 	endif
 
-	depnames = [
-		'libpipewire-0.2', 'libspa-0.1'
-	]
 	deps_pipewire = [ dep_libweston_private ]
-	foreach depname : depnames
-		dep = dependency(depname, required: false)
-		if not dep.found()
-			error('Pipewire plugin requires @0@ which was not found. '.format(depname) + user_hint)
-		endif
-		deps_pipewire += dep
-	endforeach
+
+	dep_libpipewire = dependency('libpipewire-0.3', required: false)
+	if not dep_libpipewire.found()
+		dep_libpipewire = dependency('libpipewire-0.2', required: false)
+	endif
+	if not dep_libpipewire.found()
+		error('Pipewire plugin requires libpipewire which was not found. ' + user_hint)
+	endif
+	deps_pipewire += dep_libpipewire
+
+	dep_libspa = dependency('libspa-0.2', required: false)
+	if not dep_libspa.found()
+		dep_libspa = dependency('libspa-0.1', required: false)
+	endif
+	if not dep_libspa.found()
+		error('Pipewire plugin requires libspa which was not found. ' + user_hint)
+	endif
+	deps_pipewire += dep_libspa
 
 	plugin_pipewire = shared_library(
 		'pipewire-plugin',
diff --git a/pipewire/pipewire-plugin.c b/pipewire/pipewire-plugin.c
index 6f89257..ce70ea6 100644
--- a/pipewire/pipewire-plugin.c
+++ b/pipewire/pipewire-plugin.c
@@ -34,20 +34,27 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include <pipewire/pipewire.h>
+
 #include <spa/param/format-utils.h>
 #include <spa/param/video/format-utils.h>
 #include <spa/utils/defs.h>
 
-#include <pipewire/pipewire.h>
+#if PW_CHECK_VERSION(0, 2, 90)
+#include <spa/buffer/meta.h>
+#include <spa/utils/result.h>
+#endif
 
 #define PROP_RANGE(min, max) 2, (min), (max)
 
+#if !PW_CHECK_VERSION(0, 2, 90)
 struct type {
 	struct spa_type_media_type media_type;
 	struct spa_type_media_subtype media_subtype;
 	struct spa_type_format_video format_video;
 	struct spa_type_video_format video_format;
 };
+#endif
 
 struct weston_pipewire {
 	struct weston_compositor *compositor;
@@ -60,12 +67,19 @@
 	struct pw_loop *loop;
 	struct wl_event_source *loop_source;
 
+#if PW_CHECK_VERSION(0, 2, 90)
+	struct pw_context *context;
+#endif
 	struct pw_core *core;
 	struct pw_type *t;
+#if PW_CHECK_VERSION(0, 2, 90)
+	struct spa_hook core_listener;
+#else
 	struct type type;
 
 	struct pw_remote *remote;
 	struct spa_hook remote_listener;
+#endif
 };
 
 struct pipewire_output {
@@ -100,6 +114,7 @@
 	struct wl_event_source *fence_sync_event_source;
 };
 
+#if !PW_CHECK_VERSION(0, 2, 90)
 static inline void init_type(struct type *type, struct spa_type_map *map)
 {
 	spa_type_media_type_map(map, &type->media_type);
@@ -107,6 +122,7 @@
 	spa_type_format_video_map(map, &type->format_video);
 	spa_type_video_format_map(map, &type->video_format);
 }
+#endif
 
 static void
 pipewire_debug_impl(struct weston_pipewire *pipewire,
@@ -141,6 +157,7 @@
 	free(logstr);
 }
 
+#if !PW_CHECK_VERSION(0, 2, 90)
 static void
 pipewire_debug(struct weston_pipewire *pipewire, const char *fmt, ...)
 {
@@ -150,6 +167,7 @@
 	pipewire_debug_impl(pipewire, NULL, fmt, ap);
 	va_end(ap);
 }
+#endif
 
 static void
 pipewire_output_debug(struct pipewire_output *output, const char *fmt, ...)
@@ -185,7 +203,9 @@
 	const struct weston_drm_virtual_output_api *api =
 		output->pipewire->virtual_output_api;
 	size_t size = output->output->height * stride;
+#if !PW_CHECK_VERSION(0, 2, 90)
 	struct pw_type *t = output->pipewire->t;
+#endif
 	struct pw_buffer *buffer;
 	struct spa_buffer *spa_buffer;
 	struct spa_meta_header *h;
@@ -203,7 +223,12 @@
 
 	spa_buffer = buffer->buffer;
 
+#if PW_CHECK_VERSION(0, 2, 90)
+	if ((h = spa_buffer_find_meta_data(spa_buffer, SPA_META_Header,
+				     sizeof(struct spa_meta_header)))) {
+#else
 	if ((h = spa_buffer_find_meta(spa_buffer, t->meta.Header))) {
+#endif
 		h->pts = -1;
 		h->flags = 0;
 		h->seq = output->seq++;
@@ -375,18 +400,40 @@
 static int
 pipewire_output_connect(struct pipewire_output *output)
 {
+#if !PW_CHECK_VERSION(0, 2, 90)
 	struct weston_pipewire *pipewire = output->pipewire;
 	struct type *type = &pipewire->type;
+#endif
 	uint8_t buffer[1024];
 	struct spa_pod_builder builder =
 		SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
 	const struct spa_pod *params[1];
+#if !PW_CHECK_VERSION(0, 2, 90)
 	struct pw_type *t = pipewire->t;
+#endif
 	int frame_rate = output->output->current_mode->refresh / 1000;
 	int width = output->output->width;
 	int height = output->output->height;
 	int ret;
 
+#if PW_CHECK_VERSION(0, 2, 90)
+	params[0] = spa_pod_builder_add_object(&builder,
+		SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
+		SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
+		SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
+		SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_BGRx),
+		SPA_FORMAT_VIDEO_size, SPA_POD_Rectangle(&SPA_RECTANGLE(width, height)),
+		SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&SPA_FRACTION (0, 1)),
+		SPA_FORMAT_VIDEO_maxFramerate,
+		SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(frame_rate, 1),
+			&SPA_FRACTION(1, 1),
+			&SPA_FRACTION(frame_rate, 1)));
+
+	ret = pw_stream_connect(output->stream, PW_DIRECTION_OUTPUT, SPA_ID_INVALID,
+				(PW_STREAM_FLAG_DRIVER |
+				 PW_STREAM_FLAG_MAP_BUFFERS),
+				params, 1);
+#else
 	params[0] = spa_pod_builder_object(&builder,
 		t->param.idEnumFormat, t->spa_format,
 		"I", type->media_type.video,
@@ -406,6 +453,7 @@
 				(PW_STREAM_FLAG_DRIVER |
 				 PW_STREAM_FLAG_MAP_BUFFERS),
 				params, 1);
+#endif
 	if (ret != 0) {
 		weston_log("Failed to connect pipewire stream: %s",
 			   spa_strerror(ret));
@@ -482,26 +530,42 @@
 }
 
 static void
+#if PW_CHECK_VERSION(0, 2, 90)
+pipewire_output_stream_param_changed(void *data, uint32_t id, const struct spa_pod *format)
+#else
 pipewire_output_stream_format_changed(void *data, const struct spa_pod *format)
+#endif
 {
 	struct pipewire_output *output = data;
+#if !PW_CHECK_VERSION(0, 2, 90)
 	struct weston_pipewire *pipewire = output->pipewire;
+#endif
 	uint8_t buffer[1024];
 	struct spa_pod_builder builder =
 		SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
 	const struct spa_pod *params[2];
+#if !PW_CHECK_VERSION(0, 2, 90)
 	struct pw_type *t = pipewire->t;
+#endif
 	int32_t width, height, stride, size;
 	const int bpp = 4;
 
 	if (!format) {
 		pipewire_output_debug(output, "format = None");
+#if PW_CHECK_VERSION(0, 2, 90)
+		pw_stream_update_params(output->stream, NULL, 0);
+#else
 		pw_stream_finish_format(output->stream, 0, NULL, 0);
+#endif
 		return;
 	}
 
+#if PW_CHECK_VERSION(0, 2, 90)
+	spa_format_video_raw_parse(format, &output->video_format);
+#else
 	spa_format_video_raw_parse(format, &output->video_format,
 				   &pipewire->type.format_video);
+#endif
 
 	width = output->video_format.size.width;
 	height = output->video_format.size.height;
@@ -510,6 +574,21 @@
 
 	pipewire_output_debug(output, "format = %dx%d", width, height);
 
+#if PW_CHECK_VERSION(0, 2, 90)
+	params[0] = spa_pod_builder_add_object(&builder,
+		SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
+		SPA_PARAM_BUFFERS_size, SPA_POD_Int(size),
+		SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
+		SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(4, 2, 8),
+		SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
+
+	params[1] = spa_pod_builder_add_object(&builder,
+		SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
+		SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
+		SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header)));
+
+	pw_stream_update_params(output->stream, params, 2);
+#else
 	params[0] = spa_pod_builder_object(&builder,
 		t->param.idBuffers, t->param_buffers.Buffers,
 		":", t->param_buffers.size,
@@ -527,12 +606,17 @@
 		":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
 
 	pw_stream_finish_format(output->stream, 0, params, 2);
+#endif
 }
 
 static const struct pw_stream_events stream_events = {
 	PW_VERSION_STREAM_EVENTS,
 	.state_changed = pipewire_output_stream_state_changed,
+#if PW_CHECK_VERSION(0, 2, 90)
+	.param_changed = pipewire_output_stream_param_changed,
+#else
 	.format_changed = pipewire_output_stream_format_changed,
+#endif
 };
 
 static struct weston_output *
@@ -560,7 +644,11 @@
 	if (!head)
 		goto err;
 
+#if PW_CHECK_VERSION(0, 2, 90)
+	output->stream = pw_stream_new(pipewire->core, name, NULL);
+#else
 	output->stream = pw_stream_new(pipewire->remote, name, NULL);
+#endif
 	if (!output->stream) {
 		weston_log("Cannot initialize pipewire stream\n");
 		goto err;
@@ -704,6 +792,14 @@
 	return 0;
 }
 
+#if PW_CHECK_VERSION(0, 2, 90)
+static void
+weston_pipewire_error(void *data, uint32_t id, int seq, int res,
+			      const char *error)
+{
+	weston_log("pipewire remote error: %s\n", error);
+}
+#else
 static void
 weston_pipewire_state_changed(void *data, enum pw_remote_state old,
 			      enum pw_remote_state state, const char *error)
@@ -725,12 +821,20 @@
 		break;
 	}
 }
+#endif
 
 
+#if PW_CHECK_VERSION(0, 2, 90)
+static const struct pw_core_events core_events = {
+	PW_VERSION_CORE_EVENTS,
+	.error = weston_pipewire_error,
+};
+#else
 static const struct pw_remote_events remote_events = {
 	PW_VERSION_REMOTE_EVENTS,
 	.state_changed = weston_pipewire_state_changed,
 };
+#endif
 
 static int
 weston_pipewire_init(struct weston_pipewire *pipewire)
@@ -745,10 +849,19 @@
 
 	pw_loop_enter(pipewire->loop);
 
+#if PW_CHECK_VERSION(0, 2, 90)
+	pipewire->context = pw_context_new(pipewire->loop, NULL, 0);
+#else
 	pipewire->core = pw_core_new(pipewire->loop, NULL);
 	pipewire->t = pw_core_get_type(pipewire->core);
 	init_type(&pipewire->type, pipewire->t->map);
+#endif
 
+#if PW_CHECK_VERSION(0, 2, 90)
+	pw_core_add_listener(pipewire->core,
+			       &pipewire->core_listener,
+			       &core_events, pipewire);
+#else
 	pipewire->remote = pw_remote_new(pipewire->core, NULL, 0);
 	pw_remote_add_listener(pipewire->remote,
 			       &pipewire->remote_listener,
@@ -777,6 +890,7 @@
 			goto err;
 		}
 	}
+#endif
 
 	loop = wl_display_get_event_loop(pipewire->compositor->wl_display);
 	pipewire->loop_source =
@@ -786,12 +900,14 @@
 				     pipewire);
 
 	return 0;
+#if !PW_CHECK_VERSION(0, 2, 90)
 err:
 	if (pipewire->remote)
 		pw_remote_destroy(pipewire->remote);
 	pw_loop_leave(pipewire->loop);
 	pw_loop_destroy(pipewire->loop);
 	return -1;
+#endif
 }
 
 static const struct weston_pipewire_api pipewire_api = {