summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Plattner2016-06-06 15:40:33 -0700
committerAaron Plattner2016-06-06 15:43:38 -0700
commit527fba43a5628b8e2697ff253b162622e321b201 (patch)
tree38308204f797794fc0b30eb229b70550f340929b
parent57673850b273dcf3db6c85abe9bc1d45d090eaf4 (diff)
downloadaur-527fba43a5628b8e2697ff253b162622e321b201.tar.gz
Update to Weston 1.11.0
Fetched patches from the nvidia_r364 branch of git://people.freedesktop.org/~jjones/weston and then rebased on top of the 1.11.0 tag. Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
-rw-r--r--.SRCINFO42
-rw-r--r--0001-gl-renderer-Rename-gl_renderer_create-to-gl_renderer.patch115
-rw-r--r--0001-gl-renderer-Renaming-of-things-and-minor-improvement.patch212
-rw-r--r--0002-gl-renderer-Rename-gl_renderer-output_create-to-outp.patch113
-rw-r--r--0003-gl-renderer-Implement-use-check_extension.patch167
-rw-r--r--0003-gl-renderer-Rename-attribs-param-of-gl_renderer-to-c.patch85
-rw-r--r--0004-gl-renderer-Add-platform_attribs-param-to-gl_rendere.patch111
-rw-r--r--0005-gl-renderer-Accept-non-NULL-empty-visual_id-arrays.patch32
-rw-r--r--0006-compositor-drm-Renaming-of-gbm-fields.patch228
-rw-r--r--0006-gl-renderer-Refactor-gl_renderer_output_window_creat.patch (renamed from 0002-gl-renderer-Refactor-gl_renderer_output_window_creat.patch)38
-rw-r--r--0007-gl-renderer-Add-EGLDevice-enumeration-support.patch146
-rw-r--r--0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch (renamed from 0004-gl-renderer-Add-support-for-EGLDevice-EGLOutput.patch)466
-rw-r--r--0009-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch302
-rw-r--r--0010-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch (renamed from 0005-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch)28
-rw-r--r--0011-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch (renamed from 0007-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch)229
-rw-r--r--PKGBUILD58
16 files changed, 1187 insertions, 1185 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 0badd42231a..1d2664d4410 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = weston-eglstream
pkgdesc = Reference implementation of a Wayland compositor with EGLStream support
- pkgver = 1.10.0
+ pkgver = 1.11.0
pkgrel = 1
url = http://wayland.freedesktop.org
arch = i686
@@ -19,22 +19,30 @@ pkgbase = weston-eglstream
depends = colord
provides = weston
conflicts = weston
- source = http://wayland.freedesktop.org/releases/weston-1.10.0.tar.xz
- source = 0001-gl-renderer-Renaming-of-things-and-minor-improvement.patch
- source = 0002-gl-renderer-Refactor-gl_renderer_output_window_creat.patch
- source = 0003-gl-renderer-Implement-use-check_extension.patch
- source = 0004-gl-renderer-Add-support-for-EGLDevice-EGLOutput.patch
- source = 0005-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch
- source = 0006-compositor-drm-Renaming-of-gbm-fields.patch
- source = 0007-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch
- sha1sums = c9c2c8e2e798b25e7bf6b31bf0c4ef08724a7ebb
- sha1sums = c623cdf628a20a4bde5a98cc40867c32a8300e79
- sha1sums = 3441d0a7da0ae64835a5b29545caab4bc7977417
- sha1sums = f6742fadb973ec6c2b55e5500127309e70579312
- sha1sums = 31e3a447a1209712d604d739d0ac7e5b1925e940
- sha1sums = b483f21b3f880d3978cc678bf5f97802f7ddddaf
- sha1sums = 13d217d76a0811f5eb8d7180d31ec7a69fbbaabd
- sha1sums = 6bab10ac02a7e69b1bb1bf1982b5804e87870e0e
+ source = http://wayland.freedesktop.org/releases/weston-1.11.0.tar.xz
+ source = 0001-gl-renderer-Rename-gl_renderer_create-to-gl_renderer.patch
+ source = 0002-gl-renderer-Rename-gl_renderer-output_create-to-outp.patch
+ source = 0003-gl-renderer-Rename-attribs-param-of-gl_renderer-to-c.patch
+ source = 0004-gl-renderer-Add-platform_attribs-param-to-gl_rendere.patch
+ source = 0005-gl-renderer-Accept-non-NULL-empty-visual_id-arrays.patch
+ source = 0006-gl-renderer-Refactor-gl_renderer_output_window_creat.patch
+ source = 0007-gl-renderer-Add-EGLDevice-enumeration-support.patch
+ source = 0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch
+ source = 0009-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch
+ source = 0010-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch
+ source = 0011-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch
+ sha1sums = 8b051ee16b785b6db16657161aeed6cd6724f028
+ sha1sums = 67741bea89d102740e1d8726d20cf6d278d6d51e
+ sha1sums = 63b21515874749572d515266d49c202dbc560a43
+ sha1sums = 551571daaabab0ded8c1dc58cd45035fad3a6387
+ sha1sums = 96b73103c25811a7721a40487ad7ec5d9436fa11
+ sha1sums = d1aab8b491b50dbcfceb96aa154df0bac04ec4f4
+ sha1sums = c74abfd3e5ee691a889be8d03a841c96da6602c0
+ sha1sums = 5148c5ec24a98af3d33f65eabbba065f4556b212
+ sha1sums = 25634c91c587af648cb2428e2124c23e22e6025b
+ sha1sums = a51dfacd54988910e909789e31bea43b9c2156fe
+ sha1sums = 350c82bee9bd06c0b678fabf08fcef405e832083
+ sha1sums = c1db4cb0ac1d685a0c6e9d020238f8ea0c163318
pkgname = weston-eglstream
diff --git a/0001-gl-renderer-Rename-gl_renderer_create-to-gl_renderer.patch b/0001-gl-renderer-Rename-gl_renderer_create-to-gl_renderer.patch
new file mode 100644
index 00000000000..6a11a96238e
--- /dev/null
+++ b/0001-gl-renderer-Rename-gl_renderer_create-to-gl_renderer.patch
@@ -0,0 +1,115 @@
+From 986ecf2624930070e2d89dfe68459cd893179ca2 Mon Sep 17 00:00:00 2001
+From: "Miguel A. Vico" <mvicomoya@nvidia.com>
+Date: Wed, 30 Mar 2016 15:44:09 +0200
+Subject: [PATCH 01/11] gl-renderer: Rename gl_renderer_create to
+ gl_renderer_display_create
+X-NVConfidentiality: public
+
+No functional change. This patch only renames gl_renderer_create() to
+gl_renderer_display_create(), which is something more descriptive of
+what the function does.
+
+Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
+Reviewed-by: James Jones <jajones@nvidia.com>
+---
+ src/compositor-drm.c | 2 +-
+ src/compositor-fbdev.c | 2 +-
+ src/compositor-wayland.c | 2 +-
+ src/compositor-x11.c | 5 +++--
+ src/gl-renderer.c | 4 ++--
+ src/gl-renderer.h | 2 +-
+ 6 files changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/src/compositor-drm.c b/src/compositor-drm.c
+index 893877d946ff..0e217e075713 100644
+--- a/src/compositor-drm.c
++++ b/src/compositor-drm.c
+@@ -1577,7 +1577,7 @@ drm_backend_create_gl_renderer(struct drm_backend *b)
+
+ if (format[1])
+ n_formats = 3;
+- if (gl_renderer->create(b->compositor,
++ if (gl_renderer->display_create(b->compositor,
+ EGL_PLATFORM_GBM_KHR,
+ (void *)b->gbm,
+ gl_renderer->opaque_attribs,
+diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
+index ee762e312c59..c6ffcd7e8696 100644
+--- a/src/compositor-fbdev.c
++++ b/src/compositor-fbdev.c
+@@ -785,7 +785,7 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
+ goto out_launcher;
+ }
+
+- if (gl_renderer->create(compositor, NO_EGL_PLATFORM,
++ if (gl_renderer->display_create(compositor, NO_EGL_PLATFORM,
+ EGL_DEFAULT_DISPLAY,
+ gl_renderer->opaque_attribs,
+ NULL, 0) < 0) {
+diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
+index fe8b082b43fd..ba99b2af7f9c 100644
+--- a/src/compositor-wayland.c
++++ b/src/compositor-wayland.c
+@@ -2208,7 +2208,7 @@ wayland_backend_create(struct weston_compositor *compositor,
+ }
+
+ if (!b->use_pixman) {
+- if (gl_renderer->create(compositor,
++ if (gl_renderer->display_create(compositor,
+ EGL_PLATFORM_WAYLAND_KHR,
+ b->parent.wl_display,
+ gl_renderer->alpha_attribs,
+diff --git a/src/compositor-x11.c b/src/compositor-x11.c
+index 629b5f39a217..78b9c62f873b 100644
+--- a/src/compositor-x11.c
++++ b/src/compositor-x11.c
+@@ -1557,8 +1557,9 @@ init_gl_renderer(struct x11_backend *b)
+ if (!gl_renderer)
+ return -1;
+
+- ret = gl_renderer->create(b->compositor, EGL_PLATFORM_X11_KHR, (void *) b->dpy,
+- gl_renderer->opaque_attribs, NULL, 0);
++ ret = gl_renderer->display_create(b->compositor, EGL_PLATFORM_X11_KHR,
++ (void *) b->dpy,
++ gl_renderer->opaque_attribs, NULL, 0);
+
+ return ret;
+ }
+diff --git a/src/gl-renderer.c b/src/gl-renderer.c
+index 23c0cd722df8..197e5c2a3123 100644
+--- a/src/gl-renderer.c
++++ b/src/gl-renderer.c
+@@ -2873,7 +2873,7 @@ platform_to_extension(EGLenum platform)
+ }
+
+ static int
+-gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
++gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
+ void *native_window, const EGLint *attribs,
+ const EGLint *visual_id, int n_ids)
+ {
+@@ -3147,7 +3147,7 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
+ .opaque_attribs = gl_renderer_opaque_attribs,
+ .alpha_attribs = gl_renderer_alpha_attribs,
+
+- .create = gl_renderer_create,
++ .display_create = gl_renderer_display_create,
+ .display = gl_renderer_display,
+ .output_create = gl_renderer_output_create,
+ .output_destroy = gl_renderer_output_destroy,
+diff --git a/src/gl-renderer.h b/src/gl-renderer.h
+index 71f6b46e49e1..cd67a890aae9 100644
+--- a/src/gl-renderer.h
++++ b/src/gl-renderer.h
+@@ -75,7 +75,7 @@ struct gl_renderer_interface {
+ const EGLint *opaque_attribs;
+ const EGLint *alpha_attribs;
+
+- int (*create)(struct weston_compositor *ec,
++ int (*display_create)(struct weston_compositor *ec,
+ EGLenum platform,
+ void *native_window,
+ const EGLint *attribs,
+--
+2.8.3
+
diff --git a/0001-gl-renderer-Renaming-of-things-and-minor-improvement.patch b/0001-gl-renderer-Renaming-of-things-and-minor-improvement.patch
deleted file mode 100644
index ae7acd6ca07..00000000000
--- a/0001-gl-renderer-Renaming-of-things-and-minor-improvement.patch
+++ /dev/null
@@ -1,212 +0,0 @@
-From 50b2478345ae978143364abde179080a36479e94 Mon Sep 17 00:00:00 2001
-From: "Miguel A. Vico" <mvicomoya@nvidia.com>
-Date: Mon, 21 Mar 2016 17:37:31 +0100
-Subject: [PATCH 1/7] gl-renderer: Renaming of things and minor improvements
-X-NVConfidentiality: public
-
-In preparation for follow-on changes to support frame presentation
-through EGLDevice+EGLOutput, this change includes the following:
- -Rename gl_renderer_output_create to gl_renderer_output_window_create
- -Add <platform_attribs> argument to gl_renderer_create
- -Rename <attribs> argument for gl_renderer_create() and
- gl_renderer_output_window_create() to <config_attribs>
- -Accept non-NULL empty <visual_id> arrays (n_ids == 0) both in
- gl_renderer_create() and gl_renderer_output_window_create()
-
-Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
-Reviewed-by: Andy Ritger <aritger@nvidia.com>
----
- src/compositor-drm.c | 3 ++-
- src/compositor-fbdev.c | 3 ++-
- src/compositor-wayland.c | 3 ++-
- src/compositor-x11.c | 4 ++--
- src/gl-renderer.c | 18 +++++++++---------
- src/gl-renderer.h | 7 ++++---
- 6 files changed, 21 insertions(+), 17 deletions(-)
-
-diff --git a/src/compositor-drm.c b/src/compositor-drm.c
-index 538e56eb58ba..ded15f83c3e6 100644
---- a/src/compositor-drm.c
-+++ b/src/compositor-drm.c
-@@ -1588,6 +1588,7 @@ drm_backend_create_gl_renderer(struct drm_backend *b)
- if (gl_renderer->create(b->compositor,
- EGL_PLATFORM_GBM_KHR,
- (void *)b->gbm,
-+ NULL,
- gl_renderer->opaque_attribs,
- format,
- n_formats) < 0) {
-@@ -1852,7 +1853,7 @@ drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
-
- if (format[1])
- n_formats = 2;
-- if (gl_renderer->output_create(&output->base,
-+ if (gl_renderer->output_window_create(&output->base,
- (EGLNativeWindowType)output->surface,
- output->surface,
- gl_renderer->opaque_attribs,
-diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
-index 36d7ae0ae500..84435b7f2fbd 100644
---- a/src/compositor-fbdev.c
-+++ b/src/compositor-fbdev.c
-@@ -526,7 +526,7 @@ fbdev_output_create(struct fbdev_backend *backend,
- goto out_hw_surface;
- } else {
- setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
-- if (gl_renderer->output_create(&output->base,
-+ if (gl_renderer->output_window_create(&output->base,
- (EGLNativeWindowType)NULL, NULL,
- gl_renderer->opaque_attribs,
- NULL, 0) < 0) {
-@@ -799,6 +799,7 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
-
- if (gl_renderer->create(compositor, NO_EGL_PLATFORM,
- EGL_DEFAULT_DISPLAY,
-+ NULL,
- gl_renderer->opaque_attribs,
- NULL, 0) < 0) {
- weston_log("gl_renderer_create failed.\n");
-diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
-index d1c020d886a1..d38376a9ee38 100644
---- a/src/compositor-wayland.c
-+++ b/src/compositor-wayland.c
-@@ -657,7 +657,7 @@ wayland_output_init_gl_renderer(struct wayland_output *output)
- return -1;
- }
-
-- if (gl_renderer->output_create(&output->base,
-+ if (gl_renderer->output_window_create(&output->base,
- output->gl.egl_window,
- output->gl.egl_window,
- gl_renderer->alpha_attribs,
-@@ -2250,6 +2250,7 @@ wayland_backend_create(struct weston_compositor *compositor, int use_pixman,
- if (gl_renderer->create(compositor,
- EGL_PLATFORM_WAYLAND_KHR,
- b->parent.wl_display,
-+ NULL,
- gl_renderer->alpha_attribs,
- NULL,
- 0) < 0) {
-diff --git a/src/compositor-x11.c b/src/compositor-x11.c
-index 13a5d7304568..bc35db66f6fc 100644
---- a/src/compositor-x11.c
-+++ b/src/compositor-x11.c
-@@ -932,7 +932,7 @@ x11_backend_create_output(struct x11_backend *b, int x, int y,
- * but eglCreateWindowSurface takes a Window. */
- Window xid = (Window) output->window;
-
-- ret = gl_renderer->output_create(&output->base,
-+ ret = gl_renderer->output_window_create(&output->base,
- (EGLNativeWindowType) output->window,
- &xid,
- gl_renderer->opaque_attribs,
-@@ -1562,7 +1562,7 @@ init_gl_renderer(struct x11_backend *b)
- return -1;
-
- ret = gl_renderer->create(b->compositor, EGL_PLATFORM_X11_KHR, (void *) b->dpy,
-- gl_renderer->opaque_attribs, NULL, 0);
-+ NULL, gl_renderer->opaque_attribs, NULL, 0);
-
- return ret;
- }
-diff --git a/src/gl-renderer.c b/src/gl-renderer.c
-index cb083448bfdb..0c55e0b9ebd2 100644
---- a/src/gl-renderer.c
-+++ b/src/gl-renderer.c
-@@ -2493,7 +2493,7 @@ egl_choose_config(struct gl_renderer *gr, const EGLint *attribs,
- goto out;
- }
-
-- if (!visual_id)
-+ if (!visual_id || n_ids == 0)
- config_index = 0;
-
- for (i = 0; config_index == -1 && i < n_ids; i++)
-@@ -2547,10 +2547,10 @@ static int
- gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface);
-
- static int
--gl_renderer_output_create(struct weston_output *output,
-+gl_renderer_output_window_create(struct weston_output *output,
- EGLNativeWindowType window_for_legacy,
- void *window_for_platform,
-- const EGLint *attribs,
-+ const EGLint *config_attribs,
- const EGLint *visual_id,
- int n_ids)
- {
-@@ -2560,7 +2560,7 @@ gl_renderer_output_create(struct weston_output *output,
- EGLConfig egl_config;
- int i;
-
-- if (egl_choose_config(gr, attribs, visual_id,
-+ if (egl_choose_config(gr, config_attribs, visual_id,
- n_ids, &egl_config) == -1) {
- weston_log("failed to choose EGL config for output\n");
- return -1;
-@@ -2846,8 +2846,8 @@ platform_to_extension(EGLenum platform)
-
- static int
- gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
-- void *native_window, const EGLint *attribs,
-- const EGLint *visual_id, int n_ids)
-+ void *native_window, const EGLint* platform_attribs,
-+ const EGLint *config_attribs, const EGLint *visual_id, int n_ids)
- {
- struct gl_renderer *gr;
- EGLint major, minor;
-@@ -2889,7 +2889,7 @@ gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
- if (get_platform_display && platform) {
- gr->egl_display = get_platform_display(platform,
- native_window,
-- NULL);
-+ platform_attribs);
- }
- }
-
-@@ -2910,7 +2910,7 @@ gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
- goto fail_with_error;
- }
-
-- if (egl_choose_config(gr, attribs, visual_id,
-+ if (egl_choose_config(gr, config_attribs, visual_id,
- n_ids, &gr->egl_config) < 0) {
- weston_log("failed to choose EGL config\n");
- goto fail_terminate;
-@@ -3121,7 +3121,7 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
-
- .create = gl_renderer_create,
- .display = gl_renderer_display,
-- .output_create = gl_renderer_output_create,
-+ .output_window_create = gl_renderer_output_window_create,
- .output_destroy = gl_renderer_output_destroy,
- .output_surface = gl_renderer_output_surface,
- .output_set_border = gl_renderer_output_set_border,
-diff --git a/src/gl-renderer.h b/src/gl-renderer.h
-index 71f6b46e49e1..af8dd267e700 100644
---- a/src/gl-renderer.h
-+++ b/src/gl-renderer.h
-@@ -78,16 +78,17 @@ struct gl_renderer_interface {
- int (*create)(struct weston_compositor *ec,
- EGLenum platform,
- void *native_window,
-- const EGLint *attribs,
-+ const EGLint *platform_attribs,
-+ const EGLint *config_attribs,
- const EGLint *visual_id,
- const int n_ids);
-
- EGLDisplay (*display)(struct weston_compositor *ec);
-
-- int (*output_create)(struct weston_output *output,
-+ int (*output_window_create)(struct weston_output *output,
- EGLNativeWindowType window_for_legacy,
- void *window_for_platform,
-- const EGLint *attribs,
-+ const EGLint *config_attribs,
- const EGLint *visual_id,
- const int n_ids);
-
---
-2.7.4
-
diff --git a/0002-gl-renderer-Rename-gl_renderer-output_create-to-outp.patch b/0002-gl-renderer-Rename-gl_renderer-output_create-to-outp.patch
new file mode 100644
index 00000000000..13d64e38986
--- /dev/null
+++ b/0002-gl-renderer-Rename-gl_renderer-output_create-to-outp.patch
@@ -0,0 +1,113 @@
+From 32a49cc3fce7d2a48b4d07ef542c21cac26e7177 Mon Sep 17 00:00:00 2001
+From: "Miguel A. Vico" <mvicomoya@nvidia.com>
+Date: Wed, 30 Mar 2016 15:09:14 +0200
+Subject: [PATCH 02/11] gl-renderer: Rename gl_renderer::output_create to
+ output_window_create
+X-NVConfidentiality: public
+
+No functional change. This patch renames gl_renderer_output_create() to
+gl_renderer_output_window_create(), which is something more descriptive
+of what the function does.
+
+Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
+Reviewed-by: Andy Ritger <aritger@nvidia.com>
+Reviewed-by: James Jones <jajones@nvidia.com>
+---
+ src/compositor-drm.c | 2 +-
+ src/compositor-fbdev.c | 2 +-
+ src/compositor-wayland.c | 2 +-
+ src/compositor-x11.c | 2 +-
+ src/gl-renderer.c | 4 ++--
+ src/gl-renderer.h | 2 +-
+ 6 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/src/compositor-drm.c b/src/compositor-drm.c
+index 0e217e075713..20e6474511ef 100644
+--- a/src/compositor-drm.c
++++ b/src/compositor-drm.c
+@@ -1844,7 +1844,7 @@ drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
+
+ if (format[1])
+ n_formats = 2;
+- if (gl_renderer->output_create(&output->base,
++ if (gl_renderer->output_window_create(&output->base,
+ (EGLNativeWindowType)output->gbm_surface,
+ output->gbm_surface,
+ gl_renderer->opaque_attribs,
+diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
+index c6ffcd7e8696..21a24fd4c4e3 100644
+--- a/src/compositor-fbdev.c
++++ b/src/compositor-fbdev.c
+@@ -510,7 +510,7 @@ fbdev_output_create(struct fbdev_backend *backend,
+ goto out_hw_surface;
+ } else {
+ setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
+- if (gl_renderer->output_create(&output->base,
++ if (gl_renderer->output_window_create(&output->base,
+ (EGLNativeWindowType)NULL, NULL,
+ gl_renderer->opaque_attribs,
+ NULL, 0) < 0) {
+diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
+index ba99b2af7f9c..85e755a52d84 100644
+--- a/src/compositor-wayland.c
++++ b/src/compositor-wayland.c
+@@ -658,7 +658,7 @@ wayland_output_init_gl_renderer(struct wayland_output *output)
+ return -1;
+ }
+
+- if (gl_renderer->output_create(&output->base,
++ if (gl_renderer->output_window_create(&output->base,
+ output->gl.egl_window,
+ output->gl.egl_window,
+ gl_renderer->alpha_attribs,
+diff --git a/src/compositor-x11.c b/src/compositor-x11.c
+index 78b9c62f873b..6b61cee6bbed 100644
+--- a/src/compositor-x11.c
++++ b/src/compositor-x11.c
+@@ -928,7 +928,7 @@ x11_backend_create_output(struct x11_backend *b, int x, int y,
+ * but eglCreateWindowSurface takes a Window. */
+ Window xid = (Window) output->window;
+
+- ret = gl_renderer->output_create(&output->base,
++ ret = gl_renderer->output_window_create(&output->base,
+ (EGLNativeWindowType) output->window,
+ &xid,
+ gl_renderer->opaque_attribs,
+diff --git a/src/gl-renderer.c b/src/gl-renderer.c
+index 197e5c2a3123..784cacbc2619 100644
+--- a/src/gl-renderer.c
++++ b/src/gl-renderer.c
+@@ -2547,7 +2547,7 @@ static int
+ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface);
+
+ static int
+-gl_renderer_output_create(struct weston_output *output,
++gl_renderer_output_window_create(struct weston_output *output,
+ EGLNativeWindowType window_for_legacy,
+ void *window_for_platform,
+ const EGLint *attribs,
+@@ -3149,7 +3149,7 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
+
+ .display_create = gl_renderer_display_create,
+ .display = gl_renderer_display,
+- .output_create = gl_renderer_output_create,
++ .output_window_create = gl_renderer_output_window_create,
+ .output_destroy = gl_renderer_output_destroy,
+ .output_surface = gl_renderer_output_surface,
+ .output_set_border = gl_renderer_output_set_border,
+diff --git a/src/gl-renderer.h b/src/gl-renderer.h
+index cd67a890aae9..ae9bf0f0aee2 100644
+--- a/src/gl-renderer.h
++++ b/src/gl-renderer.h
+@@ -84,7 +84,7 @@ struct gl_renderer_interface {
+
+ EGLDisplay (*display)(struct weston_compositor *ec);
+
+- int (*output_create)(struct weston_output *output,
++ int (*output_window_create)(struct weston_output *output,
+ EGLNativeWindowType window_for_legacy,
+ void *window_for_platform,
+ const EGLint *attribs,
+--
+2.8.3
+
diff --git a/0003-gl-renderer-Implement-use-check_extension.patch b/0003-gl-renderer-Implement-use-check_extension.patch
deleted file mode 100644
index deed6e719fa..00000000000
--- a/0003-gl-renderer-Implement-use-check_extension.patch
+++ /dev/null
@@ -1,167 +0,0 @@
-From c513bd330d06c7e57ca294f5e3cf7f0824afefc4 Mon Sep 17 00:00:00 2001
-From: "Miguel A. Vico" <mvicomoya@nvidia.com>
-Date: Mon, 21 Mar 2016 17:37:33 +0100
-Subject: [PATCH 3/7] gl-renderer: Implement & use check_extension
-X-NVConfidentiality: public
-
-Using strstr(3) for checking for extensions is an error-prone mechanism
-as extension names can be prefixes of other extension names (see
-https://www.opengl.org/registry/doc/rules.html#using).
-
-This change implements the check_extension() function to properly check
-for an extension and replaces all usages of strstr(3).
-
-Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
-Reviewed-by: Andy Ritger <aritger@nvidia.com>
-Reviewed-by: Daniel Stone <daniels@collabora.com>
-[Pekka: move 'bool' to the same line with 'static']
-Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
-(cherry picked from commit cc3a192b448153a7911d44aa0fa549099607911d)
----
- src/gl-renderer.c | 56 +++++++++++++++++++++++++++++++++++++++++--------------
- 1 file changed, 42 insertions(+), 14 deletions(-)
-
-diff --git a/src/gl-renderer.c b/src/gl-renderer.c
-index 1d6d98c9b86b..887d131674f5 100644
---- a/src/gl-renderer.c
-+++ b/src/gl-renderer.c
-@@ -2701,6 +2701,34 @@ gl_renderer_destroy(struct weston_compositor *ec)
- free(gr);
- }
-
-+static bool
-+check_extension(const char *extensions, const char *extension)
-+{
-+ size_t extlen = strlen(extension);
-+ const char *end = extensions + strlen(extensions);
-+
-+ while (extensions < end) {
-+ size_t n = 0;
-+
-+ /* Skip whitespaces, if any */
-+ if (*extensions == ' ') {
-+ extensions++;
-+ continue;
-+ }
-+
-+ n = strcspn(extensions, " ");
-+
-+ /* Compare strings */
-+ if (n == extlen && strncmp(extension, extensions, n) == 0)
-+ return true; /* Found */
-+
-+ extensions += n;
-+ }
-+
-+ /* Not found */
-+ return false;
-+}
-+
- static void
- renderer_setup_egl_client_extensions(struct gl_renderer *gr)
- {
-@@ -2712,7 +2740,7 @@ renderer_setup_egl_client_extensions(struct gl_renderer *gr)
- return;
- }
-
-- if (strstr(extensions, "EGL_EXT_platform_base"))
-+ if (check_extension(extensions, "EGL_EXT_platform_base"))
- gr->create_platform_window =
- (void *) eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT");
- else
-@@ -2742,7 +2770,7 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
- return -1;
- }
-
-- if (strstr(extensions, "EGL_WL_bind_wayland_display"))
-+ if (check_extension(extensions, "EGL_WL_bind_wayland_display"))
- gr->has_bind_display = 1;
- if (gr->has_bind_display) {
- ret = gr->bind_display(gr->egl_display, ec->wl_display);
-@@ -2750,14 +2778,14 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
- gr->has_bind_display = 0;
- }
-
-- if (strstr(extensions, "EGL_EXT_buffer_age"))
-+ if (check_extension(extensions, "EGL_EXT_buffer_age"))
- gr->has_egl_buffer_age = 1;
- else
- weston_log("warning: EGL_EXT_buffer_age not supported. "
- "Performance could be affected.\n");
-
- #ifdef EGL_EXT_swap_buffers_with_damage
-- if (strstr(extensions, "EGL_EXT_swap_buffers_with_damage"))
-+ if (check_extension(extensions, "EGL_EXT_swap_buffers_with_damage"))
- gr->swap_buffers_with_damage =
- (void *) eglGetProcAddress("eglSwapBuffersWithDamageEXT");
- else
-@@ -2766,12 +2794,12 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
- #endif
-
- #ifdef EGL_MESA_configless_context
-- if (strstr(extensions, "EGL_MESA_configless_context"))
-+ if (check_extension(extensions, "EGL_MESA_configless_context"))
- gr->has_configless_context = 1;
- #endif
-
- #ifdef EGL_EXT_image_dma_buf_import
-- if (strstr(extensions, "EGL_EXT_image_dma_buf_import"))
-+ if (check_extension(extensions, "EGL_EXT_image_dma_buf_import"))
- gr->has_dmabuf_import = 1;
- #endif
-
-@@ -2840,19 +2868,19 @@ gl_renderer_supports(struct weston_compositor *ec,
- extensions);
- }
-
-- if (!strstr(extensions, "EGL_EXT_platform_base"))
-+ if (!check_extension(extensions, "EGL_EXT_platform_base"))
- return 0;
-
- snprintf(s, sizeof s, "EGL_KHR_platform_%s", extension_suffix);
-- if (strstr(extensions, s))
-+ if (check_extension(extensions, s))
- return 1;
-
- snprintf(s, sizeof s, "EGL_EXT_platform_%s", extension_suffix);
-- if (strstr(extensions, s))
-+ if (check_extension(extensions, s))
- return 1;
-
- snprintf(s, sizeof s, "EGL_MESA_platform_%s", extension_suffix);
-- if (strstr(extensions, s))
-+ if (check_extension(extensions, s))
- return 1;
-
- /* at this point we definitely have some platform extensions but
-@@ -3104,22 +3132,22 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
- return -1;
- }
-
-- if (!strstr(extensions, "GL_EXT_texture_format_BGRA8888")) {
-+ if (!check_extension(extensions, "GL_EXT_texture_format_BGRA8888")) {
- weston_log("GL_EXT_texture_format_BGRA8888 not available\n");
- return -1;
- }
-
-- if (strstr(extensions, "GL_EXT_read_format_bgra"))
-+ if (check_extension(extensions, "GL_EXT_read_format_bgra"))
- ec->read_format = PIXMAN_a8r8g8b8;
- else
- ec->read_format = PIXMAN_a8b8g8r8;
-
- #ifdef GL_EXT_unpack_subimage
-- if (strstr(extensions, "GL_EXT_unpack_subimage"))
-+ if (check_extension(extensions, "GL_EXT_unpack_subimage"))
- gr->has_unpack_subimage = 1;
- #endif
-
-- if (strstr(extensions, "GL_OES_EGL_image_external"))
-+ if (check_extension(extensions, "GL_OES_EGL_image_external"))
- gr->has_egl_image_external = 1;
-
- glActiveTexture(GL_TEXTURE0);
---
-2.7.4
-
diff --git a/0003-gl-renderer-Rename-attribs-param-of-gl_renderer-to-c.patch b/0003-gl-renderer-Rename-attribs-param-of-gl_renderer-to-c.patch
new file mode 100644
index 00000000000..320e8f96433
--- /dev/null
+++ b/0003-gl-renderer-Rename-attribs-param-of-gl_renderer-to-c.patch
@@ -0,0 +1,85 @@
+From f0598cde32ca1af3fecd71d8592f34e56f6bdae0 Mon Sep 17 00:00:00 2001
+From: "Miguel A. Vico" <mvicomoya@nvidia.com>
+Date: Wed, 30 Mar 2016 15:23:49 +0200
+Subject: [PATCH 03/11] gl-renderer: Rename <attribs> param of gl_renderer to
+ <config_attribs>
+X-NVConfidentiality: public
+
+In preparation for follow-on changes to support frame presentation
+through EGLDevice+EGLOutput, this change renames <attribs> parameter
+of gl_renderer_display_create() and gl_renderer_output_window_create()
+to <config_attribs>
+
+Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
+Reviewed-by: Andy Ritger <aritger@nvidia.com>
+Reviewed-by: James Jones <jajones@nvidia.com>
+---
+ src/gl-renderer.c | 8 ++++----
+ src/gl-renderer.h | 4 ++--
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/gl-renderer.c b/src/gl-renderer.c
+index 784cacbc2619..b0bee7f6a94f 100644
+--- a/src/gl-renderer.c
++++ b/src/gl-renderer.c
+@@ -2550,7 +2550,7 @@ static int
+ gl_renderer_output_window_create(struct weston_output *output,
+ EGLNativeWindowType window_for_legacy,
+ void *window_for_platform,
+- const EGLint *attribs,
++ const EGLint *config_attribs,
+ const EGLint *visual_id,
+ int n_ids)
+ {
+@@ -2560,7 +2560,7 @@ gl_renderer_output_window_create(struct weston_output *output,
+ EGLConfig egl_config;
+ int i;
+
+- if (egl_choose_config(gr, attribs, visual_id,
++ if (egl_choose_config(gr, config_attribs, visual_id,
+ n_ids, &egl_config) == -1) {
+ weston_log("failed to choose EGL config for output\n");
+ return -1;
+@@ -2874,7 +2874,7 @@ platform_to_extension(EGLenum platform)
+
+ static int
+ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
+- void *native_window, const EGLint *attribs,
++ void *native_window, const EGLint *config_attribs,
+ const EGLint *visual_id, int n_ids)
+ {
+ struct gl_renderer *gr;
+@@ -2938,7 +2938,7 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
+ goto fail_with_error;
+ }
+
+- if (egl_choose_config(gr, attribs, visual_id,
++ if (egl_choose_config(gr, config_attribs, visual_id,
+ n_ids, &gr->egl_config) < 0) {
+ weston_log("failed to choose EGL config\n");
+ goto fail_terminate;
+diff --git a/src/gl-renderer.h b/src/gl-renderer.h
+index ae9bf0f0aee2..d43131940f43 100644
+--- a/src/gl-renderer.h
++++ b/src/gl-renderer.h
+@@ -78,7 +78,7 @@ struct gl_renderer_interface {
+ int (*display_create)(struct weston_compositor *ec,
+ EGLenum platform,
+ void *native_window,
+- const EGLint *attribs,
++ const EGLint *config_attribs,
+ const EGLint *visual_id,
+ const int n_ids);
+
+@@ -87,7 +87,7 @@ struct gl_renderer_interface {
+ int (*output_window_create)(struct weston_output *output,
+ EGLNativeWindowType window_for_legacy,
+ void *window_for_platform,
+- const EGLint *attribs,
++ const EGLint *config_attribs,
+ const EGLint *visual_id,
+ const int n_ids);
+
+--
+2.8.3
+
diff --git a/0004-gl-renderer-Add-platform_attribs-param-to-gl_rendere.patch b/0004-gl-renderer-Add-platform_attribs-param-to-gl_rendere.patch
new file mode 100644
index 00000000000..12cf967fdc4
--- /dev/null
+++ b/0004-gl-renderer-Add-platform_attribs-param-to-gl_rendere.patch
@@ -0,0 +1,111 @@
+From 0e4bc3d227912df81c275ccddc48cae5b058d65c Mon Sep 17 00:00:00 2001
+From: "Miguel A. Vico" <mvicomoya@nvidia.com>
+Date: Wed, 30 Mar 2016 15:17:01 +0200
+Subject: [PATCH 04/11] gl-renderer: Add <platform_attribs> param to
+ gl_renderer_display_create
+X-NVConfidentiality: public
+
+In preparation for follow-on changes to support frame presentation
+through EGLDevice+EGLOutput, this change adds <platform_attribs>
+parameter to gl_renderer_display_create().
+
+Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
+Reviewed-by: Andy Ritger <aritger@nvidia.com>
+Reviewed-by: James Jones <jajones@nvidia.com>
+---
+ src/compositor-drm.c | 1 +
+ src/compositor-fbdev.c | 1 +
+ src/compositor-wayland.c | 1 +
+ src/compositor-x11.c | 2 +-
+ src/gl-renderer.c | 6 +++---
+ src/gl-renderer.h | 1 +
+ 6 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/src/compositor-drm.c b/src/compositor-drm.c
+index 20e6474511ef..dd545de1ccc0 100644
+--- a/src/compositor-drm.c
++++ b/src/compositor-drm.c
+@@ -1580,6 +1580,7 @@ drm_backend_create_gl_renderer(struct drm_backend *b)
+ if (gl_renderer->display_create(b->compositor,
+ EGL_PLATFORM_GBM_KHR,
+ (void *)b->gbm,
++ NULL,
+ gl_renderer->opaque_attribs,
+ format,
+ n_formats) < 0) {
+diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
+index 21a24fd4c4e3..7a7c32915c8c 100644
+--- a/src/compositor-fbdev.c
++++ b/src/compositor-fbdev.c
+@@ -787,6 +787,7 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
+
+ if (gl_renderer->display_create(compositor, NO_EGL_PLATFORM,
+ EGL_DEFAULT_DISPLAY,
++ NULL,
+ gl_renderer->opaque_attribs,
+ NULL, 0) < 0) {
+ weston_log("gl_renderer_create failed.\n");
+diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
+index 85e755a52d84..88992dbeec23 100644
+--- a/src/compositor-wayland.c
++++ b/src/compositor-wayland.c
+@@ -2211,6 +2211,7 @@ wayland_backend_create(struct weston_compositor *compositor,
+ if (gl_renderer->display_create(compositor,
+ EGL_PLATFORM_WAYLAND_KHR,
+ b->parent.wl_display,
++ NULL,
+ gl_renderer->alpha_attribs,
+ NULL,
+ 0) < 0) {
+diff --git a/src/compositor-x11.c b/src/compositor-x11.c
+index 6b61cee6bbed..52b7a7e16cd7 100644
+--- a/src/compositor-x11.c
++++ b/src/compositor-x11.c
+@@ -1558,7 +1558,7 @@ init_gl_renderer(struct x11_backend *b)
+ return -1;
+
+ ret = gl_renderer->display_create(b->compositor, EGL_PLATFORM_X11_KHR,
+- (void *) b->dpy,
++ (void *) b->dpy, NULL,
+ gl_renderer->opaque_attribs, NULL, 0);
+
+ return ret;
+diff --git a/src/gl-renderer.c b/src/gl-renderer.c
+index b0bee7f6a94f..7f522055fac8 100644
+--- a/src/gl-renderer.c
++++ b/src/gl-renderer.c
+@@ -2874,8 +2874,8 @@ platform_to_extension(EGLenum platform)
+
+ static int
+ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
+- void *native_window, const EGLint *config_attribs,
+- const EGLint *visual_id, int n_ids)
++ void *native_window, const EGLint *platform_attribs,
++ const EGLint *config_attribs, const EGLint *visual_id, int n_ids)
+ {
+ struct gl_renderer *gr;
+ EGLint major, minor;
+@@ -2917,7 +2917,7 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
+ if (get_platform_display && platform) {
+ gr->egl_display = get_platform_display(platform,
+ native_window,
+- NULL);
++ platform_attribs);
+ }
+ }
+
+diff --git a/src/gl-renderer.h b/src/gl-renderer.h
+index d43131940f43..f778cd9b6f69 100644
+--- a/src/gl-renderer.h
++++ b/src/gl-renderer.h
+@@ -78,6 +78,7 @@ struct gl_renderer_interface {
+ int (*display_create)(struct weston_compositor *ec,
+ EGLenum platform,
+ void *native_window,
++ const EGLint *platform_attribs,
+ const EGLint *config_attribs,
+ const EGLint *visual_id,
+ const int n_ids);
+--
+2.8.3
+
diff --git a/0005-gl-renderer-Accept-non-NULL-empty-visual_id-arrays.patch b/0005-gl-renderer-Accept-non-NULL-empty-visual_id-arrays.patch
new file mode 100644
index 00000000000..8af11b53729
--- /dev/null
+++ b/0005-gl-renderer-Accept-non-NULL-empty-visual_id-arrays.patch
@@ -0,0 +1,32 @@
+From d55b51e9bdd451c0ff635d8937e1e818a6de1216 Mon Sep 17 00:00:00 2001
+From: "Miguel A. Vico" <mvicomoya@nvidia.com>
+Date: Wed, 30 Mar 2016 15:29:37 +0200
+Subject: [PATCH 05/11] gl-renderer: Accept non-NULL empty <visual_id> arrays
+X-NVConfidentiality: public
+
+This change modifies egl_choose_config() to accept a non-NULL but empty
+<visual_id> array (i.e. n_ids == 0)
+
+Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
+Reviewed-by: Andy Ritger <aritger@nvidia.com>
+Reviewed-by: James Jones <jajones@nvidia.com>
+---
+ src/gl-renderer.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/gl-renderer.c b/src/gl-renderer.c
+index 7f522055fac8..1d76488c2165 100644
+--- a/src/gl-renderer.c
++++ b/src/gl-renderer.c
+@@ -2493,7 +2493,7 @@ egl_choose_config(struct gl_renderer *gr, const EGLint *attribs,
+ goto out;
+ }
+
+- if (!visual_id)
++ if (!visual_id || n_ids == 0)
+ config_index = 0;
+
+ for (i = 0; config_index == -1 && i < n_ids; i++)
+--
+2.8.3
+
diff --git a/0006-compositor-drm-Renaming-of-gbm-fields.patch b/0006-compositor-drm-Renaming-of-gbm-fields.patch
deleted file mode 100644
index 7048d84cad6..00000000000
--- a/0006-compositor-drm-Renaming-of-gbm-fields.patch
+++ /dev/null
@@ -1,228 +0,0 @@
-From b50d1674382c982747b9091215bb02c860380fd9 Mon Sep 17 00:00:00 2001
-From: "Miguel A. Vico" <mvicomoya@nvidia.com>
-Date: Mon, 21 Mar 2016 17:41:03 +0100
-Subject: [PATCH 6/7] compositor-drm: Renaming of gbm fields
-X-NVConfidentiality: public
-
-In preparation for follow-on changes to support frame presentation
-through EGLDevice+EGLOutput, this change includes the following:
- - Rename drm_backend::format to gbm_format
- - Rename drm_output::format to gbm_format
- - Rename drm_output::surface to gbm_surface
- - Rename drm_output::cursor_bo to gbm_cursor_bo
-
-Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
-Reviewed-by: Andy Ritger <aritger@nvidia.com>
-Reviewed-by: Daniel Stone <daniels@collabora.com>
-[Pekka: trivial rebase out of the series]
-Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-
-(cherry picked from commit fcf4b6c0aef3d2e3afda5fa8a4d4127585f7231b)
-
-Conflicts:
- src/compositor-drm.c
----
- src/compositor-drm.c | 58 ++++++++++++++++++++++++++--------------------------
- 1 file changed, 29 insertions(+), 29 deletions(-)
-
-diff --git a/src/compositor-drm.c b/src/compositor-drm.c
-index a6d4573a922f..6c2816152307 100644
---- a/src/compositor-drm.c
-+++ b/src/compositor-drm.c
-@@ -107,7 +107,7 @@ struct drm_backend {
- uint32_t crtc_allocator;
- uint32_t connector_allocator;
- struct wl_listener session_listener;
-- uint32_t format;
-+ uint32_t gbm_format;
-
- /* we need these parameters in order to not fail drmModeAddFB2()
- * due to out of bounds dimensions, and then mistakenly set
-@@ -170,7 +170,7 @@ struct drm_output {
- drmModeCrtcPtr original_crtc;
- struct drm_edid edid;
- drmModePropertyPtr dpms_prop;
-- uint32_t format;
-+ uint32_t gbm_format;
-
- enum dpms_enum dpms;
-
-@@ -178,8 +178,8 @@ struct drm_output {
- int page_flip_pending;
- int destroy_pending;
-
-- struct gbm_surface *surface;
-- struct gbm_bo *cursor_bo[2];
-+ struct gbm_surface *gbm_surface;
-+ struct gbm_bo *gbm_cursor_bo[2];
- struct weston_plane cursor_plane;
- struct weston_plane fb_plane;
- struct weston_view *cursor_view;
-@@ -439,7 +439,7 @@ drm_output_release_fb(struct drm_output *output, struct drm_fb *fb)
- if (fb->is_client_buffer)
- gbm_bo_destroy(fb->bo);
- else
-- gbm_surface_release_buffer(output->surface,
-+ gbm_surface_release_buffer(output->gbm_surface,
- fb->bo);
- }
- }
-@@ -468,7 +468,7 @@ drm_output_check_scanout_format(struct drm_output *output,
- pixman_region32_fini(&r);
- }
-
-- if (output->format == format)
-+ if (output->gbm_format == format)
- return format;
-
- return 0;
-@@ -531,16 +531,16 @@ drm_output_render_gl(struct drm_output *output, pixman_region32_t *damage)
- output->base.compositor->renderer->repaint_output(&output->base,
- damage);
-
-- bo = gbm_surface_lock_front_buffer(output->surface);
-+ bo = gbm_surface_lock_front_buffer(output->gbm_surface);
- if (!bo) {
- weston_log("failed to lock front buffer: %m\n");
- return;
- }
-
-- output->next = drm_fb_get_from_bo(bo, b, output->format);
-+ output->next = drm_fb_get_from_bo(bo, b, output->gbm_format);
- if (!output->next) {
- weston_log("failed to get drm_fb for bo\n");
-- gbm_surface_release_buffer(output->surface, bo);
-+ gbm_surface_release_buffer(output->gbm_surface, bo);
- return;
- }
- }
-@@ -1210,7 +1210,7 @@ drm_output_set_cursor(struct drm_output *output)
- pixman_region32_fini(&output->cursor_plane.damage);
- pixman_region32_init(&output->cursor_plane.damage);
- output->current_cursor ^= 1;
-- bo = output->cursor_bo[output->current_cursor];
-+ bo = output->gbm_cursor_bo[output->current_cursor];
-
- cursor_bo_update(b, bo, ev);
- handle = gbm_bo_get_handle(bo).s32;
-@@ -1362,7 +1362,7 @@ drm_output_destroy(struct weston_output *output_base)
- drm_output_fini_pixman(output);
- } else {
- gl_renderer->output_destroy(output_base);
-- gbm_surface_destroy(output->surface);
-+ gbm_surface_destroy(output->gbm_surface);
- }
-
- weston_plane_release(&output->fb_plane);
-@@ -1463,7 +1463,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
- }
- } else {
- gl_renderer->output_destroy(&output->base);
-- gbm_surface_destroy(output->surface);
-+ gbm_surface_destroy(output->gbm_surface);
-
- if (drm_output_init_egl(output, b) < 0) {
- weston_log("failed to init output egl state with "
-@@ -1595,8 +1595,8 @@ static int
- drm_backend_create_gl_renderer(struct drm_backend *b)
- {
- EGLint format[3] = {
-- b->format,
-- fallback_format_for(b->format),
-+ b->gbm_format,
-+ fallback_format_for(b->gbm_format),
- 0,
- };
- int n_formats = 2;
-@@ -1853,18 +1853,18 @@ static int
- drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
- {
- EGLint format[2] = {
-- output->format,
-- fallback_format_for(output->format),
-+ output->gbm_format,
-+ fallback_format_for(output->gbm_format),
- };
- int i, flags, n_formats = 1;
-
-- output->surface = gbm_surface_create(b->gbm,
-+ output->gbm_surface = gbm_surface_create(b->gbm,
- output->base.current_mode->width,
- output->base.current_mode->height,
- format[0],
- GBM_BO_USE_SCANOUT |
- GBM_BO_USE_RENDERING);
-- if (!output->surface) {
-+ if (!output->gbm_surface) {
- weston_log("failed to create gbm surface\n");
- return -1;
- }
-@@ -1872,28 +1872,28 @@ drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
- if (format[1])
- n_formats = 2;
- if (gl_renderer->output_window_create(&output->base,
-- (EGLNativeWindowType)output->surface,
-- output->surface,
-+ (EGLNativeWindowType)output->gbm_surface,
-+ output->gbm_surface,
- gl_renderer->opaque_attribs,
- format,
- n_formats) < 0) {
- weston_log("failed to create gl renderer output state\n");
-- gbm_surface_destroy(output->surface);
-+ gbm_surface_destroy(output->gbm_surface);
- return -1;
- }
-
- flags = GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE;
-
- for (i = 0; i < 2; i++) {
-- if (output->cursor_bo[i])
-+ if (output->gbm_cursor_bo[i])
- continue;
-
-- output->cursor_bo[i] =
-+ output->gbm_cursor_bo[i] =
- gbm_bo_create(b->gbm, b->cursor_width, b->cursor_height,
- GBM_FORMAT_ARGB8888, flags);
- }
-
-- if (output->cursor_bo[0] == NULL || output->cursor_bo[1] == NULL) {
-+ if (output->gbm_cursor_bo[0] == NULL || output->gbm_cursor_bo[1] == NULL) {
- weston_log("cursor buffers unavailable, using gl cursors\n");
- b->cursors_are_broken = 1;
- }
-@@ -2375,9 +2375,9 @@ create_output_for_connector(struct drm_backend *b,
- free(s);
-
- if (get_gbm_format_from_section(section,
-- b->format,
-- &output->format) == -1)
-- output->format = b->format;
-+ b->gbm_format,
-+ &output->gbm_format) == -1)
-+ output->gbm_format = b->gbm_format;
-
- weston_config_section_get_string(section, "seat", &s, "");
- setup_output_seat_constraint(b, &output->base, s);
-@@ -2992,7 +2992,7 @@ recorder_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key,
- struct drm_output, base.link);
-
- if (!output->recorder) {
-- if (output->format != GBM_FORMAT_XRGB8888) {
-+ if (output->gbm_format != GBM_FORMAT_XRGB8888) {
- weston_log("failed to start vaapi recorder: "
- "output format not supported\n");
- return;
-@@ -3118,7 +3118,7 @@ drm_backend_create(struct weston_compositor *compositor,
- section = weston_config_get_section(config, "core", NULL, NULL);
- if (get_gbm_format_from_section(section,
- GBM_FORMAT_XRGB8888,
-- &b->format) == -1)
-+ &b->gbm_format) == -1)
- goto err_base;
-
- b->use_pixman = param->use_pixman;
---
-2.7.4
-
diff --git a/0002-gl-renderer-Refactor-gl_renderer_output_window_creat.patch b/0006-gl-renderer-Refactor-gl_renderer_output_window_creat.patch
index 2c4528b9499..1f009b7f754 100644
--- a/0002-gl-renderer-Refactor-gl_renderer_output_window_creat.patch
+++ b/0006-gl-renderer-Refactor-gl_renderer_output_window_creat.patch
@@ -1,7 +1,8 @@
-From 1a6f5e3586cf62029a8bed8072bd41e845746bad Mon Sep 17 00:00:00 2001
+From 2309d0381a9353651f7d080190c43702c76d2075 Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
-Date: Mon, 21 Mar 2016 17:37:32 +0100
-Subject: [PATCH 2/7] gl-renderer: Refactor gl_renderer_output_window_create()
+Date: Fri, 26 Feb 2016 15:44:59 +0100
+Subject: [PATCH 06/11] gl-renderer: Refactor
+ gl_renderer_output_window_create()
X-NVConfidentiality: public
In preparation for follow-on changes to support frame presentation
@@ -13,12 +14,13 @@ Bonus: Fix EGLSurface leakage upon gl_renderer_setup() failure.
Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
+Reviewed-by: James Jones <jajones@nvidia.com>
---
- src/gl-renderer.c | 91 +++++++++++++++++++++++++++++++++++++------------------
- 1 file changed, 62 insertions(+), 29 deletions(-)
+ src/gl-renderer.c | 96 ++++++++++++++++++++++++++++++++++++-------------------
+ 1 file changed, 64 insertions(+), 32 deletions(-)
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
-index 0c55e0b9ebd2..1d6d98c9b86b 100644
+index 1d76488c2165..c208f36a5165 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -1,6 +1,7 @@
@@ -58,7 +60,7 @@ index 0c55e0b9ebd2..1d6d98c9b86b 100644
}
if (egl_config != gr->egl_config &&
-@@ -2571,48 +2569,83 @@ gl_renderer_output_window_create(struct weston_output *output,
+@@ -2571,48 +2569,82 @@ gl_renderer_output_window_create(struct weston_output *output,
weston_log("attempted to use a different EGL config for an "
"output but EGL_MESA_configless_context is not "
"supported\n");
@@ -92,7 +94,12 @@ index 0c55e0b9ebd2..1d6d98c9b86b 100644
+ egl_surface = eglCreateWindowSurface(gr->egl_display,
+ egl_config,
+ window_for_legacy, NULL);
-+
+
+- if (go->egl_surface == EGL_NO_SURFACE) {
+- weston_log("failed to create egl surface\n");
+- free(go);
+- return -1;
+- }
+ return egl_surface;
+}
+
@@ -105,13 +112,6 @@ index 0c55e0b9ebd2..1d6d98c9b86b 100644
+ struct gl_output_state *go;
+ int i;
-- if (go->egl_surface == EGL_NO_SURFACE) {
-+ if (surface == EGL_NO_SURFACE) {
- weston_log("failed to create egl surface\n");
-- free(go);
- return -1;
- }
-
if (gr->egl_context == NULL)
- if (gl_renderer_setup(ec, go->egl_surface) < 0) {
- free(go);
@@ -153,9 +153,13 @@ index 0c55e0b9ebd2..1d6d98c9b86b 100644
+ window_for_platform,
+ config_attribs,
+ visual_id, n_ids);
++ if (egl_surface == EGL_NO_SURFACE) {
++ weston_log("failed to create egl surface\n");
++ return -1;
++ }
+
+ ret = gl_renderer_output_create(output, egl_surface);
-+ if (ret < 0 && egl_surface != EGL_NO_SURFACE)
++ if (ret < 0)
+ eglDestroySurface(gr->egl_display, egl_surface);
+
+ return ret;
@@ -165,5 +169,5 @@ index 0c55e0b9ebd2..1d6d98c9b86b 100644
gl_renderer_output_destroy(struct weston_output *output)
{
--
-2.7.4
+2.8.3
diff --git a/0007-gl-renderer-Add-EGLDevice-enumeration-support.patch b/0007-gl-renderer-Add-EGLDevice-enumeration-support.patch
new file mode 100644
index 00000000000..d0e2d74a759
--- /dev/null
+++ b/0007-gl-renderer-Add-EGLDevice-enumeration-support.patch
@@ -0,0 +1,146 @@
+From 1ba420dd543f35b3f5b9988efb5368c26f34c270 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 07/11] gl-renderer: Add EGLDevice enumeration support
+X-NVConfidentiality: public
+
+EGLDevice provides means to enumerate native devices.
+
+In preparation for follow-on changes to support frame presentation
+through EGLDevice+EGLOutput, this change adds both
+gl_renderer_get_devices() and gl_renderer_get_drm_device_file()
+functions which will help to enumerate EGLDevices and match them to DRM
+devices.
+
+Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
+Reviewed-by: Andy Ritger <aritger@nvidia.com>
+Reviewed-by: Adam Cheney <acheney@nvidia.com>
+Reviewed-by: James Jones <jajones@nvidia.com>
+---
+ src/gl-renderer.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ src/gl-renderer.h | 7 +++++
+ 2 files changed, 93 insertions(+), 1 deletion(-)
+
+diff --git a/src/gl-renderer.c b/src/gl-renderer.c
+index c208f36a5165..098440ce30a2 100644
+--- a/src/gl-renderer.c
++++ b/src/gl-renderer.c
+@@ -3175,6 +3175,88 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
+ return 0;
+ }
+
++static int
++gl_renderer_get_devices(EGLint max_devices, EGLDeviceEXT *devices,
++ EGLint *num_devices)
++{
++ const char *extensions;
++ PFNEGLQUERYDEVICESEXTPROC query_devices;
++
++ extensions = (const char *)eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
++ if (!extensions) {
++ weston_log("Retrieving EGL extension string failed.\n");
++ return -1;
++ }
++
++ if (!check_extension(extensions, "EGL_EXT_device_base") &&
++ (!check_extension(extensions, "EGL_EXT_device_query") ||
++ !check_extension(extensions, "EGL_EXT_device_enumeration"))) {
++ weston_log("EGL_EXT_device_base not supported\n");
++ return -1;
++ }
++
++ query_devices = (void *) eglGetProcAddress("eglQueryDevicesEXT");
++ if (!query_devices) {
++ weston_log("Failed to get eglQueryDevicesEXT function\n");
++ return -1;
++ }
++
++ if (query_devices(max_devices, devices, num_devices) != EGL_TRUE) {
++ weston_log("Failed to query EGL Devices\n");
++ gl_renderer_print_egl_error_state();
++ return -1;
++ }
++
++ return 0;
++}
++
++static int
++gl_renderer_get_drm_device_file(EGLDeviceEXT device,
++ const char **drm_device_file)
++{
++ const char *extensions;
++ PFNEGLQUERYDEVICESTRINGEXTPROC query_device_string;
++
++ extensions = (const char *)eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
++ if (!extensions) {
++ weston_log("Retrieving EGL extension string failed.\n");
++ return -1;
++ }
++
++ if (!check_extension(extensions, "EGL_EXT_device_base") &&
++ (!check_extension(extensions, "EGL_EXT_device_query") ||
++ !check_extension(extensions, "EGL_EXT_device_enumeration"))) {
++ weston_log("EGL_EXT_device_base not supported.\n");
++ return -1;
++ }
++
++ query_device_string = (void *) eglGetProcAddress("eglQueryDeviceStringEXT");
++ if (!query_device_string) {
++ weston_log("Failed to get eglQueryDeviceStringEXT function\n");
++ return -1;
++ }
++
++ extensions = query_device_string(device, EGL_EXTENSIONS);
++ if (!extensions) {
++ weston_log("Retrieving EGL extension string failed.\n");
++ return -1;
++ }
++
++ if (!check_extension(extensions, "EGL_EXT_device_drm")) {
++ weston_log("EGL_EXT_device_drm not supported.\n");
++ return -1;
++ }
++
++ (*drm_device_file) = query_device_string(device, EGL_DRM_DEVICE_FILE_EXT);
++ if (*drm_device_file == NULL) {
++ weston_log("Failed to query DRM device name.\n");
++ gl_renderer_print_egl_error_state();
++ return -1;
++ }
++
++ return 0;
++}
++
+ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
+ .opaque_attribs = gl_renderer_opaque_attribs,
+ .alpha_attribs = gl_renderer_alpha_attribs,
+@@ -3185,5 +3267,8 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
+ .output_destroy = gl_renderer_output_destroy,
+ .output_surface = gl_renderer_output_surface,
+ .output_set_border = gl_renderer_output_set_border,
+- .print_egl_error_state = gl_renderer_print_egl_error_state
++ .print_egl_error_state = gl_renderer_print_egl_error_state,
++
++ .get_devices = gl_renderer_get_devices,
++ .get_drm_device_file = gl_renderer_get_drm_device_file
+ };
+diff --git a/src/gl-renderer.h b/src/gl-renderer.h
+index f778cd9b6f69..f376edd80106 100644
+--- a/src/gl-renderer.h
++++ b/src/gl-renderer.h
+@@ -129,5 +129,12 @@ struct gl_renderer_interface {
+ int32_t tex_width, unsigned char *data);
+
+ void (*print_egl_error_state)(void);
++
++ int (*get_devices)(EGLint max_devices,
++ EGLDeviceEXT *devices,
++ EGLint *num_devices);
++
++ int (*get_drm_device_file)(EGLDeviceEXT device,
++ const char **drm_device_file);
+ };
+
+--
+2.8.3
+
diff --git a/0004-gl-renderer-Add-support-for-EGLDevice-EGLOutput.patch b/0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch
index f720cef9b67..72d9ef25c95 100644
--- a/0004-gl-renderer-Add-support-for-EGLDevice-EGLOutput.patch
+++ b/0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch
@@ -1,7 +1,8 @@
-From 89af96dc92477e94383ea02712b46fa2da03a438 Mon Sep 17 00:00:00 2001
+From 13ffa3ad89037a8e686633468b762fb9b92c95c8 Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
-Date: Mon, 21 Mar 2016 17:37:34 +0100
-Subject: [PATCH 4/7] gl-renderer: Add support for EGLDevice+EGLOutput
+Date: Mon, 2 May 2016 16:34:01 +0200
+Subject: [PATCH 08/11] gl-renderer: Add support for EGLDevice composited frame
+ presentation
X-NVConfidentiality: public
EGLDevice provides means to enumerate native devices, and then create
@@ -22,11 +23,6 @@ Thus, a compositor could produce frames and feed them to an
EGLOutputLayer through an EGLStream for presentation on a display
device.
-In a similar way, by attaching a GLTexture consumer to a stream, a
-producer (wayland 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.
@@ -41,43 +37,21 @@ Note that some unpublished EGL extensions were needed:
- EGL_NV_output_drm_flip_event:
https://github.com/aritger/eglstreams-kms-example/blob/master/proposed-extensions/EGL_NV_output_drm_flip_event.txt
-Also, in order to allow wl_buffers to be bound to EGLStreams, we
-kludged eglQueryWaylandBufferWL(EGL_WAYLAND_BUFFER_WL) to return
-the stream file descriptor.
-
-We think the proper way to handle this should be:
-
- - Update WL_bind_wayland_display such that eglQueryWaylandBufferWL() accepts
- a new attribute EGL_WAYLAND_BUFFER_TYPE_WL, returning
- EGL_WAYLAND_BUFFER_EGLIMAGE_WL for the non-stream case.
-
- - Add a new WL_wayland_buffer_eglstream extension, which would define
- EGL_WAYLAND_BUFFER_EGLSTREAM_WL as a return value for
- EGL_WAYLAND_BUFFER_TYPE_WL, and yet another attribute
- EGL_WAYLAND_BUFFER_EGLSTREAM_FD_WL to query the stream file descriptor.
-
Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: Adam Cheney <acheney@nvidia.com>
+Reviewed-by: James Jones <jajones@nvidia.com>
---
- src/gl-renderer.c | 476 ++++++++++++++++++++++++++++++++++++++++++++++++++-
- src/gl-renderer.h | 26 +++
- src/weston-egl-ext.h | 19 ++
- 3 files changed, 517 insertions(+), 4 deletions(-)
+ src/gl-renderer.c | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++-
+ src/gl-renderer.h | 19 ++++
+ src/weston-egl-ext.h | 18 ++++
+ 3 files changed, 285 insertions(+), 3 deletions(-)
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
-index 887d131674f5..07879cb83b60 100644
+index 098440ce30a2..764bd880d743 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
-@@ -30,6 +30,7 @@
- #include <GLES2/gl2.h>
- #include <GLES2/gl2ext.h>
-
-+#include <unistd.h>
- #include <stdbool.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -84,6 +85,8 @@ struct gl_output_state {
+@@ -84,6 +84,8 @@ struct gl_output_state {
struct gl_border_image borders[4];
enum gl_border_status border_status;
@@ -86,23 +60,18 @@ index 887d131674f5..07879cb83b60 100644
struct weston_matrix output_matrix;
};
-@@ -159,6 +162,9 @@ struct gl_surface_state {
- int height; /* in pixels */
- int y_inverted;
-
-+ EGLStreamKHR egl_stream;
-+ bool stream_frame_acquired;
-+
- struct weston_surface *surface;
-
- struct wl_listener surface_destroy_listener;
-@@ -202,6 +208,36 @@ struct gl_renderer {
+@@ -202,6 +204,27 @@ struct gl_renderer {
int has_configless_context;
++ PFNEGLGETOUTPUTLAYERSEXTPROC get_output_layers;
++ PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC query_output_layer_attrib;
++ int has_egl_output_base;
++ int has_egl_output_drm;
++ int has_egl_output_drm_flip_event;
++
+ PFNEGLCREATESTREAMKHRPROC create_stream;
+ PFNEGLDESTROYSTREAMKHRPROC destroy_stream;
-+ PFNEGLQUERYSTREAMKHRPROC query_stream;
+ int has_egl_stream;
+
+ PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC create_stream_producer_surface;
@@ -111,76 +80,15 @@ index 887d131674f5..07879cb83b60 100644
+ PFNEGLSTREAMCONSUMEROUTPUTEXTPROC stream_consumer_output;
+ int has_egl_stream_consumer_egloutput;
+
-+ PFNEGLSTREAMCONSUMERACQUIREKHRPROC stream_consumer_acquire;
+#ifdef EGL_EXT_stream_acquire_mode
+ PFNEGLSTREAMCONSUMERACQUIREATTRIBEXTPROC stream_consumer_acquire_attrib;
+#endif
+ int has_egl_stream_acquire_mode;
+
-+ int has_egl_output_drm;
-+ int has_egl_output_drm_flip_event;
-+
-+ PFNEGLGETOUTPUTLAYERSEXTPROC get_output_layers;
-+ PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC query_output_layer_attrib;
-+ int has_egl_output_base;
-+
-+ PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC create_stream_from_file_descriptor;
-+ int has_egl_stream_cross_process_fd;
-+
-+ PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC stream_consumer_gltexture;
-+ int has_egl_stream_consumer_gltexture;
-+
int has_dmabuf_import;
struct wl_list dmabuf_images;
-@@ -735,6 +771,7 @@ draw_view(struct weston_view *ev, struct weston_output *output,
- /* non-opaque region in surface coordinates: */
- pixman_region32_t surface_blend;
- GLint filter;
-+ EGLint stream_state = EGL_STREAM_STATE_EMPTY_KHR;
- int i;
-
- /* In case of a runtime switch of renderers, we may not have received
-@@ -743,6 +780,21 @@ draw_view(struct weston_view *ev, struct weston_output *output,
- if (!gs->shader)
- return;
-
-+ /* If using EGLStreams, only continue if we are certain we have something to
-+ * render, i.e. a new frame is available or an old one was previously
-+ * acquired and is ready to be re-used */
-+ if (gs->egl_stream != EGL_NO_STREAM_KHR) {
-+ if (gr->query_stream(gr->egl_display,
-+ gs->egl_stream,
-+ EGL_STREAM_STATE_KHR,
-+ &stream_state) != EGL_TRUE)
-+ return;
-+
-+ if (stream_state != EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR &&
-+ !gs->stream_frame_acquired)
-+ return;
-+ }
-+
- pixman_region32_init(&repaint);
- pixman_region32_intersect(&repaint,
- &ev->transform.boundingbox, damage);
-@@ -774,6 +826,16 @@ draw_view(struct weston_view *ev, struct weston_output *output,
- glTexParameteri(gs->target, GL_TEXTURE_MAG_FILTER, filter);
- }
-
-+ /* If using EGLStreams, we need to acquire the new frame, if any */
-+ if (gs->egl_stream != EGL_NO_STREAM_KHR &&
-+ stream_state == EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR) {
-+ if (gr->stream_consumer_acquire(gr->egl_display,
-+ gs->egl_stream) != EGL_TRUE)
-+ goto out;
-+
-+ gs->stream_frame_acquired = true;
-+ }
-+
- /* blended region is whole surface minus opaque region: */
- pixman_region32_init_rect(&surface_blend, 0, 0,
- ev->surface->width, ev->surface->height);
-@@ -1193,6 +1255,37 @@ gl_renderer_repaint_output(struct weston_output *output,
+@@ -1193,6 +1216,37 @@ gl_renderer_repaint_output(struct weston_output *output,
}
static int
@@ -218,135 +126,7 @@ index 887d131674f5..07879cb83b60 100644
gl_renderer_read_pixels(struct weston_output *output,
pixman_format_code_t format, void *pixels,
uint32_t x, uint32_t y,
-@@ -1884,6 +1977,72 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
- }
-
- static void
-+gl_renderer_attach_egl_fd_texture(struct weston_surface *es,
-+ struct weston_buffer *buffer,
-+ EGLNativeFileDescriptorKHR streamFd)
-+{
-+ struct weston_compositor *ec = es->compositor;
-+ struct gl_renderer *gr = get_renderer(ec);
-+ struct gl_surface_state *gs = get_surface_state(es);
-+
-+ /* If an invalid streamFd is provided, either there was an error creating
-+ * the buffer or this buffer is already attached. Either case, there's
-+ * nothing to be done */
-+ if (streamFd < 0)
-+ return;
-+
-+ /* 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 = EGL_NO_STREAM_KHR;
-+ gs->stream_frame_acquired = false;
-+ }
-+
-+ gs->egl_stream =
-+ gr->create_stream_from_file_descriptor(gr->egl_display, streamFd);
-+ close(streamFd);
-+
-+ if (gs->egl_stream == EGL_NO_STREAM_KHR) {
-+ weston_log("failed to create egl stream\n");
-+ goto err_attach_egl_fd_base;
-+ }
-+
-+ gs->shader = &gr->texture_shader_egl_external;
-+ gs->target = GL_TEXTURE_EXTERNAL_OES;
-+
-+ glActiveTexture(GL_TEXTURE0);
-+ ensure_textures(gs, 1);
-+ glBindTexture(gs->target, gs->textures[0]);
-+
-+ if (gr->stream_consumer_gltexture(gr->egl_display, gs->egl_stream) != EGL_TRUE) {
-+ weston_log("failed to set stream consumer\n");
-+ goto err_attach_egl_fd_stream;
-+ }
-+
-+ 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);
-+ buffer->y_inverted = 0;
-+
-+ gs->pitch = buffer->width;
-+ gs->height = buffer->height;
-+ gs->buffer_type = BUFFER_TYPE_EGL;
-+ gs->y_inverted = buffer->y_inverted;
-+
-+ return;
-+
-+err_attach_egl_fd_stream:
-+ gr->destroy_stream(gr->egl_display, gs->egl_stream);
-+ gs->egl_stream = EGL_NO_STREAM_KHR;
-+
-+err_attach_egl_fd_base:
-+ gl_renderer_print_egl_error_state();
-+ return;
-+}
-+
-+static void
- gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
- {
- struct weston_compositor *ec = es->compositor;
-@@ -1891,6 +2050,7 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
- struct gl_surface_state *gs = get_surface_state(es);
- struct wl_shm_buffer *shm_buffer;
- struct linux_dmabuf_buffer *dmabuf;
-+ EGLNativeFileDescriptorKHR streamFd;
- EGLint format;
- int i;
-
-@@ -1906,6 +2066,13 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
- gs->num_textures = 0;
- gs->buffer_type = BUFFER_TYPE_NULL;
- gs->y_inverted = 1;
-+
-+ if (gs->egl_stream != EGL_NO_STREAM_KHR) {
-+ gr->destroy_stream(gr->egl_display, gs->egl_stream);
-+ gs->egl_stream = EGL_NO_STREAM_KHR;
-+ gs->stream_frame_acquired = false;
-+ }
-+
- return;
- }
-
-@@ -1918,7 +2085,11 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
- gl_renderer_attach_egl(es, buffer, format);
- else if ((dmabuf = linux_dmabuf_buffer_get(buffer->resource)))
- gl_renderer_attach_dmabuf(es, buffer, dmabuf);
-- else {
-+ else if (gr->query_buffer(gr->egl_display, (void *) buffer->resource,
-+ EGL_WAYLAND_BUFFER_WL, &streamFd)) {
-+ /* FIXME: WL_bind_wayland_display violation */
-+ gl_renderer_attach_egl_fd_texture(es, buffer, streamFd);
-+ } else {
- weston_log("unhandled buffer type!\n");
- weston_buffer_reference(&gs->buffer_ref, NULL);
- gs->buffer_type = BUFFER_TYPE_NULL;
-@@ -2106,6 +2277,10 @@ surface_state_destroy(struct gl_surface_state *gs, struct gl_renderer *gr)
-
- weston_buffer_reference(&gs->buffer_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);
- }
-
-@@ -2156,6 +2331,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;
-
-@@ -2587,9 +2764,92 @@ gl_renderer_create_window_surface(struct gl_renderer *gr,
+@@ -2587,9 +2641,92 @@ gl_renderer_create_window_surface(struct gl_renderer *gr,
return egl_surface;
}
@@ -440,7 +220,7 @@ index 887d131674f5..07879cb83b60 100644
{
struct weston_compositor *ec = output->compositor;
struct gl_renderer *gr = get_renderer(ec);
-@@ -2611,6 +2871,7 @@ gl_renderer_output_create(struct weston_output *output,
+@@ -2606,6 +2743,7 @@ gl_renderer_output_create(struct weston_output *output,
return -1;
go->egl_surface = surface;
@@ -448,13 +228,13 @@ index 887d131674f5..07879cb83b60 100644
for (i = 0; i < BUFFER_DAMAGE_COUNT; i++)
pixman_region32_init(&go->buffer_damage[i]);
-@@ -2639,13 +2900,41 @@ gl_renderer_output_window_create(struct weston_output *output,
- config_attribs,
- visual_id, n_ids);
+@@ -2638,13 +2776,41 @@ gl_renderer_output_window_create(struct weston_output *output,
+ return -1;
+ }
- ret = gl_renderer_output_create(output, egl_surface);
+ ret = gl_renderer_output_create(output, egl_surface, EGL_NO_STREAM_KHR);
- if (ret < 0 && egl_surface != EGL_NO_SURFACE)
+ if (ret < 0)
eglDestroySurface(gr->egl_display, egl_surface);
return ret;
@@ -476,13 +256,13 @@ index 887d131674f5..07879cb83b60 100644
+ output->current_mode->width,
+ output->current_mode->height,
+ &egl_stream);
++ if (egl_surface == EGL_NO_SURFACE)
++ return -1;
+
+ ret = gl_renderer_output_create(output, egl_surface, egl_stream);
+ if (ret < 0) {
-+ if (egl_surface != EGL_NO_SURFACE)
-+ eglDestroySurface(gr->egl_display, egl_surface);
-+ if (egl_stream != EGL_NO_STREAM_KHR)
-+ gr->destroy_stream(gr->egl_display, egl_stream);
++ eglDestroySurface(gr->egl_display, egl_surface);
++ gr->destroy_stream(gr->egl_display, egl_stream);
+ }
+
+ return ret;
@@ -491,7 +271,7 @@ index 887d131674f5..07879cb83b60 100644
static void
gl_renderer_output_destroy(struct weston_output *output)
{
-@@ -2658,6 +2947,9 @@ gl_renderer_output_destroy(struct weston_output *output)
+@@ -2657,6 +2823,9 @@ gl_renderer_output_destroy(struct weston_output *output)
eglDestroySurface(gr->egl_display, go->egl_surface);
@@ -501,26 +281,19 @@ index 887d131674f5..07879cb83b60 100644
free(go);
}
-@@ -2762,6 +3054,26 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
+@@ -2761,6 +2930,19 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
(void *) eglGetProcAddress("eglUnbindWaylandDisplayWL");
gr->query_buffer =
(void *) eglGetProcAddress("eglQueryWaylandBufferWL");
++ gr->get_output_layers = (void *) eglGetProcAddress("eglGetOutputLayersEXT");
++ gr->query_output_layer_attrib =
++ (void *) eglGetProcAddress("eglQueryOutputLayerAttribEXT");
+ gr->create_stream = (void *) eglGetProcAddress("eglCreateStreamKHR");
+ gr->destroy_stream = (void *) eglGetProcAddress("eglDestroyStreamKHR");
-+ gr->query_stream = (void *) eglGetProcAddress("eglQueryStreamKHR");
+ gr->create_stream_producer_surface =
+ (void *) eglGetProcAddress("eglCreateStreamProducerSurfaceKHR");
+ gr->stream_consumer_output =
+ (void *) eglGetProcAddress("eglStreamConsumerOutputEXT");
-+ gr->get_output_layers = (void *) eglGetProcAddress("eglGetOutputLayersEXT");
-+ gr->query_output_layer_attrib =
-+ (void *) eglGetProcAddress("eglQueryOutputLayerAttribEXT");
-+ gr->create_stream_from_file_descriptor =
-+ (void *) eglGetProcAddress("eglCreateStreamFromFileDescriptorKHR");
-+ gr->stream_consumer_gltexture =
-+ (void *) eglGetProcAddress("eglStreamConsumerGLTextureExternalKHR");
-+ gr->stream_consumer_acquire =
-+ (void *) eglGetProcAddress("eglStreamConsumerAcquireKHR");
+#ifdef EGL_EXT_stream_acquire_mode
+ gr->stream_consumer_acquire_attrib =
+ (void *) eglGetProcAddress("eglStreamConsumerAcquireAttribEXT");
@@ -528,10 +301,19 @@ index 887d131674f5..07879cb83b60 100644
extensions =
(const char *) eglQueryString(gr->egl_display, EGL_EXTENSIONS);
-@@ -2803,6 +3115,33 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
+@@ -2802,6 +2984,27 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
gr->has_dmabuf_import = 1;
#endif
++ if (check_extension(extensions, "EGL_EXT_output_base"))
++ gr->has_egl_output_base = 1;
++
++ if (check_extension(extensions, "EGL_EXT_output_drm"))
++ gr->has_egl_output_drm = 1;
++
++ if (check_extension(extensions, "EGL_NV_output_drm_flip_event"))
++ gr->has_egl_output_drm_flip_event = 1;
++
+ if (check_extension(extensions, "EGL_KHR_stream"))
+ gr->has_egl_stream = 1;
+
@@ -541,28 +323,13 @@ index 887d131674f5..07879cb83b60 100644
+ if (check_extension(extensions, "EGL_EXT_stream_consumer_egloutput"))
+ gr->has_egl_stream_consumer_egloutput = 1;
+
-+ if (check_extension(extensions, "EGL_KHR_stream_consumer_gltexture"))
-+ gr->has_egl_stream_consumer_gltexture = 1;
-+
+ if (check_extension(extensions, "EGL_EXT_stream_acquire_mode"))
+ gr->has_egl_stream_acquire_mode = 1;
+
-+ if (check_extension(extensions, "EGL_EXT_output_base"))
-+ gr->has_egl_output_base = 1;
-+
-+ if (check_extension(extensions, "EGL_EXT_output_drm"))
-+ gr->has_egl_output_drm = 1;
-+
-+ if (check_extension(extensions, "EGL_NV_output_drm_flip_event"))
-+ gr->has_egl_output_drm_flip_event = 1;
-+
-+ if (check_extension(extensions, "EGL_KHR_stream_cross_process_fd"))
-+ gr->has_egl_stream_cross_process_fd = 1;
-+
renderer_setup_egl_client_extensions(gr);
return 0;
-@@ -2828,6 +3167,16 @@ static const EGLint gl_renderer_alpha_attribs[] = {
+@@ -2827,6 +3030,16 @@ static const EGLint gl_renderer_alpha_attribs[] = {
EGL_NONE
};
@@ -579,7 +346,7 @@ index 887d131674f5..07879cb83b60 100644
/** Checks whether a platform EGL client extension is supported
*
* \param ec The weston compositor
-@@ -2900,6 +3249,8 @@ platform_to_extension(EGLenum platform)
+@@ -2899,6 +3112,8 @@ platform_to_extension(EGLenum platform)
return "wayland";
case EGL_PLATFORM_X11_KHR:
return "x11";
@@ -588,7 +355,7 @@ index 887d131674f5..07879cb83b60 100644
default:
assert(0 && "bad EGL platform enum");
}
-@@ -2985,6 +3336,38 @@ gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
+@@ -2984,6 +3199,32 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
if (gl_renderer_setup_egl_extensions(ec) < 0)
goto fail_with_error;
@@ -598,24 +365,18 @@ index 887d131674f5..07879cb83b60 100644
+ !gr->has_egl_stream ||
+ !gr->has_egl_stream_producer_eglsurface ||
+ !gr->has_egl_stream_consumer_egloutput ||
-+ !gr->has_egl_stream_consumer_gltexture ||
-+ !gr->has_egl_stream_acquire_mode ||
-+ !gr->has_egl_stream_cross_process_fd) {
++ !gr->has_egl_stream_acquire_mode) {
+ weston_log("following required extensions not supported:\n"
-+ "%s%s%s%s%s%s%s%s",
-+ (gr->has_egl_output_base ? " EGL_EXT_output_base\n" : ""),
-+ (gr->has_egl_output_drm ? " EGL_EXT_output_drm\n" : ""),
-+ (gr->has_egl_stream ? " EGL_KHR_stream\n" : ""),
++ "%s%s%s%s%s%s",
++ (gr->has_egl_output_base ? "" : " EGL_EXT_output_base\n"),
++ (gr->has_egl_output_drm ? "" : " EGL_EXT_output_drm\n"),
++ (gr->has_egl_stream ? "" : " EGL_KHR_stream\n"),
+ (gr->has_egl_stream_producer_eglsurface ?
-+ " EGL_KHR_stream_producer_eglsurface\n" : ""),
++ "" : " EGL_KHR_stream_producer_eglsurface\n"),
+ (gr->has_egl_stream_consumer_egloutput ?
-+ " EGL_EXT_stream_consumer_egloutput\n" : ""),
-+ (gr->has_egl_stream_consumer_gltexture ?
-+ " EGL_KHR_stream_consumer_gltexture\n" : ""),
++ "" : " EGL_EXT_stream_consumer_egloutput\n"),
+ (gr->has_egl_stream_acquire_mode ?
-+ " EGL_EXT_stream_acquire_mode\n" : ""),
-+ (gr->has_egl_stream_cross_process_fd ?
-+ " EGL_KHR_stream_cross_process_fd\n" : ""));
++ "" : " EGL_EXT_stream_acquire_mode\n"));
+ goto fail_terminate;
+ }
+
@@ -627,110 +388,29 @@ index 887d131674f5..07879cb83b60 100644
wl_list_init(&gr->dmabuf_images);
if (gr->has_dmabuf_import)
gr->base.import_dmabuf = gl_renderer_import_dmabuf;
-@@ -3176,15 +3559,100 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
- return 0;
- }
-
-+static int
-+gl_renderer_get_devices(EGLint max_devices, EGLDeviceEXT *devices,
-+ EGLint *num_devices)
-+{
-+ const char *extensions;
-+ PFNEGLQUERYDEVICESEXTPROC query_devices;
-+
-+ extensions = (const char *)eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
-+ if (!extensions) {
-+ weston_log("Retrieving EGL extension string failed.\n");
-+ return -1;
-+ }
-+
-+ if (!check_extension(extensions, "EGL_EXT_device_base")) {
-+ weston_log("EGL_EXT_device_base not supported\n");
-+ return -1;
-+ }
-+
-+ query_devices = (void *) eglGetProcAddress("eglQueryDevicesEXT");
-+ if (!query_devices) {
-+ weston_log("Failed to get eglQueryDevicesEXT function\n");
-+ return -1;
-+ }
-+
-+ if (query_devices(max_devices, devices, num_devices) != EGL_TRUE) {
-+ weston_log("Failed to query EGL Devices\n");
-+ gl_renderer_print_egl_error_state();
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
-+static int
-+gl_renderer_get_drm_device_file(EGLDeviceEXT device,
-+ const char **drm_device_file)
-+{
-+ const char *extensions;
-+ PFNEGLQUERYDEVICESTRINGEXTPROC query_device_string;
-+
-+ extensions = (const char *)eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
-+ if (!extensions) {
-+ weston_log("Retrieving EGL extension string failed.\n");
-+ return -1;
-+ }
-+
-+ if (!check_extension(extensions, "EGL_EXT_device_base")) {
-+ weston_log("EGL_EXT_device_base not supported.\n");
-+ return -1;
-+ }
-+
-+ query_device_string = (void *) eglGetProcAddress("eglQueryDeviceStringEXT");
-+ if (!query_device_string) {
-+ weston_log("Failed to get eglQueryDeviceStringEXT function\n");
-+ return -1;
-+ }
-+
-+ extensions = query_device_string(device, EGL_EXTENSIONS);
-+ if (!extensions) {
-+ weston_log("Retrieving EGL extension string failed.\n");
-+ return -1;
-+ }
-+
-+ if (!check_extension(extensions, "EGL_EXT_device_drm")) {
-+ weston_log("EGL_EXT_device_drm not supported.\n");
-+ return -1;
-+ }
-+
-+ (*drm_device_file) = query_device_string(device, EGL_DRM_DEVICE_FILE_EXT);
-+ if (*drm_device_file == NULL) {
-+ weston_log("Failed to query DRM device name.\n");
-+ gl_renderer_print_egl_error_state();
-+ return -1;
-+ }
-+
-+ return 0;
-+}
-+
+@@ -3260,15 +3501,19 @@ gl_renderer_get_drm_device_file(EGLDeviceEXT device,
WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
.opaque_attribs = gl_renderer_opaque_attribs,
.alpha_attribs = gl_renderer_alpha_attribs,
+ .opaque_stream_attribs = gl_renderer_opaque_stream_attribs,
- .create = gl_renderer_create,
+ .display_create = gl_renderer_display_create,
.display = gl_renderer_display,
.output_window_create = gl_renderer_output_window_create,
+ .output_stream_create = gl_renderer_output_stream_create,
.output_destroy = gl_renderer_output_destroy,
.output_surface = gl_renderer_output_surface,
.output_set_border = gl_renderer_output_set_border,
-- .print_egl_error_state = gl_renderer_print_egl_error_state
-+ .print_egl_error_state = gl_renderer_print_egl_error_state,
-+
-+ .get_devices = gl_renderer_get_devices,
+ .print_egl_error_state = gl_renderer_print_egl_error_state,
+
+ .get_devices = gl_renderer_get_devices,
+- .get_drm_device_file = gl_renderer_get_drm_device_file
+ .get_drm_device_file = gl_renderer_get_drm_device_file,
+
+ .output_stream_flip = gl_renderer_output_stream_flip
};
diff --git a/src/gl-renderer.h b/src/gl-renderer.h
-index af8dd267e700..d1dc009b2f5e 100644
+index f376edd80106..958caa19e38b 100644
--- a/src/gl-renderer.h
+++ b/src/gl-renderer.h
@@ -62,6 +62,10 @@ typedef EGLSurface (*PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy,
@@ -750,7 +430,7 @@ index af8dd267e700..d1dc009b2f5e 100644
const EGLint *alpha_attribs;
+ const EGLint *opaque_stream_attribs;
- int (*create)(struct weston_compositor *ec,
+ int (*display_create)(struct weston_compositor *ec,
EGLenum platform,
@@ -92,6 +97,9 @@ struct gl_renderer_interface {
const EGLint *visual_id,
@@ -762,17 +442,10 @@ index af8dd267e700..d1dc009b2f5e 100644
void (*output_destroy)(struct weston_output *output);
EGLSurface (*output_surface)(struct weston_output *output);
-@@ -129,5 +137,23 @@ struct gl_renderer_interface {
- int32_t tex_width, unsigned char *data);
+@@ -136,5 +144,16 @@ struct gl_renderer_interface {
- void (*print_egl_error_state)(void);
-+
-+ int (*get_devices)(EGLint max_devices,
-+ EGLDeviceEXT *devices,
-+ EGLint *num_devices);
-+
-+ int (*get_drm_device_file)(EGLDeviceEXT device,
-+ const char **drm_device_file);
+ int (*get_drm_device_file)(EGLDeviceEXT device,
+ const char **drm_device_file);
+
+ /*
+ * output_stream_flip() makes the EGLOutput consumer attached to the
@@ -787,10 +460,10 @@ index af8dd267e700..d1dc009b2f5e 100644
};
diff --git a/src/weston-egl-ext.h b/src/weston-egl-ext.h
-index 32f6108fbb83..2faab1567c77 100644
+index 32f6108fbb83..6597e1143fea 100644
--- a/src/weston-egl-ext.h
+++ b/src/weston-egl-ext.h
-@@ -116,5 +116,24 @@ typedef struct wl_buffer * (EGLAPIENTRYP PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL) (
+@@ -116,5 +116,23 @@ typedef struct wl_buffer * (EGLAPIENTRYP PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL) (
#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
#endif
@@ -812,9 +485,8 @@ index 32f6108fbb83..2faab1567c77 100644
+#define EGL_NV_output_drm_flip_event 1
+#define EGL_DRM_FLIP_EVENT_DATA_NV 0x333E
+#endif /* EGL_NV_output_drm_flip_event */
-+
#endif
--
-2.7.4
+2.8.3
diff --git a/0009-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch b/0009-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch
new file mode 100644
index 00000000000..52f93c37461
--- /dev/null
+++ b/0009-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch
@@ -0,0 +1,302 @@
+From 1b660d12f9586b8d7b58fc0d18a22728febaf727 Mon Sep 17 00:00:00 2001
+From: "Miguel A. Vico" <mvicomoya@nvidia.com>
+Date: Mon, 2 May 2016 18:22:47 +0200
+Subject: [PATCH 09/11] 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
+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_EXT_stream_acquire_mode:
+ https://github.com/aritger/eglstreams-kms-example/blob/master/proposed-extensions/EGL_EXT_stream_acquire_mode.txt
+
+Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
+Reviewed-by: Adam Cheney <acheney@nvidia.com>
+Reviewed-by: James Jones <jajones@nvidia.com>
+---
+ src/gl-renderer.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 174 insertions(+), 1 deletion(-)
+
+diff --git a/src/gl-renderer.c b/src/gl-renderer.c
+index 764bd880d743..608f4bf4cb92 100644
+--- a/src/gl-renderer.c
++++ b/src/gl-renderer.c
+@@ -30,6 +30,7 @@
+ #include <GLES2/gl2.h>
+ #include <GLES2/gl2ext.h>
+
++#include <unistd.h>
+ #include <stdbool.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -161,6 +162,9 @@ struct gl_surface_state {
+ int height; /* in pixels */
+ int y_inverted;
+
++ EGLStreamKHR egl_stream;
++ bool new_stream;
++
+ struct weston_surface *surface;
+
+ struct wl_listener surface_destroy_listener;
+@@ -212,6 +216,7 @@ struct gl_renderer {
+
+ PFNEGLCREATESTREAMKHRPROC create_stream;
+ PFNEGLDESTROYSTREAMKHRPROC destroy_stream;
++ PFNEGLQUERYSTREAMKHRPROC query_stream;
+ int has_egl_stream;
+
+ PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC create_stream_producer_surface;
+@@ -225,6 +230,13 @@ struct gl_renderer {
+ #endif
+ int has_egl_stream_acquire_mode;
+
++ PFNEGLSTREAMCONSUMERACQUIREKHRPROC stream_consumer_acquire;
++ PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC stream_consumer_gltexture;
++ int has_egl_stream_consumer_gltexture;
++
++ PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC create_stream_from_fd;
++ int has_egl_stream_cross_process_fd;
++
+ int has_dmabuf_import;
+ struct wl_list dmabuf_images;
+
+@@ -1937,6 +1949,132 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
+ gs->y_inverted = buffer->y_inverted;
+ }
+
++/*
++ * 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)
++{
++ struct weston_compositor *ec = es->compositor;
++ struct gl_renderer *gr = get_renderer(ec);
++ struct gl_surface_state *gs = get_surface_state(es);
++ EGLNativeFileDescriptorKHR fd = EGL_NO_FILE_DESCRIPTOR_KHR;
++ 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_consumer_gltexture ||
++ !gr->has_egl_stream_cross_process_fd)
++ return false;
++
++ /* Try to get the stream file descriptor. If the query fails, the given
++ * buffer does not corresponds to an EGLStream
++ *
++ * FIXME: Use EGL_WL_wayland_eglstream instead */
++ if (!gr->query_buffer(gr->egl_display, buffer->resource,
++ EGL_WAYLAND_BUFFER_WL, &fd))
++ return false;
++
++ /* If invalid file descriptor returned, buffer->resource corresponds to a
++ * previously created stream so we must have a valid stream handle already
++ * we can use to acquire next frame; otherwise, try to create the stream */
++ if (fd != EGL_NO_FILE_DESCRIPTOR_KHR) {
++ EGLStreamKHR stream = EGL_NO_STREAM_KHR;
++
++ stream = gr->create_stream_from_fd(gr->egl_display, fd);
++ close(fd);
++
++ if (stream == EGL_NO_STREAM_KHR) {
++ gl_renderer_print_egl_error_state();
++ return true; /* buffer->resource is EGLStream */
++ } 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 = &gr->texture_shader_egl_external;
++ gs->target = GL_TEXTURE_EXTERNAL_OES;
++
++ glActiveTexture(GL_TEXTURE0);
++ ensure_textures(gs, 2);
++ glBindTexture(gs->target, gs->textures[1]);
++
++ gs->new_stream = (EGL_TRUE == gr->stream_consumer_gltexture(
++ gr->egl_display,
++ gs->egl_stream));
++
++ 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(gr->egl_display,
++ gs->egl_stream) != 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 */
++}
++
+ static void
+ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
+ {
+@@ -1960,6 +2098,12 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
+ gs->num_textures = 0;
+ gs->buffer_type = BUFFER_TYPE_NULL;
+ gs->y_inverted = 1;
++
++ 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;
+ }
+
+@@ -1972,7 +2116,7 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
+ gl_renderer_attach_egl(es, buffer, format);
+ else if ((dmabuf = linux_dmabuf_buffer_get(buffer->resource)))
+ gl_renderer_attach_dmabuf(es, buffer, dmabuf);
+- else {
++ else if (!gl_renderer_attach_stream_texture(es, buffer)) {
+ weston_log("unhandled buffer type!\n");
+ weston_buffer_reference(&gs->buffer_ref, NULL);
+ gs->buffer_type = BUFFER_TYPE_NULL;
+@@ -2160,6 +2304,10 @@ surface_state_destroy(struct gl_surface_state *gs, struct gl_renderer *gr)
+
+ weston_buffer_reference(&gs->buffer_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);
+ }
+
+@@ -2210,6 +2358,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;
+
+@@ -2935,6 +3085,7 @@ 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 =
+@@ -2943,6 +3094,12 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
+ gr->stream_consumer_acquire_attrib =
+ (void *) eglGetProcAddress("eglStreamConsumerAcquireAttribEXT");
+ #endif
++ gr->stream_consumer_acquire =
++ (void *) eglGetProcAddress("eglStreamConsumerAcquireKHR");
++ gr->stream_consumer_gltexture =
++ (void *) eglGetProcAddress("eglStreamConsumerGLTextureExternalKHR");
++ gr->create_stream_from_fd =
++ (void *) eglGetProcAddress("eglCreateStreamFromFileDescriptorKHR");
+
+ extensions =
+ (const char *) eglQueryString(gr->egl_display, EGL_EXTENSIONS);
+@@ -3005,6 +3162,12 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
+ if (check_extension(extensions, "EGL_EXT_stream_acquire_mode"))
+ gr->has_egl_stream_acquire_mode = 1;
+
++ if (check_extension(extensions, "EGL_KHR_stream_consumer_gltexture"))
++ gr->has_egl_stream_consumer_gltexture = 1;
++
++ if (check_extension(extensions, "EGL_KHR_stream_cross_process_fd"))
++ gr->has_egl_stream_cross_process_fd = 1;
++
+ renderer_setup_egl_client_extensions(gr);
+
+ return 0;
+@@ -3220,6 +3383,16 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
+ goto fail_terminate;
+ }
+
++ if (!gr->has_egl_stream_consumer_gltexture ||
++ !gr->has_egl_stream_cross_process_fd)
++ weston_log("warning: following required extensions for EGL client "
++ "frame presentation through EGLDevice not supported:\n"
++ "%s%s",
++ (gr->has_egl_stream_consumer_gltexture ?
++ " EGL_KHR_stream_consumer_gltexture\n" : ""),
++ (gr->has_egl_stream_cross_process_fd ?
++ " EGL_KHR_stream_cross_process_fd\n" : ""));
++
+ if (!gr->has_egl_output_drm_flip_event)
+ weston_log("warning: EGL page flip event notification not"
+ " supported\n");
+--
+2.8.3
+
diff --git a/0005-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch b/0010-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch
index 3c98a74abc1..b294073b906 100644
--- a/0005-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch
+++ b/0010-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch
@@ -1,8 +1,8 @@
-From 851f5b55210835e6e7c5699d87e18e09cbbe69e3 Mon Sep 17 00:00:00 2001
+From 8e93cad203be5983ea01fdd4a1b044465c3b8ac0 Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
-Date: Mon, 21 Mar 2016 17:37:35 +0100
-Subject: [PATCH 5/7] compositor-drm: Gracefully handle vblank and flip invalid
- timestamps
+Date: Tue, 1 Mar 2016 22:19:14 +0100
+Subject: [PATCH 10/11] compositor-drm: Gracefully handle vblank and flip
+ invalid timestamps
X-NVConfidentiality: public
Instant query for vblank timestamp may always fail, resulting in
@@ -18,11 +18,11 @@ situations above.
Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
---
- src/compositor-drm.c | 24 +++++++++++++++++++++---
- 1 file changed, 21 insertions(+), 3 deletions(-)
+ src/compositor-drm.c | 26 +++++++++++++++++++++++---
+ 1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
-index ded15f83c3e6..a6d4573a922f 100644
+index dd545de1ccc0..51d90e1d6437 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1,6 +1,7 @@
@@ -33,7 +33,7 @@ index ded15f83c3e6..a6d4573a922f 100644
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
-@@ -761,8 +762,16 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
+@@ -753,8 +754,16 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
vbl.request.type |= drm_waitvblank_pipe(output);
ret = drmWaitVBlank(backend->drm.fd, &vbl);
@@ -52,7 +52,7 @@ index ded15f83c3e6..a6d4573a922f 100644
ts.tv_sec = vbl.reply.tval_sec;
ts.tv_nsec = vbl.reply.tval_usec * 1000;
-@@ -783,7 +792,7 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
+@@ -775,7 +784,7 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
}
}
@@ -61,22 +61,24 @@ index ded15f83c3e6..a6d4573a922f 100644
* Use pageflip fallback.
*/
fb_id = output->current->fb_id;
-@@ -869,6 +878,15 @@ page_flip_handler(int fd, unsigned int frame,
+@@ -861,6 +870,17 @@ page_flip_handler(int fd, unsigned int frame,
else if (!output->vblank_pending) {
ts.tv_sec = sec;
ts.tv_nsec = usec * 1000;
+
+ /* Zero timestamp means failure to get valid timestamp, so immediately
-+ * finish frame */
++ * finish frame
++ *
++ * FIXME: Driver should never return an invalid page flip timestamp */
+ if (ts.tv_sec == 0 && ts.tv_nsec == 0) {
+ weston_compositor_read_presentation_clock(output->base.compositor,
+ &ts);
-+ flags = PRESENTATION_FEEDBACK_INVALID;
++ flags = WP_PRESENTATION_FEEDBACK_INVALID;
+ }
+
weston_output_finish_frame(&output->base, &ts, flags);
/* We can't call this from frame_notify, because the output's
--
-2.7.4
+2.8.3
diff --git a/0007-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch b/0011-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch
index dc1cf812964..8fb95c0c0f7 100644
--- a/0007-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch
+++ b/0011-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch
@@ -1,7 +1,7 @@
-From c285314728543280bf9ebd4e2776fe5cf4d096b1 Mon Sep 17 00:00:00 2001
+From cb241882dc1903c2330dc68f08c21c76c9a14e91 Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
-Date: Mon, 21 Mar 2016 17:41:32 +0100
-Subject: [PATCH 7/7] compositor-drm: Add support for EGLDevice+EGLOutput
+Date: Thu, 28 Jan 2016 19:37:10 +0100
+Subject: [PATCH 11/11] compositor-drm: Add support for EGLDevice+EGLOutput
X-NVConfidentiality: public
As previously stated, EGLDevice and EGLOutput will provide means
@@ -23,16 +23,20 @@ used can be controlled by --use-egldevice backend argument.
Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
Reviewed-by: Adam Cheney <acheney@nvidia.com>
+Reviewed-by: James Jones <jajones@nvidia.com>
+
+[aplattner@nvidia.com: rebased on top of Weston 1.11.0]
---
- src/compositor-drm.c | 319 +++++++++++++++++++++++++++++++++++----------------
- src/main.c | 1 +
- 2 files changed, 224 insertions(+), 96 deletions(-)
+ src/compositor-drm.c | 328 +++++++++++++++++++++++++++++++++++----------------
+ src/compositor-drm.h | 3 +
+ src/main.c | 2 +
+ 3 files changed, 233 insertions(+), 100 deletions(-)
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
-index 6c2816152307..58f916a27fc8 100644
+index 51d90e1d6437..0844cec9f570 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
-@@ -75,6 +75,10 @@
+@@ -76,6 +76,10 @@
#define GBM_BO_USE_CURSOR GBM_BO_USE_CURSOR_64X64
#endif
@@ -40,10 +44,10 @@ index 6c2816152307..58f916a27fc8 100644
+#define EGL_DRM_MASTER_FD_EXT 0x333C
+#endif
+
- static int option_current_mode = 0;
-
- enum output_config {
-@@ -101,7 +105,10 @@ struct drm_backend {
+ struct drm_backend {
+ struct weston_backend base;
+ struct weston_compositor *compositor;
+@@ -91,7 +95,10 @@ struct drm_backend {
int fd;
char *filename;
} drm;
@@ -54,7 +58,7 @@ index 6c2816152307..58f916a27fc8 100644
uint32_t *crtcs;
int num_crtcs;
uint32_t crtc_allocator;
-@@ -124,6 +131,7 @@ struct drm_backend {
+@@ -114,6 +121,7 @@ struct drm_backend {
int cursors_are_broken;
int use_pixman;
@@ -62,15 +66,7 @@ index 6c2816152307..58f916a27fc8 100644
uint32_t prev_state;
-@@ -225,6 +233,7 @@ struct drm_parameters {
- int connector;
- int tty;
- int use_pixman;
-+ int use_egldevice;
- const char *seat_id;
- };
-
-@@ -531,17 +540,21 @@ drm_output_render_gl(struct drm_output *output, pixman_region32_t *damage)
+@@ -523,17 +531,21 @@ drm_output_render_gl(struct drm_output *output, pixman_region32_t *damage)
output->base.compositor->renderer->repaint_output(&output->base,
damage);
@@ -102,7 +98,7 @@ index 6c2816152307..58f916a27fc8 100644
}
}
-@@ -666,9 +679,14 @@ drm_output_repaint(struct weston_output *output_base,
+@@ -658,9 +670,14 @@ drm_output_repaint(struct weston_output *output_base,
output_base->set_dpms(output_base, WESTON_DPMS_ON);
}
@@ -120,7 +116,7 @@ index 6c2816152307..58f916a27fc8 100644
weston_log("queueing pageflip failed: %m\n");
goto err_pageflip;
}
-@@ -739,7 +757,6 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
+@@ -731,7 +748,6 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
struct drm_output *output = (struct drm_output *) output_base;
struct drm_backend *backend = (struct drm_backend *)
output_base->compositor->backend;
@@ -128,7 +124,7 @@ index 6c2816152307..58f916a27fc8 100644
struct timespec ts, tnow;
struct timespec vbl2now;
int64_t refresh_nsec;
-@@ -795,10 +812,14 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
+@@ -787,10 +803,14 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
/* Immediate query succeeded, but didn't provide valid timestamp.
* Use pageflip fallback.
*/
@@ -146,7 +142,7 @@ index 6c2816152307..58f916a27fc8 100644
weston_log("queueing pageflip failed: %m\n");
goto finish_frame;
}
-@@ -1328,6 +1349,9 @@ static void
+@@ -1322,6 +1342,9 @@ static void
drm_output_fini_pixman(struct drm_output *output);
static void
@@ -156,7 +152,7 @@ index 6c2816152307..58f916a27fc8 100644
drm_output_destroy(struct weston_output *output_base)
{
struct drm_output *output = (struct drm_output *) output_base;
-@@ -1358,12 +1382,10 @@ drm_output_destroy(struct weston_output *output_base)
+@@ -1352,12 +1375,10 @@ drm_output_destroy(struct weston_output *output_base)
b->crtc_allocator &= ~(1 << output->crtc_id);
b->connector_allocator &= ~(1 << output->connector_id);
@@ -172,7 +168,7 @@ index 6c2816152307..58f916a27fc8 100644
weston_plane_release(&output->fb_plane);
weston_plane_release(&output->cursor_plane);
-@@ -1462,9 +1484,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
+@@ -1456,9 +1477,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
return -1;
}
} else {
@@ -183,7 +179,7 @@ index 6c2816152307..58f916a27fc8 100644
if (drm_output_init_egl(output, b) < 0) {
weston_log("failed to init output egl state with "
"new mode");
-@@ -1551,11 +1571,6 @@ create_gbm_device(int fd)
+@@ -1545,11 +1564,6 @@ create_gbm_device(int fd)
{
struct gbm_device *gbm;
@@ -195,12 +191,12 @@ index 6c2816152307..58f916a27fc8 100644
/* 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
-@@ -1568,6 +1583,39 @@ create_gbm_device(int fd)
+@@ -1562,6 +1576,39 @@ create_gbm_device(int fd)
return gbm;
}
+static EGLDeviceEXT
-+create_egldevice(const char *filename)
++find_egldevice(const char *filename)
+{
+ EGLDeviceEXT egldevice = EGL_NO_DEVICE_EXT;
+ EGLDeviceEXT *devices;
@@ -233,28 +229,22 @@ index 6c2816152307..58f916a27fc8 100644
+}
+
/* When initializing EGL, if the preferred buffer format isn't available
- * we may be able to susbstitute an ARGB format for an XRGB one.
+ * we may be able to substitute an ARGB format for an XRGB one.
*
-@@ -1594,38 +1642,59 @@ fallback_format_for(uint32_t format)
+@@ -1588,38 +1635,61 @@ fallback_format_for(uint32_t format)
static int
drm_backend_create_gl_renderer(struct drm_backend *b)
{
- EGLint format[3] = {
-+ EGLint platform_attribs[] = {
-+ EGL_DRM_MASTER_FD_EXT, b->drm.fd,
-+ EGL_NONE
-+ };
-+ EGLint format[] = {
- b->gbm_format,
- fallback_format_for(b->gbm_format),
+- b->gbm_format,
+- fallback_format_for(b->gbm_format),
- 0,
-+ 0
- };
- int n_formats = 2;
-
- if (format[1])
- n_formats = 3;
-- if (gl_renderer->create(b->compositor,
+- };
+- int n_formats = 2;
+-
+- if (format[1])
+- n_formats = 3;
+- if (gl_renderer->display_create(b->compositor,
- EGL_PLATFORM_GBM_KHR,
- (void *)b->gbm,
- NULL,
@@ -263,24 +253,39 @@ index 6c2816152307..58f916a27fc8 100644
- n_formats) < 0) {
- return -1;
- }
++ if (b->use_egldevice) {
++ EGLint device_platform_attribs[] = {
++ EGL_DRM_MASTER_FD_EXT, b->drm.fd,
++ EGL_NONE
++ };
- return 0;
-+ if (b->use_egldevice)
-+ return gl_renderer->create(b->compositor,
-+ EGL_PLATFORM_DEVICE_EXT,
-+ (void *)b->egldevice,
-+ platform_attribs,
-+ gl_renderer->opaque_stream_attribs,
-+ NULL,
-+ 0);
-+ else
-+ return gl_renderer->create(b->compositor,
-+ EGL_PLATFORM_GBM_KHR,
-+ b->gbm,
-+ NULL,
-+ gl_renderer->opaque_attribs,
-+ format,
-+ n_formats);
++ return gl_renderer->display_create(b->compositor,
++ EGL_PLATFORM_DEVICE_EXT,
++ (void *)b->egldevice,
++ device_platform_attribs,
++ gl_renderer->opaque_stream_attribs,
++ NULL,
++ 0);
++ } else {
++ EGLint format[] = {
++ b->gbm_format,
++ fallback_format_for(b->gbm_format),
++ 0
++ };
++ int n_formats = 2;
++
++ if (format[1])
++ n_formats = 3;
++
++ return gl_renderer->display_create(b->compositor,
++ EGL_PLATFORM_GBM_KHR,
++ (void *)b->gbm,
++ NULL,
++ gl_renderer->opaque_attribs,
++ format,
++ n_formats);
++ }
}
static int
@@ -295,7 +300,7 @@ index 6c2816152307..58f916a27fc8 100644
return -1;
+ if (b->use_egldevice) {
-+ b->egldevice = create_egldevice(b->drm.filename);
++ b->egldevice = find_egldevice(b->drm.filename);
+ if (b->egldevice == EGL_NO_DEVICE_EXT)
+ return -1;
+ } else {
@@ -311,7 +316,7 @@ index 6c2816152307..58f916a27fc8 100644
return -1;
}
-@@ -1852,55 +1921,94 @@ find_crtc_for_connector(struct drm_backend *b,
+@@ -1846,55 +1916,95 @@ find_crtc_for_connector(struct drm_backend *b,
static int
drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
{
@@ -347,12 +352,13 @@ index 6c2816152307..58f916a27fc8 100644
- gbm_surface_destroy(output->gbm_surface);
- return -1;
- }
-+ /* Create a dumb fb for modesetting */
++ /* Create a black dumb fb for modesetting */
+ output->dumb[0] = drm_fb_create_dumb(b, w, h);
+ if (!output->dumb[0]) {
+ weston_log("failed to create dumb framebuffer\n");
+ return -1;
+ }
++ memset(output->dumb[0]->map, 0, output->dumb[0]->size);
- flags = GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE;
+ if (gl_renderer->output_stream_create(&output->base, ~0u,
@@ -445,23 +451,20 @@ index 6c2816152307..58f916a27fc8 100644
static int
drm_output_init_pixman(struct drm_output *output, struct drm_backend *b)
{
-@@ -2374,10 +2482,11 @@ create_output_for_connector(struct drm_backend *b,
+@@ -2344,8 +2454,10 @@ create_output_for_connector(struct drm_backend *b,
- free(s);
-
-- if (get_gbm_format_from_section(section,
-- b->gbm_format,
-- &output->gbm_format) == -1)
+ mode = b->configure_output(b->compositor, b->use_current_mode,
+ output->base.name, &config);
+- if (parse_gbm_format(config.gbm_format, b->gbm_format, &output->gbm_format) == -1)
- output->gbm_format = b->gbm_format;
-+ if (!b->use_egldevice)
-+ if (get_gbm_format_from_section(section,
-+ b->gbm_format,
-+ &output->gbm_format) == -1)
++ if (!b->use_egldevice && parse_gbm_format(config.gbm_format,
++ b->gbm_format,
++ &output->gbm_format) == -1)
+ output->gbm_format = b->gbm_format;
- weston_config_section_get_string(section, "seat", &s, "");
- setup_output_seat_constraint(b, &output->base, s);
-@@ -2988,6 +3097,11 @@ recorder_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key,
+ setup_output_seat_constraint(b, &output->base,
+ config.seat ? config.seat : "");
+@@ -2955,6 +3067,11 @@ recorder_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t key,
struct drm_output *output;
int width, height;
@@ -473,7 +476,7 @@ index 6c2816152307..58f916a27fc8 100644
output = container_of(b->compositor->output_list.next,
struct drm_output, base.link);
-@@ -3043,11 +3157,20 @@ switch_to_gl_renderer(struct drm_backend *b)
+@@ -3010,11 +3127,20 @@ switch_to_gl_renderer(struct drm_backend *b)
weston_log("Switching to GL renderer\n");
@@ -483,7 +486,7 @@ index 6c2816152307..58f916a27fc8 100644
- "Aborting renderer switch\n");
- return;
+ if (b->use_egldevice) {
-+ b->egldevice = create_egldevice(b->drm.filename);
++ b->egldevice = find_egldevice(b->drm.filename);
+ if (b->egldevice == EGL_NO_DEVICE_EXT) {
+ weston_log("Failed to create EGL device. "
+ "Aborting renderer switch\n");
@@ -499,7 +502,7 @@ index 6c2816152307..58f916a27fc8 100644
}
wl_list_for_each(output, &b->compositor->output_list, base.link)
-@@ -3056,7 +3179,8 @@ switch_to_gl_renderer(struct drm_backend *b)
+@@ -3023,7 +3149,8 @@ switch_to_gl_renderer(struct drm_backend *b)
b->compositor->renderer->destroy(b->compositor);
if (drm_backend_create_gl_renderer(b) < 0) {
@@ -509,37 +512,33 @@ index 6c2816152307..58f916a27fc8 100644
weston_log("Failed to create GL renderer. Quitting.\n");
/* FIXME: we need a function to shutdown cleanly */
assert(0);
-@@ -3122,6 +3246,7 @@ drm_backend_create(struct weston_compositor *compositor,
- goto err_base;
-
- b->use_pixman = param->use_pixman;
-+ b->use_egldevice = param->use_egldevice;
-
- /* Check if we run drm-backend using weston-launch */
- compositor->launcher = weston_launcher_connect(compositor, param->tty,
-@@ -3246,7 +3371,8 @@ err_drm_source:
- err_udev_input:
- udev_input_destroy(&b->input);
- err_sprite:
-- gbm_device_destroy(b->gbm);
-+ if (b->gbm)
-+ gbm_device_destroy(b->gbm);
- destroy_sprites(b);
- err_udev_dev:
- udev_device_unref(drm_device);
-@@ -3275,6 +3401,7 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
- { WESTON_OPTION_INTEGER, "tty", 0, &param.tty },
- { WESTON_OPTION_BOOLEAN, "current-mode", 0, &option_current_mode },
- { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &param.use_pixman },
-+ { WESTON_OPTION_BOOLEAN, "use-egldevice", 0, &param.use_egldevice },
- };
-
- param.seat_id = default_seat;
+@@ -3080,6 +3207,7 @@ drm_backend_create(struct weston_compositor *compositor,
+ b->sprites_are_broken = 1;
+ b->compositor = compositor;
+ b->use_pixman = config->use_pixman;
++ b->use_egldevice = config->use_egldevice;
+ b->configure_output = config->configure_output;
+ b->use_current_mode = config->use_current_mode;
+
+diff --git a/src/compositor-drm.h b/src/compositor-drm.h
+index 3f150dba28b3..816830434aeb 100644
+--- a/src/compositor-drm.h
++++ b/src/compositor-drm.h
+@@ -87,6 +87,9 @@ struct weston_drm_backend_config {
+ /** Whether to use the pixman renderer instead of the OpenGL ES renderer. */
+ bool use_pixman;
+
++ /** Whether to use EGLDevice rather than GBM. */
++ bool use_egldevice;
++
+ /** The seat to be used for input and output.
+ *
+ * If NULL the default "seat0" will be used. The backend will
diff --git a/src/main.c b/src/main.c
-index 1850fa633554..2494414138a8 100644
+index 3279ac6a8b02..ad1a1fc98344 100644
--- a/src/main.c
+++ b/src/main.c
-@@ -266,6 +266,7 @@ usage(int error_code)
+@@ -277,6 +277,7 @@ usage(int error_code)
" --seat=SEAT\t\tThe seat that weston should run on\n"
" --tty=TTY\t\tThe tty to use\n"
" --use-pixman\t\tUse the pixman (CPU) renderer\n"
@@ -547,6 +546,14 @@ index 1850fa633554..2494414138a8 100644
" --current-mode\tPrefer current KMS mode over EDID preferred mode\n\n");
#endif
+@@ -750,6 +751,7 @@ load_drm_backend(struct weston_compositor *c, const char *backend,
+ { WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
+ { WESTON_OPTION_BOOLEAN, "current-mode", 0, &config.use_current_mode },
+ { WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
++ { WESTON_OPTION_BOOLEAN, "use-egldevice", 0, &config.use_egldevice },
+ };
+
+ parse_options(options, ARRAY_LENGTH(options), argc, argv);
--
-2.7.4
+2.8.3
diff --git a/PKGBUILD b/PKGBUILD
index 0f6494f9b58..fee948eb9af 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
# Contributor: Joel Teichroeb <joel@teichroeb.net>
pkgname=weston-eglstream
-pkgver=1.10.0
+pkgver=1.11.0
pkgrel=1
pkgdesc='Reference implementation of a Wayland compositor with EGLStream support'
arch=('i686' 'x86_64')
@@ -14,32 +14,44 @@ makedepends=('wayland-protocols')
provides=('weston')
conflicts=('weston')
source=("http://wayland.freedesktop.org/releases/weston-$pkgver.tar.xz"
- '0001-gl-renderer-Renaming-of-things-and-minor-improvement.patch'
- '0002-gl-renderer-Refactor-gl_renderer_output_window_creat.patch'
- '0003-gl-renderer-Implement-use-check_extension.patch'
- '0004-gl-renderer-Add-support-for-EGLDevice-EGLOutput.patch'
- '0005-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch'
- '0006-compositor-drm-Renaming-of-gbm-fields.patch'
- '0007-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch')
-sha1sums=('c9c2c8e2e798b25e7bf6b31bf0c4ef08724a7ebb'
- 'c623cdf628a20a4bde5a98cc40867c32a8300e79'
- '3441d0a7da0ae64835a5b29545caab4bc7977417'
- 'f6742fadb973ec6c2b55e5500127309e70579312'
- '31e3a447a1209712d604d739d0ac7e5b1925e940'
- 'b483f21b3f880d3978cc678bf5f97802f7ddddaf'
- '13d217d76a0811f5eb8d7180d31ec7a69fbbaabd'
- '6bab10ac02a7e69b1bb1bf1982b5804e87870e0e')
+ '0001-gl-renderer-Rename-gl_renderer_create-to-gl_renderer.patch'
+ '0002-gl-renderer-Rename-gl_renderer-output_create-to-outp.patch'
+ '0003-gl-renderer-Rename-attribs-param-of-gl_renderer-to-c.patch'
+ '0004-gl-renderer-Add-platform_attribs-param-to-gl_rendere.patch'
+ '0005-gl-renderer-Accept-non-NULL-empty-visual_id-arrays.patch'
+ '0006-gl-renderer-Refactor-gl_renderer_output_window_creat.patch'
+ '0007-gl-renderer-Add-EGLDevice-enumeration-support.patch'
+ '0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch'
+ '0009-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch'
+ '0010-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch'
+ '0011-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch')
+sha1sums=('8b051ee16b785b6db16657161aeed6cd6724f028'
+ '67741bea89d102740e1d8726d20cf6d278d6d51e'
+ '63b21515874749572d515266d49c202dbc560a43'
+ '551571daaabab0ded8c1dc58cd45035fad3a6387'
+ '96b73103c25811a7721a40487ad7ec5d9436fa11'
+ 'd1aab8b491b50dbcfceb96aa154df0bac04ec4f4'
+ 'c74abfd3e5ee691a889be8d03a841c96da6602c0'
+ '5148c5ec24a98af3d33f65eabbba065f4556b212'
+ '25634c91c587af648cb2428e2124c23e22e6025b'
+ 'a51dfacd54988910e909789e31bea43b9c2156fe'
+ '350c82bee9bd06c0b678fabf08fcef405e832083'
+ 'c1db4cb0ac1d685a0c6e9d020238f8ea0c163318')
prepare() {
cd weston-$pkgver
- patch -Np1 -i "${srcdir}/0001-gl-renderer-Renaming-of-things-and-minor-improvement.patch"
- patch -Np1 -i "${srcdir}/0002-gl-renderer-Refactor-gl_renderer_output_window_creat.patch"
- patch -Np1 -i "${srcdir}/0003-gl-renderer-Implement-use-check_extension.patch"
- patch -Np1 -i "${srcdir}/0004-gl-renderer-Add-support-for-EGLDevice-EGLOutput.patch"
- patch -Np1 -i "${srcdir}/0005-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch"
- patch -Np1 -i "${srcdir}/0006-compositor-drm-Renaming-of-gbm-fields.patch"
- patch -Np1 -i "${srcdir}/0007-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch"
+ patch -Np1 -i "${srcdir}/0001-gl-renderer-Rename-gl_renderer_create-to-gl_renderer.patch"
+ patch -Np1 -i "${srcdir}/0002-gl-renderer-Rename-gl_renderer-output_create-to-outp.patch"
+ patch -Np1 -i "${srcdir}/0003-gl-renderer-Rename-attribs-param-of-gl_renderer-to-c.patch"
+ patch -Np1 -i "${srcdir}/0004-gl-renderer-Add-platform_attribs-param-to-gl_rendere.patch"
+ patch -Np1 -i "${srcdir}/0005-gl-renderer-Accept-non-NULL-empty-visual_id-arrays.patch"
+ patch -Np1 -i "${srcdir}/0006-gl-renderer-Refactor-gl_renderer_output_window_creat.patch"
+ patch -Np1 -i "${srcdir}/0007-gl-renderer-Add-EGLDevice-enumeration-support.patch"
+ patch -Np1 -i "${srcdir}/0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch"
+ patch -Np1 -i "${srcdir}/0009-gl-renderer-Add-EGL-client-support-for-EGLStream-fra.patch"
+ patch -Np1 -i "${srcdir}/0010-compositor-drm-Gracefully-handle-vblank-and-flip-inv.patch"
+ patch -Np1 -i "${srcdir}/0011-compositor-drm-Add-support-for-EGLDevice-EGLOutput.patch"
}
build() {