aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2015-01-07 16:14:14 -0200
committerOtavio Salvador <otavio@ossystems.com.br>2015-02-04 12:10:09 -0200
commitda650496d88f8d1d7d396c7c8c9c9b4d0f053c65 (patch)
treec7da830e95f06e39d6fa45d98d21a0c0427b4127
parent95e0861135ffa5f42828d9419788b3db9946861f (diff)
downloadmeta-fsl-arm-da650496d88f8d1d7d396c7c8c9c9b4d0f053c65.tar.gz
meta-fsl-arm-da650496d88f8d1d7d396c7c8c9c9b4d0f053c65.tar.bz2
meta-fsl-arm-da650496d88f8d1d7d396c7c8c9c9b4d0f053c65.zip
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>
-rw-r--r--recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch11
-rw-r--r--recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch13
-rw-r--r--recipes-graphics/wayland/weston/0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch (renamed from recipes-graphics/wayland/weston/0003-Distorted-line-and-shadow-if-use-2d-com.patch)10
-rw-r--r--recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch (renamed from recipes-graphics/wayland/weston/0005-Enable-GAL2D-compositor-in-SoloLite.patch)15
-rw-r--r--recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch (renamed from recipes-graphics/wayland/weston/0006-Change-GAL2D-compositor-to-be-default-i.patch)9
-rw-r--r--recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch247
-rw-r--r--recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch183
-rw-r--r--recipes-graphics/wayland/weston_%.bbappend16
8 files changed, 476 insertions, 28 deletions
diff --git a/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch b/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch
index e946fe4..a0fcdef 100644
--- a/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch
+++ b/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch
@@ -1,7 +1,8 @@
-From 0d24f9872fc5bbbb07ae55f1107ba0f5060fca8a Mon Sep 17 00:00:00 2001
+From eb738e87f131f60c89e641e619dc8b1ccc88a30b Mon Sep 17 00:00:00 2001
From: Yong Gan <b45748@freescale.com>
Date: Thu, 22 May 2014 15:25:42 +0800
-Subject: [PATCH 1/3] ENGR00314805-1 Add Vivante EGL support
+Subject: [PATCH] ENGR00314805-1 Add Vivante EGL support
+Organization: O.S. Systems Software LTDA.
Add Vivante EGL compositor support.
@@ -9,8 +10,10 @@ Upstream-Status: Pending
[DATE]05-22-2014
Signed-off-by Yong Gan <B45748@freescale.com>
+
+Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
- src/compositor-fbdev.c | 23 +++++++++++++++++++----
+ src/compositor-fbdev.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
@@ -70,5 +73,5 @@ index e703e0e..3db1d17 100644
NULL) < 0) {
weston_log("gl_renderer_create failed.\n");
--
-1.7.9.5
+2.1.4
diff --git a/recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch b/recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch
index 58b5966..1cfca7b 100644
--- a/recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch
+++ b/recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch
@@ -1,7 +1,8 @@
-From 2a24c62ef00d1b08974bd8f07e277695ac2911fa Mon Sep 17 00:00:00 2001
+From 8a887ec821a53f18a7530b77f08ec823ce757937 Mon Sep 17 00:00:00 2001
From: Yong Gan <b45748@freescale.com>
Date: Thu, 22 May 2014 15:26:31 +0800
-Subject: [PATCH 2/3] ENGR00314805-2 Add Vivante GAL2D support
+Subject: [PATCH] ENGR00314805-2 Add Vivante GAL2D support
+Organization: O.S. Systems Software LTDA.
Add Vivante GAL2D compositor support.
@@ -9,6 +10,8 @@ Upstream-Status: Pending
[DATE]05-22-2014
Signed-off-by Yong Gan <B45748@freescale.com>
+
+Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
Makefile.am | 13 +
src/compositor-fbdev.c | 110 ++++-
@@ -19,10 +22,10 @@ Signed-off-by Yong Gan <B45748@freescale.com>
create mode 100644 src/gal2d-renderer.h
diff --git a/Makefile.am b/Makefile.am
-index 343adc6..2bccfe9 100644
+index 0c08acb..29834c3 100644
--- a/Makefile.am
+++ b/Makefile.am
-@@ -162,6 +162,19 @@ gl_renderer_la_SOURCES = \
+@@ -165,6 +165,19 @@ gl_renderer_la_SOURCES = \
src/gl-renderer.c \
src/vertex-clipping.c \
src/vertex-clipping.h
@@ -1496,5 +1499,5 @@ index 0000000..3b89f73
+
+#endif
--
-1.7.9.5
+2.1.4
diff --git a/recipes-graphics/wayland/weston/0003-Distorted-line-and-shadow-if-use-2d-com.patch b/recipes-graphics/wayland/weston/0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch
index 0e7ffd0..65554d3 100644
--- a/recipes-graphics/wayland/weston/0003-Distorted-line-and-shadow-if-use-2d-com.patch
+++ b/recipes-graphics/wayland/weston/0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch
@@ -1,14 +1,16 @@
-From 1fd17db2ab978322803683a4d2d847a0b31a4c1c Mon Sep 17 00:00:00 2001
+From 663f2a362ff384098f4c32f5cc9e7b7b73f2a553 Mon Sep 17 00:00:00 2001
From: Prabhu Sundararaj <prabhu.sundararaj@freescale.com>
Date: Tue, 24 Jun 2014 15:44:13 -0500
-Subject: [PATCH 3/3] ENGR00319247 : Distorted line and shadow if use 2d
- compositor to run wayland apps.
+Subject: [PATCH] ENGR00319247 : Distorted line and shadow if use 2d compositor
+ to run wayland apps.
+Organization: O.S. Systems Software LTDA.
Fixed blending for shadown and maintained separate surface for damage composite.
Upstream Status: N/A
Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@freescale.com>
+Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
src/compositor-fbdev.c | 8 ++--
src/gal2d-renderer.c | 102 +++++++++++++++++++++++++++++++++++--------------
@@ -252,5 +254,5 @@ index 3b89f73..1322a7d 100644
struct gal2d_renderer_interface {
--
-2.0.0
+2.1.4
diff --git a/recipes-graphics/wayland/weston/0005-Enable-GAL2D-compositor-in-SoloLite.patch b/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch
index cf08900..cb4ed6b 100644
--- a/recipes-graphics/wayland/weston/0005-Enable-GAL2D-compositor-in-SoloLite.patch
+++ b/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch
@@ -1,21 +1,24 @@
-From 1eea925312fb7e1bc1cf42e001069cbac887b128 Mon Sep 17 00:00:00 2001
+From ca9eb5bdbdfe17654466d84c8baaa1187a8796c6 Mon Sep 17 00:00:00 2001
From: Yong Gan <b45748@freescale.com>
Date: Wed, 2 Jul 2014 11:27:26 +0800
Subject: [PATCH] ENGR00320243 Enable GAL2D compositor in SoloLite
+Organization: O.S. Systems Software LTDA.
Build gal2d-renderer.so when EGL was not enabled.
Date: Jul 02, 2014
Signed-off-by Yong Gan <yong.gan@freescale.com>
+
+Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
- Makefile.am | 2 +-
+ Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
-index 2bccfe9..42148b1 100644
+index 29834c3..e82e970 100644
--- a/Makefile.am
+++ b/Makefile.am
-@@ -162,6 +162,7 @@ gl_renderer_la_SOURCES = \
+@@ -165,6 +165,7 @@ gl_renderer_la_SOURCES = \
src/gl-renderer.c \
src/vertex-clipping.c \
src/vertex-clipping.h
@@ -23,7 +26,7 @@ index 2bccfe9..42148b1 100644
module_LTLIBRARIES += gal2d-renderer.la
gal2d_renderer_la_LDFLAGS = -module -avoid-version
-@@ -175,7 +176,6 @@ gal2d_renderer_la_SOURCES = \
+@@ -178,7 +179,6 @@ gal2d_renderer_la_SOURCES = \
src/gal2d-renderer.c \
src/vertex-clipping.c \
src/vertex-clipping.h
@@ -32,5 +35,5 @@ index 2bccfe9..42148b1 100644
if ENABLE_X11_COMPOSITOR
module_LTLIBRARIES += x11-backend.la
--
-1.7.9.5
+2.1.4
diff --git a/recipes-graphics/wayland/weston/0006-Change-GAL2D-compositor-to-be-default-i.patch b/recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch
index e0a855f..89d6215 100644
--- a/recipes-graphics/wayland/weston/0006-Change-GAL2D-compositor-to-be-default-i.patch
+++ b/recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch
@@ -1,15 +1,18 @@
-From 916e1fe5ca320f3115e904ae5543da3c5603d70e Mon Sep 17 00:00:00 2001
+From e58ecd66cea732aab8f6b5274d72868922e92c5f Mon Sep 17 00:00:00 2001
From: Yong Gan <b45748@freescale.com>
Date: Fri, 4 Jul 2014 09:57:11 +0800
Subject: [PATCH] ENGR00321030 Change GAL2D compositor to be default in
SoloLite.
+Organization: O.S. Systems Software LTDA.
Change GAL2D compositor to be default When EGL is not enabled.
Date: Jul 03, 2014
Signed-off-by Yong Gan <yong.gan@freescale.com>
+
+Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
- src/compositor-fbdev.c | 5 +++++
+ src/compositor-fbdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
@@ -31,5 +34,5 @@ index b27d199..bdc6ec9 100644
const struct weston_option fbdev_options[] = {
--
-1.7.9.5
+2.1.4
diff --git a/recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch b/recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch
new file mode 100644
index 0000000..8201459
--- /dev/null
+++ b/recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch
@@ -0,0 +1,247 @@
+From db720086b85046bd0806484bfe63915870bb4323 Mon Sep 17 00:00:00 2001
+From: Prabhu Sundararaj <prabhu.sundararaj@freescale.com>
+Date: Tue, 30 Dec 2014 16:09:29 -0600
+Subject: [PATCH] MGS-389 - Fix for wrong FPS throttling when multibuffer is
+ set
+Organization: O.S. Systems Software LTDA.
+
+When the FB_MULTI_BUFFER=2 is set, throtling to 30FPS for a 60Hz display
+which is suppose to have 60FPS.
+Adding worker thread to output the frame in async mode for better
+performance.
+
+Upstream-Status: Pending
+
+Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@freescale.com>
+---
+ src/gal2d-renderer.c | 109 +++++++++++++++++++++++++++++++++++++++------------
+ 1 file changed, 83 insertions(+), 26 deletions(-)
+
+diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c
+index fbe39f6..4cccaf1 100644
+--- a/src/gal2d-renderer.c
++++ b/src/gal2d-renderer.c
+@@ -28,6 +28,8 @@
+ #include <ctype.h>
+ #include <float.h>
+ #include <assert.h>
++#include <pthread.h>
++
+ #include "compositor.h"
+ #include "gal2d-renderer.h"
+ #include "vertex-clipping.h"
+@@ -37,7 +39,6 @@
+
+ #define galONERROR(x) if(status < 0) printf("Error in function %s\n", __func__);
+
+-
+ struct gal2d_output_state {
+
+ int current_buffer;
+@@ -48,7 +49,12 @@ struct gal2d_output_state {
+ int activebuffer;
+ gcoSURF offscreenSurface;
+ gceSURF_FORMAT format;
+- gcoSURF tempSurf;
++ pthread_mutex_t workerMutex;
++ pthread_t workerId;
++ gctUINT32 exitWorker;
++ gctSIGNAL signal;
++ gctSIGNAL busySignal;
++ gcsHAL_INTERFACE iface;
+ };
+
+ struct gal2d_surface_state {
+@@ -373,8 +379,7 @@ gal2d_clear(struct weston_output *base)
+ gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect));
+ gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect));
+ gcmONERROR(gco2D_Clear(gr->gcoEngine2d, 1, &dstRect, 0xff0000ff, 0xCC, 0xCC, go->format));
+-
+- gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE));
++ gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvTRUE));
+
+ OnError:
+ galONERROR(status);
+@@ -465,7 +470,6 @@ gal2dBindBuffer(struct weston_surface* es)
+ static void
+ gal2d_flip_surface(struct weston_output *output)
+ {
+- struct gal2d_renderer *gr = get_renderer(output->compositor);
+ struct gal2d_output_state *go = get_output_state(output);
+
+ if(go->nNumBuffers > 1)
+@@ -473,17 +477,36 @@ gal2d_flip_surface(struct weston_output *output)
+ gctUINT Offset;
+ gctINT X;
+ gctINT Y;
+- gcmVERIFY_OK(gcoHAL_Commit(gr->gcoHal, gcvTRUE));
+-
++
+ gcmVERIFY_OK(gcoOS_GetDisplayBackbuffer(go->display, gcvNULL,
+ gcvNULL, gcvNULL, &Offset, &X, &Y));
+
+ gcmVERIFY_OK(gcoOS_SetDisplayVirtual(go->display, gcvNULL,
+- Offset, X, Y));
+-
+- go->activebuffer = (go->activebuffer+1) % go->nNumBuffers;
++ Offset, X, Y));
+ }
+ }
++static void *gal2d_output_worker(void *arg)
++{
++ struct weston_output *output = (struct weston_output *)arg;
++ struct gal2d_output_state *go = get_output_state(output);
++
++ while(1)
++ {
++ if(gcoOS_WaitSignal(gcvNULL, go->signal, gcvINFINITE) == gcvSTATUS_OK )
++ {
++ gal2d_flip_surface(output);
++ gcoOS_Signal(gcvNULL,go->busySignal, gcvTRUE);
++ }
++ pthread_mutex_lock(&go->workerMutex);
++ if(go->exitWorker == 1)
++ {
++ pthread_mutex_unlock(&go->workerMutex);
++ break;
++ }
++ pthread_mutex_unlock(&go->workerMutex);
++ }
++ return 0;
++}
+
+ static int
+ update_surface(struct weston_output *output)
+@@ -520,11 +543,13 @@ update_surface(struct weston_output *output)
+ gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect));
+ gcmONERROR(gco2D_Blit(gr->gcoEngine2d, 1, &dstRect, 0xCC, 0xCC, go->format));
+ gcmONERROR(gcoSURF_Unlock(srcSurface, (gctPOINTER *)&va));
+- gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE));
++ gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE));
+ }
+-
+- gal2d_flip_surface(output);
+-
++ else if(go->nNumBuffers > 1)
++ {
++ gcoHAL_ScheduleEvent(gr->gcoHal, &go->iface);
++ gcmVERIFY_OK(gcoHAL_Commit(gr->gcoHal, gcvFALSE));
++ }
+ OnError:
+ galONERROR(status);
+ return status;
+@@ -746,6 +771,7 @@ repaint_region(struct weston_view *ev, struct weston_output *output, struct gal2
+ 0xCC, 0xCC, go->format));
+ }
+ }
++
+ if(status < 0)
+ {
+ printf("cr l=%d r=%d t=%d b=%d w=%d h=%d\n",
+@@ -759,12 +785,6 @@ repaint_region(struct weston_view *ev, struct weston_output *output, struct gal2
+ goto OnError;
+ }
+ }
+- status = (gcoHAL_Commit(gr->gcoHal, gcvFALSE));
+- if(status < 0)
+- {
+- printf("Error in gcoHAL_Commit %s\n", __func__);
+- goto OnError;
+- }
+ }
+
+ OnError:
+@@ -831,7 +851,15 @@ repaint_views(struct weston_output *output, pixman_region32_t *damage)
+ {
+ struct weston_compositor *compositor = output->compositor;
+ struct weston_view *view;
+-
++ struct gal2d_output_state *go = get_output_state(output);
++
++ if(go->nNumBuffers > 1)
++ {
++ /*500ms is more than enough to process a frame */
++ gcoOS_WaitSignal(gcvNULL, go->busySignal, 500);
++ }
++ go->activebuffer = (go->activebuffer+1) % go->nNumBuffers;
++
+ wl_list_for_each_reverse(view, &compositor->view_list, link)
+ if (view->plane == &compositor->primary_plane)
+ draw_view(view, output, damage);
+@@ -1090,12 +1118,19 @@ gal2d_renderer_output_destroy(struct weston_output *output)
+ if(go->offscreenSurface)
+ gcmVERIFY_OK(gcoSURF_Destroy(go->offscreenSurface));
+ }
+-
++ else
++ {
++ gcoOS_Signal(gcvNULL,go->signal, gcvTRUE);
++ pthread_mutex_lock(&go->workerMutex);
++ go->exitWorker = 1;
++ pthread_mutex_unlock(&go->workerMutex);
++ pthread_join(go->workerId, NULL);
++ }
++
+ for(i=0; i < go->nNumBuffers; i++)
+ {
+ gcmVERIFY_OK(gcoSURF_Destroy(go->renderSurf[i]));
+ }
+-
+ free(go->renderSurf);
+ go->renderSurf = gcvNULL;
+
+@@ -1182,9 +1217,28 @@ gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType dis
+
+ go->renderSurf = malloc(sizeof(gcoSURF) * go->nNumBuffers);
+ gcoOS_GetDisplayVirtual(go->display, &width, &height);
++ gcoOS_SetSwapInterval(go->display, 1);
++
++ /*Needed only for multi Buffer */
++ if(go->nNumBuffers > 1)
++ {
++ gcmVERIFY_OK(gcoOS_CreateSignal(gcvNULL, gcvFALSE,
++ &go->signal));
++ gcmVERIFY_OK(gcoOS_CreateSignal(gcvNULL, gcvFALSE,
++ &go->busySignal));
++
++ go->iface.command = gcvHAL_SIGNAL;
++ go->iface.u.Signal.signal = gcmPTR_TO_UINT64(go->signal);
++ go->iface.u.Signal.auxSignal = 0;
++ go->iface.u.Signal.process = gcmPTR_TO_UINT64(gcoOS_GetCurrentProcessID());
++ go->iface.u.Signal.fromWhere = gcvKERNEL_PIXEL;
++
++ go->exitWorker = 0;
++ pthread_create(&go->workerId, NULL, gal2d_output_worker, output);
++ pthread_mutex_init(&go->workerMutex, gcvNULL);
++ }
+ for(i=0; i < go->nNumBuffers; i++)
+ {
+-
+ gcmONERROR(gcoSURF_Construct(gr->gcoHal, info.width, info.height, 1,
+ gcvSURF_BITMAP, go->format, gcvPOOL_USER, &go->renderSurf[i]));
+
+@@ -1200,7 +1254,7 @@ gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType dis
+ go->activebuffer = 0;
+ else
+ go->activebuffer = 1;
+-
++
+ if(go->nNumBuffers <= 1 )
+ {
+ gcmVERIFY_OK(gcoSURF_Construct(gr->gcoHal,
+@@ -1213,8 +1267,11 @@ gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType dis
+ &go->offscreenSurface));
+ make_current(gr, go->offscreenSurface);
+ gal2d_clear(output);
+- gal2d_flip_surface(output);
+ }
++ else
++ {
++ gcoOS_Signal(gcvNULL,go->busySignal, gcvTRUE);
++ }
+
+ for (i = 0; i < 2; i++)
+ pixman_region32_init(&go->buffer_damage[i]);
+--
+2.1.4
+
diff --git a/recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch b/recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch
new file mode 100644
index 0000000..295d4e8
--- /dev/null
+++ b/recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch
@@ -0,0 +1,183 @@
+From 399460e202d2b23ffda661499845bcc4d86dc86c Mon Sep 17 00:00:00 2001
+From: Prabhu Sundararaj <prabhu.sundararaj@freescale.com>
+Date: Wed, 31 Dec 2014 16:59:16 -0600
+Subject: [PATCH] MGS-391: Weston: Performance Optimisation for single buffer
+ mode
+Organization: O.S. Systems Software LTDA.
+
+Blit direct to the onscreen whenever compositing is needed which
+will help to improve bandwidth utilization
+
+Upstream-Status: Pending
+
+Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@freescale.com>
+---
+ src/gal2d-renderer.c | 114 ++++++++++++++++++++++++++++++++++++---------------
+ 1 file changed, 81 insertions(+), 33 deletions(-)
+
+diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c
+index 4cccaf1..e07a2f9 100644
+--- a/src/gal2d-renderer.c
++++ b/src/gal2d-renderer.c
+@@ -55,6 +55,9 @@ struct gal2d_output_state {
+ gctSIGNAL signal;
+ gctSIGNAL busySignal;
+ gcsHAL_INTERFACE iface;
++ int directBlit;
++ gctINT width;
++ gctINT height;
+ };
+
+ struct gal2d_surface_state {
+@@ -515,34 +518,37 @@ update_surface(struct weston_output *output)
+ struct gal2d_output_state *go = get_output_state(output);
+ gceSTATUS status = gcvSTATUS_OK;
+
+- if(go->offscreenSurface && go->nNumBuffers == 1)
++ if(go->nNumBuffers == 1)
+ {
+- make_current(gr, go->renderSurf[go->activebuffer]);
+-
+- gctUINT srcWidth = 0;
+- gctUINT srcHeight = 0;
+- gctINT srcStride = 0;
+- gceSURF_FORMAT srcFormat;;
+- gcsRECT dstRect = {0};
+- gcoSURF srcSurface = go->offscreenSurface;
+- gctUINT32 physical;
+- gctPOINTER va =0;
+-
+- gcmONERROR(gcoSURF_GetAlignedSize(srcSurface, &srcWidth, &srcHeight, &srcStride));
+- gcmONERROR(gcoSURF_GetFormat(srcSurface, gcvNULL, &srcFormat));
+- gcmONERROR(gcoSURF_Lock(srcSurface, &physical, (gctPOINTER *)&va));
+- gcmONERROR(gco2D_SetColorSource(gr->gcoEngine2d, physical, srcStride, srcFormat,
+- gcvFALSE, srcWidth, gcvFALSE, gcvSURF_OPAQUE, 0));
+-
+- dstRect.left = 0;
+- dstRect.top = 0;
+- dstRect.right = srcWidth;
+- dstRect.bottom = srcHeight;
+-
+- gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect));
+- gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect));
+- gcmONERROR(gco2D_Blit(gr->gcoEngine2d, 1, &dstRect, 0xCC, 0xCC, go->format));
+- gcmONERROR(gcoSURF_Unlock(srcSurface, (gctPOINTER *)&va));
++ if(!go->directBlit && go->offscreenSurface)
++ {
++ make_current(gr, go->renderSurf[go->activebuffer]);
++
++ gctUINT srcWidth = 0;
++ gctUINT srcHeight = 0;
++ gctINT srcStride = 0;
++ gceSURF_FORMAT srcFormat;;
++ gcsRECT dstRect = {0};
++ gcoSURF srcSurface = go->offscreenSurface;
++ gctUINT32 physical;
++ gctPOINTER va =0;
++
++ gcmONERROR(gcoSURF_GetAlignedSize(srcSurface, &srcWidth, &srcHeight, &srcStride));
++ gcmONERROR(gcoSURF_GetFormat(srcSurface, gcvNULL, &srcFormat));
++ gcmONERROR(gcoSURF_Lock(srcSurface, &physical, (gctPOINTER *)&va));
++ gcmONERROR(gco2D_SetColorSource(gr->gcoEngine2d, physical, srcStride, srcFormat,
++ gcvFALSE, srcWidth, gcvFALSE, gcvSURF_OPAQUE, 0));
++
++ dstRect.left = 0;
++ dstRect.top = 0;
++ dstRect.right = srcWidth;
++ dstRect.bottom = srcHeight;
++
++ gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect));
++ gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect));
++ gcmONERROR(gco2D_Blit(gr->gcoEngine2d, 1, &dstRect, 0xCC, 0xCC, go->format));
++ gcmONERROR(gcoSURF_Unlock(srcSurface, (gctPOINTER *)&va));
++ }
+ gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE));
+ }
+ else if(go->nNumBuffers > 1)
+@@ -554,18 +560,61 @@ OnError:
+ galONERROR(status);
+ return status;
+ }
++
++static int
++is_view_visible(struct weston_view *view)
++{
++ /* Return false, if surface is guaranteed to be totally obscured. */
++ int ret;
++ pixman_region32_t unocc;
++
++ pixman_region32_init(&unocc);
++ pixman_region32_subtract(&unocc, &view->transform.boundingbox,
++ &view->clip);
++ ret = pixman_region32_not_empty(&unocc);
++ pixman_region32_fini(&unocc);
++
++ return ret;
++}
+
+ static int
+ use_output(struct weston_output *output)
+ {
++ struct weston_compositor *compositor = output->compositor;
++ struct weston_view *view;
+ struct gal2d_output_state *go = get_output_state(output);
+ struct gal2d_renderer *gr = get_renderer(output->compositor);
+ gceSTATUS status = gcvSTATUS_OK;
+
+ gcoSURF surface;
+- surface = go->nNumBuffers > 1 ?
+- go->renderSurf[go->activebuffer] :
+- go->offscreenSurface; /*go->renderSurf[0];*/
++ int visibleViews=0;
++ int fullscreenViews=0;
++
++ surface = go->renderSurf[go->activebuffer];
++ if(go->nNumBuffers == 1)
++ {
++ wl_list_for_each_reverse(view, &compositor->view_list, link)
++ if (view->plane == &compositor->primary_plane && is_view_visible(view))
++ {
++ visibleViews++;
++ if(view->surface->width == go->width && view->surface->height == go->height)
++ {
++ pixman_box32_t *bb_rects;
++ int nbb=0;
++ bb_rects = pixman_region32_rectangles(&view->transform.boundingbox, &nbb);
++ if(nbb == 1)
++ if(bb_rects[0].x1 == 0 && bb_rects[0].y1 ==0)
++ fullscreenViews++;
++ }
++ }
++
++ go->directBlit = ((visibleViews == 1) || (fullscreenViews > 1));
++
++ if(!go->directBlit)
++ {
++ surface = go->offscreenSurface;
++ }
++ }
+ make_current(gr, surface);
+ return status;
+ }
+@@ -1190,8 +1239,7 @@ gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType dis
+ struct gal2d_renderer *gr = get_renderer(output->compositor);
+ struct gal2d_output_state *go = calloc(1, sizeof *go);
+ halDISPLAY_INFO info;
+- gctUINT32 backOffset = 0;
+- gctINT width, height;
++ gctUINT32 backOffset = 0;
+ gceSTATUS status = gcvSTATUS_OK;
+ gctUINT32 i;
+
+@@ -1216,7 +1264,7 @@ gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType dis
+ go->activebuffer = 0;
+
+ go->renderSurf = malloc(sizeof(gcoSURF) * go->nNumBuffers);
+- gcoOS_GetDisplayVirtual(go->display, &width, &height);
++ gcoOS_GetDisplayVirtual(go->display, &go->width, &go->height);
+ gcoOS_SetSwapInterval(go->display, 1);
+
+ /*Needed only for multi Buffer */
+--
+2.1.4
+
diff --git a/recipes-graphics/wayland/weston_%.bbappend b/recipes-graphics/wayland/weston_%.bbappend
index 01773d2..f7ad463 100644
--- a/recipes-graphics/wayland/weston_%.bbappend
+++ b/recipes-graphics/wayland/weston_%.bbappend
@@ -1,11 +1,15 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-SRC_URI_append_mx6 = " file://0001-ENGR00314805-1-Add-Vivante-EGL-support.patch \
- file://0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch \
- file://0003-Distorted-line-and-shadow-if-use-2d-com.patch \
- file://0005-Enable-GAL2D-compositor-in-SoloLite.patch \
- file://0006-Change-GAL2D-compositor-to-be-default-i.patch \
- "
+SRC_URI_append_mx6 = " \
+ file://0001-ENGR00314805-1-Add-Vivante-EGL-support.patch \
+ file://0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch \
+ file://0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch \
+ file://0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch \
+ file://0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch \
+ file://0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch \
+ file://0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch \
+"
+
PACKAGECONFIG_append_mx6q = " cairo-glesv2"
PACKAGECONFIG_append_mx6dl = " cairo-glesv2"
PACKAGECONFIG_append_mx6sx = " cairo-glesv2"