diff options
author | Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com> | 2022-04-04 18:08:03 +0200 |
---|---|---|
committer | Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com> | 2022-04-04 18:08:03 +0200 |
commit | c4250bb3e7c3e77c1da0bdaf681207a4a891dce2 (patch) | |
tree | db3d21c4bd27f8de0582ea273ed8184507f70133 /recipes-graphics/wayland/weston | |
parent | 36589d57ee3fa9d3aac891f42c16d45622b00750 (diff) | |
download | meta-freescale-c4250bb3e7c3e77c1da0bdaf681207a4a891dce2.tar.gz |
weston: Add vsync to cloned displays.
When using g2d clone mode allocates additional surfaces according to
FB_MULTI_BUFFER for each cloned display. The g2d blit from the main screen
to the cloned displays is done using inactive surface. The FBIOPAN_DISPLAY
ioctl to the surface is done afterwards.
Diffstat (limited to 'recipes-graphics/wayland/weston')
-rw-r--r-- | recipes-graphics/wayland/weston/0001-g2d-renderer-Add-vsync-to-cloned-displays.patch | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/recipes-graphics/wayland/weston/0001-g2d-renderer-Add-vsync-to-cloned-displays.patch b/recipes-graphics/wayland/weston/0001-g2d-renderer-Add-vsync-to-cloned-displays.patch new file mode 100644 index 00000000..fb2d47bf --- /dev/null +++ b/recipes-graphics/wayland/weston/0001-g2d-renderer-Add-vsync-to-cloned-displays.patch | |||
@@ -0,0 +1,102 @@ | |||
1 | From b719011b7c015e2d6f0108c9d0709b98d21d6a89 Mon Sep 17 00:00:00 2001 | ||
2 | From: Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com> | ||
3 | Date: Mon, 21 Mar 2022 12:37:18 +0100 | ||
4 | Subject: [PATCH] g2d-renderer: Add vsync to cloned displays. | ||
5 | |||
6 | When using g2d clone mode allocates additional surfaces according to | ||
7 | FB_MULTI_BUFFER for each cloned display. The g2d blit from the main screen | ||
8 | to the cloned displays is done using inactive surface. The FBIOPAN_DISPLAY | ||
9 | ioctl to the surface is done afterwards. | ||
10 | |||
11 | Signed-off-by: Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com> | ||
12 | --- | ||
13 | libweston/renderer-g2d/g2d-renderer.c | 33 +++++++++++++++++++++------ | ||
14 | 1 file changed, 26 insertions(+), 7 deletions(-) | ||
15 | |||
16 | diff --git a/libweston/renderer-g2d/g2d-renderer.c b/libweston/renderer-g2d/g2d-renderer.c | ||
17 | index 34a077b7..3e6395d6 100644 | ||
18 | --- a/libweston/renderer-g2d/g2d-renderer.c | ||
19 | +++ b/libweston/renderer-g2d/g2d-renderer.c | ||
20 | @@ -525,6 +525,7 @@ g2d_blit_surface(void *handle, struct g2d_surfaceEx * srcG2dSurface, struct g2d_ | ||
21 | static void | ||
22 | g2d_flip_surface(struct weston_output *output) | ||
23 | { | ||
24 | + int i; | ||
25 | struct g2d_output_state *go = get_output_state(output); | ||
26 | go->fb_info.varinfo.yoffset = go->activebuffer * go->fb_info.y_resolution; | ||
27 | |||
28 | @@ -532,6 +533,16 @@ g2d_flip_surface(struct weston_output *output) | ||
29 | { | ||
30 | weston_log("FBIOPAN_DISPLAY Failed\n"); | ||
31 | } | ||
32 | + | ||
33 | + for (i = 0; i < go->clone_display_num; i++) | ||
34 | + { | ||
35 | + go->mirror_fb_info[i].varinfo.yoffset = go->activebuffer * go->mirror_fb_info[i].y_resolution; | ||
36 | + if(ioctl(go->mirror_fb_info[i].fb_fd, FBIOPAN_DISPLAY, &(go->mirror_fb_info[i].varinfo)) < 0) | ||
37 | + { | ||
38 | + weston_log("FBIOPAN_DISPLAY clone %d Failed\n", i); | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | go->activebuffer = (go->activebuffer + 1) % go->nNumBuffers; | ||
43 | } | ||
44 | |||
45 | @@ -571,17 +582,18 @@ copy_to_framebuffer(struct weston_output *output, pixman_region32_t* output_dama | ||
46 | int i = 0; | ||
47 | for(i = 0; i < go->clone_display_num; i++) | ||
48 | { | ||
49 | + int idx = i * go->nNumBuffers + go->activebuffer; | ||
50 | g2dRECT srcRect = {0, 0, go->renderSurf[go->activebuffer].base.width, go->renderSurf[go->activebuffer].base.height}; | ||
51 | - g2dRECT dstrect = {0, 0, go->mirrorSurf[i].base.width, go->mirrorSurf[i].base.height}; | ||
52 | + g2dRECT dstrect = {0, 0, go->mirrorSurf[idx].base.width, go->mirrorSurf[idx].base.height}; | ||
53 | if(go->directBlit || go->nNumBuffers > 1) | ||
54 | { | ||
55 | g2d_blit_surface(gr->handle, &go->renderSurf[go->activebuffer], | ||
56 | - &go->mirrorSurf[i], &srcRect, &dstrect); | ||
57 | + &go->mirrorSurf[idx], &srcRect, &dstrect); | ||
58 | } | ||
59 | else | ||
60 | { | ||
61 | g2d_blit_surface(gr->handle, &go->offscreenSurface, | ||
62 | - &go->mirrorSurf[i], &srcRect, &dstrect); | ||
63 | + &go->mirrorSurf[idx], &srcRect, &dstrect); | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | @@ -2113,6 +2125,7 @@ g2d_fbdev_renderer_output_create(struct weston_output *output, | ||
68 | int clone_display_num = 0; | ||
69 | int count = 0; | ||
70 | int k=0, dispCount = 0; | ||
71 | + int offset = 0; | ||
72 | char displays[5][32]; | ||
73 | weston_log("g2d_renderer_output_create device=%s\n", device); | ||
74 | count = strlen(device); | ||
75 | @@ -2166,7 +2179,7 @@ g2d_fbdev_renderer_output_create(struct weston_output *output, | ||
76 | |||
77 | if(go->clone_display_num) | ||
78 | { | ||
79 | - go->mirrorSurf = zalloc(sizeof(struct g2d_surfaceEx) * clone_display_num); | ||
80 | + go->mirrorSurf = zalloc(sizeof(struct g2d_surfaceEx) * clone_display_num * go->nNumBuffers); | ||
81 | go->mirror_fb_info = zalloc(sizeof(struct fb_screeninfo) * clone_display_num); | ||
82 | if(go->mirrorSurf == NULL || go->mirror_fb_info == NULL) | ||
83 | return -1; | ||
84 | @@ -2178,9 +2191,15 @@ g2d_fbdev_renderer_output_create(struct weston_output *output, | ||
85 | weston_log("Open frame buffer failed.\n"); | ||
86 | return -1; | ||
87 | } | ||
88 | - get_G2dSurface_from_screeninfo(&go->mirror_fb_info[i], &go->mirrorSurf[i]); | ||
89 | - go->mirrorSurf[i].base.planes[0] = go->mirror_fb_info[i].physical; | ||
90 | - g2d_clear(gr->handle, &go->mirrorSurf[i].base); | ||
91 | + | ||
92 | + offset = go->mirror_fb_info[i].stride_bytes * go->mirror_fb_info[i].y_resolution; | ||
93 | + for(k = 0; k < go->nNumBuffers; k++) | ||
94 | + { | ||
95 | + int idx = i * go->nNumBuffers + k; | ||
96 | + get_G2dSurface_from_screeninfo(&go->mirror_fb_info[i], &go->mirrorSurf[idx]); | ||
97 | + go->mirrorSurf[idx].base.planes[0] = go->mirror_fb_info[i].physical + (offset * k); | ||
98 | + g2d_clear(gr->handle, &go->mirrorSurf[idx].base); | ||
99 | + } | ||
100 | } | ||
101 | } | ||
102 | g2d_finish(gr->handle); | ||