diff options
author | Aaron Plattner | 2016-12-12 09:47:15 -0800 |
---|---|---|
committer | Aaron Plattner | 2016-12-12 09:47:15 -0800 |
commit | 0351b429af478ee4c2b90520bf793438c3526490 (patch) | |
tree | 17bbd36e7915bfd46026ab4753bca1cbbab05379 /0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch | |
parent | aabeac990c916034c44ef83fc3689a0810350b4c (diff) | |
download | aur-0351b429af478ee4c2b90520bf793438c3526490.tar.gz |
Update to Weston 1.12.0 with patches from git://people.freedesktop.org/~jjones/weston nvidia_head_rebase_1.12
Diffstat (limited to '0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch')
-rw-r--r-- | 0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch | 188 |
1 files changed, 109 insertions, 79 deletions
diff --git a/0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch b/0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch index 7309529cda4b..032d2b12b75a 100644 --- a/0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch +++ b/0008-gl-renderer-Add-support-for-EGLDevice-composited-fra.patch @@ -1,7 +1,7 @@ -From 4a84caec21fa650c8919db504dea94b3ad352a71 Mon Sep 17 00:00:00 2001 +From 34433e17e968229bce5eca51946fb85fcbc69f3d Mon Sep 17 00:00:00 2001 From: "Miguel A. Vico" <mvicomoya@nvidia.com> Date: Mon, 2 May 2016 16:34:01 +0200 -Subject: [PATCH 08/11] gl-renderer: Add support for EGLDevice composited frame +Subject: [PATCH 08/12] gl-renderer: Add support for EGLDevice composited frame presentation X-NVConfidentiality: public @@ -41,16 +41,14 @@ 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.12.0] --- - libweston/gl-renderer.c | 251 ++++++++++++++++++++++++++++++++++++++++++++- - libweston/gl-renderer.h | 15 +++ - libweston/weston-egl-ext.h | 18 ++++ - 3 files changed, 281 insertions(+), 3 deletions(-) + libweston/gl-renderer.c | 262 ++++++++++++++++++++++++++++++++++++++++++++- + libweston/gl-renderer.h | 16 +++ + libweston/weston-egl-ext.h | 38 +++++++ + 3 files changed, 313 insertions(+), 3 deletions(-) diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c -index b5d93531c944..01c5933966ca 100644 +index 9ef115ae092f..a0efea2ed648 100644 --- a/libweston/gl-renderer.c +++ b/libweston/gl-renderer.c @@ -86,6 +86,8 @@ struct gl_output_state { @@ -62,7 +60,7 @@ index b5d93531c944..01c5933966ca 100644 struct weston_matrix output_matrix; }; -@@ -204,6 +206,27 @@ struct gl_renderer { +@@ -204,6 +206,28 @@ struct gl_renderer { int has_surfaceless_context; @@ -82,22 +80,23 @@ index b5d93531c944..01c5933966ca 100644 + PFNEGLSTREAMCONSUMEROUTPUTEXTPROC stream_consumer_output; + int has_egl_stream_consumer_egloutput; + -+#ifdef EGL_EXT_stream_acquire_mode -+ PFNEGLSTREAMCONSUMERACQUIREATTRIBEXTPROC stream_consumer_acquire_attrib; ++#ifdef EGL_NV_stream_attrib ++ PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC stream_consumer_acquire_attrib; +#endif ++ int has_egl_stream_attrib; + int has_egl_stream_acquire_mode; + int has_dmabuf_import; struct wl_list dmabuf_images; -@@ -1189,6 +1212,37 @@ gl_renderer_repaint_output(struct weston_output *output, +@@ -1189,6 +1213,38 @@ gl_renderer_repaint_output(struct weston_output *output, } static int +gl_renderer_output_stream_flip(struct weston_output *output, -+ void *flip_data) ++ void *flip_data) +{ -+#ifdef EGL_EXT_stream_acquire_mode ++#if defined(EGL_NV_stream_attrib) && defined(EGL_EXT_stream_acquire_mode) + struct gl_output_state *go = get_output_state(output); + struct weston_compositor *compositor = output->compositor; + struct gl_renderer *gr = get_renderer(compositor); @@ -113,9 +112,10 @@ index b5d93531c944..01c5933966ca 100644 +#endif + + if (go->egl_stream != EGL_NO_STREAM_KHR) -+ if (EGL_TRUE != gr->stream_consumer_acquire_attrib(gr->egl_display, -+ go->egl_stream, -+ acquire_attribs)) ++ if (gr->stream_consumer_acquire_attrib( ++ gr->egl_display, ++ go->egl_stream, ++ acquire_attribs) != EGL_TRUE) + return -1; + + return 0; @@ -128,16 +128,16 @@ index b5d93531c944..01c5933966ca 100644 gl_renderer_read_pixels(struct weston_output *output, pixman_format_code_t format, void *pixels, uint32_t x, uint32_t y, -@@ -2584,9 +2638,92 @@ gl_renderer_create_window_surface(struct gl_renderer *gr, +@@ -2584,9 +2640,93 @@ gl_renderer_create_window_surface(struct gl_renderer *gr, return egl_surface; } +static EGLSurface +gl_renderer_create_stream_surface(struct gl_renderer *gr, -+ uint32_t plane_id, -+ uint32_t crtc_id, -+ EGLint width, EGLint height, -+ EGLStreamKHR *egl_stream) ++ uint32_t plane_id, ++ uint32_t crtc_id, ++ EGLint width, EGLint height, ++ EGLStreamKHR *egl_stream) +{ + EGLint stream_attribs[] = { + EGL_STREAM_FIFO_LENGTH_KHR, 1, @@ -175,9 +175,9 @@ index b5d93531c944..01c5933966ca 100644 + output_attribs[2] = EGL_NONE; + + if (gr->get_output_layers(gr->egl_display, -+ output_attribs, -+ &output_layer, -+ 1, &num_layers) != EGL_TRUE) { ++ output_attribs, ++ &output_layer, ++ 1, &num_layers) != EGL_TRUE) { + weston_log("Failed to get output layer.\n"); + goto err_egl_create_surf_stream; + } @@ -188,15 +188,16 @@ index b5d93531c944..01c5933966ca 100644 + } + + if (gr->stream_consumer_output(gr->egl_display, *egl_stream, -+ output_layer) != EGL_TRUE) { ++ output_layer) != EGL_TRUE) { + weston_log("Failed to set EGL stream consumer.\n"); + goto err_egl_create_surf_stream; + } + -+ egl_surface = gr->create_stream_producer_surface(gr->egl_display, -+ gr->egl_config, -+ *egl_stream, -+ stream_producer_attribs); ++ egl_surface = gr->create_stream_producer_surface( ++ gr->egl_display, ++ gr->egl_config, ++ *egl_stream, ++ stream_producer_attribs); + + if (egl_surface == EGL_NO_SURFACE) { + weston_log("Failed to create EGL producer surface.\n"); @@ -216,13 +217,13 @@ index b5d93531c944..01c5933966ca 100644 + static int gl_renderer_output_create(struct weston_output *output, -- EGLSurface surface) -+ EGLSurface surface, -+ EGLStreamKHR stream) +- EGLSurface surface) ++ EGLSurface surface, ++ EGLStreamKHR stream) { struct gl_output_state *go; int i; -@@ -2596,6 +2733,7 @@ gl_renderer_output_create(struct weston_output *output, +@@ -2596,6 +2736,7 @@ gl_renderer_output_create(struct weston_output *output, return -1; go->egl_surface = surface; @@ -230,7 +231,7 @@ index b5d93531c944..01c5933966ca 100644 for (i = 0; i < BUFFER_DAMAGE_COUNT; i++) pixman_region32_init(&go->buffer_damage[i]); -@@ -2628,13 +2766,41 @@ gl_renderer_output_window_create(struct weston_output *output, +@@ -2628,13 +2769,41 @@ gl_renderer_output_window_create(struct weston_output *output, return -1; } @@ -244,7 +245,7 @@ index b5d93531c944..01c5933966ca 100644 +static int +gl_renderer_output_stream_create(struct weston_output *output, -+ uint32_t plane_id, uint32_t crtc_id) ++ uint32_t plane_id, uint32_t crtc_id) +{ + struct weston_compositor *ec = output->compositor; + struct gl_renderer *gr = get_renderer(ec); @@ -254,10 +255,10 @@ index b5d93531c944..01c5933966ca 100644 + + egl_surface = + gl_renderer_create_stream_surface(gr, -+ plane_id, crtc_id, -+ output->current_mode->width, -+ output->current_mode->height, -+ &egl_stream); ++ plane_id, crtc_id, ++ output->current_mode->width, ++ output->current_mode->height, ++ &egl_stream); + if (egl_surface == EGL_NO_SURFACE) + return -1; + @@ -273,7 +274,7 @@ index b5d93531c944..01c5933966ca 100644 static void gl_renderer_output_destroy(struct weston_output *output) { -@@ -2647,6 +2813,9 @@ gl_renderer_output_destroy(struct weston_output *output) +@@ -2647,6 +2816,9 @@ gl_renderer_output_destroy(struct weston_output *output) eglDestroySurface(gr->egl_display, go->egl_surface); @@ -283,7 +284,7 @@ index b5d93531c944..01c5933966ca 100644 free(go); } -@@ -2728,6 +2897,19 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec) +@@ -2728,6 +2900,19 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec) (void *) eglGetProcAddress("eglUnbindWaylandDisplayWL"); gr->query_buffer = (void *) eglGetProcAddress("eglQueryWaylandBufferWL"); @@ -296,14 +297,14 @@ index b5d93531c944..01c5933966ca 100644 + (void *) eglGetProcAddress("eglCreateStreamProducerSurfaceKHR"); + gr->stream_consumer_output = + (void *) eglGetProcAddress("eglStreamConsumerOutputEXT"); -+#ifdef EGL_EXT_stream_acquire_mode ++#ifdef EGL_NV_stream_attrib + gr->stream_consumer_acquire_attrib = -+ (void *) eglGetProcAddress("eglStreamConsumerAcquireAttribEXT"); ++ (void *) eglGetProcAddress("eglStreamConsumerAcquireAttribNV"); +#endif extensions = (const char *) eglQueryString(gr->egl_display, EGL_EXTENSIONS); -@@ -2766,6 +2948,27 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec) +@@ -2766,6 +2951,30 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec) if (weston_check_egl_extension(extensions, "EGL_EXT_image_dma_buf_import")) gr->has_dmabuf_import = 1; @@ -325,13 +326,16 @@ index b5d93531c944..01c5933966ca 100644 + if (weston_check_egl_extension(extensions, "EGL_EXT_stream_consumer_egloutput")) + gr->has_egl_stream_consumer_egloutput = 1; + ++ if (weston_check_egl_extension(extensions, "EGL_NV_stream_attrib")) ++ gr->has_egl_stream_attrib = 1; ++ + if (weston_check_egl_extension(extensions, "EGL_EXT_stream_acquire_mode")) + gr->has_egl_stream_acquire_mode = 1; + renderer_setup_egl_client_extensions(gr); return 0; -@@ -2791,6 +2994,16 @@ static const EGLint gl_renderer_alpha_attribs[] = { +@@ -2791,6 +3000,15 @@ static const EGLint gl_renderer_alpha_attribs[] = { EGL_NONE }; @@ -344,11 +348,10 @@ index b5d93531c944..01c5933966ca 100644 + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_NONE +}; -+ /** Checks whether a platform EGL client extension is supported * -@@ -2864,6 +3077,8 @@ platform_to_extension(EGLenum platform) +@@ -2864,6 +3082,8 @@ platform_to_extension(EGLenum platform) return "wayland"; case EGL_PLATFORM_X11_KHR: return "x11"; @@ -357,7 +360,7 @@ index b5d93531c944..01c5933966ca 100644 default: assert(0 && "bad EGL platform enum"); } -@@ -3000,6 +3215,32 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform, +@@ -3000,6 +3220,38 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform, if (gl_renderer_setup_egl_extensions(ec) < 0) goto fail_with_error; @@ -367,30 +370,36 @@ index b5d93531c944..01c5933966ca 100644 + !gr->has_egl_stream || + !gr->has_egl_stream_producer_eglsurface || + !gr->has_egl_stream_consumer_egloutput || ++ !gr->has_egl_stream_attrib || + !gr->has_egl_stream_acquire_mode) { -+ weston_log("following required extensions not supported:\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"), -+ (gr->has_egl_stream_consumer_egloutput ? -+ "" : " EGL_EXT_stream_consumer_egloutput\n"), -+ (gr->has_egl_stream_acquire_mode ? -+ "" : " EGL_EXT_stream_acquire_mode\n")); ++ weston_log("following required extensions not " ++ "supported:\n%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"), ++ (gr->has_egl_stream_producer_eglsurface ? "" : ++ " EGL_KHR_stream_producer_eglsurface\n"), ++ (gr->has_egl_stream_consumer_egloutput ? "" : ++ " EGL_EXT_stream_consumer_egloutput\n"), ++ (gr->has_egl_stream_attrib ? "" : ++ " EGL_NV_stream_attrib\n"), ++ (gr->has_egl_stream_acquire_mode ? "" : ++ " EGL_EXT_stream_acquire_mode\n")); + goto fail_terminate; + } + + if (!gr->has_egl_output_drm_flip_event) -+ weston_log("warning: EGL page flip event notification not" -+ " supported\n"); ++ weston_log("warning: EGL page flip event notification " ++ "not supported\n"); + } + wl_list_init(&gr->dmabuf_images); if (gr->has_dmabuf_import) gr->base.import_dmabuf = gl_renderer_import_dmabuf; -@@ -3293,15 +3534,19 @@ gl_renderer_get_drm_device_file(EGLDeviceEXT device, +@@ -3295,15 +3547,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, @@ -412,7 +421,7 @@ index b5d93531c944..01c5933966ca 100644 + .output_stream_flip = gl_renderer_output_stream_flip }; diff --git a/libweston/gl-renderer.h b/libweston/gl-renderer.h -index 871aa6589b01..02c79c355b47 100644 +index 2840ee5bea28..6e2fd34f4257 100644 --- a/libweston/gl-renderer.h +++ b/libweston/gl-renderer.h @@ -59,6 +59,7 @@ enum gl_renderer_border_side { @@ -422,47 +431,68 @@ index 871aa6589b01..02c79c355b47 100644 + const EGLint *opaque_stream_attribs; int (*display_create)(struct weston_compositor *ec, - EGLenum platform, + EGLenum platform, @@ -77,6 +78,9 @@ struct gl_renderer_interface { - const EGLint *visual_id, - const int n_ids); + const EGLint *visual_id, + const int n_ids); + int (*output_stream_create)(struct weston_output *output, -+ uint32_t plane_id, uint32_t crtc_id); ++ uint32_t plane_id, uint32_t crtc_id); + void (*output_destroy)(struct weston_output *output); EGLSurface (*output_surface)(struct weston_output *output); -@@ -121,5 +125,16 @@ struct gl_renderer_interface { +@@ -121,5 +125,17 @@ struct gl_renderer_interface { int (*get_drm_device_file)(EGLDeviceEXT device, - const char **drm_device_file); + const char **drm_device_file); + + /* + * output_stream_flip() makes the EGLOutput consumer attached to the + * corresponding <output> stream acquire the new available frame + * (repaint_output() has been called previously) and queue a page flip. -+ * Whenever DRM is the underlying API and EGL_NV_output_drm_flip_event is -+ * supported, page flip notification can be requested by passing a non-NULL -+ * <flip_data> pointer. Otherwise, compositors should rely on a different -+ * mechanism in order to re-schedule output repaints. ++ * Whenever DRM is the underlying API and EGL_NV_output_drm_flip_event ++ * is supported, page flip notification can be requested by passing a ++ * non-NULL <flip_data> pointer. Otherwise, compositors should rely on a ++ * different mechanism in order to re-schedule output repaints. + */ -+ int (*output_stream_flip)(struct weston_output *output, void *flip_data); ++ int (*output_stream_flip)(struct weston_output *output, ++ void *flip_data); }; diff --git a/libweston/weston-egl-ext.h b/libweston/weston-egl-ext.h -index 6e3699602b5b..79aa2de2b09f 100644 +index 6e3699602b5b..709c80959b66 100644 --- a/libweston/weston-egl-ext.h +++ b/libweston/weston-egl-ext.h -@@ -152,5 +152,23 @@ typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLD +@@ -152,5 +152,43 @@ typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLD #define EGL_PLATFORM_X11_KHR 0x31D5 #endif ++#ifndef EGL_PLATFORM_DEVICE_EXT ++#define EGL_PLATFORM_DEVICE_EXT 0x313F ++#endif ++ +/* + * FIXME: Remove both EGL_EXT_stream_acquire_mode and + * EGL_NV_output_drm_flip_event definitions below once both extensions + * get published by Khronos and incorportated into Khronos' header files + */ ++#ifndef EGL_NV_stream_attrib ++#define EGL_NV_stream_attrib 1 ++#ifdef EGL_EGLEXT_PROTOTYPES ++EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribNV(EGLDisplay dpy, const EGLAttrib *attrib_list); ++EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribNV(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); ++EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribNV(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); ++EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribNV(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); ++EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribNV(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); ++#endif ++typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBNVPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list); ++typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); ++typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); ++typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); ++typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); ++#endif /* EGL_NV_stream_attrib */ ++ +#ifndef EGL_EXT_stream_acquire_mode +#define EGL_EXT_stream_acquire_mode 1 +#define EGL_CONSUMER_AUTO_ACQUIRE_EXT 0x332B @@ -479,5 +509,5 @@ index 6e3699602b5b..79aa2de2b09f 100644 #endif -- -2.10.0 +2.10.2 |