diff options
-rw-r--r-- | .SRCINFO | 20 | ||||
-rw-r--r-- | 0001-gl-renderer-Add-EGLDevice-enumeration-support.patch | 14 | ||||
-rw-r--r-- | 0002-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch | 89 | ||||
-rw-r--r-- | 0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch | 47 | ||||
-rw-r--r-- | 0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch | 12 | ||||
-rw-r--r-- | 0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch | 547 | ||||
-rw-r--r-- | 0006-compositor-Process-stream-attach-requests-with-wl_eg.patch | 42 | ||||
-rw-r--r-- | PKGBUILD | 18 |
8 files changed, 403 insertions, 386 deletions
@@ -1,7 +1,7 @@ pkgbase = weston-eglstream pkgdesc = Reference implementation of a Wayland compositor with EGLStream support - pkgver = 8.0.0 - pkgrel = 2 + pkgver = 9.0.0 + pkgrel = 1 url = https://wayland.freedesktop.org/ arch = x86_64 license = MIT @@ -22,20 +22,20 @@ pkgbase = weston-eglstream depends = egl-wayland provides = weston conflicts = weston - source = https://wayland.freedesktop.org/releases/weston-8.0.0.tar.xz + source = https://wayland.freedesktop.org/releases/weston-9.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 - sha256sums = 7518b49b2eaa1c3091f24671bdcc124fd49fc8f1af51161927afa4329c027848 - sha256sums = 8d644af0432944ec0c8710f3d31ffdccb8a0661683247743df08915cf9670915 - sha256sums = bbfc35859b4561ddaee39077c1b449c729ce6e691193a64090b44746bc46d587 - sha256sums = 0e2616445c720fc23137feffc6148f891648e3ab8a52f6790cf484b0b39d7fe2 - sha256sums = 557aa28b89b18c4fb28ea7ab56dd6f3580dbc44d6ae0a983b8b615eab5bf00b1 - sha256sums = 36e9d9a317c32e61910465394977c8a35bf94afe97a11e56476ea7ff1e8d708a - sha256sums = dc64ac1cacac8dea668644a2a64aeaf3123983dcc61bf5b993bbd48dbc4f69ef + sha256sums = 5cf5d6ce192e0eb15c1fc861a436bf21b5bb3b91dbdabbdebe83e1f83aa098fe + sha256sums = 39eb26160b63183f35e5c50bea8cc10248fe194ab96b2cb9417990e5ed45fa1a + sha256sums = 55ee7aaed84cdc75cc58919a3ec71c7b2cfdbcf936a5f6c8f07f54376b9cc3a5 + sha256sums = c971abb2b84d9b2519c08aacbd3a4afc44d31bf0970d3bc71e48cca850a9765f + sha256sums = ac1c048f6944b1ddd24c17205a7bd8f55578af5489d2f9ca7121727b0cbacc68 + sha256sums = 5898de8565d3c449fb276f9e3b1ae1bb9e908e8153e0802989a49baa8d1d134a + sha256sums = 5834b4b0068cc0debe5bc20cddafd17f9ca4cb472035716da3942401a130ccc8 pkgname = weston-eglstream diff --git a/0001-gl-renderer-Add-EGLDevice-enumeration-support.patch b/0001-gl-renderer-Add-EGLDevice-enumeration-support.patch index f365b5a7d8e2..6eadeff3a9bc 100644 --- a/0001-gl-renderer-Add-EGLDevice-enumeration-support.patch +++ b/0001-gl-renderer-Add-EGLDevice-enumeration-support.patch @@ -1,4 +1,4 @@ -From e1cb3214647b044f1ba39fa8b0eff02a26bb894a Mon Sep 17 00:00:00 2001 +From 3cf008cf8b11488e07f3008ab32ce1d43b004914 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/6] gl-renderer: Add EGLDevice enumeration support @@ -21,10 +21,10 @@ Reviewed-by: James Jones <jajones@nvidia.com> 2 files changed, 94 insertions(+) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c -index 6c435507..4bf95e60 100644 +index d5bfe830..0c9e197a 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c -@@ -3826,6 +3826,90 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface) +@@ -3804,6 +3804,90 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface) return 0; } @@ -115,7 +115,7 @@ index 6c435507..4bf95e60 100644 WL_EXPORT struct gl_renderer_interface gl_renderer_interface = { .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 = { +@@ -3811,4 +3895,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, @@ -123,7 +123,7 @@ index 6c435507..4bf95e60 100644 + .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 2bca2d00..b60a6463 100644 +index 1430bb14..80c3379b 100644 --- a/libweston/renderer-gl/gl-renderer.h +++ b/libweston/renderer-gl/gl-renderer.h @@ -40,6 +40,7 @@ @@ -134,7 +134,7 @@ index 2bca2d00..b60a6463 100644 typedef void *EGLDisplay; typedef void *EGLSurface; typedef void *EGLConfig; -@@ -202,4 +203,11 @@ struct gl_renderer_interface { +@@ -218,4 +219,11 @@ struct gl_renderer_interface { * EGL_ANDROID_native_fence_sync extension. */ int (*create_fence_fd)(struct weston_output *output); @@ -147,5 +147,5 @@ index 2bca2d00..b60a6463 100644 + const char **drm_device_file); }; -- -2.20.1 +2.25.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 2449df0669fb..1ab6d5cf0900 100644 --- a/0002-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch +++ b/0002-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch @@ -1,4 +1,4 @@ -From 0bc696502b2cf1266e30dfc35146d85282eaa629 Mon Sep 17 00:00:00 2001 +From e3914a22b9dfb64705b2bcc8d497ebb464fa2fc7 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/6] gl-renderer: Add support for EGLDevice composited frame @@ -41,18 +41,27 @@ Reviewed-by: Andy Ritger <aritger@nvidia.com> Reviewed-by: Adam Cheney <acheney@nvidia.com> Reviewed-by: James Jones <jajones@nvidia.com> --- - 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/egl-glue.c | 45 +++++ + libweston/renderer-gl/gl-renderer-internal.h | 22 +++ + libweston/renderer-gl/gl-renderer.c | 197 ++++++++++++++++++- libweston/renderer-gl/gl-renderer.h | 15 ++ shared/weston-egl-ext.h | 40 ++++ - 5 files changed, 308 insertions(+), 5 deletions(-) + 5 files changed, 314 insertions(+), 5 deletions(-) diff --git a/libweston/renderer-gl/egl-glue.c b/libweston/renderer-gl/egl-glue.c -index d96efeae..24d647b8 100644 +index 28be4ffe..60cebd8f 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) +@@ -503,6 +503,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"); + } +@@ -600,6 +602,19 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec) (void *) eglGetProcAddress("eglQueryWaylandBufferWL"); gr->set_damage_region = (void *) eglGetProcAddress("eglSetDamageRegionKHR"); @@ -72,7 +81,7 @@ index d96efeae..24d647b8 100644 extensions = (const char *) eglQueryString(gr->egl_display, EGL_EXTENSIONS); -@@ -593,6 +606,30 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec) +@@ -689,5 +704,35 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec) "to missing EGL_KHR_wait_sync extension\n"); } @@ -100,16 +109,21 @@ index d96efeae..24d647b8 100644 + if (weston_check_egl_extension(extensions, "EGL_EXT_stream_acquire_mode")) + gr->has_egl_stream_acquire_mode = true; + - renderer_setup_egl_client_extensions(gr); - ++ 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; ++ return 0; + } diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h -index 00f617a9..b7c374a2 100644 +index 529cb2f9..e122f64a 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; +@@ -91,6 +91,28 @@ struct gl_renderer { struct wl_list dmabuf_images; + struct wl_list dmabuf_formats; + PFNEGLGETOUTPUTLAYERSEXTPROC get_output_layers; + PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC query_output_layer_attrib; @@ -137,7 +151,7 @@ index 00f617a9..b7c374a2 100644 struct gl_shader texture_shader_rgba; diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c -index 4bf95e60..fe4f1087 100644 +index 0c9e197a..6fc469ba 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -91,6 +91,8 @@ struct gl_output_state { @@ -149,7 +163,7 @@ index 4bf95e60..fe4f1087 100644 struct weston_matrix output_matrix; EGLSyncKHR begin_render_sync, end_render_sync; -@@ -1514,6 +1516,38 @@ gl_renderer_repaint_output(struct weston_output *output, +@@ -1521,6 +1523,38 @@ gl_renderer_repaint_output(struct weston_output *output, update_buffer_release_fences(compositor, output); } @@ -188,7 +202,7 @@ index 4bf95e60..fe4f1087 100644 static int gl_renderer_read_pixels(struct weston_output *output, pixman_format_code_t format, void *pixels, -@@ -3142,9 +3176,93 @@ gl_renderer_create_window_surface(struct gl_renderer *gr, +@@ -3238,9 +3272,93 @@ gl_renderer_create_window_surface(struct gl_renderer *gr, return egl_surface; } @@ -283,7 +297,7 @@ index 4bf95e60..fe4f1087 100644 { struct gl_output_state *go; int i; -@@ -3154,6 +3272,7 @@ gl_renderer_output_create(struct weston_output *output, +@@ -3250,6 +3368,7 @@ gl_renderer_output_create(struct weston_output *output, return -1; go->egl_surface = surface; @@ -291,7 +305,7 @@ index 4bf95e60..fe4f1087 100644 for (i = 0; i < BUFFER_DAMAGE_COUNT; i++) pixman_region32_init(&go->buffer_damage[i]); -@@ -3190,7 +3309,7 @@ gl_renderer_output_window_create(struct weston_output *output, +@@ -3283,7 +3402,7 @@ gl_renderer_output_window_create(struct weston_output *output, return -1; } @@ -300,7 +314,7 @@ index 4bf95e60..fe4f1087 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, +@@ -3322,13 +3441,41 @@ gl_renderer_output_pbuffer_create(struct weston_output *output, return -1; } @@ -343,7 +357,7 @@ index 4bf95e60..fe4f1087 100644 static void gl_renderer_output_destroy(struct weston_output *output) { -@@ -3268,6 +3415,9 @@ gl_renderer_output_destroy(struct weston_output *output) +@@ -3358,6 +3505,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); @@ -353,30 +367,21 @@ index 4bf95e60..fe4f1087 100644 free(go); } -@@ -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"); - } -@@ -3530,7 +3682,8 @@ gl_renderer_display_create(struct weston_compositor *ec, +@@ -3503,7 +3653,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; ++ options->egl_platform == EGL_PLATFORM_DEVICE_EXT) { + EGLint egl_surface_type = options->egl_surface_type; -@@ -3550,6 +3703,38 @@ gl_renderer_display_create(struct weston_compositor *ec, + if (!gr->has_surfaceless_context) +@@ -3526,6 +3677,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; -+ if (platform == EGL_PLATFORM_DEVICE_EXT) { ++ if (options->egl_platform == EGL_PLATFORM_DEVICE_EXT) { + if (!gr->has_egl_output_base || + !gr->has_egl_output_drm || + !gr->has_egl_stream || @@ -411,7 +416,7 @@ index 4bf95e60..fe4f1087 100644 wl_list_init(&gr->dmabuf_images); if (gr->has_dmabuf_import) { gr->base.import_dmabuf = gl_renderer_import_dmabuf; -@@ -3914,9 +4099,13 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = { +@@ -3892,9 +4075,13 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = { .display_create = gl_renderer_display_create, .output_window_create = gl_renderer_output_window_create, .output_pbuffer_create = gl_renderer_output_pbuffer_create, @@ -427,12 +432,12 @@ index 4bf95e60..fe4f1087 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 b60a6463..ecf7368d 100644 +index 80c3379b..f46c21c6 100644 --- a/libweston/renderer-gl/gl-renderer.h +++ b/libweston/renderer-gl/gl-renderer.h -@@ -163,6 +163,9 @@ struct gl_renderer_interface { - const uint32_t *drm_formats, - unsigned drm_formats_count); +@@ -179,6 +179,9 @@ struct gl_renderer_interface { + int (*output_pbuffer_create)(struct weston_output *output, + const struct gl_renderer_pbuffer_options *options); + int (*output_stream_create)(struct weston_output *output, + uint32_t plane_id, uint32_t crtc_id); @@ -440,7 +445,7 @@ index b60a6463..ecf7368d 100644 void (*output_destroy)(struct weston_output *output); /* Sets the output border. -@@ -210,4 +213,16 @@ struct gl_renderer_interface { +@@ -226,4 +229,16 @@ struct gl_renderer_interface { int (*get_drm_device_file)(EGLDeviceEXT device, const char **drm_device_file); @@ -516,5 +521,5 @@ index 4a757c8b..dc07c04a 100644 #endif /* ENABLE_EGL */ -- -2.20.1 +2.25.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 7d70902ca7c6..5f02a285a2c1 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,4 +1,4 @@ -From ac135245b43c99dfbad084b52393da9d5ba76f2a Mon Sep 17 00:00:00 2001 +From a7fc52ddd8d7f6c212caeb29dc1df5b4b8b74bd3 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/6] gl-renderer: Add EGL client support for EGLStream frame @@ -27,17 +27,17 @@ 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/egl-glue.c | 11 ++ + libweston/renderer-gl/egl-glue.c | 5 + 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(+) + 4 files changed, 183 insertions(+) diff --git a/libweston/renderer-gl/egl-glue.c b/libweston/renderer-gl/egl-glue.c -index 24d647b8..90575d29 100644 +index 60cebd8f..abe10b46 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) +@@ -607,14 +607,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"); @@ -57,24 +57,11 @@ index 24d647b8..90575d29 100644 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; -+ -+ if (weston_check_egl_extension(extensions, "EGL_WL_wayland_eglstream")) -+ gr->has_egl_wayland_eglstream = true; -+ - renderer_setup_egl_client_extensions(gr); - - return 0; diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h -index b7c374a2..0827500e 100644 +index e122f64a..5b0bd4b5 100644 --- a/libweston/renderer-gl/gl-renderer-internal.h +++ b/libweston/renderer-gl/gl-renderer-internal.h -@@ -95,6 +95,7 @@ struct gl_renderer { +@@ -99,6 +99,7 @@ struct gl_renderer { PFNEGLCREATESTREAMKHRPROC create_stream; PFNEGLDESTROYSTREAMKHRPROC destroy_stream; @@ -82,7 +69,7 @@ index b7c374a2..0827500e 100644 bool has_egl_stream; PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC create_stream_producer_surface; -@@ -104,11 +105,16 @@ struct gl_renderer { +@@ -108,11 +109,16 @@ struct gl_renderer { bool has_egl_stream_consumer_egloutput; #ifdef EGL_NV_stream_attrib @@ -100,10 +87,10 @@ index b7c374a2..0827500e 100644 struct gl_shader texture_shader_rgba; diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c -index fe4f1087..1b6a219b 100644 +index 6fc469ba..f834a7cb 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c -@@ -187,6 +187,9 @@ struct gl_surface_state { +@@ -196,6 +196,9 @@ struct gl_surface_state { int hsub[3]; /* horizontal subsampling per plane */ int vsub[3]; /* vertical subsampling per plane */ @@ -113,7 +100,7 @@ index fe4f1087..1b6a219b 100644 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, +@@ -2636,6 +2639,145 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface, gs->shader = image->shader; } @@ -259,7 +246,7 @@ index fe4f1087..1b6a219b 100644 static void gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) { -@@ -2571,6 +2713,12 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) +@@ -2663,6 +2805,12 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) gs->y_inverted = true; gs->direct_display = false; es->is_opaque = false; @@ -272,7 +259,7 @@ index fe4f1087..1b6a219b 100644 return; } -@@ -2578,6 +2726,9 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) +@@ -2670,6 +2818,9 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) if (shm_buffer) gl_renderer_attach_shm(es, buffer, shm_buffer); @@ -282,7 +269,7 @@ index fe4f1087..1b6a219b 100644 else if (gr->has_bind_display && gr->query_buffer(gr->egl_display, (void *)buffer->resource, EGL_TEXTURE_FORMAT, &format)) -@@ -2781,6 +2932,10 @@ surface_state_destroy(struct gl_surface_state *gs, struct gl_renderer *gr) +@@ -2873,6 +3024,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); @@ -293,7 +280,7 @@ index fe4f1087..1b6a219b 100644 free(gs); } -@@ -2832,6 +2987,8 @@ gl_renderer_create_surface(struct weston_surface *surface) +@@ -2924,6 +3079,8 @@ gl_renderer_create_surface(struct weston_surface *surface) gs->surface = surface; @@ -302,7 +289,7 @@ index fe4f1087..1b6a219b 100644 pixman_region32_init(&gs->texture_damage); surface->renderer_state = gs; -@@ -3730,6 +3887,16 @@ gl_renderer_display_create(struct weston_compositor *ec, +@@ -3704,6 +3861,16 @@ gl_renderer_display_create(struct weston_compositor *ec, goto fail_terminate; } @@ -336,5 +323,5 @@ index dc07c04a..d348a5c0 100644 /* EGL platform definition are keept to allow compositor-xx.c to build */ -- -2.20.1 +2.25.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 e2089e965e10..0db21e38460c 100644 --- a/0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch +++ b/0004-backend-drm-Gracefully-handle-vblank-and-flip-invali.patch @@ -1,4 +1,4 @@ -From 0ed7d25672cf8a2e16f84e336568970e069e0930 Mon Sep 17 00:00:00 2001 +From b897295ffd88f1046e7150a084d57c41ced4cb9e 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/6] backend-drm: Gracefully handle vblank and flip invalid @@ -21,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 e0b1cbd7..bbce70e5 100644 +index 2780f3bd..94a2bf2a 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -4,6 +4,7 @@ @@ -32,7 +32,7 @@ index e0b1cbd7..bbce70e5 100644 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the -@@ -318,6 +319,19 @@ drm_output_update_complete(struct drm_output *output, uint32_t flags, +@@ -319,6 +320,19 @@ drm_output_update_complete(struct drm_output *output, uint32_t flags, ts.tv_sec = sec; ts.tv_nsec = usec * 1000; @@ -52,7 +52,7 @@ index e0b1cbd7..bbce70e5 100644 weston_output_finish_frame(&output->base, &ts, flags); /* We can't call this from frame_notify, because the output's -@@ -525,8 +539,16 @@ drm_output_start_repaint_loop(struct weston_output *output_base) +@@ -555,8 +569,16 @@ drm_output_start_repaint_loop(struct weston_output *output_base) vbl.request.type |= drm_waitvblank_pipe(output); ret = drmWaitVBlank(backend->drm.fd, &vbl); @@ -71,7 +71,7 @@ index e0b1cbd7..bbce70e5 100644 ts.tv_sec = vbl.reply.tval_sec; ts.tv_nsec = vbl.reply.tval_usec * 1000; -@@ -547,7 +569,7 @@ drm_output_start_repaint_loop(struct weston_output *output_base) +@@ -577,7 +599,7 @@ drm_output_start_repaint_loop(struct weston_output *output_base) } } @@ -81,5 +81,5 @@ index e0b1cbd7..bbce70e5 100644 */ -- -2.20.1 +2.25.1 diff --git a/0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch b/0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch index ba947b7ee705..857a9721ffe2 100644 --- a/0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch +++ b/0005-backend-drm-Add-support-for-EGLDevice-EGLOutput.patch @@ -1,4 +1,4 @@ -From e9ad91ffa3a22fe63455461f62d808e455c2f36d Mon Sep 17 00:00:00 2001 +From 8f9701ca16c53caa96edbdf0d0e5fc5cd6f6efbe 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/6] backend-drm: Add support for EGLDevice+EGLOutput @@ -24,42 +24,46 @@ 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-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(-) + compositor/main.c | 4 +- + include/libweston/backend-drm.h | 4 + + libweston/backend-drm/drm-gbm.c | 262 +++++++++++++------ + libweston/backend-drm/drm-internal.h | 14 + + libweston/backend-drm/drm.c | 15 +- + 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/egl-glue.c | 5 +- + libweston/renderer-gl/gl-renderer-internal.h | 4 +- + libweston/renderer-gl/gl-renderer.c | 4 +- + libweston/renderer-gl/gl-renderer.h | 2 + + shared/weston-egl-ext.h | 9 + + 14 files changed, 259 insertions(+), 90 deletions(-) diff --git a/compositor/main.c b/compositor/main.c -index 8eb8a470..ae0c32d1 100644 +index 65da9dbc..2361cc63 100644 --- a/compositor/main.c +++ b/compositor/main.c -@@ -670,6 +670,7 @@ usage(int error_code) - " --tty=TTY\t\tThe tty to use\n" +@@ -677,7 +677,8 @@ usage(int error_code) " --drm-device=CARD\tThe DRM device to use, e.g. \"card0\".\n" " --use-pixman\t\tUse the pixman (CPU) renderer\n" -+ " --use-egldevice\tUse EGLDevice and EGLOutput with the GL renderer\n" - " --current-mode\tPrefer current KMS mode over EDID preferred mode\n\n"); + " --current-mode\tPrefer current KMS mode over EDID preferred mode\n" +- " --continue-without-input\tAllow the compositor to start without input devices\n\n"); ++ " --continue-without-input\tAllow the compositor to start without input devices\n\n" ++ " --use-egldevice\tUse EGLDevice and EGLOutput with the GL renderer\n"); #endif -@@ -2494,6 +2495,7 @@ load_drm_backend(struct weston_compositor *c, - { WESTON_OPTION_STRING, "drm-device", 0, &config.specific_device }, + #if defined(BUILD_FBDEV_COMPOSITOR) +@@ -2525,6 +2526,7 @@ load_drm_backend(struct weston_compositor *c, { WESTON_OPTION_BOOLEAN, "current-mode", 0, &wet->drm_use_current_mode }, { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman }, + { WESTON_OPTION_BOOLEAN, "continue-without-input", 0, &config.continue_without_input }, + { WESTON_OPTION_BOOLEAN, "use-egldevice", 0, &config.use_egldevice }, }; parse_options(options, ARRAY_LENGTH(options), argc, argv); diff --git a/include/libweston/backend-drm.h b/include/libweston/backend-drm.h -index f6647e28..b2ccce55 100644 +index 350eeb0d..8916f98d 100644 --- a/include/libweston/backend-drm.h +++ b/include/libweston/backend-drm.h @@ -177,6 +177,10 @@ struct weston_drm_backend_config { @@ -74,10 +78,22 @@ index f6647e28..b2ccce55 100644 * * If seat_id is NULL, the seat is taken from XDG_SEAT environment diff --git a/libweston/backend-drm/drm-gbm.c b/libweston/backend-drm/drm-gbm.c -index 324c2a83..52a6766f 100644 +index 30609e3e..04a9f89b 100644 --- a/libweston/backend-drm/drm-gbm.c +++ b/libweston/backend-drm/drm-gbm.c -@@ -68,6 +68,40 @@ create_gbm_device(int fd) +@@ -51,11 +51,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 +@@ -68,6 +63,40 @@ create_gbm_device(int fd) return gbm; } @@ -118,42 +134,47 @@ index 324c2a83..52a6766f 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. * -@@ -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, -- EGL_WINDOW_BIT, -- format, -- n_formats) < 0) { -- return -1; -- } +@@ -98,33 +127,57 @@ drm_backend_create_gl_renderer(struct drm_backend *b) + fallback_format_for(b->gbm_format), + 0, + }; +- struct gl_renderer_display_options options = { +- .egl_platform = EGL_PLATFORM_GBM_KHR, +- .egl_native_display = b->gbm, +- .egl_surface_type = EGL_WINDOW_BIT, +- .drm_formats = format, +- .drm_formats_count = 2, ++ ++ EGLint device_platform_attribs[] = { ++ EGL_DRM_MASTER_FD_EXT, b->drm.fd, ++ EGL_NONE + }; -- return 0; ++ struct gl_renderer_display_options options; + 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); ++ options.egl_platform = EGL_PLATFORM_DEVICE_EXT; ++ options.egl_native_display = b->egldevice; ++ options.egl_surface_type = EGL_STREAM_BIT_KHR; ++ options.egl_platform_attribs = device_platform_attribs; ++ options.drm_formats = format; ++ options.drm_formats_count = 2; + } else { -+ return gl_renderer->display_create(b->compositor, -+ EGL_PLATFORM_GBM_KHR, -+ (void *)b->gbm, -+ NULL, -+ EGL_WINDOW_BIT, -+ format, -+ n_formats); ++ options.egl_platform = EGL_PLATFORM_GBM_KHR; ++ options.egl_native_display = b->gbm; ++ options.egl_surface_type = EGL_WINDOW_BIT; ++ options.egl_platform_attribs = NULL; ++ options.drm_formats = format; ++ options.drm_formats_count = 2; + } ++ + if (format[1]) + options.drm_formats_count = 3; + +- if (gl_renderer->display_create(b->compositor, &options) < 0) +- return -1; +- +- return 0; ++ return gl_renderer->display_create(b->compositor, &options); } int @@ -185,35 +206,78 @@ index 324c2a83..52a6766f 100644 return -1; } -@@ -180,71 +239,98 @@ err: +@@ -181,71 +234,98 @@ err: int drm_output_init_egl(struct drm_output *output, struct drm_backend *b) { - uint32_t format[2] = { -- output->gbm_format, -- fallback_format_for(output->gbm_format), ++ if (b->use_egldevice) { ++ int w = output->base.current_mode->width; ++ int h = output->base.current_mode->height; ++ ++ /* Create a black dumb fb for modesetting */ ++ output->dumb[0] = drm_fb_create_dumb(b, w, h, ++ DRM_FORMAT_XRGB8888); ++ if (!output->dumb[0]) { ++ weston_log("failed to create dumb framebuffer\n"); ++ return -1; ++ } ++ memset(output->dumb[0]->map, 0, output->dumb[0]->size); ++ ++ if (gl_renderer->output_stream_create(&output->base, ~0u, ++ output->crtc_id) < 0) { ++ weston_log("failed to create gl renderer output stream " ++ "state\n"); ++ drm_fb_unref(output->dumb[0]); ++ output->dumb[0] = 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 { ++ uint32_t format[2] = { + output->gbm_format, + fallback_format_for(output->gbm_format), +- }; +- struct gl_renderer_output_options options = { ++ }; ++ struct gl_renderer_output_options options = { + .drm_formats = format, + .drm_formats_count = 1, - }; -- unsigned n_formats = 1; - struct weston_mode *mode = output->base.current_mode; - struct drm_plane *plane = output->scanout_plane; - unsigned int i; -- ++ }; ++ struct weston_mode *mode = output->base.current_mode; ++ struct drm_plane *plane = output->scanout_plane; ++ unsigned int i; + - assert(output->gbm_surface == NULL); -- ++ assert(output->gbm_surface == NULL); + - for (i = 0; i < plane->count_formats; i++) { -- if (plane->formats[i].format == output->gbm_format) ++ for (i = 0; i < plane->count_formats; i++) { + if (plane->formats[i].format == output->gbm_format) - break; - } -- ++ 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 ++ } + + #ifdef HAVE_GBM_MODIFIERS - if (plane->formats[i].count_modifiers > 0) { -- output->gbm_surface = ++ if (plane->formats[i].count_modifiers > 0) { + output->gbm_surface = - gbm_surface_create_with_modifiers(b->gbm, - mode->width, - mode->height, @@ -226,127 +290,58 @@ index 324c2a83..52a6766f 100644 - * 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 ++ 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); ++ { + 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 (b->use_egldevice) { -+ int w = output->base.current_mode->width; -+ int h = output->base.current_mode->height; -+ -+ /* Create a black dumb fb for modesetting */ -+ output->dumb[0] = drm_fb_create_dumb(b, w, h, -+ DRM_FORMAT_XRGB8888); -+ if (!output->dumb[0]) { -+ weston_log("failed to create dumb framebuffer\n"); -+ return -1; -+ } -+ memset(output->dumb[0]->map, 0, output->dumb[0]->size); -+ -+ if (gl_renderer->output_stream_create(&output->base, ~0u, -+ output->crtc_id) < 0) { -+ weston_log("failed to create gl renderer output stream " -+ "state\n"); -+ drm_fb_unref(output->dumb[0]); -+ output->dumb[0] = NULL; -+ return -1; -+ } - -- 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 { -+ uint32_t format[2] = { -+ output->gbm_format, -+ fallback_format_for(output->gbm_format), -+ }; -+ 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 (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; -+ } -+ -+ drm_output_init_cursor_egl(output, b); - } ++ } + +- if (options.drm_formats[1]) ++ if (options.drm_formats[1]) + options.drm_formats_count = 2; +- options.window_for_legacy = (EGLNativeWindowType) output->gbm_surface; +- options.window_for_platform = output->gbm_surface; +- if (gl_renderer->output_window_create(&output->base, &options) < 0) { ++ options.window_for_legacy = (EGLNativeWindowType) output->gbm_surface; ++ options.window_for_platform = output->gbm_surface; ++ if (gl_renderer->output_window_create(&output->base, &options) < 0) { + weston_log("failed to create gl renderer output state\n"); + gbm_surface_destroy(output->gbm_surface); + output->gbm_surface = NULL; + return -1; +- } ++ } - drm_output_init_cursor_egl(output, b); -- ++ drm_output_init_cursor_egl(output, b); ++ } + return 0; } - -@@ -256,8 +342,9 @@ drm_output_fini_egl(struct drm_output *output) +@@ -258,14 +338,23 @@ 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 && @@ -355,10 +350,7 @@ index 324c2a83..52a6766f 100644 + ((output->scanout_plane->state_cur->fb && + output->scanout_plane->state_cur->fb->type == BUFFER_GBM_SURFACE) || + b->use_egldevice)) { - drm_plane_state_free(output->scanout_plane->state_cur, true); - output->scanout_plane->state_cur = - drm_plane_state_alloc(NULL, output->scanout_plane); -@@ -265,8 +352,16 @@ drm_output_fini_egl(struct drm_output *output) + drm_plane_reset_state(output->scanout_plane); } gl_renderer->output_destroy(&output->base); @@ -377,7 +369,7 @@ index 324c2a83..52a6766f 100644 drm_output_fini_cursor_egl(output); } -@@ -280,22 +375,25 @@ drm_output_render_gl(struct drm_output_state *state, pixman_region32_t *damage) +@@ -279,22 +368,25 @@ drm_output_render_gl(struct drm_output_state *state, pixman_region32_t *damage) output->base.compositor->renderer->repaint_output(&output->base, damage); @@ -418,7 +410,7 @@ index 324c2a83..52a6766f 100644 return ret; } -@@ -316,11 +414,20 @@ switch_to_gl_renderer(struct drm_backend *b) +@@ -315,11 +407,20 @@ switch_to_gl_renderer(struct drm_backend *b) weston_log("Switching to GL renderer\n"); @@ -444,7 +436,7 @@ index 324c2a83..52a6766f 100644 } wl_list_for_each(output, &b->compositor->output_list, base.link) -@@ -329,7 +436,8 @@ switch_to_gl_renderer(struct drm_backend *b) +@@ -328,7 +429,8 @@ switch_to_gl_renderer(struct drm_backend *b) b->compositor->renderer->destroy(b->compositor); if (drm_backend_create_gl_renderer(b) < 0) { @@ -455,7 +447,7 @@ index 324c2a83..52a6766f 100644 /* FIXME: we need a function to shutdown cleanly */ assert(0); diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h -index 2384a9ac..002c0deb 100644 +index 06f952f2..8bc9c92b 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -60,6 +60,17 @@ @@ -476,7 +468,7 @@ index 2384a9ac..002c0deb 100644 #ifndef DRM_CLIENT_CAP_ASPECT_RATIO #define DRM_CLIENT_CAP_ASPECT_RATIO 4 #endif -@@ -253,6 +264,9 @@ struct drm_backend { +@@ -262,6 +273,9 @@ struct drm_backend { struct wl_listener session_listener; uint32_t gbm_format; @@ -487,21 +479,20 @@ index 2384a9ac..002c0deb 100644 * 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 +index 94a2bf2a..94246bb2 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; - +@@ -390,7 +390,8 @@ drm_output_render(struct drm_output_state *state, pixman_region32_t *damage) + * the damaged region into the renderer to re-render the affected + * area. + */ - 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, + scanout_plane->state_cur->fb->type == BUFFER_PIXMAN_DUMB)) { +@@ -2798,6 +2799,11 @@ recorder_binding(struct weston_keyboard *keyboard, const struct timespec *time, struct drm_output *output; int width, height; @@ -513,7 +504,7 @@ index bbce70e5..c85497d8 100644 output = container_of(b->compositor->output_list.next, struct drm_output, base.link); -@@ -2846,6 +2853,13 @@ drm_backend_create(struct weston_compositor *compositor, +@@ -2879,6 +2885,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; @@ -525,10 +516,10 @@ index bbce70e5..c85497d8 100644 +#endif + } - b->debug = weston_compositor_add_log_scope(compositor->weston_log_ctx, - "drm-backend", + b->debug = weston_compositor_add_log_scope(compositor, "drm-backend", + "Debug messages from DRM/KMS backend\n", diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c -index 192435c7..c70fd853 100644 +index c91e3810..0033dba2 100644 --- a/libweston/backend-drm/kms.c +++ b/libweston/backend-drm/kms.c @@ -42,6 +42,11 @@ @@ -543,7 +534,7 @@ index 192435c7..c70fd853 100644 #ifndef DRM_FORMAT_MOD_LINEAR #define DRM_FORMAT_MOD_LINEAR 0 #endif -@@ -736,9 +741,19 @@ drm_output_apply_state_legacy(struct drm_output_state *state) +@@ -752,9 +757,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"); @@ -566,9 +557,9 @@ index 192435c7..c70fd853 100644 weston_log("queueing pageflip failed: %s\n", strerror(errno)); goto err; } -@@ -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"); +@@ -1468,7 +1483,7 @@ init_kms_caps(struct drm_backend *b) + b->universal_planes = (ret == 0); + } - if (b->universal_planes && !getenv("WESTON_DISABLE_ATOMIC")) { + if (b->universal_planes && !getenv("WESTON_DISABLE_ATOMIC") && !b->use_egldevice) { @@ -576,64 +567,96 @@ index 192435c7..c70fd853 100644 if (ret != 0) cap = 0; diff --git a/libweston/backend-headless/headless.c b/libweston/backend-headless/headless.c -index c98bdc24..a482e1c8 100644 +index c312a0f2..94f4e998 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) { +@@ -396,6 +396,7 @@ headless_gl_renderer_init(struct headless_backend *b) + .egl_platform = EGL_PLATFORM_SURFACELESS_MESA, + .egl_native_display = EGL_DEFAULT_DISPLAY, + .egl_surface_type = EGL_PBUFFER_BIT, ++ .egl_platform_attribs = NULL, + .drm_formats = headless_formats, + .drm_formats_count = ARRAY_LENGTH(headless_formats), + }; diff --git a/libweston/backend-wayland/wayland.c b/libweston/backend-wayland/wayland.c -index 42af0c80..71a6865a 100644 +index 60d42bf3..a8bca921 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) { +@@ -2781,6 +2781,7 @@ wayland_backend_create(struct weston_compositor *compositor, + .egl_platform = EGL_PLATFORM_WAYLAND_KHR, + .egl_native_display = b->parent.wl_display, + .egl_surface_type = EGL_WINDOW_BIT, ++ .egl_platform_attribs = NULL, + .drm_formats = wayland_formats, + .drm_formats_count = ARRAY_LENGTH(wayland_formats), + }; diff --git a/libweston/backend-x11/x11.c b/libweston/backend-x11/x11.c -index 5fda0568..ff3e762b 100644 +index 387e97a4..46af8f02 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)); +@@ -1806,6 +1806,7 @@ init_gl_renderer(struct x11_backend *b) + .egl_platform = EGL_PLATFORM_X11_KHR, + .egl_native_display = b->dpy, + .egl_surface_type = EGL_WINDOW_BIT, ++ .egl_platform_attribs = NULL, + .drm_formats = x11_formats, + .drm_formats_count = ARRAY_LENGTH(x11_formats), + }; +diff --git a/libweston/renderer-gl/egl-glue.c b/libweston/renderer-gl/egl-glue.c +index abe10b46..c1fa17d8 100644 +--- a/libweston/renderer-gl/egl-glue.c ++++ b/libweston/renderer-gl/egl-glue.c +@@ -457,7 +457,8 @@ gl_renderer_get_egl_config(struct gl_renderer *gr, + + int + gl_renderer_setup_egl_display(struct gl_renderer *gr, +- void *native_display) ++ void *native_display, ++ const EGLint *attribs) + { + gr->egl_display = NULL; + +@@ -465,7 +466,7 @@ gl_renderer_setup_egl_display(struct gl_renderer *gr, + if (gr->has_platform_base) + gr->egl_display = gr->get_platform_display(gr->platform, + native_display, +- NULL); ++ attribs); + + if (!gr->egl_display) { + weston_log("warning: either no EGL_EXT_platform_base " +diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h +index 5b0bd4b5..ae76a81e 100644 +--- a/libweston/renderer-gl/gl-renderer-internal.h ++++ b/libweston/renderer-gl/gl-renderer-internal.h +@@ -171,7 +171,9 @@ gl_renderer_get_egl_config(struct gl_renderer *gr, + unsigned drm_formats_count); + + int +-gl_renderer_setup_egl_display(struct gl_renderer *gr, void *native_display); ++gl_renderer_setup_egl_display(struct gl_renderer *gr, ++ void *native_display, ++ const EGLint *attribs); + + int + gl_renderer_setup_egl_client_extensions(struct gl_renderer *gr); diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c -index 1b6a219b..c081d1e5 100644 +index f834a7cb..19a2e730 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); - } - } +@@ -3800,7 +3800,9 @@ gl_renderer_display_create(struct weston_compositor *ec, + gl_renderer_surface_get_content_size; + gr->base.surface_copy_content = gl_renderer_surface_copy_content; + +- if (gl_renderer_setup_egl_display(gr, options->egl_native_display) < 0) ++ if (gl_renderer_setup_egl_display(gr, ++ options->egl_native_display, ++ options->egl_platform_attribs) < 0) + goto fail; + log_egl_info(gr->egl_display); diff --git a/libweston/renderer-gl/gl-renderer.h b/libweston/renderer-gl/gl-renderer.h -index ecf7368d..4fdc6b3f 100644 +index f46c21c6..8ad069d9 100644 --- a/libweston/renderer-gl/gl-renderer.h +++ b/libweston/renderer-gl/gl-renderer.h @@ -49,6 +49,7 @@ typedef intptr_t EGLNativeWindowType; @@ -644,14 +667,14 @@ index ecf7368d..4fdc6b3f 100644 #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); +@@ -71,6 +72,7 @@ struct gl_renderer_display_options { + void *egl_native_display; + /** EGL_SURFACE_TYPE bits for the base EGLConfig */ + EGLint egl_surface_type; ++ const EGLint *egl_platform_attribs; + /** Array of DRM pixel formats acceptable for the base EGLConfig */ + const uint32_t *drm_formats; + /** The \c drm_formats array length */ diff --git a/shared/weston-egl-ext.h b/shared/weston-egl-ext.h index d348a5c0..30e4eaba 100644 --- a/shared/weston-egl-ext.h @@ -680,5 +703,5 @@ index d348a5c0..30e4eaba 100644 #endif -- -2.20.1 +2.25.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 ade334559052..c157188ec6f9 100644 --- a/0006-compositor-Process-stream-attach-requests-with-wl_eg.patch +++ b/0006-compositor-Process-stream-attach-requests-with-wl_eg.patch @@ -1,4 +1,4 @@ -From e4f2e3aa56b3f8801dc056f9e015a7ec7e347113 Mon Sep 17 00:00:00 2001 +From 0e3bba550aa51972f92a78ae9b9cbfd0a7adc126 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/6] compositor: Process stream attach requests with @@ -33,16 +33,16 @@ Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com> --- compositor/meson.build | 1 + include/libweston/libweston.h | 4 + - libweston/compositor.c | 78 +++++++++++++++ + libweston/compositor.c | 80 ++++++++++++++- libweston/renderer-gl/gl-renderer.c | 146 ++++++++++++++++++---------- protocol/meson.build | 7 ++ - 5 files changed, 182 insertions(+), 54 deletions(-) + 5 files changed, 183 insertions(+), 55 deletions(-) diff --git a/compositor/meson.build b/compositor/meson.build -index e1334d6a..5fffeda8 100644 +index 9dc95f3f..0d35aa53 100644 --- a/compositor/meson.build +++ b/compositor/meson.build -@@ -9,6 +9,7 @@ srcs_weston = [ +@@ -10,6 +10,7 @@ srcs_weston = [ input_method_unstable_v1_protocol_c, weston_screenshooter_server_protocol_h, weston_screenshooter_protocol_c, @@ -51,10 +51,10 @@ index e1334d6a..5fffeda8 100644 deps_weston = [ dep_libshared, diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h -index dc54b170..3b3ffb41 100644 +index d036c5bb..b83c04f5 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h -@@ -912,6 +912,10 @@ struct weston_renderer { +@@ -919,6 +919,10 @@ struct weston_renderer { void (*query_dmabuf_modifiers)(struct weston_compositor *ec, int format, uint64_t **modifiers, int *num_modifiers); @@ -66,7 +66,7 @@ index dc54b170..3b3ffb41 100644 enum weston_capability { diff --git a/libweston/compositor.c b/libweston/compositor.c -index dbc64927..f316902b 100644 +index 7fd4cc1e..e1cf4338 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -3,6 +3,7 @@ @@ -85,7 +85,7 @@ index dbc64927..f316902b 100644 #include "weston-log-internal.h" -@@ -6911,6 +6913,80 @@ bind_presentation(struct wl_client *client, +@@ -7042,6 +7044,80 @@ bind_presentation(struct wl_client *client, wp_presentation_send_clock_id(resource, compositor->presentation_clock); } @@ -166,17 +166,19 @@ index dbc64927..f316902b 100644 static void compositor_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id) -@@ -7278,6 +7354,8 @@ weston_compositor_create(struct wl_display *display, +@@ -7392,7 +7468,9 @@ weston_compositor_create(struct wl_display *display, ec, bind_presentation)) goto fail; +- if (weston_input_init(ec) != 0) + init_eglstream_controller(ec->wl_display); + - if (weston_log_ctx_compositor_setup(ec, log_ctx) < 0) ++ if (weston_input_init(ec) != 0) goto fail; + wl_list_init(&ec->view_list); diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c -index c081d1e5..4430bc4b 100644 +index 19a2e730..56a6c052 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -1,7 +1,7 @@ @@ -188,7 +190,7 @@ index c081d1e5..4430bc4b 100644 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the -@@ -2547,18 +2547,9 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface, +@@ -2639,18 +2639,9 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface, gs->shader = image->shader; } @@ -210,7 +212,7 @@ index c081d1e5..4430bc4b 100644 { #ifdef EGL_NV_stream_attrib struct weston_compositor *ec = es->compositor; -@@ -2567,65 +2558,110 @@ gl_renderer_attach_stream_texture(struct weston_surface *es, +@@ -2659,65 +2650,110 @@ gl_renderer_attach_stream_texture(struct weston_surface *es, EGLStreamKHR stream = EGL_NO_STREAM_KHR; EGLAttrib stream_attribs[] = { #ifdef EGL_WL_wayland_eglstream @@ -362,15 +364,15 @@ index c081d1e5..4430bc4b 100644 } /* At this point we should have a valid stream handle */ -@@ -3796,6 +3832,8 @@ gl_renderer_display_create(struct weston_compositor *ec, +@@ -3799,6 +3835,8 @@ gl_renderer_display_create(struct weston_compositor *ec, + gr->base.surface_get_content_size = 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; ++ gl_renderer_attach_eglstream_consumer; - /* extension_suffix is supported */ + if (gl_renderer_setup_egl_display(gr, + options->egl_native_display, diff --git a/protocol/meson.build b/protocol/meson.build index 25cea5a8..1a42ee64 100644 --- a/protocol/meson.build @@ -404,5 +406,5 @@ index 25cea5a8..1a42ee64 100644 base_file = proto_name xml_path = '@0@/stable/@1@/@1@.xml'.format(dir_wp_base, base_file) -- -2.20.1 +2.25.1 @@ -6,8 +6,8 @@ # Contributor: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> pkgname=weston-eglstream -pkgver=8.0.0 -pkgrel=2 +pkgver=9.0.0 +pkgrel=1 pkgdesc='Reference implementation of a Wayland compositor with EGLStream support' arch=('x86_64') url='https://wayland.freedesktop.org/' @@ -25,13 +25,13 @@ source=("https://wayland.freedesktop.org/releases/weston-$pkgver.tar.xz" '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') -sha256sums=('7518b49b2eaa1c3091f24671bdcc124fd49fc8f1af51161927afa4329c027848' - '8d644af0432944ec0c8710f3d31ffdccb8a0661683247743df08915cf9670915' - 'bbfc35859b4561ddaee39077c1b449c729ce6e691193a64090b44746bc46d587' - '0e2616445c720fc23137feffc6148f891648e3ab8a52f6790cf484b0b39d7fe2' - '557aa28b89b18c4fb28ea7ab56dd6f3580dbc44d6ae0a983b8b615eab5bf00b1' - '36e9d9a317c32e61910465394977c8a35bf94afe97a11e56476ea7ff1e8d708a' - 'dc64ac1cacac8dea668644a2a64aeaf3123983dcc61bf5b993bbd48dbc4f69ef') +sha256sums=('5cf5d6ce192e0eb15c1fc861a436bf21b5bb3b91dbdabbdebe83e1f83aa098fe' + '39eb26160b63183f35e5c50bea8cc10248fe194ab96b2cb9417990e5ed45fa1a' + '55ee7aaed84cdc75cc58919a3ec71c7b2cfdbcf936a5f6c8f07f54376b9cc3a5' + 'c971abb2b84d9b2519c08aacbd3a4afc44d31bf0970d3bc71e48cca850a9765f' + 'ac1c048f6944b1ddd24c17205a7bd8f55578af5489d2f9ca7121727b0cbacc68' + '5898de8565d3c449fb276f9e3b1ae1bb9e908e8153e0802989a49baa8d1d134a' + '5834b4b0068cc0debe5bc20cddafd17f9ca4cb472035716da3942401a130ccc8') prepare() { cd weston-$pkgver |