weston: drop weston 10.0.2 recipe and bbappend

Signed-off-by: Matt Madison <matt@madison.systems>
This commit is contained in:
Matt Madison
2024-05-11 07:54:11 -07:00
parent fd15e19dc5
commit db466146df
10 changed files with 0 additions and 1026 deletions

View File

@@ -1,33 +0,0 @@
From 8eec4e961f1e36bedcb057bf76f9c1febb6524cb Mon Sep 17 00:00:00 2001
From: Matt Madison <matt@madison.systems>
Date: Mon, 14 Feb 2022 08:38:55 -0800
Subject: [PATCH] Drop DRM version check in meson.build
The NVIDIA libdrm that we drop in at runtime doesn't
support the feature that weston is looking for, but
the version it checks at build time is real libdrm,
not ours, so just drop the check entirely for tegra
builds.
Signed-off-by: Matt Madison <matt@madison.systems>
---
meson.build | 6 ------
1 file changed, 6 deletions(-)
diff --git a/meson.build b/meson.build
index 7b80214..b1295be 100644
--- a/meson.build
+++ b/meson.build
@@ -156,12 +156,6 @@ dep_libdrm = dependency('libdrm', version: '>= 2.4.95')
dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true)
dep_threads = dependency('threads')
-dep_libdrm_version = dep_libdrm.version()
-if dep_libdrm_version.version_compare('>=2.4.107')
- message('Found libdrm with human format modifier support.')
- config_h.set('HAVE_HUMAN_FORMAT_MODIFIER', '1')
-endif
-
prog_python = import('python').find_installation('python3')
files_xxd_py = files('tools/xxd.py')
cmd_xxd = [ prog_python, files_xxd_py, '@INPUT@', '@OUTPUT@' ]

View File

@@ -1,72 +0,0 @@
From 50a44ee682360fc9793e74aea86f53efe8286094 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 14 Dec 2023 09:13:54 -0800
Subject: [PATCH] libweston,tools: Include libgen.h for basename signature
Latest musl has removed the declaration from string.h [1] as it only
implements POSIX version alone and string.h in glibc implements GNU
version of basename. This now results in compile errors on musl.
This might be a warning with older compilers but it is error with
Clang-17+ as it treats -Wimplicit-function-declaration as error
Switch the use in backlight_init function to use POSIX version
[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
Upstream-Status: Submitted [https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1420]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libweston/backend-drm/libbacklight.c | 8 +++++---
tools/zunitc/src/zunitc_impl.c | 1 +
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/libweston/backend-drm/libbacklight.c b/libweston/backend-drm/libbacklight.c
index ca7f2d68..973d15ff 100644
--- a/libweston/backend-drm/libbacklight.c
+++ b/libweston/backend-drm/libbacklight.c
@@ -41,6 +41,7 @@
#include <drm.h>
#include <fcntl.h>
#include <malloc.h>
+#include <libgen.h>
#include <string.h>
#include <errno.h>
@@ -167,7 +168,7 @@ struct backlight *backlight_init(struct udev_device *drm_device,
DIR *backlights = NULL;
struct dirent *entry;
enum backlight_type type = 0;
- char buffer[100];
+ char buffer[100], basename_buffer[100];
struct backlight *backlight = NULL;
int ret;
@@ -186,9 +187,10 @@ struct backlight *backlight_init(struct udev_device *drm_device,
free(path);
if (ret < 0)
return NULL;
-
+ strncpy(basename_buffer, buffer, ret);
buffer[ret] = '\0';
- pci_name = basename(buffer);
+ basename_buffer[ret] = '\0';
+ pci_name = basename(basename_buffer);
if (connector_type <= 0)
return NULL;
diff --git a/tools/zunitc/src/zunitc_impl.c b/tools/zunitc/src/zunitc_impl.c
index 18f03015..9b460fa0 100644
--- a/tools/zunitc/src/zunitc_impl.c
+++ b/tools/zunitc/src/zunitc_impl.c
@@ -27,6 +27,7 @@
#include <errno.h>
#include <fcntl.h>
+#include <libgen.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
--
2.43.0

View File

@@ -1,334 +0,0 @@
From 04062356483f6e15c259a969fd8ecffdc1a05535 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] gl-renderer: Add EGL client support for EGLStream frame
presentation
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
compositor to prepare the final frame to be presented.
This change adds required logic to support presentation approach
described above.
Note that some unpublished EGL extensions were needed:
- EGL_NV_stream_attrib:
https://github.com/aritger/eglstreams-kms-example/blob/master/proposed-extensions/EGL_NV_stream_attrib.txt
- EGL_WL_wayland_eglstream:
https://github.com/aritger/eglstreams-kms-example/blob/master/proposed-extensions/EGL_WL_wayland_eglstream.txt
[ekurzinger: - Try realizing EGLStream before EGLImage buffer since
libnvidia-egl-wayland now reports EGL_TEXTURE_FORMAT]
Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
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 | 20 +++
libweston/renderer-gl/gl-renderer-internal.h | 15 ++
libweston/renderer-gl/gl-renderer.c | 157 +++++++++++++++++++
shared/weston-egl-ext.h | 21 +++
4 files changed, 213 insertions(+)
diff --git a/libweston/renderer-gl/egl-glue.c b/libweston/renderer-gl/egl-glue.c
index 013172a..f6e1038 100644
--- a/libweston/renderer-gl/egl-glue.c
+++ b/libweston/renderer-gl/egl-glue.c
@@ -650,6 +650,17 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
(void *) eglGetProcAddress("eglQueryWaylandBufferWL");
gr->set_damage_region =
(void *) eglGetProcAddress("eglSetDamageRegionKHR");
+ gr->create_stream = (void *) eglGetProcAddress("eglCreateStreamKHR");
+ gr->destroy_stream = (void *) eglGetProcAddress("eglDestroyStreamKHR");
+ gr->query_stream = (void *) eglGetProcAddress("eglQueryStreamKHR");
+#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);
@@ -739,5 +750,14 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
"to missing EGL_KHR_wait_sync extension\n");
}
+ if (weston_check_egl_extension(extensions, "EGL_NV_stream_attrib"))
+ gr->has_egl_stream_attrib = 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;
+
return 0;
}
diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h
index 72101b4..d6f5e74 100644
--- a/libweston/renderer-gl/gl-renderer-internal.h
+++ b/libweston/renderer-gl/gl-renderer-internal.h
@@ -155,6 +155,21 @@ struct gl_renderer {
struct wl_list dmabuf_formats;
bool has_texture_type_2_10_10_10_rev;
+
+ PFNEGLCREATESTREAMKHRPROC create_stream;
+ PFNEGLDESTROYSTREAMKHRPROC destroy_stream;
+ PFNEGLQUERYSTREAMKHRPROC query_stream;
+
+#ifdef EGL_NV_stream_attrib
+ PFNEGLCREATESTREAMATTRIBNVPROC create_stream_attrib;
+ PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC stream_consumer_acquire_attrib;
+#endif
+ bool has_egl_stream_attrib;
+
+ PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC stream_consumer_gltexture;
+ bool has_egl_stream_consumer_gltexture;
+ bool has_egl_wayland_eglstream;
+
bool has_gl_texture_rg;
struct gl_shader *current_shader;
diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
index a5f5eae..c775077 100644
--- a/libweston/renderer-gl/gl-renderer.c
+++ b/libweston/renderer-gl/gl-renderer.c
@@ -199,6 +199,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.
@@ -2923,6 +2926,145 @@ out:
return ret;
}
+/*
+ * gl_renderer_attach_stream_texture
+ *
+ * Try to bind given <buffer> to an EGLStream. If the given buffer was already
+ * bound, it will acquire next frame on the stream.
+ *
+ * Return true if the given <buffer> corresponds to an EGLStream; otherwise,
+ * return false (if might be another kind of buffer).
+ */
+static bool
+gl_renderer_attach_stream_texture(struct weston_surface *es,
+ struct weston_buffer *buffer)
+{
+#ifdef EGL_NV_stream_attrib
+ struct weston_compositor *ec = es->compositor;
+ struct gl_renderer *gr = get_renderer(ec);
+ struct gl_surface_state *gs = get_surface_state(es);
+ EGLStreamKHR stream = EGL_NO_STREAM_KHR;
+ EGLAttrib stream_attribs[] = {
+#ifdef EGL_WL_wayland_eglstream
+ EGL_WAYLAND_EGLSTREAM_WL, (EGLAttrib)buffer->resource,
+#endif
+ EGL_NONE
+ };
+ EGLint stream_state = EGL_STREAM_STATE_EMPTY_KHR;
+
+ /* Check for required extensions. If they arent supported, there's no
+ * way the given buffer corresponds to an EGLStream */
+ if (!gr->has_egl_stream_attrib ||
+ !gr->has_egl_stream_consumer_gltexture ||
+ !gr->has_egl_wayland_eglstream)
+ return false;
+
+ stream = gr->create_stream_attrib(gr->egl_display, stream_attribs);
+ if (stream == EGL_NO_STREAM_KHR) {
+ EGLint err = eglGetError();
+
+ switch (err) {
+ case EGL_BAD_ACCESS:
+ /* EGL_BAD_ACCESS is generated whenever buffer->resource
+ * does not corresponds to a stream */
+ return false;
+
+ case EGL_BAD_STREAM_KHR:
+ /* EGL_BAD_STREAM_KHR is generated whenever
+ * buffer->resource corresponds to a previously created
+ * stream so we must have a valid stream handle already
+ * we can use to acquire next frame */
+ break;
+
+ default:
+ /* An unknown error was generated */
+ assert(0);
+ return false;
+ }
+ } else {
+ /* Clean up current stream resources if needed */
+ if (gs->egl_stream != EGL_NO_STREAM_KHR)
+ gr->destroy_stream(gr->egl_display, gs->egl_stream);
+
+ gs->egl_stream = stream;
+ gs->shader_variant = SHADER_VARIANT_EXTERNAL;
+ target = gl_shader_texture_variant_get_target(gs->shader_variant);
+
+ glActiveTexture(GL_TEXTURE0);
+ ensure_textures(gs, target, 1);
+ glBindTexture(target, gs->textures[0]);
+
+ gs->new_stream = (gr->stream_consumer_gltexture(
+ gr->egl_display,
+ gs->egl_stream) == EGL_TRUE);
+
+ if (!gs->new_stream) {
+ weston_log("failed to set stream consumer\n");
+ gl_renderer_print_egl_error_state();
+ gr->destroy_stream(gr->egl_display, gs->egl_stream);
+ gs->egl_stream = EGL_NO_STREAM_KHR;
+ return true; /* buffer->resource is EGLStream */
+ }
+ }
+
+ /* At this point we should have a valid stream handle */
+ assert(gs->egl_stream != EGL_NO_STREAM_KHR);
+
+ /* Check whether there are new frames available */
+ if (gr->query_stream(gr->egl_display,
+ gs->egl_stream,
+ EGL_STREAM_STATE_KHR,
+ &stream_state) != EGL_TRUE) {
+ weston_log("failed to query stream state\n");
+ gl_renderer_print_egl_error_state();
+ return true; /* buffer->resource is EGLStream */
+ }
+
+ /* If no new frame available, re-use last one */
+ if (stream_state != EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR) {
+ /* Fake size of last frame */
+ buffer->width = gs->pitch;
+ buffer->height = gs->height;
+ return true; /* buffer->resource is EGLStream */
+ }
+
+ if (gr->stream_consumer_acquire_attrib(gr->egl_display,
+ gs->egl_stream,
+ NULL) != EGL_TRUE) {
+ weston_log("failed to acquire buffer\n");
+ gl_renderer_print_egl_error_state();
+ return true; /* buffer->resource is EGLStream */
+ }
+
+ /* Swap textures if new stream was created */
+ if (gs->new_stream) {
+ GLuint tmp = gs->textures[0];
+
+ gs->textures[0] = gs->textures[1];
+ gs->textures[1] = tmp;
+ gs->new_stream = false;
+ }
+
+ /* Update buffer and surface data */
+ buffer->legacy_buffer = (void *)buffer->resource;
+ gr->query_buffer(gr->egl_display, buffer->legacy_buffer,
+ EGL_WIDTH, &buffer->width);
+ gr->query_buffer(gr->egl_display, buffer->legacy_buffer,
+ EGL_HEIGHT, &buffer->height);
+ gr->query_buffer(gr->egl_display, buffer->legacy_buffer,
+ EGL_WAYLAND_Y_INVERTED_WL, &buffer->y_inverted);
+
+ gs->pitch = buffer->width;
+ gs->height = buffer->height;
+ gs->buffer_type = BUFFER_TYPE_EGL;
+ gs->y_inverted = buffer->y_inverted;
+
+ return true; /* buffer->resource is EGLStream */
+#else
+ return false;
+#endif
+}
+
static void
gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
{
@@ -2950,6 +3092,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) {
+ gr->destroy_stream(gr->egl_display, gs->egl_stream);
+ gs->egl_stream = EGL_NO_STREAM_KHR;
+ }
+
return;
}
@@ -2957,6 +3105,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);
else if (gr->has_bind_display &&
gr->query_buffer(gr->egl_display, (void *)buffer->resource,
EGL_TEXTURE_FORMAT, &format))
@@ -3157,6 +3308,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);
+
+ if (gs->egl_stream != EGL_NO_STREAM_KHR)
+ gr->destroy_stream(gr->egl_display, gs->egl_stream);
+
free(gs);
}
@@ -3208,6 +3363,8 @@ gl_renderer_create_surface(struct weston_surface *surface)
gs->surface = surface;
+ gs->egl_stream = EGL_NO_STREAM_KHR;
+
pixman_region32_init(&gs->texture_damage);
surface->renderer_state = gs;
diff --git a/shared/weston-egl-ext.h b/shared/weston-egl-ext.h
index 822810f..94a8b14 100644
--- a/shared/weston-egl-ext.h
+++ b/shared/weston-egl-ext.h
@@ -240,6 +240,27 @@ typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy,
#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
#endif
+#ifndef EGL_NV_stream_attrib
+#define EGL_NV_stream_attrib 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribNV(EGLDisplay dpy, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribNV(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribNV(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribNV(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribNV(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#endif
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBNVPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
+#endif /* EGL_NV_stream_attrib */
+
+#ifndef EGL_WL_wayland_eglstream
+#define EGL_WL_wayland_eglstream 1
+#define EGL_WAYLAND_EGLSTREAM_WL 0x334B
+#endif /* EGL_WL_wayland_eglstream */
+
#else /* ENABLE_EGL */
/* EGL platform definition are kept to allow compositor-xx.c to build */

View File

@@ -1,402 +0,0 @@
From 82ae29c900f5715a4f0b0b028d709735f6aa1839 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] compositor: Process stream attach requests with
wl_eglstream_controller
So far, the EGLStream implementation of the Wayland client-side driver
has been using wl_surface_attach + commit in order to make the server
create its stream endpoint and attach a consumer to it.
However, no actual buffer would be actually shared between client and
server, which goes against many of the assumptions behind
wl_surface_attach + commit.
This has caused different interaction issues in the past.
In order to properly resolve this once and for all, a new
wl_eglstream_controller protocol has been added which will let clients
request the compositor to create its stream.
This change adds the required code for weston to create a
wl_eglstream_controller global and process attach_eglstream_consumer
requests.
[mvicomoya: - Dynamically load libnvidia-egl-wayland.so.1 instead linking
against it
- Add wayland-eglstream-protocols package dependency and
generate server header for wayland-eglstream-controller at
build time]
Signed-off-by: Ashutosh Agarwal <asagarwal@nvidia.com>
Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
---
compositor/meson.build | 1 +
include/libweston/libweston.h | 13 +++
libweston/compositor.c | 79 ++++++++++++++-
libweston/renderer-gl/gl-renderer.c | 145 ++++++++++++++++++----------
protocol/meson.build | 7 ++
5 files changed, 191 insertions(+), 54 deletions(-)
diff --git a/compositor/meson.build b/compositor/meson.build
index 8a54ea9..e1878be 100644
--- a/compositor/meson.build
+++ b/compositor/meson.build
@@ -9,6 +9,7 @@ srcs_weston = [
input_method_unstable_v1_protocol_c,
weston_screenshooter_server_protocol_h,
weston_screenshooter_protocol_c,
+ wayland_eglstream_controller_server_protocol_h,
]
deps_weston = [
dep_libshared,
diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h
index d99dc76..8d87dc4 100644
--- a/include/libweston/libweston.h
+++ b/include/libweston/libweston.h
@@ -968,6 +968,19 @@ struct weston_renderer {
const struct weston_drm_format_array *
(*get_supported_formats)(struct weston_compositor *ec);
+
+ /** On error sets num_formats to zero */
+ void (*query_dmabuf_formats)(struct weston_compositor *ec,
+ int **formats, int *num_formats);
+
+ /** On error sets num_modifiers to zero */
+ void (*query_dmabuf_modifiers)(struct weston_compositor *ec,
+ int format, uint64_t **modifiers,
+ int *num_modifiers);
+
+ /** Create weston endpoint of an EGLStream & attach a consumer to it */
+ bool (*attach_eglstream_consumer)(struct weston_surface *es,
+ struct wl_resource *wl_eglstream);
};
enum weston_capability {
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 1670c50..c5d9828 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -76,6 +76,7 @@
#include "backend.h"
#include "libweston-internal.h"
#include "color.h"
+#include "wayland-eglstream-controller-server-protocol.h"
#include "weston-log-internal.h"
@@ -7422,6 +7423,80 @@ bind_presentation(struct wl_client *client,
wp_presentation_send_clock_id(resource, compositor->presentation_clock);
}
+static struct wl_interface *eglstream_controller_interface = NULL;
+
+static void
+attach_eglstream_consumer(struct wl_client *client,
+ struct wl_resource *resource,
+ struct wl_resource *wl_surface,
+ struct wl_resource *wl_eglstream)
+{
+ struct weston_surface *surface =
+ wl_resource_get_user_data(wl_surface);
+
+ surface->compositor->renderer->attach_eglstream_consumer(surface,
+ wl_eglstream);
+}
+
+static const struct wl_eglstream_controller_interface
+eglstream_controller_implementation = {
+ attach_eglstream_consumer
+};
+
+static void
+bind_eglstream_controller(struct wl_client *client,
+ void *data, uint32_t version, uint32_t id)
+{
+ struct wl_resource *resource;
+
+ resource = wl_resource_create(client, eglstream_controller_interface,
+ version, id);
+
+ if (resource == NULL) {
+ wl_client_post_no_memory(client);
+ return;
+ }
+ wl_resource_set_implementation(resource,
+ &eglstream_controller_implementation,
+ data,
+ NULL);
+}
+
+static void
+init_eglstream_controller(struct wl_display *display)
+{
+ /*
+ * wl_eglstream_controller_interface is provided by
+ * libnvidia-egl-wayland.so.1
+ *
+ * Since it might not be available on the
+ * system, dynamically load it at runtime and resolve the needed
+ * symbols. If available, it should be found under any of the search
+ * directories of dlopen()
+ *
+ * Failure to initialize wl_eglstream_controller is non-fatal
+ */
+
+ void *lib = dlopen("libnvidia-egl-wayland.so.1", RTLD_NOW | RTLD_LAZY);
+ if (!lib)
+ goto fail;
+
+ eglstream_controller_interface =
+ dlsym(lib, "wl_eglstream_controller_interface");
+
+ if (!eglstream_controller_interface)
+ goto fail;
+
+ if (wl_global_create(display,
+ eglstream_controller_interface, 1,
+ NULL, bind_eglstream_controller))
+ return; /* success */
+fail:
+ if (lib)
+ dlclose(lib);
+ weston_log("warning: Unable to initialize wl_eglstream_controller.\n");
+}
+
static void
compositor_bind(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
@@ -7799,7 +7874,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_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 c775077..67c8a57 100644
--- a/libweston/renderer-gl/gl-renderer.c
+++ b/libweston/renderer-gl/gl-renderer.c
@@ -2926,85 +2926,122 @@ out:
return ret;
}
-/*
- * gl_renderer_attach_stream_texture
- *
- * Try to bind given <buffer> to an EGLStream. If the given buffer was already
- * bound, it will acquire next frame on the stream.
- *
- * Return true if the given <buffer> corresponds to an EGLStream; otherwise,
- * return false (if might be another kind of buffer).
- */
-static bool
-gl_renderer_attach_stream_texture(struct weston_surface *es,
- struct weston_buffer *buffer)
+static EGLint
+gl_renderer_attach_eglstream_consumer_common(struct weston_surface *es,
+ struct wl_resource *wl_eglstream)
{
#ifdef EGL_NV_stream_attrib
struct weston_compositor *ec = es->compositor;
struct gl_renderer *gr = get_renderer(ec);
struct gl_surface_state *gs = get_surface_state(es);
EGLStreamKHR stream = EGL_NO_STREAM_KHR;
+ GLenum target;
EGLAttrib stream_attribs[] = {
#ifdef EGL_WL_wayland_eglstream
- EGL_WAYLAND_EGLSTREAM_WL, (EGLAttrib)buffer->resource,
+ EGL_WAYLAND_EGLSTREAM_WL, (EGLAttrib)wl_eglstream,
#endif
EGL_NONE
};
- EGLint stream_state = EGL_STREAM_STATE_EMPTY_KHR;
/* Check for required extensions. If they arent supported, there's no
- * way the given buffer corresponds to an EGLStream */
+ * way the given resource corresponds to an EGLStream */
if (!gr->has_egl_stream_attrib ||
!gr->has_egl_stream_consumer_gltexture ||
!gr->has_egl_wayland_eglstream)
- return false;
+ return EGL_BAD_ACCESS;
stream = gr->create_stream_attrib(gr->egl_display, stream_attribs);
- if (stream == EGL_NO_STREAM_KHR) {
+
+ if (stream == EGL_NO_STREAM_KHR)
+ return eglGetError();
+
+ if (gs->egl_stream != EGL_NO_STREAM_KHR)
+ gr->destroy_stream(gr->egl_display, gs->egl_stream);
+
+ gs->egl_stream = stream;
+ gs->shader_variant = SHADER_VARIANT_EXTERNAL;
+ target = gl_shader_texture_variant_get_target(gs->shader_variant);
+
+ glActiveTexture(GL_TEXTURE0);
+ ensure_textures(gs, target, 1);
+ glBindTexture(target, gs->textures[0]);
+
+ gs->new_stream = (gr->stream_consumer_gltexture(
+ gr->egl_display,
+ gs->egl_stream) == EGL_TRUE);
+
+ if (!gs->new_stream) {
EGLint err = eglGetError();
- switch (err) {
- case EGL_BAD_ACCESS:
- /* EGL_BAD_ACCESS is generated whenever buffer->resource
- * does not corresponds to a stream */
- return false;
+ weston_log("failed to set stream consumer\n");
+ weston_log("EGL error: 0x%04lx\n", (long)err);
- case EGL_BAD_STREAM_KHR:
- /* EGL_BAD_STREAM_KHR is generated whenever
- * buffer->resource corresponds to a previously created
- * stream so we must have a valid stream handle already
- * we can use to acquire next frame */
- break;
+ gr->destroy_stream(gr->egl_display, gs->egl_stream);
+ gs->egl_stream = EGL_NO_STREAM_KHR;
+ return err;
+ }
- default:
- /* An unknown error was generated */
- assert(0);
- return false;
- }
- } else {
- /* Clean up current stream resources if needed */
- if (gs->egl_stream != EGL_NO_STREAM_KHR)
- gr->destroy_stream(gr->egl_display, gs->egl_stream);
+ return EGL_SUCCESS;
+#else
+ return EGL_BAD_ACCESS;
+#endif
+}
- gs->egl_stream = stream;
- gs->shader_variant = SHADER_VARIANT_EXTERNAL;
- target = gl_shader_texture_variant_get_target(gs->shader_variant);
+static bool
+gl_renderer_attach_eglstream_consumer(struct weston_surface *es,
+ struct wl_resource *stream)
+{
+ EGLint err = gl_renderer_attach_eglstream_consumer_common(es, stream);
+ return (err == EGL_SUCCESS);
+}
+
+/*
+ * gl_renderer_attach_stream_texture
+ *
+ * Try to bind given <buffer> to an EGLStream. If the given buffer was already
+ * bound, it will acquire next frame on the stream.
+ *
+ * Return true if the given <buffer> corresponds to an EGLStream; otherwise,
+ * return false (if might be another kind of buffer).
+ */
+static bool
+gl_renderer_attach_stream_texture(struct weston_surface *es,
+ struct weston_buffer *buffer)
+{
+#ifdef EGL_NV_stream_attrib
+ struct weston_compositor *ec = es->compositor;
+ struct gl_renderer *gr = get_renderer(ec);
+ struct gl_surface_state *gs = get_surface_state(es);
+ EGLint stream_state = EGL_STREAM_STATE_EMPTY_KHR;
- glActiveTexture(GL_TEXTURE0);
- ensure_textures(gs, target, 1);
- glBindTexture(target, gs->textures[0]);
+ EGLint err;
- gs->new_stream = (gr->stream_consumer_gltexture(
- gr->egl_display,
- gs->egl_stream) == EGL_TRUE);
+ err = gl_renderer_attach_eglstream_consumer_common(es, buffer->resource);
- if (!gs->new_stream) {
- weston_log("failed to set stream consumer\n");
- gl_renderer_print_egl_error_state();
- gr->destroy_stream(gr->egl_display, gs->egl_stream);
- gs->egl_stream = EGL_NO_STREAM_KHR;
- return true; /* buffer->resource is EGLStream */
- }
+ switch (err) {
+ case EGL_BAD_ACCESS:
+ /* EGL_BAD_ACCESS is generated whenever buffer->resource
+ * does not corresponds to a stream */
+ return false;
+
+ case EGL_BAD_STREAM_KHR:
+ /* EGL_BAD_STREAM_KHR is generated whenever
+ * buffer->resource corresponds to a previously created
+ * stream so we must have a valid stream handle already
+ * we can use to acquire next frame */
+ break;
+
+ case EGL_SUCCESS:
+ /* EGL_SUCCESS is returned when the server stream endpoint is
+ * created and a consumer is attached successfully. This path is
+ * hit with old drivers which use wl_surface::attach + commit to
+ * request stream creation. */
+ return true; /* buffer->resource is EGLStream */
+
+ default:
+ /* An unknown error was generated */
+ assert(0);
+ return false;
}
/* At this point we should have a valid stream handle */
@@ -3832,6 +3869,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->base.attach_eglstream_consumer =
+ gl_renderer_attach_eglstream_consumer;
if (gl_renderer_setup_egl_display(gr, options->egl_native_display) < 0)
goto fail;
diff --git a/protocol/meson.build b/protocol/meson.build
index 7d869da..60a0391 100644
--- a/protocol/meson.build
+++ b/protocol/meson.build
@@ -4,6 +4,9 @@ prog_scanner = find_program(dep_scanner.get_pkgconfig_variable('wayland_scanner'
dep_wp = dependency('wayland-protocols', version: '>= 1.24')
dir_wp_base = dep_wp.get_pkgconfig_variable('pkgdatadir')
+dep_wep = dependency('wayland-eglstream-protocols')
+dir_wep_base = dep_wep.get_pkgconfig_variable('pkgdatadir')
+
install_data(
[
'weston-debug.xml',
@@ -37,6 +40,7 @@ generated_protocols = [
[ 'xdg-output', 'v1' ],
[ 'xdg-shell', 'v6' ],
[ 'xdg-shell', 'stable' ],
+ [ 'wayland-eglstream-controller', '3rdparty', dir_wep_base ],
]
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)
+ elif proto[1] == '3rdparty'
+ base_file = proto_name
+ xml_path = '@0@/@1@.xml'.format(proto[2], base_file)
elif proto[1] == 'stable'
base_file = proto_name
xml_path = '@0@/stable/@1@/@1@.xml'.format(dir_wp_base, base_file)

View File

@@ -1,9 +0,0 @@
#!/bin/sh
# SPDX-FileCopyrightText: Huawei Inc.
# SPDX-License-Identifier: Apache-2.0
if [[ -x "/usr/lib/weston/systemd-notify.so" ]]; then
add_weston_module "systemd-notify.so"
fi

View File

@@ -1,9 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=Weston
Comment=Wayland Compostitor
Exec=weston
Icon=weston
Terminal=false
Categories=Utility;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -1,6 +0,0 @@
#!/bin/sh
if type Xwayland >/dev/null 2>/dev/null; then
mkdir -m 775 -p /tmp/.X11-unix
chown root:video /tmp/.X11-unix
fi

View File

@@ -1,144 +0,0 @@
SUMMARY = "Weston, a Wayland compositor"
DESCRIPTION = "Weston is the reference implementation of a Wayland compositor"
HOMEPAGE = "http://wayland.freedesktop.org"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=d79ee9e66bb0f95d3386a7acae780b70 \
file://libweston/compositor.c;endline=27;md5=eb6d5297798cabe2ddc65e2af519bcf0 \
"
SRC_URI = "https://gitlab.freedesktop.org/wayland/weston/-/releases/${PV}/downloads/${BPN}-${PV}.tar.xz \
file://0001-libweston-tools-Include-libgen.h-for-basename-signat.patch \
file://weston.png \
file://weston.desktop \
file://xwayland.weston-start \
file://systemd-notify.weston-start \
"
SRC_URI[sha256sum] = "89646ca0d9f8d413c2767e5c3828eaa3fa149c2a105b3729a6894fa7cf1549e7"
UPSTREAM_CHECK_URI = "https://wayland.freedesktop.org/releases.html"
UPSTREAM_CHECK_REGEX = "weston-(?P<pver>\d+\.\d+\.(?!9\d+)\d+)"
DEFAULT_PREFERENCE = "-1"
inherit meson pkgconfig useradd features_check
REQUIRED_DISTRO_FEATURES = "wayland opengl ${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', 'pam', '', d)}"
DEPENDS = "libxkbcommon gdk-pixbuf pixman cairo glib-2.0"
DEPENDS += "wayland wayland-protocols libinput virtual/egl pango wayland-native"
LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'lto', '-Wl,-z,undefs', '', d)}"
WESTON_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:1])}"
EXTRA_OEMESON += "-Dpipewire=false"
PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'kms wayland egl clients', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', '', d)} \
${@bb.utils.filter('DISTRO_FEATURES', 'systemd x11', d)} \
${@bb.utils.contains_any('DISTRO_FEATURES', 'wayland x11', '', 'headless', d)} \
${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'sysvinit', 'launcher-libseat', '', d)} \
image-jpeg \
screenshare \
shell-desktop \
shell-fullscreen \
shell-ivi"
# Can be 'damage', 'im', 'egl', 'shm', 'touch', 'dmabuf-feedback', 'dmabuf-v4l', 'dmabuf-egl' or 'all'
SIMPLECLIENTS ?= "all"
#
# Compositor choices
#
# Weston on KMS
PACKAGECONFIG[kms] = "-Dbackend-drm=true,-Dbackend-drm=false,drm udev virtual/egl virtual/libgles2 virtual/libgbm mtdev"
# Weston on Wayland (nested Weston)
PACKAGECONFIG[wayland] = "-Dbackend-wayland=true,-Dbackend-wayland=false,virtual/egl virtual/libgles2"
# Weston on X11
PACKAGECONFIG[x11] = "-Dbackend-x11=true,-Dbackend-x11=false,virtual/libx11 libxcb libxcb libxcursor cairo"
# Headless Weston
PACKAGECONFIG[headless] = "-Dbackend-headless=true,-Dbackend-headless=false"
# Weston on framebuffer
PACKAGECONFIG[fbdev] = "-Ddeprecated-backend-fbdev=true,-Ddeprecated-backend-fbdev=false,udev mtdev"
# Weston on RDP
PACKAGECONFIG[rdp] = "-Dbackend-rdp=true,-Dbackend-rdp=false,freerdp"
# weston-launch
PACKAGECONFIG[launch] = "-Ddeprecated-weston-launch=true,-Ddeprecated-weston-launch=false,drm"
# VA-API desktop recorder
PACKAGECONFIG[vaapi] = "-Dbackend-drm-screencast-vaapi=true,-Dbackend-drm-screencast-vaapi=false,libva"
# Weston with EGL support
PACKAGECONFIG[egl] = "-Drenderer-gl=true,-Drenderer-gl=false,virtual/egl"
# Weston with lcms support
PACKAGECONFIG[lcms] = "-Dcolor-management-lcms=true,-Dcolor-management-lcms=false,lcms"
# Weston with webp support
PACKAGECONFIG[webp] = "-Dimage-webp=true,-Dimage-webp=false,libwebp"
# Weston with systemd-login support
PACKAGECONFIG[systemd] = "-Dsystemd=true -Dlauncher-logind=true,-Dsystemd=false -Dlauncher-logind=false,systemd dbus"
# Weston with Xwayland support (requires X11 and Wayland)
PACKAGECONFIG[xwayland] = "-Dxwayland=true,-Dxwayland=false"
# colord CMS support
PACKAGECONFIG[colord] = "-Dcolor-management-colord=true,-Dcolor-management-colord=false,colord"
# Clients support
PACKAGECONFIG[clients] = "-Dsimple-clients=${SIMPLECLIENTS} -Ddemo-clients=true,-Dsimple-clients= -Ddemo-clients=false"
# Virtual remote output with GStreamer on DRM backend
PACKAGECONFIG[remoting] = "-Dremoting=true,-Dremoting=false,gstreamer1.0 gstreamer1.0-plugins-base"
# Weston with screen-share support
PACKAGECONFIG[screenshare] = "-Dscreenshare=true,-Dscreenshare=false"
# Traditional desktop shell
PACKAGECONFIG[shell-desktop] = "-Dshell-desktop=true,-Dshell-desktop=false"
# Fullscreen shell
PACKAGECONFIG[shell-fullscreen] = "-Dshell-fullscreen=true,-Dshell-fullscreen=false"
# In-Vehicle Infotainment (IVI) shell
PACKAGECONFIG[shell-ivi] = "-Dshell-ivi=true,-Dshell-ivi=false"
# JPEG image loading support
PACKAGECONFIG[image-jpeg] = "-Dimage-jpeg=true,-Dimage-jpeg=false, jpeg"
# support libseat based launch
PACKAGECONFIG[launcher-libseat] = "-Dlauncher-libseat=true,-Dlauncher-libseat=false,seatd"
do_install:append() {
# Weston doesn't need the .la files to load modules, so wipe them
rm -f ${D}/${libdir}/libweston-${WESTON_MAJOR_VERSION}/*.la
# If X11, ship a desktop file to launch it
if [ "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" ]; then
install -d ${D}${datadir}/applications
install ${UNPACKDIR}/weston.desktop ${D}${datadir}/applications
install -d ${D}${datadir}/icons/hicolor/48x48/apps
install ${UNPACKDIR}/weston.png ${D}${datadir}/icons/hicolor/48x48/apps
fi
if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then
install -Dm 644 ${UNPACKDIR}/xwayland.weston-start ${D}${datadir}/weston-start/xwayland
fi
if [ "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'yes', 'no', d)}" = "yes" ]; then
install -Dm 644 ${UNPACKDIR}/systemd-notify.weston-start ${D}${datadir}/weston-start/systemd-notify
fi
if [ "${@bb.utils.contains('PACKAGECONFIG', 'launch', 'yes', 'no', d)}" = "yes" ]; then
chmod u+s ${D}${bindir}/weston-launch
fi
}
PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', '${PN}-xwayland', '', d)} \
libweston-${WESTON_MAJOR_VERSION} ${PN}-examples"
FILES:${PN}-dev += "${libdir}/${BPN}/libexec_weston.so"
FILES:${PN} = "${bindir}/weston ${bindir}/weston-terminal ${bindir}/weston-info ${bindir}/weston-launch ${bindir}/wcap-decode ${libexecdir} ${libdir}/${BPN}/*.so* ${datadir}"
FILES:libweston-${WESTON_MAJOR_VERSION} = "${libdir}/lib*${SOLIBS} ${libdir}/libweston-${WESTON_MAJOR_VERSION}/*.so"
SUMMARY:libweston-${WESTON_MAJOR_VERSION} = "Helper library for implementing 'wayland window managers'."
FILES:${PN}-examples = "${bindir}/*"
FILES:${PN}-xwayland = "${libdir}/libweston-${WESTON_MAJOR_VERSION}/xwayland.so"
RDEPENDS:${PN}-xwayland += "xwayland"
RDEPENDS:${PN} += "xkeyboard-config"
RRECOMMENDS:${PN} = "weston-init liberation-fonts"
RRECOMMENDS:${PN}-dev += "wayland-protocols"
USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM:${PN} = "--system weston-launch"

View File

@@ -1,17 +0,0 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI:append:tegra = " file://0001-Drop-DRM-version-check-in-meson.build.patch \
file://0002-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch \
file://0003-compositor-Process-stream-attach-requests-with-wl_eg.patch \
"
DEPENDS:append:tegra = " egl-wayland"
PACKAGE_ARCH:tegra = "${TEGRA_PKGARCH}"
RDEPENDS:${PN}:append:tegra = " egl-wayland egl-gbm"
# wlshell is used by nvidia gstreamer plugins
EXTRA_OEMESON:append:tegra = " -Ddeprecated-wl-shell=true"
RRECOMMENDS:${PN}:append:tegra = " kernel-module-tegra-udrm kernel-module-nvidia-drm"
RRECOMMENDS:${PN}:append:tegra234 = " nvidia-drm-loadconf"