summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Kurzinger2020-01-29 12:05:50 -0800
committerErik Kurzinger2020-01-29 12:05:50 -0800
commit4663bfed711768b751c00a04e336290aee62b340 (patch)
tree59797ee46de9c0b9804b4043f7aca0b63a6e4bc7
parentf821989f042dbf89593a8344624fe0672fbbddb8 (diff)
downloadaur-4663bfed711768b751c00a04e336290aee62b340.tar.gz
Update to Weston 8.0.0
-rw-r--r--.SRCINFO24
-rw-r--r--0001-gl-renderer-Add-EGLDevice-enumeration-support.patch35
-rw-r--r--0002-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch245
-rw-r--r--0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch139
-rw-r--r--0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch15
-rw-r--r--0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch592
-rw-r--r--0006-compositor-Process-stream-attach-requests-with-wl_eg.patch48
-rw-r--r--0007-desktop-shell-Avoid-NULL-output-dereference-when-get.patch52
-rw-r--r--0008-compositor-Do-not-trigger-invalid-destructors-when-h.patch53
-rw-r--r--PKGBUILD26
10 files changed, 580 insertions, 649 deletions
diff --git a/.SRCINFO b/.SRCINFO
index a0def764802..ef4fa490a21 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = weston-eglstream
pkgdesc = Reference implementation of a Wayland compositor with EGLStream support
- pkgver = 7.0.0
- pkgrel = 2
+ pkgver = 8.0.0
+ pkgrel = 1
url = https://wayland.freedesktop.org/
arch = x86_64
license = MIT
@@ -22,24 +22,20 @@ pkgbase = weston-eglstream
depends = egl-wayland
provides = weston
conflicts = weston
- source = https://wayland.freedesktop.org/releases/weston-7.0.0.tar.xz
+ source = https://wayland.freedesktop.org/releases/weston-8.0.0.tar.xz
source = 0001-gl-renderer-Add-EGLDevice-enumeration-support.patch
source = 0002-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch
source = 0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch
source = 0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch
source = 0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch
source = 0006-compositor-Process-stream-attach-requests-with-wl_eg.patch
- source = 0007-desktop-shell-Avoid-NULL-output-dereference-when-get.patch
- source = 0008-compositor-Do-not-trigger-invalid-destructors-when-h.patch
- sha256sums = a00a6d207b6a45f95f4401c604772a307c3767e5e2beecf3d879110c43909a64
- sha256sums = 052d1256d069b5ca23865cd12ba5122e79475780b6fb09bdaa1301a621b32c1f
- sha256sums = cf2fda06ab6f3a545f9302b4ced8435df2f03378f4b3f2e25f7c85222c54d38f
- sha256sums = 5bd7f6a11341efcffc596ad6808d2dc3c5b5e10e6cdecd3bfdc27eb23fe7ba0f
- sha256sums = 46d2975fa6c6397206c9b170639aa79a96b3bddde8957dbe234d2a8206f773aa
- sha256sums = 085c23f406366b236b6aa7f1d1158b65fead3adbd907a7c44b8e9407b6f90b9d
- sha256sums = c4db17e98afca6b099f5bbc6486430b768a1f71929c433ae403e68626f3e78d8
- sha256sums = 2b7025295ae077cf91d22dc32c255f15e36feb9a61bf686adaf4c6be87750469
- sha256sums = 3c12268e4bae6dfa264411c2a72be4ca7aca4055fe3956136b5a31dbca3e4136
+ sha256sums = 7518b49b2eaa1c3091f24671bdcc124fd49fc8f1af51161927afa4329c027848
+ sha256sums = 8d644af0432944ec0c8710f3d31ffdccb8a0661683247743df08915cf9670915
+ sha256sums = bbfc35859b4561ddaee39077c1b449c729ce6e691193a64090b44746bc46d587
+ sha256sums = 0e2616445c720fc23137feffc6148f891648e3ab8a52f6790cf484b0b39d7fe2
+ sha256sums = 557aa28b89b18c4fb28ea7ab56dd6f3580dbc44d6ae0a983b8b615eab5bf00b1
+ sha256sums = 36e9d9a317c32e61910465394977c8a35bf94afe97a11e56476ea7ff1e8d708a
+ sha256sums = dc64ac1cacac8dea668644a2a64aeaf3123983dcc61bf5b993bbd48dbc4f69ef
pkgname = weston-eglstream
diff --git a/0001-gl-renderer-Add-EGLDevice-enumeration-support.patch b/0001-gl-renderer-Add-EGLDevice-enumeration-support.patch
index e3b830e4be6..f365b5a7d8e 100644
--- a/0001-gl-renderer-Add-EGLDevice-enumeration-support.patch
+++ b/0001-gl-renderer-Add-EGLDevice-enumeration-support.patch
@@ -1,8 +1,7 @@
-From 78f72e9eb8e42b2791099c519cf8c47e89c4143f Mon Sep 17 00:00:00 2001
+From e1cb3214647b044f1ba39fa8b0eff02a26bb894a Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
Date: Mon, 2 May 2016 15:56:37 +0200
-Subject: [PATCH 1/8] gl-renderer: Add EGLDevice enumeration support
-X-NVConfidentiality: public
+Subject: [PATCH 1/6] gl-renderer: Add EGLDevice enumeration support
EGLDevice provides means to enumerate native devices.
@@ -17,15 +16,15 @@ Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: Adam Cheney <acheney@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
---
- libweston/renderer-gl/gl-renderer.c | 89 ++++++++++++++++++++++++++++-
+ libweston/renderer-gl/gl-renderer.c | 86 +++++++++++++++++++++++++++++
libweston/renderer-gl/gl-renderer.h | 8 +++
- 2 files changed, 96 insertions(+), 1 deletion(-)
+ 2 files changed, 94 insertions(+)
diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
-index 54f8b1cd..a6be2b7b 100644
+index 6c435507..4bf95e60 100644
--- a/libweston/renderer-gl/gl-renderer.c
+++ b/libweston/renderer-gl/gl-renderer.c
-@@ -4084,6 +4084,90 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
+@@ -3826,6 +3826,90 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
return 0;
}
@@ -114,20 +113,17 @@ index 54f8b1cd..a6be2b7b 100644
+}
+
WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
- .opaque_attribs = gl_renderer_opaque_attribs,
- .alpha_attribs = gl_renderer_alpha_attribs,
-@@ -4095,5 +4179,8 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
- .output_surface = gl_renderer_output_surface,
+ .display_create = gl_renderer_display_create,
+ .output_window_create = gl_renderer_output_window_create,
+@@ -3833,4 +3917,6 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
+ .output_destroy = gl_renderer_output_destroy,
.output_set_border = gl_renderer_output_set_border,
.create_fence_fd = gl_renderer_create_fence_fd,
-- .print_egl_error_state = gl_renderer_print_egl_error_state
-+ .print_egl_error_state = gl_renderer_print_egl_error_state,
-+
+ .get_devices = gl_renderer_get_devices,
+ .get_drm_device_file = gl_renderer_get_drm_device_file
};
diff --git a/libweston/renderer-gl/gl-renderer.h b/libweston/renderer-gl/gl-renderer.h
-index b1d6abbe..cd330932 100644
+index 2bca2d00..b60a6463 100644
--- a/libweston/renderer-gl/gl-renderer.h
+++ b/libweston/renderer-gl/gl-renderer.h
@@ -40,6 +40,7 @@
@@ -138,10 +134,10 @@ index b1d6abbe..cd330932 100644
typedef void *EGLDisplay;
typedef void *EGLSurface;
typedef void *EGLConfig;
-@@ -123,5 +124,12 @@ struct gl_renderer_interface {
+@@ -202,4 +203,11 @@ struct gl_renderer_interface {
+ * EGL_ANDROID_native_fence_sync extension.
+ */
int (*create_fence_fd)(struct weston_output *output);
-
- void (*print_egl_error_state)(void);
+
+ int (*get_devices)(EGLint max_devices,
+ EGLDeviceEXT *devices,
@@ -150,7 +146,6 @@ index b1d6abbe..cd330932 100644
+ int (*get_drm_device_file)(EGLDeviceEXT device,
+ const char **drm_device_file);
};
-
--
-2.21.0
+2.20.1
diff --git a/0002-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch b/0002-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch
index 6e5d2734e8a..2449df0669f 100644
--- a/0002-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch
+++ b/0002-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch
@@ -1,9 +1,8 @@
-From 418000cc187e0ae6c9ab076f0e743cae669e053d Mon Sep 17 00:00:00 2001
+From 0bc696502b2cf1266e30dfc35146d85282eaa629 Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
Date: Mon, 2 May 2016 16:34:01 +0200
-Subject: [PATCH 2/8] gl-renderer: Add support for EGLDevice composited frame
+Subject: [PATCH 2/6] gl-renderer: Add support for EGLDevice composited frame
presentation
-X-NVConfidentiality: public
EGLDevice provides means to enumerate native devices, and then create
an EGL display connection from them.
@@ -42,25 +41,73 @@ Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: Adam Cheney <acheney@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
---
- libweston/renderer-gl/gl-renderer.c | 262 +++++++++++++++++++++++++++-
- libweston/renderer-gl/gl-renderer.h | 16 ++
- shared/weston-egl-ext.h | 40 +++++
- 3 files changed, 315 insertions(+), 3 deletions(-)
+ libweston/renderer-gl/egl-glue.c | 37 ++++
+ libweston/renderer-gl/gl-renderer-internal.h | 22 ++
+ libweston/renderer-gl/gl-renderer.c | 199 ++++++++++++++++++-
+ libweston/renderer-gl/gl-renderer.h | 15 ++
+ shared/weston-egl-ext.h | 40 ++++
+ 5 files changed, 308 insertions(+), 5 deletions(-)
-diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
-index a6be2b7b..215ed9b3 100644
---- a/libweston/renderer-gl/gl-renderer.c
-+++ b/libweston/renderer-gl/gl-renderer.c
-@@ -101,6 +101,8 @@ struct gl_output_state {
- struct gl_border_image borders[4];
- enum gl_border_status border_status;
+diff --git a/libweston/renderer-gl/egl-glue.c b/libweston/renderer-gl/egl-glue.c
+index d96efeae..24d647b8 100644
+--- a/libweston/renderer-gl/egl-glue.c
++++ b/libweston/renderer-gl/egl-glue.c
+@@ -504,6 +504,19 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
+ (void *) eglGetProcAddress("eglQueryWaylandBufferWL");
+ gr->set_damage_region =
+ (void *) eglGetProcAddress("eglSetDamageRegionKHR");
++ gr->get_output_layers = (void *) eglGetProcAddress("eglGetOutputLayersEXT");
++ gr->query_output_layer_attrib =
++ (void *) eglGetProcAddress("eglQueryOutputLayerAttribEXT");
++ gr->create_stream = (void *) eglGetProcAddress("eglCreateStreamKHR");
++ gr->destroy_stream = (void *) eglGetProcAddress("eglDestroyStreamKHR");
++ gr->create_stream_producer_surface =
++ (void *) eglGetProcAddress("eglCreateStreamProducerSurfaceKHR");
++ gr->stream_consumer_output =
++ (void *) eglGetProcAddress("eglStreamConsumerOutputEXT");
++#ifdef EGL_NV_stream_attrib
++ gr->stream_consumer_acquire_attrib =
++ (void *) eglGetProcAddress("eglStreamConsumerAcquireAttribNV");
++#endif
-+ EGLStreamKHR egl_stream;
+ extensions =
+ (const char *) eglQueryString(gr->egl_display, EGL_EXTENSIONS);
+@@ -593,6 +606,30 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
+ "to missing EGL_KHR_wait_sync extension\n");
+ }
+
++ if (weston_check_egl_extension(extensions, "EGL_EXT_output_base"))
++ gr->has_egl_output_base = true;
+
- struct weston_matrix output_matrix;
++ if (weston_check_egl_extension(extensions, "EGL_EXT_output_drm"))
++ gr->has_egl_output_drm = true;
++
++ if (weston_check_egl_extension(extensions, "EGL_NV_output_drm_flip_event"))
++ gr->has_egl_output_drm_flip_event = true;
++
++ if (weston_check_egl_extension(extensions, "EGL_KHR_stream"))
++ gr->has_egl_stream = true;
++
++ if (weston_check_egl_extension(extensions, "EGL_KHR_stream_producer_eglsurface"))
++ gr->has_egl_stream_producer_eglsurface = true;
++
++ if (weston_check_egl_extension(extensions, "EGL_EXT_stream_consumer_egloutput"))
++ gr->has_egl_stream_consumer_egloutput = true;
++
++ if (weston_check_egl_extension(extensions, "EGL_NV_stream_attrib"))
++ gr->has_egl_stream_attrib = true;
++
++ if (weston_check_egl_extension(extensions, "EGL_EXT_stream_acquire_mode"))
++ gr->has_egl_stream_acquire_mode = true;
++
+ renderer_setup_egl_client_extensions(gr);
- EGLSyncKHR begin_render_sync, end_render_sync;
-@@ -243,6 +245,28 @@ struct gl_renderer {
+ return 0;
+diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h
+index 00f617a9..b7c374a2 100644
+--- a/libweston/renderer-gl/gl-renderer-internal.h
++++ b/libweston/renderer-gl/gl-renderer-internal.h
+@@ -87,6 +87,28 @@ struct gl_renderer {
bool has_dmabuf_import;
struct wl_list dmabuf_images;
@@ -89,7 +136,20 @@ index a6be2b7b..215ed9b3 100644
bool has_gl_texture_rg;
struct gl_shader texture_shader_rgba;
-@@ -1592,6 +1616,38 @@ gl_renderer_repaint_output(struct weston_output *output,
+diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
+index 4bf95e60..fe4f1087 100644
+--- a/libweston/renderer-gl/gl-renderer.c
++++ b/libweston/renderer-gl/gl-renderer.c
+@@ -91,6 +91,8 @@ struct gl_output_state {
+ struct gl_border_image borders[4];
+ enum gl_border_status border_status;
+
++ EGLStreamKHR egl_stream;
++
+ struct weston_matrix output_matrix;
+
+ EGLSyncKHR begin_render_sync, end_render_sync;
+@@ -1514,6 +1516,38 @@ gl_renderer_repaint_output(struct weston_output *output,
update_buffer_release_fences(compositor, output);
}
@@ -128,7 +188,7 @@ index a6be2b7b..215ed9b3 100644
static int
gl_renderer_read_pixels(struct weston_output *output,
pixman_format_code_t format, void *pixels,
-@@ -3284,9 +3340,93 @@ gl_renderer_create_window_surface(struct gl_renderer *gr,
+@@ -3142,9 +3176,93 @@ gl_renderer_create_window_surface(struct gl_renderer *gr,
return egl_surface;
}
@@ -223,7 +283,7 @@ index a6be2b7b..215ed9b3 100644
{
struct gl_output_state *go;
int i;
-@@ -3296,6 +3436,7 @@ gl_renderer_output_create(struct weston_output *output,
+@@ -3154,6 +3272,7 @@ gl_renderer_output_create(struct weston_output *output,
return -1;
go->egl_surface = surface;
@@ -231,7 +291,7 @@ index a6be2b7b..215ed9b3 100644
for (i = 0; i < BUFFER_DAMAGE_COUNT; i++)
pixman_region32_init(&go->buffer_damage[i]);
-@@ -3333,13 +3474,41 @@ gl_renderer_output_window_create(struct weston_output *output,
+@@ -3190,7 +3309,7 @@ gl_renderer_output_window_create(struct weston_output *output,
return -1;
}
@@ -240,6 +300,15 @@ index a6be2b7b..215ed9b3 100644
if (ret < 0)
weston_platform_destroy_egl_surface(gr->egl_display, egl_surface);
+@@ -3232,13 +3351,41 @@ gl_renderer_output_pbuffer_create(struct weston_output *output,
+ return -1;
+ }
+
+- ret = gl_renderer_output_create(output, egl_surface);
++ ret = gl_renderer_output_create(output, egl_surface, EGL_NO_STREAM_KHR);
+ if (ret < 0)
+ eglDestroySurface(gr->egl_display, egl_surface);
+
return ret;
}
@@ -274,7 +343,7 @@ index a6be2b7b..215ed9b3 100644
static void
gl_renderer_output_destroy(struct weston_output *output)
{
-@@ -3369,6 +3538,9 @@ gl_renderer_output_destroy(struct weston_output *output)
+@@ -3268,6 +3415,9 @@ gl_renderer_output_destroy(struct weston_output *output)
if (go->end_render_sync != EGL_NO_SYNC_KHR)
gr->destroy_sync(gr->egl_display, go->end_render_sync);
@@ -284,83 +353,26 @@ index a6be2b7b..215ed9b3 100644
free(go);
}
-@@ -3484,6 +3656,19 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
- (void *) eglGetProcAddress("eglQueryWaylandBufferWL");
- gr->set_damage_region =
- (void *) eglGetProcAddress("eglSetDamageRegionKHR");
-+ gr->get_output_layers = (void *) eglGetProcAddress("eglGetOutputLayersEXT");
-+ gr->query_output_layer_attrib =
-+ (void *) eglGetProcAddress("eglQueryOutputLayerAttribEXT");
-+ gr->create_stream = (void *) eglGetProcAddress("eglCreateStreamKHR");
-+ gr->destroy_stream = (void *) eglGetProcAddress("eglDestroyStreamKHR");
-+ gr->create_stream_producer_surface =
-+ (void *) eglGetProcAddress("eglCreateStreamProducerSurfaceKHR");
-+ gr->stream_consumer_output =
-+ (void *) eglGetProcAddress("eglStreamConsumerOutputEXT");
-+#ifdef EGL_NV_stream_attrib
-+ gr->stream_consumer_acquire_attrib =
-+ (void *) eglGetProcAddress("eglStreamConsumerAcquireAttribNV");
-+#endif
-
- extensions =
- (const char *) eglQueryString(gr->egl_display, EGL_EXTENSIONS);
-@@ -3561,6 +3746,30 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
- "to missing EGL_KHR_wait_sync extension\n");
- }
-
-+ if (weston_check_egl_extension(extensions, "EGL_EXT_output_base"))
-+ gr->has_egl_output_base = true;
-+
-+ if (weston_check_egl_extension(extensions, "EGL_EXT_output_drm"))
-+ gr->has_egl_output_drm = true;
-+
-+ if (weston_check_egl_extension(extensions, "EGL_NV_output_drm_flip_event"))
-+ gr->has_egl_output_drm_flip_event = true;
-+
-+ if (weston_check_egl_extension(extensions, "EGL_KHR_stream"))
-+ gr->has_egl_stream = true;
-+
-+ if (weston_check_egl_extension(extensions, "EGL_KHR_stream_producer_eglsurface"))
-+ gr->has_egl_stream_producer_eglsurface = true;
-+
-+ if (weston_check_egl_extension(extensions, "EGL_EXT_stream_consumer_egloutput"))
-+ gr->has_egl_stream_consumer_egloutput = true;
-+
-+ if (weston_check_egl_extension(extensions, "EGL_NV_stream_attrib"))
-+ gr->has_egl_stream_attrib = true;
-+
-+ if (weston_check_egl_extension(extensions, "EGL_EXT_stream_acquire_mode"))
-+ gr->has_egl_stream_acquire_mode = true;
-+
- renderer_setup_egl_client_extensions(gr);
-
- return 0;
-@@ -3586,6 +3795,15 @@ static const EGLint gl_renderer_alpha_attribs[] = {
- EGL_NONE
- };
-
-+static const EGLint gl_renderer_opaque_stream_attribs[] = {
-+ EGL_SURFACE_TYPE, EGL_STREAM_BIT_KHR,
-+ EGL_RED_SIZE, 1,
-+ EGL_GREEN_SIZE, 1,
-+ EGL_BLUE_SIZE, 1,
-+ EGL_ALPHA_SIZE, 0,
-+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
-+ EGL_NONE
-+};
-
- /** Checks whether a platform EGL client extension is supported
- *
-@@ -3659,6 +3877,8 @@ platform_to_extension(EGLenum platform)
- return "wayland";
- case EGL_PLATFORM_X11_KHR:
+@@ -3402,6 +3552,8 @@ platform_to_extension(EGLenum platform)
return "x11";
+ case EGL_PLATFORM_SURFACELESS_MESA:
+ return "surfaceless";
+ case EGL_PLATFORM_DEVICE_EXT:
+ return "device";
default:
assert(0 && "bad EGL platform enum");
}
-@@ -3800,6 +4020,38 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
+@@ -3530,7 +3682,8 @@ gl_renderer_display_create(struct weston_compositor *ec,
+ if (gl_renderer_setup_egl_extensions(ec) < 0)
+ goto fail_with_error;
+
+- if (!gr->has_configless_context) {
++ if (!gr->has_configless_context ||
++ platform == EGL_PLATFORM_DEVICE_EXT) {
+ if (!gr->has_surfaceless_context)
+ egl_surface_type |= EGL_PBUFFER_BIT;
+
+@@ -3550,6 +3703,38 @@ gl_renderer_display_create(struct weston_compositor *ec,
if (gr->has_native_fence_sync && gr->has_wait_sync)
ec->capabilities |= WESTON_CAP_EXPLICIT_SYNC;
@@ -399,22 +411,15 @@ index a6be2b7b..215ed9b3 100644
wl_list_init(&gr->dmabuf_images);
if (gr->has_dmabuf_import) {
gr->base.import_dmabuf = gl_renderer_import_dmabuf;
-@@ -4171,10 +4423,12 @@ gl_renderer_get_drm_device_file(EGLDeviceEXT device,
- WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
- .opaque_attribs = gl_renderer_opaque_attribs,
- .alpha_attribs = gl_renderer_alpha_attribs,
-+ .opaque_stream_attribs = gl_renderer_opaque_stream_attribs,
-
+@@ -3914,9 +4099,13 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
.display_create = gl_renderer_display_create,
- .display = gl_renderer_display,
.output_window_create = gl_renderer_output_window_create,
+ .output_pbuffer_create = gl_renderer_output_pbuffer_create,
+ .output_stream_create = gl_renderer_output_stream_create,
.output_destroy = gl_renderer_output_destroy,
- .output_surface = gl_renderer_output_surface,
.output_set_border = gl_renderer_output_set_border,
-@@ -4182,5 +4436,7 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
- .print_egl_error_state = gl_renderer_print_egl_error_state,
-
+ .create_fence_fd = gl_renderer_create_fence_fd,
++
.get_devices = gl_renderer_get_devices,
- .get_drm_device_file = gl_renderer_get_drm_device_file
+ .get_drm_device_file = gl_renderer_get_drm_device_file,
@@ -422,28 +427,20 @@ index a6be2b7b..215ed9b3 100644
+ .output_stream_flip = gl_renderer_output_stream_flip
};
diff --git a/libweston/renderer-gl/gl-renderer.h b/libweston/renderer-gl/gl-renderer.h
-index cd330932..c5c3e12b 100644
+index b60a6463..ecf7368d 100644
--- a/libweston/renderer-gl/gl-renderer.h
+++ b/libweston/renderer-gl/gl-renderer.h
-@@ -62,6 +62,7 @@ enum gl_renderer_border_side {
- struct gl_renderer_interface {
- const EGLint *opaque_attribs;
- const EGLint *alpha_attribs;
-+ const EGLint *opaque_stream_attribs;
-
- int (*display_create)(struct weston_compositor *ec,
- EGLenum platform,
-@@ -80,6 +81,9 @@ struct gl_renderer_interface {
- const EGLint *visual_id,
- const int n_ids);
+@@ -163,6 +163,9 @@ struct gl_renderer_interface {
+ const uint32_t *drm_formats,
+ unsigned drm_formats_count);
+ int (*output_stream_create)(struct weston_output *output,
+ uint32_t plane_id, uint32_t crtc_id);
+
void (*output_destroy)(struct weston_output *output);
- EGLSurface (*output_surface)(struct weston_output *output);
-@@ -131,5 +135,17 @@ struct gl_renderer_interface {
+ /* Sets the output border.
+@@ -210,4 +213,16 @@ struct gl_renderer_interface {
int (*get_drm_device_file)(EGLDeviceEXT device,
const char **drm_device_file);
@@ -460,12 +457,11 @@ index cd330932..c5c3e12b 100644
+ int (*output_stream_flip)(struct weston_output *output,
+ void *flip_data);
};
-
diff --git a/shared/weston-egl-ext.h b/shared/weston-egl-ext.h
-index 0784ea2d..f39990ed 100644
+index 4a757c8b..dc07c04a 100644
--- a/shared/weston-egl-ext.h
+++ b/shared/weston-egl-ext.h
-@@ -204,12 +204,52 @@ typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy,
+@@ -208,6 +208,45 @@ typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy,
#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
#endif
@@ -511,13 +507,14 @@ index 0784ea2d..f39990ed 100644
#else /* ENABLE_EGL */
/* EGL platform definition are keept to allow compositor-xx.c to build */
- #define EGL_PLATFORM_GBM_KHR 0x31D7
+@@ -215,6 +254,7 @@ typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy,
#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
#define EGL_PLATFORM_X11_KHR 0x31D5
+ #define EGL_PLATFORM_SURFACELESS_MESA 0x31DD
+#define EGL_PLATFORM_DEVICE_EXT 0x313F
#endif /* ENABLE_EGL */
--
-2.21.0
+2.20.1
diff --git a/0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch b/0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch
index 6ce956b25d7..7d70902ca7c 100644
--- a/0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch
+++ b/0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch
@@ -1,9 +1,8 @@
-From ef918a27b0134d44d680c2cd034a1b50a87edc3e Mon Sep 17 00:00:00 2001
+From ac135245b43c99dfbad084b52393da9d5ba76f2a Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
Date: Thu, 29 Mar 2018 00:15:49 -0700
-Subject: [PATCH 3/8] gl-renderer: Add EGL client support for EGLStream frame
+Subject: [PATCH 3/6] gl-renderer: Add EGL client support for EGLStream frame
presentation
-X-NVConfidentiality: public
By attaching a GLTexture consumer to a stream, a producer (wayland EGL
client) could feed frames to a texture, which in turn can be used by a
@@ -28,25 +27,54 @@ Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Adam Cheney <acheney@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
---
- libweston/renderer-gl/gl-renderer.c | 184 ++++++++++++++++++++++++++++
- shared/weston-egl-ext.h | 5 +
- 2 files changed, 189 insertions(+)
+ libweston/renderer-gl/egl-glue.c | 11 ++
+ libweston/renderer-gl/gl-renderer-internal.h | 6 +
+ libweston/renderer-gl/gl-renderer.c | 167 +++++++++++++++++++
+ shared/weston-egl-ext.h | 5 +
+ 4 files changed, 189 insertions(+)
-diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
-index 215ed9b3..22a64f81 100644
---- a/libweston/renderer-gl/gl-renderer.c
-+++ b/libweston/renderer-gl/gl-renderer.c
-@@ -189,6 +189,9 @@ struct gl_surface_state {
- int hsub[3]; /* horizontal subsampling per plane */
- int vsub[3]; /* vertical subsampling per plane */
+diff --git a/libweston/renderer-gl/egl-glue.c b/libweston/renderer-gl/egl-glue.c
+index 24d647b8..90575d29 100644
+--- a/libweston/renderer-gl/egl-glue.c
++++ b/libweston/renderer-gl/egl-glue.c
+@@ -509,14 +509,19 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
+ (void *) eglGetProcAddress("eglQueryOutputLayerAttribEXT");
+ gr->create_stream = (void *) eglGetProcAddress("eglCreateStreamKHR");
+ gr->destroy_stream = (void *) eglGetProcAddress("eglDestroyStreamKHR");
++ gr->query_stream = (void *) eglGetProcAddress("eglQueryStreamKHR");
+ gr->create_stream_producer_surface =
+ (void *) eglGetProcAddress("eglCreateStreamProducerSurfaceKHR");
+ gr->stream_consumer_output =
+ (void *) eglGetProcAddress("eglStreamConsumerOutputEXT");
+ #ifdef EGL_NV_stream_attrib
++ gr->create_stream_attrib =
++ (void *) eglGetProcAddress("eglCreateStreamAttribNV");
+ gr->stream_consumer_acquire_attrib =
+ (void *) eglGetProcAddress("eglStreamConsumerAcquireAttribNV");
+ #endif
++ gr->stream_consumer_gltexture =
++ (void *) eglGetProcAddress("eglStreamConsumerGLTextureExternalKHR");
-+ EGLStreamKHR egl_stream;
-+ bool new_stream;
+ extensions =
+ (const char *) eglQueryString(gr->egl_display, EGL_EXTENSIONS);
+@@ -630,6 +635,12 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
+ if (weston_check_egl_extension(extensions, "EGL_EXT_stream_acquire_mode"))
+ gr->has_egl_stream_acquire_mode = true;
+
++ if (weston_check_egl_extension(extensions, "EGL_KHR_stream_consumer_gltexture"))
++ gr->has_egl_stream_consumer_gltexture = true;
+
- struct weston_surface *surface;
++ if (weston_check_egl_extension(extensions, "EGL_WL_wayland_eglstream"))
++ gr->has_egl_wayland_eglstream = true;
++
+ renderer_setup_egl_client_extensions(gr);
- /* Whether this surface was used in the current output repaint.
-@@ -253,6 +256,7 @@ struct gl_renderer {
+ return 0;
+diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h
+index b7c374a2..0827500e 100644
+--- a/libweston/renderer-gl/gl-renderer-internal.h
++++ b/libweston/renderer-gl/gl-renderer-internal.h
+@@ -95,6 +95,7 @@ struct gl_renderer {
PFNEGLCREATESTREAMKHRPROC create_stream;
PFNEGLDESTROYSTREAMKHRPROC destroy_stream;
@@ -54,7 +82,7 @@ index 215ed9b3..22a64f81 100644
bool has_egl_stream;
PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC create_stream_producer_surface;
-@@ -262,11 +266,16 @@ struct gl_renderer {
+@@ -104,11 +105,16 @@ struct gl_renderer {
bool has_egl_stream_consumer_egloutput;
#ifdef EGL_NV_stream_attrib
@@ -71,8 +99,22 @@ index 215ed9b3..22a64f81 100644
bool has_gl_texture_rg;
struct gl_shader texture_shader_rgba;
-@@ -2617,6 +2626,145 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
- surface->is_opaque = dmabuf_is_opaque(dmabuf);
+diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
+index fe4f1087..1b6a219b 100644
+--- a/libweston/renderer-gl/gl-renderer.c
++++ b/libweston/renderer-gl/gl-renderer.c
+@@ -187,6 +187,9 @@ struct gl_surface_state {
+ int hsub[3]; /* horizontal subsampling per plane */
+ int vsub[3]; /* vertical subsampling per plane */
+
++ EGLStreamKHR egl_stream;
++ bool new_stream;
++
+ struct weston_surface *surface;
+
+ /* Whether this surface was used in the current output repaint.
+@@ -2544,6 +2547,145 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
+ gs->shader = image->shader;
}
+/*
@@ -217,9 +259,9 @@ index 215ed9b3..22a64f81 100644
static void
gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
{
-@@ -2643,6 +2791,12 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
- gs->buffer_type = BUFFER_TYPE_NULL;
+@@ -2571,6 +2713,12 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
gs->y_inverted = true;
+ gs->direct_display = false;
es->is_opaque = false;
+
+ if (gs->egl_stream != EGL_NO_STREAM_KHR) {
@@ -230,17 +272,17 @@ index 215ed9b3..22a64f81 100644
return;
}
-@@ -2650,6 +2804,9 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
+@@ -2578,6 +2726,9 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
if (shm_buffer)
gl_renderer_attach_shm(es, buffer, shm_buffer);
+ else if (gl_renderer_attach_stream_texture(es, buffer))
-+ /* The stream texture is attached. Nothing else to be done here */
-+ ((void)0);
++ /* The stream texture is attached. Nothing else to be done here */
++ ((void)0);
else if (gr->has_bind_display &&
gr->query_buffer(gr->egl_display, (void *)buffer->resource,
EGL_TEXTURE_FORMAT, &format))
-@@ -2853,6 +3010,10 @@ surface_state_destroy(struct gl_surface_state *gs, struct gl_renderer *gr)
+@@ -2781,6 +2932,10 @@ surface_state_destroy(struct gl_surface_state *gs, struct gl_renderer *gr)
weston_buffer_reference(&gs->buffer_ref, NULL);
weston_buffer_release_reference(&gs->buffer_release_ref, NULL);
pixman_region32_fini(&gs->texture_damage);
@@ -251,7 +293,7 @@ index 215ed9b3..22a64f81 100644
free(gs);
}
-@@ -2903,6 +3064,8 @@ gl_renderer_create_surface(struct weston_surface *surface)
+@@ -2832,6 +2987,8 @@ gl_renderer_create_surface(struct weston_surface *surface)
gs->surface = surface;
@@ -260,40 +302,7 @@ index 215ed9b3..22a64f81 100644
pixman_region32_init(&gs->texture_damage);
surface->renderer_state = gs;
-@@ -3661,14 +3824,19 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
- (void *) eglGetProcAddress("eglQueryOutputLayerAttribEXT");
- gr->create_stream = (void *) eglGetProcAddress("eglCreateStreamKHR");
- gr->destroy_stream = (void *) eglGetProcAddress("eglDestroyStreamKHR");
-+ gr->query_stream = (void *) eglGetProcAddress("eglQueryStreamKHR");
- gr->create_stream_producer_surface =
- (void *) eglGetProcAddress("eglCreateStreamProducerSurfaceKHR");
- gr->stream_consumer_output =
- (void *) eglGetProcAddress("eglStreamConsumerOutputEXT");
- #ifdef EGL_NV_stream_attrib
-+ gr->create_stream_attrib =
-+ (void *) eglGetProcAddress("eglCreateStreamAttribNV");
- gr->stream_consumer_acquire_attrib =
- (void *) eglGetProcAddress("eglStreamConsumerAcquireAttribNV");
- #endif
-+ gr->stream_consumer_gltexture =
-+ (void *) eglGetProcAddress("eglStreamConsumerGLTextureExternalKHR");
-
- extensions =
- (const char *) eglQueryString(gr->egl_display, EGL_EXTENSIONS);
-@@ -3770,6 +3938,12 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
- if (weston_check_egl_extension(extensions, "EGL_EXT_stream_acquire_mode"))
- gr->has_egl_stream_acquire_mode = true;
-
-+ if (weston_check_egl_extension(extensions, "EGL_KHR_stream_consumer_gltexture"))
-+ gr->has_egl_stream_consumer_gltexture = true;
-+
-+ if (weston_check_egl_extension(extensions, "EGL_WL_wayland_eglstream"))
-+ gr->has_egl_wayland_eglstream = true;
-+
- renderer_setup_egl_client_extensions(gr);
-
- return 0;
-@@ -4047,6 +4221,16 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
+@@ -3730,6 +3887,16 @@ gl_renderer_display_create(struct weston_compositor *ec,
goto fail_terminate;
}
@@ -311,10 +320,10 @@ index 215ed9b3..22a64f81 100644
weston_log("warning: EGL page flip event notification "
"not supported\n");
diff --git a/shared/weston-egl-ext.h b/shared/weston-egl-ext.h
-index f39990ed..96982e2d 100644
+index dc07c04a..d348a5c0 100644
--- a/shared/weston-egl-ext.h
+++ b/shared/weston-egl-ext.h
-@@ -243,6 +243,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribEXT (EGLDisplay dpy,
+@@ -247,6 +247,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribEXT (EGLDisplay dpy,
#define EGL_DRM_FLIP_EVENT_DATA_NV 0x333E
#endif /* EGL_NV_output_drm_flip_event */
@@ -327,5 +336,5 @@ index f39990ed..96982e2d 100644
/* EGL platform definition are keept to allow compositor-xx.c to build */
--
-2.21.0
+2.20.1
diff --git a/0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch b/0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch
index 118f9498d4f..e2089e965e1 100644
--- a/0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch
+++ b/0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch
@@ -1,9 +1,8 @@
-From f664250b469b329189aef308ce9a65e06a851242 Mon Sep 17 00:00:00 2001
+From 0ed7d25672cf8a2e16f84e336568970e069e0930 Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
Date: Tue, 1 Mar 2016 22:19:14 +0100
-Subject: [PATCH 4/8] backend-drm: Gracefully handle vblank and flip invalid
+Subject: [PATCH 4/6] backend-drm: Gracefully handle vblank and flip invalid
timestamps
-X-NVConfidentiality: public
Instant query for vblank timestamp may always fail, resulting in
never scheduling a full repaint in drm_output_start_repaint_loop().
@@ -22,7 +21,7 @@ Reviewed-by: Andy Ritger <aritger@nvidia.com>
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
-index 041a15a5..e631ffb9 100644
+index e0b1cbd7..bbce70e5 100644
--- a/libweston/backend-drm/drm.c
+++ b/libweston/backend-drm/drm.c
@@ -4,6 +4,7 @@
@@ -33,7 +32,7 @@ index 041a15a5..e631ffb9 100644
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
-@@ -268,6 +269,19 @@ drm_output_update_complete(struct drm_output *output, uint32_t flags,
+@@ -318,6 +319,19 @@ drm_output_update_complete(struct drm_output *output, uint32_t flags,
ts.tv_sec = sec;
ts.tv_nsec = usec * 1000;
@@ -53,7 +52,7 @@ index 041a15a5..e631ffb9 100644
weston_output_finish_frame(&output->base, &ts, flags);
/* We can't call this from frame_notify, because the output's
-@@ -501,8 +515,16 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
+@@ -525,8 +539,16 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
vbl.request.type |= drm_waitvblank_pipe(output);
ret = drmWaitVBlank(backend->drm.fd, &vbl);
@@ -72,7 +71,7 @@ index 041a15a5..e631ffb9 100644
ts.tv_sec = vbl.reply.tval_sec;
ts.tv_nsec = vbl.reply.tval_usec * 1000;
-@@ -523,7 +545,7 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
+@@ -547,7 +569,7 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
}
}
@@ -82,5 +81,5 @@ index 041a15a5..e631ffb9 100644
*/
--
-2.21.0
+2.20.1
diff --git a/0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch b/0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch
index 3e09d739c4d..ba947b7ee70 100644
--- a/0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch
+++ b/0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch
@@ -1,8 +1,7 @@
-From 3a9b0e9def60f81b6f550df29a0dbe26fc07aa05 Mon Sep 17 00:00:00 2001
+From e9ad91ffa3a22fe63455461f62d808e455c2f36d Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
Date: Mon, 26 Aug 2019 09:48:49 -0700
-Subject: [PATCH 5/8] backend-drm: Add support for EGLDevice+EGLOutput
-X-NVConfidentiality: public
+Subject: [PATCH 5/6] backend-drm: Add support for EGLDevice+EGLOutput
As previously stated, EGLDevice and EGLOutput will provide means
to access native device objects and different portions of display
@@ -25,20 +24,25 @@ Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: Adam Cheney <acheney@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
---
- compositor/main.c | 2 +
- include/libweston/backend-drm.h | 4 +
- libweston/backend-drm/drm-internal.h | 14 ++
- libweston/backend-drm/drm.c | 328 ++++++++++++++++++---------
- libweston/backend-drm/kms.c | 17 +-
- libweston/renderer-gl/gl-renderer.h | 1 +
- shared/weston-egl-ext.h | 9 +
- 7 files changed, 263 insertions(+), 112 deletions(-)
+ compositor/main.c | 2 +
+ include/libweston/backend-drm.h | 4 +
+ libweston/backend-drm/drm-gbm.c | 308 +++++++++++++++++---------
+ libweston/backend-drm/drm-internal.h | 14 ++
+ libweston/backend-drm/drm.c | 16 +-
+ libweston/backend-drm/kms.c | 23 +-
+ libweston/backend-headless/headless.c | 1 +
+ libweston/backend-wayland/wayland.c | 1 +
+ libweston/backend-x11/x11.c | 1 +
+ libweston/renderer-gl/gl-renderer.c | 3 +-
+ libweston/renderer-gl/gl-renderer.h | 2 +
+ shared/weston-egl-ext.h | 9 +
+ 12 files changed, 278 insertions(+), 106 deletions(-)
diff --git a/compositor/main.c b/compositor/main.c
-index 13ca00f3..bb6bd84b 100644
+index 8eb8a470..ae0c32d1 100644
--- a/compositor/main.c
+++ b/compositor/main.c
-@@ -660,6 +660,7 @@ usage(int error_code)
+@@ -670,6 +670,7 @@ usage(int error_code)
" --tty=TTY\t\tThe tty to use\n"
" --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n"
" --use-pixman\t\tUse the pixman (CPU) renderer\n"
@@ -46,10 +50,10 @@ index 13ca00f3..bb6bd84b 100644
" --current-mode\tPrefer current KMS mode over EDID preferred mode\n\n");
#endif
-@@ -2483,6 +2484,7 @@ load_drm_backend(struct weston_compositor *c,
+@@ -2494,6 +2495,7 @@ load_drm_backend(struct weston_compositor *c,
{ WESTON_OPTION_STRING, "drm-device", 0, &config.specific_device },
- { WESTON_OPTION_BOOLEAN, "current-mode", 0, &drm_use_current_mode },
- { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &use_pixman_ },
+ { WESTON_OPTION_BOOLEAN, "current-mode", 0, &wet->drm_use_current_mode },
+ { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
+ { WESTON_OPTION_BOOLEAN, "use-egldevice", 0, &config.use_egldevice },
};
@@ -69,114 +73,11 @@ index f6647e28..b2ccce55 100644
/** The seat to be used for input and output.
*
* If seat_id is NULL, the seat is taken from XDG_SEAT environment
-diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h
-index 6f5a9880..99767442 100644
---- a/libweston/backend-drm/drm-internal.h
-+++ b/libweston/backend-drm/drm-internal.h
-@@ -58,6 +58,17 @@
- #include "backend.h"
- #include "libweston-internal.h"
-
-+#ifdef ENABLE_EGL
-+
-+#include <EGL/egl.h>
-+#include <EGL/eglext.h>
-+
-+#else
-+
-+typedef void *EGLDeviceEXT;
-+
-+#endif
-+
- #ifndef DRM_CLIENT_CAP_ASPECT_RATIO
- #define DRM_CLIENT_CAP_ASPECT_RATIO 4
- #endif
-@@ -225,6 +236,9 @@ struct drm_backend {
- struct wl_listener session_listener;
- uint32_t gbm_format;
-
-+ EGLDeviceEXT egldevice;
-+ bool use_egldevice;
-+
- /* we need these parameters in order to not fail drmModeAddFB2()
- * due to out of bounds dimensions, and then mistakenly set
- * sprites_are_broken:
-diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
-index e631ffb9..b975c444 100644
---- a/libweston/backend-drm/drm.c
-+++ b/libweston/backend-drm/drm.c
-@@ -69,7 +69,7 @@
- #include "linux-dmabuf-unstable-v1-server-protocol.h"
- #include "linux-explicit-synchronization.h"
-
--static struct gl_renderer_interface *gl_renderer;
-+struct gl_renderer_interface *gl_renderer;
-
- static const char default_seat[] = "seat0";
-
-@@ -302,21 +302,25 @@ drm_output_render_gl(struct drm_output_state *state, pixman_region32_t *damage)
- output->base.compositor->renderer->repaint_output(&output->base,
- damage);
-
-- bo = gbm_surface_lock_front_buffer(output->gbm_surface);
-- if (!bo) {
-- weston_log("failed to lock front buffer: %s\n",
-- strerror(errno));
-- return NULL;
-- }
-+ if (b->use_egldevice)
-+ ret = drm_fb_ref(output->dumb[0]);
-+ else {
-+ bo = gbm_surface_lock_front_buffer(output->gbm_surface);
-+ if (!bo) {
-+ weston_log("failed to lock front buffer: %s\n",
-+ strerror(errno));
-+ return NULL;
-+ }
-
-- /* The renderer always produces an opaque image. */
-- ret = drm_fb_get_from_bo(bo, b, true, BUFFER_GBM_SURFACE);
-- if (!ret) {
-- weston_log("failed to get drm_fb for bo\n");
-- gbm_surface_release_buffer(output->gbm_surface, bo);
-- return NULL;
-+ /* The renderer always produces an opaque image. */
-+ ret = drm_fb_get_from_bo(bo, b, true, BUFFER_GBM_SURFACE);
-+ if (!ret) {
-+ weston_log("failed to get drm_fb for bo\n");
-+ gbm_surface_release_buffer(output->gbm_surface, bo);
-+ return NULL;
-+ }
-+ ret->gbm_surface = output->gbm_surface;
- }
-- ret->gbm_surface = output->gbm_surface;
-
- return ret;
- }
-@@ -359,7 +363,9 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage)
- if (scanout_state->fb)
- return;
-
-- if (!pixman_region32_not_empty(damage) &&
-+ /* XXX: Assume full damage when using streams */
-+ if (!b->use_egldevice &&
-+ !pixman_region32_not_empty(damage) &&
- scanout_plane->state_cur->fb &&
- (scanout_plane->state_cur->fb->type == BUFFER_GBM_SURFACE ||
- scanout_plane->state_cur->fb->type == BUFFER_PIXMAN_DUMB) &&
-@@ -707,11 +713,6 @@ create_gbm_device(int fd)
- {
- struct gbm_device *gbm;
-
-- gl_renderer = weston_load_module("gl-renderer.so",
-- "gl_renderer_interface");
-- if (!gl_renderer)
-- return NULL;
--
- /* GBM will load a dri driver, but even though they need symbols from
- * libglapi, in some version of Mesa they are not linked to it. Since
- * only the gl-renderer module links to it, the call above won't make
-@@ -724,6 +725,40 @@ create_gbm_device(int fd)
+diff --git a/libweston/backend-drm/drm-gbm.c b/libweston/backend-drm/drm-gbm.c
+index 324c2a83..52a6766f 100644
+--- a/libweston/backend-drm/drm-gbm.c
++++ b/libweston/backend-drm/drm-gbm.c
+@@ -68,6 +68,40 @@ create_gbm_device(int fd)
return gbm;
}
@@ -217,64 +118,45 @@ index e631ffb9..b975c444 100644
/* When initializing EGL, if the preferred buffer format isn't available
* we may be able to substitute an ARGB format for an XRGB one.
*
-@@ -750,38 +785,62 @@ fallback_format_for(uint32_t format)
- static int
- drm_backend_create_gl_renderer(struct drm_backend *b)
- {
-- EGLint format[3] = {
-- b->gbm_format,
-- fallback_format_for(b->gbm_format),
-- 0,
-- };
-- int n_formats = 2;
--
-- if (format[1])
-- n_formats = 3;
+@@ -102,28 +136,53 @@ drm_backend_create_gl_renderer(struct drm_backend *b)
+
+ if (format[1])
+ n_formats = 3;
- if (gl_renderer->display_create(b->compositor,
- EGL_PLATFORM_GBM_KHR,
- (void *)b->gbm,
-+ if (b->use_egldevice) {
-+ EGLint device_platform_attribs[] = {
-+ EGL_DRM_MASTER_FD_EXT, b->drm.fd,
-+ EGL_NONE
-+ };
-+
-+ return gl_renderer->display_create(
-+ b->compositor,
-+ EGL_PLATFORM_DEVICE_EXT,
-+ (void *)b->egldevice,
-+ device_platform_attribs,
-+ gl_renderer->opaque_stream_attribs,
- NULL,
-- gl_renderer->opaque_attribs,
+- EGL_WINDOW_BIT,
- format,
- n_formats) < 0) {
- return -1;
- }
-+ 0);
-+ } else {
-+ EGLint format[3] = {
-+ b->gbm_format,
-+ fallback_format_for(b->gbm_format),
-+ 0,
-+ };
-+ int n_formats = 2;
- return 0;
-+ if (format[1])
-+ n_formats = 3;
++ if (b->use_egldevice) {
++ EGLint device_platform_attribs[] = {
++ EGL_DRM_MASTER_FD_EXT, b->drm.fd,
++ EGL_NONE
++ };
+
+ return gl_renderer->display_create(b->compositor,
++ EGL_PLATFORM_DEVICE_EXT,
++ (void *)b->egldevice,
++ device_platform_attribs,
++ EGL_STREAM_BIT_KHR,
++ format,
++ n_formats);
++ } else {
++ return gl_renderer->display_create(b->compositor,
+ EGL_PLATFORM_GBM_KHR,
+ (void *)b->gbm,
+ NULL,
-+ gl_renderer->opaque_attribs,
++ EGL_WINDOW_BIT,
+ format,
+ n_formats);
+ }
}
- static int
+ int
init_egl(struct drm_backend *b)
{
- b->gbm = create_gbm_device(b->drm.fd);
@@ -291,6 +173,7 @@ index e631ffb9..b975c444 100644
+ return -1;
+ } else {
+ b->gbm = create_gbm_device(b->drm.fd);
++
+ if (!b->gbm)
+ return -1;
+ }
@@ -302,23 +185,63 @@ index e631ffb9..b975c444 100644
return -1;
}
-@@ -1354,71 +1413,98 @@ err:
- static int
+@@ -180,71 +239,98 @@ err:
+ int
drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
{
-- EGLint format[2] = {
+- uint32_t format[2] = {
- output->gbm_format,
- fallback_format_for(output->gbm_format),
- };
-- int n_formats = 1;
+- unsigned n_formats = 1;
- struct weston_mode *mode = output->base.current_mode;
- struct drm_plane *plane = output->scanout_plane;
- unsigned int i;
+-
+- assert(output->gbm_surface == NULL);
+-
+- for (i = 0; i < plane->count_formats; i++) {
+- if (plane->formats[i].format == output->gbm_format)
+- break;
+- }
+-
+- if (i == plane->count_formats) {
+- weston_log("format 0x%x not supported by output %s\n",
+- output->gbm_format, output->base.name);
+- return -1;
+- }
+-
+-#ifdef HAVE_GBM_MODIFIERS
+- if (plane->formats[i].count_modifiers > 0) {
+- output->gbm_surface =
+- gbm_surface_create_with_modifiers(b->gbm,
+- mode->width,
+- mode->height,
+- output->gbm_format,
+- plane->formats[i].modifiers,
+- plane->formats[i].count_modifiers);
+- }
+-
+- /* If allocating with modifiers fails, try again without. This can
+- * happen when the KMS display device supports modifiers but the
+- * GBM driver does not, e.g. the old i915 Mesa driver. */
+- if (!output->gbm_surface)
+-#endif
+- {
+- output->gbm_surface =
+- gbm_surface_create(b->gbm, mode->width, mode->height,
+- output->gbm_format,
+- output->gbm_bo_flags);
+- }
+-
+- if (!output->gbm_surface) {
+- weston_log("failed to create gbm surface\n");
+- return -1;
+- }
+ if (b->use_egldevice) {
+ int w = output->base.current_mode->width;
+ int h = output->base.current_mode->height;
-
-- assert(output->gbm_surface == NULL);
++
+ /* Create a black dumb fb for modesetting */
+ output->dumb[0] = drm_fb_create_dumb(b, w, h,
+ DRM_FORMAT_XRGB8888);
@@ -337,56 +260,44 @@ index e631ffb9..b975c444 100644
+ return -1;
+ }
-- for (i = 0; i < plane->count_formats; i++) {
-- if (plane->formats[i].format == output->gbm_format)
-- break;
-- }
+- if (format[1])
+- n_formats = 2;
+- if (gl_renderer->output_window_create(&output->base,
+- (EGLNativeWindowType)output->gbm_surface,
+- output->gbm_surface,
+- format,
+- n_formats) < 0) {
+- weston_log("failed to create gl renderer output state\n");
+- gbm_surface_destroy(output->gbm_surface);
+- output->gbm_surface = NULL;
+- return -1;
+ /* FIXME: Add hw planes and cursors for EGL device when supported */
+ b->sprites_are_broken = 1;
+ b->cursors_are_broken = 1;
+ } else {
-+ EGLint format[2] = {
++ uint32_t format[2] = {
+ output->gbm_format,
+ fallback_format_for(output->gbm_format),
+ };
-+ int n_formats = 1;
++ unsigned n_formats = 1;
+ struct weston_mode *mode = output->base.current_mode;
+ struct drm_plane *plane = output->scanout_plane;
+ unsigned int i;
-+
++
+ assert(output->gbm_surface == NULL);
-+
++
+ for (i = 0; i < plane->count_formats; i++) {
+ if (plane->formats[i].format == output->gbm_format)
+ break;
+ }
-
-- if (i == plane->count_formats) {
-- weston_log("format 0x%x not supported by output %s\n",
-- output->gbm_format, output->base.name);
-- return -1;
-- }
++
+ if (i == plane->count_formats) {
+ weston_log("format 0x%x not supported by output %s\n",
+ output->gbm_format, output->base.name);
+ return -1;
+ }
-
- #ifdef HAVE_GBM_MODIFIERS
-- if (plane->formats[i].count_modifiers > 0) {
-- output->gbm_surface =
-- gbm_surface_create_with_modifiers(b->gbm,
-- mode->width,
-- mode->height,
-- output->gbm_format,
-- plane->formats[i].modifiers,
-- plane->formats[i].count_modifiers);
-- }
--
-- /* If allocating with modifiers fails, try again without. This can
-- * happen when the KMS display device supports modifiers but the
-- * GBM driver does not, e.g. the old i915 Mesa driver. */
-- if (!output->gbm_surface)
++
++ #ifdef HAVE_GBM_MODIFIERS
+ if (plane->formats[i].count_modifiers > 0) {
+ output->gbm_surface =
+ gbm_surface_create_with_modifiers(b->gbm,
@@ -396,53 +307,29 @@ index e631ffb9..b975c444 100644
+ plane->formats[i].modifiers,
+ plane->formats[i].count_modifiers);
+ }
-+
++
+ /* If allocating with modifiers fails, try again without. This can
+ * happen when the KMS display device supports modifiers but the
+ * GBM driver does not, e.g. the old i915 Mesa driver. */
+ if (!output->gbm_surface)
- #endif
-- {
-- output->gbm_surface =
-- gbm_surface_create(b->gbm, mode->width, mode->height,
-- output->gbm_format,
-- output->gbm_bo_flags);
-- }
++ #endif
+ {
+ output->gbm_surface =
+ gbm_surface_create(b->gbm, mode->width, mode->height,
+ output->gbm_format,
+ output->gbm_bo_flags);
+ }
-
-- if (!output->gbm_surface) {
-- weston_log("failed to create gbm surface\n");
-- return -1;
-- }
++
+ if (!output->gbm_surface) {
+ weston_log("failed to create gbm surface\n");
+ return -1;
+ }
-
-- if (format[1])
-- n_formats = 2;
-- if (gl_renderer->output_window_create(&output->base,
-- (EGLNativeWindowType)output->gbm_surface,
-- output->gbm_surface,
-- gl_renderer->opaque_attribs,
-- format,
-- n_formats) < 0) {
-- weston_log("failed to create gl renderer output state\n");
-- gbm_surface_destroy(output->gbm_surface);
-- output->gbm_surface = NULL;
-- return -1;
-- }
++
+ if (format[1])
+ n_formats = 2;
+ if (gl_renderer->output_window_create(&output->base,
+ (EGLNativeWindowType)output->gbm_surface,
+ output->gbm_surface,
-+ gl_renderer->opaque_attribs,
+ format,
+ n_formats) < 0) {
+ weston_log("failed to create gl renderer output state\n");
@@ -450,14 +337,16 @@ index e631ffb9..b975c444 100644
+ output->gbm_surface = NULL;
+ return -1;
+ }
-
-- drm_output_init_cursor_egl(output, b);
++
+ drm_output_init_cursor_egl(output, b);
-+ }
+ }
+- drm_output_init_cursor_egl(output, b);
+-
return 0;
}
-@@ -1431,8 +1517,9 @@ drm_output_fini_egl(struct drm_output *output)
+
+@@ -256,8 +342,9 @@ drm_output_fini_egl(struct drm_output *output)
/* Destroying the GBM surface will destroy all our GBM buffers,
* regardless of refcount. Ensure we destroy them here. */
if (!b->shutting_down &&
@@ -469,7 +358,7 @@ index e631ffb9..b975c444 100644
drm_plane_state_free(output->scanout_plane->state_cur, true);
output->scanout_plane->state_cur =
drm_plane_state_alloc(NULL, output->scanout_plane);
-@@ -1440,8 +1527,17 @@ drm_output_fini_egl(struct drm_output *output)
+@@ -265,8 +352,16 @@ drm_output_fini_egl(struct drm_output *output)
}
gl_renderer->output_destroy(&output->base);
@@ -485,23 +374,51 @@ index e631ffb9..b975c444 100644
+ gbm_surface_destroy(output->gbm_surface);
+ output->gbm_surface = NULL;
+ }
-+
drm_output_fini_cursor_egl(output);
}
-@@ -2854,6 +2950,11 @@ recorder_binding(struct weston_keyboard *keyboard, const struct timespec *time,
- struct drm_output *output;
- int width, height;
+@@ -280,22 +375,25 @@ drm_output_render_gl(struct drm_output_state *state, pixman_region32_t *damage)
-+ if (b->use_egldevice) {
-+ weston_log("recorder not supported with EGL device\n");
-+ return;
-+ }
-+
- output = container_of(b->compositor->output_list.next,
- struct drm_output, base.link);
+ output->base.compositor->renderer->repaint_output(&output->base,
+ damage);
+-
+- bo = gbm_surface_lock_front_buffer(output->gbm_surface);
+- if (!bo) {
+- weston_log("failed to lock front buffer: %s\n",
+- strerror(errno));
+- return NULL;
+- }
+-
+- /* The renderer always produces an opaque image. */
+- ret = drm_fb_get_from_bo(bo, b, true, BUFFER_GBM_SURFACE);
+- if (!ret) {
+- weston_log("failed to get drm_fb for bo\n");
+- gbm_surface_release_buffer(output->gbm_surface, bo);
+- return NULL;
++ if (b->use_egldevice)
++ ret = drm_fb_ref(output->dumb[0]);
++ else {
++ bo = gbm_surface_lock_front_buffer(output->gbm_surface);
++ if (!bo) {
++ weston_log("failed to lock front buffer: %s\n",
++ strerror(errno));
++ return NULL;
++ }
++
++ /* The renderer always produces an opaque image. */
++ ret = drm_fb_get_from_bo(bo, b, true, BUFFER_GBM_SURFACE);
++ if (!ret) {
++ weston_log("failed to get drm_fb for bo\n");
++ gbm_surface_release_buffer(output->gbm_surface, bo);
++ return NULL;
++ }
++ ret->gbm_surface = output->gbm_surface;
+ }
+- ret->gbm_surface = output->gbm_surface;
-@@ -2912,11 +3013,20 @@ switch_to_gl_renderer(struct drm_backend *b)
+ return ret;
+ }
+@@ -316,11 +414,20 @@ switch_to_gl_renderer(struct drm_backend *b)
weston_log("Switching to GL renderer\n");
@@ -517,7 +434,7 @@ index e631ffb9..b975c444 100644
+ "Aborting renderer switch\n");
+ return;
+ }
-+ } else {
++ } else {
+ b->gbm = create_gbm_device(b->drm.fd);
+ if (!b->gbm) {
+ weston_log("Failed to create gbm device. "
@@ -527,7 +444,7 @@ index e631ffb9..b975c444 100644
}
wl_list_for_each(output, &b->compositor->output_list, base.link)
-@@ -2925,7 +3035,8 @@ switch_to_gl_renderer(struct drm_backend *b)
+@@ -329,7 +436,8 @@ switch_to_gl_renderer(struct drm_backend *b)
b->compositor->renderer->destroy(b->compositor);
if (drm_backend_create_gl_renderer(b) < 0) {
@@ -537,43 +454,110 @@ index e631ffb9..b975c444 100644
weston_log("Failed to create GL renderer. Quitting.\n");
/* FIXME: we need a function to shutdown cleanly */
assert(0);
-@@ -3257,6 +3368,7 @@ drm_backend_create(struct weston_compositor *compositor,
+diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h
+index 2384a9ac..002c0deb 100644
+--- a/libweston/backend-drm/drm-internal.h
++++ b/libweston/backend-drm/drm-internal.h
+@@ -60,6 +60,17 @@
+ #include "backend.h"
+ #include "libweston-internal.h"
+
++#ifdef ENABLE_EGL
++
++#include <EGL/egl.h>
++#include <EGL/eglext.h>
++
++#else
++
++typedef void *EGLDeviceEXT;
++
++#endif
++
+ #ifndef DRM_CLIENT_CAP_ASPECT_RATIO
+ #define DRM_CLIENT_CAP_ASPECT_RATIO 4
+ #endif
+@@ -253,6 +264,9 @@ struct drm_backend {
+ struct wl_listener session_listener;
+ uint32_t gbm_format;
+
++ EGLDeviceEXT egldevice;
++ bool use_egldevice;
++
+ /* we need these parameters in order to not fail drmModeAddFB2()
+ * due to out of bounds dimensions, and then mistakenly set
+ * sprites_are_broken:
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index bbce70e5..c85497d8 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -378,7 +378,9 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage)
+ if (scanout_state->fb)
+ return;
+
+- if (!pixman_region32_not_empty(damage) &&
++ /* XXX: Assume full damage when using streams */
++ if (!b->use_egldevice &&
++ !pixman_region32_not_empty(damage) &&
+ scanout_plane->state_cur->fb &&
+ (scanout_plane->state_cur->fb->type == BUFFER_GBM_SURFACE ||
+ scanout_plane->state_cur->fb->type == BUFFER_PIXMAN_DUMB) &&
+@@ -2765,6 +2767,11 @@ recorder_binding(struct weston_keyboard *keyboard, const struct timespec *time,
+ struct drm_output *output;
+ int width, height;
+
++ if (b->use_egldevice) {
++ weston_log("recorder not supported with EGL device\n");
++ return;
++ }
++
+ output = container_of(b->compositor->output_list.next,
+ struct drm_output, base.link);
+
+@@ -2846,6 +2853,13 @@ drm_backend_create(struct weston_compositor *compositor,
b->use_pixman = config->use_pixman;
b->pageflip_timeout = config->pageflip_timeout;
b->use_pixman_shadow = config->use_pixman_shadow;
+ b->use_egldevice = config->use_egldevice;
++ if (b->use_egldevice) {
++#if !BUILD_DRM_GBM
++ weston_log("fatal: drm backend with EGLDevice requires GL renderer.\n");
++ goto err_compositor;
++#endif
++ }
b->debug = weston_compositor_add_log_scope(compositor->weston_log_ctx,
"drm-backend",
diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c
-index b5b1ade6..d25df495 100644
+index 192435c7..c70fd853 100644
--- a/libweston/backend-drm/kms.c
+++ b/libweston/backend-drm/kms.c
-@@ -41,11 +41,14 @@
- #include "drm-internal.h"
+@@ -42,6 +42,11 @@
#include "pixel-formats.h"
#include "presentation-time-server-protocol.h"
-+#include "renderer-gl/gl-renderer.h"
++#if BUILD_DRM_GBM
++#include "renderer-gl/gl-renderer.h"
++extern struct gl_renderer_interface *gl_renderer;
++#endif
++
#ifndef DRM_FORMAT_MOD_LINEAR
#define DRM_FORMAT_MOD_LINEAR 0
#endif
-
-+extern struct gl_renderer_interface *gl_renderer;
-+
- struct drm_property_enum_info plane_type_enums[] = {
- [WDRM_PLANE_TYPE_PRIMARY] = {
- .name = "Primary",
-@@ -656,9 +659,14 @@ drm_output_apply_state_legacy(struct drm_output_state *state)
+@@ -736,9 +741,19 @@ drm_output_apply_state_legacy(struct drm_output_state *state)
output->crtc_id, scanout_state->plane->plane_id,
pinfo ? pinfo->drm_format_name : "UNKNOWN");
- if (drmModePageFlip(backend->drm.fd, output->crtc_id,
- scanout_state->fb->fb_id,
- DRM_MODE_PAGE_FLIP_EVENT, output) < 0) {
-+ if (backend->use_egldevice)
++ if (backend->use_egldevice) {
++#if BUILD_DRM_GBM
+ ret = gl_renderer->output_stream_flip(&output->base, output);
-+ else
++#else
++ assert(!"Can't flip output EGLStream without GL renderer.\n");
++ ret = -1;
++#endif
++ } else
+ ret = drmModePageFlip(backend->drm.fd, output->crtc_id,
+ scanout_state->fb->fb_id,
+ DRM_MODE_PAGE_FLIP_EVENT, output);
@@ -582,33 +566,97 @@ index b5b1ade6..d25df495 100644
weston_log("queueing pageflip failed: %s\n", strerror(errno));
goto err;
}
-@@ -1335,7 +1343,8 @@ init_kms_caps(struct drm_backend *b)
+@@ -1489,7 +1504,7 @@ init_kms_caps(struct drm_backend *b)
+ weston_log("DRM: %s universal planes\n",
b->universal_planes ? "supports" : "does not support");
- #ifdef HAVE_DRM_ATOMIC
- if (b->universal_planes && !getenv("WESTON_DISABLE_ATOMIC")) {
-+ /* FIXME: Atomic modeset is not yet fully supported with streams */
+ if (b->universal_planes && !getenv("WESTON_DISABLE_ATOMIC") && !b->use_egldevice) {
ret = drmGetCap(b->drm.fd, DRM_CAP_CRTC_IN_VBLANK_EVENT, &cap);
if (ret != 0)
cap = 0;
+diff --git a/libweston/backend-headless/headless.c b/libweston/backend-headless/headless.c
+index c98bdc24..a482e1c8 100644
+--- a/libweston/backend-headless/headless.c
++++ b/libweston/backend-headless/headless.c
+@@ -394,6 +394,7 @@ headless_gl_renderer_init(struct headless_backend *b)
+ if (b->glri->display_create(b->compositor,
+ EGL_PLATFORM_SURFACELESS_MESA,
+ EGL_DEFAULT_DISPLAY,
++ NULL,
+ EGL_PBUFFER_BIT,
+ headless_formats,
+ ARRAY_LENGTH(headless_formats)) < 0) {
+diff --git a/libweston/backend-wayland/wayland.c b/libweston/backend-wayland/wayland.c
+index 42af0c80..71a6865a 100644
+--- a/libweston/backend-wayland/wayland.c
++++ b/libweston/backend-wayland/wayland.c
+@@ -2773,6 +2773,7 @@ wayland_backend_create(struct weston_compositor *compositor,
+ if (gl_renderer->display_create(compositor,
+ EGL_PLATFORM_WAYLAND_KHR,
+ b->parent.wl_display,
++ NULL,
+ EGL_WINDOW_BIT,
+ wayland_formats,
+ ARRAY_LENGTH(wayland_formats)) < 0) {
+diff --git a/libweston/backend-x11/x11.c b/libweston/backend-x11/x11.c
+index 5fda0568..ff3e762b 100644
+--- a/libweston/backend-x11/x11.c
++++ b/libweston/backend-x11/x11.c
+@@ -1813,6 +1813,7 @@ init_gl_renderer(struct x11_backend *b)
+
+ ret = gl_renderer->display_create(b->compositor, EGL_PLATFORM_X11_KHR,
+ (void *) b->dpy,
++ NULL,
+ EGL_WINDOW_BIT,
+ x11_formats,
+ ARRAY_LENGTH(x11_formats));
+diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
+index 1b6a219b..c081d1e5 100644
+--- a/libweston/renderer-gl/gl-renderer.c
++++ b/libweston/renderer-gl/gl-renderer.c
+@@ -3762,6 +3762,7 @@ static int
+ gl_renderer_display_create(struct weston_compositor *ec,
+ EGLenum platform,
+ void *native_display,
++ const EGLint *platform_attribs,
+ EGLint egl_surface_type,
+ const uint32_t *drm_formats,
+ unsigned drm_formats_count)
+@@ -3811,7 +3812,7 @@ gl_renderer_display_create(struct weston_compositor *ec,
+ if (get_platform_display && platform) {
+ gr->egl_display = get_platform_display(platform,
+ native_display,
+- NULL);
++ platform_attribs);
+ }
+ }
+
diff --git a/libweston/renderer-gl/gl-renderer.h b/libweston/renderer-gl/gl-renderer.h
-index c5c3e12b..ac6ea7f2 100644
+index ecf7368d..4fdc6b3f 100644
--- a/libweston/renderer-gl/gl-renderer.h
+++ b/libweston/renderer-gl/gl-renderer.h
-@@ -47,6 +47,7 @@ typedef void *EGLConfig;
- typedef intptr_t EGLNativeDisplayType;
- typedef intptr_t EGLNativeWindowType;
+@@ -49,6 +49,7 @@ typedef intptr_t EGLNativeWindowType;
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
+ #define EGL_PBUFFER_BIT 0x0001
+ #define EGL_WINDOW_BIT 0x0004
+#define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)0)
#endif /* ENABLE_EGL */
+@@ -99,6 +100,7 @@ struct gl_renderer_interface {
+ int (*display_create)(struct weston_compositor *ec,
+ EGLenum platform,
+ void *native_display,
++ const EGLint *platform_attribs,
+ EGLint egl_surface_type,
+ const uint32_t *drm_formats,
+ unsigned drm_formats_count);
diff --git a/shared/weston-egl-ext.h b/shared/weston-egl-ext.h
-index 96982e2d..975ee0ed 100644
+index d348a5c0..30e4eaba 100644
--- a/shared/weston-egl-ext.h
+++ b/shared/weston-egl-ext.h
-@@ -208,6 +208,10 @@ typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy,
+@@ -212,6 +212,10 @@ typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy,
#define EGL_PLATFORM_DEVICE_EXT 0x313F
#endif
@@ -619,8 +667,8 @@ index 96982e2d..975ee0ed 100644
/*
* FIXME: Remove both EGL_EXT_stream_acquire_mode and
* EGL_NV_output_drm_flip_event definitions below once both extensions
-@@ -256,6 +260,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribEXT (EGLDisplay dpy,
- #define EGL_PLATFORM_X11_KHR 0x31D5
+@@ -261,6 +265,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribEXT (EGLDisplay dpy,
+ #define EGL_PLATFORM_SURFACELESS_MESA 0x31DD
#define EGL_PLATFORM_DEVICE_EXT 0x313F
+/* EGL_DRM_MASTER_FD_EXT and EGL_NONE enum values are also kept to allow
@@ -632,5 +680,5 @@ index 96982e2d..975ee0ed 100644
#endif
--
-2.21.0
+2.20.1
diff --git a/0006-compositor-Process-stream-attach-requests-with-wl_eg.patch b/0006-compositor-Process-stream-attach-requests-with-wl_eg.patch
index c453f46e84c..ade33455905 100644
--- a/0006-compositor-Process-stream-attach-requests-with-wl_eg.patch
+++ b/0006-compositor-Process-stream-attach-requests-with-wl_eg.patch
@@ -1,9 +1,8 @@
-From 7b4d70dc7f5024e80656d9facdb0bc834d91adb9 Mon Sep 17 00:00:00 2001
+From e4f2e3aa56b3f8801dc056f9e015a7ec7e347113 Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
Date: Thu, 18 May 2017 14:35:36 -0700
-Subject: [PATCH 6/8] compositor: Process stream attach requests with
+Subject: [PATCH 6/6] compositor: Process stream attach requests with
wl_eglstream_controller
-X-NVConfidentiality: public
So far, the EGLStream implementation of the Wayland client-side driver
has been using wl_surface_attach + commit in order to make the server
@@ -35,12 +34,12 @@ Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
compositor/meson.build | 1 +
include/libweston/libweston.h | 4 +
libweston/compositor.c | 78 +++++++++++++++
- libweston/renderer-gl/gl-renderer.c | 147 ++++++++++++++++++----------
+ libweston/renderer-gl/gl-renderer.c | 146 ++++++++++++++++++----------
protocol/meson.build | 7 ++
- 5 files changed, 183 insertions(+), 54 deletions(-)
+ 5 files changed, 182 insertions(+), 54 deletions(-)
diff --git a/compositor/meson.build b/compositor/meson.build
-index 61860a7a..f11d55e8 100644
+index e1334d6a..5fffeda8 100644
--- a/compositor/meson.build
+++ b/compositor/meson.build
@@ -9,6 +9,7 @@ srcs_weston = [
@@ -52,10 +51,10 @@ index 61860a7a..f11d55e8 100644
deps_weston = [
dep_libshared,
diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h
-index 5be8ef05..178bb071 100644
+index dc54b170..3b3ffb41 100644
--- a/include/libweston/libweston.h
+++ b/include/libweston/libweston.h
-@@ -917,6 +917,10 @@ struct weston_renderer {
+@@ -912,6 +912,10 @@ struct weston_renderer {
void (*query_dmabuf_modifiers)(struct weston_compositor *ec,
int format, uint64_t **modifiers,
int *num_modifiers);
@@ -67,7 +66,7 @@ index 5be8ef05..178bb071 100644
enum weston_capability {
diff --git a/libweston/compositor.c b/libweston/compositor.c
-index 85327159..0a6a56e2 100644
+index dbc64927..f316902b 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -3,6 +3,7 @@
@@ -86,7 +85,7 @@ index 85327159..0a6a56e2 100644
#include "weston-log-internal.h"
-@@ -6850,6 +6852,80 @@ bind_presentation(struct wl_client *client,
+@@ -6911,6 +6913,80 @@ bind_presentation(struct wl_client *client,
wp_presentation_send_clock_id(resource, compositor->presentation_clock);
}
@@ -167,7 +166,7 @@ index 85327159..0a6a56e2 100644
static void
compositor_bind(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
-@@ -7230,6 +7306,8 @@ weston_compositor_create(struct wl_display *display,
+@@ -7278,6 +7354,8 @@ weston_compositor_create(struct wl_display *display,
ec, bind_presentation))
goto fail;
@@ -177,20 +176,20 @@ index 85327159..0a6a56e2 100644
goto fail;
diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
-index 22a64f81..b4a88da3 100644
+index c081d1e5..4430bc4b 100644
--- a/libweston/renderer-gl/gl-renderer.c
+++ b/libweston/renderer-gl/gl-renderer.c
@@ -1,7 +1,7 @@
/*
* Copyright © 2012 Intel Corporation
- * Copyright © 2015 Collabora, Ltd.
+ * Copyright © 2015,2019 Collabora, Ltd.
- * Copyright © 2016 NVIDIA Corporation
-+ * Copyright © 2016-2017 NVIDIA Corporation
++ * Copyright © 2016,2017 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
-@@ -2626,18 +2626,9 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
- surface->is_opaque = dmabuf_is_opaque(dmabuf);
+@@ -2547,18 +2547,9 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
+ gs->shader = image->shader;
}
-/*
@@ -211,7 +210,7 @@ index 22a64f81..b4a88da3 100644
{
#ifdef EGL_NV_stream_attrib
struct weston_compositor *ec = es->compositor;
-@@ -2646,65 +2637,111 @@ gl_renderer_attach_stream_texture(struct weston_surface *es,
+@@ -2567,65 +2558,110 @@ gl_renderer_attach_stream_texture(struct weston_surface *es,
EGLStreamKHR stream = EGL_NO_STREAM_KHR;
EGLAttrib stream_attribs[] = {
#ifdef EGL_WL_wayland_eglstream
@@ -261,8 +260,7 @@ index 22a64f81..b4a88da3 100644
- * does not corresponds to a stream */
- return false;
+ weston_log("failed to set stream consumer\n");
-+ weston_log("EGL error state: %s (0x%04lx)\n",
-+ egl_error_string(err), (long)err);
++ weston_log("EGL error: 0x%04lx\n", (long)err);
- case EGL_BAD_STREAM_KHR:
- /* EGL_BAD_STREAM_KHR is generated whenever
@@ -364,17 +362,17 @@ index 22a64f81..b4a88da3 100644
}
/* At this point we should have a valid stream handle */
-@@ -4138,6 +4175,8 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
- gr->base.surface_get_content_size =
+@@ -3796,6 +3832,8 @@ gl_renderer_display_create(struct weston_compositor *ec,
gl_renderer_surface_get_content_size;
gr->base.surface_copy_content = gl_renderer_surface_copy_content;
+ gr->platform = platform;
+ gr->base.attach_eglstream_consumer =
+ gl_renderer_attach_eglstream_consumer;
gr->egl_display = NULL;
/* extension_suffix is supported */
diff --git a/protocol/meson.build b/protocol/meson.build
-index 1228d15b..e47d0a6c 100644
+index 25cea5a8..1a42ee64 100644
--- a/protocol/meson.build
+++ b/protocol/meson.build
@@ -4,6 +4,9 @@ prog_scanner = find_program(dep_scanner.get_pkgconfig_variable('wayland_scanner'
@@ -387,7 +385,7 @@ index 1228d15b..e47d0a6c 100644
install_data(
[
'weston-debug.xml',
-@@ -35,6 +38,7 @@ generated_protocols = [
+@@ -37,6 +40,7 @@ generated_protocols = [
[ 'xdg-output', 'v1' ],
[ 'xdg-shell', 'v6' ],
[ 'xdg-shell', 'stable' ],
@@ -395,7 +393,7 @@ index 1228d15b..e47d0a6c 100644
]
foreach proto: generated_protocols
-@@ -42,6 +46,9 @@ foreach proto: generated_protocols
+@@ -44,6 +48,9 @@ foreach proto: generated_protocols
if proto[1] == 'internal'
base_file = proto_name
xml_path = '@0@.xml'.format(proto_name)
@@ -406,5 +404,5 @@ index 1228d15b..e47d0a6c 100644
base_file = proto_name
xml_path = '@0@/stable/@1@/@1@.xml'.format(dir_wp_base, base_file)
--
-2.21.0
+2.20.1
diff --git a/0007-desktop-shell-Avoid-NULL-output-dereference-when-get.patch b/0007-desktop-shell-Avoid-NULL-output-dereference-when-get.patch
deleted file mode 100644
index c913b0f9d9d..00000000000
--- a/0007-desktop-shell-Avoid-NULL-output-dereference-when-get.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From f98d9cf40a5dc11a7f87bc674bb6e3333c2321d1 Mon Sep 17 00:00:00 2001
-From: "Miguel A. Vico" <mvicomoya@nvidia.com>
-Date: Wed, 25 Sep 2019 11:23:13 -0700
-Subject: [PATCH 7/8] desktop-shell: Avoid NULL output dereference when getting
- surface label
-X-NVConfidentiality: public
-
-When hotunplugging a display, the compositor will tear down the
-corresponding output object.
-
-Avoid NULL output dereferences by all surface label getters in
-desktop-shell when hotunplugging happens.
-
-Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
----
- desktop-shell/shell.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
-index f94a4ca2..00ee1079 100644
---- a/desktop-shell/shell.c
-+++ b/desktop-shell/shell.c
-@@ -521,7 +521,7 @@ static int
- focus_surface_get_label(struct weston_surface *surface, char *buf, size_t len)
- {
- return snprintf(buf, len, "focus highlight effect for output %s",
-- surface->output->name);
-+ (surface->output ? surface->output->name : "NULL"));
- }
-
- /* no-op func for checking focus surface */
-@@ -2985,7 +2985,7 @@ static int
- background_get_label(struct weston_surface *surface, char *buf, size_t len)
- {
- return snprintf(buf, len, "background for output %s",
-- surface->output->name);
-+ (surface->output ? surface->output->name : "NULL"));
- }
-
- static void
-@@ -3065,7 +3065,7 @@ static int
- panel_get_label(struct weston_surface *surface, char *buf, size_t len)
- {
- return snprintf(buf, len, "panel for output %s",
-- surface->output->name);
-+ (surface->output ? surface->output->name : "NULL"));
- }
-
- static void
---
-2.21.0
-
diff --git a/0008-compositor-Do-not-trigger-invalid-destructors-when-h.patch b/0008-compositor-Do-not-trigger-invalid-destructors-when-h.patch
deleted file mode 100644
index 424dab6971b..00000000000
--- a/0008-compositor-Do-not-trigger-invalid-destructors-when-h.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 760828c01641d6900e2a63125a558df3b54b01b4 Mon Sep 17 00:00:00 2001
-From: "Miguel A. Vico" <mvicomoya@nvidia.com>
-Date: Wed, 25 Sep 2019 11:28:13 -0700
-Subject: [PATCH 8/8] compositor: Do not trigger invalid destructors when
- hotunplugging
-X-NVConfidentiality: public
-
-When hotunplugging a display, the compositor will tear the top-level
-wet_output object down, freeing its memory.
-
-However, destruction of the backend output might be delayed in certain
-situations (e.g. destroying DRM output while in the middle of a page
-flip).
-
-When the backend output is finally destroyed, it will trigger a
-destruction callback previously added by the compositor, which point to
-data belonging to the top-level wet_output object.
-
-In order to avoid access to invalid data when the backend output is
-destroyed after the top-level wet_output object, remove the destruction
-callback from the corresponding list before freeing the object.
-
-Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
----
- compositor/main.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/compositor/main.c b/compositor/main.c
-index bb6bd84b..2f253f40 100644
---- a/compositor/main.c
-+++ b/compositor/main.c
-@@ -1860,8 +1860,16 @@ wet_output_from_weston_output(struct weston_output *base)
- static void
- wet_output_destroy(struct wet_output *output)
- {
-- if (output->output)
-- weston_output_destroy(output->output);
-+ if (output->output) {
-+ /* output->output destruction may be deferred in some cases (see
-+ * drm_output_destroy()), so we need to forcibly trigger the
-+ * destruction callback now, or otherwise would later access
-+ * data that we are about to free
-+ */
-+ struct weston_output *save = output->output;
-+ wet_output_handle_destroy(&output->output_destroy_listener, save);
-+ weston_output_destroy(save);
-+ }
-
- wl_list_remove(&output->link);
- free(output);
---
-2.21.0
-
diff --git a/PKGBUILD b/PKGBUILD
index 924657fd19b..c49bde367f9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,8 +6,8 @@
# Contributor: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
pkgname=weston-eglstream
-pkgver=7.0.0
-pkgrel=2
+pkgver=8.0.0
+pkgrel=1
pkgdesc='Reference implementation of a Wayland compositor with EGLStream support'
arch=('x86_64')
url='https://wayland.freedesktop.org/'
@@ -24,18 +24,14 @@ source=("https://wayland.freedesktop.org/releases/weston-$pkgver.tar.xz"
'0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch'
'0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch'
'0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch'
- '0006-compositor-Process-stream-attach-requests-with-wl_eg.patch'
- '0007-desktop-shell-Avoid-NULL-output-dereference-when-get.patch'
- '0008-compositor-Do-not-trigger-invalid-destructors-when-h.patch')
-sha256sums=('a00a6d207b6a45f95f4401c604772a307c3767e5e2beecf3d879110c43909a64'
- '052d1256d069b5ca23865cd12ba5122e79475780b6fb09bdaa1301a621b32c1f'
- 'cf2fda06ab6f3a545f9302b4ced8435df2f03378f4b3f2e25f7c85222c54d38f'
- '5bd7f6a11341efcffc596ad6808d2dc3c5b5e10e6cdecd3bfdc27eb23fe7ba0f'
- '46d2975fa6c6397206c9b170639aa79a96b3bddde8957dbe234d2a8206f773aa'
- '085c23f406366b236b6aa7f1d1158b65fead3adbd907a7c44b8e9407b6f90b9d'
- 'c4db17e98afca6b099f5bbc6486430b768a1f71929c433ae403e68626f3e78d8'
- '2b7025295ae077cf91d22dc32c255f15e36feb9a61bf686adaf4c6be87750469'
- '3c12268e4bae6dfa264411c2a72be4ca7aca4055fe3956136b5a31dbca3e4136')
+ '0006-compositor-Process-stream-attach-requests-with-wl_eg.patch')
+sha256sums=('7518b49b2eaa1c3091f24671bdcc124fd49fc8f1af51161927afa4329c027848'
+ '8d644af0432944ec0c8710f3d31ffdccb8a0661683247743df08915cf9670915'
+ 'bbfc35859b4561ddaee39077c1b449c729ce6e691193a64090b44746bc46d587'
+ '0e2616445c720fc23137feffc6148f891648e3ab8a52f6790cf484b0b39d7fe2'
+ '557aa28b89b18c4fb28ea7ab56dd6f3580dbc44d6ae0a983b8b615eab5bf00b1'
+ '36e9d9a317c32e61910465394977c8a35bf94afe97a11e56476ea7ff1e8d708a'
+ 'dc64ac1cacac8dea668644a2a64aeaf3123983dcc61bf5b993bbd48dbc4f69ef')
prepare() {
cd weston-$pkgver
@@ -45,8 +41,6 @@ prepare() {
patch -Np1 -i "${srcdir}/0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch"
patch -Np1 -i "${srcdir}/0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch"
patch -Np1 -i "${srcdir}/0006-compositor-Process-stream-attach-requests-with-wl_eg.patch"
- patch -Np1 -i "${srcdir}/0007-desktop-shell-Avoid-NULL-output-dereference-when-get.patch"
- patch -Np1 -i "${srcdir}/0008-compositor-Do-not-trigger-invalid-destructors-when-h.patch"
}
build() {