summaryrefslogtreecommitdiffstats
path: root/recipes-graphics
diff options
context:
space:
mode:
authorTom Hochstein <tom.hochstein@nxp.com>2016-10-07 17:36:57 -0500
committerOtavio Salvador <otavio@ossystems.com.br>2016-10-18 16:26:14 -0200
commit94094cf7f9eedeff3cd4d3debf046c391560c779 (patch)
tree09fac148d3d2be7e2785de6a7b69a0e1bbe8bc8c /recipes-graphics
parentc76cf5043d47778a2bddc317df43403634f099d3 (diff)
downloadmeta-freescale-94094cf7f9eedeff3cd4d3debf046c391560c779.tar.gz
weston: Use common API to support G2d compositor
Replace gcoOS_WaylandCreateVivGlobal with eglBindWaylandDisplayWL. Fix a width set error in g2d_renderer_attach_shm. Use noncached buffer in weston shm buffer. Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'recipes-graphics')
-rw-r--r--recipes-graphics/wayland/weston/0013-MGS-1945-Use-common-API-to-support-G2d-compositor.patch196
-rw-r--r--recipes-graphics/wayland/weston_%.bbappend1
2 files changed, 197 insertions, 0 deletions
diff --git a/recipes-graphics/wayland/weston/0013-MGS-1945-Use-common-API-to-support-G2d-compositor.patch b/recipes-graphics/wayland/weston/0013-MGS-1945-Use-common-API-to-support-G2d-compositor.patch
new file mode 100644
index 00000000..46161737
--- /dev/null
+++ b/recipes-graphics/wayland/weston/0013-MGS-1945-Use-common-API-to-support-G2d-compositor.patch
@@ -0,0 +1,196 @@
1From bdf9a0349f84997397a1c9352ee041e6fa4256a9 Mon Sep 17 00:00:00 2001
2From: "yong.gan" <yong.gan@nxp.com>
3Date: Thu, 23 Jun 2016 09:15:51 +0800
4Subject: [PATCH] MGS-1945: Use common API to support G2d compositor.
5
6Replace gcoOS_WaylandCreateVivGlobal with eglBindWaylandDisplayWL.
7Fix a width set error in g2d_renderer_attach_shm.
8Use noncached buffer in weston shm buffer.
9
10Upstream-Status: Inappropriate [i.MX specific]
11Date: Jun 21, 2016
12Signed-off-by: Yong Gan <yong.gan@nxp.com>
13---
14 Makefile.am | 4 ++++
15 src/g2d-renderer.c | 44 +++++++++++++++++++++++++++-----------------
16 src/g2d-renderer.h | 1 +
17 3 files changed, 32 insertions(+), 17 deletions(-)
18
19diff --git a/Makefile.am b/Makefile.am
20index f62bfc7..207864f 100644
21--- a/Makefile.am
22+++ b/Makefile.am
23@@ -214,6 +214,7 @@ gl_renderer_la_SOURCES = \
24 src/vertex-clipping.h \
25 shared/helpers.h
26 endif
27+
28 module_LTLIBRARIES += g2d-renderer.la
29 g2d_renderer_la_LDFLAGS = -module -avoid-version
30 g2d_renderer_la_LIBADD = $(COMPOSITOR_LIBS) $(EGL_LIBS) -lg2d
31@@ -226,6 +227,9 @@ g2d_renderer_la_SOURCES = \
32 src/g2d-renderer.c \
33 src/vertex-clipping.c \
34 src/vertex-clipping.h
35+if ENABLE_EGL
36+g2d_renderer_la_CFLAGS += -DENABLE_EGL
37+endif
38
39 if ENABLE_X11_COMPOSITOR
40 module_LTLIBRARIES += x11-backend.la
41diff --git a/src/g2d-renderer.c b/src/g2d-renderer.c
42index 4440fb9..0c26e91 100644
43--- a/src/g2d-renderer.c
44+++ b/src/g2d-renderer.c
45@@ -46,7 +46,7 @@
46 #include "shared/helpers.h"
47
48 #define BUFFER_DAMAGE_COUNT 2
49-extern struct wl_global* gcoOS_WaylandCreateVivGlobal(struct wl_display* display);
50+#define ALIGN_WIDTH(a) (((a) + 15) & ~15)
51
52 typedef struct _g2dRECT
53 {
54@@ -103,7 +103,11 @@ struct g2d_surface_state {
55 struct g2d_renderer {
56 struct weston_renderer base;
57 struct wl_signal destroy_signal;
58- struct wl_global *viv_global;
59+#ifdef ENABLE_EGL
60+ NativeDisplayType display;
61+ EGLDisplay egl_display;
62+ struct wl_display *wl_display;
63+#endif
64 void *handle;
65 };
66
67@@ -296,9 +300,10 @@ g2d_getG2dFormat(IN gceSURF_FORMAT Format, enum g2d_format* g2dFormat)
68 }
69 }
70
71-static void printG2dSurfaceInfo(struct g2d_surfaceEx* g2dSurface)
72+static void printG2dSurfaceInfo(struct g2d_surfaceEx* g2dSurface, const char* msg)
73 {
74- weston_log("physicAddr = %d left = %d right = %d top=%d bottom=%d stride= %d tiling = %d, format=%d \n",
75+ weston_log("%s physicAddr = %x left = %d right = %d top=%d bottom=%d stride= %d tiling = %d, format=%d \n",
76+ msg,
77 g2dSurface->base.planes[0],
78 g2dSurface->base.left,
79 g2dSurface->base.right,
80@@ -357,8 +362,8 @@ g2d_blitSurface(void *handle, struct g2d_surfaceEx * srcG2dSurface, struct g2d_s
81
82 if(g2d_blitEx(handle, srcG2dSurface, dstG2dSurface))
83 {
84- printG2dSurfaceInfo(srcG2dSurface);
85- printG2dSurfaceInfo(dstG2dSurface);
86+ printG2dSurfaceInfo(srcG2dSurface, "SRC:");
87+ printG2dSurfaceInfo(dstG2dSurface, "DST:");
88 return -1;
89 }
90 return 0;
91@@ -724,7 +729,7 @@ g2d_renderer_flush_damage(struct weston_surface *surface)
92 wl_shm_buffer_begin_access(buffer->shm_buffer);
93 if(gs->shm_buf)
94 {
95- int alignedWidth = (buffer->width + 15) & ~15;
96+ int alignedWidth = ALIGN_WIDTH(buffer->width);
97 if(alignedWidth == buffer->width)
98 {
99 int size = wl_shm_buffer_get_stride(buffer->shm_buffer)*buffer->height;
100@@ -743,7 +748,6 @@ g2d_renderer_flush_damage(struct weston_surface *surface)
101 }
102 }
103 }
104- g2d_cache_op(gs->shm_buf, G2D_CACHE_CLEAN);
105 }
106 else
107 {
108@@ -768,7 +772,6 @@ g2d_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer,
109 struct wl_shm_buffer *shm_buffer)
110 {
111 struct g2d_surface_state *gs = get_surface_state(es);
112- int stride = 0;
113 int buffer_length = 0;
114 int alloc_new_buff = 1;
115 int alignedWidth = 0;
116@@ -776,9 +779,7 @@ g2d_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer,
117 buffer->shm_buffer = shm_buffer;
118 buffer->width = wl_shm_buffer_get_width(shm_buffer);
119 buffer->height = wl_shm_buffer_get_height(shm_buffer);
120- alignedWidth = (buffer->width + 15) & ~15;
121- stride = wl_shm_buffer_get_stride(shm_buffer);
122- buffer_length = stride * buffer->height;
123+ alignedWidth = ALIGN_WIDTH(buffer->width);
124
125 switch (wl_shm_buffer_get_format(shm_buffer)) {
126 case WL_SHM_FORMAT_XRGB8888:
127@@ -812,7 +813,7 @@ g2d_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer,
128 {
129 if(gs->shm_buf)
130 g2d_free(gs->shm_buf);
131- gs->shm_buf = g2d_alloc(buffer_length, 1);
132+ gs->shm_buf = g2d_alloc(buffer_length, 0);
133 gs->g2d_surface.base.planes[0] = gs->shm_buf->buf_paddr;
134 }
135 gs->g2d_surface.base.left = 0;
136@@ -820,7 +821,7 @@ g2d_renderer_attach_shm(struct weston_surface *es, struct weston_buffer *buffer,
137 gs->g2d_surface.base.right = buffer->width;
138 gs->g2d_surface.base.bottom = buffer->height;
139 gs->g2d_surface.base.stride = alignedWidth;
140- gs->g2d_surface.base.width = buffer->width;
141+ gs->g2d_surface.base.width = alignedWidth;
142 gs->g2d_surface.base.height = buffer->height;
143 gs->g2d_surface.base.rot = G2D_ROTATION_0;
144 gs->g2d_surface.base.clrcolor = 0xFF400000;
145@@ -953,7 +954,7 @@ static void
146 g2d_renderer_output_destroy(struct weston_output *output)
147 {
148 struct g2d_output_state *go = get_output_state(output);
149- gctUINT32 i;
150+ int i;
151
152 for (i = 0; i < 2; i++)
153 {
154@@ -1005,8 +1006,12 @@ g2d_renderer_destroy(struct weston_compositor *ec)
155 struct g2d_renderer *gr = get_renderer(ec);
156
157 wl_signal_emit(&gr->destroy_signal, gr);
158- wl_global_destroy(gr->viv_global);
159 g2d_close(gr->handle);
160+#ifdef ENABLE_EGL
161+ eglUnbindWaylandDisplayWL(gr->egl_display);
162+ eglTerminate(gr->egl_display);
163+ fbDestroyDisplay(gr->display);
164+#endif
165 free(ec->renderer);
166 ec->renderer = NULL;
167 }
168@@ -1247,7 +1252,12 @@ g2d_renderer_output_create(struct weston_output *output, struct wl_display *wl_d
169 return -1;
170 go->clone_display_num = clone_display_num;
171 output->renderer_state = go;
172- gr->viv_global = gcoOS_WaylandCreateVivGlobal(wl_display);
173+#ifdef ENABLE_EGL
174+ gr->wl_display = wl_display;
175+ gr->display = fbGetDisplay(wl_display);
176+ gr->egl_display = eglGetDisplay(gr->display);
177+ eglBindWaylandDisplayWL(gr->egl_display, wl_display);
178+#endif
179 getBufferNumber(go);
180
181 if(g2d_renderer_surface_create(go, gr, displays[0]) < 0)
182diff --git a/src/g2d-renderer.h b/src/g2d-renderer.h
183index 45c72de..fc4ca49 100644
184--- a/src/g2d-renderer.h
185+++ b/src/g2d-renderer.h
186@@ -30,6 +30,7 @@
187
188 #ifdef ENABLE_EGL
189 #include <EGL/egl.h>
190+#include <EGL/eglext.h>
191 #endif
192
193 struct g2d_renderer_interface {
194--
1951.9.1
196
diff --git a/recipes-graphics/wayland/weston_%.bbappend b/recipes-graphics/wayland/weston_%.bbappend
index abf188b5..f0074288 100644
--- a/recipes-graphics/wayland/weston_%.bbappend
+++ b/recipes-graphics/wayland/weston_%.bbappend
@@ -11,6 +11,7 @@ SRC_URI_append_imxgpu2d = " \
11 file://0010-MGS-1284-1-xwld-Re-implement-weston-2d-renderer-with.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 \ 12 file://0011-MGS-1724-xwld-G2D-compositor-build-failed-in-slevk-b.patch \
13 file://0012-MGS-1783-xwld-Add-clone-mode-support-for-multi-displ.patch \ 13 file://0012-MGS-1783-xwld-Add-clone-mode-support-for-multi-displ.patch \
14 file://0013-MGS-1945-Use-common-API-to-support-G2d-compositor.patch \
14" 15"
15 16
16PACKAGECONFIG_IMX_TO_APPEND = "" 17PACKAGECONFIG_IMX_TO_APPEND = ""