summarylogtreecommitdiffstats
path: root/0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch
diff options
context:
space:
mode:
Diffstat (limited to '0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch')
-rw-r--r--0003-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch146
1 files changed, 71 insertions, 75 deletions
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 387031d8e989..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,9 +1,8 @@
-From 720e02507651efefe3a4a42077f719dd9f74b07c 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
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,51 +27,81 @@ Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed-by: Adam Cheney <acheney@nvidia.com>
Reviewed-by: James Jones <jajones@nvidia.com>
---
- libweston/gl-renderer.c | 184 ++++++++++++++++++++++++++++++++++++++++
- shared/weston-egl-ext.h | 5 ++
- 2 files changed, 189 insertions(+)
+ 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, 183 insertions(+)
-diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
-index f3fb2c65..4bae6546 100644
---- a/libweston/gl-renderer.c
-+++ b/libweston/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 */
-
-+ EGLStreamKHR egl_stream;
-+ bool new_stream;
-+
- struct weston_surface *surface;
+diff --git a/libweston/renderer-gl/egl-glue.c b/libweston/renderer-gl/egl-glue.c
+index 60cebd8f..abe10b46 100644
+--- a/libweston/renderer-gl/egl-glue.c
++++ b/libweston/renderer-gl/egl-glue.c
+@@ -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");
++ 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");
- /* Whether this surface was used in the current output repaint.
-@@ -248,6 +251,7 @@ struct gl_renderer {
+ extensions =
+ (const char *) eglQueryString(gr->egl_display, EGL_EXTENSIONS);
+diff --git a/libweston/renderer-gl/gl-renderer-internal.h b/libweston/renderer-gl/gl-renderer-internal.h
+index e122f64a..5b0bd4b5 100644
+--- a/libweston/renderer-gl/gl-renderer-internal.h
++++ b/libweston/renderer-gl/gl-renderer-internal.h
+@@ -99,6 +99,7 @@ struct gl_renderer {
PFNEGLCREATESTREAMKHRPROC create_stream;
PFNEGLDESTROYSTREAMKHRPROC destroy_stream;
+ PFNEGLQUERYSTREAMKHRPROC query_stream;
- int has_egl_stream;
+ bool has_egl_stream;
PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC create_stream_producer_surface;
-@@ -257,11 +261,16 @@ struct gl_renderer {
- int has_egl_stream_consumer_egloutput;
+@@ -108,11 +109,16 @@ struct gl_renderer {
+ bool has_egl_stream_consumer_egloutput;
#ifdef EGL_NV_stream_attrib
+ PFNEGLCREATESTREAMATTRIBNVPROC create_stream_attrib;
PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC stream_consumer_acquire_attrib;
#endif
- int has_egl_stream_attrib;
- int has_egl_stream_acquire_mode;
+ bool has_egl_stream_attrib;
+ bool has_egl_stream_acquire_mode;
+ PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC stream_consumer_gltexture;
-+ int has_egl_stream_consumer_gltexture;
-+ int has_egl_wayland_eglstream;
++ bool has_egl_stream_consumer_gltexture;
++ bool has_egl_wayland_eglstream;
++
+ bool has_gl_texture_rg;
+
+ struct gl_shader texture_shader_rgba;
+diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c
+index 6fc469ba..f834a7cb 100644
+--- a/libweston/renderer-gl/gl-renderer.c
++++ b/libweston/renderer-gl/gl-renderer.c
+@@ -196,6 +196,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;
+
- int has_dmabuf_import;
- struct wl_list dmabuf_images;
+ struct weston_surface *surface;
-@@ -2528,6 +2537,145 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
- surface->is_opaque = dmabuf_is_opaque(dmabuf);
+ /* Whether this surface was used in the current output repaint.
+@@ -2636,6 +2639,145 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
+ gs->shader = image->shader;
}
+/*
@@ -217,9 +246,9 @@ index f3fb2c65..4bae6546 100644
static void
gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
{
-@@ -2554,6 +2702,12 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
- gs->buffer_type = BUFFER_TYPE_NULL;
- gs->y_inverted = 1;
+@@ -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;
+
+ if (gs->egl_stream != EGL_NO_STREAM_KHR) {
@@ -230,17 +259,17 @@ index f3fb2c65..4bae6546 100644
return;
}
-@@ -2561,6 +2715,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);
+ 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))
-@@ -2764,6 +2921,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);
@@ -251,7 +280,7 @@ index f3fb2c65..4bae6546 100644
free(gs);
}
-@@ -2814,6 +2975,8 @@ gl_renderer_create_surface(struct weston_surface *surface)
+@@ -2924,6 +3079,8 @@ gl_renderer_create_surface(struct weston_surface *surface)
gs->surface = surface;
@@ -260,40 +289,7 @@ index f3fb2c65..4bae6546 100644
pixman_region32_init(&gs->texture_damage);
surface->renderer_state = gs;
-@@ -3570,14 +3733,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);
-@@ -3676,6 +3844,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 = 1;
-
-+ if (weston_check_egl_extension(extensions, "EGL_KHR_stream_consumer_gltexture"))
-+ gr->has_egl_stream_consumer_gltexture = 1;
-+
-+ if (weston_check_egl_extension(extensions, "EGL_WL_wayland_eglstream"))
-+ gr->has_egl_wayland_eglstream = 1;
-+
- renderer_setup_egl_client_extensions(gr);
-
- return 0;
-@@ -3953,6 +4127,16 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
+@@ -3704,6 +3861,16 @@ gl_renderer_display_create(struct weston_compositor *ec,
goto fail_terminate;
}
@@ -311,10 +307,10 @@ index f3fb2c65..4bae6546 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 +323,5 @@ index f39990ed..96982e2d 100644
/* EGL platform definition are keept to allow compositor-xx.c to build */
--
-2.21.0
+2.25.1