[PATCH 3/4] xwayland: Draw decoration on window manager side

Kristian Høgsberg krh at bitplanet.net
Wed Jul 31 09:58:44 PDT 2013


Thanks Uli, that's what I was thinking too, just didn't get time to reply.

Kristian

On Wed, Jul 31, 2013 at 7:41 AM, Uli Schlachter <psychon at znc.in> wrote:
> Hi,
>
> On 30.07.2013 18:13, Louis-Francis Ratté-Boulianne wrote:
>> Draw everything in a cairo image surface before copying it to the XCB
>> surface. That removes the flickering visible on rpi whenever the
>> decoration were redrawn.
>> ---
>>  src/xwayland/window-manager.c | 22 ++++++++++++++++++++--
>>  1 file changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
>> index b3c9251..57a5d99 100644
>> --- a/src/xwayland/window-manager.c
>> +++ b/src/xwayland/window-manager.c
>> @@ -97,6 +97,7 @@ struct weston_wm_window {
>>       xcb_window_t id;
>>       xcb_window_t frame_id;
>>       cairo_surface_t *cairo_surface;
>> +     cairo_surface_t *cairo_xcb_surface;
>>       struct weston_surface *surface;
>>       struct shell_surface *shsurf;
>>       struct wl_listener surface_destroy_listener;
>> @@ -900,12 +901,14 @@ weston_wm_handle_map_request(struct weston_wm *wm, xcb_generic_event_t *event)
>>       xcb_map_window(wm->conn, map_request->window);
>>       xcb_map_window(wm->conn, window->frame_id);
>>
>> -     window->cairo_surface =
>> +     window->cairo_xcb_surface =
>>               cairo_xcb_surface_create_with_xrender_format(wm->conn,
>>                                                            wm->screen,
>>                                                            window->frame_id,
>>                                                            &wm->format_rgba,
>>                                                            width, height);
>> +     window->cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
>> +                                                         width, height);
> [...]
>
> Why do you use an image surface for this? I would suggest to use
> cairo_surface_create_similar() instead. This might then give you an XCB surface
> drawing to a temporary pixmap (but it could also be an image surface or
> something completely different).
>
> If there is some reason for forcing image surfaces and if depending on cairo
> 1.12 is no problem, I would suggest to use cairo_surface_create_similar_image()
> at least. This would make it possible for cairo to use shared memory instead of
> sending all the pixels over the X11 socket.
>
> And a third idea would be to use cairo_push_group(); /
> cairo_pop_group_to_source(); cairo_paint();. This would need to be done around
> the drawing code. I don't know this code and I am too lazy to look it up, but if
> this works and could be done easily, this would avoid the memory usage for
> keeping the double-buffering surface around always.
>
> Cheers,
> Uli
> --
> - He made himself, me nothing, you nothing out of the dust
> - Er machte sich mir nichts, dir nichts aus dem Staub
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list