diff options
| author | Tom Hochstein <tom.hochstein@nxp.com> | 2016-10-07 17:36:55 -0500 | 
|---|---|---|
| committer | Otavio Salvador <otavio@ossystems.com.br> | 2016-10-18 16:26:14 -0200 | 
| commit | e141909e97556aa9a3028f06543751643a35cc58 (patch) | |
| tree | 83fccc3db24fc8ef446d0db4c3e9963cfe9db9c8 | |
| parent | 0d0a092097718863838a583c66c6e7fed9a3af48 (diff) | |
| download | meta-freescale-e141909e97556aa9a3028f06543751643a35cc58.tar.gz | |
weston: Re-implement renderer using G2D
Change i.MX renderer from gal2d to g2d API.
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
4 files changed, 3014 insertions, 0 deletions
diff --git a/recipes-graphics/wayland/weston/0009-MGS-1284-xwld-Re-implement-weston-2d-renderer-with-p.patch b/recipes-graphics/wayland/weston/0009-MGS-1284-xwld-Re-implement-weston-2d-renderer-with-p.patch new file mode 100644 index 000000000..0afbd4b68 --- /dev/null +++ b/recipes-graphics/wayland/weston/0009-MGS-1284-xwld-Re-implement-weston-2d-renderer-with-p.patch  | |||
| @@ -0,0 +1,2869 @@ | |||
| 1 | From 7bcbb14a149d0955176855e8ab6289cf68d099e5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "yong.gan" <yong.gan@nxp.com> | ||
| 3 | Date: Fri, 11 Mar 2016 10:55:48 +0800 | ||
| 4 | Subject: [PATCH 1/3] MGS-1284: xwld: Re-implement weston 2d renderer with | ||
| 5 | porting g2d API | ||
| 6 | |||
| 7 | Use G2D API to replace Gal2D API. | ||
| 8 | Fix the errors in multi display mode. | ||
| 9 | Use the standard FB API to operate the frame buffer. | ||
| 10 | |||
| 11 | Date: Feb 22, 2016 | ||
| 12 | Upstream Status: Inappropriate [i.MX specific] | ||
| 13 | |||
| 14 | Signed-off-by: Yong Gan <yong.gan@freescale.com> | ||
| 15 | --- | ||
| 16 | Makefile.am | 16 +- | ||
| 17 | src/compositor-fbdev.c | 74 +-- | ||
| 18 | src/g2d-renderer.c | 1175 +++++++++++++++++++++++++++++++++++++++++++ | ||
| 19 | src/g2d-renderer.h | 48 ++ | ||
| 20 | src/gal2d-renderer.c | 1307 ------------------------------------------------ | ||
| 21 | src/gal2d-renderer.h | 50 -- | ||
| 22 | 6 files changed, 1255 insertions(+), 1415 deletions(-) | ||
| 23 | create mode 100644 src/g2d-renderer.c | ||
| 24 | create mode 100644 src/g2d-renderer.h | ||
| 25 | delete mode 100644 src/gal2d-renderer.c | ||
| 26 | delete mode 100644 src/gal2d-renderer.h | ||
| 27 | |||
| 28 | Index: weston-1.11.0/Makefile.am | ||
| 29 | =================================================================== | ||
| 30 | --- weston-1.11.0.orig/Makefile.am 2016-10-06 14:26:20.254564856 -0500 | ||
| 31 | +++ weston-1.11.0/Makefile.am 2016-10-06 14:28:47.000000000 -0500 | ||
| 32 | @@ -247,16 +247,16 @@ | ||
| 33 | src/vertex-clipping.h \ | ||
| 34 | shared/helpers.h | ||
| 35 | endif | ||
| 36 | -module_LTLIBRARIES += gal2d-renderer.la | ||
| 37 | -gal2d_renderer_la_LDFLAGS = -module -avoid-version | ||
| 38 | -gal2d_renderer_la_LIBADD = $(COMPOSITOR_LIBS) $(EGL_LIBS) | ||
| 39 | -gal2d_renderer_la_CFLAGS = \ | ||
| 40 | +module_LTLIBRARIES += g2d-renderer.la | ||
| 41 | +g2d_renderer_la_LDFLAGS = -module -avoid-version | ||
| 42 | +g2d_renderer_la_LIBADD = $(COMPOSITOR_LIBS) $(EGL_LIBS) -lg2d | ||
| 43 | +g2d_renderer_la_CFLAGS = \ | ||
| 44 | $(COMPOSITOR_CFLAGS) \ | ||
| 45 | $(EGL_CFLAGS) \ | ||
| 46 | - $(GCC_CFLAGS) | ||
| 47 | -gal2d_renderer_la_SOURCES = \ | ||
| 48 | - src/gal2d-renderer.h \ | ||
| 49 | - src/gal2d-renderer.c \ | ||
| 50 | + $(GCC_CFLAGS) -DHAVE_G2D | ||
| 51 | +g2d_renderer_la_SOURCES = \ | ||
| 52 | + src/g2d-renderer.h \ | ||
| 53 | + src/g2d-renderer.c \ | ||
| 54 | src/vertex-clipping.c \ | ||
| 55 | src/vertex-clipping.h | ||
| 56 | |||
| 57 | Index: weston-1.11.0/src/compositor-fbdev.c | ||
| 58 | =================================================================== | ||
| 59 | --- weston-1.11.0.orig/src/compositor-fbdev.c 2016-10-06 14:26:20.418565670 -0500 | ||
| 60 | +++ weston-1.11.0/src/compositor-fbdev.c 2016-10-06 14:28:47.000000000 -0500 | ||
| 61 | @@ -50,7 +50,7 @@ | ||
| 62 | #include "libinput-seat.h" | ||
| 63 | #include "gl-renderer.h" | ||
| 64 | #include "presentation-time-server-protocol.h" | ||
| 65 | -#include "gal2d-renderer.h" | ||
| 66 | +#include "g2d-renderer.h" | ||
| 67 | |||
| 68 | struct fbdev_backend { | ||
| 69 | struct weston_backend base; | ||
| 70 | @@ -60,7 +60,7 @@ | ||
| 71 | struct udev *udev; | ||
| 72 | struct udev_input input; | ||
| 73 | int use_pixman; | ||
| 74 | - int use_gal2d; | ||
| 75 | + int use_g2d; | ||
| 76 | uint32_t output_transform; | ||
| 77 | struct wl_listener session_listener; | ||
| 78 | NativeDisplayType display; | ||
| 79 | @@ -102,7 +102,7 @@ | ||
| 80 | }; | ||
| 81 | |||
| 82 | struct gl_renderer_interface *gl_renderer; | ||
| 83 | -struct gal2d_renderer_interface *gal2d_renderer; | ||
| 84 | +struct g2d_renderer_interface *g2d_renderer; | ||
| 85 | |||
| 86 | static const char default_seat[] = "seat0"; | ||
| 87 | |||
| 88 | @@ -519,36 +519,10 @@ | ||
| 89 | if (backend->use_pixman) { | ||
| 90 | if (pixman_renderer_output_create(&output->base) < 0) | ||
| 91 | goto out_hw_surface; | ||
| 92 | - } else if(backend->use_gal2d) { | ||
| 93 | - | ||
| 94 | - char* fbenv = getenv("FB_FRAMEBUFFER_0"); | ||
| 95 | - setenv("FB_FRAMEBUFFER_0", device, 1); | ||
| 96 | - output->display = fbGetDisplay(backend->compositor->wl_display); | ||
| 97 | - if (output->display == NULL) { | ||
| 98 | - fprintf(stderr, "failed to get display\n"); | ||
| 99 | - return 0; | ||
| 100 | - } | ||
| 101 | - | ||
| 102 | - output->window = fbCreateWindow(output->display, -1, -1, 0, 0); | ||
| 103 | - if (output->window == NULL) { | ||
| 104 | - fprintf(stderr, "failed to create window\n"); | ||
| 105 | - return 0; | ||
| 106 | - } | ||
| 107 | - /* restore the previous value*/ | ||
| 108 | - if(fbenv != NULL) | ||
| 109 | - { | ||
| 110 | - setenv("FB_FRAMEBUFFER_0", fbenv, 1); | ||
| 111 | - } | ||
| 112 | - else | ||
| 113 | - { | ||
| 114 | - unsetenv("FB_FRAMEBUFFER_0"); | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - | ||
| 118 | - if (gal2d_renderer->output_create(&output->base, | ||
| 119 | - output->display, | ||
| 120 | - (NativeWindowType)output->window) < 0) { | ||
| 121 | - weston_log("gal_renderer_output_create failed.\n"); | ||
| 122 | + } else if(backend->use_g2d) { | ||
| 123 | + if (g2d_renderer->output_create(&output->base, | ||
| 124 | + backend->compositor->wl_display, device) < 0) { | ||
| 125 | + weston_log("g2d_renderer_output_create failed.\n"); | ||
| 126 | goto out_hw_surface; | ||
| 127 | } | ||
| 128 | |||
| 129 | @@ -607,8 +581,8 @@ | ||
| 130 | if (backend->use_pixman) { | ||
| 131 | if (base->renderer_state != NULL) | ||
| 132 | pixman_renderer_output_destroy(base); | ||
| 133 | - } else if (backend->use_gal2d) { | ||
| 134 | - gal2d_renderer->output_destroy(base); | ||
| 135 | + } else if (backend->use_g2d) { | ||
| 136 | + g2d_renderer->output_destroy(base); | ||
| 137 | } else { | ||
| 138 | gl_renderer->output_destroy(base); | ||
| 139 | } | ||
| 140 | @@ -820,8 +794,8 @@ | ||
| 141 | backend->base.restore = fbdev_restore; | ||
| 142 | |||
| 143 | backend->prev_state = WESTON_COMPOSITOR_ACTIVE; | ||
| 144 | - backend->use_pixman = !(param->use_gl || param->use_gal2d); | ||
| 145 | - backend->use_gal2d = param->use_gal2d; | ||
| 146 | + backend->use_pixman = !(param->use_gl || param->use_g2d); | ||
| 147 | + backend->use_g2d = param->use_g2d; | ||
| 148 | backend->output_transform = param->output_transform; | ||
| 149 | |||
| 150 | weston_setup_vt_switch_bindings(compositor); | ||
| 151 | @@ -830,21 +804,21 @@ | ||
| 152 | if (pixman_renderer_init(compositor) < 0) | ||
| 153 | goto out_launcher; | ||
| 154 | } | ||
| 155 | - else if (backend->use_gal2d) { | ||
| 156 | + else if (backend->use_g2d) { | ||
| 157 | int x = 0, y = 0; | ||
| 158 | int i=0; | ||
| 159 | int count = 0; | ||
| 160 | int k=0, dispCount = 0; | ||
| 161 | char displays[5][32]; | ||
| 162 | - gal2d_renderer = weston_load_module("gal2d-renderer.so", | ||
| 163 | - "gal2d_renderer_interface"); | ||
| 164 | - if (!gal2d_renderer) { | ||
| 165 | - weston_log("could not load gal2d renderer\n"); | ||
| 166 | + g2d_renderer = weston_load_module("g2d-renderer.so", | ||
| 167 | + "g2d_renderer_interface"); | ||
| 168 | + if (!g2d_renderer) { | ||
| 169 | + weston_log("could not load g2d renderer\n"); | ||
| 170 | goto out_launcher; | ||
| 171 | } | ||
| 172 | |||
| 173 | - if (gal2d_renderer->create(backend->compositor) < 0) { | ||
| 174 | - weston_log("gal2d_renderer_create failed.\n"); | ||
| 175 | + if (g2d_renderer->create(backend->compositor) < 0) { | ||
| 176 | + weston_log("g2d_renderer_create failed.\n"); | ||
| 177 | goto out_launcher; | ||
| 178 | } | ||
| 179 | |||
| 180 | @@ -893,7 +867,7 @@ | ||
| 181 | goto out_launcher; | ||
| 182 | } | ||
| 183 | } | ||
| 184 | - if(!backend->use_gal2d) | ||
| 185 | + if(!backend->use_g2d) | ||
| 186 | if (fbdev_output_create(backend, 0, 0, param->device) < 0) | ||
| 187 | goto out_launcher; | ||
| 188 | |||
| 189 | @@ -924,10 +898,10 @@ | ||
| 190 | config->device = "/dev/fb0"; /* default frame buffer */ | ||
| 191 | #ifdef ENABLE_EGL | ||
| 192 | config->use_gl = 1; | ||
| 193 | - config->use_gal2d = 0; | ||
| 194 | + config->use_g2d = 0; | ||
| 195 | #else | ||
| 196 | config->use_gl = 0; | ||
| 197 | - config->use_gal2d = 1; | ||
| 198 | + config->use_g2d = 1; | ||
| 199 | #endif | ||
| 200 | config->output_transform = WL_OUTPUT_TRANSFORM_NORMAL; | ||
| 201 | } | ||
| 202 | Index: weston-1.11.0/src/g2d-renderer.c | ||
| 203 | =================================================================== | ||
| 204 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 205 | +++ weston-1.11.0/src/g2d-renderer.c 2016-10-06 14:28:47.000000000 -0500 | ||
| 206 | @@ -0,0 +1,1175 @@ | ||
| 207 | +/* | ||
| 208 | + * Copyright (c) 2016 Freescale Semiconductor, Inc. | ||
| 209 | + * Copyright © 2012 Intel Corporation | ||
| 210 | + * Copyright © 2015 Collabora, Ltd. | ||
| 211 | + * | ||
| 212 | + * Permission is hereby granted, free of charge, to any person obtaining | ||
| 213 | + * a copy of this software and associated documentation files (the | ||
| 214 | + * "Software"), to deal in the Software without restriction, including | ||
| 215 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
| 216 | + * distribute, sublicense, and/or sell copies of the Software, and to | ||
| 217 | + * permit persons to whom the Software is furnished to do so, subject to | ||
| 218 | + * the following conditions: | ||
| 219 | + * | ||
| 220 | + * The above copyright notice and this permission notice (including the | ||
| 221 | + * next paragraph) shall be included in all copies or substantial | ||
| 222 | + * portions of the Software. | ||
| 223 | + * | ||
| 224 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 225 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 226 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 227 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
| 228 | + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
| 229 | + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 230 | + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 231 | + * SOFTWARE. | ||
| 232 | + */ | ||
| 233 | + | ||
| 234 | +#define _GNU_SOURCE | ||
| 235 | + | ||
| 236 | +#include <stdlib.h> | ||
| 237 | +#include <string.h> | ||
| 238 | +#include <ctype.h> | ||
| 239 | +#include <float.h> | ||
| 240 | +#include <assert.h> | ||
| 241 | +#include <pthread.h> | ||
| 242 | +#include <linux/fb.h> | ||
| 243 | +#include <sys/ioctl.h> | ||
| 244 | +#include <fcntl.h> | ||
| 245 | +#include <unistd.h> | ||
| 246 | + | ||
| 247 | +#include "compositor.h" | ||
| 248 | +#include "g2d-renderer.h" | ||
| 249 | +#include "vertex-clipping.h" | ||
| 250 | +#include "shared/helpers.h" | ||
| 251 | +#include "HAL/gc_hal_eglplatform.h" | ||
| 252 | +#include "g2dExt.h" | ||
| 253 | + | ||
| 254 | +#define BUFFER_DAMAGE_COUNT 2 | ||
| 255 | + | ||
| 256 | +typedef struct _g2dRECT | ||
| 257 | +{ | ||
| 258 | + int left; | ||
| 259 | + int top; | ||
| 260 | + int right; | ||
| 261 | + int bottom; | ||
| 262 | +} g2dRECT; | ||
| 263 | + | ||
| 264 | +struct fb_screeninfo { | ||
| 265 | + struct fb_var_screeninfo varinfo; | ||
| 266 | + struct fb_fix_screeninfo fixinfo; | ||
| 267 | + unsigned int x_resolution; | ||
| 268 | + unsigned int y_resolution; | ||
| 269 | + size_t buffer_length; /* length of frame buffer memory in bytes */ | ||
| 270 | + size_t physical; | ||
| 271 | + enum g2d_format pixel_format; /* frame buffer pixel format */ | ||
| 272 | +}; | ||
| 273 | + | ||
| 274 | +struct g2d_output_state { | ||
| 275 | + int current_buffer; | ||
| 276 | + pixman_region32_t buffer_damage[BUFFER_DAMAGE_COUNT]; | ||
| 277 | + struct g2d_surfaceEx *renderSurf; | ||
| 278 | + int nNumBuffers; | ||
| 279 | + int activebuffer; | ||
| 280 | + struct g2d_surfaceEx offscreenSurface; | ||
| 281 | + struct g2d_buf *offscreen_buf; | ||
| 282 | + struct fb_screeninfo fb_info; | ||
| 283 | + int directBlit; | ||
| 284 | + int width; | ||
| 285 | + int height; | ||
| 286 | + int fb_fd; | ||
| 287 | +}; | ||
| 288 | + | ||
| 289 | +struct g2d_surface_state { | ||
| 290 | + float color[4]; | ||
| 291 | + struct weston_buffer_reference buffer_ref; | ||
| 292 | + int pitch; /* in pixels */ | ||
| 293 | + int attached; | ||
| 294 | + pixman_region32_t texture_damage; | ||
| 295 | + struct g2d_surfaceEx g2d_surface; | ||
| 296 | + struct g2d_buf *shm_buf; | ||
| 297 | + int shm_buf_length; | ||
| 298 | + int bpp; | ||
| 299 | + | ||
| 300 | + struct weston_surface *surface; | ||
| 301 | + struct wl_listener surface_destroy_listener; | ||
| 302 | + struct wl_listener renderer_destroy_listener; | ||
| 303 | +}; | ||
| 304 | + | ||
| 305 | +struct g2d_renderer { | ||
| 306 | + struct weston_renderer base; | ||
| 307 | + struct wl_signal destroy_signal; | ||
| 308 | + struct wl_global *viv_global; | ||
| 309 | + void *handle; | ||
| 310 | +}; | ||
| 311 | + | ||
| 312 | +static int | ||
| 313 | +g2d_renderer_create_surface(struct weston_surface *surface); | ||
| 314 | + | ||
| 315 | +static inline struct g2d_surface_state * | ||
| 316 | +get_surface_state(struct weston_surface *surface) | ||
| 317 | +{ | ||
| 318 | + if (!surface->renderer_state) | ||
| 319 | + g2d_renderer_create_surface(surface); | ||
| 320 | + return (struct g2d_surface_state *)surface->renderer_state; | ||
| 321 | +} | ||
| 322 | + | ||
| 323 | +static inline struct g2d_renderer * | ||
| 324 | +get_renderer(struct weston_compositor *ec) | ||
| 325 | +{ | ||
| 326 | + return (struct g2d_renderer *)ec->renderer; | ||
| 327 | +} | ||
| 328 | + | ||
| 329 | +#define max(a, b) (((a) > (b)) ? (a) : (b)) | ||
| 330 | +#define min(a, b) (((a) > (b)) ? (b) : (a)) | ||
| 331 | +/* | ||
| 332 | + * Compute the boundary vertices of the intersection of the global coordinate | ||
| 333 | + * aligned rectangle 'rect', and an arbitrary quadrilateral produced from | ||
| 334 | + * 'surf_rect' when transformed from surface coordinates into global coordinates. | ||
| 335 | + * The vertices are written to 'ex' and 'ey', and the return value is the | ||
| 336 | + * number of vertices. Vertices are produced in clockwise winding order. | ||
| 337 | + * Guarantees to produce either zero vertices, or 3-8 vertices with non-zero | ||
| 338 | + * polygon area. | ||
| 339 | + */ | ||
| 340 | +static int | ||
| 341 | +calculate_edges(struct weston_view *ev, pixman_box32_t *rect, | ||
| 342 | + pixman_box32_t *surf_rect, float *ex, float *ey) | ||
| 343 | +{ | ||
| 344 | + | ||
| 345 | + struct clip_context ctx; | ||
| 346 | + int i, n; | ||
| 347 | + float min_x, max_x, min_y, max_y; | ||
| 348 | + struct polygon8 surf = { | ||
| 349 | + { surf_rect->x1, surf_rect->x2, surf_rect->x2, surf_rect->x1 }, | ||
| 350 | + { surf_rect->y1, surf_rect->y1, surf_rect->y2, surf_rect->y2 }, | ||
| 351 | + 4 | ||
| 352 | + }; | ||
| 353 | + | ||
| 354 | + ctx.clip.x1 = rect->x1; | ||
| 355 | + ctx.clip.y1 = rect->y1; | ||
| 356 | + ctx.clip.x2 = rect->x2; | ||
| 357 | + ctx.clip.y2 = rect->y2; | ||
| 358 | + | ||
| 359 | + /* transform surface to screen space: */ | ||
| 360 | + for (i = 0; i < surf.n; i++) | ||
| 361 | + weston_view_to_global_float(ev, surf.x[i], surf.y[i], | ||
| 362 | + &surf.x[i], &surf.y[i]); | ||
| 363 | + | ||
| 364 | + /* find bounding box: */ | ||
| 365 | + min_x = max_x = surf.x[0]; | ||
| 366 | + min_y = max_y = surf.y[0]; | ||
| 367 | + | ||
| 368 | + for (i = 1; i < surf.n; i++) { | ||
| 369 | + min_x = min(min_x, surf.x[i]); | ||
| 370 | + max_x = max(max_x, surf.x[i]); | ||
| 371 | + min_y = min(min_y, surf.y[i]); | ||
| 372 | + max_y = max(max_y, surf.y[i]); | ||
| 373 | + } | ||
| 374 | + | ||
| 375 | + /* First, simple bounding box check to discard early transformed | ||
| 376 | + * surface rects that do not intersect with the clip region: | ||
| 377 | + */ | ||
| 378 | + if ((min_x >= ctx.clip.x2) || (max_x <= ctx.clip.x1) || | ||
| 379 | + (min_y >= ctx.clip.y2) || (max_y <= ctx.clip.y1)) | ||
| 380 | + return 0; | ||
| 381 | + | ||
| 382 | + /* Simple case, bounding box edges are parallel to surface edges, | ||
| 383 | + * there will be only four edges. We just need to clip the surface | ||
| 384 | + * vertices to the clip rect bounds: | ||
| 385 | + */ | ||
| 386 | + if (!ev->transform.enabled) | ||
| 387 | + return clip_simple(&ctx, &surf, ex, ey); | ||
| 388 | + | ||
| 389 | + /* Transformed case: use a general polygon clipping algorithm to | ||
| 390 | + * clip the surface rectangle with each side of 'rect'. | ||
| 391 | + * The algorithm is Sutherland-Hodgman, as explained in | ||
| 392 | + * http://www.codeguru.com/cpp/misc/misc/graphics/article.php/c8965/Polygon-Clipping.htm | ||
| 393 | + * but without looking at any of that code. | ||
| 394 | + */ | ||
| 395 | + n = clip_transformed(&ctx, &surf, ex, ey); | ||
| 396 | + | ||
| 397 | + if (n < 3) | ||
| 398 | + return 0; | ||
| 399 | + | ||
| 400 | + return n; | ||
| 401 | +} | ||
| 402 | + | ||
| 403 | + | ||
| 404 | +static inline struct g2d_output_state * | ||
| 405 | +get_output_state(struct weston_output *output) | ||
| 406 | +{ | ||
| 407 | + return (struct g2d_output_state *)output->renderer_state; | ||
| 408 | +} | ||
| 409 | + | ||
| 410 | +static void | ||
| 411 | +g2d_getG2dTiling(IN gceTILING tiling, enum g2d_tiling* g2dTiling) | ||
| 412 | +{ | ||
| 413 | + switch(tiling) | ||
| 414 | + { | ||
| 415 | + case gcvLINEAR: | ||
| 416 | + *g2dTiling = G2D_LINEAR; | ||
| 417 | + break; | ||
| 418 | + case gcvTILED: | ||
| 419 | + *g2dTiling = G2D_TILED; | ||
| 420 | + break; | ||
| 421 | + case gcvSUPERTILED: | ||
| 422 | + *g2dTiling = G2D_SUPERTILED; | ||
| 423 | + break; | ||
| 424 | + default: | ||
| 425 | + weston_log("Error in function %s\n", __func__); | ||
| 426 | + break; | ||
| 427 | + } | ||
| 428 | +} | ||
| 429 | + | ||
| 430 | +static void | ||
| 431 | +g2d_getG2dFormat(IN gceSURF_FORMAT Format, enum g2d_format* g2dFormat) | ||
| 432 | +{ | ||
| 433 | + switch(Format) | ||
| 434 | + { | ||
| 435 | + case gcvSURF_R5G6B5: | ||
| 436 | + *g2dFormat = G2D_RGB565; | ||
| 437 | + break; | ||
| 438 | + case gcvSURF_A8B8G8R8: | ||
| 439 | + *g2dFormat = G2D_RGBA8888; | ||
| 440 | + break; | ||
| 441 | + case gcvSURF_X8B8G8R8: | ||
| 442 | + *g2dFormat = G2D_RGBA8888; | ||
| 443 | + break; | ||
| 444 | + case gcvSURF_A8R8G8B8: | ||
| 445 | + *g2dFormat = G2D_BGRA8888; | ||
| 446 | + break; | ||
| 447 | + case gcvSURF_X8R8G8B8: | ||
| 448 | + *g2dFormat = G2D_BGRX8888; | ||
| 449 | + break; | ||
| 450 | + case gcvSURF_B5G6R5: | ||
| 451 | + *g2dFormat = G2D_BGR565; | ||
| 452 | + break; | ||
| 453 | + case gcvSURF_B8G8R8A8: | ||
| 454 | + *g2dFormat = G2D_ARGB8888; | ||
| 455 | + break; | ||
| 456 | + case gcvSURF_R8G8B8A8: | ||
| 457 | + *g2dFormat = G2D_ABGR8888; | ||
| 458 | + break; | ||
| 459 | + case gcvSURF_B8G8R8X8: | ||
| 460 | + *g2dFormat = G2D_XRGB8888; | ||
| 461 | + break; | ||
| 462 | + case gcvSURF_R8G8B8X8: | ||
| 463 | + *g2dFormat = G2D_XBGR8888; | ||
| 464 | + break; | ||
| 465 | + case gcvSURF_NV12: | ||
| 466 | + *g2dFormat = G2D_NV12; | ||
| 467 | + break; | ||
| 468 | + case gcvSURF_NV21: | ||
| 469 | + *g2dFormat = G2D_NV21; | ||
| 470 | + break; | ||
| 471 | + case gcvSURF_I420: | ||
| 472 | + *g2dFormat = G2D_I420; | ||
| 473 | + break; | ||
| 474 | + case gcvSURF_YV12: | ||
| 475 | + *g2dFormat = G2D_YV12; | ||
| 476 | + break; | ||
| 477 | + case gcvSURF_YUY2: | ||
| 478 | + *g2dFormat = G2D_YUYV; | ||
| 479 | + break; | ||
| 480 | + case gcvSURF_YVYU: | ||
| 481 | + *g2dFormat = G2D_YVYU; | ||
| 482 | + break; | ||
| 483 | + case gcvSURF_UYVY: | ||
| 484 | + *g2dFormat = G2D_UYVY; | ||
| 485 | + break; | ||
| 486 | + case gcvSURF_VYUY: | ||
| 487 | + *g2dFormat = G2D_VYUY; | ||
| 488 | + break; | ||
| 489 | + case gcvSURF_NV16: | ||
| 490 | + *g2dFormat = G2D_NV16; | ||
| 491 | + break; | ||
| 492 | + case gcvSURF_NV61: | ||
| 493 | + *g2dFormat = G2D_NV61; | ||
| 494 | + break; | ||
| 495 | + default: | ||
| 496 | + weston_log("Error in function %s, Format not supported\n", __func__); | ||
| 497 | + break; | ||
| 498 | + } | ||
| 499 | +} | ||
| 500 | + | ||
| 501 | +static void printG2dSurfaceInfo(struct g2d_surfaceEx* g2dSurface) | ||
| 502 | +{ | ||
| 503 | + weston_log("physicAddr = %d left = %d right = %d top=%d bottom=%d stride= %d tiling = %d, format=%d \n", | ||
| 504 | + g2dSurface->base.planes[0], | ||
| 505 | + g2dSurface->base.left, | ||
| 506 | + g2dSurface->base.right, | ||
| 507 | + g2dSurface->base.top, | ||
| 508 | + g2dSurface->base.bottom, | ||
| 509 | + g2dSurface->base.stride, | ||
| 510 | + g2dSurface->tiling, | ||
| 511 | + g2dSurface->base.format); | ||
| 512 | +} | ||
| 513 | + | ||
| 514 | +static void | ||
| 515 | +get_g2dSurface(gcsWL_VIV_BUFFER *buffer, struct g2d_surfaceEx *g2dSurface) | ||
| 516 | +{ | ||
| 517 | + if(buffer->width < 0 || buffer->height < 0) | ||
| 518 | + { | ||
| 519 | + weston_log("invalid EGL buffer in function %s\n", __func__); | ||
| 520 | + return; | ||
| 521 | + } | ||
| 522 | + int width = buffer->alignedWidth; | ||
| 523 | + int height = buffer->alignedHeight; | ||
| 524 | + g2d_getG2dFormat(buffer->format, &g2dSurface->base.format); | ||
| 525 | + g2d_getG2dTiling(buffer->tiling, &g2dSurface->tiling); | ||
| 526 | + g2dSurface->base.planes[0] = buffer->physical[0]; | ||
| 527 | + g2dSurface->base.planes[1] = buffer->physical[1]; | ||
| 528 | + g2dSurface->base.planes[2] = buffer->physical[2]; | ||
| 529 | + g2dSurface->base.left = 0; | ||
| 530 | + g2dSurface->base.top = 0; | ||
| 531 | + g2dSurface->base.right = buffer->width; | ||
| 532 | + g2dSurface->base.bottom = buffer->height; | ||
| 533 | + g2dSurface->base.stride = width; | ||
| 534 | + g2dSurface->base.width = width; | ||
| 535 | + g2dSurface->base.height = height; | ||
| 536 | + g2dSurface->base.rot = G2D_ROTATION_0; | ||
| 537 | +} | ||
| 538 | + | ||
| 539 | +static void | ||
| 540 | +g2d_SetSurfaceRect(struct g2d_surfaceEx* g2dSurface, g2dRECT* rect) | ||
| 541 | +{ | ||
| 542 | + if(g2dSurface && rect) | ||
| 543 | + { | ||
| 544 | + g2dSurface->base.left = rect->left; | ||
| 545 | + g2dSurface->base.top = rect->top; | ||
| 546 | + g2dSurface->base.right = rect->right; | ||
| 547 | + g2dSurface->base.bottom = rect->bottom; | ||
| 548 | + } | ||
| 549 | +} | ||
| 550 | + | ||
| 551 | +static int | ||
| 552 | +g2d_blitSurface(void *handle, struct g2d_surfaceEx * srcG2dSurface, struct g2d_surfaceEx *dstG2dSurface, | ||
| 553 | + g2dRECT *srcRect, g2dRECT *dstRect) | ||
| 554 | +{ | ||
| 555 | + g2d_SetSurfaceRect(srcG2dSurface, srcRect); | ||
| 556 | + g2d_SetSurfaceRect(dstG2dSurface, dstRect); | ||
| 557 | + srcG2dSurface->base.blendfunc = G2D_ONE; | ||
| 558 | + dstG2dSurface->base.blendfunc = G2D_ONE_MINUS_SRC_ALPHA; | ||
| 559 | + | ||
| 560 | + if(g2d_blitEx(handle, srcG2dSurface, dstG2dSurface)) | ||
| 561 | + { | ||
| 562 | + printG2dSurfaceInfo(srcG2dSurface); | ||
| 563 | + printG2dSurfaceInfo(dstG2dSurface); | ||
| 564 | + return -1; | ||
| 565 | + } | ||
| 566 | + return 0; | ||
| 567 | +} | ||
| 568 | + | ||
| 569 | +static void | ||
| 570 | +g2d_flip_surface(struct weston_output *output) | ||
| 571 | +{ | ||
| 572 | + struct g2d_output_state *go = get_output_state(output); | ||
| 573 | + go->fb_info.varinfo.yoffset = go->activebuffer * go->fb_info.y_resolution; | ||
| 574 | + | ||
| 575 | + if(ioctl(go->fb_fd, FBIOPAN_DISPLAY, &(go->fb_info.varinfo)) < 0) | ||
| 576 | + { | ||
| 577 | + weston_log("FBIOPAN_DISPLAY Failed\n"); | ||
| 578 | + } | ||
| 579 | + go->activebuffer = (go->activebuffer + 1) % go->nNumBuffers; | ||
| 580 | +} | ||
| 581 | + | ||
| 582 | +static void | ||
| 583 | +copy_to_framebuffer(struct weston_output *output) | ||
| 584 | +{ | ||
| 585 | + struct g2d_renderer *gr = get_renderer(output->compositor); | ||
| 586 | + struct g2d_output_state *go = get_output_state(output); | ||
| 587 | + if(!go->directBlit && go->nNumBuffers == 1) | ||
| 588 | + { | ||
| 589 | + g2dRECT srcRect = {0, 0, go->offscreenSurface.base.width, go->offscreenSurface.base.height}; | ||
| 590 | + g2dRECT dstrect = srcRect; | ||
| 591 | + g2dRECT clipRect = srcRect; | ||
| 592 | + g2d_set_clipping(gr->handle, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); | ||
| 593 | + g2d_blitSurface(gr->handle, &go->offscreenSurface, | ||
| 594 | + &go->renderSurf[go->activebuffer], &srcRect, &dstrect); | ||
| 595 | + } | ||
| 596 | + | ||
| 597 | + g2d_finish(gr->handle); | ||
| 598 | + | ||
| 599 | + if(go->nNumBuffers > 1) | ||
| 600 | + { | ||
| 601 | + g2d_flip_surface(output); | ||
| 602 | + } | ||
| 603 | +} | ||
| 604 | + | ||
| 605 | +static int | ||
| 606 | +is_view_visible(struct weston_view *view) | ||
| 607 | +{ | ||
| 608 | + /* Return false, if surface is guaranteed to be totally obscured. */ | ||
| 609 | + int ret; | ||
| 610 | + pixman_region32_t unocc; | ||
| 611 | + | ||
| 612 | + pixman_region32_init(&unocc); | ||
| 613 | + pixman_region32_subtract(&unocc, &view->transform.boundingbox, | ||
| 614 | + &view->clip); | ||
| 615 | + ret = pixman_region32_not_empty(&unocc); | ||
| 616 | + pixman_region32_fini(&unocc); | ||
| 617 | + | ||
| 618 | + return ret; | ||
| 619 | +} | ||
| 620 | + | ||
| 621 | +static void | ||
| 622 | +use_output(struct weston_output *output) | ||
| 623 | +{ | ||
| 624 | + struct weston_compositor *compositor = output->compositor; | ||
| 625 | + struct weston_view *view; | ||
| 626 | + struct g2d_output_state *go = get_output_state(output); | ||
| 627 | + int visibleViews=0; | ||
| 628 | + int fullscreenViews=0; | ||
| 629 | + | ||
| 630 | + if(go->nNumBuffers == 1) | ||
| 631 | + { | ||
| 632 | + wl_list_for_each_reverse(view, &compositor->view_list, link) | ||
| 633 | + if (view->plane == &compositor->primary_plane && is_view_visible(view)) | ||
| 634 | + { | ||
| 635 | + visibleViews++; | ||
| 636 | + if(view->surface->width == go->width && view->surface->height == go->height) | ||
| 637 | + { | ||
| 638 | + pixman_box32_t *bb_rects; | ||
| 639 | + int nbb=0; | ||
| 640 | + bb_rects = pixman_region32_rectangles(&view->transform.boundingbox, &nbb); | ||
| 641 | + if(nbb == 1) | ||
| 642 | + if(bb_rects[0].x1 == 0 && bb_rects[0].y1 ==0) | ||
| 643 | + fullscreenViews++; | ||
| 644 | + } | ||
| 645 | + } | ||
| 646 | + | ||
| 647 | + go->directBlit = ((visibleViews == 1) || (fullscreenViews > 1)); | ||
| 648 | + } | ||
| 649 | +} | ||
| 650 | + | ||
| 651 | +static int | ||
| 652 | +g2d_renderer_read_pixels(struct weston_output *output, | ||
| 653 | + pixman_format_code_t format, void *pixels, | ||
| 654 | + uint32_t x, uint32_t y, | ||
| 655 | + uint32_t width, uint32_t height) | ||
| 656 | +{ | ||
| 657 | + return 0; | ||
| 658 | +} | ||
| 659 | + | ||
| 660 | +static int g2d_int_from_double(double d) | ||
| 661 | +{ | ||
| 662 | + return wl_fixed_to_int(wl_fixed_from_double(d)); | ||
| 663 | +} | ||
| 664 | + | ||
| 665 | +static void | ||
| 666 | +repaint_region(struct weston_view *ev, struct weston_output *output, struct g2d_output_state *go, pixman_region32_t *region, | ||
| 667 | + pixman_region32_t *surf_region){ | ||
| 668 | + | ||
| 669 | + struct g2d_renderer *gr = get_renderer(ev->surface->compositor); | ||
| 670 | + struct g2d_surface_state *gs = get_surface_state(ev->surface); | ||
| 671 | + | ||
| 672 | + pixman_box32_t *rects, *surf_rects, *bb_rects; | ||
| 673 | + int i, j, nrects, nsurf, nbb=0; | ||
| 674 | + g2dRECT srcRect = {0}; | ||
| 675 | + g2dRECT dstrect = {0}; | ||
| 676 | + g2dRECT clipRect = {0}; | ||
| 677 | + int dstWidth = 0; | ||
| 678 | + int dstHeight = 0; | ||
| 679 | + struct g2d_surfaceEx *dstsurface; | ||
| 680 | + | ||
| 681 | + bb_rects = pixman_region32_rectangles(&ev->transform.boundingbox, &nbb); | ||
| 682 | + | ||
| 683 | + if(!gs->attached || nbb <= 0) | ||
| 684 | + { | ||
| 685 | + return; | ||
| 686 | + } | ||
| 687 | + | ||
| 688 | + rects = pixman_region32_rectangles(region, &nrects); | ||
| 689 | + surf_rects = pixman_region32_rectangles(surf_region, &nsurf); | ||
| 690 | + srcRect.left = ev->geometry.x < 0.0 ? g2d_int_from_double(fabsf(ev->geometry.x)) : 0; | ||
| 691 | + srcRect.top = ev->geometry.y < 0.0 ? g2d_int_from_double(fabsf(ev->geometry.y)) : 0; | ||
| 692 | + srcRect.right = ev->surface->width; | ||
| 693 | + srcRect.bottom = ev->surface->height; | ||
| 694 | + if(go->nNumBuffers > 1 || go->directBlit) | ||
| 695 | + { | ||
| 696 | + dstsurface = &go->renderSurf[go->activebuffer]; | ||
| 697 | + } | ||
| 698 | + else | ||
| 699 | + { | ||
| 700 | + dstsurface = &go->offscreenSurface; | ||
| 701 | + } | ||
| 702 | + dstWidth = dstsurface->base.width; | ||
| 703 | + dstHeight = dstsurface->base.height; | ||
| 704 | + for (i = 0; i < nrects; i++) | ||
| 705 | + { | ||
| 706 | + pixman_box32_t *rect = &rects[i]; | ||
| 707 | + gctFLOAT min_x, max_x, min_y, max_y; | ||
| 708 | + | ||
| 709 | + dstrect.left = (bb_rects[0].x1 < 0) ? rect->x1 : bb_rects[0].x1; | ||
| 710 | + dstrect.top = (bb_rects[0].y1 < 0) ? rect->y1 : bb_rects[0].y1; | ||
| 711 | + dstrect.right = bb_rects[0].x2; | ||
| 712 | + dstrect.bottom = bb_rects[0].y2; | ||
| 713 | + /*Multi display support*/ | ||
| 714 | + if(output->x > 0) | ||
| 715 | + { | ||
| 716 | + dstrect.left = dstrect.left - output->x; | ||
| 717 | + dstrect.right = dstrect.right - output->x; | ||
| 718 | + } | ||
| 719 | + if(dstrect.left < 0) | ||
| 720 | + { | ||
| 721 | + srcRect.left -= dstrect.left; | ||
| 722 | + dstrect.left = 0; | ||
| 723 | + if(srcRect.left > ev->surface->width) | ||
| 724 | + break; | ||
| 725 | + } | ||
| 726 | + if(dstrect.right > dstWidth) | ||
| 727 | + { | ||
| 728 | + dstrect.right = dstWidth; | ||
| 729 | + srcRect.right = srcRect.left + dstrect.right - dstrect.left; | ||
| 730 | + if(srcRect.right > ev->surface->width) | ||
| 731 | + break; | ||
| 732 | + } | ||
| 733 | + if(dstrect.bottom > dstHeight) | ||
| 734 | + { | ||
| 735 | + dstrect.bottom = dstHeight; | ||
| 736 | + srcRect.bottom = srcRect.top + dstrect.bottom - dstrect.top; | ||
| 737 | + if(srcRect.bottom < 0) | ||
| 738 | + break; | ||
| 739 | + } | ||
| 740 | + | ||
| 741 | + for (j = 0; j < nsurf; j++) | ||
| 742 | + { | ||
| 743 | + pixman_box32_t *surf_rect = &surf_rects[j]; | ||
| 744 | + gctFLOAT ex[8], ey[8]; /* edge points in screen space */ | ||
| 745 | + int n; | ||
| 746 | + int m=0; | ||
| 747 | + n = calculate_edges(ev, rect, surf_rect, ex, ey); | ||
| 748 | + if (n < 3) | ||
| 749 | + continue; | ||
| 750 | + | ||
| 751 | + min_x = max_x = ex[0]; | ||
| 752 | + min_y = max_y = ey[0]; | ||
| 753 | + for (m = 1; m < n; m++) | ||
| 754 | + { | ||
| 755 | + min_x = min(min_x, ex[m]); | ||
| 756 | + max_x = max(max_x, ex[m]); | ||
| 757 | + min_y = min(min_y, ey[m]); | ||
| 758 | + max_y = max(max_y, ey[m]); | ||
| 759 | + } | ||
| 760 | + | ||
| 761 | + clipRect.left = g2d_int_from_double(min_x); | ||
| 762 | + clipRect.top = g2d_int_from_double(min_y); | ||
| 763 | + clipRect.right = g2d_int_from_double(max_x); | ||
| 764 | + clipRect.bottom = g2d_int_from_double(max_y); | ||
| 765 | + | ||
| 766 | + if(output->x > 0) | ||
| 767 | + { | ||
| 768 | + clipRect.left = clipRect.left - output->x; | ||
| 769 | + clipRect.right = clipRect.right - output->x; | ||
| 770 | + } | ||
| 771 | + g2d_set_clipping(gr->handle, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); | ||
| 772 | + g2d_blitSurface(gr->handle, &gs->g2d_surface, dstsurface, &srcRect, &dstrect); | ||
| 773 | + } | ||
| 774 | + } | ||
| 775 | +} | ||
| 776 | + | ||
| 777 | +static void | ||
| 778 | +draw_view(struct weston_view *ev, struct weston_output *output, | ||
| 779 | + pixman_region32_t *damage) /* in global coordinates */ | ||
| 780 | +{ | ||
| 781 | + struct weston_compositor *ec = ev->surface->compositor; | ||
| 782 | + struct g2d_output_state *go = get_output_state(output); | ||
| 783 | + struct g2d_surface_state *gs = get_surface_state(ev->surface); | ||
| 784 | + /* repaint bounding region in global coordinates: */ | ||
| 785 | + pixman_region32_t repaint; | ||
| 786 | + /* non-opaque region in surface coordinates: */ | ||
| 787 | + pixman_region32_t surface_blend; | ||
| 788 | + pixman_region32_t *buffer_damage; | ||
| 789 | + | ||
| 790 | + pixman_region32_init(&repaint); | ||
| 791 | + pixman_region32_intersect(&repaint, | ||
| 792 | + &ev->transform.boundingbox, damage); | ||
| 793 | + pixman_region32_subtract(&repaint, &repaint, &ev->clip); | ||
| 794 | + | ||
| 795 | + if (!pixman_region32_not_empty(&repaint)) | ||
| 796 | + goto out; | ||
| 797 | + | ||
| 798 | + buffer_damage = &go->buffer_damage[go->current_buffer]; | ||
| 799 | + pixman_region32_subtract(buffer_damage, buffer_damage, &repaint); | ||
| 800 | + | ||
| 801 | + /* blended region is whole surface minus opaque region: */ | ||
| 802 | + pixman_region32_init_rect(&surface_blend, 0, 0, | ||
| 803 | + ev->surface->width, ev->surface->height); | ||
| 804 | + pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque); | ||
| 805 | + | ||
| 806 | + struct g2d_renderer *gr = get_renderer(ec); | ||
| 807 | + if (pixman_region32_not_empty(&ev->surface->opaque)) { | ||
| 808 | + repaint_region(ev, output, go, &repaint, &ev->surface->opaque); | ||
| 809 | + } | ||
| 810 | + | ||
| 811 | + if (pixman_region32_not_empty(&surface_blend)) { | ||
| 812 | + g2d_enable(gr->handle,G2D_BLEND); | ||
| 813 | + if (ev->alpha < 1.0) | ||
| 814 | + { | ||
| 815 | + g2d_enable(gr->handle, G2D_GLOBAL_ALPHA); | ||
| 816 | + gs->g2d_surface.base.global_alpha = ev->alpha * 0xFF; | ||
| 817 | + } | ||
| 818 | + repaint_region(ev, output, go, &repaint, &surface_blend); | ||
| 819 | + g2d_disable(gr->handle, G2D_GLOBAL_ALPHA); | ||
| 820 | + g2d_disable(gr->handle, G2D_BLEND); | ||
| 821 | + } | ||
| 822 | + pixman_region32_fini(&surface_blend); | ||
| 823 | + | ||
| 824 | +out: | ||
| 825 | + pixman_region32_fini(&repaint); | ||
| 826 | +} | ||
| 827 | + | ||
| 828 | +static void | ||
| 829 | +repaint_views(struct weston_output *output, pixman_region32_t *damage) | ||
| 830 | +{ | ||
| 831 | + struct weston_compositor *compositor = output->compositor; | ||
| 832 | + struct weston_view *view; | ||
| 833 | + | ||
| 834 | + wl_list_for_each_reverse(view, &compositor->view_list, link) | ||
| 835 | + if (view->plane == &compositor->primary_plane) | ||
| 836 | + draw_view(view, output, damage); | ||
| 837 | +} | ||
| 838 | + | ||
| 839 | +static void | ||
| 840 | +g2d_renderer_repaint_output(struct weston_output *output, | ||
| 841 | + pixman_region32_t *output_damage) | ||
| 842 | +{ | ||
| 843 | + struct g2d_output_state *go = get_output_state(output); | ||
| 844 | + int i; | ||
| 845 | + | ||
| 846 | + use_output(output); | ||
| 847 | + for (i = 0; i < 2; i++) | ||
| 848 | + pixman_region32_union(&go->buffer_damage[i], | ||
| 849 | + &go->buffer_damage[i], | ||
| 850 | + output_damage); | ||
| 851 | + | ||
| 852 | + pixman_region32_union(output_damage, output_damage, | ||
| 853 | + &go->buffer_damage[go->current_buffer]); | ||
| 854 | + | ||
| 855 | + repaint_views(output, output_damage); | ||
| 856 | + | ||
| 857 | + pixman_region32_copy(&output->previous_damage, output_damage); | ||
| 858 | + wl_signal_emit(&output->frame_signal, output); | ||
| 859 | + copy_to_framebuffer(output); | ||
| 860 | + go->current_buffer ^= 1; | ||
| 861 | +} | ||
| 862 | + | ||
| 863 | +static void | ||
| 864 | +g2d_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer) | ||
| 865 | +{ | ||
| 866 | + gcsWL_VIV_BUFFER *vivBuffer = wl_resource_get_user_data(buffer->resource); | ||
| 867 | + struct g2d_surface_state *gs = get_surface_state(es); | ||
| 868 | + buffer->width = vivBuffer->width; | ||
| 869 | + buffer->height = vivBuffer->height; | ||
| 870 | + get_g2dSurface(vivBuffer, &gs->g2d_surface); | ||
| 871 | +} | ||
| 872 | + | ||
| 873 | +static void | ||
| 874 | +g2d_renderer_flush_damage(struct weston_surface *surface) | ||
| 875 | +{ | ||
| 876 | + struct g2d_surface_state *gs = get_surface_state(surface); | ||
| 877 | + struct weston_buffer *buffer = gs->buffer_ref.buffer; | ||
| 878 | + struct weston_view *view; | ||
| 879 | + int texture_used; | ||
| 880 | + pixman_region32_union(&gs->texture_damage, | ||
| 881 | + &gs->texture_damage, &surface->damage); | ||
| 882 | + | ||
| 883 | + if (!buffer) | ||
| 884 | + return; | ||
| 885 | + | ||
| 886 | + texture_used = 0; | ||
| 887 | + wl_list_for_each(view, &surface->views, surface_link) { | ||
| 888 | + if (view->plane == &surface->compositor->primary_plane) { | ||
| 889 | + texture_used = 1; | ||
| 890 | + break; | ||
| 891 | + } | ||
| 892 | + } | ||
| 893 | + if (!texture_used) | ||
| 894 | + return; | ||
| 895 | + | ||
| 896 | + if (!pixman_region32_not_empty(&gs->texture_damage)) | ||
| 897 | + goto done; | ||
| 898 | + | ||
| 899 | + if(wl_shm_buffer_get(buffer->resource)) | ||
| 900 | + { | ||
| 901 | + uint8_t *src = wl_shm_buffer_get_data(buffer->shm_buffer); | ||
| 902 | + uint8_t *dst = gs->shm_buf->buf_vaddr; | ||
| 903 | + int bpp = gs->bpp; | ||
| 904 | + wl_shm_buffer_begin_access(buffer->shm_buffer); | ||
| 905 | + if(gs->shm_buf) | ||
| 906 | + { | ||
| 907 | + int alignedWidth = (buffer->width + 15) & ~15; | ||
| 908 | + if(alignedWidth == buffer->width) | ||
| 909 | + { | ||
| 910 | + int size = wl_shm_buffer_get_stride(buffer->shm_buffer)*buffer->height; | ||
| 911 | + memcpy(dst, src, size); | ||
| 912 | + } | ||
| 913 | + else | ||
| 914 | + { | ||
| 915 | + int i, j; | ||
| 916 | + for (i = 0; i < buffer->height; i++) | ||
| 917 | + { | ||
| 918 | + for (j = 0; j < buffer->width; j++) | ||
| 919 | + { | ||
| 920 | + int dstOff = i * alignedWidth + j; | ||
| 921 | + int srcOff = (i * buffer->width + j); | ||
| 922 | + memcpy(dst + dstOff * bpp, src + srcOff * bpp, bpp); | ||
| 923 | + } | ||
| 924 | + } | ||
| 925 | + } | ||
| 926 | + g2d_cache_op(gs->shm_buf, G2D_CACHE_CLEAN); | ||
| 927 | + } | ||
| 928 | + else | ||
| 929 | + { | ||
| 930 | + weston_log("Error: This shm buffer was not attached\n"); | ||
| 931 | + } | ||
| 932 | + wl_shm_buffer_end_access(buffer->shm_buffer); | ||
| 933 | + } | ||
| 934 | + else | ||
| 935 | + { | ||
| 936 | + g2d_renderer_attach_egl(surface, buffer); | ||
| 937 | + } | ||
| 938 | + | ||
| 939 | +done: | ||
| 940 | + pixman_region32_fini(&gs->texture_damage); | ||
| 941 | + pixman_region32_init(&gs->texture_damage); | ||
| 942 | + | ||
| 943 | + weston_buffer_reference(&gs->buffer_ref, NULL); | ||
| 944 | +} | ||
| 945 | + | ||
| 946 | +static void | ||
| 947 | +g2d_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer, | ||
| 948 | + struct wl_shm_buffer *shm_buffer) | ||
| 949 | +{ | ||
| 950 | + struct g2d_surface_state *gs = get_surface_state(es); | ||
| 951 | + int stride = 0; | ||
| 952 | + int buffer_length = 0; | ||
| 953 | + int alloc_new_buff = 1; | ||
| 954 | + int alignedWidth = 0; | ||
| 955 | + enum g2d_format g2dFormat = 0; | ||
| 956 | + buffer->shm_buffer = shm_buffer; | ||
| 957 | + buffer->width = wl_shm_buffer_get_width(shm_buffer); | ||
| 958 | + buffer->height = wl_shm_buffer_get_height(shm_buffer); | ||
| 959 | + alignedWidth = (buffer->width + 15) & ~15; | ||
| 960 | + stride = wl_shm_buffer_get_stride(shm_buffer); | ||
| 961 | + buffer_length = stride * buffer->height; | ||
| 962 | + | ||
| 963 | + switch (wl_shm_buffer_get_format(shm_buffer)) { | ||
| 964 | + case WL_SHM_FORMAT_XRGB8888: | ||
| 965 | + g2dFormat = G2D_XRGB8888; | ||
| 966 | + gs->bpp = 4; | ||
| 967 | + break; | ||
| 968 | + case WL_SHM_FORMAT_ARGB8888: | ||
| 969 | + g2dFormat = G2D_ARGB8888; | ||
| 970 | + gs->bpp = 4; | ||
| 971 | + break; | ||
| 972 | + case WL_SHM_FORMAT_RGB565: | ||
| 973 | + g2dFormat = G2D_RGB565; | ||
| 974 | + gs->bpp = 2; | ||
| 975 | + break; | ||
| 976 | + default: | ||
| 977 | + weston_log("warning: unknown shm buffer format: %08x\n", | ||
| 978 | + wl_shm_buffer_get_format(shm_buffer)); | ||
| 979 | + return; | ||
| 980 | + } | ||
| 981 | + | ||
| 982 | + buffer_length = alignedWidth * buffer->height * gs->bpp; | ||
| 983 | + | ||
| 984 | + /* Only allocate a new g2d buff if it is larger than existing one.*/ | ||
| 985 | + gs->shm_buf_length = buffer_length; | ||
| 986 | + if(gs->shm_buf && gs->shm_buf->buf_size > buffer_length) | ||
| 987 | + { | ||
| 988 | + alloc_new_buff = 0; | ||
| 989 | + } | ||
| 990 | + | ||
| 991 | + if(alloc_new_buff) | ||
| 992 | + { | ||
| 993 | + if(gs->shm_buf) | ||
| 994 | + g2d_free(gs->shm_buf); | ||
| 995 | + gs->shm_buf = g2d_alloc(buffer_length, 1); | ||
| 996 | + gs->g2d_surface.base.planes[0] = gs->shm_buf->buf_paddr; | ||
| 997 | + } | ||
| 998 | + gs->g2d_surface.base.left = 0; | ||
| 999 | + gs->g2d_surface.base.top = 0; | ||
| 1000 | + gs->g2d_surface.base.right = buffer->width; | ||
| 1001 | + gs->g2d_surface.base.bottom = buffer->height; | ||
| 1002 | + gs->g2d_surface.base.stride = alignedWidth; | ||
| 1003 | + gs->g2d_surface.base.width = buffer->width; | ||
| 1004 | + gs->g2d_surface.base.height = buffer->height; | ||
| 1005 | + gs->g2d_surface.base.rot = G2D_ROTATION_0; | ||
| 1006 | + gs->g2d_surface.base.clrcolor = 0xFF400000; | ||
| 1007 | + gs->g2d_surface.tiling = G2D_LINEAR; | ||
| 1008 | + gs->g2d_surface.base.format = g2dFormat; | ||
| 1009 | +} | ||
| 1010 | + | ||
| 1011 | +static void | ||
| 1012 | +g2d_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) | ||
| 1013 | +{ | ||
| 1014 | + struct g2d_surface_state *gs = get_surface_state(es); | ||
| 1015 | + struct wl_shm_buffer *shm_buffer; | ||
| 1016 | + weston_buffer_reference(&gs->buffer_ref, buffer); | ||
| 1017 | + | ||
| 1018 | + if(buffer==NULL) | ||
| 1019 | + return; | ||
| 1020 | + | ||
| 1021 | + shm_buffer = wl_shm_buffer_get(buffer->resource); | ||
| 1022 | + | ||
| 1023 | + if(shm_buffer) | ||
| 1024 | + { | ||
| 1025 | + g2d_renderer_attach_shm(es, buffer, shm_buffer); | ||
| 1026 | + } | ||
| 1027 | + else | ||
| 1028 | + { | ||
| 1029 | + g2d_renderer_attach_egl(es, buffer); | ||
| 1030 | + } | ||
| 1031 | + gs->attached = 1; | ||
| 1032 | +} | ||
| 1033 | + | ||
| 1034 | +static void | ||
| 1035 | +surface_state_destroy(struct g2d_surface_state *gs, struct g2d_renderer *gr) | ||
| 1036 | +{ | ||
| 1037 | + wl_list_remove(&gs->surface_destroy_listener.link); | ||
| 1038 | + wl_list_remove(&gs->renderer_destroy_listener.link); | ||
| 1039 | + if(gs->surface) | ||
| 1040 | + gs->surface->renderer_state = NULL; | ||
| 1041 | + | ||
| 1042 | + if(gs->shm_buf) | ||
| 1043 | + { | ||
| 1044 | + g2d_free(gs->shm_buf); | ||
| 1045 | + gs->shm_buf = NULL; | ||
| 1046 | + } | ||
| 1047 | + | ||
| 1048 | + weston_buffer_reference(&gs->buffer_ref, NULL); | ||
| 1049 | + free(gs); | ||
| 1050 | +} | ||
| 1051 | + | ||
| 1052 | +static void | ||
| 1053 | +surface_state_handle_surface_destroy(struct wl_listener *listener, void *data) | ||
| 1054 | +{ | ||
| 1055 | + struct g2d_surface_state *gs; | ||
| 1056 | + struct g2d_renderer *gr; | ||
| 1057 | + | ||
| 1058 | + gs = container_of(listener, struct g2d_surface_state, | ||
| 1059 | + surface_destroy_listener); | ||
| 1060 | + | ||
| 1061 | + gr = get_renderer(gs->surface->compositor); | ||
| 1062 | + surface_state_destroy(gs, gr); | ||
| 1063 | +} | ||
| 1064 | + | ||
| 1065 | +static void | ||
| 1066 | +surface_state_handle_renderer_destroy(struct wl_listener *listener, void *data) | ||
| 1067 | +{ | ||
| 1068 | + struct g2d_surface_state *gs; | ||
| 1069 | + struct g2d_renderer *gr; | ||
| 1070 | + | ||
| 1071 | + gr = data; | ||
| 1072 | + | ||
| 1073 | + gs = container_of(listener, struct g2d_surface_state, | ||
| 1074 | + renderer_destroy_listener); | ||
| 1075 | + | ||
| 1076 | + surface_state_destroy(gs, gr); | ||
| 1077 | +} | ||
| 1078 | + | ||
| 1079 | + | ||
| 1080 | +static int | ||
| 1081 | +g2d_renderer_create_surface(struct weston_surface *surface) | ||
| 1082 | +{ | ||
| 1083 | + struct g2d_surface_state *gs; | ||
| 1084 | + struct g2d_renderer *gr = get_renderer(surface->compositor); | ||
| 1085 | + | ||
| 1086 | + gs = zalloc(sizeof *gs); | ||
| 1087 | + if (gs == NULL) | ||
| 1088 | + return -1; | ||
| 1089 | + | ||
| 1090 | + /* A buffer is never attached to solid color surfaces, yet | ||
| 1091 | + * they still go through texcoord computations. Do not divide | ||
| 1092 | + * by zero there. | ||
| 1093 | + */ | ||
| 1094 | + gs->pitch = 1; | ||
| 1095 | + | ||
| 1096 | + gs->surface = surface; | ||
| 1097 | + | ||
| 1098 | + pixman_region32_init(&gs->texture_damage); | ||
| 1099 | + surface->renderer_state = gs; | ||
| 1100 | + | ||
| 1101 | + gs->surface_destroy_listener.notify = | ||
| 1102 | + surface_state_handle_surface_destroy; | ||
| 1103 | + wl_signal_add(&surface->destroy_signal, | ||
| 1104 | + &gs->surface_destroy_listener); | ||
| 1105 | + | ||
| 1106 | + gs->renderer_destroy_listener.notify = | ||
| 1107 | + surface_state_handle_renderer_destroy; | ||
| 1108 | + wl_signal_add(&gr->destroy_signal, | ||
| 1109 | + &gs->renderer_destroy_listener); | ||
| 1110 | + | ||
| 1111 | + if (surface->buffer_ref.buffer) { | ||
| 1112 | + g2d_renderer_attach(surface, surface->buffer_ref.buffer); | ||
| 1113 | + g2d_renderer_flush_damage(surface); | ||
| 1114 | + } | ||
| 1115 | + | ||
| 1116 | + return 0; | ||
| 1117 | +} | ||
| 1118 | + | ||
| 1119 | +static void | ||
| 1120 | +g2d_renderer_surface_set_color(struct weston_surface *surface, | ||
| 1121 | + float red, float green, float blue, float alpha) | ||
| 1122 | +{ | ||
| 1123 | + struct g2d_surface_state *gs = get_surface_state(surface); | ||
| 1124 | + | ||
| 1125 | + gs->color[0] = red; | ||
| 1126 | + gs->color[1] = green; | ||
| 1127 | + gs->color[2] = blue; | ||
| 1128 | + gs->color[3] = alpha; | ||
| 1129 | +} | ||
| 1130 | + | ||
| 1131 | + | ||
| 1132 | +static void | ||
| 1133 | +g2d_renderer_output_destroy(struct weston_output *output) | ||
| 1134 | +{ | ||
| 1135 | + struct g2d_output_state *go = get_output_state(output); | ||
| 1136 | + gctUINT32 i; | ||
| 1137 | + | ||
| 1138 | + for (i = 0; i < 2; i++) | ||
| 1139 | + { | ||
| 1140 | + pixman_region32_fini(&go->buffer_damage[i]); | ||
| 1141 | + } | ||
| 1142 | + | ||
| 1143 | + if(go->offscreen_buf) | ||
| 1144 | + { | ||
| 1145 | + g2d_free(go->offscreen_buf); | ||
| 1146 | + go->offscreen_buf = NULL; | ||
| 1147 | + } | ||
| 1148 | + | ||
| 1149 | + if(go->fb_fd) | ||
| 1150 | + { | ||
| 1151 | + close(go->fb_fd); | ||
| 1152 | + go->fb_fd = 0; | ||
| 1153 | + } | ||
| 1154 | + | ||
| 1155 | + if(go->renderSurf) | ||
| 1156 | + { | ||
| 1157 | + free(go->renderSurf); | ||
| 1158 | + go->renderSurf = NULL; | ||
| 1159 | + } | ||
| 1160 | + | ||
| 1161 | + free(go); | ||
| 1162 | +} | ||
| 1163 | + | ||
| 1164 | +static void | ||
| 1165 | +g2d_renderer_destroy(struct weston_compositor *ec) | ||
| 1166 | +{ | ||
| 1167 | + struct g2d_renderer *gr = get_renderer(ec); | ||
| 1168 | + | ||
| 1169 | + wl_signal_emit(&gr->destroy_signal, gr); | ||
| 1170 | + wl_global_destroy(gr->viv_global); | ||
| 1171 | + g2d_close(gr->handle); | ||
| 1172 | + free(ec->renderer); | ||
| 1173 | + ec->renderer = NULL; | ||
| 1174 | +} | ||
| 1175 | + | ||
| 1176 | +static int | ||
| 1177 | +g2d_renderer_create(struct weston_compositor *ec) | ||
| 1178 | +{ | ||
| 1179 | + struct g2d_renderer *gr; | ||
| 1180 | + gr = malloc(sizeof *gr); | ||
| 1181 | + if (gr == NULL) | ||
| 1182 | + return -1; | ||
| 1183 | + | ||
| 1184 | + gr->base.read_pixels = g2d_renderer_read_pixels; | ||
| 1185 | + gr->base.repaint_output = g2d_renderer_repaint_output; | ||
| 1186 | + gr->base.flush_damage = g2d_renderer_flush_damage; | ||
| 1187 | + gr->base.attach = g2d_renderer_attach; | ||
| 1188 | + gr->base.surface_set_color = g2d_renderer_surface_set_color; | ||
| 1189 | + gr->base.destroy = g2d_renderer_destroy; | ||
| 1190 | + | ||
| 1191 | + if(g2d_open(&gr->handle)) | ||
| 1192 | + { | ||
| 1193 | + weston_log("g2d_open fail.\n"); | ||
| 1194 | + return -1; | ||
| 1195 | + } | ||
| 1196 | + ec->renderer = &gr->base; | ||
| 1197 | + wl_signal_init(&gr->destroy_signal); | ||
| 1198 | + return 0; | ||
| 1199 | +} | ||
| 1200 | + | ||
| 1201 | +static int | ||
| 1202 | +calculate_g2d_format(struct fb_var_screeninfo *varinfo, enum g2d_format *g2dFormat) | ||
| 1203 | +{ | ||
| 1204 | + /* Get the color format. */ | ||
| 1205 | + switch (varinfo->green.length) | ||
| 1206 | + { | ||
| 1207 | + case 6: | ||
| 1208 | + *g2dFormat= G2D_RGB565; | ||
| 1209 | + break; | ||
| 1210 | + | ||
| 1211 | + case 8: | ||
| 1212 | + if (varinfo->blue.offset == 0) | ||
| 1213 | + { | ||
| 1214 | + *g2dFormat = (varinfo->transp.length == 0) ? G2D_BGRX8888 : G2D_BGRA8888; | ||
| 1215 | + } | ||
| 1216 | + else | ||
| 1217 | + { | ||
| 1218 | + *g2dFormat = (varinfo->transp.length == 0) ? G2D_RGBX8888 : G2D_RGBA8888; | ||
| 1219 | + } | ||
| 1220 | + break; | ||
| 1221 | + | ||
| 1222 | + default: | ||
| 1223 | + *g2dFormat = -1; | ||
| 1224 | + break; | ||
| 1225 | + } | ||
| 1226 | + return 0; | ||
| 1227 | +} | ||
| 1228 | + | ||
| 1229 | +static int | ||
| 1230 | +get_G2dSurface_from_screeninfo(struct fb_screeninfo *info, struct g2d_surfaceEx* g2dSurface) | ||
| 1231 | +{ | ||
| 1232 | + if(info && g2dSurface) | ||
| 1233 | + { | ||
| 1234 | + g2dSurface->base.planes[0] = info->physical; | ||
| 1235 | + g2dSurface->base.left = 0; | ||
| 1236 | + g2dSurface->base.top = 0; | ||
| 1237 | + g2dSurface->base.right = info->x_resolution; | ||
| 1238 | + g2dSurface->base.bottom = info->y_resolution; | ||
| 1239 | + g2dSurface->base.stride = info->x_resolution; | ||
| 1240 | + g2dSurface->base.width = info->x_resolution; | ||
| 1241 | + g2dSurface->base.height = info->y_resolution; | ||
| 1242 | + g2dSurface->base.format = info->pixel_format; | ||
| 1243 | + g2dSurface->base.rot = G2D_ROTATION_0; | ||
| 1244 | + g2dSurface->base.clrcolor = 0xFF400000; | ||
| 1245 | + g2dSurface->tiling = G2D_LINEAR; | ||
| 1246 | + return 0; | ||
| 1247 | + } | ||
| 1248 | + return -1; | ||
| 1249 | +} | ||
| 1250 | + | ||
| 1251 | +static int | ||
| 1252 | +fb_query_screen_info(struct g2d_output_state *output, int fd, | ||
| 1253 | + struct fb_screeninfo *info) | ||
| 1254 | +{ | ||
| 1255 | + struct g2d_output_state *go = output; | ||
| 1256 | + struct fb_var_screeninfo *varinfo = &info->varinfo; | ||
| 1257 | + struct fb_fix_screeninfo *fixinfo = &info->fixinfo; | ||
| 1258 | + | ||
| 1259 | + /* Probe the device for screen information. */ | ||
| 1260 | + if (ioctl(fd, FBIOGET_VSCREENINFO, varinfo) < 0) { | ||
| 1261 | + return -1; | ||
| 1262 | + } | ||
| 1263 | + | ||
| 1264 | + if(go->nNumBuffers > 1){ | ||
| 1265 | + varinfo->yres_virtual = varinfo->yres * go->nNumBuffers; | ||
| 1266 | + if (ioctl(fd, FBIOPUT_VSCREENINFO, varinfo) < 0) | ||
| 1267 | + return -1; | ||
| 1268 | + } | ||
| 1269 | + | ||
| 1270 | + if (ioctl(fd, FBIOGET_FSCREENINFO, fixinfo) < 0 || | ||
| 1271 | + ioctl(fd, FBIOGET_VSCREENINFO, varinfo) < 0){ | ||
| 1272 | + return -1; | ||
| 1273 | + } | ||
| 1274 | + /* Store the pertinent data. */ | ||
| 1275 | + info->x_resolution = varinfo->xres; | ||
| 1276 | + info->y_resolution = varinfo->yres; | ||
| 1277 | + info->physical = fixinfo->smem_start; | ||
| 1278 | + info->buffer_length = fixinfo->smem_len; | ||
| 1279 | + calculate_g2d_format(varinfo, &info->pixel_format); | ||
| 1280 | + | ||
| 1281 | + if (info->pixel_format < 0) { | ||
| 1282 | + weston_log("Frame buffer uses an unsupported format.\n"); | ||
| 1283 | + return -1; | ||
| 1284 | + } | ||
| 1285 | + | ||
| 1286 | + return 0; | ||
| 1287 | +} | ||
| 1288 | + | ||
| 1289 | +static int | ||
| 1290 | +fb_frame_buffer_open(struct g2d_output_state *output, const char *fb_dev, | ||
| 1291 | + struct fb_screeninfo *screen_info) | ||
| 1292 | +{ | ||
| 1293 | + /* Open the frame buffer device. */ | ||
| 1294 | + output->fb_fd = open(fb_dev, O_RDWR | O_CLOEXEC); | ||
| 1295 | + if (output->fb_fd < 0) { | ||
| 1296 | + weston_log("Failed to open frame buffer device%s \n", fb_dev); | ||
| 1297 | + return -1; | ||
| 1298 | + } | ||
| 1299 | + | ||
| 1300 | + /* Grab the screen info. */ | ||
| 1301 | + if (fb_query_screen_info(output, output->fb_fd, screen_info) < 0) { | ||
| 1302 | + weston_log("Failed to get frame buffer info \n"); | ||
| 1303 | + | ||
| 1304 | + close(output->fb_fd); | ||
| 1305 | + return -1; | ||
| 1306 | + } | ||
| 1307 | + | ||
| 1308 | + return 0; | ||
| 1309 | +} | ||
| 1310 | + | ||
| 1311 | +static int | ||
| 1312 | +g2d_renderer_output_create(struct weston_output *output, struct wl_display *wl_display, const char *device) | ||
| 1313 | + | ||
| 1314 | + { | ||
| 1315 | + struct g2d_renderer *gr = get_renderer(output->compositor); | ||
| 1316 | + struct g2d_output_state *go; | ||
| 1317 | + int i = 0; | ||
| 1318 | + int offset = 0; | ||
| 1319 | + char *p = NULL; | ||
| 1320 | + go = zalloc(sizeof *go); | ||
| 1321 | + if (go == NULL) | ||
| 1322 | + return -1; | ||
| 1323 | + | ||
| 1324 | + output->renderer_state = go; | ||
| 1325 | + gr->viv_global = gcoOS_WaylandCreateVivGlobal(wl_display); | ||
| 1326 | + | ||
| 1327 | + p = getenv("FB_MULTI_BUFFER"); | ||
| 1328 | + if (p == gcvNULL) | ||
| 1329 | + { | ||
| 1330 | + go->nNumBuffers = 1; | ||
| 1331 | + } | ||
| 1332 | + else | ||
| 1333 | + { | ||
| 1334 | + go->nNumBuffers = atoi(p); | ||
| 1335 | + if (go->nNumBuffers < 1) | ||
| 1336 | + { | ||
| 1337 | + go->nNumBuffers = 1; | ||
| 1338 | + } | ||
| 1339 | + else if(go->nNumBuffers >= 2) | ||
| 1340 | + { | ||
| 1341 | + go->nNumBuffers = 2; | ||
| 1342 | + go->activebuffer = 1; | ||
| 1343 | + } | ||
| 1344 | + } | ||
| 1345 | + weston_log("FB_MULTI_BUFFER = %d\n", go->nNumBuffers); | ||
| 1346 | + | ||
| 1347 | + if(fb_frame_buffer_open(go, device, &go->fb_info) < 0) | ||
| 1348 | + { | ||
| 1349 | + weston_log("Open frame buffer failed.\n"); | ||
| 1350 | + return -1; | ||
| 1351 | + } | ||
| 1352 | + | ||
| 1353 | + go->renderSurf = zalloc(sizeof(struct g2d_surfaceEx) * go->nNumBuffers); | ||
| 1354 | + offset = go->fb_info.buffer_length/go->nNumBuffers; | ||
| 1355 | + for(i = 0; i < go->nNumBuffers; i++) | ||
| 1356 | + { | ||
| 1357 | + get_G2dSurface_from_screeninfo(&go->fb_info, &go->renderSurf[i]); | ||
| 1358 | + go->renderSurf[i].base.planes[0] = go->fb_info.physical | ||
| 1359 | + + (offset * i); | ||
| 1360 | + g2d_clear(gr->handle, &go->renderSurf[i].base); | ||
| 1361 | + } | ||
| 1362 | + | ||
| 1363 | + if(go->nNumBuffers == 1) | ||
| 1364 | + { | ||
| 1365 | + go->offscreenSurface = (go->renderSurf[go->activebuffer]); | ||
| 1366 | + go->offscreen_buf = g2d_alloc(go->fb_info.buffer_length, 0); | ||
| 1367 | + go->offscreenSurface.base.planes[0] = go->offscreen_buf->buf_paddr; | ||
| 1368 | + g2d_clear(gr->handle, &go->offscreenSurface.base); | ||
| 1369 | + } | ||
| 1370 | + | ||
| 1371 | + g2d_finish(gr->handle); | ||
| 1372 | + for (i = 0; i < 2; i++) | ||
| 1373 | + pixman_region32_init(&go->buffer_damage[i]); | ||
| 1374 | + return 0; | ||
| 1375 | + } | ||
| 1376 | + | ||
| 1377 | + WL_EXPORT struct g2d_renderer_interface g2d_renderer_interface = { | ||
| 1378 | + .create = g2d_renderer_create, | ||
| 1379 | + .output_create = g2d_renderer_output_create, | ||
| 1380 | + .output_destroy = g2d_renderer_output_destroy, | ||
| 1381 | +}; | ||
| 1382 | Index: weston-1.11.0/src/g2d-renderer.h | ||
| 1383 | =================================================================== | ||
| 1384 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 1385 | +++ weston-1.11.0/src/g2d-renderer.h 2016-10-06 14:28:47.000000000 -0500 | ||
| 1386 | @@ -0,0 +1,48 @@ | ||
| 1387 | +/* | ||
| 1388 | + * Copyright (c) 2015 Freescale Semiconductor, Inc. | ||
| 1389 | + * Copyright © 2013 Vasily Khoruzhick <anarsoul@gmail.com> | ||
| 1390 | + * | ||
| 1391 | + * Permission is hereby granted, free of charge, to any person obtaining | ||
| 1392 | + * a copy of this software and associated documentation files (the | ||
| 1393 | + * "Software"), to deal in the Software without restriction, including | ||
| 1394 | + * without limitation the rights to use, copy, modify, merge, publish, | ||
| 1395 | + * distribute, sublicense, and/or sell copies of the Software, and to | ||
| 1396 | + * permit persons to whom the Software is furnished to do so, subject to | ||
| 1397 | + * the following conditions: | ||
| 1398 | + * | ||
| 1399 | + * The above copyright notice and this permission notice (including the | ||
| 1400 | + * next paragraph) shall be included in all copies or substantial | ||
| 1401 | + * portions of the Software. | ||
| 1402 | + * | ||
| 1403 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 1404 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 1405 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 1406 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
| 1407 | + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
| 1408 | + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 1409 | + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 1410 | + * SOFTWARE. | ||
| 1411 | + */ | ||
| 1412 | +#ifndef __g2d_renderer_h_ | ||
| 1413 | +#define __g2d_renderer_h_ | ||
| 1414 | + | ||
| 1415 | +#include "compositor.h" | ||
| 1416 | +#ifdef ENABLE_EGL | ||
| 1417 | +#include <EGL/egl.h> | ||
| 1418 | +#else | ||
| 1419 | +#include <HAL/gc_hal_eglplatform.h> | ||
| 1420 | +#endif | ||
| 1421 | + | ||
| 1422 | + | ||
| 1423 | +struct g2d_renderer_interface { | ||
| 1424 | + | ||
| 1425 | + int (*create)(struct weston_compositor *ec); | ||
| 1426 | + | ||
| 1427 | + int (*output_create)(struct weston_output *output, | ||
| 1428 | + struct wl_display *wl_display, | ||
| 1429 | + const char *device); | ||
| 1430 | + | ||
| 1431 | + void (*output_destroy)(struct weston_output *output); | ||
| 1432 | +}; | ||
| 1433 | + | ||
| 1434 | +#endif | ||
| 1435 | Index: weston-1.11.0/src/gal2d-renderer.c | ||
| 1436 | =================================================================== | ||
| 1437 | --- weston-1.11.0.orig/src/gal2d-renderer.c 2016-10-06 14:26:20.678566959 -0500 | ||
| 1438 | +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 1439 | @@ -1,1307 +0,0 @@ | ||
| 1440 | -/* | ||
| 1441 | - * Copyright (c) 2015 Freescale Semiconductor, Inc. | ||
| 1442 | - * Copyright © 2012 Intel Corporation | ||
| 1443 | - * Copyright © 2015 Collabora, Ltd. | ||
| 1444 | - * | ||
| 1445 | - * Permission is hereby granted, free of charge, to any person obtaining | ||
| 1446 | - * a copy of this software and associated documentation files (the | ||
| 1447 | - * "Software"), to deal in the Software without restriction, including | ||
| 1448 | - * without limitation the rights to use, copy, modify, merge, publish, | ||
| 1449 | - * distribute, sublicense, and/or sell copies of the Software, and to | ||
| 1450 | - * permit persons to whom the Software is furnished to do so, subject to | ||
| 1451 | - * the following conditions: | ||
| 1452 | - * | ||
| 1453 | - * The above copyright notice and this permission notice (including the | ||
| 1454 | - * next paragraph) shall be included in all copies or substantial | ||
| 1455 | - * portions of the Software. | ||
| 1456 | - * | ||
| 1457 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 1458 | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 1459 | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 1460 | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
| 1461 | - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
| 1462 | - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 1463 | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 1464 | - * SOFTWARE. | ||
| 1465 | - */ | ||
| 1466 | - | ||
| 1467 | -#define _GNU_SOURCE | ||
| 1468 | - | ||
| 1469 | -#include <stdlib.h> | ||
| 1470 | -#include <string.h> | ||
| 1471 | -#include <ctype.h> | ||
| 1472 | -#include <float.h> | ||
| 1473 | -#include <assert.h> | ||
| 1474 | -#include <pthread.h> | ||
| 1475 | - | ||
| 1476 | -#include "compositor.h" | ||
| 1477 | -#include "gal2d-renderer.h" | ||
| 1478 | -#include "vertex-clipping.h" | ||
| 1479 | -#include "shared/helpers.h" | ||
| 1480 | -#include "HAL/gc_hal.h" | ||
| 1481 | -#include "HAL/gc_hal_raster.h" | ||
| 1482 | -#include "HAL/gc_hal_eglplatform.h" | ||
| 1483 | - | ||
| 1484 | -#define galONERROR(x) if(status < 0) printf("Error in function %s\n", __func__); | ||
| 1485 | - | ||
| 1486 | -struct gal2d_output_state { | ||
| 1487 | - | ||
| 1488 | - int current_buffer; | ||
| 1489 | - pixman_region32_t buffer_damage[2]; | ||
| 1490 | - NativeDisplayType display; | ||
| 1491 | - gcoSURF* renderSurf; | ||
| 1492 | - gctUINT32 nNumBuffers; | ||
| 1493 | - int activebuffer; | ||
| 1494 | - gcoSURF offscreenSurface; | ||
| 1495 | - gceSURF_FORMAT format; | ||
| 1496 | - pthread_mutex_t workerMutex; | ||
| 1497 | - pthread_t workerId; | ||
| 1498 | - gctUINT32 exitWorker; | ||
| 1499 | - gctSIGNAL signal; | ||
| 1500 | - gctSIGNAL busySignal; | ||
| 1501 | - gcsHAL_INTERFACE iface; | ||
| 1502 | - int directBlit; | ||
| 1503 | - gctINT width; | ||
| 1504 | - gctINT height; | ||
| 1505 | -}; | ||
| 1506 | - | ||
| 1507 | -struct gal2d_surface_state { | ||
| 1508 | - float color[4]; | ||
| 1509 | - struct weston_buffer_reference buffer_ref; | ||
| 1510 | - int pitch; /* in pixels */ | ||
| 1511 | - pixman_region32_t texture_damage; | ||
| 1512 | - gcoSURF gco_Surface; | ||
| 1513 | - | ||
| 1514 | - struct weston_surface *surface; | ||
| 1515 | - struct wl_listener surface_destroy_listener; | ||
| 1516 | - struct wl_listener renderer_destroy_listener; | ||
| 1517 | -}; | ||
| 1518 | - | ||
| 1519 | -struct gal2d_renderer { | ||
| 1520 | - struct weston_renderer base; | ||
| 1521 | - struct wl_signal destroy_signal; | ||
| 1522 | - gcoOS gcos; | ||
| 1523 | - gcoHAL gcoHal; | ||
| 1524 | - gco2D gcoEngine2d; | ||
| 1525 | - gctPOINTER localInfo; | ||
| 1526 | -}; | ||
| 1527 | - | ||
| 1528 | -static int | ||
| 1529 | -gal2d_renderer_create_surface(struct weston_surface *surface); | ||
| 1530 | - | ||
| 1531 | -static inline struct gal2d_surface_state * | ||
| 1532 | -get_surface_state(struct weston_surface *surface) | ||
| 1533 | -{ | ||
| 1534 | - if (!surface->renderer_state) | ||
| 1535 | - gal2d_renderer_create_surface(surface); | ||
| 1536 | - return (struct gal2d_surface_state *)surface->renderer_state; | ||
| 1537 | -} | ||
| 1538 | - | ||
| 1539 | -static inline struct gal2d_renderer * | ||
| 1540 | -get_renderer(struct weston_compositor *ec) | ||
| 1541 | -{ | ||
| 1542 | - return (struct gal2d_renderer *)ec->renderer; | ||
| 1543 | -} | ||
| 1544 | - | ||
| 1545 | - | ||
| 1546 | - | ||
| 1547 | -#define max(a, b) (((a) > (b)) ? (a) : (b)) | ||
| 1548 | -#define min(a, b) (((a) > (b)) ? (b) : (a)) | ||
| 1549 | -/* | ||
| 1550 | - * Compute the boundary vertices of the intersection of the global coordinate | ||
| 1551 | - * aligned rectangle 'rect', and an arbitrary quadrilateral produced from | ||
| 1552 | - * 'surf_rect' when transformed from surface coordinates into global coordinates. | ||
| 1553 | - * The vertices are written to 'ex' and 'ey', and the return value is the | ||
| 1554 | - * number of vertices. Vertices are produced in clockwise winding order. | ||
| 1555 | - * Guarantees to produce either zero vertices, or 3-8 vertices with non-zero | ||
| 1556 | - * polygon area. | ||
| 1557 | - */ | ||
| 1558 | -static int | ||
| 1559 | -calculate_edges(struct weston_view *ev, pixman_box32_t *rect, | ||
| 1560 | - pixman_box32_t *surf_rect, float *ex, float *ey) | ||
| 1561 | -{ | ||
| 1562 | - | ||
| 1563 | - struct clip_context ctx; | ||
| 1564 | - int i, n; | ||
| 1565 | - float min_x, max_x, min_y, max_y; | ||
| 1566 | - struct polygon8 surf = { | ||
| 1567 | - { surf_rect->x1, surf_rect->x2, surf_rect->x2, surf_rect->x1 }, | ||
| 1568 | - { surf_rect->y1, surf_rect->y1, surf_rect->y2, surf_rect->y2 }, | ||
| 1569 | - 4 | ||
| 1570 | - }; | ||
| 1571 | - | ||
| 1572 | - ctx.clip.x1 = rect->x1; | ||
| 1573 | - ctx.clip.y1 = rect->y1; | ||
| 1574 | - ctx.clip.x2 = rect->x2; | ||
| 1575 | - ctx.clip.y2 = rect->y2; | ||
| 1576 | - | ||
| 1577 | - /* transform surface to screen space: */ | ||
| 1578 | - for (i = 0; i < surf.n; i++) | ||
| 1579 | - weston_view_to_global_float(ev, surf.x[i], surf.y[i], | ||
| 1580 | - &surf.x[i], &surf.y[i]); | ||
| 1581 | - | ||
| 1582 | - /* find bounding box: */ | ||
| 1583 | - min_x = max_x = surf.x[0]; | ||
| 1584 | - min_y = max_y = surf.y[0]; | ||
| 1585 | - | ||
| 1586 | - for (i = 1; i < surf.n; i++) { | ||
| 1587 | - min_x = min(min_x, surf.x[i]); | ||
| 1588 | - max_x = max(max_x, surf.x[i]); | ||
| 1589 | - min_y = min(min_y, surf.y[i]); | ||
| 1590 | - max_y = max(max_y, surf.y[i]); | ||
| 1591 | - } | ||
| 1592 | - | ||
| 1593 | - /* First, simple bounding box check to discard early transformed | ||
| 1594 | - * surface rects that do not intersect with the clip region: | ||
| 1595 | - */ | ||
| 1596 | - if ((min_x >= ctx.clip.x2) || (max_x <= ctx.clip.x1) || | ||
| 1597 | - (min_y >= ctx.clip.y2) || (max_y <= ctx.clip.y1)) | ||
| 1598 | - return 0; | ||
| 1599 | - | ||
| 1600 | - /* Simple case, bounding box edges are parallel to surface edges, | ||
| 1601 | - * there will be only four edges. We just need to clip the surface | ||
| 1602 | - * vertices to the clip rect bounds: | ||
| 1603 | - */ | ||
| 1604 | - if (!ev->transform.enabled) | ||
| 1605 | - return clip_simple(&ctx, &surf, ex, ey); | ||
| 1606 | - | ||
| 1607 | - /* Transformed case: use a general polygon clipping algorithm to | ||
| 1608 | - * clip the surface rectangle with each side of 'rect'. | ||
| 1609 | - * The algorithm is Sutherland-Hodgman, as explained in | ||
| 1610 | - * http://www.codeguru.com/cpp/misc/misc/graphics/article.php/c8965/Polygon-Clipping.htm | ||
| 1611 | - * but without looking at any of that code. | ||
| 1612 | - */ | ||
| 1613 | - n = clip_transformed(&ctx, &surf, ex, ey); | ||
| 1614 | - | ||
| 1615 | - if (n < 3) | ||
| 1616 | - return 0; | ||
| 1617 | - | ||
| 1618 | - return n; | ||
| 1619 | -} | ||
| 1620 | - | ||
| 1621 | - | ||
| 1622 | -static inline struct gal2d_output_state * | ||
| 1623 | -get_output_state(struct weston_output *output) | ||
| 1624 | -{ | ||
| 1625 | - return (struct gal2d_output_state *)output->renderer_state; | ||
| 1626 | -} | ||
| 1627 | - | ||
| 1628 | -static gceSTATUS | ||
| 1629 | -gal2d_getSurfaceFormat(halDISPLAY_INFO info, gceSURF_FORMAT * Format) | ||
| 1630 | -{ | ||
| 1631 | - /* Get the color format. */ | ||
| 1632 | - switch (info.greenLength) | ||
| 1633 | - { | ||
| 1634 | - case 4: | ||
| 1635 | - if (info.blueOffset == 0) | ||
| 1636 | - { | ||
| 1637 | - *Format = (info.alphaLength == 0) ? gcvSURF_X4R4G4B4 : gcvSURF_A4R4G4B4; | ||
| 1638 | - } | ||
| 1639 | - else | ||
| 1640 | - { | ||
| 1641 | - *Format = (info.alphaLength == 0) ? gcvSURF_X4B4G4R4 : gcvSURF_A4B4G4R4; | ||
| 1642 | - } | ||
| 1643 | - break; | ||
| 1644 | - | ||
| 1645 | - case 5: | ||
| 1646 | - if (info.blueOffset == 0) | ||
| 1647 | - { | ||
| 1648 | - *Format = (info.alphaLength == 0) ? gcvSURF_X1R5G5B5 : gcvSURF_A1R5G5B5; | ||
| 1649 | - } | ||
| 1650 | - else | ||
| 1651 | - { | ||
| 1652 | - *Format = (info.alphaLength == 0) ? gcvSURF_X1B5G5R5 : gcvSURF_A1B5G5R5; | ||
| 1653 | - } | ||
| 1654 | - break; | ||
| 1655 | - | ||
| 1656 | - case 6: | ||
| 1657 | - *Format = gcvSURF_R5G6B5; | ||
| 1658 | - break; | ||
| 1659 | - | ||
| 1660 | - case 8: | ||
| 1661 | - if (info.blueOffset == 0) | ||
| 1662 | - { | ||
| 1663 | - *Format = (info.alphaLength == 0) ? gcvSURF_X8R8G8B8 : gcvSURF_A8R8G8B8; | ||
| 1664 | - } | ||
| 1665 | - else | ||
| 1666 | - { | ||
| 1667 | - *Format = (info.alphaLength == 0) ? gcvSURF_X8B8G8R8 : gcvSURF_A8B8G8R8; | ||
| 1668 | - } | ||
| 1669 | - break; | ||
| 1670 | - | ||
| 1671 | - default: | ||
| 1672 | - /* Unsupported color depth. */ | ||
| 1673 | - return gcvSTATUS_INVALID_ARGUMENT; | ||
| 1674 | - } | ||
| 1675 | - /* Success. */ | ||
| 1676 | - return gcvSTATUS_OK; | ||
| 1677 | -} | ||
| 1678 | - | ||
| 1679 | -static gceSTATUS galIsYUVFormat(IN gceSURF_FORMAT Format) | ||
| 1680 | -{ | ||
| 1681 | - switch (Format) | ||
| 1682 | - { | ||
| 1683 | - case gcvSURF_YUY2: | ||
| 1684 | - case gcvSURF_UYVY: | ||
| 1685 | - case gcvSURF_I420: | ||
| 1686 | - case gcvSURF_YV12: | ||
| 1687 | - case gcvSURF_NV16: | ||
| 1688 | - case gcvSURF_NV12: | ||
| 1689 | - case gcvSURF_NV61: | ||
| 1690 | - case gcvSURF_NV21: | ||
| 1691 | - | ||
| 1692 | - return gcvSTATUS_TRUE; | ||
| 1693 | - | ||
| 1694 | - default: | ||
| 1695 | - return gcvSTATUS_FALSE; | ||
| 1696 | - } | ||
| 1697 | -} | ||
| 1698 | - | ||
| 1699 | -static gceSTATUS galQueryUVStride( | ||
| 1700 | - IN gceSURF_FORMAT Format, | ||
| 1701 | - IN gctUINT32 yStride, | ||
| 1702 | - OUT gctUINT32_PTR uStride, | ||
| 1703 | - OUT gctUINT32_PTR vStride | ||
| 1704 | - ) | ||
| 1705 | -{ | ||
| 1706 | - switch (Format) | ||
| 1707 | - { | ||
| 1708 | - case gcvSURF_YUY2: | ||
| 1709 | - case gcvSURF_UYVY: | ||
| 1710 | - *uStride = *vStride = 0; | ||
| 1711 | - break; | ||
| 1712 | - | ||
| 1713 | - case gcvSURF_I420: | ||
| 1714 | - case gcvSURF_YV12: | ||
| 1715 | - *uStride = *vStride = yStride / 2; | ||
| 1716 | - break; | ||
| 1717 | - | ||
| 1718 | - case gcvSURF_NV16: | ||
| 1719 | - case gcvSURF_NV12: | ||
| 1720 | - case gcvSURF_NV61: | ||
| 1721 | - case gcvSURF_NV21: | ||
| 1722 | - | ||
| 1723 | - *uStride = yStride; | ||
| 1724 | - *vStride = 0; | ||
| 1725 | - break; | ||
| 1726 | - | ||
| 1727 | - default: | ||
| 1728 | - return gcvSTATUS_NOT_SUPPORTED; | ||
| 1729 | - } | ||
| 1730 | - | ||
| 1731 | - return gcvSTATUS_OK; | ||
| 1732 | -} | ||
| 1733 | - | ||
| 1734 | -static int | ||
| 1735 | -make_current(struct gal2d_renderer *gr, gcoSURF surface) | ||
| 1736 | -{ | ||
| 1737 | - gceSTATUS status = gcvSTATUS_OK; | ||
| 1738 | - gctUINT width = 0; | ||
| 1739 | - gctUINT height = 0; | ||
| 1740 | - gctINT stride = 0; | ||
| 1741 | - gctUINT32 physical[3]; | ||
| 1742 | - gctPOINTER va =0; | ||
| 1743 | - gceSURF_FORMAT format; | ||
| 1744 | - | ||
| 1745 | - if(!surface) | ||
| 1746 | - goto OnError; | ||
| 1747 | - | ||
| 1748 | - | ||
| 1749 | - gcmONERROR(gcoSURF_GetAlignedSize(surface, &width, &height, &stride)); | ||
| 1750 | - gcmONERROR(gcoSURF_GetFormat(surface, gcvNULL, &format)); | ||
| 1751 | - gcmONERROR(gcoSURF_Lock(surface, &physical[0], (gctPOINTER *)&va)); | ||
| 1752 | - gco2D_SetGenericTarget(gr->gcoEngine2d, | ||
| 1753 | - &physical[0], 1, | ||
| 1754 | - &stride, 1, | ||
| 1755 | - gcvLINEAR, format, | ||
| 1756 | - gcvSURF_0_DEGREE, width, height); | ||
| 1757 | - | ||
| 1758 | - gcmONERROR(gcoSURF_Unlock(surface, (gctPOINTER *)&va)); | ||
| 1759 | -OnError: | ||
| 1760 | - galONERROR(status); | ||
| 1761 | - return status; | ||
| 1762 | -} | ||
| 1763 | - | ||
| 1764 | -static gceSTATUS | ||
| 1765 | -gal2d_clear(struct weston_output *base) | ||
| 1766 | -{ | ||
| 1767 | - struct gal2d_renderer *gr = get_renderer(base->compositor); | ||
| 1768 | - struct gal2d_output_state *go = get_output_state(base); | ||
| 1769 | - gceSTATUS status = gcvSTATUS_OK; | ||
| 1770 | - | ||
| 1771 | - gctINT stride = 0; | ||
| 1772 | - gctUINT width = 0, height = 0; | ||
| 1773 | - gcsRECT dstRect = {0}; | ||
| 1774 | - gcmONERROR(gcoSURF_GetAlignedSize(go->renderSurf[go->activebuffer], | ||
| 1775 | - &width, &height, &stride)); | ||
| 1776 | - dstRect.right = width; | ||
| 1777 | - dstRect.bottom = height; | ||
| 1778 | - gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect)); | ||
| 1779 | - gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect)); | ||
| 1780 | - gcmONERROR(gco2D_Clear(gr->gcoEngine2d, 1, &dstRect, 0xff0000ff, 0xCC, 0xCC, go->format)); | ||
| 1781 | - gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvTRUE)); | ||
| 1782 | - | ||
| 1783 | -OnError: | ||
| 1784 | - galONERROR(status); | ||
| 1785 | - | ||
| 1786 | - return status; | ||
| 1787 | -} | ||
| 1788 | - | ||
| 1789 | -static gcoSURF getSurfaceFromShm(struct weston_surface *es, struct weston_buffer *buffer) | ||
| 1790 | -{ | ||
| 1791 | - struct gal2d_renderer *gr = get_renderer(es->compositor); | ||
| 1792 | - | ||
| 1793 | - gcoSURF surface = 0; | ||
| 1794 | - gceSURF_FORMAT format; | ||
| 1795 | - gcePOOL pool = gcvPOOL_DEFAULT; | ||
| 1796 | - | ||
| 1797 | - if (wl_shm_buffer_get_format(buffer->shm_buffer) == WL_SHM_FORMAT_XRGB8888) | ||
| 1798 | - format = gcvSURF_X8R8G8B8; | ||
| 1799 | - else | ||
| 1800 | - format = gcvSURF_A8R8G8B8; | ||
| 1801 | - | ||
| 1802 | - if(buffer->width == ((buffer->width + 0x7) & ~0x7)) | ||
| 1803 | - { | ||
| 1804 | - pool = gcvPOOL_USER; | ||
| 1805 | - } | ||
| 1806 | - | ||
| 1807 | - gcmVERIFY_OK(gcoSURF_Construct(gr->gcoHal, | ||
| 1808 | - (gctUINT) buffer->width, | ||
| 1809 | - (gctUINT) buffer->height, | ||
| 1810 | - 1, gcvSURF_BITMAP, | ||
| 1811 | - format, pool, &surface)); | ||
| 1812 | - | ||
| 1813 | - if(pool == gcvPOOL_USER) | ||
| 1814 | - { | ||
| 1815 | - gcmVERIFY_OK(gcoSURF_MapUserSurface(surface, 1, | ||
| 1816 | - (gctPOINTER)wl_shm_buffer_get_data(buffer->shm_buffer), gcvINVALID_ADDRESS)); | ||
| 1817 | - } | ||
| 1818 | - | ||
| 1819 | - return surface; | ||
| 1820 | -} | ||
| 1821 | - | ||
| 1822 | -static int | ||
| 1823 | -gal2dBindBuffer(struct weston_surface* es) | ||
| 1824 | -{ | ||
| 1825 | - struct gal2d_surface_state *gs = get_surface_state(es); | ||
| 1826 | - gceSTATUS status = gcvSTATUS_OK; | ||
| 1827 | - gcoSURF surface = gs->gco_Surface; | ||
| 1828 | - struct weston_buffer *buffer = gs->buffer_ref.buffer; | ||
| 1829 | - gcePOOL pool = gcvPOOL_DEFAULT; | ||
| 1830 | - | ||
| 1831 | - gcmVERIFY_OK(gcoSURF_QueryVidMemNode(surface, gcvNULL, | ||
| 1832 | - &pool, gcvNULL)); | ||
| 1833 | - | ||
| 1834 | - if(pool != gcvPOOL_USER) | ||
| 1835 | - { | ||
| 1836 | - gctUINT alignedWidth; | ||
| 1837 | - gctPOINTER logical = (gctPOINTER)wl_shm_buffer_get_data(buffer->shm_buffer); | ||
| 1838 | - gctPOINTER va =0; | ||
| 1839 | - | ||
| 1840 | - | ||
| 1841 | - gcmVERIFY_OK(gcoSURF_GetAlignedSize(surface, &alignedWidth, gcvNULL, gcvNULL)); | ||
| 1842 | - gcmVERIFY_OK(gcoSURF_Lock(surface, gcvNULL, (gctPOINTER *)&va)); | ||
| 1843 | - | ||
| 1844 | - if(alignedWidth == (unsigned int)buffer->width) | ||
| 1845 | - { | ||
| 1846 | - int size = wl_shm_buffer_get_stride(buffer->shm_buffer)*buffer->height; | ||
| 1847 | - memcpy(va, logical, size); | ||
| 1848 | - } | ||
| 1849 | - else | ||
| 1850 | - { | ||
| 1851 | - int i, j; | ||
| 1852 | - for (i = 0; i < buffer->height; i++) | ||
| 1853 | - { | ||
| 1854 | - for (j = 0; j < buffer->width; j++) | ||
| 1855 | - { | ||
| 1856 | - gctUINT dstOff = i * alignedWidth + j; | ||
| 1857 | - gctUINT srcOff = (i * buffer->width + j); | ||
| 1858 | - | ||
| 1859 | - memcpy(va + dstOff * 4, logical + srcOff * 4, 4); | ||
| 1860 | - } | ||
| 1861 | - } | ||
| 1862 | - } | ||
| 1863 | - gcmVERIFY_OK(gcoSURF_Unlock(surface, (gctPOINTER)va)); | ||
| 1864 | - } | ||
| 1865 | - | ||
| 1866 | - return status; | ||
| 1867 | -} | ||
| 1868 | - | ||
| 1869 | -static void | ||
| 1870 | -gal2d_flip_surface(struct weston_output *output) | ||
| 1871 | -{ | ||
| 1872 | - struct gal2d_output_state *go = get_output_state(output); | ||
| 1873 | - | ||
| 1874 | - if(go->nNumBuffers > 1) | ||
| 1875 | - { | ||
| 1876 | - gctUINT Offset; | ||
| 1877 | - gctINT X; | ||
| 1878 | - gctINT Y; | ||
| 1879 | - | ||
| 1880 | - gcmVERIFY_OK(gcoOS_GetDisplayBackbuffer(go->display, gcvNULL, | ||
| 1881 | - gcvNULL, gcvNULL, &Offset, &X, &Y)); | ||
| 1882 | - | ||
| 1883 | - gcmVERIFY_OK(gcoOS_SetDisplayVirtual(go->display, gcvNULL, | ||
| 1884 | - Offset, X, Y)); | ||
| 1885 | - } | ||
| 1886 | -} | ||
| 1887 | - | ||
| 1888 | -static void *gal2d_output_worker(void *arg) | ||
| 1889 | -{ | ||
| 1890 | - struct weston_output *output = (struct weston_output *)arg; | ||
| 1891 | - struct gal2d_output_state *go = get_output_state(output); | ||
| 1892 | - | ||
| 1893 | - while(1) | ||
| 1894 | - { | ||
| 1895 | - if(gcoOS_WaitSignal(gcvNULL, go->signal, gcvINFINITE) == gcvSTATUS_OK ) | ||
| 1896 | - { | ||
| 1897 | - gal2d_flip_surface(output); | ||
| 1898 | - gcoOS_Signal(gcvNULL,go->busySignal, gcvTRUE); | ||
| 1899 | - } | ||
| 1900 | - pthread_mutex_lock(&go->workerMutex); | ||
| 1901 | - if(go->exitWorker == 1) | ||
| 1902 | - { | ||
| 1903 | - pthread_mutex_unlock(&go->workerMutex); | ||
| 1904 | - break; | ||
| 1905 | - } | ||
| 1906 | - pthread_mutex_unlock(&go->workerMutex); | ||
| 1907 | - } | ||
| 1908 | - return 0; | ||
| 1909 | -} | ||
| 1910 | - | ||
| 1911 | -static int | ||
| 1912 | -update_surface(struct weston_output *output) | ||
| 1913 | -{ | ||
| 1914 | - struct gal2d_renderer *gr = get_renderer(output->compositor); | ||
| 1915 | - struct gal2d_output_state *go = get_output_state(output); | ||
| 1916 | - gceSTATUS status = gcvSTATUS_OK; | ||
| 1917 | - | ||
| 1918 | - if(go->nNumBuffers == 1) | ||
| 1919 | - { | ||
| 1920 | - if(!go->directBlit && go->offscreenSurface) | ||
| 1921 | - { | ||
| 1922 | - make_current(gr, go->renderSurf[go->activebuffer]); | ||
| 1923 | - | ||
| 1924 | - gctUINT srcWidth = 0; | ||
| 1925 | - gctUINT srcHeight = 0; | ||
| 1926 | - gceSURF_FORMAT srcFormat;; | ||
| 1927 | - gcsRECT dstRect = {0}; | ||
| 1928 | - gcoSURF srcSurface = go->offscreenSurface; | ||
| 1929 | - gctUINT32 srcPhyAddr[3]; | ||
| 1930 | - gctUINT32 srcStride[3]; | ||
| 1931 | - | ||
| 1932 | - gctPOINTER va =0; | ||
| 1933 | - | ||
| 1934 | - gcmONERROR(gcoSURF_GetAlignedSize(srcSurface, &srcWidth, &srcHeight, (gctINT *)&srcStride[0])); | ||
| 1935 | - gcmONERROR(gcoSURF_GetFormat(srcSurface, gcvNULL, &srcFormat)); | ||
| 1936 | - | ||
| 1937 | - gcmONERROR(gcoSURF_Lock(srcSurface, srcPhyAddr, (gctPOINTER *)&va)); | ||
| 1938 | - gcmONERROR(gco2D_SetCurrentSourceIndex(gr->gcoEngine2d, 0U)); | ||
| 1939 | - | ||
| 1940 | - gco2D_SetGenericSource(gr->gcoEngine2d, srcPhyAddr, 1, | ||
| 1941 | - srcStride, 1, | ||
| 1942 | - gcvLINEAR, srcFormat, gcvSURF_0_DEGREE, | ||
| 1943 | - srcWidth, srcHeight); | ||
| 1944 | - | ||
| 1945 | - dstRect.left = 0; | ||
| 1946 | - dstRect.top = 0; | ||
| 1947 | - dstRect.right = srcWidth; | ||
| 1948 | - dstRect.bottom = srcHeight; | ||
| 1949 | - | ||
| 1950 | - gcmONERROR(gco2D_SetSource(gr->gcoEngine2d, &dstRect)); | ||
| 1951 | - gcmONERROR(gco2D_SetClipping(gr->gcoEngine2d, &dstRect)); | ||
| 1952 | - gcmONERROR(gco2D_Blit(gr->gcoEngine2d, 1, &dstRect, 0xCC, 0xCC, go->format)); | ||
| 1953 | - gcmONERROR(gcoSURF_Unlock(srcSurface, (gctPOINTER *)&va)); | ||
| 1954 | - } | ||
| 1955 | - gcmONERROR(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
| 1956 | - } | ||
| 1957 | - else if(go->nNumBuffers > 1) | ||
| 1958 | - { | ||
| 1959 | - gcoHAL_ScheduleEvent(gr->gcoHal, &go->iface); | ||
| 1960 | - gcmVERIFY_OK(gcoHAL_Commit(gr->gcoHal, gcvFALSE)); | ||
| 1961 | - } | ||
| 1962 | -OnError: | ||
| 1963 | - galONERROR(status); | ||
| 1964 | - return status; | ||
| 1965 | - } | ||
| 1966 | - | ||
| 1967 | -static int | ||
| 1968 | -is_view_visible(struct weston_view *view) | ||
| 1969 | -{ | ||
| 1970 | - /* Return false, if surface is guaranteed to be totally obscured. */ | ||
| 1971 | - int ret; | ||
| 1972 | - pixman_region32_t unocc; | ||
| 1973 | - | ||
| 1974 | - pixman_region32_init(&unocc); | ||
| 1975 | - pixman_region32_subtract(&unocc, &view->transform.boundingbox, | ||
| 1976 | - &view->clip); | ||
| 1977 | - ret = pixman_region32_not_empty(&unocc); | ||
| 1978 | - pixman_region32_fini(&unocc); | ||
| 1979 | - | ||
| 1980 | - return ret; | ||
| 1981 | -} | ||
| 1982 | - | ||
| 1983 | -static int | ||
| 1984 | -use_output(struct weston_output *output) | ||
| 1985 | -{ | ||
| 1986 | - struct weston_compositor *compositor = output->compositor; | ||
| 1987 | - struct weston_view *view; | ||
| 1988 | - struct gal2d_output_state *go = get_output_state(output); | ||
| 1989 | - struct gal2d_renderer *gr = get_renderer(output->compositor); | ||
| 1990 | - gceSTATUS status = gcvSTATUS_OK; | ||
| 1991 | - | ||
| 1992 | - gcoSURF surface; | ||
| 1993 | - int visibleViews=0; | ||
| 1994 | - int fullscreenViews=0; | ||
| 1995 | - | ||
| 1996 | - surface = go->renderSurf[go->activebuffer]; | ||
| 1997 | - if(go->nNumBuffers == 1) | ||
| 1998 | - { | ||
| 1999 | - wl_list_for_each_reverse(view, &compositor->view_list, link) | ||
| 2000 | - if (view->plane == &compositor->primary_plane && is_view_visible(view)) | ||
| 2001 | - { | ||
| 2002 | - visibleViews++; | ||
| 2003 | - if(view->surface->width == go->width && view->surface->height == go->height) | ||
| 2004 | - { | ||
| 2005 | - pixman_box32_t *bb_rects; | ||
| 2006 | - int nbb=0; | ||
| 2007 | - bb_rects = pixman_region32_rectangles(&view->transform.boundingbox, &nbb); | ||
| 2008 | - if(nbb == 1) | ||
| 2009 | - if(bb_rects[0].x1 == 0 && bb_rects[0].y1 ==0) | ||
| 2010 | - fullscreenViews++; | ||
| 2011 | - } | ||
| 2012 | - } | ||
| 2013 | - | ||
| 2014 | - go->directBlit = ((visibleViews == 1) || (fullscreenViews > 1)); | ||
| 2015 | - | ||
| 2016 | - if(!go->directBlit) | ||
| 2017 | - { | ||
| 2018 | - surface = go->offscreenSurface; | ||
| 2019 | - } | ||
| 2020 | - } | ||
| 2021 | - make_current(gr, surface); | ||
| 2022 | - return status; | ||
| 2023 | -} | ||
| 2024 | - | ||
| 2025 | -static int | ||
| 2026 | -gal2d_renderer_read_pixels(struct weston_output *output, | ||
| 2027 | - pixman_format_code_t format, void *pixels, | ||
| 2028 | - uint32_t x, uint32_t y, | ||
| 2029 | - uint32_t width, uint32_t height) | ||
| 2030 | -{ | ||
| 2031 | - return 0; | ||
| 2032 | -} | ||
| 2033 | - | ||
| 2034 | -static int gal2d_int_from_double(double d) | ||
| 2035 | -{ | ||
| 2036 | - return wl_fixed_to_int(wl_fixed_from_double(d)); | ||
| 2037 | -} | ||
| 2038 | - | ||
| 2039 | -static void | ||
| 2040 | -repaint_region(struct weston_view *ev, struct weston_output *output, struct gal2d_output_state *go, pixman_region32_t *region, | ||
| 2041 | - pixman_region32_t *surf_region){ | ||
| 2042 | - | ||
| 2043 | - struct gal2d_renderer *gr = get_renderer(ev->surface->compositor); | ||
| 2044 | - struct gal2d_surface_state *gs = get_surface_state(ev->surface); | ||
| 2045 | - | ||
| 2046 | - pixman_box32_t *rects, *surf_rects, *bb_rects; | ||
| 2047 | - int i, j, nrects, nsurf, nbb=0; | ||
| 2048 | - gceSTATUS status = gcvSTATUS_OK; | ||
| 2049 | - gcoSURF srcSurface = gs->gco_Surface; | ||
| 2050 | - gcsRECT srcRect = {0}; | ||
| 2051 | - gcsRECT dstrect = {0}; | ||
| 2052 | - gctUINT32 horFactor, verFactor; | ||
| 2053 | - int useFilterBlit = 0; | ||
| 2054 | - gctUINT srcWidth = 0; | ||
| 2055 | - gctUINT srcHeight = 0; | ||
| 2056 | - gctUINT32 srcStride[3]; | ||
| 2057 | - gceSURF_FORMAT srcFormat; | ||
| 2058 | - gctUINT32 srcPhyAddr[3]; | ||
| 2059 | - gctUINT32 dstPhyAddr[3]; | ||
| 2060 | - gctUINT dstWidth = 0; | ||
| 2061 | - gctUINT dstHeight = 0; | ||
| 2062 | - gctUINT32 dstStrides[3]; | ||
| 2063 | - gcoSURF dstsurface; | ||
| 2064 | - int geoWidth = ev->surface->width; | ||
| 2065 | - int geoheight = ev->surface->height; | ||
| 2066 | - gceTILING tiling; | ||
| 2067 | - | ||
| 2068 | - bb_rects = pixman_region32_rectangles(&ev->transform.boundingbox, &nbb); | ||
| 2069 | - | ||
| 2070 | - if(!srcSurface || nbb <= 0) | ||
| 2071 | - goto OnError; | ||
| 2072 | - rects = pixman_region32_rectangles(region, &nrects); | ||
| 2073 | - surf_rects = pixman_region32_rectangles(surf_region, &nsurf); | ||
| 2074 | - | ||
| 2075 | - gcmVERIFY_OK(gcoSURF_GetAlignedSize(srcSurface, &srcWidth, &srcHeight, (gctINT *)&srcStride[0])); | ||
| 2076 | - | ||
| 2077 | - gcmVERIFY_OK(gcoSURF_GetFormat(srcSurface, gcvNULL, &srcFormat)); | ||
| 2078 | - | ||
| 2079 | - if(galIsYUVFormat(srcFormat) == gcvSTATUS_TRUE) | ||
| 2080 | - { | ||
| 2081 | - useFilterBlit = 1; | ||
| 2082 | - } | ||
| 2083 | - | ||
| 2084 | - gcmVERIFY_OK(gcoSURF_Lock(srcSurface, &srcPhyAddr[0], gcvNULL)); | ||
| 2085 | - | ||
| 2086 | - gcmVERIFY_OK(gcoSURF_Unlock(srcSurface, gcvNULL)); | ||
| 2087 | - | ||
| 2088 | - srcRect.left = ev->geometry.x < 0.0 ? gal2d_int_from_double(fabsf(ev->geometry.x)) : 0; | ||
| 2089 | - srcRect.top = 0; /*es->geometry.y < 0.0 ? gal2d_int_from_double(fabsf(es->geometry.y)) : 0;*/ | ||
| 2090 | - srcRect.right = ev->surface->width; | ||
| 2091 | - srcRect.bottom = ev->surface->height; | ||
| 2092 | - | ||
| 2093 | - dstsurface = go->nNumBuffers > 1 ? | ||
| 2094 | - go->renderSurf[go->activebuffer] : | ||
| 2095 | - go->offscreenSurface; | ||
| 2096 | - gcmVERIFY_OK(gcoSURF_GetAlignedSize(dstsurface, &dstWidth, &dstHeight, (gctINT *)&dstStrides)); | ||
| 2097 | - gcmVERIFY_OK(gcoSURF_Lock(dstsurface, &dstPhyAddr[0], gcvNULL)); | ||
| 2098 | - gcmVERIFY_OK(gcoSURF_Unlock(dstsurface, gcvNULL)); | ||
| 2099 | - | ||
| 2100 | - if(galIsYUVFormat(srcFormat) == gcvSTATUS_TRUE) | ||
| 2101 | - { | ||
| 2102 | - useFilterBlit = 1; | ||
| 2103 | - } | ||
| 2104 | - else | ||
| 2105 | - { | ||
| 2106 | - gcoSURF_GetTiling(srcSurface, &tiling); | ||
| 2107 | - if (gcoHAL_IsFeatureAvailable(gr->gcoHal, gcvFEATURE_2D_TILING) != gcvTRUE && (tiling > gcvLINEAR)) | ||
| 2108 | - { | ||
| 2109 | - weston_log("Tiling not supported \n"); | ||
| 2110 | - status = gcvSTATUS_NOT_SUPPORTED; | ||
| 2111 | - gcmONERROR(status); | ||
| 2112 | - } | ||
| 2113 | - gco2D_SetGenericSource(gr->gcoEngine2d, srcPhyAddr, 1, | ||
| 2114 | - srcStride, 1, | ||
| 2115 | - tiling, srcFormat, gcvSURF_0_DEGREE, | ||
| 2116 | - srcWidth, srcHeight); | ||
| 2117 | - gcmVERIFY_OK(gco2D_SetSource(gr->gcoEngine2d, &srcRect)); | ||
| 2118 | - /* Setup mirror. */ | ||
| 2119 | - gcmONERROR(gco2D_SetBitBlitMirror(gr->gcoEngine2d, gcvFALSE, gcvFALSE)); | ||
| 2120 | - gcmONERROR(gco2D_SetROP(gr->gcoEngine2d, 0xCC, 0xCC)); | ||
| 2121 | - } | ||
| 2122 | - | ||
| 2123 | - for (i = 0; i < nrects; i++) | ||
| 2124 | - { | ||
| 2125 | - pixman_box32_t *rect = &rects[i]; | ||
| 2126 | - gctFLOAT min_x, max_x, min_y, max_y; | ||
| 2127 | - | ||
| 2128 | - dstrect.left = (bb_rects[0].x1 < 0) ? rect->x1 : bb_rects[0].x1; | ||
| 2129 | - dstrect.top = (bb_rects[0].y1 < 0) ? rect->y1 : bb_rects[0].y1; | ||
| 2130 | - dstrect.right = bb_rects[0].x2; | ||
| 2131 | - dstrect.bottom = bb_rects[0].y2; | ||
| 2132 | - | ||
| 2133 | - if(dstrect.right < 0 || dstrect.bottom < 0 || dstrect.left > dstWidth || dstrect.top > dstHeight) | ||
| 2134 | - { | ||
| 2135 | - break; | ||
| 2136 | - } | ||
| 2137 | - | ||
| 2138 | - for (j = 0; j < nsurf; j++) | ||
| 2139 | - { | ||
| 2140 | - pixman_box32_t *surf_rect = &surf_rects[j]; | ||
| 2141 | - gctFLOAT ex[8], ey[8]; /* edge points in screen space */ | ||
| 2142 | - int n; | ||
| 2143 | - gcsRECT clipRect = {0}; | ||
| 2144 | - int m=0; | ||
| 2145 | - n = calculate_edges(ev, rect, surf_rect, ex, ey); | ||
| 2146 | - if (n < 3) | ||
| 2147 | - continue; | ||
| 2148 | - | ||
| 2149 | - min_x = max_x = ex[0]; | ||
| 2150 | - min_y = max_y = ey[0]; | ||
| 2151 | - for (m = 1; m < n; m++) | ||
| 2152 | - { | ||
| 2153 | - min_x = min(min_x, ex[m]); | ||
| 2154 | - max_x = max(max_x, ex[m]); | ||
| 2155 | - min_y = min(min_y, ey[m]); | ||
| 2156 | - max_y = max(max_y, ey[m]); | ||
| 2157 | - } | ||
| 2158 | - | ||
| 2159 | - clipRect.left = gal2d_int_from_double(min_x); | ||
| 2160 | - clipRect.top = gal2d_int_from_double(min_y); | ||
| 2161 | - clipRect.right = gal2d_int_from_double(max_x); | ||
| 2162 | - clipRect.bottom = gal2d_int_from_double(max_y); | ||
| 2163 | - | ||
| 2164 | - if(output->x > 0) | ||
| 2165 | - { | ||
| 2166 | - dstrect.left = dstrect.left - output->x; | ||
| 2167 | - dstrect.right = dstrect.right - output->x; | ||
| 2168 | - clipRect.left = clipRect.left - output->x; | ||
| 2169 | - clipRect.right = clipRect.right - output->x; | ||
| 2170 | - } | ||
| 2171 | - | ||
| 2172 | - dstrect.left = (dstrect.left < 0) ? 0 : dstrect.left; | ||
| 2173 | - | ||
| 2174 | - status = gco2D_SetClipping(gr->gcoEngine2d, &clipRect); | ||
| 2175 | - if(status < 0) | ||
| 2176 | - { | ||
| 2177 | - weston_log("Error in gco2D_SetClipping %s\n", __func__); | ||
| 2178 | - goto OnError; | ||
| 2179 | - } | ||
| 2180 | - | ||
| 2181 | - if(useFilterBlit) | ||
| 2182 | - { | ||
| 2183 | - gctINT srcStrideNum; | ||
| 2184 | - gctINT srcAddressNum; | ||
| 2185 | - gcmVERIFY_OK(galQueryUVStride(srcFormat, srcStride[0], | ||
| 2186 | - &srcStride[1], &srcStride[2])); | ||
| 2187 | - | ||
| 2188 | - switch (srcFormat) | ||
| 2189 | - { | ||
| 2190 | - case gcvSURF_YUY2: | ||
| 2191 | - case gcvSURF_UYVY: | ||
| 2192 | - srcStrideNum = srcAddressNum = 1; | ||
| 2193 | - break; | ||
| 2194 | - | ||
| 2195 | - case gcvSURF_I420: | ||
| 2196 | - case gcvSURF_YV12: | ||
| 2197 | - srcStrideNum = srcAddressNum = 3; | ||
| 2198 | - break; | ||
| 2199 | - | ||
| 2200 | - case gcvSURF_NV16: | ||
| 2201 | - case gcvSURF_NV12: | ||
| 2202 | - case gcvSURF_NV61: | ||
| 2203 | - case gcvSURF_NV21: | ||
| 2204 | - srcStrideNum = srcAddressNum = 2; | ||
| 2205 | - break; | ||
| 2206 | - | ||
| 2207 | - default: | ||
| 2208 | - gcmONERROR(gcvSTATUS_NOT_SUPPORTED); | ||
| 2209 | - } | ||
| 2210 | - gco2D_FilterBlitEx2(gr->gcoEngine2d, | ||
| 2211 | - srcPhyAddr, srcAddressNum, | ||
| 2212 | - srcStride, srcStrideNum, | ||
| 2213 | - gcvLINEAR, srcFormat, gcvSURF_0_DEGREE, | ||
| 2214 | - geoWidth, geoheight, &srcRect, | ||
| 2215 | - dstPhyAddr, 1, | ||
| 2216 | - dstStrides, 1, | ||
| 2217 | - gcvLINEAR, go->format, gcvSURF_0_DEGREE, | ||
| 2218 | - dstWidth, dstHeight, | ||
| 2219 | - &dstrect, gcvNULL); | ||
| 2220 | - } | ||
| 2221 | - else | ||
| 2222 | - { | ||
| 2223 | - gcmVERIFY_OK(gco2D_CalcStretchFactor(gr->gcoEngine2d, srcRect.right - srcRect.left, | ||
| 2224 | - dstrect.right - dstrect.left, &horFactor)); | ||
| 2225 | - | ||
| 2226 | - gcmONERROR(gco2D_CalcStretchFactor(gr->gcoEngine2d, srcRect.bottom - srcRect.top, | ||
| 2227 | - dstrect.bottom - dstrect.top, &verFactor)); | ||
| 2228 | - | ||
| 2229 | - if(verFactor == 65536 && horFactor == 65536) | ||
| 2230 | - { | ||
| 2231 | - gcmVERIFY_OK(gco2D_Blit(gr->gcoEngine2d, 1, &dstrect, | ||
| 2232 | - 0xCC, 0xCC, go->format)); | ||
| 2233 | - } | ||
| 2234 | - else | ||
| 2235 | - { | ||
| 2236 | - dstrect.right = dstrect.right < dstWidth ? dstrect.right : dstWidth; | ||
| 2237 | - dstrect.bottom = dstrect.bottom < dstHeight ? dstrect.bottom : dstHeight; | ||
| 2238 | - srcRect.right = srcRect.right < dstWidth ? srcRect.right : dstWidth; | ||
| 2239 | - srcRect.bottom = srcRect.bottom < dstHeight ? srcRect.bottom : dstHeight; | ||
| 2240 | - | ||
| 2241 | - gcmVERIFY_OK(gco2D_CalcStretchFactor(gr->gcoEngine2d, srcRect.right - srcRect.left, | ||
| 2242 | - dstrect.right - dstrect.left, &horFactor)); | ||
| 2243 | - | ||
| 2244 | - gcmONERROR(gco2D_CalcStretchFactor(gr->gcoEngine2d, srcRect.bottom - srcRect.top, | ||
| 2245 | - dstrect.bottom - dstrect.top, &verFactor)); | ||
| 2246 | - /* Program the stretch factors. */ | ||
| 2247 | - gcmVERIFY_OK(gco2D_SetStretchFactors(gr->gcoEngine2d, horFactor, verFactor)); | ||
| 2248 | - | ||
| 2249 | - gcmVERIFY_OK(gco2D_StretchBlit(gr->gcoEngine2d, 1, &dstrect, | ||
| 2250 | - 0xCC, 0xCC, go->format)); | ||
| 2251 | - } | ||
| 2252 | - } | ||
| 2253 | - | ||
| 2254 | - if(status < 0) | ||
| 2255 | - { | ||
| 2256 | - printf("cr l=%d r=%d t=%d b=%d w=%d h=%d\n", | ||
| 2257 | - clipRect.left, clipRect.right, clipRect.top ,clipRect.bottom, | ||
| 2258 | - clipRect.right - clipRect.left, clipRect.bottom -clipRect.top); | ||
| 2259 | - printf("dr l=%d r=%d t=%d b=%d w=%d h=%d\n", | ||
| 2260 | - dstrect.left, dstrect.right, dstrect.top ,dstrect.bottom, | ||
| 2261 | - dstrect.right - dstrect.left, dstrect.bottom -dstrect.top); | ||
| 2262 | - printf("horFactor=%d, verFactor=%d\n",horFactor, verFactor); | ||
| 2263 | - | ||
| 2264 | - goto OnError; | ||
| 2265 | - } | ||
| 2266 | - } | ||
| 2267 | - } | ||
| 2268 | - | ||
| 2269 | -OnError: | ||
| 2270 | - galONERROR(status); | ||
| 2271 | -} | ||
| 2272 | - | ||
| 2273 | -static void | ||
| 2274 | -draw_view(struct weston_view *ev, struct weston_output *output, | ||
| 2275 | - pixman_region32_t *damage) /* in global coordinates */ | ||
| 2276 | -{ | ||
| 2277 | - struct weston_compositor *ec = ev->surface->compositor; | ||
| 2278 | - struct gal2d_output_state *go = get_output_state(output); | ||
| 2279 | - /* repaint bounding region in global coordinates: */ | ||
| 2280 | - pixman_region32_t repaint; | ||
| 2281 | - /* non-opaque region in surface coordinates: */ | ||
| 2282 | - pixman_region32_t surface_blend; | ||
| 2283 | - pixman_region32_t *buffer_damage; | ||
| 2284 | - | ||
| 2285 | - pixman_region32_init(&repaint); | ||
| 2286 | - pixman_region32_intersect(&repaint, | ||
| 2287 | - &ev->transform.boundingbox, damage); | ||
| 2288 | - pixman_region32_subtract(&repaint, &repaint, &ev->clip); | ||
| 2289 | - | ||
| 2290 | - if (!pixman_region32_not_empty(&repaint)) | ||
| 2291 | - goto out; | ||
| 2292 | - | ||
| 2293 | - buffer_damage = &go->buffer_damage[go->current_buffer]; | ||
| 2294 | - pixman_region32_subtract(buffer_damage, buffer_damage, &repaint); | ||
| 2295 | - | ||
| 2296 | - /* blended region is whole surface minus opaque region: */ | ||
| 2297 | - pixman_region32_init_rect(&surface_blend, 0, 0, | ||
| 2298 | - ev->surface->width, ev->surface->height); | ||
| 2299 | - pixman_region32_subtract(&surface_blend, &surface_blend, &ev->surface->opaque); | ||
| 2300 | - | ||
| 2301 | - struct gal2d_renderer *gr = get_renderer(ec); | ||
| 2302 | - gco2D_SetCurrentSourceIndex(gr->gcoEngine2d, 0U); | ||
| 2303 | - | ||
| 2304 | - if (pixman_region32_not_empty(&ev->surface->opaque)) { | ||
| 2305 | - repaint_region(ev, output, go, &repaint, &ev->surface->opaque); | ||
| 2306 | - } | ||
| 2307 | - | ||
| 2308 | - if (pixman_region32_not_empty(&surface_blend)) { | ||
| 2309 | - gco2D_EnableAlphaBlend(gr->gcoEngine2d, | ||
| 2310 | - ev->alpha * 0xFF, ev->alpha * 0xFF, | ||
| 2311 | - gcvSURF_PIXEL_ALPHA_STRAIGHT, gcvSURF_PIXEL_ALPHA_STRAIGHT, | ||
| 2312 | - gcvSURF_GLOBAL_ALPHA_SCALE, gcvSURF_GLOBAL_ALPHA_SCALE, | ||
| 2313 | - gcvSURF_BLEND_STRAIGHT, gcvSURF_BLEND_INVERSED, | ||
| 2314 | - gcvSURF_COLOR_STRAIGHT, gcvSURF_COLOR_STRAIGHT); | ||
| 2315 | - | ||
| 2316 | - repaint_region(ev, output, go, &repaint, &surface_blend); | ||
| 2317 | - } | ||
| 2318 | - | ||
| 2319 | - gco2D_DisableAlphaBlend(gr->gcoEngine2d); | ||
| 2320 | - pixman_region32_fini(&surface_blend); | ||
| 2321 | - | ||
| 2322 | -out: | ||
| 2323 | - pixman_region32_fini(&repaint); | ||
| 2324 | - | ||
| 2325 | -} | ||
| 2326 | - | ||
| 2327 | -static void | ||
| 2328 | -repaint_views(struct weston_output *output, pixman_region32_t *damage) | ||
| 2329 | -{ | ||
| 2330 | - struct weston_compositor *compositor = output->compositor; | ||
| 2331 | - struct weston_view *view; | ||
| 2332 | - struct gal2d_output_state *go = get_output_state(output); | ||
| 2333 | - | ||
| 2334 | - if(go->nNumBuffers > 1) | ||
| 2335 | - { | ||
| 2336 | - /*500ms is more than enough to process a frame */ | ||
| 2337 | - gcoOS_WaitSignal(gcvNULL, go->busySignal, 500); | ||
| 2338 | - } | ||
| 2339 | - go->activebuffer = (go->activebuffer+1) % go->nNumBuffers; | ||
| 2340 | - | ||
| 2341 | - wl_list_for_each_reverse(view, &compositor->view_list, link) | ||
| 2342 | - if (view->plane == &compositor->primary_plane) | ||
| 2343 | - draw_view(view, output, damage); | ||
| 2344 | -} | ||
| 2345 | - | ||
| 2346 | -static void | ||
| 2347 | -gal2d_renderer_repaint_output(struct weston_output *output, | ||
| 2348 | - pixman_region32_t *output_damage) | ||
| 2349 | -{ | ||
| 2350 | - struct gal2d_output_state *go = get_output_state(output); | ||
| 2351 | - gctUINT32 i; | ||
| 2352 | - | ||
| 2353 | - if (use_output(output) < 0) | ||
| 2354 | - return; | ||
| 2355 | - | ||
| 2356 | - for (i = 0; i < 2; i++) | ||
| 2357 | - pixman_region32_union(&go->buffer_damage[i], | ||
| 2358 | - &go->buffer_damage[i], | ||
| 2359 | - output_damage); | ||
| 2360 | - | ||
| 2361 | - pixman_region32_union(output_damage, output_damage, | ||
| 2362 | - &go->buffer_damage[go->current_buffer]); | ||
| 2363 | - | ||
| 2364 | - repaint_views(output, output_damage); | ||
| 2365 | - | ||
| 2366 | - pixman_region32_copy(&output->previous_damage, output_damage); | ||
| 2367 | - wl_signal_emit(&output->frame_signal, output); | ||
| 2368 | - | ||
| 2369 | - update_surface(output); | ||
| 2370 | - | ||
| 2371 | - go->current_buffer ^= 1; | ||
| 2372 | -} | ||
| 2373 | - | ||
| 2374 | -static void | ||
| 2375 | -gal2d_renderer_attach_egl(struct weston_surface *es, struct weston_buffer *buffer) | ||
| 2376 | -{ | ||
| 2377 | - gcsWL_VIV_BUFFER *vivBuffer = wl_resource_get_user_data(buffer->resource); | ||
| 2378 | - gcoSURF srcSurf = vivBuffer->surface; | ||
| 2379 | - gceSTATUS status = gcvSTATUS_OK; | ||
| 2380 | - struct gal2d_surface_state *gs = get_surface_state(es); | ||
| 2381 | - | ||
| 2382 | - if(gs->gco_Surface != gcvNULL) | ||
| 2383 | - { | ||
| 2384 | - gcmONERROR(gcoSURF_Destroy(gs->gco_Surface)); | ||
| 2385 | - } | ||
| 2386 | - | ||
| 2387 | - gs->gco_Surface = srcSurf; | ||
| 2388 | - gcoSURF_ReferenceSurface(srcSurf); | ||
| 2389 | - buffer->width = vivBuffer->width; | ||
| 2390 | - buffer->height = vivBuffer->height; | ||
| 2391 | - | ||
| 2392 | - OnError: | ||
| 2393 | - galONERROR(status); | ||
| 2394 | -} | ||
| 2395 | - | ||
| 2396 | -static void | ||
| 2397 | -gal2d_renderer_flush_damage(struct weston_surface *surface) | ||
| 2398 | -{ | ||
| 2399 | - struct gal2d_surface_state *gs = get_surface_state(surface); | ||
| 2400 | - struct weston_buffer *buffer = gs->buffer_ref.buffer; | ||
| 2401 | - struct weston_view *view; | ||
| 2402 | - int texture_used; | ||
| 2403 | - pixman_region32_union(&gs->texture_damage, | ||
| 2404 | - &gs->texture_damage, &surface->damage); | ||
| 2405 | - | ||
| 2406 | - if (!buffer) | ||
| 2407 | - return; | ||
| 2408 | - | ||
| 2409 | - texture_used = 0; | ||
| 2410 | - wl_list_for_each(view, &surface->views, surface_link) { | ||
| 2411 | - if (view->plane == &surface->compositor->primary_plane) { | ||
| 2412 | - texture_used = 1; | ||
| 2413 | - break; | ||
| 2414 | - } | ||
| 2415 | - } | ||
| 2416 | - if (!texture_used) | ||
| 2417 | - return; | ||
| 2418 | - | ||
| 2419 | - if (!pixman_region32_not_empty(&gs->texture_damage)) | ||
| 2420 | - goto done; | ||
| 2421 | - | ||
| 2422 | - if(wl_shm_buffer_get(buffer->resource)) | ||
| 2423 | - { | ||
| 2424 | - if(gs->gco_Surface==NULL) | ||
| 2425 | - { | ||
| 2426 | - gs->gco_Surface = getSurfaceFromShm(surface, buffer); | ||
| 2427 | - } | ||
| 2428 | - gal2dBindBuffer(surface); | ||
| 2429 | - } | ||
| 2430 | - else | ||
| 2431 | - gal2d_renderer_attach_egl(surface, buffer); | ||
| 2432 | - | ||
| 2433 | -done: | ||
| 2434 | - pixman_region32_fini(&gs->texture_damage); | ||
| 2435 | - pixman_region32_init(&gs->texture_damage); | ||
| 2436 | - | ||
| 2437 | - weston_buffer_reference(&gs->buffer_ref, NULL); | ||
| 2438 | -} | ||
| 2439 | - | ||
| 2440 | -static void | ||
| 2441 | -gal2d_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer) | ||
| 2442 | -{ | ||
| 2443 | - struct gal2d_surface_state *gs = get_surface_state(es); | ||
| 2444 | - struct wl_shm_buffer *shm_buffer; | ||
| 2445 | - weston_buffer_reference(&gs->buffer_ref, buffer); | ||
| 2446 | - | ||
| 2447 | - if(buffer==NULL) | ||
| 2448 | - return; | ||
| 2449 | - | ||
| 2450 | - shm_buffer = wl_shm_buffer_get(buffer->resource); | ||
| 2451 | - | ||
| 2452 | - if(shm_buffer) | ||
| 2453 | - { | ||
| 2454 | - buffer->width = wl_shm_buffer_get_width(shm_buffer); | ||
| 2455 | - buffer->height = wl_shm_buffer_get_height(shm_buffer); | ||
| 2456 | - buffer->shm_buffer = shm_buffer; | ||
| 2457 | - | ||
| 2458 | - if(gs->gco_Surface) | ||
| 2459 | - { | ||
| 2460 | - gcoSURF_Destroy(gs->gco_Surface); | ||
| 2461 | - gs->gco_Surface = getSurfaceFromShm(es, buffer); | ||
| 2462 | - } | ||
| 2463 | - } | ||
| 2464 | - else | ||
| 2465 | - gal2d_renderer_attach_egl(es, buffer); | ||
| 2466 | -} | ||
| 2467 | - | ||
| 2468 | -static void | ||
| 2469 | -surface_state_destroy(struct gal2d_surface_state *gs, struct gal2d_renderer *gr) | ||
| 2470 | -{ | ||
| 2471 | - if(gs->gco_Surface) | ||
| 2472 | - { | ||
| 2473 | - gcoSURF_Destroy(gs->gco_Surface); | ||
| 2474 | - } | ||
| 2475 | - wl_list_remove(&gs->surface_destroy_listener.link); | ||
| 2476 | - wl_list_remove(&gs->renderer_destroy_listener.link); | ||
| 2477 | - if(gs->surface) | ||
| 2478 | - gs->surface->renderer_state = NULL; | ||
| 2479 | - | ||
| 2480 | - weston_buffer_reference(&gs->buffer_ref, NULL); | ||
| 2481 | - free(gs); | ||
| 2482 | -} | ||
| 2483 | - | ||
| 2484 | -static void | ||
| 2485 | -surface_state_handle_surface_destroy(struct wl_listener *listener, void *data) | ||
| 2486 | -{ | ||
| 2487 | - struct gal2d_surface_state *gs; | ||
| 2488 | - struct gal2d_renderer *gr; | ||
| 2489 | - | ||
| 2490 | - gs = container_of(listener, struct gal2d_surface_state, | ||
| 2491 | - surface_destroy_listener); | ||
| 2492 | - | ||
| 2493 | - gr = get_renderer(gs->surface->compositor); | ||
| 2494 | - surface_state_destroy(gs, gr); | ||
| 2495 | -} | ||
| 2496 | - | ||
| 2497 | -static void | ||
| 2498 | -surface_state_handle_renderer_destroy(struct wl_listener *listener, void *data) | ||
| 2499 | -{ | ||
| 2500 | - struct gal2d_surface_state *gs; | ||
| 2501 | - struct gal2d_renderer *gr; | ||
| 2502 | - | ||
| 2503 | - gr = data; | ||
| 2504 | - | ||
| 2505 | - gs = container_of(listener, struct gal2d_surface_state, | ||
| 2506 | - renderer_destroy_listener); | ||
| 2507 | - | ||
| 2508 | - surface_state_destroy(gs, gr); | ||
| 2509 | -} | ||
| 2510 | - | ||
| 2511 | - | ||
| 2512 | -static int | ||
| 2513 | -gal2d_renderer_create_surface(struct weston_surface *surface) | ||
| 2514 | -{ | ||
| 2515 | - struct gal2d_surface_state *gs; | ||
| 2516 | - struct gal2d_renderer *gr = get_renderer(surface->compositor); | ||
| 2517 | - | ||
| 2518 | - gs = zalloc(sizeof *gs); | ||
| 2519 | - if (gs == NULL) | ||
| 2520 | - return -1; | ||
| 2521 | - | ||
| 2522 | - /* A buffer is never attached to solid color surfaces, yet | ||
| 2523 | - * they still go through texcoord computations. Do not divide | ||
| 2524 | - * by zero there. | ||
| 2525 | - */ | ||
| 2526 | - gs->pitch = 1; | ||
| 2527 | - | ||
| 2528 | - gs->surface = surface; | ||
| 2529 | - | ||
| 2530 | - pixman_region32_init(&gs->texture_damage); | ||
| 2531 | - surface->renderer_state = gs; | ||
| 2532 | - | ||
| 2533 | - gs->surface_destroy_listener.notify = | ||
| 2534 | - surface_state_handle_surface_destroy; | ||
| 2535 | - wl_signal_add(&surface->destroy_signal, | ||
| 2536 | - &gs->surface_destroy_listener); | ||
| 2537 | - | ||
| 2538 | - gs->renderer_destroy_listener.notify = | ||
| 2539 | - surface_state_handle_renderer_destroy; | ||
| 2540 | - wl_signal_add(&gr->destroy_signal, | ||
| 2541 | - &gs->renderer_destroy_listener); | ||
| 2542 | - | ||
| 2543 | - if (surface->buffer_ref.buffer) { | ||
| 2544 | - gal2d_renderer_attach(surface, surface->buffer_ref.buffer); | ||
| 2545 | - gal2d_renderer_flush_damage(surface); | ||
| 2546 | - } | ||
| 2547 | - | ||
| 2548 | - return 0; | ||
| 2549 | -} | ||
| 2550 | - | ||
| 2551 | -static void | ||
| 2552 | -gal2d_renderer_surface_set_color(struct weston_surface *surface, | ||
| 2553 | - float red, float green, float blue, float alpha) | ||
| 2554 | -{ | ||
| 2555 | - struct gal2d_surface_state *gs = get_surface_state(surface); | ||
| 2556 | - | ||
| 2557 | - gs->color[0] = red; | ||
| 2558 | - gs->color[1] = green; | ||
| 2559 | - gs->color[2] = blue; | ||
| 2560 | - gs->color[3] = alpha; | ||
| 2561 | -} | ||
| 2562 | - | ||
| 2563 | - | ||
| 2564 | -static void | ||
| 2565 | -gal2d_renderer_output_destroy(struct weston_output *output) | ||
| 2566 | -{ | ||
| 2567 | - struct gal2d_output_state *go = get_output_state(output); | ||
| 2568 | - gctUINT32 i; | ||
| 2569 | - | ||
| 2570 | - for (i = 0; i < 2; i++) | ||
| 2571 | - { | ||
| 2572 | - pixman_region32_fini(&go->buffer_damage[i]); | ||
| 2573 | - } | ||
| 2574 | - if(go->nNumBuffers <= 1 ) | ||
| 2575 | - { | ||
| 2576 | - if(go->offscreenSurface) | ||
| 2577 | - gcmVERIFY_OK(gcoSURF_Destroy(go->offscreenSurface)); | ||
| 2578 | - } | ||
| 2579 | - else | ||
| 2580 | - { | ||
| 2581 | - gcoOS_Signal(gcvNULL,go->signal, gcvTRUE); | ||
| 2582 | - pthread_mutex_lock(&go->workerMutex); | ||
| 2583 | - go->exitWorker = 1; | ||
| 2584 | - pthread_mutex_unlock(&go->workerMutex); | ||
| 2585 | - pthread_join(go->workerId, NULL); | ||
| 2586 | - } | ||
| 2587 | - | ||
| 2588 | - for(i=0; i < go->nNumBuffers; i++) | ||
| 2589 | - { | ||
| 2590 | - gcmVERIFY_OK(gcoSURF_Destroy(go->renderSurf[i])); | ||
| 2591 | - } | ||
| 2592 | - free(go->renderSurf); | ||
| 2593 | - go->renderSurf = gcvNULL; | ||
| 2594 | - | ||
| 2595 | - free(go); | ||
| 2596 | -} | ||
| 2597 | - | ||
| 2598 | -static void | ||
| 2599 | -gal2d_renderer_destroy(struct weston_compositor *ec) | ||
| 2600 | -{ | ||
| 2601 | - struct gal2d_renderer *gr = get_renderer(ec); | ||
| 2602 | - | ||
| 2603 | - wl_signal_emit(&gr->destroy_signal, gr); | ||
| 2604 | - free(ec->renderer); | ||
| 2605 | - ec->renderer = NULL; | ||
| 2606 | -} | ||
| 2607 | - | ||
| 2608 | - | ||
| 2609 | -static int | ||
| 2610 | -gal2d_renderer_create(struct weston_compositor *ec) | ||
| 2611 | -{ | ||
| 2612 | - struct gal2d_renderer *gr; | ||
| 2613 | - gceSTATUS status = gcvSTATUS_OK; | ||
| 2614 | - gr = malloc(sizeof *gr); | ||
| 2615 | - if (gr == NULL) | ||
| 2616 | - return -1; | ||
| 2617 | - | ||
| 2618 | - gr->base.read_pixels = gal2d_renderer_read_pixels; | ||
| 2619 | - gr->base.repaint_output = gal2d_renderer_repaint_output; | ||
| 2620 | - gr->base.flush_damage = gal2d_renderer_flush_damage; | ||
| 2621 | - gr->base.attach = gal2d_renderer_attach; | ||
| 2622 | - gr->base.surface_set_color = gal2d_renderer_surface_set_color; | ||
| 2623 | - gr->base.destroy = gal2d_renderer_destroy; | ||
| 2624 | - | ||
| 2625 | - /* Construct the gcoOS object. */ | ||
| 2626 | - gcmONERROR(gcoOS_Construct(gcvNULL, &gr->gcos)); | ||
| 2627 | - | ||
| 2628 | - /* Construct the gcoHAL object. */ | ||
| 2629 | - gcmONERROR(gcoHAL_Construct(gcvNULL, gr->gcos, &gr->gcoHal)); | ||
| 2630 | - gcmONERROR(gcoHAL_Get2DEngine(gr->gcoHal, &gr->gcoEngine2d)); | ||
| 2631 | - gcmONERROR(gcoHAL_SetHardwareType(gr->gcoHal, gcvHARDWARE_2D)); | ||
| 2632 | - | ||
| 2633 | - ec->renderer = &gr->base; | ||
| 2634 | - wl_signal_init(&gr->destroy_signal); | ||
| 2635 | -OnError: | ||
| 2636 | - galONERROR(status); | ||
| 2637 | - | ||
| 2638 | - /* Return the status. */ | ||
| 2639 | - return status; | ||
| 2640 | - | ||
| 2641 | -} | ||
| 2642 | - | ||
| 2643 | -static int | ||
| 2644 | -gal2d_renderer_output_create(struct weston_output *output, NativeDisplayType display, | ||
| 2645 | - NativeWindowType window) | ||
| 2646 | - | ||
| 2647 | - { | ||
| 2648 | - struct gal2d_renderer *gr = get_renderer(output->compositor); | ||
| 2649 | - struct gal2d_output_state *go; | ||
| 2650 | - halDISPLAY_INFO info; | ||
| 2651 | - gctUINT32 backOffset = 0; | ||
| 2652 | - gceSTATUS status = gcvSTATUS_OK; | ||
| 2653 | - gctUINT32 i; | ||
| 2654 | - | ||
| 2655 | - go = zalloc(sizeof *go); | ||
| 2656 | - if (go == NULL) | ||
| 2657 | - return -1; | ||
| 2658 | - | ||
| 2659 | - output->renderer_state = go; | ||
| 2660 | - go->display = display; | ||
| 2661 | - gcmONERROR(gcoOS_InitLocalDisplayInfo(go->display, &gr->localInfo)); | ||
| 2662 | - | ||
| 2663 | - /* Get display information. */ | ||
| 2664 | - gcmONERROR(gcoOS_GetDisplayInfoEx2( | ||
| 2665 | - go->display, gcvNULL, gr->localInfo, | ||
| 2666 | - sizeof(info), &info)); | ||
| 2667 | - go->nNumBuffers = info.multiBuffer; | ||
| 2668 | - | ||
| 2669 | - weston_log("Number of buffers=%d\n",go->nNumBuffers); | ||
| 2670 | - | ||
| 2671 | - gcmONERROR(gal2d_getSurfaceFormat(info, &go->format)); | ||
| 2672 | - backOffset = (gctUINT32)(info.stride * info.height ); | ||
| 2673 | - | ||
| 2674 | - go->activebuffer = 0; | ||
| 2675 | - | ||
| 2676 | - go->renderSurf = malloc(sizeof(gcoSURF) * go->nNumBuffers); | ||
| 2677 | - gcoOS_GetDisplayVirtual(go->display, &go->width, &go->height); | ||
| 2678 | - gcoOS_SetSwapInterval(go->display, 1); | ||
| 2679 | - | ||
| 2680 | - /*Needed only for multi Buffer */ | ||
| 2681 | - if(go->nNumBuffers > 1) | ||
| 2682 | - { | ||
| 2683 | - gcmVERIFY_OK(gcoOS_CreateSignal(gcvNULL, gcvFALSE, | ||
| 2684 | - &go->signal)); | ||
| 2685 | - gcmVERIFY_OK(gcoOS_CreateSignal(gcvNULL, gcvFALSE, | ||
| 2686 | - &go->busySignal)); | ||
| 2687 | - | ||
| 2688 | - go->iface.command = gcvHAL_SIGNAL; | ||
| 2689 | - go->iface.u.Signal.signal = gcmPTR_TO_UINT64(go->signal); | ||
| 2690 | - go->iface.u.Signal.auxSignal = 0; | ||
| 2691 | - go->iface.u.Signal.process = gcmPTR_TO_UINT64(gcoOS_GetCurrentProcessID()); | ||
| 2692 | - go->iface.u.Signal.fromWhere = gcvKERNEL_PIXEL; | ||
| 2693 | - | ||
| 2694 | - go->exitWorker = 0; | ||
| 2695 | - pthread_create(&go->workerId, NULL, gal2d_output_worker, output); | ||
| 2696 | - pthread_mutex_init(&go->workerMutex, gcvNULL); | ||
| 2697 | - } | ||
| 2698 | - for(i=0; i < go->nNumBuffers; i++) | ||
| 2699 | - { | ||
| 2700 | - gcmONERROR(gcoSURF_Construct(gr->gcoHal, info.width, info.height, 1, | ||
| 2701 | - gcvSURF_BITMAP, go->format, gcvPOOL_USER, &go->renderSurf[i])); | ||
| 2702 | - | ||
| 2703 | - gcoSURF_MapUserSurface(go->renderSurf[i], 0,info.logical + (i * backOffset), | ||
| 2704 | - info.physical + (i * backOffset)); | ||
| 2705 | - | ||
| 2706 | - //Clear surfaces | ||
| 2707 | - make_current(gr, go->renderSurf[go->activebuffer]); | ||
| 2708 | - gal2d_clear(output); | ||
| 2709 | - gal2d_flip_surface(output); | ||
| 2710 | - } | ||
| 2711 | - if(go->nNumBuffers <= 1) | ||
| 2712 | - go->activebuffer = 0; | ||
| 2713 | - else | ||
| 2714 | - go->activebuffer = 1; | ||
| 2715 | - | ||
| 2716 | - if(go->nNumBuffers <= 1 ) | ||
| 2717 | - { | ||
| 2718 | - gcmVERIFY_OK(gcoSURF_Construct(gr->gcoHal, | ||
| 2719 | - (gctUINT) info.width, | ||
| 2720 | - (gctUINT) info.height, | ||
| 2721 | - 1, | ||
| 2722 | - gcvSURF_BITMAP, | ||
| 2723 | - go->format, | ||
| 2724 | - gcvPOOL_DEFAULT, | ||
| 2725 | - &go->offscreenSurface)); | ||
| 2726 | - make_current(gr, go->offscreenSurface); | ||
| 2727 | - gal2d_clear(output); | ||
| 2728 | - } | ||
| 2729 | - else | ||
| 2730 | - { | ||
| 2731 | - gcoOS_Signal(gcvNULL,go->busySignal, gcvTRUE); | ||
| 2732 | - } | ||
| 2733 | - | ||
| 2734 | - for (i = 0; i < 2; i++) | ||
| 2735 | - pixman_region32_init(&go->buffer_damage[i]); | ||
| 2736 | -OnError: | ||
| 2737 | - galONERROR(status); | ||
| 2738 | - /* Return the status. */ | ||
| 2739 | - return status; | ||
| 2740 | - } | ||
| 2741 | - | ||
| 2742 | - WL_EXPORT struct gal2d_renderer_interface gal2d_renderer_interface = { | ||
| 2743 | - .create = gal2d_renderer_create, | ||
| 2744 | - .output_create = gal2d_renderer_output_create, | ||
| 2745 | - .output_destroy = gal2d_renderer_output_destroy, | ||
| 2746 | -}; | ||
| 2747 | Index: weston-1.11.0/src/gal2d-renderer.h | ||
| 2748 | =================================================================== | ||
| 2749 | --- weston-1.11.0.orig/src/gal2d-renderer.h 2016-10-06 14:26:20.254564856 -0500 | ||
| 2750 | +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 2751 | @@ -1,50 +0,0 @@ | ||
| 2752 | -/* | ||
| 2753 | - * Copyright (c) 2015 Freescale Semiconductor, Inc. | ||
| 2754 | - * Copyright © 2013 Vasily Khoruzhick <anarsoul@gmail.com> | ||
| 2755 | - * | ||
| 2756 | - * Permission is hereby granted, free of charge, to any person obtaining | ||
| 2757 | - * a copy of this software and associated documentation files (the | ||
| 2758 | - * "Software"), to deal in the Software without restriction, including | ||
| 2759 | - * without limitation the rights to use, copy, modify, merge, publish, | ||
| 2760 | - * distribute, sublicense, and/or sell copies of the Software, and to | ||
| 2761 | - * permit persons to whom the Software is furnished to do so, subject to | ||
| 2762 | - * the following conditions: | ||
| 2763 | - * | ||
| 2764 | - * The above copyright notice and this permission notice (including the | ||
| 2765 | - * next paragraph) shall be included in all copies or substantial | ||
| 2766 | - * portions of the Software. | ||
| 2767 | - * | ||
| 2768 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| 2769 | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
| 2770 | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| 2771 | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
| 2772 | - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
| 2773 | - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 2774 | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 2775 | - * SOFTWARE. | ||
| 2776 | - */ | ||
| 2777 | -#ifndef __gal_2d_renderer_h_ | ||
| 2778 | -#define __gal_2d_renderer_h_ | ||
| 2779 | - | ||
| 2780 | -#include "compositor.h" | ||
| 2781 | -#ifdef ENABLE_EGL | ||
| 2782 | -#include <EGL/egl.h> | ||
| 2783 | -#else | ||
| 2784 | -#include <HAL/gc_hal_eglplatform.h> | ||
| 2785 | -typedef HALNativeDisplayType NativeDisplayType; | ||
| 2786 | -typedef HALNativeWindowType NativeWindowType; | ||
| 2787 | -#endif | ||
| 2788 | - | ||
| 2789 | - | ||
| 2790 | -struct gal2d_renderer_interface { | ||
| 2791 | - | ||
| 2792 | - int (*create)(struct weston_compositor *ec); | ||
| 2793 | - | ||
| 2794 | - int (*output_create)(struct weston_output *output, | ||
| 2795 | - NativeDisplayType display, | ||
| 2796 | - NativeWindowType window); | ||
| 2797 | - | ||
| 2798 | - void (*output_destroy)(struct weston_output *output); | ||
| 2799 | -}; | ||
| 2800 | - | ||
| 2801 | -#endif | ||
| 2802 | Index: weston-1.11.0/src/main.c | ||
| 2803 | =================================================================== | ||
| 2804 | --- weston-1.11.0.orig/src/main.c 2016-10-06 14:26:20.258564876 -0500 | ||
| 2805 | +++ weston-1.11.0/src/main.c 2016-10-06 14:28:47.000000000 -0500 | ||
| 2806 | @@ -287,10 +287,10 @@ | ||
| 2807 | " --device=DEVICE\tThe framebuffer device to use\n" | ||
| 2808 | #if defined ENABLE_EGL | ||
| 2809 | " --no-use-gl\t\tDo not use the GL renderer\n" | ||
| 2810 | - " --use-gal2d\t\tUse the GAL2D renderer\n\n"); | ||
| 2811 | + " --use-g2d\t\tUse the G2D renderer\n\n"); | ||
| 2812 | #else | ||
| 2813 | " --use-gl\t\tUse the GL renderer\n" | ||
| 2814 | - " --no-use-gal2d\t\tDo not use the GAL2D renderer\n\n"); | ||
| 2815 | + " --no-use-g2d\t\tDo not use the G2D renderer\n\n"); | ||
| 2816 | #endif | ||
| 2817 | #endif | ||
| 2818 | |||
| 2819 | @@ -871,11 +871,11 @@ | ||
| 2820 | char *s = NULL; | ||
| 2821 | int ret = 0; | ||
| 2822 | #ifdef ENABLE_EGL | ||
| 2823 | - /* GL rendering is default, so user options are --no-use-gl and --use-gal2d */ | ||
| 2824 | + /* GL rendering is default, so user options are --no-use-gl and --use-g2d */ | ||
| 2825 | int no_use_gl = 0; | ||
| 2826 | #else | ||
| 2827 | - /* GAL2D rendering is default, so user options are --use-gl and --no-use-gal2d */ | ||
| 2828 | - int no_use_gal2d = 0; | ||
| 2829 | + /* G2D rendering is default, so user options are --use-gl and --no-use-g2d */ | ||
| 2830 | + int no_use_g2d = 0; | ||
| 2831 | #endif | ||
| 2832 | |||
| 2833 | const struct weston_option fbdev_options[] = { | ||
| 2834 | @@ -883,10 +883,10 @@ | ||
| 2835 | { WESTON_OPTION_STRING, "device", 0, &config.device }, | ||
| 2836 | #ifdef ENABLE_EGL | ||
| 2837 | { WESTON_OPTION_BOOLEAN, "no-use-gl", 0, &no_use_gl }, | ||
| 2838 | - { WESTON_OPTION_BOOLEAN, "use-gal2d", 0, &config.use_gal2d }, | ||
| 2839 | + { WESTON_OPTION_BOOLEAN, "use-g2d", 0, &config.use_g2d }, | ||
| 2840 | #else | ||
| 2841 | { WESTON_OPTION_BOOLEAN, "use-gl", 0, &config.use_gl }, | ||
| 2842 | - { WESTON_OPTION_BOOLEAN, "no-use-gal2d", 0, &no_use_gal2d }, | ||
| 2843 | + { WESTON_OPTION_BOOLEAN, "no-use-g2d", 0, &no_use_g2d }, | ||
| 2844 | #endif | ||
| 2845 | }; | ||
| 2846 | |||
| 2847 | @@ -897,7 +897,7 @@ | ||
| 2848 | #ifdef ENABLE_EGL | ||
| 2849 | config.use_gl = !no_use_gl; | ||
| 2850 | #else | ||
| 2851 | - config.use_gal2d = !no_use_gal2d; | ||
| 2852 | + config.use_g2d = !no_use_g2d; | ||
| 2853 | #endif | ||
| 2854 | section = weston_config_get_section(wc, "output", "name", "fbdev"); | ||
| 2855 | weston_config_section_get_string(section, "transform", &s, "normal"); | ||
| 2856 | Index: weston-1.11.0/src/compositor-fbdev.h | ||
| 2857 | =================================================================== | ||
| 2858 | --- weston-1.11.0.orig/src/compositor-fbdev.h 2016-10-06 14:26:20.258564876 -0500 | ||
| 2859 | +++ weston-1.11.0/src/compositor-fbdev.h 2016-10-06 14:34:09.000000000 -0500 | ||
| 2860 | @@ -40,7 +40,8 @@ | ||
| 2861 | int tty; | ||
| 2862 | char *device; | ||
| 2863 | int use_gl; | ||
| 2864 | - int use_gal2d; | ||
| 2865 | + int use_g2d; | ||
| 2866 | + int clone_mode; | ||
| 2867 | |||
| 2868 | uint32_t output_transform; | ||
| 2869 | }; | ||
diff --git a/recipes-graphics/wayland/weston/0010-MGS-1284-1-xwld-Re-implement-weston-2d-renderer-with.patch b/recipes-graphics/wayland/weston/0010-MGS-1284-1-xwld-Re-implement-weston-2d-renderer-with.patch new file mode 100644 index 000000000..96181abae --- /dev/null +++ b/recipes-graphics/wayland/weston/0010-MGS-1284-1-xwld-Re-implement-weston-2d-renderer-with.patch  | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | From 9a19dd911fc79fa828b03fce8cdb16c6cfcb25cb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "yong.gan" <yong.gan@nxp.com> | ||
| 3 | Date: Tue, 22 Mar 2016 10:15:31 +0800 | ||
| 4 | Subject: [PATCH 2/3] MGS-1284-1: xwld: Re-implement weston 2d renderer with | ||
| 5 | porting g2d API | ||
| 6 | |||
| 7 | Add gpu address to the buffer physical address, fix the mess in sx board. | ||
| 8 | |||
| 9 | Date: Feb 22, 2016 | ||
| 10 | Upstream Status: Inappropriate [i.MX specific] | ||
| 11 | |||
| 12 | Signed-off-by: Yong Gan <yong.gan@freescale.com> | ||
| 13 | --- | ||
| 14 | src/g2d-renderer.c | 6 +++--- | ||
| 15 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/src/g2d-renderer.c b/src/g2d-renderer.c | ||
| 18 | index 756c8f0..19c93a0 100644 | ||
| 19 | --- a/src/g2d-renderer.c | ||
| 20 | +++ b/src/g2d-renderer.c | ||
| 21 | @@ -317,9 +317,9 @@ get_g2dSurface(gcsWL_VIV_BUFFER *buffer, struct g2d_surfaceEx *g2dSurface) | ||
| 22 | int height = buffer->alignedHeight; | ||
| 23 | g2d_getG2dFormat(buffer->format, &g2dSurface->base.format); | ||
| 24 | g2d_getG2dTiling(buffer->tiling, &g2dSurface->tiling); | ||
| 25 | - g2dSurface->base.planes[0] = buffer->physical[0]; | ||
| 26 | - g2dSurface->base.planes[1] = buffer->physical[1]; | ||
| 27 | - g2dSurface->base.planes[2] = buffer->physical[2]; | ||
| 28 | + g2dSurface->base.planes[0] = buffer->physical[0] + buffer->gpuBaseAddr; | ||
| 29 | + g2dSurface->base.planes[1] = buffer->physical[1] + buffer->gpuBaseAddr; | ||
| 30 | + g2dSurface->base.planes[2] = buffer->physical[2] + buffer->gpuBaseAddr; | ||
| 31 | g2dSurface->base.left = 0; | ||
| 32 | g2dSurface->base.top = 0; | ||
| 33 | g2dSurface->base.right = buffer->width; | ||
| 34 | -- | ||
| 35 | 1.9.1 | ||
| 36 | |||
diff --git a/recipes-graphics/wayland/weston/0011-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch b/recipes-graphics/wayland/weston/0011-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch new file mode 100644 index 000000000..f7bee2fec --- /dev/null +++ b/recipes-graphics/wayland/weston/0011-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch  | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | From b67a6184ed3b6d728894eba37a554a302c1b0312 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "yong.gan" <yong.gan@nxp.com> | ||
| 3 | Date: Sat, 2 Apr 2016 09:33:56 +0800 | ||
| 4 | Subject: [PATCH 3/3] MGS-1724: xwld: G2D compositor build failed in slevk | ||
| 5 | board | ||
| 6 | |||
| 7 | Add macro ENABLE_EGL to make sure the EGL was not built in slevk board. | ||
| 8 | Modify the wrong format for the shm buffer. | ||
| 9 | |||
| 10 | Upstream Status: Inappropriate [i.MX specific] | ||
| 11 | |||
| 12 | Signed-off-by: Yong Gan <yong.gan@nxp.com> | ||
| 13 | --- | ||
| 14 | src/compositor-fbdev.c | 11 ++++++++++- | ||
| 15 | src/g2d-renderer.c | 4 ++-- | ||
| 16 | 2 files changed, 12 insertions(+), 3 deletions(-) | ||
| 17 | |||
| 18 | Index: weston-1.11.0/src/compositor-fbdev.c | ||
| 19 | =================================================================== | ||
| 20 | --- weston-1.11.0.orig/src/compositor-fbdev.c 2016-10-06 13:11:53.376414804 -0500 | ||
| 21 | +++ weston-1.11.0/src/compositor-fbdev.c 2016-10-06 13:19:16.000000000 -0500 | ||
| 22 | @@ -63,7 +63,9 @@ | ||
| 23 | int use_g2d; | ||
| 24 | uint32_t output_transform; | ||
| 25 | struct wl_listener session_listener; | ||
| 26 | +#ifdef ENABLE_EGL | ||
| 27 | NativeDisplayType display; | ||
| 28 | +#endif | ||
| 29 | }; | ||
| 30 | |||
| 31 | struct fbdev_screeninfo { | ||
| 32 | @@ -96,9 +98,10 @@ | ||
| 33 | /* pixman details. */ | ||
| 34 | pixman_image_t *hw_surface; | ||
| 35 | uint8_t depth; | ||
| 36 | - | ||
| 37 | +#ifdef ENABLE_EGL | ||
| 38 | NativeDisplayType display; | ||
| 39 | NativeWindowType window; | ||
| 40 | +#endif | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct gl_renderer_interface *gl_renderer; | ||
| 44 | @@ -450,10 +453,12 @@ | ||
| 45 | strerror(errno)); | ||
| 46 | |||
| 47 | output->fb = NULL; | ||
| 48 | +#ifdef ENABLE_EGL | ||
| 49 | if(output->window) | ||
| 50 | fbDestroyWindow(output->window); | ||
| 51 | if(output->display) | ||
| 52 | fbDestroyDisplay(output->display); | ||
| 53 | +#endif | ||
| 54 | } | ||
| 55 | |||
| 56 | static void fbdev_output_destroy(struct weston_output *base); | ||
| 57 | @@ -527,6 +532,7 @@ | ||
| 58 | } | ||
| 59 | |||
| 60 | } else { | ||
| 61 | +#ifdef ENABLE_EGL | ||
| 62 | setenv("HYBRIS_EGLPLATFORM", "wayland", 1); | ||
| 63 | output->window = fbCreateWindow(backend->display, -1, -1, 0, 0); | ||
| 64 | if (output->window == NULL) { | ||
| 65 | @@ -540,6 +546,7 @@ | ||
| 66 | weston_log("gl_renderer_output_create failed.\n"); | ||
| 67 | goto out_hw_surface; | ||
| 68 | } | ||
| 69 | +#endif | ||
| 70 | } | ||
| 71 | |||
| 72 | loop = wl_display_get_event_loop(backend->compositor->wl_display); | ||
| 73 | @@ -847,6 +854,7 @@ | ||
| 74 | } | ||
| 75 | } | ||
| 76 | else { | ||
| 77 | +#ifdef ENABLE_EGL | ||
| 78 | gl_renderer = weston_load_module("gl-renderer.so", | ||
| 79 | "gl_renderer_interface"); | ||
| 80 | if (!gl_renderer) { | ||
| 81 | @@ -866,6 +874,7 @@ | ||
| 82 | weston_log("gl_renderer_create failed.\n"); | ||
| 83 | goto out_launcher; | ||
| 84 | } | ||
| 85 | +#endif | ||
| 86 | } | ||
| 87 | if(!backend->use_g2d) | ||
| 88 | if (fbdev_output_create(backend, 0, 0, param->device) < 0) | ||
| 89 | Index: weston-1.11.0/src/g2d-renderer.c | ||
| 90 | =================================================================== | ||
| 91 | --- weston-1.11.0.orig/src/g2d-renderer.c 2016-10-06 13:11:53.376414804 -0500 | ||
| 92 | +++ weston-1.11.0/src/g2d-renderer.c 2016-10-06 13:11:53.372414784 -0500 | ||
| 93 | @@ -756,11 +756,11 @@ | ||
| 94 | |||
| 95 | switch (wl_shm_buffer_get_format(shm_buffer)) { | ||
| 96 | case WL_SHM_FORMAT_XRGB8888: | ||
| 97 | - g2dFormat = G2D_XRGB8888; | ||
| 98 | + g2dFormat = G2D_BGRX8888; | ||
| 99 | gs->bpp = 4; | ||
| 100 | break; | ||
| 101 | case WL_SHM_FORMAT_ARGB8888: | ||
| 102 | - g2dFormat = G2D_ARGB8888; | ||
| 103 | + g2dFormat = G2D_BGRA8888; | ||
| 104 | gs->bpp = 4; | ||
| 105 | break; | ||
| 106 | case WL_SHM_FORMAT_RGB565: | ||
diff --git a/recipes-graphics/wayland/weston_%.bbappend b/recipes-graphics/wayland/weston_%.bbappend index 270adfa64..bb2e51a6f 100644 --- a/recipes-graphics/wayland/weston_%.bbappend +++ b/recipes-graphics/wayland/weston_%.bbappend  | |||
| @@ -7,6 +7,9 @@ SRC_URI_append_imxgpu2d = " \ | |||
| 7 | file://0005-MGS-1252-Fix-for-Qt5_CinematicExperience-will-meet-s.patch \ | 7 | file://0005-MGS-1252-Fix-for-Qt5_CinematicExperience-will-meet-s.patch \ | 
| 8 | file://0006-MGS-1236-imx6qp-imx6dl-First-frame-distored-when-som.patch \ | 8 | file://0006-MGS-1236-imx6qp-imx6dl-First-frame-distored-when-som.patch \ | 
| 9 | file://0007-MGS-1236-1-imx6qp-imx6dl-First-frame-distored-when-s.patch \ | 9 | file://0007-MGS-1236-1-imx6qp-imx6dl-First-frame-distored-when-s.patch \ | 
| 10 | file://0009-MGS-1284-xwld-Re-implement-weston-2d-renderer-with-p.patch \ | ||
| 11 | file://0010-MGS-1284-1-xwld-Re-implement-weston-2d-renderer-with.patch \ | ||
| 12 | file://0011-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch \ | ||
| 10 | " | 13 | " | 
| 11 | 14 | ||
| 12 | PACKAGECONFIG_IMX_TO_APPEND = "" | 15 | PACKAGECONFIG_IMX_TO_APPEND = "" | 
