diff options
| author | Otavio Salvador <otavio@ossystems.com.br> | 2015-01-07 16:14:14 -0200 |
|---|---|---|
| committer | Otavio Salvador <otavio@ossystems.com.br> | 2015-02-04 12:10:09 -0200 |
| commit | 62f9dd851bafad508e9d8aa7973036a3f6111c52 (patch) | |
| tree | 7daf4a21cf0f60fb3d511c3d2146461e90fa449a | |
| parent | 0847355d526a6de8e8723b74979177d3427f7c92 (diff) | |
| download | meta-freescale-62f9dd851bafad508e9d8aa7973036a3f6111c52.tar.gz | |
weston: Performance optmizations for i.MX6 GAL2D renderer
This improves the Weston performance considerably and is backward
compatible with Vivante 4.6.9 and Vivante 5.0.X VIV-GPU drivers.
The following new patches has been included:
MGS-391: Weston: Performance Optimisation for single buffer mode
MGS-389: Fix for wrong FPS throttling when multibuffer is set
Change-Id: I17a5d8377927fa250dd0f24ac8462064dc7592ca
Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@freescale.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
8 files changed, 476 insertions, 28 deletions
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch b/meta-fsl-arm/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch index e946fe4bd..a0fcdefc5 100644 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch +++ b/meta-fsl-arm/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | From 0d24f9872fc5bbbb07ae55f1107ba0f5060fca8a Mon Sep 17 00:00:00 2001 | 1 | From eb738e87f131f60c89e641e619dc8b1ccc88a30b Mon Sep 17 00:00:00 2001 |
| 2 | From: Yong Gan <b45748@freescale.com> | 2 | From: Yong Gan <b45748@freescale.com> |
| 3 | Date: Thu, 22 May 2014 15:25:42 +0800 | 3 | Date: Thu, 22 May 2014 15:25:42 +0800 |
| 4 | Subject: [PATCH 1/3] ENGR00314805-1 Add Vivante EGL support | 4 | Subject: [PATCH] ENGR00314805-1 Add Vivante EGL support |
| 5 | Organization: O.S. Systems Software LTDA. | ||
| 5 | 6 | ||
| 6 | Add Vivante EGL compositor support. | 7 | Add Vivante EGL compositor support. |
| 7 | 8 | ||
| @@ -9,8 +10,10 @@ Upstream-Status: Pending | |||
| 9 | 10 | ||
| 10 | [DATE]05-22-2014 | 11 | [DATE]05-22-2014 |
| 11 | Signed-off-by Yong Gan <B45748@freescale.com> | 12 | Signed-off-by Yong Gan <B45748@freescale.com> |
| 13 | |||
| 14 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
| 12 | --- | 15 | --- |
| 13 | src/compositor-fbdev.c | 23 +++++++++++++++++++---- | 16 | src/compositor-fbdev.c | 23 +++++++++++++++++++---- |
| 14 | 1 file changed, 19 insertions(+), 4 deletions(-) | 17 | 1 file changed, 19 insertions(+), 4 deletions(-) |
| 15 | 18 | ||
| 16 | diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c | 19 | diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c |
| @@ -70,5 +73,5 @@ index e703e0e..3db1d17 100644 | |||
| 70 | NULL) < 0) { | 73 | NULL) < 0) { |
| 71 | weston_log("gl_renderer_create failed.\n"); | 74 | weston_log("gl_renderer_create failed.\n"); |
| 72 | -- | 75 | -- |
| 73 | 1.7.9.5 | 76 | 2.1.4 |
| 74 | 77 | ||
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch b/meta-fsl-arm/recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch index 58b5966b9..1cfca7b15 100644 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch +++ b/meta-fsl-arm/recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | From 2a24c62ef00d1b08974bd8f07e277695ac2911fa Mon Sep 17 00:00:00 2001 | 1 | From 8a887ec821a53f18a7530b77f08ec823ce757937 Mon Sep 17 00:00:00 2001 |
| 2 | From: Yong Gan <b45748@freescale.com> | 2 | From: Yong Gan <b45748@freescale.com> |
| 3 | Date: Thu, 22 May 2014 15:26:31 +0800 | 3 | Date: Thu, 22 May 2014 15:26:31 +0800 |
| 4 | Subject: [PATCH 2/3] ENGR00314805-2 Add Vivante GAL2D support | 4 | Subject: [PATCH] ENGR00314805-2 Add Vivante GAL2D support |
| 5 | Organization: O.S. Systems Software LTDA. | ||
| 5 | 6 | ||
| 6 | Add Vivante GAL2D compositor support. | 7 | Add Vivante GAL2D compositor support. |
| 7 | 8 | ||
| @@ -9,6 +10,8 @@ Upstream-Status: Pending | |||
| 9 | 10 | ||
| 10 | [DATE]05-22-2014 | 11 | [DATE]05-22-2014 |
| 11 | Signed-off-by Yong Gan <B45748@freescale.com> | 12 | Signed-off-by Yong Gan <B45748@freescale.com> |
| 13 | |||
| 14 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
| 12 | --- | 15 | --- |
| 13 | Makefile.am | 13 + | 16 | Makefile.am | 13 + |
| 14 | src/compositor-fbdev.c | 110 ++++- | 17 | src/compositor-fbdev.c | 110 ++++- |
| @@ -19,10 +22,10 @@ Signed-off-by Yong Gan <B45748@freescale.com> | |||
| 19 | create mode 100644 src/gal2d-renderer.h | 22 | create mode 100644 src/gal2d-renderer.h |
| 20 | 23 | ||
| 21 | diff --git a/Makefile.am b/Makefile.am | 24 | diff --git a/Makefile.am b/Makefile.am |
| 22 | index 343adc6..2bccfe9 100644 | 25 | index 0c08acb..29834c3 100644 |
| 23 | --- a/Makefile.am | 26 | --- a/Makefile.am |
| 24 | +++ b/Makefile.am | 27 | +++ b/Makefile.am |
| 25 | @@ -162,6 +162,19 @@ gl_renderer_la_SOURCES = \ | 28 | @@ -165,6 +165,19 @@ gl_renderer_la_SOURCES = \ |
| 26 | src/gl-renderer.c \ | 29 | src/gl-renderer.c \ |
| 27 | src/vertex-clipping.c \ | 30 | src/vertex-clipping.c \ |
| 28 | src/vertex-clipping.h | 31 | src/vertex-clipping.h |
| @@ -1496,5 +1499,5 @@ index 0000000..3b89f73 | |||
| 1496 | + | 1499 | + |
| 1497 | +#endif | 1500 | +#endif |
| 1498 | -- | 1501 | -- |
| 1499 | 1.7.9.5 | 1502 | 2.1.4 |
| 1500 | 1503 | ||
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston/0003-Distorted-line-and-shadow-if-use-2d-com.patch b/meta-fsl-arm/recipes-graphics/wayland/weston/0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch index 0e7ffd06a..65554d34a 100644 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0003-Distorted-line-and-shadow-if-use-2d-com.patch +++ b/meta-fsl-arm/recipes-graphics/wayland/weston/0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch | |||
| @@ -1,14 +1,16 @@ | |||
| 1 | From 1fd17db2ab978322803683a4d2d847a0b31a4c1c Mon Sep 17 00:00:00 2001 | 1 | From 663f2a362ff384098f4c32f5cc9e7b7b73f2a553 Mon Sep 17 00:00:00 2001 |
| 2 | From: Prabhu Sundararaj <prabhu.sundararaj@freescale.com> | 2 | From: Prabhu Sundararaj <prabhu.sundararaj@freescale.com> |
| 3 | Date: Tue, 24 Jun 2014 15:44:13 -0500 | 3 | Date: Tue, 24 Jun 2014 15:44:13 -0500 |
| 4 | Subject: [PATCH 3/3] ENGR00319247 : Distorted line and shadow if use 2d | 4 | Subject: [PATCH] ENGR00319247 : Distorted line and shadow if use 2d compositor |
| 5 | compositor to run wayland apps. | 5 | to run wayland apps. |
| 6 | Organization: O.S. Systems Software LTDA. | ||
| 6 | 7 | ||
| 7 | Fixed blending for shadown and maintained separate surface for damage composite. | 8 | Fixed blending for shadown and maintained separate surface for damage composite. |
| 8 | 9 | ||
| 9 | Upstream Status: N/A | 10 | Upstream Status: N/A |
| 10 | 11 | ||
| 11 | Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@freescale.com> | 12 | Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@freescale.com> |
| 13 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
| 12 | --- | 14 | --- |
| 13 | src/compositor-fbdev.c | 8 ++-- | 15 | src/compositor-fbdev.c | 8 ++-- |
| 14 | src/gal2d-renderer.c | 102 +++++++++++++++++++++++++++++++++++-------------- | 16 | src/gal2d-renderer.c | 102 +++++++++++++++++++++++++++++++++++-------------- |
| @@ -252,5 +254,5 @@ index 3b89f73..1322a7d 100644 | |||
| 252 | 254 | ||
| 253 | struct gal2d_renderer_interface { | 255 | struct gal2d_renderer_interface { |
| 254 | -- | 256 | -- |
| 255 | 2.0.0 | 257 | 2.1.4 |
| 256 | 258 | ||
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston/0005-Enable-GAL2D-compositor-in-SoloLite.patch b/meta-fsl-arm/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch index cf0890022..cb4ed6bf7 100644 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0005-Enable-GAL2D-compositor-in-SoloLite.patch +++ b/meta-fsl-arm/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch | |||
| @@ -1,21 +1,24 @@ | |||
| 1 | From 1eea925312fb7e1bc1cf42e001069cbac887b128 Mon Sep 17 00:00:00 2001 | 1 | From ca9eb5bdbdfe17654466d84c8baaa1187a8796c6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Yong Gan <b45748@freescale.com> | 2 | From: Yong Gan <b45748@freescale.com> |
| 3 | Date: Wed, 2 Jul 2014 11:27:26 +0800 | 3 | Date: Wed, 2 Jul 2014 11:27:26 +0800 |
| 4 | Subject: [PATCH] ENGR00320243 Enable GAL2D compositor in SoloLite | 4 | Subject: [PATCH] ENGR00320243 Enable GAL2D compositor in SoloLite |
| 5 | Organization: O.S. Systems Software LTDA. | ||
| 5 | 6 | ||
| 6 | Build gal2d-renderer.so when EGL was not enabled. | 7 | Build gal2d-renderer.so when EGL was not enabled. |
| 7 | 8 | ||
| 8 | Date: Jul 02, 2014 | 9 | Date: Jul 02, 2014 |
| 9 | Signed-off-by Yong Gan <yong.gan@freescale.com> | 10 | Signed-off-by Yong Gan <yong.gan@freescale.com> |
| 11 | |||
| 12 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
| 10 | --- | 13 | --- |
| 11 | Makefile.am | 2 +- | 14 | Makefile.am | 2 +- |
| 12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 15 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 13 | 16 | ||
| 14 | diff --git a/Makefile.am b/Makefile.am | 17 | diff --git a/Makefile.am b/Makefile.am |
| 15 | index 2bccfe9..42148b1 100644 | 18 | index 29834c3..e82e970 100644 |
| 16 | --- a/Makefile.am | 19 | --- a/Makefile.am |
| 17 | +++ b/Makefile.am | 20 | +++ b/Makefile.am |
| 18 | @@ -162,6 +162,7 @@ gl_renderer_la_SOURCES = \ | 21 | @@ -165,6 +165,7 @@ gl_renderer_la_SOURCES = \ |
| 19 | src/gl-renderer.c \ | 22 | src/gl-renderer.c \ |
| 20 | src/vertex-clipping.c \ | 23 | src/vertex-clipping.c \ |
| 21 | src/vertex-clipping.h | 24 | src/vertex-clipping.h |
| @@ -23,7 +26,7 @@ index 2bccfe9..42148b1 100644 | |||
| 23 | 26 | ||
| 24 | module_LTLIBRARIES += gal2d-renderer.la | 27 | module_LTLIBRARIES += gal2d-renderer.la |
| 25 | gal2d_renderer_la_LDFLAGS = -module -avoid-version | 28 | gal2d_renderer_la_LDFLAGS = -module -avoid-version |
| 26 | @@ -175,7 +176,6 @@ gal2d_renderer_la_SOURCES = \ | 29 | @@ -178,7 +179,6 @@ gal2d_renderer_la_SOURCES = \ |
| 27 | src/gal2d-renderer.c \ | 30 | src/gal2d-renderer.c \ |
| 28 | src/vertex-clipping.c \ | 31 | src/vertex-clipping.c \ |
| 29 | src/vertex-clipping.h | 32 | src/vertex-clipping.h |
| @@ -32,5 +35,5 @@ index 2bccfe9..42148b1 100644 | |||
| 32 | if ENABLE_X11_COMPOSITOR | 35 | if ENABLE_X11_COMPOSITOR |
| 33 | module_LTLIBRARIES += x11-backend.la | 36 | module_LTLIBRARIES += x11-backend.la |
| 34 | -- | 37 | -- |
| 35 | 1.7.9.5 | 38 | 2.1.4 |
| 36 | 39 | ||
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston/0006-Change-GAL2D-compositor-to-be-default-i.patch b/meta-fsl-arm/recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch index e0a855f99..89d6215a4 100644 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0006-Change-GAL2D-compositor-to-be-default-i.patch +++ b/meta-fsl-arm/recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch | |||
| @@ -1,15 +1,18 @@ | |||
| 1 | From 916e1fe5ca320f3115e904ae5543da3c5603d70e Mon Sep 17 00:00:00 2001 | 1 | From e58ecd66cea732aab8f6b5274d72868922e92c5f Mon Sep 17 00:00:00 2001 |
| 2 | From: Yong Gan <b45748@freescale.com> | 2 | From: Yong Gan <b45748@freescale.com> |
| 3 | Date: Fri, 4 Jul 2014 09:57:11 +0800 | 3 | Date: Fri, 4 Jul 2014 09:57:11 +0800 |
| 4 | Subject: [PATCH] ENGR00321030 Change GAL2D compositor to be default in | 4 | Subject: [PATCH] ENGR00321030 Change GAL2D compositor to be default in |
| 5 | SoloLite. | 5 | SoloLite. |
| 6 | Organization: O.S. Systems Software LTDA. | ||
| 6 | 7 | ||
| 7 | Change GAL2D compositor to be default When EGL is not enabled. | 8 | Change GAL2D compositor to be default When EGL is not enabled. |
| 8 | 9 | ||
| 9 | Date: Jul 03, 2014 | 10 | Date: Jul 03, 2014 |
| 10 | Signed-off-by Yong Gan <yong.gan@freescale.com> | 11 | Signed-off-by Yong Gan <yong.gan@freescale.com> |
| 12 | |||
| 13 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
| 11 | --- | 14 | --- |
| 12 | src/compositor-fbdev.c | 5 +++++ | 15 | src/compositor-fbdev.c | 5 +++++ |
| 13 | 1 file changed, 5 insertions(+) | 16 | 1 file changed, 5 insertions(+) |
| 14 | 17 | ||
| 15 | diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c | 18 | diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c |
| @@ -31,5 +34,5 @@ index b27d199..bdc6ec9 100644 | |||
| 31 | 34 | ||
| 32 | const struct weston_option fbdev_options[] = { | 35 | const struct weston_option fbdev_options[] = { |
| 33 | -- | 36 | -- |
| 34 | 1.7.9.5 | 37 | 2.1.4 |
| 35 | 38 | ||
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch b/meta-fsl-arm/recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch new file mode 100644 index 000000000..8201459c0 --- /dev/null +++ b/meta-fsl-arm/recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch | |||
| @@ -0,0 +1,247 @@ | |||
| 1 | From db720086b85046bd0806484bfe63915870bb4323 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Prabhu Sundararaj <prabhu.sundararaj@freescale.com> | ||
| 3 | Date: Tue, 30 Dec 2014 16:09:29 -0600 | ||
| 4 | Subject: [PATCH] MGS-389 - Fix for wrong FPS throttling when multibuffer is | ||
| 5 | set | ||
| 6 | Organization: O.S. Systems Software LTDA. | ||
| 7 | |||
| 8 | When the FB_MULTI_BUFFER=2 is set, throtling to 30FPS for a 60Hz display | ||
| 9 | which is suppose to have 60FPS. | ||
| 10 | Adding worker thread to output the frame in async mode for better | ||
| 11 | performance. | ||
| 12 | |||
| 13 | Upstream-Status: Pending | ||
| 14 | |||
| 15 | Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@freescale.com> | ||
| 16 | --- | ||
| 17 | src/gal2d-renderer.c | 109 +++++++++++++++++++++++++++++++++++++++------------ | ||
| 18 | 1 file changed, 83 insertions(+), 26 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c | ||
| 21 | index fbe39f6..4cccaf1 100644 | ||
| 22 | --- a/src/gal2d-renderer.c | ||
| 23 | +++ b/src/gal2d-renderer.c | ||
| 24 | @@ -28,6 +28,8 @@ | ||
| 25 | #include <ctype.h> | ||
| 26 | #include <float.h> | ||
| 27 | #include <assert.h> | ||
| 28 | +#include <pthread.h> | ||
| 29 | + | ||
| 30 | #include "compositor.h" | ||
| 31 | #include "gal2d-renderer.h" | ||
| 32 | #include "vertex-clipping.h" | ||
| 33 | @@ -37,7 +39,6 @@ | ||
| 34 | |||
| 35 | #define galONERROR(x) if(status < 0) printf("Error in function %s\n", __func__); | ||
| 36 | |||
| 37 | - | ||
| 38 | struct gal2d_output_state { | ||
| 39 | |||
| 40 | int current_buffer; | ||
| 41 | @@ -48,7 +49,12 @@ struct gal2d_output_state { | ||
| 42 | int activebuffer; | ||
| 43 | gcoSURF offscreenSurface; | ||
| 44 | gceSURF_FORMAT format; | ||
| 45 | - gcoSURF tempSurf; | ||
| 46 | + pthread_mutex_t workerMutex; | ||
| 47 | + pthread_t workerId; | ||
| 48 | + gctUINT32 exitWorker; | ||
| 49 | + gctSIGNAL signal; | ||
| 50 | + gctSIGNAL busySignal; | ||
| 51 | + gcsHAL_INTERFACE iface; | ||
| 52 | }; | ||
| 53 | |||
| 54 | struct gal2d_surface_state { | ||
| 55 | @@ -373,8 +379,7 @@ gal2d_clear(struct weston_output *base) | ||
| 56 | gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect)); | ||
| 57 | gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect)); | ||
| 58 | gcmONERROR(gco2D_Clear(gr->gcoEngine2d, 1, &dstRect, 0xff0000ff, 0xCC, 0xCC, go->format)); | ||
| 59 | - | ||
| 60 | - gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
| 61 | + gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvTRUE)); | ||
| 62 | |||
| 63 | OnError: | ||
| 64 | galONERROR(status); | ||
| 65 | @@ -465,7 +470,6 @@ gal2dBindBuffer(struct weston_surface* es) | ||
| 66 | static void | ||
| 67 | gal2d_flip_surface(struct weston_output *output) | ||
| 68 | { | ||
| 69 | - struct gal2d_renderer *gr = get_renderer(output->compositor); | ||
| 70 | struct gal2d_output_state *go = get_output_state(output); | ||
| 71 | |||
| 72 | if(go->nNumBuffers > 1) | ||
| 73 | @@ -473,17 +477,36 @@ gal2d_flip_surface(struct weston_output *output) | ||
| 74 | gctUINT Offset; | ||
| 75 | gctINT X; | ||
| 76 | gctINT Y; | ||
| 77 | - gcmVERIFY_OK(gcoHAL_Commit(gr->gcoHal, gcvTRUE)); | ||
| 78 | - | ||
| 79 | + | ||
| 80 | gcmVERIFY_OK(gcoOS_GetDisplayBackbuffer(go->display, gcvNULL, | ||
| 81 | gcvNULL, gcvNULL, &Offset, &X, &Y)); | ||
| 82 | |||
| 83 | gcmVERIFY_OK(gcoOS_SetDisplayVirtual(go->display, gcvNULL, | ||
| 84 | - Offset, X, Y)); | ||
| 85 | - | ||
| 86 | - go->activebuffer = (go->activebuffer+1) % go->nNumBuffers; | ||
| 87 | + Offset, X, Y)); | ||
| 88 | } | ||
| 89 | } | ||
| 90 | +static void *gal2d_output_worker(void *arg) | ||
| 91 | +{ | ||
| 92 | + struct weston_output *output = (struct weston_output *)arg; | ||
| 93 | + struct gal2d_output_state *go = get_output_state(output); | ||
| 94 | + | ||
| 95 | + while(1) | ||
| 96 | + { | ||
| 97 | + if(gcoOS_WaitSignal(gcvNULL, go->signal, gcvINFINITE) == gcvSTATUS_OK ) | ||
| 98 | + { | ||
| 99 | + gal2d_flip_surface(output); | ||
| 100 | + gcoOS_Signal(gcvNULL,go->busySignal, gcvTRUE); | ||
| 101 | + } | ||
| 102 | + pthread_mutex_lock(&go->workerMutex); | ||
| 103 | + if(go->exitWorker == 1) | ||
| 104 | + { | ||
| 105 | + pthread_mutex_unlock(&go->workerMutex); | ||
| 106 | + break; | ||
| 107 | + } | ||
| 108 | + pthread_mutex_unlock(&go->workerMutex); | ||
| 109 | + } | ||
| 110 | + return 0; | ||
| 111 | +} | ||
| 112 | |||
| 113 | static int | ||
| 114 | update_surface(struct weston_output *output) | ||
| 115 | @@ -520,11 +543,13 @@ update_surface(struct weston_output *output) | ||
| 116 | gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect)); | ||
| 117 | gcmONERROR(gco2D_Blit(gr->gcoEngine2d, 1, &dstRect, 0xCC, 0xCC, go->format)); | ||
| 118 | gcmONERROR(gcoSURF_Unlock(srcSurface, (gctPOINTER *)&va)); | ||
| 119 | - gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
| 120 | + gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
| 121 | } | ||
| 122 | - | ||
| 123 | - gal2d_flip_surface(output); | ||
| 124 | - | ||
| 125 | + else if(go->nNumBuffers > 1) | ||
| 126 | + { | ||
| 127 | + gcoHAL_ScheduleEvent(gr->gcoHal, &go->iface); | ||
| 128 | + gcmVERIFY_OK(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
| 129 | + } | ||
| 130 | OnError: | ||
| 131 | galONERROR(status); | ||
| 132 | return status; | ||
| 133 | @@ -746,6 +771,7 @@ repaint_region(struct weston_view *ev, struct weston_output *output, struct gal2 | ||
| 134 | 0xCC, 0xCC, go->format)); | ||
| 135 | } | ||
| 136 | } | ||
| 137 | + | ||
| 138 | if(status < 0) | ||
| 139 | { | ||
| 140 | printf("cr l=%d r=%d t=%d b=%d w=%d h=%d\n", | ||
| 141 | @@ -759,12 +785,6 @@ repaint_region(struct weston_view *ev, struct weston_output *output, struct gal2 | ||
| 142 | goto OnError; | ||
| 143 | } | ||
| 144 | } | ||
| 145 | - status = (gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
| 146 | - if(status < 0) | ||
| 147 | - { | ||
| 148 | - printf("Error in gcoHAL_Commit %s\n", __func__); | ||
| 149 | - goto OnError; | ||
| 150 | - } | ||
| 151 | } | ||
| 152 | |||
| 153 | OnError: | ||
| 154 | @@ -831,7 +851,15 @@ repaint_views(struct weston_output *output, pixman_region32_t *damage) | ||
| 155 | { | ||
| 156 | struct weston_compositor *compositor = output->compositor; | ||
| 157 | struct weston_view *view; | ||
| 158 | - | ||
| 159 | + struct gal2d_output_state *go = get_output_state(output); | ||
| 160 | + | ||
| 161 | + if(go->nNumBuffers > 1) | ||
| 162 | + { | ||
| 163 | + /*500ms is more than enough to process a frame */ | ||
| 164 | + gcoOS_WaitSignal(gcvNULL, go->busySignal, 500); | ||
| 165 | + } | ||
| 166 | + go->activebuffer = (go->activebuffer+1) % go->nNumBuffers; | ||
| 167 | + | ||
| 168 | wl_list_for_each_reverse(view, &compositor->view_list, link) | ||
| 169 | if (view->plane == &compositor->primary_plane) | ||
| 170 | draw_view(view, output, damage); | ||
| 171 | @@ -1090,12 +1118,19 @@ gal2d_renderer_output_destroy(struct weston_output *output) | ||
| 172 | if(go->offscreenSurface) | ||
| 173 | gcmVERIFY_OK(gcoSURF_Destroy(go->offscreenSurface)); | ||
| 174 | } | ||
| 175 | - | ||
| 176 | + else | ||
| 177 | + { | ||
| 178 | + gcoOS_Signal(gcvNULL,go->signal, gcvTRUE); | ||
| 179 | + pthread_mutex_lock(&go->workerMutex); | ||
| 180 | + go->exitWorker = 1; | ||
| 181 | + pthread_mutex_unlock(&go->workerMutex); | ||
| 182 | + pthread_join(go->workerId, NULL); | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | for(i=0; i < go->nNumBuffers; i++) | ||
| 186 | { | ||
| 187 | gcmVERIFY_OK(gcoSURF_Destroy(go->renderSurf[i])); | ||
| 188 | } | ||
| 189 | - | ||
| 190 | free(go->renderSurf); | ||
| 191 | go->renderSurf = gcvNULL; | ||
| 192 | |||
| 193 | @@ -1182,9 +1217,28 @@ gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType dis | ||
| 194 | |||
| 195 | go->renderSurf = malloc(sizeof(gcoSURF) * go->nNumBuffers); | ||
| 196 | gcoOS_GetDisplayVirtual(go->display, &width, &height); | ||
| 197 | + gcoOS_SetSwapInterval(go->display, 1); | ||
| 198 | + | ||
| 199 | + /*Needed only for multi Buffer */ | ||
| 200 | + if(go->nNumBuffers > 1) | ||
| 201 | + { | ||
| 202 | + gcmVERIFY_OK(gcoOS_CreateSignal(gcvNULL, gcvFALSE, | ||
| 203 | + &go->signal)); | ||
| 204 | + gcmVERIFY_OK(gcoOS_CreateSignal(gcvNULL, gcvFALSE, | ||
| 205 | + &go->busySignal)); | ||
| 206 | + | ||
| 207 | + go->iface.command = gcvHAL_SIGNAL; | ||
| 208 | + go->iface.u.Signal.signal = gcmPTR_TO_UINT64(go->signal); | ||
| 209 | + go->iface.u.Signal.auxSignal = 0; | ||
| 210 | + go->iface.u.Signal.process = gcmPTR_TO_UINT64(gcoOS_GetCurrentProcessID()); | ||
| 211 | + go->iface.u.Signal.fromWhere = gcvKERNEL_PIXEL; | ||
| 212 | + | ||
| 213 | + go->exitWorker = 0; | ||
| 214 | + pthread_create(&go->workerId, NULL, gal2d_output_worker, output); | ||
| 215 | + pthread_mutex_init(&go->workerMutex, gcvNULL); | ||
| 216 | + } | ||
| 217 | for(i=0; i < go->nNumBuffers; i++) | ||
| 218 | { | ||
| 219 | - | ||
| 220 | gcmONERROR(gcoSURF_Construct(gr->gcoHal, info.width, info.height, 1, | ||
| 221 | gcvSURF_BITMAP, go->format, gcvPOOL_USER, &go->renderSurf[i])); | ||
| 222 | |||
| 223 | @@ -1200,7 +1254,7 @@ gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType dis | ||
| 224 | go->activebuffer = 0; | ||
| 225 | else | ||
| 226 | go->activebuffer = 1; | ||
| 227 | - | ||
| 228 | + | ||
| 229 | if(go->nNumBuffers <= 1 ) | ||
| 230 | { | ||
| 231 | gcmVERIFY_OK(gcoSURF_Construct(gr->gcoHal, | ||
| 232 | @@ -1213,8 +1267,11 @@ gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType dis | ||
| 233 | &go->offscreenSurface)); | ||
| 234 | make_current(gr, go->offscreenSurface); | ||
| 235 | gal2d_clear(output); | ||
| 236 | - gal2d_flip_surface(output); | ||
| 237 | } | ||
| 238 | + else | ||
| 239 | + { | ||
| 240 | + gcoOS_Signal(gcvNULL,go->busySignal, gcvTRUE); | ||
| 241 | + } | ||
| 242 | |||
| 243 | for (i = 0; i < 2; i++) | ||
| 244 | pixman_region32_init(&go->buffer_damage[i]); | ||
| 245 | -- | ||
| 246 | 2.1.4 | ||
| 247 | |||
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch b/meta-fsl-arm/recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch new file mode 100644 index 000000000..295d4e8de --- /dev/null +++ b/meta-fsl-arm/recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch | |||
| @@ -0,0 +1,183 @@ | |||
| 1 | From 399460e202d2b23ffda661499845bcc4d86dc86c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Prabhu Sundararaj <prabhu.sundararaj@freescale.com> | ||
| 3 | Date: Wed, 31 Dec 2014 16:59:16 -0600 | ||
| 4 | Subject: [PATCH] MGS-391: Weston: Performance Optimisation for single buffer | ||
| 5 | mode | ||
| 6 | Organization: O.S. Systems Software LTDA. | ||
| 7 | |||
| 8 | Blit direct to the onscreen whenever compositing is needed which | ||
| 9 | will help to improve bandwidth utilization | ||
| 10 | |||
| 11 | Upstream-Status: Pending | ||
| 12 | |||
| 13 | Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@freescale.com> | ||
| 14 | --- | ||
| 15 | src/gal2d-renderer.c | 114 ++++++++++++++++++++++++++++++++++++--------------- | ||
| 16 | 1 file changed, 81 insertions(+), 33 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c | ||
| 19 | index 4cccaf1..e07a2f9 100644 | ||
| 20 | --- a/src/gal2d-renderer.c | ||
| 21 | +++ b/src/gal2d-renderer.c | ||
| 22 | @@ -55,6 +55,9 @@ struct gal2d_output_state { | ||
| 23 | gctSIGNAL signal; | ||
| 24 | gctSIGNAL busySignal; | ||
| 25 | gcsHAL_INTERFACE iface; | ||
| 26 | + int directBlit; | ||
| 27 | + gctINT width; | ||
| 28 | + gctINT height; | ||
| 29 | }; | ||
| 30 | |||
| 31 | struct gal2d_surface_state { | ||
| 32 | @@ -515,34 +518,37 @@ update_surface(struct weston_output *output) | ||
| 33 | struct gal2d_output_state *go = get_output_state(output); | ||
| 34 | gceSTATUS status = gcvSTATUS_OK; | ||
| 35 | |||
| 36 | - if(go->offscreenSurface && go->nNumBuffers == 1) | ||
| 37 | + if(go->nNumBuffers == 1) | ||
| 38 | { | ||
| 39 | - make_current(gr, go->renderSurf[go->activebuffer]); | ||
| 40 | - | ||
| 41 | - gctUINT srcWidth = 0; | ||
| 42 | - gctUINT srcHeight = 0; | ||
| 43 | - gctINT srcStride = 0; | ||
| 44 | - gceSURF_FORMAT srcFormat;; | ||
| 45 | - gcsRECT dstRect = {0}; | ||
| 46 | - gcoSURF srcSurface = go->offscreenSurface; | ||
| 47 | - gctUINT32 physical; | ||
| 48 | - gctPOINTER va =0; | ||
| 49 | - | ||
| 50 | - gcmONERROR(gcoSURF_GetAlignedSize(srcSurface, &srcWidth, &srcHeight, &srcStride)); | ||
| 51 | - gcmONERROR(gcoSURF_GetFormat(srcSurface, gcvNULL, &srcFormat)); | ||
| 52 | - gcmONERROR(gcoSURF_Lock(srcSurface, &physical, (gctPOINTER *)&va)); | ||
| 53 | - gcmONERROR(gco2D_SetColorSource(gr->gcoEngine2d, physical, srcStride, srcFormat, | ||
| 54 | - gcvFALSE, srcWidth, gcvFALSE, gcvSURF_OPAQUE, 0)); | ||
| 55 | - | ||
| 56 | - dstRect.left = 0; | ||
| 57 | - dstRect.top = 0; | ||
| 58 | - dstRect.right = srcWidth; | ||
| 59 | - dstRect.bottom = srcHeight; | ||
| 60 | - | ||
| 61 | - gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect)); | ||
| 62 | - gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect)); | ||
| 63 | - gcmONERROR(gco2D_Blit(gr->gcoEngine2d, 1, &dstRect, 0xCC, 0xCC, go->format)); | ||
| 64 | - gcmONERROR(gcoSURF_Unlock(srcSurface, (gctPOINTER *)&va)); | ||
| 65 | + if(!go->directBlit && go->offscreenSurface) | ||
| 66 | + { | ||
| 67 | + make_current(gr, go->renderSurf[go->activebuffer]); | ||
| 68 | + | ||
| 69 | + gctUINT srcWidth = 0; | ||
| 70 | + gctUINT srcHeight = 0; | ||
| 71 | + gctINT srcStride = 0; | ||
| 72 | + gceSURF_FORMAT srcFormat;; | ||
| 73 | + gcsRECT dstRect = {0}; | ||
| 74 | + gcoSURF srcSurface = go->offscreenSurface; | ||
| 75 | + gctUINT32 physical; | ||
| 76 | + gctPOINTER va =0; | ||
| 77 | + | ||
| 78 | + gcmONERROR(gcoSURF_GetAlignedSize(srcSurface, &srcWidth, &srcHeight, &srcStride)); | ||
| 79 | + gcmONERROR(gcoSURF_GetFormat(srcSurface, gcvNULL, &srcFormat)); | ||
| 80 | + gcmONERROR(gcoSURF_Lock(srcSurface, &physical, (gctPOINTER *)&va)); | ||
| 81 | + gcmONERROR(gco2D_SetColorSource(gr->gcoEngine2d, physical, srcStride, srcFormat, | ||
| 82 | + gcvFALSE, srcWidth, gcvFALSE, gcvSURF_OPAQUE, 0)); | ||
| 83 | + | ||
| 84 | + dstRect.left = 0; | ||
| 85 | + dstRect.top = 0; | ||
| 86 | + dstRect.right = srcWidth; | ||
| 87 | + dstRect.bottom = srcHeight; | ||
| 88 | + | ||
| 89 | + gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect)); | ||
| 90 | + gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect)); | ||
| 91 | + gcmONERROR(gco2D_Blit(gr->gcoEngine2d, 1, &dstRect, 0xCC, 0xCC, go->format)); | ||
| 92 | + gcmONERROR(gcoSURF_Unlock(srcSurface, (gctPOINTER *)&va)); | ||
| 93 | + } | ||
| 94 | gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
| 95 | } | ||
| 96 | else if(go->nNumBuffers > 1) | ||
| 97 | @@ -554,18 +560,61 @@ OnError: | ||
| 98 | galONERROR(status); | ||
| 99 | return status; | ||
| 100 | } | ||
| 101 | + | ||
| 102 | +static int | ||
| 103 | +is_view_visible(struct weston_view *view) | ||
| 104 | +{ | ||
| 105 | + /* Return false, if surface is guaranteed to be totally obscured. */ | ||
| 106 | + int ret; | ||
| 107 | + pixman_region32_t unocc; | ||
| 108 | + | ||
| 109 | + pixman_region32_init(&unocc); | ||
| 110 | + pixman_region32_subtract(&unocc, &view->transform.boundingbox, | ||
| 111 | + &view->clip); | ||
| 112 | + ret = pixman_region32_not_empty(&unocc); | ||
| 113 | + pixman_region32_fini(&unocc); | ||
| 114 | + | ||
| 115 | + return ret; | ||
| 116 | +} | ||
| 117 | |||
| 118 | static int | ||
| 119 | use_output(struct weston_output *output) | ||
| 120 | { | ||
| 121 | + struct weston_compositor *compositor = output->compositor; | ||
| 122 | + struct weston_view *view; | ||
| 123 | struct gal2d_output_state *go = get_output_state(output); | ||
| 124 | struct gal2d_renderer *gr = get_renderer(output->compositor); | ||
| 125 | gceSTATUS status = gcvSTATUS_OK; | ||
| 126 | |||
| 127 | gcoSURF surface; | ||
| 128 | - surface = go->nNumBuffers > 1 ? | ||
| 129 | - go->renderSurf[go->activebuffer] : | ||
| 130 | - go->offscreenSurface; /*go->renderSurf[0];*/ | ||
| 131 | + int visibleViews=0; | ||
| 132 | + int fullscreenViews=0; | ||
| 133 | + | ||
| 134 | + surface = go->renderSurf[go->activebuffer]; | ||
| 135 | + if(go->nNumBuffers == 1) | ||
| 136 | + { | ||
| 137 | + wl_list_for_each_reverse(view, &compositor->view_list, link) | ||
| 138 | + if (view->plane == &compositor->primary_plane && is_view_visible(view)) | ||
| 139 | + { | ||
| 140 | + visibleViews++; | ||
| 141 | + if(view->surface->width == go->width && view->surface->height == go->height) | ||
| 142 | + { | ||
| 143 | + pixman_box32_t *bb_rects; | ||
| 144 | + int nbb=0; | ||
| 145 | + bb_rects = pixman_region32_rectangles(&view->transform.boundingbox, &nbb); | ||
| 146 | + if(nbb == 1) | ||
| 147 | + if(bb_rects[0].x1 == 0 && bb_rects[0].y1 ==0) | ||
| 148 | + fullscreenViews++; | ||
| 149 | + } | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + go->directBlit = ((visibleViews == 1) || (fullscreenViews > 1)); | ||
| 153 | + | ||
| 154 | + if(!go->directBlit) | ||
| 155 | + { | ||
| 156 | + surface = go->offscreenSurface; | ||
| 157 | + } | ||
| 158 | + } | ||
| 159 | make_current(gr, surface); | ||
| 160 | return status; | ||
| 161 | } | ||
| 162 | @@ -1190,8 +1239,7 @@ gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType dis | ||
| 163 | struct gal2d_renderer *gr = get_renderer(output->compositor); | ||
| 164 | struct gal2d_output_state *go = calloc(1, sizeof *go); | ||
| 165 | halDISPLAY_INFO info; | ||
| 166 | - gctUINT32 backOffset = 0; | ||
| 167 | - gctINT width, height; | ||
| 168 | + gctUINT32 backOffset = 0; | ||
| 169 | gceSTATUS status = gcvSTATUS_OK; | ||
| 170 | gctUINT32 i; | ||
| 171 | |||
| 172 | @@ -1216,7 +1264,7 @@ gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType dis | ||
| 173 | go->activebuffer = 0; | ||
| 174 | |||
| 175 | go->renderSurf = malloc(sizeof(gcoSURF) * go->nNumBuffers); | ||
| 176 | - gcoOS_GetDisplayVirtual(go->display, &width, &height); | ||
| 177 | + gcoOS_GetDisplayVirtual(go->display, &go->width, &go->height); | ||
| 178 | gcoOS_SetSwapInterval(go->display, 1); | ||
| 179 | |||
| 180 | /*Needed only for multi Buffer */ | ||
| 181 | -- | ||
| 182 | 2.1.4 | ||
| 183 | |||
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston_%.bbappend b/meta-fsl-arm/recipes-graphics/wayland/weston_%.bbappend index 01773d279..f7ad4635b 100644 --- a/meta-fsl-arm/recipes-graphics/wayland/weston_%.bbappend +++ b/meta-fsl-arm/recipes-graphics/wayland/weston_%.bbappend | |||
| @@ -1,11 +1,15 @@ | |||
| 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" |
| 2 | 2 | ||
| 3 | SRC_URI_append_mx6 = " file://0001-ENGR00314805-1-Add-Vivante-EGL-support.patch \ | 3 | SRC_URI_append_mx6 = " \ |
| 4 | file://0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch \ | 4 | file://0001-ENGR00314805-1-Add-Vivante-EGL-support.patch \ |
| 5 | file://0003-Distorted-line-and-shadow-if-use-2d-com.patch \ | 5 | file://0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch \ |
| 6 | file://0005-Enable-GAL2D-compositor-in-SoloLite.patch \ | 6 | file://0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch \ |
| 7 | file://0006-Change-GAL2D-compositor-to-be-default-i.patch \ | 7 | file://0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch \ |
| 8 | " | 8 | file://0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch \ |
| 9 | file://0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch \ | ||
| 10 | file://0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch \ | ||
| 11 | " | ||
| 12 | |||
| 9 | PACKAGECONFIG_append_mx6q = " cairo-glesv2" | 13 | PACKAGECONFIG_append_mx6q = " cairo-glesv2" |
| 10 | PACKAGECONFIG_append_mx6dl = " cairo-glesv2" | 14 | PACKAGECONFIG_append_mx6dl = " cairo-glesv2" |
| 11 | PACKAGECONFIG_append_mx6sx = " cairo-glesv2" | 15 | PACKAGECONFIG_append_mx6sx = " cairo-glesv2" |
