diff options
author | Lauren Post <lauren.post@freescale.com> | 2015-07-08 09:12:12 -0500 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2015-07-13 10:07:30 -0300 |
commit | bfdb045548e7bf00908440a6919d195bdae331d0 (patch) | |
tree | fae16cc9d66083c9f80fe56d10aa788e4070adce | |
parent | a66cf5ea9a7db97d6f9a02835a996db465108318 (diff) | |
download | meta-freescale-bfdb045548e7bf00908440a6919d195bdae331d0.tar.gz |
weston: Update i.MX6 Vivante GPU to support Wayland 1.8
Update the support patches for Weston 1.8.
The support patches are consolidated in a single patch.
Signed-off-by: Lauren Post <lauren.post@freescale.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
-rw-r--r-- | meta-fsl-arm/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch | 77 | ||||
-rw-r--r-- | meta-fsl-arm/recipes-graphics/wayland/weston/0001-MGS-840-Add-i.MX6-support-for-weston.patch (renamed from meta-fsl-arm/recipes-graphics/wayland/weston/0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch) | 532 | ||||
-rw-r--r-- | meta-fsl-arm/recipes-graphics/wayland/weston/0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch | 258 | ||||
-rw-r--r-- | meta-fsl-arm/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch | 39 | ||||
-rw-r--r-- | meta-fsl-arm/recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch | 38 | ||||
-rw-r--r-- | meta-fsl-arm/recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch | 247 | ||||
-rw-r--r-- | meta-fsl-arm/recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch | 183 | ||||
-rw-r--r-- | meta-fsl-arm/recipes-graphics/wayland/weston_%.bbappend | 10 |
8 files changed, 370 insertions, 1014 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 deleted file mode 100644 index a0fcdefc..00000000 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0001-ENGR00314805-1-Add-Vivante-EGL-support.patch +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | From eb738e87f131f60c89e641e619dc8b1ccc88a30b Mon Sep 17 00:00:00 2001 | ||
2 | From: Yong Gan <b45748@freescale.com> | ||
3 | Date: Thu, 22 May 2014 15:25:42 +0800 | ||
4 | Subject: [PATCH] ENGR00314805-1 Add Vivante EGL support | ||
5 | Organization: O.S. Systems Software LTDA. | ||
6 | |||
7 | Add Vivante EGL compositor support. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | [DATE]05-22-2014 | ||
12 | Signed-off-by Yong Gan <B45748@freescale.com> | ||
13 | |||
14 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
15 | --- | ||
16 | src/compositor-fbdev.c | 23 +++++++++++++++++++---- | ||
17 | 1 file changed, 19 insertions(+), 4 deletions(-) | ||
18 | |||
19 | diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c | ||
20 | index e703e0e..3db1d17 100644 | ||
21 | --- a/src/compositor-fbdev.c | ||
22 | +++ b/src/compositor-fbdev.c | ||
23 | @@ -53,6 +53,7 @@ struct fbdev_compositor { | ||
24 | struct udev_input input; | ||
25 | int use_pixman; | ||
26 | struct wl_listener session_listener; | ||
27 | + EGLNativeDisplayType display; | ||
28 | }; | ||
29 | |||
30 | struct fbdev_screeninfo { | ||
31 | @@ -87,6 +88,9 @@ struct fbdev_output { | ||
32 | pixman_image_t *shadow_surface; | ||
33 | void *shadow_buf; | ||
34 | uint8_t depth; | ||
35 | + | ||
36 | + EGLNativeDisplayType display; | ||
37 | + EGLNativeWindowType window; | ||
38 | }; | ||
39 | |||
40 | struct fbdev_parameters { | ||
41 | @@ -627,10 +631,15 @@ fbdev_output_create(struct fbdev_compositor *compositor, | ||
42 | goto out_shadow_surface; | ||
43 | } else { | ||
44 | setenv("HYBRIS_EGLPLATFORM", "wayland", 1); | ||
45 | + output->window = fbCreateWindow(compositor->display, -1, -1, 0, 0); | ||
46 | + if (output->window == NULL) { | ||
47 | + fprintf(stderr, "failed to create window\n"); | ||
48 | + return 0; | ||
49 | + } | ||
50 | if (gl_renderer->output_create(&output->base, | ||
51 | - (EGLNativeWindowType)NULL, | ||
52 | - gl_renderer->opaque_attribs, | ||
53 | - NULL) < 0) { | ||
54 | + (EGLNativeWindowType)output->window, | ||
55 | + gl_renderer->opaque_attribs, | ||
56 | + NULL) < 0) { | ||
57 | weston_log("gl_renderer_output_create failed.\n"); | ||
58 | goto out_shadow_surface; | ||
59 | } | ||
60 | @@ -923,7 +932,13 @@ fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[], | ||
61 | goto out_launcher; | ||
62 | } | ||
63 | |||
64 | - if (gl_renderer->create(&compositor->base, EGL_DEFAULT_DISPLAY, | ||
65 | + compositor->display = fbGetDisplay(compositor->base.wl_display); | ||
66 | + if (compositor->display == NULL) { | ||
67 | + weston_log("fbGetDisplay failed.\n"); | ||
68 | + goto out_launcher; | ||
69 | + } | ||
70 | + | ||
71 | + if (gl_renderer->create(&compositor->base, compositor->display, | ||
72 | gl_renderer->opaque_attribs, | ||
73 | NULL) < 0) { | ||
74 | weston_log("gl_renderer_create failed.\n"); | ||
75 | -- | ||
76 | 2.1.4 | ||
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/0001-MGS-840-Add-i.MX6-support-for-weston.patch index 1cfca7b1..80505bdc 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/0001-MGS-840-Add-i.MX6-support-for-weston.patch | |||
@@ -1,35 +1,32 @@ | |||
1 | From 8a887ec821a53f18a7530b77f08ec823ce757937 Mon Sep 17 00:00:00 2001 | 1 | From 0da66b0b96a7059392f0b62d3a13fcedf1023ba8 Mon Sep 17 00:00:00 2001 |
2 | From: Yong Gan <b45748@freescale.com> | 2 | From: Prabhu <prabhu.sundararaj@freescale.com> |
3 | Date: Thu, 22 May 2014 15:26:31 +0800 | 3 | Date: Wed, 24 Jun 2015 17:29:03 -0500 |
4 | Subject: [PATCH] ENGR00314805-2 Add Vivante GAL2D support | 4 | Subject: [PATCH] MGS-840 Add i.MX6 support for weston |
5 | Organization: O.S. Systems Software LTDA. | ||
6 | 5 | ||
7 | Add Vivante GAL2D compositor support. | 6 | Add fbdev backend support for Vivante FBdev EGL |
8 | 7 | ||
9 | Upstream-Status: Pending | 8 | Date: June 24, 2015 |
10 | 9 | Signed-off-by: Prabhu <prabhu.sundararaj@freescale.com> | |
11 | [DATE]05-22-2014 | ||
12 | Signed-off-by Yong Gan <B45748@freescale.com> | ||
13 | |||
14 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
15 | --- | 10 | --- |
16 | Makefile.am | 13 + | 11 | Makefile.am | 13 + |
17 | src/compositor-fbdev.c | 110 ++++- | 12 | src/compositor-fbdev.c | 139 ++++- |
18 | src/gal2d-renderer.c | 1187 ++++++++++++++++++++++++++++++++++++++++++++++++ | 13 | src/gal2d-renderer.c | 1337 ++++++++++++++++++++++++++++++++++++++++++++++++ |
19 | src/gal2d-renderer.h | 41 ++ | 14 | src/gal2d-renderer.h | 47 ++ |
20 | 4 files changed, 1337 insertions(+), 14 deletions(-) | 15 | 4 files changed, 1519 insertions(+), 17 deletions(-) |
16 | mode change 100644 => 100755 Makefile.am | ||
21 | create mode 100644 src/gal2d-renderer.c | 17 | create mode 100644 src/gal2d-renderer.c |
22 | create mode 100644 src/gal2d-renderer.h | 18 | create mode 100644 src/gal2d-renderer.h |
23 | 19 | ||
24 | diff --git a/Makefile.am b/Makefile.am | 20 | diff --git a/Makefile.am b/Makefile.am |
25 | index 0c08acb..29834c3 100644 | 21 | old mode 100644 |
22 | new mode 100755 | ||
23 | index 5819b19..e7e2d49 | ||
26 | --- a/Makefile.am | 24 | --- a/Makefile.am |
27 | +++ b/Makefile.am | 25 | +++ b/Makefile.am |
28 | @@ -165,6 +165,19 @@ gl_renderer_la_SOURCES = \ | 26 | @@ -207,6 +207,19 @@ gl_renderer_la_SOURCES = \ |
29 | src/gl-renderer.c \ | ||
30 | src/vertex-clipping.c \ | ||
31 | src/vertex-clipping.h | 27 | src/vertex-clipping.h |
32 | + | 28 | endif |
29 | |||
33 | +module_LTLIBRARIES += gal2d-renderer.la | 30 | +module_LTLIBRARIES += gal2d-renderer.la |
34 | +gal2d_renderer_la_LDFLAGS = -module -avoid-version | 31 | +gal2d_renderer_la_LDFLAGS = -module -avoid-version |
35 | +gal2d_renderer_la_LIBADD = $(COMPOSITOR_LIBS) $(EGL_LIBS) | 32 | +gal2d_renderer_la_LIBADD = $(COMPOSITOR_LIBS) $(EGL_LIBS) |
@@ -42,30 +39,42 @@ index 0c08acb..29834c3 100644 | |||
42 | + src/gal2d-renderer.c \ | 39 | + src/gal2d-renderer.c \ |
43 | + src/vertex-clipping.c \ | 40 | + src/vertex-clipping.c \ |
44 | + src/vertex-clipping.h | 41 | + src/vertex-clipping.h |
45 | endif | 42 | + |
46 | |||
47 | if ENABLE_X11_COMPOSITOR | 43 | if ENABLE_X11_COMPOSITOR |
44 | module_LTLIBRARIES += x11-backend.la | ||
45 | x11_backend_la_LDFLAGS = -module -avoid-version | ||
48 | diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c | 46 | diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c |
49 | index 3db1d17..a3d32e5 100644 | 47 | index 3f3394f..9d18c45 100644 |
50 | --- a/src/compositor-fbdev.c | 48 | --- a/src/compositor-fbdev.c |
51 | +++ b/src/compositor-fbdev.c | 49 | +++ b/src/compositor-fbdev.c |
52 | @@ -44,6 +44,7 @@ | 50 | @@ -45,6 +45,7 @@ |
53 | #include "pixman-renderer.h" | 51 | #include "libinput-seat.h" |
54 | #include "udev-input.h" | ||
55 | #include "gl-renderer.h" | 52 | #include "gl-renderer.h" |
53 | #include "presentation_timing-server-protocol.h" | ||
56 | +#include "gal2d-renderer.h" | 54 | +#include "gal2d-renderer.h" |
57 | 55 | ||
58 | struct fbdev_compositor { | 56 | struct fbdev_compositor { |
59 | struct weston_compositor base; | 57 | struct weston_compositor base; |
60 | @@ -52,6 +53,7 @@ struct fbdev_compositor { | 58 | @@ -53,7 +54,9 @@ struct fbdev_compositor { |
61 | struct udev *udev; | 59 | struct udev *udev; |
62 | struct udev_input input; | 60 | struct udev_input input; |
63 | int use_pixman; | 61 | int use_pixman; |
64 | + int use_gal2d; | 62 | + int use_gal2d; |
65 | struct wl_listener session_listener; | 63 | struct wl_listener session_listener; |
66 | EGLNativeDisplayType display; | 64 | + NativeDisplayType display; |
67 | }; | 65 | }; |
68 | @@ -97,9 +99,11 @@ struct fbdev_parameters { | 66 | |
67 | struct fbdev_screeninfo { | ||
68 | @@ -88,15 +91,20 @@ struct fbdev_output { | ||
69 | pixman_image_t *shadow_surface; | ||
70 | void *shadow_buf; | ||
71 | uint8_t depth; | ||
72 | + | ||
73 | + NativeDisplayType display; | ||
74 | + NativeWindowType window; | ||
75 | }; | ||
76 | |||
77 | struct fbdev_parameters { | ||
69 | int tty; | 78 | int tty; |
70 | char *device; | 79 | char *device; |
71 | int use_gl; | 80 | int use_gl; |
@@ -77,7 +86,18 @@ index 3db1d17..a3d32e5 100644 | |||
77 | 86 | ||
78 | static const char default_seat[] = "seat0"; | 87 | static const char default_seat[] = "seat0"; |
79 | 88 | ||
80 | @@ -502,7 +506,7 @@ static void fbdev_output_disable(struct weston_output *base); | 89 | @@ -471,6 +479,10 @@ fbdev_frame_buffer_destroy(struct fbdev_output *output) |
90 | strerror(errno)); | ||
91 | |||
92 | output->fb = NULL; | ||
93 | + if(output->window) | ||
94 | + fbDestroyWindow(output->window); | ||
95 | + if(output->display) | ||
96 | + fbDestroyDisplay(output->display); | ||
97 | } | ||
98 | |||
99 | static void fbdev_output_destroy(struct weston_output *base); | ||
100 | @@ -478,7 +490,7 @@ static void fbdev_output_disable(struct weston_output *base); | ||
81 | 101 | ||
82 | static int | 102 | static int |
83 | fbdev_output_create(struct fbdev_compositor *compositor, | 103 | fbdev_output_create(struct fbdev_compositor *compositor, |
@@ -85,33 +105,31 @@ index 3db1d17..a3d32e5 100644 | |||
85 | + int x, int y, const char *device) | 105 | + int x, int y, const char *device) |
86 | { | 106 | { |
87 | struct fbdev_output *output; | 107 | struct fbdev_output *output; |
88 | pixman_transform_t transform; | 108 | struct weston_config_section *section; |
89 | @@ -512,7 +516,8 @@ fbdev_output_create(struct fbdev_compositor *compositor, | 109 | @@ -489,7 +501,7 @@ fbdev_output_create(struct fbdev_compositor *compositor, |
90 | unsigned int bytes_per_pixel; | 110 | uint32_t config_transform; |
91 | struct wl_event_loop *loop; | 111 | char *s; |
92 | 112 | ||
93 | - weston_log("Creating fbdev output.\n"); | 113 | - weston_log("Creating fbdev output.\n"); |
94 | + | ||
95 | + weston_log("Creating fbdev output. %s x=%d y=%d\n", device, x, y); | 114 | + weston_log("Creating fbdev output. %s x=%d y=%d\n", device, x, y); |
96 | 115 | ||
97 | output = calloc(1, sizeof *output); | 116 | output = zalloc(sizeof *output); |
98 | if (!output) | 117 | if (output == NULL) |
99 | @@ -559,7 +564,7 @@ fbdev_output_create(struct fbdev_compositor *compositor, | 118 | @@ -542,7 +554,7 @@ fbdev_output_create(struct fbdev_compositor *compositor, |
100 | output->base.model = output->fb_info.id; | 119 | free(s); |
101 | 120 | ||
102 | weston_output_init(&output->base, &compositor->base, | 121 | weston_output_init(&output->base, &compositor->base, |
103 | - 0, 0, output->fb_info.width_mm, | 122 | - 0, 0, output->fb_info.width_mm, |
104 | + x, y, output->fb_info.width_mm, | 123 | + x, y, output->fb_info.width_mm, |
105 | output->fb_info.height_mm, | 124 | output->fb_info.height_mm, |
106 | WL_OUTPUT_TRANSFORM_NORMAL, | 125 | config_transform, |
107 | 1); | 126 | 1); |
108 | @@ -629,8 +634,33 @@ fbdev_output_create(struct fbdev_compositor *compositor, | 127 | @@ -565,12 +577,43 @@ fbdev_output_create(struct fbdev_compositor *compositor, |
109 | if (compositor->use_pixman) { | 128 | if (compositor->use_pixman) { |
110 | if (pixman_renderer_output_create(&output->base) < 0) | 129 | if (pixman_renderer_output_create(&output->base) < 0) |
111 | goto out_shadow_surface; | 130 | goto out_shadow_surface; |
112 | - } else { | 131 | - } else { |
113 | - setenv("HYBRIS_EGLPLATFORM", "wayland", 1); | 132 | + } |
114 | + } | ||
115 | + else if(compositor->use_gal2d) { | 133 | + else if(compositor->use_gal2d) { |
116 | + | 134 | + |
117 | + char* fbenv = getenv("FB_FRAMEBUFFER_0"); | 135 | + char* fbenv = getenv("FB_FRAMEBUFFER_0"); |
@@ -138,10 +156,23 @@ index 3db1d17..a3d32e5 100644 | |||
138 | + | 156 | + |
139 | + } | 157 | + } |
140 | + else { | 158 | + else { |
141 | output->window = fbCreateWindow(compositor->display, -1, -1, 0, 0); | 159 | setenv("HYBRIS_EGLPLATFORM", "wayland", 1); |
142 | if (output->window == NULL) { | 160 | + output->window = fbCreateWindow(compositor->display, -1, -1, 0, 0); |
143 | fprintf(stderr, "failed to create window\n"); | 161 | + if (output->window == NULL) { |
144 | @@ -698,7 +728,11 @@ fbdev_output_destroy(struct weston_output *base) | 162 | + fprintf(stderr, "failed to create window\n"); |
163 | + return 0; | ||
164 | + } | ||
165 | if (gl_renderer->output_create(&output->base, | ||
166 | - (EGLNativeWindowType)NULL, NULL, | ||
167 | - gl_renderer->opaque_attribs, | ||
168 | - NULL, 0) < 0) { | ||
169 | + (NativeWindowType)output->window, NULL, | ||
170 | + gl_renderer->opaque_attribs, | ||
171 | + NULL, 0) < 0) { | ||
172 | weston_log("gl_renderer_output_create failed.\n"); | ||
173 | goto out_shadow_surface; | ||
174 | } | ||
175 | @@ -629,7 +672,11 @@ fbdev_output_destroy(struct weston_output *base) | ||
145 | free(output->shadow_buf); | 176 | free(output->shadow_buf); |
146 | output->shadow_buf = NULL; | 177 | output->shadow_buf = NULL; |
147 | } | 178 | } |
@@ -154,7 +185,7 @@ index 3db1d17..a3d32e5 100644 | |||
154 | gl_renderer->output_destroy(base); | 185 | gl_renderer->output_destroy(base); |
155 | } | 186 | } |
156 | 187 | ||
157 | @@ -761,7 +795,7 @@ fbdev_output_reenable(struct fbdev_compositor *compositor, | 188 | @@ -692,7 +739,7 @@ fbdev_output_reenable(struct fbdev_compositor *compositor, |
158 | * are re-initialised. */ | 189 | * are re-initialised. */ |
159 | device = output->device; | 190 | device = output->device; |
160 | fbdev_output_destroy(base); | 191 | fbdev_output_destroy(base); |
@@ -163,7 +194,7 @@ index 3db1d17..a3d32e5 100644 | |||
163 | 194 | ||
164 | return 0; | 195 | return 0; |
165 | } | 196 | } |
166 | @@ -914,7 +948,10 @@ fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[], | 197 | @@ -850,7 +897,10 @@ fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[], |
167 | compositor->base.restore = fbdev_restore; | 198 | compositor->base.restore = fbdev_restore; |
168 | 199 | ||
169 | compositor->prev_state = WESTON_COMPOSITOR_ACTIVE; | 200 | compositor->prev_state = WESTON_COMPOSITOR_ACTIVE; |
@@ -175,7 +206,7 @@ index 3db1d17..a3d32e5 100644 | |||
175 | 206 | ||
176 | for (key = KEY_F1; key < KEY_F9; key++) | 207 | for (key = KEY_F1; key < KEY_F9; key++) |
177 | weston_compositor_add_key_binding(&compositor->base, key, | 208 | weston_compositor_add_key_binding(&compositor->base, key, |
178 | @@ -924,7 +961,50 @@ fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[], | 209 | @@ -860,7 +910,50 @@ fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[], |
179 | if (compositor->use_pixman) { | 210 | if (compositor->use_pixman) { |
180 | if (pixman_renderer_init(&compositor->base) < 0) | 211 | if (pixman_renderer_init(&compositor->base) < 0) |
181 | goto out_launcher; | 212 | goto out_launcher; |
@@ -227,7 +258,22 @@ index 3db1d17..a3d32e5 100644 | |||
227 | gl_renderer = weston_load_module("gl-renderer.so", | 258 | gl_renderer = weston_load_module("gl-renderer.so", |
228 | "gl_renderer_interface"); | 259 | "gl_renderer_interface"); |
229 | if (!gl_renderer) { | 260 | if (!gl_renderer) { |
230 | @@ -945,9 +1025,9 @@ fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[], | 261 | @@ -868,17 +961,22 @@ fbdev_compositor_create(struct wl_display *display, int *argc, char *argv[], |
262 | goto out_launcher; | ||
263 | } | ||
264 | |||
265 | - if (gl_renderer->create(&compositor->base, NO_EGL_PLATFORM, | ||
266 | - EGL_DEFAULT_DISPLAY, | ||
267 | + compositor->display = fbGetDisplay(compositor->base.wl_display); | ||
268 | + if (compositor->display == NULL) { | ||
269 | + weston_log("fbGetDisplay failed.\n"); | ||
270 | + goto out_launcher; | ||
271 | + } | ||
272 | + | ||
273 | + if (gl_renderer->create(&compositor->base, NO_EGL_PLATFORM, compositor->display, | ||
274 | gl_renderer->opaque_attribs, | ||
275 | NULL, 0) < 0) { | ||
276 | weston_log("gl_renderer_create failed.\n"); | ||
231 | goto out_launcher; | 277 | goto out_launcher; |
232 | } | 278 | } |
233 | } | 279 | } |
@@ -240,13 +286,17 @@ index 3db1d17..a3d32e5 100644 | |||
240 | 286 | ||
241 | udev_input_init(&compositor->input, &compositor->base, compositor->udev, seat_id); | 287 | udev_input_init(&compositor->input, &compositor->base, compositor->udev, seat_id); |
242 | 288 | ||
243 | @@ -980,13 +1060,15 @@ backend_init(struct wl_display *display, int *argc, char *argv[], | 289 | @@ -911,13 +1009,20 @@ backend_init(struct wl_display *display, int *argc, char *argv[], |
244 | struct fbdev_parameters param = { | 290 | struct fbdev_parameters param = { |
245 | .tty = 0, /* default to current tty */ | 291 | .tty = 0, /* default to current tty */ |
246 | .device = "/dev/fb0", /* default frame buffer */ | 292 | .device = "/dev/fb0", /* default frame buffer */ |
247 | - .use_gl = 0, | 293 | +#ifdef ENABLE_EGL |
248 | + .use_gl = 1, | 294 | + .use_gl = 1, |
249 | + .use_gal2d = 0, | 295 | + .use_gal2d = 0, |
296 | +#else | ||
297 | .use_gl = 0, | ||
298 | + .use_gal2d = 1, | ||
299 | +#endif | ||
250 | }; | 300 | }; |
251 | 301 | ||
252 | const struct weston_option fbdev_options[] = { | 302 | const struct weston_option fbdev_options[] = { |
@@ -260,12 +310,12 @@ index 3db1d17..a3d32e5 100644 | |||
260 | parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv); | 310 | parse_options(fbdev_options, ARRAY_LENGTH(fbdev_options), argc, argv); |
261 | diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c | 311 | diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c |
262 | new file mode 100644 | 312 | new file mode 100644 |
263 | index 0000000..c651573 | 313 | index 0000000..7ebbf98 |
264 | --- /dev/null | 314 | --- /dev/null |
265 | +++ b/src/gal2d-renderer.c | 315 | +++ b/src/gal2d-renderer.c |
266 | @@ -0,0 +1,1187 @@ | 316 | @@ -0,0 +1,1337 @@ |
267 | +/* | 317 | +/* |
268 | + * Copyright (c) 2014 Freescale Semiconductor, Inc. | 318 | + * Copyright (c) 2015 Freescale Semiconductor, Inc. |
269 | + * Copyright © 2012 Intel Corporation | 319 | + * Copyright © 2012 Intel Corporation |
270 | + * | 320 | + * |
271 | + * Permission to use, copy, modify, distribute, and sell this software and | 321 | + * Permission to use, copy, modify, distribute, and sell this software and |
@@ -294,6 +344,8 @@ index 0000000..c651573 | |||
294 | +#include <ctype.h> | 344 | +#include <ctype.h> |
295 | +#include <float.h> | 345 | +#include <float.h> |
296 | +#include <assert.h> | 346 | +#include <assert.h> |
347 | +#include <pthread.h> | ||
348 | + | ||
297 | +#include "compositor.h" | 349 | +#include "compositor.h" |
298 | +#include "gal2d-renderer.h" | 350 | +#include "gal2d-renderer.h" |
299 | +#include "vertex-clipping.h" | 351 | +#include "vertex-clipping.h" |
@@ -303,18 +355,25 @@ index 0000000..c651573 | |||
303 | + | 355 | + |
304 | +#define galONERROR(x) if(status < 0) printf("Error in function %s\n", __func__); | 356 | +#define galONERROR(x) if(status < 0) printf("Error in function %s\n", __func__); |
305 | + | 357 | + |
306 | + | ||
307 | +struct gal2d_output_state { | 358 | +struct gal2d_output_state { |
308 | + | 359 | + |
309 | + int current_buffer; | 360 | + int current_buffer; |
310 | + pixman_region32_t buffer_damage[2]; | 361 | + pixman_region32_t buffer_damage[2]; |
311 | + EGLNativeDisplayType display; | 362 | + NativeDisplayType display; |
312 | + gcoSURF* renderSurf; | 363 | + gcoSURF* renderSurf; |
313 | + gctUINT32 nNumBuffers; | 364 | + gctUINT32 nNumBuffers; |
314 | + int activebuffer; | 365 | + int activebuffer; |
315 | + gcoSURF offscreenSurface; | 366 | + gcoSURF offscreenSurface; |
316 | + gceSURF_FORMAT format; | 367 | + gceSURF_FORMAT format; |
317 | + gcoSURF tempSurf; | 368 | + pthread_mutex_t workerMutex; |
369 | + pthread_t workerId; | ||
370 | + gctUINT32 exitWorker; | ||
371 | + gctSIGNAL signal; | ||
372 | + gctSIGNAL busySignal; | ||
373 | + gcsHAL_INTERFACE iface; | ||
374 | + int directBlit; | ||
375 | + gctINT width; | ||
376 | + gctINT height; | ||
318 | +}; | 377 | +}; |
319 | + | 378 | + |
320 | +struct gal2d_surface_state { | 379 | +struct gal2d_surface_state { |
@@ -601,22 +660,24 @@ index 0000000..c651573 | |||
601 | + gctUINT width = 0; | 660 | + gctUINT width = 0; |
602 | + gctUINT height = 0; | 661 | + gctUINT height = 0; |
603 | + gctINT stride = 0; | 662 | + gctINT stride = 0; |
604 | + gctUINT32 physical; | 663 | + gctUINT32 physical[3]; |
605 | + gctPOINTER va =0; | 664 | + gctPOINTER va =0; |
665 | + gceSURF_FORMAT format; | ||
606 | + | 666 | + |
607 | + if(!surface) | 667 | + if(!surface) |
608 | + goto OnError; | 668 | + goto OnError; |
609 | + | 669 | + |
610 | + | 670 | + |
611 | + gcmONERROR(gcoSURF_GetAlignedSize(surface, &width, &height, &stride)); | 671 | + gcmONERROR(gcoSURF_GetAlignedSize(surface, &width, &height, &stride)); |
612 | + | 672 | + gcmONERROR(gcoSURF_GetFormat(surface, gcvNULL, &format)); |
613 | + gcmONERROR(gcoSURF_Lock(surface, &physical, (gctPOINTER *)&va)); | 673 | + gcmONERROR(gcoSURF_Lock(surface, &physical[0], (gctPOINTER *)&va)); |
614 | + | 674 | + gco2D_SetGenericTarget(gr->gcoEngine2d, |
615 | + gcmONERROR(gco2D_SetTargetEx(gr->gcoEngine2d, physical, stride, | 675 | + &physical[0], 1, |
616 | + gcvSURF_0_DEGREE, width, height)); | 676 | + &stride, 1, |
617 | + | 677 | + gcvLINEAR, format, |
678 | + gcvSURF_0_DEGREE, width, height); | ||
679 | + | ||
618 | + gcmONERROR(gcoSURF_Unlock(surface, (gctPOINTER *)&va)); | 680 | + gcmONERROR(gcoSURF_Unlock(surface, (gctPOINTER *)&va)); |
619 | + | ||
620 | +OnError: | 681 | +OnError: |
621 | + galONERROR(status); | 682 | + galONERROR(status); |
622 | + return status; | 683 | + return status; |
@@ -639,8 +700,7 @@ index 0000000..c651573 | |||
639 | + gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect)); | 700 | + gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect)); |
640 | + gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect)); | 701 | + gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect)); |
641 | + gcmONERROR(gco2D_Clear(gr->gcoEngine2d, 1, &dstRect, 0xff0000ff, 0xCC, 0xCC, go->format)); | 702 | + gcmONERROR(gco2D_Clear(gr->gcoEngine2d, 1, &dstRect, 0xff0000ff, 0xCC, 0xCC, go->format)); |
642 | + | 703 | + gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvTRUE)); |
643 | + gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
644 | + | 704 | + |
645 | +OnError: | 705 | +OnError: |
646 | + galONERROR(status); | 706 | + galONERROR(status); |
@@ -689,11 +749,9 @@ index 0000000..c651573 | |||
689 | + gcoSURF surface = gs->gco_Surface; | 749 | + gcoSURF surface = gs->gco_Surface; |
690 | + struct weston_buffer *buffer = gs->buffer_ref.buffer; | 750 | + struct weston_buffer *buffer = gs->buffer_ref.buffer; |
691 | + gcePOOL pool = gcvPOOL_DEFAULT; | 751 | + gcePOOL pool = gcvPOOL_DEFAULT; |
692 | + gctUINT64 node = 0; | 752 | + |
693 | + gctUINT bytes; | 753 | + gcmVERIFY_OK(gcoSURF_QueryVidMemNode(surface, gcvNULL, |
694 | + | 754 | + &pool, gcvNULL)); |
695 | + gcmVERIFY_OK(gcoSURF_QueryVidMemNode(surface, &node, | ||
696 | + &pool, &bytes)); | ||
697 | + | 755 | + |
698 | + if(pool != gcvPOOL_USER) | 756 | + if(pool != gcvPOOL_USER) |
699 | + { | 757 | + { |
@@ -733,7 +791,6 @@ index 0000000..c651573 | |||
733 | +static void | 791 | +static void |
734 | +gal2d_flip_surface(struct weston_output *output) | 792 | +gal2d_flip_surface(struct weston_output *output) |
735 | +{ | 793 | +{ |
736 | + struct gal2d_renderer *gr = get_renderer(output->compositor); | ||
737 | + struct gal2d_output_state *go = get_output_state(output); | 794 | + struct gal2d_output_state *go = get_output_state(output); |
738 | + | 795 | + |
739 | + if(go->nNumBuffers > 1) | 796 | + if(go->nNumBuffers > 1) |
@@ -741,75 +798,149 @@ index 0000000..c651573 | |||
741 | + gctUINT Offset; | 798 | + gctUINT Offset; |
742 | + gctINT X; | 799 | + gctINT X; |
743 | + gctINT Y; | 800 | + gctINT Y; |
744 | + gcmVERIFY_OK(gcoHAL_Commit(gr->gcoHal, gcvTRUE)); | ||
745 | + | 801 | + |
746 | + gcmVERIFY_OK(gcoOS_GetDisplayBackbuffer(go->display, gcvNULL, | 802 | + gcmVERIFY_OK(gcoOS_GetDisplayBackbuffer(go->display, gcvNULL, |
747 | + gcvNULL, gcvNULL, &Offset, &X, &Y)); | 803 | + gcvNULL, gcvNULL, &Offset, &X, &Y)); |
748 | + | 804 | + |
749 | + gcmVERIFY_OK(gcoOS_SetDisplayVirtual(go->display, gcvNULL, | 805 | + gcmVERIFY_OK(gcoOS_SetDisplayVirtual(go->display, gcvNULL, |
750 | + Offset, X, Y)); | 806 | + Offset, X, Y)); |
751 | + | ||
752 | + go->activebuffer = (go->activebuffer+1) % go->nNumBuffers; | ||
753 | + } | 807 | + } |
754 | +} | 808 | +} |
755 | + | 809 | + |
810 | +static void *gal2d_output_worker(void *arg) | ||
811 | +{ | ||
812 | + struct weston_output *output = (struct weston_output *)arg; | ||
813 | + struct gal2d_output_state *go = get_output_state(output); | ||
814 | + | ||
815 | + while(1) | ||
816 | + { | ||
817 | + if(gcoOS_WaitSignal(gcvNULL, go->signal, gcvINFINITE) == gcvSTATUS_OK ) | ||
818 | + { | ||
819 | + gal2d_flip_surface(output); | ||
820 | + gcoOS_Signal(gcvNULL,go->busySignal, gcvTRUE); | ||
821 | + } | ||
822 | + pthread_mutex_lock(&go->workerMutex); | ||
823 | + if(go->exitWorker == 1) | ||
824 | + { | ||
825 | + pthread_mutex_unlock(&go->workerMutex); | ||
826 | + break; | ||
827 | + } | ||
828 | + pthread_mutex_unlock(&go->workerMutex); | ||
829 | + } | ||
830 | + return 0; | ||
831 | +} | ||
832 | + | ||
756 | +static int | 833 | +static int |
757 | +update_surface(struct weston_output *output) | 834 | +update_surface(struct weston_output *output) |
758 | +{ | 835 | +{ |
759 | + struct gal2d_renderer *gr = get_renderer(output->compositor); | 836 | + struct gal2d_renderer *gr = get_renderer(output->compositor); |
760 | + struct gal2d_output_state *go = get_output_state(output); | 837 | + struct gal2d_output_state *go = get_output_state(output); |
761 | + gceSTATUS status = gcvSTATUS_OK; | 838 | + gceSTATUS status = gcvSTATUS_OK; |
762 | + | 839 | + |
763 | + if(go->offscreenSurface && go->nNumBuffers == 1) | 840 | + if(go->nNumBuffers == 1) |
764 | + { | 841 | + { |
765 | + make_current(gr, go->renderSurf[go->activebuffer]); | 842 | + if(!go->directBlit && go->offscreenSurface) |
766 | + | 843 | + { |
767 | + gctUINT srcWidth = 0; | 844 | + make_current(gr, go->renderSurf[go->activebuffer]); |
768 | + gctUINT srcHeight = 0; | 845 | + |
769 | + gctINT srcStride = 0; | 846 | + gctUINT srcWidth = 0; |
770 | + gceSURF_FORMAT srcFormat;; | 847 | + gctUINT srcHeight = 0; |
771 | + gcsRECT dstRect = {0}; | 848 | + gceSURF_FORMAT srcFormat;; |
772 | + gcoSURF srcSurface = go->offscreenSurface; | 849 | + gcsRECT dstRect = {0}; |
773 | + gctUINT32 physical; | 850 | + gcoSURF srcSurface = go->offscreenSurface; |
774 | + gctPOINTER va =0; | 851 | + gctUINT32 srcPhyAddr[3]; |
775 | + | 852 | + gctUINT32 srcStride[3]; |
776 | + gcmONERROR(gcoSURF_GetAlignedSize(srcSurface, &srcWidth, &srcHeight, &srcStride)); | 853 | + |
777 | + gcmONERROR(gcoSURF_GetFormat(srcSurface, gcvNULL, &srcFormat)); | 854 | + gctPOINTER va =0; |
778 | + gcmONERROR(gcoSURF_Lock(srcSurface, &physical, (gctPOINTER *)&va)); | 855 | + |
779 | + gcmONERROR(gco2D_SetColorSource(gr->gcoEngine2d, physical, srcStride, srcFormat, | 856 | + gcmONERROR(gcoSURF_GetAlignedSize(srcSurface, &srcWidth, &srcHeight, (gctINT *)&srcStride[0])); |
780 | + gcvFALSE, srcWidth, gcvFALSE, gcvSURF_OPAQUE, 0)); | 857 | + gcmONERROR(gcoSURF_GetFormat(srcSurface, gcvNULL, &srcFormat)); |
781 | + | 858 | + |
782 | + dstRect.left = 0; | 859 | + gcmONERROR(gcoSURF_Lock(srcSurface, srcPhyAddr, (gctPOINTER *)&va)); |
783 | + dstRect.top = 0; | 860 | + gcmONERROR(gco2D_SetCurrentSourceIndex(gr->gcoEngine2d, 0U)); |
784 | + dstRect.right = srcWidth; | 861 | + |
785 | + dstRect.bottom = srcHeight; | 862 | + gco2D_SetGenericSource(gr->gcoEngine2d, srcPhyAddr, 1, |
786 | + | 863 | + srcStride, 1, |
787 | + gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect)); | 864 | + gcvLINEAR, srcFormat, gcvSURF_0_DEGREE, |
788 | + gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect)); | 865 | + srcWidth, srcHeight); |
789 | + gcmONERROR(gco2D_Blit(gr->gcoEngine2d, 1, &dstRect, 0xCC, 0xCC, go->format)); | 866 | + |
790 | + gcmONERROR(gcoSURF_Unlock(srcSurface, (gctPOINTER *)&va)); | 867 | + dstRect.left = 0; |
868 | + dstRect.top = 0; | ||
869 | + dstRect.right = srcWidth; | ||
870 | + dstRect.bottom = srcHeight; | ||
871 | + | ||
872 | + gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect)); | ||
873 | + gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect)); | ||
874 | + gcmONERROR(gco2D_Blit(gr->gcoEngine2d, 1, &dstRect, 0xCC, 0xCC, go->format)); | ||
875 | + gcmONERROR(gcoSURF_Unlock(srcSurface, (gctPOINTER *)&va)); | ||
876 | + } | ||
791 | + gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | 877 | + gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); |
792 | + } | 878 | + } |
793 | + | 879 | + else if(go->nNumBuffers > 1) |
794 | + gal2d_flip_surface(output); | 880 | + { |
795 | + | 881 | + gcoHAL_ScheduleEvent(gr->gcoHal, &go->iface); |
882 | + gcmVERIFY_OK(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
883 | + } | ||
796 | +OnError: | 884 | +OnError: |
797 | + galONERROR(status); | 885 | + galONERROR(status); |
798 | + return status; | 886 | + return status; |
799 | + } | 887 | + } |
888 | + | ||
889 | +static int | ||
890 | +is_view_visible(struct weston_view *view) | ||
891 | +{ | ||
892 | + /* Return false, if surface is guaranteed to be totally obscured. */ | ||
893 | + int ret; | ||
894 | + pixman_region32_t unocc; | ||
895 | + | ||
896 | + pixman_region32_init(&unocc); | ||
897 | + pixman_region32_subtract(&unocc, &view->transform.boundingbox, | ||
898 | + &view->clip); | ||
899 | + ret = pixman_region32_not_empty(&unocc); | ||
900 | + pixman_region32_fini(&unocc); | ||
901 | + | ||
902 | + return ret; | ||
903 | +} | ||
800 | + | 904 | + |
801 | +static int | 905 | +static int |
802 | +use_output(struct weston_output *output) | 906 | +use_output(struct weston_output *output) |
803 | +{ | 907 | +{ |
908 | + struct weston_compositor *compositor = output->compositor; | ||
909 | + struct weston_view *view; | ||
804 | + struct gal2d_output_state *go = get_output_state(output); | 910 | + struct gal2d_output_state *go = get_output_state(output); |
805 | + struct gal2d_renderer *gr = get_renderer(output->compositor); | 911 | + struct gal2d_renderer *gr = get_renderer(output->compositor); |
806 | + gceSTATUS status = gcvSTATUS_OK; | 912 | + gceSTATUS status = gcvSTATUS_OK; |
807 | + | 913 | + |
808 | + gcoSURF surface; | 914 | + gcoSURF surface; |
809 | + surface = go->nNumBuffers > 1 ? | 915 | + int visibleViews=0; |
810 | + go->renderSurf[go->activebuffer] : | 916 | + int fullscreenViews=0; |
811 | + go->offscreenSurface; /*go->renderSurf[0];*/ | 917 | + |
812 | + make_current(gr, surface); | 918 | + surface = go->renderSurf[go->activebuffer]; |
919 | + if(go->nNumBuffers == 1) | ||
920 | + { | ||
921 | + wl_list_for_each_reverse(view, &compositor->view_list, link) | ||
922 | + if (view->plane == &compositor->primary_plane && is_view_visible(view)) | ||
923 | + { | ||
924 | + visibleViews++; | ||
925 | + if(view->surface->width == go->width && view->surface->height == go->height) | ||
926 | + { | ||
927 | + pixman_box32_t *bb_rects; | ||
928 | + int nbb=0; | ||
929 | + bb_rects = pixman_region32_rectangles(&view->transform.boundingbox, &nbb); | ||
930 | + if(nbb == 1) | ||
931 | + if(bb_rects[0].x1 == 0 && bb_rects[0].y1 ==0) | ||
932 | + fullscreenViews++; | ||
933 | + } | ||
934 | + } | ||
935 | + | ||
936 | + go->directBlit = ((visibleViews == 1) || (fullscreenViews > 1)); | ||
937 | + | ||
938 | + if(!go->directBlit) | ||
939 | + { | ||
940 | + surface = go->offscreenSurface; | ||
941 | + } | ||
942 | + } | ||
943 | + make_current(gr, surface); | ||
813 | + return status; | 944 | + return status; |
814 | +} | 945 | +} |
815 | + | 946 | + |
@@ -855,6 +986,7 @@ index 0000000..c651573 | |||
855 | + gcoSURF dstsurface; | 986 | + gcoSURF dstsurface; |
856 | + int geoWidth = ev->surface->width; | 987 | + int geoWidth = ev->surface->width; |
857 | + int geoheight = ev->surface->height; | 988 | + int geoheight = ev->surface->height; |
989 | + gceTILING tiling; | ||
858 | + | 990 | + |
859 | + bb_rects = pixman_region32_rectangles(&ev->transform.boundingbox, &nbb); | 991 | + bb_rects = pixman_region32_rectangles(&ev->transform.boundingbox, &nbb); |
860 | + | 992 | + |
@@ -892,9 +1024,20 @@ index 0000000..c651573 | |||
892 | + } | 1024 | + } |
893 | + else | 1025 | + else |
894 | + { | 1026 | + { |
895 | + gcmVERIFY_OK(gco2D_SetColorSourceEx(gr->gcoEngine2d, srcPhyAddr[0], srcStride[0], srcFormat, | 1027 | + gcoSURF_GetTiling(srcSurface, &tiling); |
896 | + gcvFALSE, srcWidth, srcHeight, gcvFALSE, gcvSURF_OPAQUE, 0)); | 1028 | + if (gcoHAL_IsFeatureAvailable(gr->gcoHal, gcvFEATURE_2D_TILING) != gcvTRUE && (tiling > gcvLINEAR)) |
897 | + gcmVERIFY_OK(gco2D_SetSource(gr->gcoEngine2d, &srcRect)); | 1029 | + { |
1030 | + weston_log("Tiling not supported \n"); | ||
1031 | + status = gcvSTATUS_NOT_SUPPORTED; | ||
1032 | + gcmONERROR(status); | ||
1033 | + } | ||
1034 | + gco2D_SetGenericSource(gr->gcoEngine2d, srcPhyAddr, 1, | ||
1035 | + srcStride, 1, | ||
1036 | + tiling, srcFormat, gcvSURF_0_DEGREE, | ||
1037 | + srcWidth, srcHeight); | ||
1038 | + /* Setup mirror. */ | ||
1039 | + gcmONERROR(gco2D_SetBitBlitMirror(gr->gcoEngine2d, gcvFALSE, gcvFALSE)); | ||
1040 | + gcmONERROR(gco2D_SetROP(gr->gcoEngine2d, 0xCC, 0xCC)); | ||
898 | + } | 1041 | + } |
899 | + | 1042 | + |
900 | + for (i = 0; i < nrects; i++) | 1043 | + for (i = 0; i < nrects; i++) |
@@ -1014,6 +1157,7 @@ index 0000000..c651573 | |||
1014 | + 0xCC, 0xCC, go->format)); | 1157 | + 0xCC, 0xCC, go->format)); |
1015 | + } | 1158 | + } |
1016 | + } | 1159 | + } |
1160 | + | ||
1017 | + if(status < 0) | 1161 | + if(status < 0) |
1018 | + { | 1162 | + { |
1019 | + printf("cr l=%d r=%d t=%d b=%d w=%d h=%d\n", | 1163 | + printf("cr l=%d r=%d t=%d b=%d w=%d h=%d\n", |
@@ -1027,12 +1171,6 @@ index 0000000..c651573 | |||
1027 | + goto OnError; | 1171 | + goto OnError; |
1028 | + } | 1172 | + } |
1029 | + } | 1173 | + } |
1030 | + status = (gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
1031 | + if(status < 0) | ||
1032 | + { | ||
1033 | + printf("Error in gcoHAL_Commit %s\n", __func__); | ||
1034 | + goto OnError; | ||
1035 | + } | ||
1036 | + } | 1174 | + } |
1037 | + | 1175 | + |
1038 | +OnError: | 1176 | +OnError: |
@@ -1067,24 +1205,25 @@ index 0000000..c651573 | |||
1067 | + ev->surface->width, ev->surface->height); | 1205 | + ev->surface->width, ev->surface->height); |
1068 | + pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque); | 1206 | + pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque); |
1069 | + | 1207 | + |
1070 | + if (pixman_region32_not_empty(&ev->surface->opaque)) { | 1208 | + struct gal2d_renderer *gr = get_renderer(ec); |
1209 | + gco2D_SetCurrentSourceIndex(gr->gcoEngine2d, 0U); | ||
1071 | + | 1210 | + |
1211 | + if (pixman_region32_not_empty(&ev->surface->opaque)) { | ||
1072 | + repaint_region(ev, output, go, &repaint, &ev->surface->opaque); | 1212 | + repaint_region(ev, output, go, &repaint, &ev->surface->opaque); |
1073 | + } | 1213 | + } |
1074 | + | 1214 | + |
1075 | + if (pixman_region32_not_empty(&surface_blend)) { | 1215 | + if (pixman_region32_not_empty(&surface_blend)) { |
1076 | + struct gal2d_renderer *gr = get_renderer(ec); | ||
1077 | + | ||
1078 | + gco2D_EnableAlphaBlend(gr->gcoEngine2d, | 1216 | + gco2D_EnableAlphaBlend(gr->gcoEngine2d, |
1079 | + ev->alpha * 0xFF, ev->alpha * 0xFF, | 1217 | + ev->alpha * 0xFF, ev->alpha * 0xFF, |
1080 | + gcvSURF_PIXEL_ALPHA_STRAIGHT, gcvSURF_PIXEL_ALPHA_STRAIGHT, | 1218 | + gcvSURF_PIXEL_ALPHA_STRAIGHT, gcvSURF_PIXEL_ALPHA_STRAIGHT, |
1081 | + gcvSURF_GLOBAL_ALPHA_OFF, gcvSURF_GLOBAL_ALPHA_OFF, | 1219 | + gcvSURF_GLOBAL_ALPHA_SCALE, gcvSURF_GLOBAL_ALPHA_SCALE, |
1082 | + gcvSURF_BLEND_ONE, gcvSURF_BLEND_INVERSED, | 1220 | + gcvSURF_BLEND_STRAIGHT, gcvSURF_BLEND_INVERSED, |
1083 | + gcvSURF_COLOR_STRAIGHT, gcvSURF_COLOR_STRAIGHT); | 1221 | + gcvSURF_COLOR_STRAIGHT, gcvSURF_COLOR_STRAIGHT); |
1084 | + | 1222 | + |
1085 | + repaint_region(ev, output, go, &repaint, &surface_blend); | 1223 | + repaint_region(ev, output, go, &repaint, &surface_blend); |
1086 | + } | 1224 | + } |
1087 | + | 1225 | + |
1226 | + gco2D_DisableAlphaBlend(gr->gcoEngine2d); | ||
1088 | + pixman_region32_fini(&surface_blend); | 1227 | + pixman_region32_fini(&surface_blend); |
1089 | + | 1228 | + |
1090 | +out: | 1229 | +out: |
@@ -1097,6 +1236,14 @@ index 0000000..c651573 | |||
1097 | +{ | 1236 | +{ |
1098 | + struct weston_compositor *compositor = output->compositor; | 1237 | + struct weston_compositor *compositor = output->compositor; |
1099 | + struct weston_view *view; | 1238 | + struct weston_view *view; |
1239 | + struct gal2d_output_state *go = get_output_state(output); | ||
1240 | + | ||
1241 | + if(go->nNumBuffers > 1) | ||
1242 | + { | ||
1243 | + /*500ms is more than enough to process a frame */ | ||
1244 | + gcoOS_WaitSignal(gcvNULL, go->busySignal, 500); | ||
1245 | + } | ||
1246 | + go->activebuffer = (go->activebuffer+1) % go->nNumBuffers; | ||
1100 | + | 1247 | + |
1101 | + wl_list_for_each_reverse(view, &compositor->view_list, link) | 1248 | + wl_list_for_each_reverse(view, &compositor->view_list, link) |
1102 | + if (view->plane == &compositor->primary_plane) | 1249 | + if (view->plane == &compositor->primary_plane) |
@@ -1132,6 +1279,28 @@ index 0000000..c651573 | |||
1132 | +} | 1279 | +} |
1133 | + | 1280 | + |
1134 | +static void | 1281 | +static void |
1282 | +gal2d_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer) | ||
1283 | +{ | ||
1284 | + gcsWL_VIV_BUFFER *vivBuffer = wl_resource_get_user_data(buffer->resource); | ||
1285 | + gcoSURF srcSurf = vivBuffer->surface; | ||
1286 | + gceSTATUS status = gcvSTATUS_OK; | ||
1287 | + struct gal2d_surface_state *gs = get_surface_state(es); | ||
1288 | + | ||
1289 | + if(gs->gco_Surface != gcvNULL) | ||
1290 | + { | ||
1291 | + gcmONERROR(gcoSURF_Destroy(gs->gco_Surface)); | ||
1292 | + } | ||
1293 | + | ||
1294 | + gs->gco_Surface = srcSurf; | ||
1295 | + gcoSURF_ReferenceSurface(srcSurf); | ||
1296 | + buffer->width = vivBuffer->width; | ||
1297 | + buffer->height = vivBuffer->height; | ||
1298 | + | ||
1299 | + OnError: | ||
1300 | + galONERROR(status); | ||
1301 | +} | ||
1302 | + | ||
1303 | +static void | ||
1135 | +gal2d_renderer_flush_damage(struct weston_surface *surface) | 1304 | +gal2d_renderer_flush_damage(struct weston_surface *surface) |
1136 | +{ | 1305 | +{ |
1137 | + struct gal2d_surface_state *gs = get_surface_state(surface); | 1306 | + struct gal2d_surface_state *gs = get_surface_state(surface); |
@@ -1166,10 +1335,7 @@ index 0000000..c651573 | |||
1166 | + gal2dBindBuffer(surface); | 1335 | + gal2dBindBuffer(surface); |
1167 | + } | 1336 | + } |
1168 | + else | 1337 | + else |
1169 | + { | 1338 | + gal2d_renderer_attach_egl(surface, buffer); |
1170 | + gcsWL_VIV_BUFFER *vivBuffer = (gcsWL_VIV_BUFFER *)buffer; | ||
1171 | + gs->gco_Surface = vivBuffer->surface; | ||
1172 | + } | ||
1173 | + | 1339 | + |
1174 | +done: | 1340 | +done: |
1175 | + pixman_region32_fini(&gs->texture_damage); | 1341 | + pixman_region32_fini(&gs->texture_damage); |
@@ -1203,19 +1369,17 @@ index 0000000..c651573 | |||
1203 | + } | 1369 | + } |
1204 | + } | 1370 | + } |
1205 | + else | 1371 | + else |
1206 | + { | 1372 | + gal2d_renderer_attach_egl(es, buffer); |
1207 | + gcsWL_VIV_BUFFER *vivBuffer = wl_resource_get_user_data(buffer->resource); | ||
1208 | + gs->gco_Surface = vivBuffer->surface; | ||
1209 | + | ||
1210 | + buffer->width = vivBuffer->width; | ||
1211 | + buffer->height = vivBuffer->height; | ||
1212 | + } | ||
1213 | +} | 1373 | +} |
1214 | + | 1374 | + |
1215 | +static void | 1375 | +static void |
1216 | +surface_state_destroy(struct gal2d_surface_state *gs, struct gal2d_renderer *gr) | 1376 | +surface_state_destroy(struct gal2d_surface_state *gs, struct gal2d_renderer *gr) |
1217 | +{ | 1377 | +{ |
1218 | + wl_list_remove(&gs->surface_destroy_listener.link); | 1378 | + if(gs->gco_Surface) |
1379 | + { | ||
1380 | + gcoSURF_Destroy(gs->gco_Surface); | ||
1381 | + } | ||
1382 | + wl_list_remove(&gs->surface_destroy_listener.link); | ||
1219 | + wl_list_remove(&gs->renderer_destroy_listener.link); | 1383 | + wl_list_remove(&gs->renderer_destroy_listener.link); |
1220 | + if(gs->surface) | 1384 | + if(gs->surface) |
1221 | + gs->surface->renderer_state = NULL; | 1385 | + gs->surface->renderer_state = NULL; |
@@ -1258,8 +1422,8 @@ index 0000000..c651573 | |||
1258 | + struct gal2d_surface_state *gs; | 1422 | + struct gal2d_surface_state *gs; |
1259 | + struct gal2d_renderer *gr = get_renderer(surface->compositor); | 1423 | + struct gal2d_renderer *gr = get_renderer(surface->compositor); |
1260 | + | 1424 | + |
1261 | + gs = calloc(1, sizeof *gs); | 1425 | + gs = zalloc(sizeof *gs); |
1262 | + if (!gs) | 1426 | + if (gs == NULL) |
1263 | + return -1; | 1427 | + return -1; |
1264 | + | 1428 | + |
1265 | + /* A buffer is never attached to solid color surfaces, yet | 1429 | + /* A buffer is never attached to solid color surfaces, yet |
@@ -1309,18 +1473,29 @@ index 0000000..c651573 | |||
1309 | +{ | 1473 | +{ |
1310 | + struct gal2d_output_state *go = get_output_state(output); | 1474 | + struct gal2d_output_state *go = get_output_state(output); |
1311 | + gctUINT32 i; | 1475 | + gctUINT32 i; |
1312 | + | 1476 | + |
1313 | + if(go->nNumBuffers <= 1 ) | 1477 | + for (i = 0; i < 2; i++) |
1478 | + { | ||
1479 | + pixman_region32_fini(&go->buffer_damage[i]); | ||
1480 | + } | ||
1481 | + if(go->nNumBuffers <= 1 ) | ||
1314 | + { | 1482 | + { |
1315 | + if(go->offscreenSurface) | 1483 | + if(go->offscreenSurface) |
1316 | + gcmVERIFY_OK(gcoSURF_Destroy(go->offscreenSurface)); | 1484 | + gcmVERIFY_OK(gcoSURF_Destroy(go->offscreenSurface)); |
1317 | + } | 1485 | + } |
1486 | + else | ||
1487 | + { | ||
1488 | + gcoOS_Signal(gcvNULL,go->signal, gcvTRUE); | ||
1489 | + pthread_mutex_lock(&go->workerMutex); | ||
1490 | + go->exitWorker = 1; | ||
1491 | + pthread_mutex_unlock(&go->workerMutex); | ||
1492 | + pthread_join(go->workerId, NULL); | ||
1493 | + } | ||
1318 | + | 1494 | + |
1319 | + for(i=0; i < go->nNumBuffers; i++) | 1495 | + for(i=0; i < go->nNumBuffers; i++) |
1320 | + { | 1496 | + { |
1321 | + gcmVERIFY_OK(gcoSURF_Destroy(go->renderSurf[i])); | 1497 | + gcmVERIFY_OK(gcoSURF_Destroy(go->renderSurf[i])); |
1322 | + } | 1498 | + } |
1323 | + | ||
1324 | + free(go->renderSurf); | 1499 | + free(go->renderSurf); |
1325 | + go->renderSurf = gcvNULL; | 1500 | + go->renderSurf = gcvNULL; |
1326 | + | 1501 | + |
@@ -1373,19 +1548,19 @@ index 0000000..c651573 | |||
1373 | +} | 1548 | +} |
1374 | + | 1549 | + |
1375 | +static int | 1550 | +static int |
1376 | +gal2d_renderer_output_create(struct weston_output *output, EGLNativeDisplayType display, | 1551 | +gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType display, |
1377 | + EGLNativeWindowType window) | 1552 | + NativeWindowType window) |
1378 | + | 1553 | + |
1379 | + { | 1554 | + { |
1380 | + struct gal2d_renderer *gr = get_renderer(output->compositor); | 1555 | + struct gal2d_renderer *gr = get_renderer(output->compositor); |
1381 | + struct gal2d_output_state *go = calloc(1, sizeof *go); | 1556 | + struct gal2d_output_state *go; |
1382 | + halDISPLAY_INFO info; | 1557 | + halDISPLAY_INFO info; |
1383 | + gctUINT32 backOffset = 0; | 1558 | + gctUINT32 backOffset = 0; |
1384 | + gctINT width, height; | ||
1385 | + gceSTATUS status = gcvSTATUS_OK; | 1559 | + gceSTATUS status = gcvSTATUS_OK; |
1386 | + gctUINT32 i; | 1560 | + gctUINT32 i; |
1387 | + | 1561 | + |
1388 | + if (!go) | 1562 | + go = zalloc(sizeof *go); |
1563 | + if (go == NULL) | ||
1389 | + return -1; | 1564 | + return -1; |
1390 | + | 1565 | + |
1391 | + output->renderer_state = go; | 1566 | + output->renderer_state = go; |
@@ -1406,10 +1581,29 @@ index 0000000..c651573 | |||
1406 | + go->activebuffer = 0; | 1581 | + go->activebuffer = 0; |
1407 | + | 1582 | + |
1408 | + go->renderSurf = malloc(sizeof(gcoSURF) * go->nNumBuffers); | 1583 | + go->renderSurf = malloc(sizeof(gcoSURF) * go->nNumBuffers); |
1409 | + gcoOS_GetDisplayVirtual(go->display, &width, &height); | 1584 | + gcoOS_GetDisplayVirtual(go->display, &go->width, &go->height); |
1585 | + gcoOS_SetSwapInterval(go->display, 1); | ||
1586 | + | ||
1587 | + /*Needed only for multi Buffer */ | ||
1588 | + if(go->nNumBuffers > 1) | ||
1589 | + { | ||
1590 | + gcmVERIFY_OK(gcoOS_CreateSignal(gcvNULL, gcvFALSE, | ||
1591 | + &go->signal)); | ||
1592 | + gcmVERIFY_OK(gcoOS_CreateSignal(gcvNULL, gcvFALSE, | ||
1593 | + &go->busySignal)); | ||
1594 | + | ||
1595 | + go->iface.command = gcvHAL_SIGNAL; | ||
1596 | + go->iface.u.Signal.signal = gcmPTR_TO_UINT64(go->signal); | ||
1597 | + go->iface.u.Signal.auxSignal = 0; | ||
1598 | + go->iface.u.Signal.process = gcmPTR_TO_UINT64(gcoOS_GetCurrentProcessID()); | ||
1599 | + go->iface.u.Signal.fromWhere = gcvKERNEL_PIXEL; | ||
1600 | + | ||
1601 | + go->exitWorker = 0; | ||
1602 | + pthread_create(&go->workerId, NULL, gal2d_output_worker, output); | ||
1603 | + pthread_mutex_init(&go->workerMutex, gcvNULL); | ||
1604 | + } | ||
1410 | + for(i=0; i < go->nNumBuffers; i++) | 1605 | + for(i=0; i < go->nNumBuffers; i++) |
1411 | + { | 1606 | + { |
1412 | + | ||
1413 | + gcmONERROR(gcoSURF_Construct(gr->gcoHal, info.width, info.height, 1, | 1607 | + gcmONERROR(gcoSURF_Construct(gr->gcoHal, info.width, info.height, 1, |
1414 | + gcvSURF_BITMAP, go->format, gcvPOOL_USER, &go->renderSurf[i])); | 1608 | + gcvSURF_BITMAP, go->format, gcvPOOL_USER, &go->renderSurf[i])); |
1415 | + | 1609 | + |
@@ -1438,8 +1632,14 @@ index 0000000..c651573 | |||
1438 | + &go->offscreenSurface)); | 1632 | + &go->offscreenSurface)); |
1439 | + make_current(gr, go->offscreenSurface); | 1633 | + make_current(gr, go->offscreenSurface); |
1440 | + gal2d_clear(output); | 1634 | + gal2d_clear(output); |
1441 | + gal2d_flip_surface(output); | ||
1442 | + } | 1635 | + } |
1636 | + else | ||
1637 | + { | ||
1638 | + gcoOS_Signal(gcvNULL,go->busySignal, gcvTRUE); | ||
1639 | + } | ||
1640 | + | ||
1641 | + for (i = 0; i < 2; i++) | ||
1642 | + pixman_region32_init(&go->buffer_damage[i]); | ||
1443 | +OnError: | 1643 | +OnError: |
1444 | + galONERROR(status); | 1644 | + galONERROR(status); |
1445 | + /* Return the status. */ | 1645 | + /* Return the status. */ |
@@ -1453,12 +1653,12 @@ index 0000000..c651573 | |||
1453 | +}; | 1653 | +}; |
1454 | diff --git a/src/gal2d-renderer.h b/src/gal2d-renderer.h | 1654 | diff --git a/src/gal2d-renderer.h b/src/gal2d-renderer.h |
1455 | new file mode 100644 | 1655 | new file mode 100644 |
1456 | index 0000000..3b89f73 | 1656 | index 0000000..fefcfd1 |
1457 | --- /dev/null | 1657 | --- /dev/null |
1458 | +++ b/src/gal2d-renderer.h | 1658 | +++ b/src/gal2d-renderer.h |
1459 | @@ -0,0 +1,41 @@ | 1659 | @@ -0,0 +1,47 @@ |
1460 | +/* | 1660 | +/* |
1461 | + * Copyright (c) 2014 Freescale Semiconductor, Inc. | 1661 | + * Copyright (c) 2015 Freescale Semiconductor, Inc. |
1462 | + * Copyright © 2013 Vasily Khoruzhick <anarsoul@gmail.com> | 1662 | + * Copyright © 2013 Vasily Khoruzhick <anarsoul@gmail.com> |
1463 | + * | 1663 | + * |
1464 | + * Permission to use, copy, modify, distribute, and sell this software and | 1664 | + * Permission to use, copy, modify, distribute, and sell this software and |
@@ -1483,7 +1683,13 @@ index 0000000..3b89f73 | |||
1483 | +#define __gal_2d_renderer_h_ | 1683 | +#define __gal_2d_renderer_h_ |
1484 | + | 1684 | + |
1485 | +#include "compositor.h" | 1685 | +#include "compositor.h" |
1686 | +#ifdef ENABLE_EGL | ||
1486 | +#include <EGL/egl.h> | 1687 | +#include <EGL/egl.h> |
1688 | +#else | ||
1689 | +#include <HAL/gc_hal_eglplatform.h> | ||
1690 | +typedef HALNativeDisplayType NativeDisplayType; | ||
1691 | +typedef HALNativeWindowType NativeWindowType; | ||
1692 | +#endif | ||
1487 | + | 1693 | + |
1488 | + | 1694 | + |
1489 | +struct gal2d_renderer_interface { | 1695 | +struct gal2d_renderer_interface { |
@@ -1499,5 +1705,5 @@ index 0000000..3b89f73 | |||
1499 | + | 1705 | + |
1500 | +#endif | 1706 | +#endif |
1501 | -- | 1707 | -- |
1502 | 2.1.4 | 1708 | 2.3.6 |
1503 | 1709 | ||
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston/0003-ENGR00319247-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 deleted file mode 100644 index 65554d34..00000000 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch +++ /dev/null | |||
@@ -1,258 +0,0 @@ | |||
1 | From 663f2a362ff384098f4c32f5cc9e7b7b73f2a553 Mon Sep 17 00:00:00 2001 | ||
2 | From: Prabhu Sundararaj <prabhu.sundararaj@freescale.com> | ||
3 | Date: Tue, 24 Jun 2014 15:44:13 -0500 | ||
4 | Subject: [PATCH] ENGR00319247 : Distorted line and shadow if use 2d compositor | ||
5 | to run wayland apps. | ||
6 | Organization: O.S. Systems Software LTDA. | ||
7 | |||
8 | Fixed blending for shadown and maintained separate surface for damage composite. | ||
9 | |||
10 | Upstream Status: N/A | ||
11 | |||
12 | Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@freescale.com> | ||
13 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
14 | --- | ||
15 | src/compositor-fbdev.c | 8 ++-- | ||
16 | src/gal2d-renderer.c | 102 +++++++++++++++++++++++++++++++++++-------------- | ||
17 | src/gal2d-renderer.h | 6 +++ | ||
18 | 3 files changed, 83 insertions(+), 33 deletions(-) | ||
19 | |||
20 | diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c | ||
21 | index a3d32e5..b27d199 100644 | ||
22 | --- a/src/compositor-fbdev.c | ||
23 | +++ b/src/compositor-fbdev.c | ||
24 | @@ -55,7 +55,7 @@ struct fbdev_compositor { | ||
25 | int use_pixman; | ||
26 | int use_gal2d; | ||
27 | struct wl_listener session_listener; | ||
28 | - EGLNativeDisplayType display; | ||
29 | + NativeDisplayType display; | ||
30 | }; | ||
31 | |||
32 | struct fbdev_screeninfo { | ||
33 | @@ -91,8 +91,8 @@ struct fbdev_output { | ||
34 | void *shadow_buf; | ||
35 | uint8_t depth; | ||
36 | |||
37 | - EGLNativeDisplayType display; | ||
38 | - EGLNativeWindowType window; | ||
39 | + NativeDisplayType display; | ||
40 | + NativeWindowType window; | ||
41 | }; | ||
42 | |||
43 | struct fbdev_parameters { | ||
44 | @@ -667,7 +667,7 @@ fbdev_output_create(struct fbdev_compositor *compositor, | ||
45 | return 0; | ||
46 | } | ||
47 | if (gl_renderer->output_create(&output->base, | ||
48 | - (EGLNativeWindowType)output->window, | ||
49 | + (NativeWindowType)output->window, | ||
50 | gl_renderer->opaque_attribs, | ||
51 | NULL) < 0) { | ||
52 | weston_log("gl_renderer_output_create failed.\n"); | ||
53 | diff --git a/src/gal2d-renderer.c b/src/gal2d-renderer.c | ||
54 | index c651573..fbe39f6 100644 | ||
55 | --- a/src/gal2d-renderer.c | ||
56 | +++ b/src/gal2d-renderer.c | ||
57 | @@ -42,7 +42,7 @@ struct gal2d_output_state { | ||
58 | |||
59 | int current_buffer; | ||
60 | pixman_region32_t buffer_damage[2]; | ||
61 | - EGLNativeDisplayType display; | ||
62 | + NativeDisplayType display; | ||
63 | gcoSURF* renderSurf; | ||
64 | gctUINT32 nNumBuffers; | ||
65 | int activebuffer; | ||
66 | @@ -423,11 +423,9 @@ gal2dBindBuffer(struct weston_surface* es) | ||
67 | gcoSURF surface = gs->gco_Surface; | ||
68 | struct weston_buffer *buffer = gs->buffer_ref.buffer; | ||
69 | gcePOOL pool = gcvPOOL_DEFAULT; | ||
70 | - gctUINT64 node = 0; | ||
71 | - gctUINT bytes; | ||
72 | - | ||
73 | - gcmVERIFY_OK(gcoSURF_QueryVidMemNode(surface, &node, | ||
74 | - &pool, &bytes)); | ||
75 | + | ||
76 | + gcmVERIFY_OK(gcoSURF_QueryVidMemNode(surface, gcvNULL, | ||
77 | + &pool, gcvNULL)); | ||
78 | |||
79 | if(pool != gcvPOOL_USER) | ||
80 | { | ||
81 | @@ -801,24 +799,26 @@ draw_view(struct weston_view *ev, struct weston_output *output, | ||
82 | ev->surface->width, ev->surface->height); | ||
83 | pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque); | ||
84 | |||
85 | + struct gal2d_renderer *gr = get_renderer(ec); | ||
86 | + | ||
87 | if (pixman_region32_not_empty(&ev->surface->opaque)) { | ||
88 | |||
89 | repaint_region(ev, output, go, &repaint, &ev->surface->opaque); | ||
90 | } | ||
91 | |||
92 | if (pixman_region32_not_empty(&surface_blend)) { | ||
93 | - struct gal2d_renderer *gr = get_renderer(ec); | ||
94 | - | ||
95 | + | ||
96 | gco2D_EnableAlphaBlend(gr->gcoEngine2d, | ||
97 | - ev->alpha * 0xFF, ev->alpha * 0xFF, | ||
98 | - gcvSURF_PIXEL_ALPHA_STRAIGHT, gcvSURF_PIXEL_ALPHA_STRAIGHT, | ||
99 | - gcvSURF_GLOBAL_ALPHA_OFF, gcvSURF_GLOBAL_ALPHA_OFF, | ||
100 | - gcvSURF_BLEND_ONE, gcvSURF_BLEND_INVERSED, | ||
101 | - gcvSURF_COLOR_STRAIGHT, gcvSURF_COLOR_STRAIGHT); | ||
102 | + ev->alpha * 0xFF, ev->alpha * 0xFF, | ||
103 | + gcvSURF_PIXEL_ALPHA_STRAIGHT, gcvSURF_PIXEL_ALPHA_STRAIGHT, | ||
104 | + gcvSURF_GLOBAL_ALPHA_SCALE, gcvSURF_GLOBAL_ALPHA_SCALE, | ||
105 | + gcvSURF_BLEND_STRAIGHT, gcvSURF_BLEND_INVERSED, | ||
106 | + gcvSURF_COLOR_STRAIGHT, gcvSURF_COLOR_STRAIGHT); | ||
107 | |||
108 | repaint_region(ev, output, go, &repaint, &surface_blend); | ||
109 | } | ||
110 | |||
111 | + gco2D_DisableAlphaBlend(gr->gcoEngine2d); | ||
112 | pixman_region32_fini(&surface_blend); | ||
113 | |||
114 | out: | ||
115 | @@ -866,6 +866,48 @@ gal2d_renderer_repaint_output(struct weston_output *output, | ||
116 | } | ||
117 | |||
118 | static void | ||
119 | +gal2d_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer) | ||
120 | +{ | ||
121 | + gcsWL_VIV_BUFFER *vivBuffer = wl_resource_get_user_data(buffer->resource); | ||
122 | + gctUINT width = 0; | ||
123 | + gctUINT height = 0; | ||
124 | + gctINT stride = 0; | ||
125 | + gceSURF_FORMAT format; | ||
126 | + gcoSURF srcSurf = vivBuffer->surface; | ||
127 | + gctUINT32 physical; | ||
128 | + gctPOINTER va =0; | ||
129 | + gceSTATUS status = gcvSTATUS_OK; | ||
130 | + struct gal2d_surface_state *gs = get_surface_state(es); | ||
131 | + | ||
132 | + if(gs->gco_Surface == gcvNULL) | ||
133 | + { | ||
134 | + /** Construct a wrapper. */ | ||
135 | + gcmONERROR(gcoSURF_ConstructWrapper(gcvNULL, &gs->gco_Surface)); | ||
136 | + } | ||
137 | + | ||
138 | + gcmONERROR(gcoSURF_GetAlignedSize(srcSurf, &width, &height, &stride)); | ||
139 | + gcmONERROR(gcoSURF_GetFormat(srcSurf, gcvNULL, &format)); | ||
140 | + gcmONERROR(gcoSURF_Lock(srcSurf, &physical, (gctPOINTER *)&va)); | ||
141 | + | ||
142 | + /* Set the buffer. */ | ||
143 | + gcmONERROR(gcoSURF_SetBuffer(gs->gco_Surface, | ||
144 | + gcvSURF_BITMAP_NO_VIDMEM, | ||
145 | + format, | ||
146 | + stride, | ||
147 | + (gctPOINTER) va, | ||
148 | + (gctUINT32) physical)); | ||
149 | + | ||
150 | + /* Set the window. */ | ||
151 | + gcmONERROR(gcoSURF_SetWindow(gs->gco_Surface, 0, 0, width, height)); | ||
152 | + | ||
153 | + buffer->width = vivBuffer->width; | ||
154 | + buffer->height = vivBuffer->height; | ||
155 | + | ||
156 | + OnError: | ||
157 | + galONERROR(status); | ||
158 | +} | ||
159 | + | ||
160 | +static void | ||
161 | gal2d_renderer_flush_damage(struct weston_surface *surface) | ||
162 | { | ||
163 | struct gal2d_surface_state *gs = get_surface_state(surface); | ||
164 | @@ -900,10 +942,7 @@ gal2d_renderer_flush_damage(struct weston_surface *surface) | ||
165 | gal2dBindBuffer(surface); | ||
166 | } | ||
167 | else | ||
168 | - { | ||
169 | - gcsWL_VIV_BUFFER *vivBuffer = (gcsWL_VIV_BUFFER *)buffer; | ||
170 | - gs->gco_Surface = vivBuffer->surface; | ||
171 | - } | ||
172 | + gal2d_renderer_attach_egl(surface, buffer); | ||
173 | |||
174 | done: | ||
175 | pixman_region32_fini(&gs->texture_damage); | ||
176 | @@ -937,19 +976,17 @@ gal2d_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) | ||
177 | } | ||
178 | } | ||
179 | else | ||
180 | - { | ||
181 | - gcsWL_VIV_BUFFER *vivBuffer = wl_resource_get_user_data(buffer->resource); | ||
182 | - gs->gco_Surface = vivBuffer->surface; | ||
183 | - | ||
184 | - buffer->width = vivBuffer->width; | ||
185 | - buffer->height = vivBuffer->height; | ||
186 | - } | ||
187 | + gal2d_renderer_attach_egl(es, buffer); | ||
188 | } | ||
189 | |||
190 | static void | ||
191 | surface_state_destroy(struct gal2d_surface_state *gs, struct gal2d_renderer *gr) | ||
192 | { | ||
193 | - wl_list_remove(&gs->surface_destroy_listener.link); | ||
194 | + if(gs->gco_Surface) | ||
195 | + { | ||
196 | + gcoSURF_Destroy(gs->gco_Surface); | ||
197 | + } | ||
198 | + wl_list_remove(&gs->surface_destroy_listener.link); | ||
199 | wl_list_remove(&gs->renderer_destroy_listener.link); | ||
200 | if(gs->surface) | ||
201 | gs->surface->renderer_state = NULL; | ||
202 | @@ -1043,8 +1080,12 @@ gal2d_renderer_output_destroy(struct weston_output *output) | ||
203 | { | ||
204 | struct gal2d_output_state *go = get_output_state(output); | ||
205 | gctUINT32 i; | ||
206 | - | ||
207 | - if(go->nNumBuffers <= 1 ) | ||
208 | + | ||
209 | + for (i = 0; i < 2; i++) | ||
210 | + { | ||
211 | + pixman_region32_fini(&go->buffer_damage[i]); | ||
212 | + } | ||
213 | + if(go->nNumBuffers <= 1 ) | ||
214 | { | ||
215 | if(go->offscreenSurface) | ||
216 | gcmVERIFY_OK(gcoSURF_Destroy(go->offscreenSurface)); | ||
217 | @@ -1107,8 +1148,8 @@ OnError: | ||
218 | } | ||
219 | |||
220 | static int | ||
221 | -gal2d_renderer_output_create(struct weston_output *output, EGLNativeDisplayType display, | ||
222 | - EGLNativeWindowType window) | ||
223 | +gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType display, | ||
224 | + NativeWindowType window) | ||
225 | |||
226 | { | ||
227 | struct gal2d_renderer *gr = get_renderer(output->compositor); | ||
228 | @@ -1174,6 +1215,9 @@ gal2d_renderer_output_create(struct weston_output *output, EGLNativeDisplayType | ||
229 | gal2d_clear(output); | ||
230 | gal2d_flip_surface(output); | ||
231 | } | ||
232 | + | ||
233 | + for (i = 0; i < 2; i++) | ||
234 | + pixman_region32_init(&go->buffer_damage[i]); | ||
235 | OnError: | ||
236 | galONERROR(status); | ||
237 | /* Return the status. */ | ||
238 | diff --git a/src/gal2d-renderer.h b/src/gal2d-renderer.h | ||
239 | index 3b89f73..1322a7d 100644 | ||
240 | --- a/src/gal2d-renderer.h | ||
241 | +++ b/src/gal2d-renderer.h | ||
242 | @@ -24,7 +24,13 @@ | ||
243 | #define __gal_2d_renderer_h_ | ||
244 | |||
245 | #include "compositor.h" | ||
246 | +#ifdef ENABLE_EGL | ||
247 | #include <EGL/egl.h> | ||
248 | +#else | ||
249 | +#include <HAL/gc_hal_eglplatform.h> | ||
250 | +typedef HALNativeDisplayType NativeDisplayType; | ||
251 | +typedef HALNativeWindowType NativeWindowType; | ||
252 | +#endif | ||
253 | |||
254 | |||
255 | struct gal2d_renderer_interface { | ||
256 | -- | ||
257 | 2.1.4 | ||
258 | |||
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch b/meta-fsl-arm/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch deleted file mode 100644 index cb4ed6bf..00000000 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | From ca9eb5bdbdfe17654466d84c8baaa1187a8796c6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yong Gan <b45748@freescale.com> | ||
3 | Date: Wed, 2 Jul 2014 11:27:26 +0800 | ||
4 | Subject: [PATCH] ENGR00320243 Enable GAL2D compositor in SoloLite | ||
5 | Organization: O.S. Systems Software LTDA. | ||
6 | |||
7 | Build gal2d-renderer.so when EGL was not enabled. | ||
8 | |||
9 | Date: Jul 02, 2014 | ||
10 | Signed-off-by Yong Gan <yong.gan@freescale.com> | ||
11 | |||
12 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
13 | --- | ||
14 | Makefile.am | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/Makefile.am b/Makefile.am | ||
18 | index 29834c3..e82e970 100644 | ||
19 | --- a/Makefile.am | ||
20 | +++ b/Makefile.am | ||
21 | @@ -165,6 +165,7 @@ gl_renderer_la_SOURCES = \ | ||
22 | src/gl-renderer.c \ | ||
23 | src/vertex-clipping.c \ | ||
24 | src/vertex-clipping.h | ||
25 | +endif | ||
26 | |||
27 | module_LTLIBRARIES += gal2d-renderer.la | ||
28 | gal2d_renderer_la_LDFLAGS = -module -avoid-version | ||
29 | @@ -178,7 +179,6 @@ gal2d_renderer_la_SOURCES = \ | ||
30 | src/gal2d-renderer.c \ | ||
31 | src/vertex-clipping.c \ | ||
32 | src/vertex-clipping.h | ||
33 | -endif | ||
34 | |||
35 | if ENABLE_X11_COMPOSITOR | ||
36 | module_LTLIBRARIES += x11-backend.la | ||
37 | -- | ||
38 | 2.1.4 | ||
39 | |||
diff --git a/meta-fsl-arm/recipes-graphics/wayland/weston/0005-ENGR00321030-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 deleted file mode 100644 index 89d6215a..00000000 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0005-ENGR00321030-Change-GAL2D-compositor-to-be-default-i.patch +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | From e58ecd66cea732aab8f6b5274d72868922e92c5f Mon Sep 17 00:00:00 2001 | ||
2 | From: Yong Gan <b45748@freescale.com> | ||
3 | Date: Fri, 4 Jul 2014 09:57:11 +0800 | ||
4 | Subject: [PATCH] ENGR00321030 Change GAL2D compositor to be default in | ||
5 | SoloLite. | ||
6 | Organization: O.S. Systems Software LTDA. | ||
7 | |||
8 | Change GAL2D compositor to be default When EGL is not enabled. | ||
9 | |||
10 | Date: Jul 03, 2014 | ||
11 | Signed-off-by Yong Gan <yong.gan@freescale.com> | ||
12 | |||
13 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
14 | --- | ||
15 | src/compositor-fbdev.c | 5 +++++ | ||
16 | 1 file changed, 5 insertions(+) | ||
17 | |||
18 | diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c | ||
19 | index b27d199..bdc6ec9 100644 | ||
20 | --- a/src/compositor-fbdev.c | ||
21 | +++ b/src/compositor-fbdev.c | ||
22 | @@ -1060,8 +1060,13 @@ backend_init(struct wl_display *display, int *argc, char *argv[], | ||
23 | struct fbdev_parameters param = { | ||
24 | .tty = 0, /* default to current tty */ | ||
25 | .device = "/dev/fb0", /* default frame buffer */ | ||
26 | +#ifdef ENABLE_EGL | ||
27 | .use_gl = 1, | ||
28 | .use_gal2d = 0, | ||
29 | +#else | ||
30 | + .use_gl = 0, | ||
31 | + .use_gal2d = 1, | ||
32 | +#endif | ||
33 | }; | ||
34 | |||
35 | const struct weston_option fbdev_options[] = { | ||
36 | -- | ||
37 | 2.1.4 | ||
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 deleted file mode 100644 index 8201459c..00000000 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0006-MGS-389-Fix-for-wrong-FPS-throttling-when-multibuffe.patch +++ /dev/null | |||
@@ -1,247 +0,0 @@ | |||
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 deleted file mode 100644 index 295d4e8d..00000000 --- a/meta-fsl-arm/recipes-graphics/wayland/weston/0007-MGS-391-Weston-Performance-Optimisation-for-single-b.patch +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
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 f7ad4635..a7496daa 100644 --- a/meta-fsl-arm/recipes-graphics/wayland/weston_%.bbappend +++ b/meta-fsl-arm/recipes-graphics/wayland/weston_%.bbappend | |||
@@ -1,14 +1,6 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" |
2 | 2 | ||
3 | SRC_URI_append_mx6 = " \ | 3 | SRC_URI_append_mx6 = " file://0001-MGS-840-Add-i.MX6-support-for-weston.patch" |
4 | file://0001-ENGR00314805-1-Add-Vivante-EGL-support.patch \ | ||
5 | file://0002-ENGR00314805-2-Add-Vivante-GAL2D-support.patch \ | ||
6 | file://0003-ENGR00319247-Distorted-line-and-shadow-if-use-2d-com.patch \ | ||
7 | file://0004-ENGR00320243-Enable-GAL2D-compositor-in-SoloLite.patch \ | ||
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 | 4 | ||
13 | PACKAGECONFIG_append_mx6q = " cairo-glesv2" | 5 | PACKAGECONFIG_append_mx6q = " cairo-glesv2" |
14 | PACKAGECONFIG_append_mx6dl = " cairo-glesv2" | 6 | PACKAGECONFIG_append_mx6dl = " cairo-glesv2" |