From da650496d88f8d1d7d396c7c8c9c9b4d0f053c65 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Wed, 7 Jan 2015 16:14:14 -0200 Subject: 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 Signed-off-by: Otavio Salvador --- ...01-ENGR00314805-1-Add-Vivante-EGL-support.patch | 11 +- ...-ENGR00314805-2-Add-Vivante-GAL2D-support.patch | 13 +- ...3-Distorted-line-and-shadow-if-use-2d-com.patch | 256 -------------------- ...7-Distorted-line-and-shadow-if-use-2d-com.patch | 258 +++++++++++++++++++++ ...20243-Enable-GAL2D-compositor-in-SoloLite.patch | 39 ++++ ...0-Change-GAL2D-compositor-to-be-default-i.patch | 38 +++ .../0005-Enable-GAL2D-compositor-in-SoloLite.patch | 36 --- ...6-Change-GAL2D-compositor-to-be-default-i.patch | 35 --- ...-for-wrong-FPS-throttling-when-multibuffe.patch | 247 ++++++++++++++++++++ ...ton-Performance-Optimisation-for-single-b.patch | 183 +++++++++++++++ recipes-graphics/wayland/weston_%.bbappend | 16 +- 11 files changed, 790 insertions(+), 342 deletions(-) delete mode 100644 recipes-graphics/wayland/weston/0003-Distorted-line-and-shadow-if-use-2d-com.patch create mode 100644 recipes-graphics/wayland/weston/0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch create mode 100644 recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch create mode 100644 recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch delete mode 100644 recipes-graphics/wayland/weston/0005-Enable-GAL2D-compositor-in-SoloLite.patch delete mode 100644 recipes-graphics/wayland/weston/0006-Change-GAL2D-compositor-to-be-default-i.patch create mode 100644 recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch create mode 100644 recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch (limited to 'recipes-graphics') 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 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 + +Signed-off-by: Otavio Salvador --- - 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 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 + +Signed-off-by: Otavio Salvador --- Makefile.am | 13 + src/compositor-fbdev.c | 110 ++++- @@ -19,10 +22,10 @@ Signed-off-by Yong Gan 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-Distorted-line-and-shadow-if-use-2d-com.patch deleted file mode 100644 index 0e7ffd0..0000000 --- a/recipes-graphics/wayland/weston/0003-Distorted-line-and-shadow-if-use-2d-com.patch +++ /dev/null @@ -1,256 +0,0 @@ -From 1fd17db2ab978322803683a4d2d847a0b31a4c1c Mon Sep 17 00:00:00 2001 -From: Prabhu Sundararaj -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. - -Fixed blending for shadown and maintained separate surface for damage composite. - -Upstream Status: N/A - -Signed-off-by: Prabhu Sundararaj ---- - src/compositor-fbdev.c | 8 ++-- - src/gal2d-renderer.c | 102 +++++++++++++++++++++++++++++++++++-------------- - src/gal2d-renderer.h | 6 +++ - 3 files changed, 83 insertions(+), 33 deletions(-) - -diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c -index a3d32e5..b27d199 100644 ---- a/src/compositor-fbdev.c -+++ b/src/compositor-fbdev.c -@@ -55,7 +55,7 @@ struct fbdev_compositor { - int use_pixman; - int use_gal2d; - struct wl_listener session_listener; -- EGLNativeDisplayType display; -+ NativeDisplayType display; - }; - - struct fbdev_screeninfo { -@@ -91,8 +91,8 @@ struct fbdev_output { - void *shadow_buf; - uint8_t depth; - -- EGLNativeDisplayType display; -- EGLNativeWindowType window; -+ NativeDisplayType display; -+ NativeWindowType window; - }; - - struct fbdev_parameters { -@@ -667,7 +667,7 @@ fbdev_output_create(struct fbdev_compositor *compositor, - return 0; - } - if (gl_renderer->output_create(&output->base, -- (EGLNativeWindowType)output->window, -+ (NativeWindowType)output->window, - gl_renderer->opaque_attribs, - NULL) < 0) { - weston_log("gl_renderer_output_create failed.\n"); -diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c -index c651573..fbe39f6 100644 ---- a/src/gal2d-renderer.c -+++ b/src/gal2d-renderer.c -@@ -42,7 +42,7 @@ struct gal2d_output_state { - - int current_buffer; - pixman_region32_t buffer_damage[2]; -- EGLNativeDisplayType display; -+ NativeDisplayType display; - gcoSURF* renderSurf; - gctUINT32 nNumBuffers; - int activebuffer; -@@ -423,11 +423,9 @@ gal2dBindBuffer(struct weston_surface* es) - gcoSURF surface = gs->gco_Surface; - struct weston_buffer *buffer = gs->buffer_ref.buffer; - gcePOOL pool = gcvPOOL_DEFAULT; -- gctUINT64 node = 0; -- gctUINT bytes; -- -- gcmVERIFY_OK(gcoSURF_QueryVidMemNode(surface, &node, -- &pool, &bytes)); -+ -+ gcmVERIFY_OK(gcoSURF_QueryVidMemNode(surface, gcvNULL, -+ &pool, gcvNULL)); - - if(pool != gcvPOOL_USER) - { -@@ -801,24 +799,26 @@ draw_view(struct weston_view *ev, struct weston_output *output, - ev->surface->width, ev->surface->height); - pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque); - -+ struct gal2d_renderer *gr = get_renderer(ec); -+ - if (pixman_region32_not_empty(&ev->surface->opaque)) { - - repaint_region(ev, output, go, &repaint, &ev->surface->opaque); - } - - if (pixman_region32_not_empty(&surface_blend)) { -- struct gal2d_renderer *gr = get_renderer(ec); -- -+ - gco2D_EnableAlphaBlend(gr->gcoEngine2d, -- ev->alpha * 0xFF, ev->alpha * 0xFF, -- gcvSURF_PIXEL_ALPHA_STRAIGHT, gcvSURF_PIXEL_ALPHA_STRAIGHT, -- gcvSURF_GLOBAL_ALPHA_OFF, gcvSURF_GLOBAL_ALPHA_OFF, -- gcvSURF_BLEND_ONE, gcvSURF_BLEND_INVERSED, -- gcvSURF_COLOR_STRAIGHT, gcvSURF_COLOR_STRAIGHT); -+ ev->alpha * 0xFF, ev->alpha * 0xFF, -+ gcvSURF_PIXEL_ALPHA_STRAIGHT, gcvSURF_PIXEL_ALPHA_STRAIGHT, -+ gcvSURF_GLOBAL_ALPHA_SCALE, gcvSURF_GLOBAL_ALPHA_SCALE, -+ gcvSURF_BLEND_STRAIGHT, gcvSURF_BLEND_INVERSED, -+ gcvSURF_COLOR_STRAIGHT, gcvSURF_COLOR_STRAIGHT); - - repaint_region(ev, output, go, &repaint, &surface_blend); - } - -+ gco2D_DisableAlphaBlend(gr->gcoEngine2d); - pixman_region32_fini(&surface_blend); - - out: -@@ -866,6 +866,48 @@ gal2d_renderer_repaint_output(struct weston_output *output, - } - - static void -+gal2d_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer) -+{ -+ gcsWL_VIV_BUFFER *vivBuffer = wl_resource_get_user_data(buffer->resource); -+ gctUINT width = 0; -+ gctUINT height = 0; -+ gctINT stride = 0; -+ gceSURF_FORMAT format; -+ gcoSURF srcSurf = vivBuffer->surface; -+ gctUINT32 physical; -+ gctPOINTER va =0; -+ gceSTATUS status = gcvSTATUS_OK; -+ struct gal2d_surface_state *gs = get_surface_state(es); -+ -+ if(gs->gco_Surface == gcvNULL) -+ { -+ /** Construct a wrapper. */ -+ gcmONERROR(gcoSURF_ConstructWrapper(gcvNULL, &gs->gco_Surface)); -+ } -+ -+ gcmONERROR(gcoSURF_GetAlignedSize(srcSurf, &width, &height, &stride)); -+ gcmONERROR(gcoSURF_GetFormat(srcSurf, gcvNULL, &format)); -+ gcmONERROR(gcoSURF_Lock(srcSurf, &physical, (gctPOINTER *)&va)); -+ -+ /* Set the buffer. */ -+ gcmONERROR(gcoSURF_SetBuffer(gs->gco_Surface, -+ gcvSURF_BITMAP_NO_VIDMEM, -+ format, -+ stride, -+ (gctPOINTER) va, -+ (gctUINT32) physical)); -+ -+ /* Set the window. */ -+ gcmONERROR(gcoSURF_SetWindow(gs->gco_Surface, 0, 0, width, height)); -+ -+ buffer->width = vivBuffer->width; -+ buffer->height = vivBuffer->height; -+ -+ OnError: -+ galONERROR(status); -+} -+ -+static void - gal2d_renderer_flush_damage(struct weston_surface *surface) - { - struct gal2d_surface_state *gs = get_surface_state(surface); -@@ -900,10 +942,7 @@ gal2d_renderer_flush_damage(struct weston_surface *surface) - gal2dBindBuffer(surface); - } - else -- { -- gcsWL_VIV_BUFFER *vivBuffer = (gcsWL_VIV_BUFFER *)buffer; -- gs->gco_Surface = vivBuffer->surface; -- } -+ gal2d_renderer_attach_egl(surface, buffer); - - done: - pixman_region32_fini(&gs->texture_damage); -@@ -937,19 +976,17 @@ gal2d_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) - } - } - else -- { -- gcsWL_VIV_BUFFER *vivBuffer = wl_resource_get_user_data(buffer->resource); -- gs->gco_Surface = vivBuffer->surface; -- -- buffer->width = vivBuffer->width; -- buffer->height = vivBuffer->height; -- } -+ gal2d_renderer_attach_egl(es, buffer); - } - - static void - surface_state_destroy(struct gal2d_surface_state *gs, struct gal2d_renderer *gr) - { -- wl_list_remove(&gs->surface_destroy_listener.link); -+ if(gs->gco_Surface) -+ { -+ gcoSURF_Destroy(gs->gco_Surface); -+ } -+ wl_list_remove(&gs->surface_destroy_listener.link); - wl_list_remove(&gs->renderer_destroy_listener.link); - if(gs->surface) - gs->surface->renderer_state = NULL; -@@ -1043,8 +1080,12 @@ gal2d_renderer_output_destroy(struct weston_output *output) - { - struct gal2d_output_state *go = get_output_state(output); - gctUINT32 i; -- -- if(go->nNumBuffers <= 1 ) -+ -+ for (i = 0; i < 2; i++) -+ { -+ pixman_region32_fini(&go->buffer_damage[i]); -+ } -+ if(go->nNumBuffers <= 1 ) - { - if(go->offscreenSurface) - gcmVERIFY_OK(gcoSURF_Destroy(go->offscreenSurface)); -@@ -1107,8 +1148,8 @@ OnError: - } - - static int --gal2d_renderer_output_create(struct weston_output *output, EGLNativeDisplayType display, -- EGLNativeWindowType window) -+gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType display, -+ NativeWindowType window) - - { - struct gal2d_renderer *gr = get_renderer(output->compositor); -@@ -1174,6 +1215,9 @@ gal2d_renderer_output_create(struct weston_output *output, EGLNativeDisplayType - gal2d_clear(output); - gal2d_flip_surface(output); - } -+ -+ for (i = 0; i < 2; i++) -+ pixman_region32_init(&go->buffer_damage[i]); - OnError: - galONERROR(status); - /* Return the status. */ -diff --git a/src/gal2d-renderer.h b/src/gal2d-renderer.h -index 3b89f73..1322a7d 100644 ---- a/src/gal2d-renderer.h -+++ b/src/gal2d-renderer.h -@@ -24,7 +24,13 @@ - #define __gal_2d_renderer_h_ - - #include "compositor.h" -+#ifdef ENABLE_EGL - #include -+#else -+#include -+typedef HALNativeDisplayType NativeDisplayType; -+typedef HALNativeWindowType NativeWindowType; -+#endif - - - struct gal2d_renderer_interface { --- -2.0.0 - diff --git a/recipes-graphics/wayland/weston/0003-ENGR00319247-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 new file mode 100644 index 0000000..65554d3 --- /dev/null +++ b/recipes-graphics/wayland/weston/0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch @@ -0,0 +1,258 @@ +From 663f2a362ff384098f4c32f5cc9e7b7b73f2a553 Mon Sep 17 00:00:00 2001 +From: Prabhu Sundararaj +Date: Tue, 24 Jun 2014 15:44:13 -0500 +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 +Signed-off-by: Otavio Salvador +--- + src/compositor-fbdev.c | 8 ++-- + src/gal2d-renderer.c | 102 +++++++++++++++++++++++++++++++++++-------------- + src/gal2d-renderer.h | 6 +++ + 3 files changed, 83 insertions(+), 33 deletions(-) + +diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c +index a3d32e5..b27d199 100644 +--- a/src/compositor-fbdev.c ++++ b/src/compositor-fbdev.c +@@ -55,7 +55,7 @@ struct fbdev_compositor { + int use_pixman; + int use_gal2d; + struct wl_listener session_listener; +- EGLNativeDisplayType display; ++ NativeDisplayType display; + }; + + struct fbdev_screeninfo { +@@ -91,8 +91,8 @@ struct fbdev_output { + void *shadow_buf; + uint8_t depth; + +- EGLNativeDisplayType display; +- EGLNativeWindowType window; ++ NativeDisplayType display; ++ NativeWindowType window; + }; + + struct fbdev_parameters { +@@ -667,7 +667,7 @@ fbdev_output_create(struct fbdev_compositor *compositor, + return 0; + } + if (gl_renderer->output_create(&output->base, +- (EGLNativeWindowType)output->window, ++ (NativeWindowType)output->window, + gl_renderer->opaque_attribs, + NULL) < 0) { + weston_log("gl_renderer_output_create failed.\n"); +diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c +index c651573..fbe39f6 100644 +--- a/src/gal2d-renderer.c ++++ b/src/gal2d-renderer.c +@@ -42,7 +42,7 @@ struct gal2d_output_state { + + int current_buffer; + pixman_region32_t buffer_damage[2]; +- EGLNativeDisplayType display; ++ NativeDisplayType display; + gcoSURF* renderSurf; + gctUINT32 nNumBuffers; + int activebuffer; +@@ -423,11 +423,9 @@ gal2dBindBuffer(struct weston_surface* es) + gcoSURF surface = gs->gco_Surface; + struct weston_buffer *buffer = gs->buffer_ref.buffer; + gcePOOL pool = gcvPOOL_DEFAULT; +- gctUINT64 node = 0; +- gctUINT bytes; +- +- gcmVERIFY_OK(gcoSURF_QueryVidMemNode(surface, &node, +- &pool, &bytes)); ++ ++ gcmVERIFY_OK(gcoSURF_QueryVidMemNode(surface, gcvNULL, ++ &pool, gcvNULL)); + + if(pool != gcvPOOL_USER) + { +@@ -801,24 +799,26 @@ draw_view(struct weston_view *ev, struct weston_output *output, + ev->surface->width, ev->surface->height); + pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque); + ++ struct gal2d_renderer *gr = get_renderer(ec); ++ + if (pixman_region32_not_empty(&ev->surface->opaque)) { + + repaint_region(ev, output, go, &repaint, &ev->surface->opaque); + } + + if (pixman_region32_not_empty(&surface_blend)) { +- struct gal2d_renderer *gr = get_renderer(ec); +- ++ + gco2D_EnableAlphaBlend(gr->gcoEngine2d, +- ev->alpha * 0xFF, ev->alpha * 0xFF, +- gcvSURF_PIXEL_ALPHA_STRAIGHT, gcvSURF_PIXEL_ALPHA_STRAIGHT, +- gcvSURF_GLOBAL_ALPHA_OFF, gcvSURF_GLOBAL_ALPHA_OFF, +- gcvSURF_BLEND_ONE, gcvSURF_BLEND_INVERSED, +- gcvSURF_COLOR_STRAIGHT, gcvSURF_COLOR_STRAIGHT); ++ ev->alpha * 0xFF, ev->alpha * 0xFF, ++ gcvSURF_PIXEL_ALPHA_STRAIGHT, gcvSURF_PIXEL_ALPHA_STRAIGHT, ++ gcvSURF_GLOBAL_ALPHA_SCALE, gcvSURF_GLOBAL_ALPHA_SCALE, ++ gcvSURF_BLEND_STRAIGHT, gcvSURF_BLEND_INVERSED, ++ gcvSURF_COLOR_STRAIGHT, gcvSURF_COLOR_STRAIGHT); + + repaint_region(ev, output, go, &repaint, &surface_blend); + } + ++ gco2D_DisableAlphaBlend(gr->gcoEngine2d); + pixman_region32_fini(&surface_blend); + + out: +@@ -866,6 +866,48 @@ gal2d_renderer_repaint_output(struct weston_output *output, + } + + static void ++gal2d_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer) ++{ ++ gcsWL_VIV_BUFFER *vivBuffer = wl_resource_get_user_data(buffer->resource); ++ gctUINT width = 0; ++ gctUINT height = 0; ++ gctINT stride = 0; ++ gceSURF_FORMAT format; ++ gcoSURF srcSurf = vivBuffer->surface; ++ gctUINT32 physical; ++ gctPOINTER va =0; ++ gceSTATUS status = gcvSTATUS_OK; ++ struct gal2d_surface_state *gs = get_surface_state(es); ++ ++ if(gs->gco_Surface == gcvNULL) ++ { ++ /** Construct a wrapper. */ ++ gcmONERROR(gcoSURF_ConstructWrapper(gcvNULL, &gs->gco_Surface)); ++ } ++ ++ gcmONERROR(gcoSURF_GetAlignedSize(srcSurf, &width, &height, &stride)); ++ gcmONERROR(gcoSURF_GetFormat(srcSurf, gcvNULL, &format)); ++ gcmONERROR(gcoSURF_Lock(srcSurf, &physical, (gctPOINTER *)&va)); ++ ++ /* Set the buffer. */ ++ gcmONERROR(gcoSURF_SetBuffer(gs->gco_Surface, ++ gcvSURF_BITMAP_NO_VIDMEM, ++ format, ++ stride, ++ (gctPOINTER) va, ++ (gctUINT32) physical)); ++ ++ /* Set the window. */ ++ gcmONERROR(gcoSURF_SetWindow(gs->gco_Surface, 0, 0, width, height)); ++ ++ buffer->width = vivBuffer->width; ++ buffer->height = vivBuffer->height; ++ ++ OnError: ++ galONERROR(status); ++} ++ ++static void + gal2d_renderer_flush_damage(struct weston_surface *surface) + { + struct gal2d_surface_state *gs = get_surface_state(surface); +@@ -900,10 +942,7 @@ gal2d_renderer_flush_damage(struct weston_surface *surface) + gal2dBindBuffer(surface); + } + else +- { +- gcsWL_VIV_BUFFER *vivBuffer = (gcsWL_VIV_BUFFER *)buffer; +- gs->gco_Surface = vivBuffer->surface; +- } ++ gal2d_renderer_attach_egl(surface, buffer); + + done: + pixman_region32_fini(&gs->texture_damage); +@@ -937,19 +976,17 @@ gal2d_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) + } + } + else +- { +- gcsWL_VIV_BUFFER *vivBuffer = wl_resource_get_user_data(buffer->resource); +- gs->gco_Surface = vivBuffer->surface; +- +- buffer->width = vivBuffer->width; +- buffer->height = vivBuffer->height; +- } ++ gal2d_renderer_attach_egl(es, buffer); + } + + static void + surface_state_destroy(struct gal2d_surface_state *gs, struct gal2d_renderer *gr) + { +- wl_list_remove(&gs->surface_destroy_listener.link); ++ if(gs->gco_Surface) ++ { ++ gcoSURF_Destroy(gs->gco_Surface); ++ } ++ wl_list_remove(&gs->surface_destroy_listener.link); + wl_list_remove(&gs->renderer_destroy_listener.link); + if(gs->surface) + gs->surface->renderer_state = NULL; +@@ -1043,8 +1080,12 @@ gal2d_renderer_output_destroy(struct weston_output *output) + { + struct gal2d_output_state *go = get_output_state(output); + gctUINT32 i; +- +- if(go->nNumBuffers <= 1 ) ++ ++ for (i = 0; i < 2; i++) ++ { ++ pixman_region32_fini(&go->buffer_damage[i]); ++ } ++ if(go->nNumBuffers <= 1 ) + { + if(go->offscreenSurface) + gcmVERIFY_OK(gcoSURF_Destroy(go->offscreenSurface)); +@@ -1107,8 +1148,8 @@ OnError: + } + + static int +-gal2d_renderer_output_create(struct weston_output *output, EGLNativeDisplayType display, +- EGLNativeWindowType window) ++gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType display, ++ NativeWindowType window) + + { + struct gal2d_renderer *gr = get_renderer(output->compositor); +@@ -1174,6 +1215,9 @@ gal2d_renderer_output_create(struct weston_output *output, EGLNativeDisplayType + gal2d_clear(output); + gal2d_flip_surface(output); + } ++ ++ for (i = 0; i < 2; i++) ++ pixman_region32_init(&go->buffer_damage[i]); + OnError: + galONERROR(status); + /* Return the status. */ +diff --git a/src/gal2d-renderer.h b/src/gal2d-renderer.h +index 3b89f73..1322a7d 100644 +--- a/src/gal2d-renderer.h ++++ b/src/gal2d-renderer.h +@@ -24,7 +24,13 @@ + #define __gal_2d_renderer_h_ + + #include "compositor.h" ++#ifdef ENABLE_EGL + #include ++#else ++#include ++typedef HALNativeDisplayType NativeDisplayType; ++typedef HALNativeWindowType NativeWindowType; ++#endif + + + struct gal2d_renderer_interface { +-- +2.1.4 + diff --git a/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch b/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch new file mode 100644 index 0000000..cb4ed6b --- /dev/null +++ b/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch @@ -0,0 +1,39 @@ +From ca9eb5bdbdfe17654466d84c8baaa1187a8796c6 Mon Sep 17 00:00:00 2001 +From: Yong Gan +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 + +Signed-off-by: Otavio Salvador +--- + Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 29834c3..e82e970 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -165,6 +165,7 @@ gl_renderer_la_SOURCES = \ + src/gl-renderer.c \ + src/vertex-clipping.c \ + src/vertex-clipping.h ++endif + + module_LTLIBRARIES += gal2d-renderer.la + gal2d_renderer_la_LDFLAGS = -module -avoid-version +@@ -178,7 +179,6 @@ gal2d_renderer_la_SOURCES = \ + src/gal2d-renderer.c \ + src/vertex-clipping.c \ + src/vertex-clipping.h +-endif + + if ENABLE_X11_COMPOSITOR + module_LTLIBRARIES += x11-backend.la +-- +2.1.4 + diff --git a/recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch b/recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch new file mode 100644 index 0000000..89d6215 --- /dev/null +++ b/recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch @@ -0,0 +1,38 @@ +From e58ecd66cea732aab8f6b5274d72868922e92c5f Mon Sep 17 00:00:00 2001 +From: Yong Gan +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 + +Signed-off-by: Otavio Salvador +--- + src/compositor-fbdev.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c +index b27d199..bdc6ec9 100644 +--- a/src/compositor-fbdev.c ++++ b/src/compositor-fbdev.c +@@ -1060,8 +1060,13 @@ backend_init(struct wl_display *display, int *argc, char *argv[], + struct fbdev_parameters param = { + .tty = 0, /* default to current tty */ + .device = "/dev/fb0", /* default frame buffer */ ++#ifdef ENABLE_EGL + .use_gl = 1, + .use_gal2d = 0, ++#else ++ .use_gl = 0, ++ .use_gal2d = 1, ++#endif + }; + + const struct weston_option fbdev_options[] = { +-- +2.1.4 + diff --git a/recipes-graphics/wayland/weston/0005-Enable-GAL2D-compositor-in-SoloLite.patch b/recipes-graphics/wayland/weston/0005-Enable-GAL2D-compositor-in-SoloLite.patch deleted file mode 100644 index cf08900..0000000 --- a/recipes-graphics/wayland/weston/0005-Enable-GAL2D-compositor-in-SoloLite.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 1eea925312fb7e1bc1cf42e001069cbac887b128 Mon Sep 17 00:00:00 2001 -From: Yong Gan -Date: Wed, 2 Jul 2014 11:27:26 +0800 -Subject: [PATCH] ENGR00320243 Enable GAL2D compositor in SoloLite - -Build gal2d-renderer.so when EGL was not enabled. - -Date: Jul 02, 2014 -Signed-off-by Yong Gan ---- - Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index 2bccfe9..42148b1 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -162,6 +162,7 @@ gl_renderer_la_SOURCES = \ - src/gl-renderer.c \ - src/vertex-clipping.c \ - src/vertex-clipping.h -+endif - - module_LTLIBRARIES += gal2d-renderer.la - gal2d_renderer_la_LDFLAGS = -module -avoid-version -@@ -175,7 +176,6 @@ gal2d_renderer_la_SOURCES = \ - src/gal2d-renderer.c \ - src/vertex-clipping.c \ - src/vertex-clipping.h --endif - - if ENABLE_X11_COMPOSITOR - module_LTLIBRARIES += x11-backend.la --- -1.7.9.5 - diff --git a/recipes-graphics/wayland/weston/0006-Change-GAL2D-compositor-to-be-default-i.patch b/recipes-graphics/wayland/weston/0006-Change-GAL2D-compositor-to-be-default-i.patch deleted file mode 100644 index e0a855f..0000000 --- a/recipes-graphics/wayland/weston/0006-Change-GAL2D-compositor-to-be-default-i.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 916e1fe5ca320f3115e904ae5543da3c5603d70e Mon Sep 17 00:00:00 2001 -From: Yong Gan -Date: Fri, 4 Jul 2014 09:57:11 +0800 -Subject: [PATCH] ENGR00321030 Change GAL2D compositor to be default in - SoloLite. - -Change GAL2D compositor to be default When EGL is not enabled. - -Date: Jul 03, 2014 -Signed-off-by Yong Gan ---- - src/compositor-fbdev.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c -index b27d199..bdc6ec9 100644 ---- a/src/compositor-fbdev.c -+++ b/src/compositor-fbdev.c -@@ -1060,8 +1060,13 @@ backend_init(struct wl_display *display, int *argc, char *argv[], - struct fbdev_parameters param = { - .tty = 0, /* default to current tty */ - .device = "/dev/fb0", /* default frame buffer */ -+#ifdef ENABLE_EGL - .use_gl = 1, - .use_gal2d = 0, -+#else -+ .use_gl = 0, -+ .use_gal2d = 1, -+#endif - }; - - const struct weston_option fbdev_options[] = { --- -1.7.9.5 - 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 +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 +--- + 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 + #include + #include ++#include ++ + #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 +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 +--- + 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" -- cgit v1.2.3-54-g00ecf