[PATCH 3/3] desktop-shell: resize background and panel surfaces on output resize
When an output is resized (permanent mode switch), we should also notify the shell client so that the panel and background fits to the new screen dimensions. Signed-off-by: David Fort --- desktop-shell/shell.c | 93 +++ desktop-shell/shell.h | 8 - 2 files changed, 86 insertions(+), 15 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 7d5bca9..42c0757 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4364,6 +4364,20 @@ configure_static_view(struct weston_view *ev, struct weston_layer *layer) } } + +static struct shell_output * +find_shell_output_from_weston_output(struct desktop_shell *shell, struct weston_output *output) +{ + struct shell_output *shell_output; + + wl_list_for_each(shell_output, &shell->output_list, link) { + if (shell_output->output == output) + return shell_output; + } + + return NULL; +} + static int background_get_label(struct weston_surface *surface, char *buf, size_t len) { @@ -4383,6 +4397,16 @@ background_configure(struct weston_surface *es, int32_t sx, int32_t sy) } static void +handle_background_surface_destroy(struct wl_listener *listener, void *data) +{ + struct shell_output *output = + container_of(listener, struct shell_output, background_surface_listener); + + weston_log("background surface gone\n"); + output->background_surface = NULL; +} + +static void desktop_shell_set_background(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output_resource, @@ -4391,6 +4415,7 @@ desktop_shell_set_background(struct wl_client *client, struct desktop_shell *shell = wl_resource_get_user_data(resource); struct weston_surface *surface = wl_resource_get_user_data(surface_resource); + struct shell_output *sh_output; struct weston_view *view, *next; if (surface->configure) { @@ -4413,6 +4438,12 @@ desktop_shell_set_background(struct wl_client *client, surface_resource, surface->output->width, surface->output->height); + + sh_output = find_shell_output_from_weston_output(shell, surface->output); + sh_output->background_surface = surface; + + sh_output->background_surface_listener.notify = handle_background_surface_destroy; + wl_signal_add(&surface->destroy_signal, &sh_output->background_surface_listener); } static int @@ -4434,6 +4465,17 @@ panel_configure(struct weston_surface *es, int32_t sx, int32_t sy) } static void +handle_panel_surface_destroy(struct wl_listener *listener, void *data) +{ + struct shell_output *output = + container_of(listener, struct shell_output, panel_surface_listener); + + weston_log("panel surface gone\n"); + output->panel_surface = NULL; +} + + +static void desktop_shell_set_panel(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output_resource, @@ -4443,6 +4485,7 @@ desktop_shell_set_panel(struct wl_client *client, struct weston_surface *surface = wl_resource_get_user_data(surface_resource); struct weston_view *view, *next; + struct shell_output *sh_output; if (surface->configure) { wl_resource_post_error(surface_resource, @@ -4464,6 +4507,12 @@ desktop_shell_set_panel(struct wl_client *client, surface_resource, surface->output->width, surface->output->height); + + sh_output = find_shell_output_from_weston_output(shell, surface->output); + sh_output->panel_surface = surface; + + sh_output->panel_surface_listener.notify = handle_panel_surface_destroy; + wl_signal_add(&surface->destroy_signal, &sh_output->panel_surface_listener); } static int @@ -4494,16 +4543,6 @@ lock_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy) } static void -handle_lock_surface_destroy(struct wl_listener *listener, void *data) -{ - struct desktop_shell *shell = - container_of(listener, struct desktop_shell, lock_surface_listener); - - weston_log("lock surface gone\n"); - shell->lock_surface = NULL; -} - -static void desktop_shell_set_lock_surface(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface_resource) @@ -4519,10 +4558,6 @@ desktop_shell_set_lock_surface(struct wl_client *client, shell->lock_surface = surface; - shell->lock_surface_listener.notify = handle_lock_surface_destroy; -
[PATCH 2/3] compositor: recompute output position on mode switch
When an output permanently changes its resolution, the output on the right should be moved accordingly. We also add an event for output resizing so that plugins can react when an output is resized. Signed-off-by: David Fort Reviewed-by: Pekka Paalanen --- src/compositor.c | 35 +-- src/compositor.h | 1 + 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index b6ef7f3..37fdd0c 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -143,6 +143,11 @@ static void weston_mode_switch_finish(struct weston_output *output, } } + +static void +weston_compositor_reflow_outputs(struct weston_compositor *compositor, + struct weston_output *resized_output, int delta_width); + WL_EXPORT int weston_output_mode_set_native(struct weston_output *output, struct weston_mode *mode, @@ -150,6 +155,7 @@ weston_output_mode_set_native(struct weston_output *output, { int ret; int mode_changed = 0, scale_changed = 0; + int32_t old_width; if (!output->switch_mode) return -1; @@ -165,11 +171,17 @@ weston_output_mode_set_native(struct weston_output *output, } } + old_width = output->width; output->native_mode = mode; output->native_scale = scale; weston_mode_switch_finish(output, mode_changed, scale_changed); + if (mode_changed || scale_changed) { + weston_compositor_reflow_outputs(output->compositor, output, output->width - old_width); + + wl_signal_emit(&output->compositor->output_resized_signal, output); + } return 0; } @@ -4062,23 +4074,25 @@ bind_output(struct wl_client *client, wl_output_send_done(resource); } -/* Move other outputs when one is removed so the space remains contiguos. */ +/* Move other outputs when one is resized so the space remains contiguous. */ static void -weston_compositor_remove_output(struct weston_compositor *compositor, - struct weston_output *remove_output) +weston_compositor_reflow_outputs(struct weston_compositor *compositor, + struct weston_output *resized_output, int delta_width) { struct weston_output *output; - int offset = 0; + bool start_resizing = false; + + if (!delta_width) + return; wl_list_for_each(output, &compositor->output_list, link) { - if (output == remove_output) { - offset = output->width; + if (output == resized_output) { + start_resizing = true; continue; } - if (offset > 0) { - weston_output_move(output, - output->x - offset, output->y); + if (start_resizing) { + weston_output_move(output, output->x + delta_width, output->y); output->dirty = 1; } } @@ -4101,7 +4115,7 @@ weston_output_destroy(struct weston_output *output) weston_presentation_feedback_discard_list(&output->feedback_list); - weston_compositor_remove_output(output->compositor, output); + weston_compositor_reflow_outputs(output->compositor, output, output->width); wl_list_remove(&output->link); wl_signal_emit(&output->compositor->output_destroyed_signal, output); @@ -4704,6 +4718,7 @@ weston_compositor_create(struct wl_display *display, void *user_data) wl_signal_init(&ec->output_created_signal); wl_signal_init(&ec->output_destroyed_signal); wl_signal_init(&ec->output_moved_signal); + wl_signal_init(&ec->output_resized_signal); wl_signal_init(&ec->session_signal); ec->session_active = 1; diff --git a/src/compositor.h b/src/compositor.h index 0bbf458..7c6d7d9 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -744,6 +744,7 @@ struct weston_compositor { struct wl_signal output_created_signal; struct wl_signal output_destroyed_signal; struct wl_signal output_moved_signal; + struct wl_signal output_resized_signal; /* callback argument: resized output */ struct wl_signal session_signal; int session_active; -- 2.7.4 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 0/3] RDP compositor needs love v3
So, the RDP compositor were given some love (2 patches integrated). I have made the changes for seat releasing. And I have also modified the handling of output resize and it should be better now. David Fort (3): rdp: don't release the seat until it is safe v2 compositor: recompute output position on mode switch desktop-shell: resize background and panel surfaces on output resize desktop-shell/shell.c | 93 +++ desktop-shell/shell.h | 8 - src/compositor-rdp.c | 34 --- src/compositor.c | 35 +-- src/compositor.h | 1 + 5 files changed, 133 insertions(+), 38 deletions(-) -- 2.7.4 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 1/3] rdp: don't release the seat until it is safe v2
Releasing a seat is not safe, so let's just announce it without keyboard and mouse until this is fixed. Without this patch we just can't reconnect on the RDP compositor as it crashes. v2: fixed the leak of the xkb_keymap Signed-off-by: David Fort Acked-by: Pekka Paalanen Reviewed-by: Sam Spilsbury --- src/compositor-rdp.c | 34 +- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c index 4fc7c74..1e7019f 100644 --- a/src/compositor-rdp.c +++ b/src/compositor-rdp.c @@ -109,7 +109,7 @@ enum peer_item_flags { struct rdp_peers_item { int flags; freerdp_peer *peer; - struct weston_seat seat; + struct weston_seat *seat; struct wl_list link; }; @@ -640,9 +640,10 @@ rdp_peer_context_free(freerdp_peer* client, RdpPeerContext* context) } if (context->item.flags & RDP_PEER_ACTIVATED) { - weston_seat_release_keyboard(&context->item.seat); - weston_seat_release_pointer(&context->item.seat); - weston_seat_release(&context->item.seat); + weston_seat_release_keyboard(context->item.seat); + weston_seat_release_pointer(context->item.seat); + /* XXX we should weston_seat_release(context->item.seat); here +* but it would crash on reconnect */ } Stream_Free(context->encode_stream, TRUE); @@ -911,9 +912,16 @@ xf_peer_activate(freerdp_peer* client) else snprintf(seat_name, sizeof(seat_name), "RDP peer @%s", settings->ClientAddress); - weston_seat_init(&peersItem->seat, b->compositor, seat_name); - weston_seat_init_keyboard(&peersItem->seat, keymap); - weston_seat_init_pointer(&peersItem->seat); + peersItem->seat = zalloc(sizeof(*peersItem->seat)); + if (!peersItem->seat) { + xkb_keymap_unref(keymap); + weston_log("unable to create a weston_seat\n"); + return FALSE; + } + + weston_seat_init(peersItem->seat, b->compositor, seat_name); + weston_seat_init_keyboard(peersItem->seat, keymap); + weston_seat_init_pointer(peersItem->seat); peersItem->flags |= RDP_PEER_ACTIVATED; @@ -952,7 +960,7 @@ xf_mouseEvent(rdpInput *input, UINT16 flags, UINT16 x, UINT16 y) if (flags & PTR_FLAGS_MOVE) { output = peerContext->rdpBackend->output; if (x < output->base.width && y < output->base.height) { - notify_motion_absolute(&peerContext->item.seat, weston_compositor_get_time(), + notify_motion_absolute(peerContext->item.seat, weston_compositor_get_time(), x, y); need_frame = true; } @@ -966,7 +974,7 @@ xf_mouseEvent(rdpInput *input, UINT16 flags, UINT16 x, UINT16 y) button = BTN_MIDDLE; if (button) { - notify_button(&peerContext->item.seat, weston_compositor_get_time(), button, + notify_button(peerContext->item.seat, weston_compositor_get_time(), button, (flags & PTR_FLAGS_DOWN) ? WL_POINTER_BUTTON_STATE_PRESSED : WL_POINTER_BUTTON_STATE_RELEASED ); need_frame = true; @@ -991,13 +999,13 @@ xf_mouseEvent(rdpInput *input, UINT16 flags, UINT16 x, UINT16 y) weston_event.discrete = (int)value; weston_event.has_discrete = true; - notify_axis(&peerContext->item.seat, weston_compositor_get_time(), + notify_axis(peerContext->item.seat, weston_compositor_get_time(), &weston_event); need_frame = true; } if (need_frame) - notify_pointer_frame(&peerContext->item.seat); + notify_pointer_frame(peerContext->item.seat); FREERDP_CB_RETURN(TRUE); } @@ -1010,7 +1018,7 @@ xf_extendedMouseEvent(rdpInput *input, UINT16 flags, UINT16 x, UINT16 y) output = peerContext->rdpBackend->output; if (x < output->base.width && y < output->base.height) { - notify_motion_absolute(&peerContext->item.seat, weston_compositor_get_time(), + notify_motion_absolute(peerContext->item.seat, weston_compositor_get_time(), x, y); } @@ -1073,7 +1081,7 @@ xf_input_keyboard_event(rdpInput *input, UINT16 flags, UINT16 code) /*weston_log("code=%x ext=%d vk_code=%x scan_code=%x\n", code, (flags & KBD_FLAGS_EXTENDED) ? 1 : 0, vk_code, scan_code);*/ - notify_key(&peerContext->item.seat, weston_compositor_get_time(), + notify_key(peerContext->item.seat, weston_compositor_get_time(), scan_code - 8, keyState, STATE_UPDATE_AUTOMATIC); } -- 2.7.4 _
Re: [PATCH 1/5] scanner: Fixed doxygen group name for _add_listener
Hi Bill, > On May 17, 2016, at 1:18 AM, spit...@gmail.com wrote: > > From: Bill Spitzak > > Signed-off-by: Bill Spitzak > --- > src/scanner.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/scanner.c b/src/scanner.c > index 037ebdb..33271bc 100644 > --- a/src/scanner.c > +++ b/src/scanner.c > @@ -1350,7 +1350,7 @@ emit_structs(struct wl_list *message_list, struct > interface *interface, enum sid > > if (side == CLIENT) { > printf("/**\n" > -" * @ingroup %s_iface\n" > +" * @ingroup iface_%s\n" > " */\n", interface->name); > printf("static inline int\n" > "%s_add_listener(struct %s *%s,\n" > -- > 1.9.1 This was on my list, but I didn't test it yet, so Acked-by: Yong Bakos However, IMHO it would be best to see this as a standalone patch rather than as the first in this series. yong ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] xdg-shell: add draw states for xdg_surface
I've inlined some replies below. On Fri, May 27, 2016 at 1:13 PM Yong Bakos wrote: > On May 27, 2016, at 10:29 AM, Mike Blumenkrantz > wrote: > > > > this adds a method for compositors to change various draw attributes > > for a surface > > > > Signed-off-by: Mike Blumenkrantz > > Signed-off-by: Jonas Ådahl > > Hi Mike & Jonas, > A question about communicating default state, and some > minor nits you can certainly ignore, inline below. > > > > --- > > unstable/xdg-shell/xdg-shell-unstable-v6.xml | 69 > > > 1 file changed, 69 insertions(+) > > > > diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml > b/unstable/xdg-shell/xdg-shell-unstable-v6.xml > > index dfd7e84..0fa76d4 100644 > > --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml > > +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml > > @@ -843,6 +843,75 @@ > > > > > > > > + > > + > > +The draw state enum defines optional states which describe how > > nit: that describe > "which" is correct and intended in this case. > > > +a client should draw a surface. A client must at least support > the > > +default state, and support for optional draw states is > explicitly > > +advertised using xdg_toplevel.set_available_draw_states. > > + > > +The default draw state implies that the client draws the surface > > +with complete window decorations. > > nit: Same paragraph, so remove line break > Line break was intentional: documentation will not generate a line break, but anyone reading the protocol file will see it. > > > +This may include, e.g., window frame and drop shadow. > > + > > +Each draw state defines an alteration to the default. Some draw > > +states may be combined, while some are mutually exclusive. See > > +each draw state for details. > > + > > +Desktop environments may extend this enum by taking up a range > of > > +values and documenting the range they chose in this description. > > +They are not required to document the values for the range that > they > > +chose. Ideally, any good extensions from a desktop environment > should > > nit: extension (singular) > > +make its way into standardization into this enum. > > + > > +The current reserved ranges are: > > + > > +0x - 0x0FFF: xdg-shell core values, documented below. > > +0x1000 - 0x1FFF: EFL > > + > > should there be a 0 entry in the enum for default? > (see my comment re: empty array below) > Other state enums begin at 1. > > > + > > + > > + The "no_shadow" draw state implies that the client must not > draw > > nit: not draw a > Using "a" would imply that the drop shadow is a singular unit instead of a combination of multiple shadow regions--a possible case. > > > + drop shadow around the surface. This may have side effects > > + on usability, e.g., the inability to activate client-initiated > > + interactive resize. > > + > > + > > + > > + > > + > > + > > +Set the draw state(s) which the client should use to draw a > given > > nit: that the client should > "which" is correct and intended in this case. > > > +surface. The absence of this event prior to an > xdg_surface.configure > > +event indicates that no change has occurred in the draw state > since the > > +previous xdg_surface.configure. > > + > > +Sending an empty array of states with this method resets a > surface to the > > +default draw state. > > Would it not be more explicit for compositors to pass a "default" enum > value rather > than an empty array? (Assuming there is a default in the draw_state enum, > per my > comment above.) > But, you will definitely know better than I! > This was discussed, and the resulting decision was that implementations would be simplified if the default value never got passed here. > > > + > > +This event is not sent by itself but as a latched state sent > prior to > > +the xdg_surface.configure event. When received, a client should > adapt > > +the drawing of the surface according to the state and respond > to the > > +configure event accordingly. See xdg_surface.ack_configure for > > +details. > > + > > +A compositor will only configure a client to draw with optional > states on a > > +given surface using the states which were advertised by that > surface using > > nit: that were advertised > "which" is correct and intended in this case. > > > +xdg_toplevel.set_available_draw_states. > > + > > + > > + > > + > > + > > + > > nit: advertise available draw states > Seems clearer, as there's no separation between "available" and > "optional," since > all draw states are optional. (Not being consistent here makes the reader > second- > guess, "are there avai
Re: [PATCH] xdg-shell: add draw states for xdg_surface
On May 27, 2016, at 10:29 AM, Mike Blumenkrantz wrote: > > this adds a method for compositors to change various draw attributes > for a surface > > Signed-off-by: Mike Blumenkrantz > Signed-off-by: Jonas Ådahl Hi Mike & Jonas, A question about communicating default state, and some minor nits you can certainly ignore, inline below. > --- > unstable/xdg-shell/xdg-shell-unstable-v6.xml | 69 > 1 file changed, 69 insertions(+) > > diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml > b/unstable/xdg-shell/xdg-shell-unstable-v6.xml > index dfd7e84..0fa76d4 100644 > --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml > +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml > @@ -843,6 +843,75 @@ > > > > + > + > +The draw state enum defines optional states which describe how nit: that describe > +a client should draw a surface. A client must at least support the > +default state, and support for optional draw states is explicitly > +advertised using xdg_toplevel.set_available_draw_states. > + > +The default draw state implies that the client draws the surface > +with complete window decorations. nit: Same paragraph, so remove line break > +This may include, e.g., window frame and drop shadow. > + > +Each draw state defines an alteration to the default. Some draw > +states may be combined, while some are mutually exclusive. See > +each draw state for details. > + > +Desktop environments may extend this enum by taking up a range of > +values and documenting the range they chose in this description. > +They are not required to document the values for the range that they > +chose. Ideally, any good extensions from a desktop environment should nit: extension (singular) > +make its way into standardization into this enum. > + > +The current reserved ranges are: > + > +0x - 0x0FFF: xdg-shell core values, documented below. > +0x1000 - 0x1FFF: EFL > + should there be a 0 entry in the enum for default? (see my comment re: empty array below) > + > + > + The "no_shadow" draw state implies that the client must not draw nit: not draw a > + drop shadow around the surface. This may have side effects > + on usability, e.g., the inability to activate client-initiated > + interactive resize. > + > + > + > + > + > + > +Set the draw state(s) which the client should use to draw a given nit: that the client should > +surface. The absence of this event prior to an xdg_surface.configure > +event indicates that no change has occurred in the draw state since > the > +previous xdg_surface.configure. > + > +Sending an empty array of states with this method resets a surface > to the > +default draw state. Would it not be more explicit for compositors to pass a "default" enum value rather than an empty array? (Assuming there is a default in the draw_state enum, per my comment above.) But, you will definitely know better than I! > + > +This event is not sent by itself but as a latched state sent prior to > +the xdg_surface.configure event. When received, a client should adapt > +the drawing of the surface according to the state and respond to the > +configure event accordingly. See xdg_surface.ack_configure for > +details. > + > +A compositor will only configure a client to draw with optional > states on a > +given surface using the states which were advertised by that surface > using nit: that were advertised > +xdg_toplevel.set_available_draw_states. > + > + > + > + > + > + nit: advertise available draw states Seems clearer, as there's no separation between "available" and "optional," since all draw states are optional. (Not being consistent here makes the reader second- guess, "are there available ones and optional ones?") > +Inform the compositor of optional draw states which are available > +for the xdg_toplevel. nit: of available draw states for the xdg_toplevel. (same as previous reason) > + > +Calling this after an xdg_toplevel's first commit will raise a > client error. > + > + Just a sanity check, since I haven't seen it in a protocol spec yet. Does scanner handle this combination of array and enum correctly? > + > + > > > This configure event asks the client to resize its toplevel surface or > -- > 2.5.5 yong ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Create cross wayland-scanner for toolchain or cross-development environment
Hi guys, Currently during cross compilation of the wayland library the wayland-scanner utility is built by cross-gcc and then used on the developer machine which lead build error. I suggest to build development version, for example, $(top_builddir)/build-wayland-scanner and to use this utility during cross-buildin the wayland package. When build is done the user can copy this release of scanner utility into his toolchain or into his SDK for example wit $(host-triplet) preffix cp $(top_builddir)/build-wayland-scanner SDK/bin/$(host_triplet)-wayland-scanner Then the user can make use this cross-wayland-scanner in his SDK, for example, like follow: $ ../MesaLib-10.3.4/configure WAILAND_SCANNER=$(SDK_DIR)/bin/$(target)-wayland-scanner I have attached the patch for you. Please look at this patch and please make decision related to cross building the wayland. Of course after applying attached patch we have to reconfigure src package; $ autoreconf -i Best Regards, Andrey K. diff -b --unified -Nr wayland-1.10.0-orig/Makefile.am wayland-1.10.0/Makefile.am --- wayland-1.10.0-orig/Makefile.am 2015-11-23 23:06:44.0 +0300 +++ wayland-1.10.0/Makefile.am 2016-05-18 15:15:08.399576274 +0300 @@ -2,6 +2,10 @@ SUBDIRS = doc endif +CC_FOR_BUILD = gcc +LD_FOR_BUILD = $(CC_FOR_BUILD) +COMPILE_FOR_BUILD = $(CC_FOR_BUILD) + ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} AM_CPPFLAGS = \ @@ -33,7 +37,7 @@ if USE_HOST_SCANNER wayland_scanner = wayland-scanner else -$(BUILT_SOURCES) : wayland-scanner +$(BUILT_SOURCES) : wayland-scanner build-wayland-scanner wayland_scanner = $(top_builddir)/wayland-scanner endif @@ -93,20 +97,44 @@ pkgconfig_DATA += src/wayland-client.pc src/wayland-server.pc +build-wayland-util.c: $(top_srcdir)/src/wayland-util.c + cp $< $@ + +build-scanner.c: $(top_srcdir)/src/scanner.c + cp $< $@ + +build-dtddata.S: $(top_srcdir)/src/dtddata.S + cp $< $@ + +build_wayland_scanner = $(top_builddir)/build-wayland-scanner +build_wayland_scanner_SOURCES = build-scanner.c build-wayland-util.c build-dtddata.S +build_wayland_scanner_LDADD = -lexpat -lxml2 +build_wayland_scanner_LINK = $(LD_FOR_BUILD) -o $@ + +build-%.o : build-%.c + $(AM_V_CC)$(COMPILE_FOR_BUILD) -I$(top_srcdir)/src -I/usr/include/libxml2 -MT $@ -MD -MP -MF $(DEPDIR)/build-$*.Tpo -c -o $@ $< + $(AM_V_at)$(am__mv) $(DEPDIR)/build-$*.Tpo $(DEPDIR)/build-$*.Po + +build-%.o : build-%.S + $(AM_V_CPPAS)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ + $(AM_V_CPPAS)$(COMPILE_FOR_BUILD) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ + $(am__mv) $$depbase.Tpo $$depbase.Po + + protocol/%-protocol.c : $(top_srcdir)/protocol/%.xml - $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@ + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(build_wayland_scanner) code < $< > $@ protocol/%-server-protocol.h : $(top_srcdir)/protocol/%.xml - $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header < $< > $@ + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(build_wayland_scanner) server-header < $< > $@ protocol/%-client-protocol.h : $(top_srcdir)/protocol/%.xml - $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < $< > $@ + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(build_wayland_scanner) client-header < $< > $@ protocol/%-server-protocol-core.h : $(top_srcdir)/protocol/%.xml - $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header -c < $< > $@ + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(build_wayland_scanner) server-header -c < $< > $@ protocol/%-client-protocol-core.h : $(top_srcdir)/protocol/%.xml - $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header -c < $< > $@ + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(build_wayland_scanner) client-header -c < $< > $@ BUILT_SOURCES = \ $(nodist_libwayland_server_la_SOURCES) \ @@ -168,7 +196,7 @@ exec-fd-leak-checker noinst_PROGRAMS =\ - fixed-benchmark + fixed-benchmark build-wayland-scanner check_LTLIBRARIES = libtest-runner.la ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 1/5] scanner: Fixed doxygen group name for _add_listener
From: Bill Spitzak Signed-off-by: Bill Spitzak --- src/scanner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scanner.c b/src/scanner.c index 037ebdb..33271bc 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -1350,7 +1350,7 @@ emit_structs(struct wl_list *message_list, struct interface *interface, enum sid if (side == CLIENT) { printf("/**\n" - " * @ingroup %s_iface\n" + " * @ingroup iface_%s\n" " */\n", interface->name); printf("static inline int\n" "%s_add_listener(struct %s *%s,\n" -- 1.9.1 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 2/5] client: Cleanup to hold lock for less time
From: Bill Spitzak Splits the allocation of wl_proxy from the assignment of the id. This removes some code such as the malloc from the lock, possibly improving multithreaded performance. Removes unnecessary lock in wl_proxy_create_wrapper. This does not change the public api. Signed-off-by: Bill Spitzak --- src/wayland-client.c | 157 +-- 1 file changed, 77 insertions(+), 80 deletions(-) diff --git a/src/wayland-client.c b/src/wayland-client.c index 03c087a..9934cd2 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -325,24 +325,13 @@ wl_display_create_queue(struct wl_display *display) } static struct wl_proxy * -proxy_create(struct wl_proxy *factory, const struct wl_interface *interface, -uint32_t version) +proxy_new(const struct wl_interface *interface) { - struct wl_proxy *proxy; - struct wl_display *display = factory->display; - - proxy = zalloc(sizeof *proxy); - if (proxy == NULL) - return NULL; - - proxy->object.interface = interface; - proxy->display = display; - proxy->queue = factory->queue; - proxy->refcount = 1; - proxy->version = version; - - proxy->object.id = wl_map_insert_new(&display->objects, 0, proxy); - + struct wl_proxy *proxy = zalloc(sizeof *proxy); + if (proxy) { + proxy->object.interface = interface; + proxy->refcount = 1; + } return proxy; } @@ -369,10 +358,16 @@ WL_EXPORT struct wl_proxy * wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface) { struct wl_display *display = factory->display; - struct wl_proxy *proxy; + struct wl_proxy *proxy = proxy_new(interface); + if (proxy == NULL) + return NULL; + + proxy->display = display; + proxy->queue = factory->queue; + proxy->version = factory->version; pthread_mutex_lock(&display->mutex); - proxy = proxy_create(factory, interface, factory->version); + proxy->object.id = wl_map_insert_new(&display->objects, 0, proxy); pthread_mutex_unlock(&display->mutex); return proxy; @@ -383,19 +378,15 @@ static struct wl_proxy * wl_proxy_create_for_id(struct wl_proxy *factory, uint32_t id, const struct wl_interface *interface) { - struct wl_proxy *proxy; struct wl_display *display = factory->display; - - proxy = zalloc(sizeof *proxy); + struct wl_proxy *proxy = proxy_new(interface); if (proxy == NULL) return NULL; - proxy->object.interface = interface; - proxy->object.id = id; proxy->display = display; proxy->queue = factory->queue; - proxy->refcount = 1; proxy->version = factory->version; + proxy->object.id = id; wl_map_insert_at(&display->objects, 0, id, proxy); @@ -539,33 +530,63 @@ wl_proxy_add_dispatcher(struct wl_proxy *proxy, return 0; } -static struct wl_proxy * -create_outgoing_proxy(struct wl_proxy *proxy, const struct wl_message *message, - union wl_argument *args, - const struct wl_interface *interface, uint32_t version) +/* Return index of the new_id argument */ +static int +new_id_index(struct wl_proxy *proxy, uint32_t opcode) { - int i, count; - const char *signature; - struct argument_details arg; - struct wl_proxy *new_proxy = NULL; - - signature = message->signature; - count = arg_count_for_signature(signature); - for (i = 0; i < count; i++) { + int i; + const struct wl_message *message = + &proxy->object.interface->methods[opcode]; + const char *signature = message->signature; + int count = arg_count_for_signature(signature); + for (i = 0; ; i++) { + struct argument_details arg; + if (i >= count) + wl_abort("Missing new_id argument"); signature = get_next_argument(signature, &arg); + if (arg.type == 'n') + break; + } + return i; +} - switch (arg.type) { - case 'n': - new_proxy = proxy_create(proxy, interface, version); - if (new_proxy == NULL) - return NULL; +/* Does wl_proxy_marshal_array, but also allocates an id for new_proxy + * if it is not null before sending the message (which requires the + * lock that this holds). + */ +static void +proxy_marshal_array(struct wl_proxy *proxy, + uint32_t opcode, + union wl_argument *args, + struct wl_proxy *new_proxy) +{ + struct wl_closure *closure; + const struct wl_message *message; - args[i].o = &new_proxy->object; - break; - } + pthrea
[PATCH 5/5] client: Added wl_registry_bind_id
From: Bill Spitzak This function assigns the id into an existing wl_proxy structure. Allows setting of the queue before binding so that events are sent to the correct thread. The arguments are purposely swapped around so that just changing wl_registry_bind to wl_registry_bind_id will not compile. The display-test modified to test this and show the usage. Signed-off-by: Bill Spitzak --- src/scanner.c | 29 +++-- src/wayland-client-core.h | 4 src/wayland-client.c | 15 ++- tests/display-test.c | 4 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/scanner.c b/src/scanner.c index fbe8193..3c0db01 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -1184,14 +1184,13 @@ emit_stubs(struct wl_list *message_list, struct interface *interface) */ if (!ret) continue; - if (!ret->interface_name) - continue; /* wl_registry_bind_id nyi */ printf("/**\n" " * @ingroup iface_%s\n", interface->name); printf(" *\n" " * Same as %s_%s() except it uses an existing proxy created by\n" " * %s_new().\n" - " */\n", interface->name, m->name, ret->interface_name); + " */\n", interface->name, m->name, + ret->interface_name ? ret->interface_name : "wl_proxy"); printf("static inline void\n"); printf("%s_%s_id(struct %s *%s", @@ -1200,23 +1199,33 @@ emit_stubs(struct wl_list *message_list, struct interface *interface) wl_list_for_each(a, &m->arg_list, link) { printf(", "); - if (a->type != NEW_ID) + if (a->type != NEW_ID) { emit_type(a); - else - printf("struct %s *", ret->interface_name); - printf("%s", a->name); + printf("%s", a->name); + } else if (ret->interface_name) { + printf("struct %s *proxy", ret->interface_name); + } else { + printf("uint32_t version, void *proxy"); + } } printf(")\n" "{\n" - "\twl_proxy_marshal_id((struct wl_proxy *) %s,\n" + "\twl_proxy_marshal_%s((struct wl_proxy *) %s,\n" "\t\t\t %s_%s", + ret->interface_name ? "id" : "bind", interface->name, interface->uppercase_name, m->uppercase_name); wl_list_for_each(a, &m->arg_list, link) { - printf(", %s", a->name); + if (a->type != NEW_ID) { + printf(", %s", a->name); + } else if (ret->interface_name) { + printf(", proxy"); + } else { + printf(", version, (struct wl_proxy *) proxy"); + } } printf(");\n"); @@ -1398,7 +1407,7 @@ emit_structs(struct wl_list *message_list, struct interface *interface, enum sid printf("/**\n" " * @ingroup iface_%s\n" " *\n" - " * Create a %s and allocate an id.\n" + " * Allocate a new %s.\n" " */\n" "static inline struct %s *\n" "%s_new(void)\n" diff --git a/src/wayland-client-core.h b/src/wayland-client-core.h index 8e48cab..84ceb70 100644 --- a/src/wayland-client-core.h +++ b/src/wayland-client-core.h @@ -128,6 +128,10 @@ void wl_proxy_marshal_id(struct wl_proxy *proxy, uint32_t opcode, ...); void +wl_proxy_marshal_bind(struct wl_proxy *factory, uint32_t opcode, + uint32_t name, uint32_t version, struct wl_proxy *new_proxy); + +void wl_proxy_marshal_array(struct wl_proxy *p, uint32_t opcode, union wl_argument *args); diff --git a/src/wayland-client.c b/src/wayland-client.c index d539bf7..326ca14 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -741,11 +741,24 @@ wl_proxy_marshal_id(struct wl_proxy *factory, uint32_t opcode, ...) new_proxy->display = factory->display; if (new_proxy->queue == NULL) new_proxy->queue = factory->queue; - new_proxy->version = factory->version; + if (new_proxy->version == 0) + new_proxy->version = factory->version; proxy_marshal_array(factory, opcode, args, new_proxy); } +/** Same as wl_proxy_marshal_id() except special handling of the new_id. + * The
[PATCH] xdg-shell: add draw states for xdg_surface
this adds a method for compositors to change various draw attributes for a surface Signed-off-by: Mike Blumenkrantz Signed-off-by: Jonas Ådahl --- unstable/xdg-shell/xdg-shell-unstable-v6.xml | 69 1 file changed, 69 insertions(+) diff --git a/unstable/xdg-shell/xdg-shell-unstable-v6.xml b/unstable/xdg-shell/xdg-shell-unstable-v6.xml index dfd7e84..0fa76d4 100644 --- a/unstable/xdg-shell/xdg-shell-unstable-v6.xml +++ b/unstable/xdg-shell/xdg-shell-unstable-v6.xml @@ -843,6 +843,75 @@ + + +The draw state enum defines optional states which describe how +a client should draw a surface. A client must at least support the +default state, and support for optional draw states is explicitly +advertised using xdg_toplevel.set_available_draw_states. + +The default draw state implies that the client draws the surface +with complete window decorations. +This may include, e.g., window frame and drop shadow. + +Each draw state defines an alteration to the default. Some draw +states may be combined, while some are mutually exclusive. See +each draw state for details. + +Desktop environments may extend this enum by taking up a range of +values and documenting the range they chose in this description. +They are not required to document the values for the range that they +chose. Ideally, any good extensions from a desktop environment should +make its way into standardization into this enum. + +The current reserved ranges are: + +0x - 0x0FFF: xdg-shell core values, documented below. +0x1000 - 0x1FFF: EFL + + + + The "no_shadow" draw state implies that the client must not draw + drop shadow around the surface. This may have side effects + on usability, e.g., the inability to activate client-initiated + interactive resize. + + + + + + +Set the draw state(s) which the client should use to draw a given +surface. The absence of this event prior to an xdg_surface.configure +event indicates that no change has occurred in the draw state since the +previous xdg_surface.configure. + +Sending an empty array of states with this method resets a surface to the +default draw state. + +This event is not sent by itself but as a latched state sent prior to +the xdg_surface.configure event. When received, a client should adapt +the drawing of the surface according to the state and respond to the +configure event accordingly. See xdg_surface.ack_configure for +details. + +A compositor will only configure a client to draw with optional states on a +given surface using the states which were advertised by that surface using +xdg_toplevel.set_available_draw_states. + + + + + + +Inform the compositor of optional draw states which are available +for the xdg_toplevel. + +Calling this after an xdg_toplevel's first commit will raise a client error. + + + + This configure event asks the client to resize its toplevel surface or -- 2.5.5 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH 3/5] client: Changed argument name from "proxy" to "factory" in constructors
From: Bill Spitzak I think this makes it less confusing. "factory" was already used for internal functions. Signed-off-by: Bill Spitzak --- src/wayland-client-core.h | 10 +- src/wayland-client.c | 48 +++ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/wayland-client-core.h b/src/wayland-client-core.h index b1d6515..52bb553 100644 --- a/src/wayland-client-core.h +++ b/src/wayland-client-core.h @@ -133,29 +133,29 @@ wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface); void * -wl_proxy_create_wrapper(void *proxy); +wl_proxy_create_wrapper(void *factory); void wl_proxy_wrapper_destroy(void *proxy_wrapper); struct wl_proxy * -wl_proxy_marshal_constructor(struct wl_proxy *proxy, +wl_proxy_marshal_constructor(struct wl_proxy *factory, uint32_t opcode, const struct wl_interface *interface, ...); struct wl_proxy * -wl_proxy_marshal_constructor_versioned(struct wl_proxy *proxy, +wl_proxy_marshal_constructor_versioned(struct wl_proxy *factory, uint32_t opcode, const struct wl_interface *interface, uint32_t version, ...); struct wl_proxy * -wl_proxy_marshal_array_constructor(struct wl_proxy *proxy, +wl_proxy_marshal_array_constructor(struct wl_proxy *factory, uint32_t opcode, union wl_argument *args, const struct wl_interface *interface); struct wl_proxy * -wl_proxy_marshal_array_constructor_versioned(struct wl_proxy *proxy, +wl_proxy_marshal_array_constructor_versioned(struct wl_proxy *factory, uint32_t opcode, union wl_argument *args, const struct wl_interface *interface, diff --git a/src/wayland-client.c b/src/wayland-client.c index 9934cd2..f67678b 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -532,11 +532,11 @@ wl_proxy_add_dispatcher(struct wl_proxy *proxy, /* Return index of the new_id argument */ static int -new_id_index(struct wl_proxy *proxy, uint32_t opcode) +new_id_index(struct wl_proxy *factory, uint32_t opcode) { int i; const struct wl_message *message = - &proxy->object.interface->methods[opcode]; + &factory->object.interface->methods[opcode]; const char *signature = message->signature; int count = arg_count_for_signature(signature); for (i = 0; ; i++) { @@ -591,7 +591,7 @@ proxy_marshal_array(struct wl_proxy *proxy, /** Prepare a request to be sent to the compositor * - * \param proxy The proxy object + * \param factory The proxy object * \param opcode Opcode of the request to be sent * \param args Extra arguments for the given request * \param interface The interface to use for the new proxy @@ -613,19 +613,19 @@ proxy_marshal_array(struct wl_proxy *proxy, * \memberof wl_proxy */ WL_EXPORT struct wl_proxy * -wl_proxy_marshal_array_constructor(struct wl_proxy *proxy, +wl_proxy_marshal_array_constructor(struct wl_proxy *factory, uint32_t opcode, union wl_argument *args, const struct wl_interface *interface) { - return wl_proxy_marshal_array_constructor_versioned(proxy, opcode, + return wl_proxy_marshal_array_constructor_versioned(factory, opcode, args, interface, - proxy->version); + factory->version); } /** Prepare a request to be sent to the compositor * - * \param proxy The proxy object + * \param factory The proxy object * \param opcode Opcode of the request to be sent * \param args Extra arguments for the given request * \param interface The interface to use for the new proxy @@ -648,7 +648,7 @@ wl_proxy_marshal_array_constructor(struct wl_proxy *proxy, * \memberof wl_proxy */ WL_EXPORT struct wl_proxy * -wl_proxy_marshal_array_constructor_versioned(struct wl_proxy *proxy, +wl_proxy_marshal_array_constructor_versioned(struct wl_proxy *factory, uint32_t opcode, union wl_argument *args, const struct wl_interface *interface, @@ -660,13 +660,13 @@ wl_proxy_marshal_array_constructor_versioned(struct wl_proxy *proxy, new_proxy = proxy_new(interface); if (new_proxy == NULL) return NULL; - new_proxy->display = proxy->display; - ne
[PATCH 4/5] client: "_id" versions of constructors, alternative to proxy_wrapper
From: Bill Spitzak Scanner produces a wl_xyz_new() for each object, and for each constructor request it produces an "_id" version that takes one of these, instead of creating one. This allows the queue and listener to be set before creation of the object so events always go to the correct queue. Existing code using proxy_wrapper changed to use this. To implement this two new api's were added to wayland-client-core.h: wl_proxy_new(interface) wl_proxy_marshal_id(...): Same as wl_proxy_marshal except it handles 'n' arguments and assigns an id to them. wl_proxy_marshal could do this but it would add overhead to search for the 'n' to non-constructor requests. v2: Moved definition of wl_proxy back out of header file v3: _new api and named request _id. Signed-off-by: Bill Spitzak --- src/scanner.c | 59 ++ src/wayland-client-core.h | 6 src/wayland-client.c | 72 --- tests/queue-test.c| 15 +- 4 files changed, 127 insertions(+), 25 deletions(-) diff --git a/src/scanner.c b/src/scanner.c index 33271bc..fbe8193 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -1176,6 +1176,51 @@ emit_stubs(struct wl_list *message_list, struct interface *interface) ret->interface_name, ret->name); printf("}\n\n"); + + /* Produce the _id version of constructor calls. +* FIXME: this is a cut + paste patch, it would be better +* to reuse the above code and/or make the old constructor +* be the special case. +*/ + if (!ret) + continue; + if (!ret->interface_name) + continue; /* wl_registry_bind_id nyi */ + printf("/**\n" + " * @ingroup iface_%s\n", interface->name); + printf(" *\n" + " * Same as %s_%s() except it uses an existing proxy created by\n" + " * %s_new().\n" + " */\n", interface->name, m->name, ret->interface_name); + printf("static inline void\n"); + + printf("%s_%s_id(struct %s *%s", + interface->name, m->name, + interface->name, interface->name); + + wl_list_for_each(a, &m->arg_list, link) { + printf(", "); + if (a->type != NEW_ID) + emit_type(a); + else + printf("struct %s *", ret->interface_name); + printf("%s", a->name); + } + + printf(")\n" + "{\n" + "\twl_proxy_marshal_id((struct wl_proxy *) %s,\n" + "\t\t\t %s_%s", + interface->name, + interface->uppercase_name, + m->uppercase_name); + + wl_list_for_each(a, &m->arg_list, link) { + printf(", %s", a->name); + } + printf(");\n"); + + printf("}\n\n"); } } @@ -1349,6 +1394,20 @@ emit_structs(struct wl_list *message_list, struct interface *interface, enum sid printf("};\n\n"); if (side == CLIENT) { + if (strcmp(interface->name, "wl_display")) + printf("/**\n" + " * @ingroup iface_%s\n" + " *\n" + " * Create a %s and allocate an id.\n" + " */\n" + "static inline struct %s *\n" + "%s_new(void)\n" + "{\n" + "\treturn (struct %s *) wl_proxy_new(&%s_interface);\n" + "}\n\n", + interface->name, interface->name, interface->name, + interface->name, interface->name, interface->name); + printf("/**\n" " * @ingroup iface_%s\n" " */\n", interface->name); diff --git a/src/wayland-client-core.h b/src/wayland-client-core.h index 52bb553..8e48cab 100644 --- a/src/wayland-client-core.h +++ b/src/wayland-client-core.h @@ -125,10 +125,16 @@ void wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...); void +wl_proxy_marshal_id(struct wl_proxy *proxy, uint32_t opcode, ...); + +void wl_proxy_marshal_array(struct wl_proxy *p, uint32_t opcode, union wl_argument *args); struct wl_proxy * +wl_proxy_new(const struct wl_interface *interface); + +struct wl_proxy * wl_proxy_create(struct wl_proxy *factory, const struct wl_interface *interface); diff --git a/src/wayland-client.c b/src/wayland-client.c index f67678b..d539bf7 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -324,8 +324,17 @@ wl_display_create_queue(struct wl_display *display) return que
Re: [systemd-devel] [ANNOUNCE] systemd v230
On Sun, May 22, 2016 at 02:02:57PM +0500, Alexander E. Patrakov wrote: > 22.05.2016 13:33, Alexander E. Patrakov пишет: > >22.05.2016 03:51, Zbigniew Jędrzejewski-Szmek пишет: > >>Hi, > >> > >>systemd v230 has been tagged. Enjoy! > >> > >>CHANGES WITH 230: > > > > > > > >>* Framebuffer devices (/dev/fb*) and 3D printers and scanners > >> (devices tagged with ID_MAKER_TOOL) are now tagged with > >> "uaccess" and are available to logged in users. > > > >Has this been discussed with Wayland developers? Framebuffer device > >access can possibly be abused to take screenshots and draw on top of the > >compositor in a Wayland-based environment. Impossibility for arbitrary > >applications to take screenshots was one of the design goals of Wayland, > >and this change breaks it. > > > >So, unless one of Wayland developers confirms that they are OK with it, > >please revert it and ask for a CVE. > > > > Sorry, I have to take this back. Attempting to grab video from > /dev/fb0 here on Intel hardware, both under X and Weston, shows only > an image from the first virtual console - i.e. not the actual > session. Still, I would like someone else to confirm that this > behaviour is not Intel-specific and cannot be circumvented by, say, > ioctls on /dev/fb0. Hi, that change makes /dev/fb* behave the same as /dev/dri/card* and /dev/dri/render*. You are right that the user can control the device, this is by design: the processes of the same user are not isolated from one another and can do pretty much anything. To achieve isolation between processes running using the same uid some other mechanism must be used (selinux, seccomp, etc). Wayland offers separation between clients, but only when using the Wayland protocol, and not through side channels. >> Has this been discussed with Wayland developers? Framebuffer device A few Wayland developers commented on the bugs where this was discussed. Zbyszek ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] weston-launch: Handle invalid command line options
On Mon, May 16, 2016 at 3:43 PM, Yong Bakos wrote: > On May 7, 2016, at 5:57 AM, Otavio Salvador wrote: >> >> From: Tom Hochstein >> >> Exit the program if an unrecognized command line option is found. >> >> Signed-off-by; Tom Hochstein >> Signed-off-by: Otavio Salvador > > Simple enough of a review, and I did test this. But the question is > whether we want weston-launch to ignore invalid options or to quit in the > event of their presence. I'm not experienced enough to judge, so others > will have to chime in. So fwiw, > > Reviewed-by: Yong Bakos > Tested-by: Yong Bakos I believe it ought to fail so we know we are giving it invalid arguments otherwise it is very hard to identify why it is not behaving as expected. We had this problem when implementing the XWayland handling in OpenEmbedded. -- Otavio Salvador O.S. Systems http://www.ossystems.com.brhttp://code.ossystems.com.br Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH v3] client: Some cleanup and new _id versions of constructors
The first three patches are cleanup that does not change the api. In particular this change moves the malloc of wl_proxy outside the lock. Patch 4 adds an "_id" version of all the constructors that takes an existing wl_proxy, and a "_new" function to create these proxies. This is an alternative to wl_proxy_wrapper which I think is simpler to use, though it adds to the header files. Patch 5 adds an "_id" version of wl_registry_bind. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 3/6] Move the functions launching clients to main.c
Hello Giulio, With this patch, and mine to fix MODULEDIR of patch #2, this patch does not build due to incomplete type: src/screenshooter.c:46:24: error: field 'process' has incomplete type struct weston_process process; The patch look fine, if I ignore this building error, I also saw a lot of change about screenshoter in the following patch, that I can imagine resolve the issue. I do not know the policy of weston, but I guess you must fix this issue. Best regards. On 24/05/2016 18:59, Giulio Camuffo wrote: > They belong in the compositor rather than libweston since they > set signals handlers, and a library should not do that behind its > user's back. Besides, they were using functions in main.c already > so they were not usable by other compositors. > > Signed-off-by: Giulio Camuffo > --- > ivi-shell/hmi-controller.c | 1 + > src/compositor.c | 144 > src/compositor.h | 22 --- > src/main.c | 145 > + > src/text-backend.c | 1 + > src/weston.h | 24 +++ > tests/ivi_layout-test-plugin.c | 1 + > tests/weston-test.c| 1 + > xwayland/xwayland.h| 1 + > 9 files changed, 174 insertions(+), 166 deletions(-) > > diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c > index 97f78af..094682c 100644 > --- a/ivi-shell/hmi-controller.c > +++ b/ivi-shell/hmi-controller.c > @@ -62,6 +62,7 @@ > #include "ivi-hmi-controller-server-protocol.h" > #include "shared/helpers.h" > #include "shared/xalloc.h" > +#include "src/weston.h" > > > /* > * structure, globals > diff --git a/src/compositor.c b/src/compositor.c > index 5a52d86..3904ef0 100644 > --- a/src/compositor.c > +++ b/src/compositor.c > @@ -236,150 +236,6 @@ weston_output_mode_switch_to_temporary(struct > weston_output *output, > } > > static void > -child_client_exec(int sockfd, const char *path) > -{ > - int clientfd; > - char s[32]; > - sigset_t allsigs; > - > - /* do not give our signal mask to the new process */ > - sigfillset(&allsigs); > - sigprocmask(SIG_UNBLOCK, &allsigs, NULL); > - > - /* Launch clients as the user. Do not lauch clients with wrong euid.*/ > - if (seteuid(getuid()) == -1) { > - weston_log("compositor: failed seteuid\n"); > - return; > - } > - > - /* SOCK_CLOEXEC closes both ends, so we dup the fd to get a > - * non-CLOEXEC fd to pass through exec. */ > - clientfd = dup(sockfd); > - if (clientfd == -1) { > - weston_log("compositor: dup failed: %m\n"); > - return; > - } > - > - snprintf(s, sizeof s, "%d", clientfd); > - setenv("WAYLAND_SOCKET", s, 1); > - > - if (execl(path, path, NULL) < 0) > - weston_log("compositor: executing '%s' failed: %m\n", > - path); > -} > - > -WL_EXPORT struct wl_client * > -weston_client_launch(struct weston_compositor *compositor, > - struct weston_process *proc, > - const char *path, > - weston_process_cleanup_func_t cleanup) > -{ > - int sv[2]; > - pid_t pid; > - struct wl_client *client; > - > - weston_log("launching '%s'\n", path); > - > - if (os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, sv) < 0) { > - weston_log("weston_client_launch: " > - "socketpair failed while launching '%s': %m\n", > - path); > - return NULL; > - } > - > - pid = fork(); > - if (pid == -1) { > - close(sv[0]); > - close(sv[1]); > - weston_log("weston_client_launch: " > - "fork failed while launching '%s': %m\n", path); > - return NULL; > - } > - > - if (pid == 0) { > - child_client_exec(sv[1], path); > - _exit(-1); > - } > - > - close(sv[1]); > - > - client = wl_client_create(compositor->wl_display, sv[0]); > - if (!client) { > - close(sv[0]); > - weston_log("weston_client_launch: " > - "wl_client_create failed while launching '%s'.\n", > - path); > - return NULL; > - } > - > - proc->pid = pid; > - proc->cleanup = cleanup; > - weston_watch_process(proc); > - > - return client; > -} > - > -struct process_info { > - struct weston_process proc; > - char *path; > -}; > - > -static void > -process_handle_sigchld(struct weston_process *process, int status) > -{ > - struct process_info *pinfo = > - container_of(process, struct process_info, proc); > - > - /* > - * There are no guarantees whether this runs before or after > - * the wl_client destructor. > - */ > - > - if (WIFEXITE
Re: [PATCH 0/6] RDP compositor needs love v2
Hi David, On Fri, May 27, 2016 at 6:48 AM, Hardening wrote: > Le 26/04/2016 23:34, David Fort a écrit : >> Compared to the first version: >> compositor: recompute output position on mode switch >> desktop-shell: resize background, panel and lock surface on output >> resize >> I checked my mails and it seems like these two have been reviewed with comments by Pekka. -- Sam Spilsbury ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH weston 2/6] Split the modules and include files between weston and libweston
Hello Giulio, The idea of the patch is fine, but the patch doesn't work. See following comments. (@Quentin: no it's does not work as it is ;) ) On 24/05/2016 18:59, Giulio Camuffo wrote: > The backends are now installed in lib/libweston-0, and the include > files that will be used by libweston in include/libweston-0. The other > modules and weston-specific include files are kept in the old paths. > A new load_weston_module() is added to load plugins in the old path, > which is not part of libweston, but weston only and defined in main.c. > To allow that to be used by out of tree weston plugins, the function > is declared in a new weston.h, installed in include/weston. > > The -0 in the paths is the abi version of libweston, and it will be > used by the libweston .so too. When the abi change the number will > be increased. > > Signed-off-by: Giulio Camuffo > --- > Makefile.am| 28 +--- > configure.ac | 2 ++ > ivi-shell/ivi-layout.c | 3 ++- > src/compositor.c | 2 +- > src/main.c | 47 ++- > src/weston.h | 40 > src/weston.pc.in | 2 +- > 7 files changed, 109 insertions(+), 15 deletions(-) > create mode 100644 src/weston.h > > diff --git a/Makefile.am b/Makefile.am > index 00b74e5..da37526 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -5,6 +5,8 @@ noinst_PROGRAMS = > libexec_PROGRAMS = > moduledir = $(libdir)/weston > module_LTLIBRARIES = > +libweston_moduledir = $(libdir)/libweston-${LIBWESTON_ABI_VERSION} > +libweston_module_LTLIBRARIES = > noinst_LTLIBRARIES = > BUILT_SOURCES = > > @@ -49,7 +51,7 @@ AM_CPPFLAGS = \ > -I$(top_srcdir)/shared \ > -I$(top_builddir)/protocol \ > -DDATADIR='"$(datadir)"'\ > - -DMODULEDIR='"$(moduledir)"'\ Here you replace MODULESDIR as already commented by Quentin. But you need MODULEDIR to build weston-compositor. I fixed the build issue by adding MODULEDIR to weston-compositor C(PP)FLAGS as follow: diff --git a/Makefile.am b/Makefile.am index da37526..2554e1f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -64,8 +64,10 @@ CLEANFILES = weston.ini \ bin_PROGRAMS += weston weston_LDFLAGS = -export-dynamic -weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON -weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS) +weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON \ + -DMODULEDIR='"$(moduledir)"' +weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS) \ + -DMODULEDIR='"$(moduledir)"' weston_LDADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \ $(DLOPEN_LIBS) -lm $(CLOCK_GETTIME_LIBS) libshared.la After this change weston build and run. > + -DLIBWESTON_MODULEDIR='"$(libweston_moduledir)"' \ > -DLIBEXECDIR='"$(libexecdir)"' \ > -DBINDIR='"$(bindir)"' > > @@ -95,6 +97,7 @@ weston_SOURCES =\ > src/main.c \ > src/linux-dmabuf.c \ > src/linux-dmabuf.h \ > + src/weston.h\ > shared/helpers.h\ > shared/matrix.c \ > shared/matrix.h \ > @@ -104,7 +107,7 @@ weston_SOURCES = \ > src/weston-egl-ext.h > > if SYSTEMD_NOTIFY_SUPPORT > -module_LTLIBRARIES += systemd-notify.la > +libweston_module_LTLIBRARIES += systemd-notify.la > systemd_notify_la_LDFLAGS = -module -avoid-version > systemd_notify_la_LIBADD = $(SYSTEMD_DAEMON_LIBS) > systemd_notify_la_CFLAGS = \ > @@ -210,8 +213,8 @@ pkgconfig_DATA = src/weston.pc > wayland_sessiondir = $(datadir)/wayland-sessions > dist_wayland_session_DATA = src/weston.desktop > > -westonincludedir = $(includedir)/weston > -westoninclude_HEADERS = \ > +libwestonincludedir = $(includedir)/libweston-${LIBWESTON_ABI_VERSION} > +libwestoninclude_HEADERS = \ > src/version.h \ > src/compositor.h\ > src/compositor-drm.h\ > @@ -226,13 +229,16 @@ westoninclude_HEADERS = \ > shared/zalloc.h \ > shared/platform.h > > +westonincludedir = $(includedir)/weston > +westoninclude_HEADERS = src/weston.h > + > if ENABLE_IVI_SHELL > westoninclude_HEADERS += \ > ivi-shell/ivi-layout-export.h > endif > > if ENABLE_EGL > -module_LTLIBRARIES += gl-renderer.la > +libweston_module_LTLIBRARIES += gl-renderer.la > gl_renderer_la_LDFLAGS = -module -avoid-version > gl_renderer_la_LIBADD = $(CO
Re: [PATCH weston 1/6] Export weston_compositor_xkb_init, as required for libweston users
Hello Giulio, The patch do what it describe. Reviewed-by: Benoit Gschwind On 24/05/2016 18:59, Giulio Camuffo wrote: > --- > src/input.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/input.c b/src/input.c > index 8fe898c..c6cdedd 100644 > --- a/src/input.c > +++ b/src/input.c > @@ -2277,7 +2277,7 @@ bind_seat(struct wl_client *client, void *data, > uint32_t version, uint32_t id) > } > > #ifdef ENABLE_XKBCOMMON > -int > +WL_EXPORT int > weston_compositor_xkb_init(struct weston_compositor *ec, > struct xkb_rule_names *names) > { > @@ -2442,7 +2442,7 @@ weston_compositor_build_global_keymap(struct > weston_compositor *ec) > return 0; > } > #else > -int > +WL_EXPORT int > weston_compositor_xkb_init(struct weston_compositor *ec, > struct xkb_rule_names *names) > { > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 2/2] compositor-drm: Support linux_dmabuf output for sprite planes without gbm
Multiplanar formats are supported by using drmModeAddFB2 and bypassing gbm. If drmModeAddFB2 isn't available, the existing gbm bo import path is used and multiplanar formats are unsupported. Signed-off-by: Tomohito Esaki --- src/compositor-drm.c | 47 +++ 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index cd2fb71..d6a4a5a 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -960,11 +960,9 @@ page_flip_handler(int fd, unsigned int frame, static uint32_t drm_output_check_sprite_format(struct drm_sprite *s, - struct weston_view *ev, struct gbm_bo *bo) + struct weston_view *ev, uint32_t format) { - uint32_t i, format; - - format = gbm_bo_get_format(bo); + uint32_t i; if (format == GBM_FORMAT_ARGB) { pixman_region32_t r; @@ -1005,15 +1003,12 @@ drm_output_prepare_overlay_view(struct drm_output *output, struct drm_sprite *s; struct linux_dmabuf_buffer *dmabuf; int found = 0; - struct gbm_bo *bo; + struct gbm_bo *bo = NULL; pixman_region32_t dest_rect, src_rect; pixman_box32_t *box, tbox; uint32_t format; wl_fixed_t sx1, sy1, sx2, sy2; - if (b->gbm == NULL) - return NULL; - if (viewport->buffer.transform != output->base.transform) return NULL; @@ -1053,15 +1048,9 @@ drm_output_prepare_overlay_view(struct drm_output *output, if (!found) return NULL; - if ((dmabuf = linux_dmabuf_buffer_get(buffer_resource))) { + if ((dmabuf = linux_dmabuf_buffer_get(buffer_resource)) && + b->no_addfb2 && b->gbm) { #ifdef HAVE_GBM_FD_IMPORT - /* XXX: TODO: -* -* Use AddFB2 directly, do not go via GBM. -* Add support for multiplanar formats. -* Both require refactoring in the DRM-backend to -* support a mix of gbm_bos and drmfbs. -*/ struct gbm_import_fd_data gbm_dmabuf = { .fd = dmabuf->attributes.fd[0], .width = dmabuf->attributes.width, @@ -1078,22 +1067,24 @@ drm_output_prepare_overlay_view(struct drm_output *output, #else return NULL; #endif - } else { + } else if (b->gbm) { bo = gbm_bo_import(b->gbm, GBM_BO_IMPORT_WL_BUFFER, buffer_resource, GBM_BO_USE_SCANOUT); } - if (!bo) - return NULL; - - format = drm_output_check_sprite_format(s, ev, bo); - if (format == 0) { - gbm_bo_destroy(bo); - return NULL; - } - s->next = drm_fb_get_from_bo(bo, b, format); - if (!s->next) { - gbm_bo_destroy(bo); + if (bo) { + if (((format = drm_output_check_sprite_format( + s, ev, gbm_bo_get_format(bo))) == 0) || + (!(s->next = drm_fb_get_from_bo(bo, b, format { + gbm_bo_destroy(bo); + return NULL; + } + } else if (dmabuf) { + if (((format = drm_output_check_sprite_format( + s, ev, dmabuf->attributes.format)) == 0) || + (!(s->next = drm_fb_create_dmabuf(dmabuf, b, format + return NULL; + } else { return NULL; } -- 2.7.4 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH weston 1/2] compositor-drm: Add scanout support for linux_dmabuf buffers
This implementations bypasses gbm and passes the dmabuf handles directly to libdrm for composition. Signed-off-by: Tomohito Esaki --- src/compositor-drm.c | 128 +++ 1 file changed, 108 insertions(+), 20 deletions(-) diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 893877d..cd2fb71 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -150,6 +150,9 @@ struct drm_fb { /* Used by dumb fbs */ void *map; + + /* Used by dmabuf */ + struct linux_dmabuf_buffer *dmabuf; }; struct drm_edid { @@ -340,6 +343,84 @@ drm_fb_destroy_dumb(struct drm_fb *fb) free(fb); } +static inline void close_drm_handle(int fd, uint32_t handle) +{ + struct drm_gem_close gem_close = {.handle = handle}; + int ret; + + ret = drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &gem_close); + if (ret) + weston_log("DRM_IOCTL_GEM_CLOSE failed.(%s)\n", + strerror(errno)); +} + +static struct drm_fb * +drm_fb_create_dmabuf(struct linux_dmabuf_buffer *dmabuf, +struct drm_backend *backend, uint32_t format) +{ + struct drm_fb *fb; + uint32_t width, height, fb_id, handles[4] = {0}; + int i, ret; + + if (!format) + return NULL; + + width = dmabuf->attributes.width; + height = dmabuf->attributes.height; + if (backend->min_width > width || width > backend->max_width || + backend->min_height > height || height > backend->max_height) { + weston_log("dmabuf geometry out of bounds\n"); + return NULL; + } + + for (i = 0; i < dmabuf->attributes.n_planes; i++) { + ret = drmPrimeFDToHandle(backend->drm.fd, +dmabuf->attributes.fd[i], +&handles[i]); + if (ret) { + weston_log("drmPrimeFDToHandle() failed. %s\n", + strerror(errno)); + goto failed; + } + } + + fb = zalloc(sizeof *fb); + if (!fb) + goto failed; + + ret = drmModeAddFB2(backend->drm.fd, width, height, + format, handles, dmabuf->attributes.stride, + dmabuf->attributes.offset, &fb_id, 0); + if (ret) { + weston_log("drmModeAddFB2 failed. %s\n", strerror(errno)); + free(fb); + goto failed; + } + + fb->fb_id = fb_id; + fb->stride = dmabuf->attributes.stride[0]; + fb->fd = backend->drm.fd; + fb->dmabuf = dmabuf; + + return fb; + +failed: + for (i = 0; i < dmabuf->attributes.n_planes; i++) { + if (!handles[i]) + continue; + close_drm_handle(backend->drm.fd, handles[i]); + } + return NULL; +} + +static void drm_fb_destroy_dmabuf(struct drm_fb *fb) +{ + if (fb->fb_id) + drmModeRmFB(fb->fd, fb->fb_id); + weston_buffer_reference(&fb->buffer_ref, NULL); + free(fb); +} + static struct drm_fb * drm_fb_get_from_bo(struct gbm_bo *bo, struct drm_backend *backend, uint32_t format) @@ -426,6 +507,8 @@ drm_output_release_fb(struct drm_output *output, struct drm_fb *fb) if (fb->map && (fb != output->dumb[0] && fb != output->dumb[1])) { drm_fb_destroy_dumb(fb); + } else if (fb->dmabuf) { + drm_fb_destroy_dmabuf(fb); } else if (fb->bo) { if (fb->is_client_buffer) gbm_bo_destroy(fb->bo); @@ -437,13 +520,10 @@ drm_output_release_fb(struct drm_output *output, struct drm_fb *fb) static uint32_t drm_output_check_scanout_format(struct drm_output *output, - struct weston_surface *es, struct gbm_bo *bo) + struct weston_surface *es, uint32_t format) { - uint32_t format; pixman_region32_t r; - format = gbm_bo_get_format(bo); - if (format == GBM_FORMAT_ARGB) { /* We can scanout an ARGB buffer if the surface's * opaque region covers the whole output, but we have @@ -473,12 +553,13 @@ drm_output_prepare_scanout_view(struct drm_output *output, (struct drm_backend *)output->base.compositor->backend; struct weston_buffer *buffer = ev->surface->buffer_ref.buffer; struct weston_buffer_viewport *viewport = &ev->surface->buffer_viewport; - struct gbm_bo *bo; + struct linux_dmabuf_buffer *dmabuf; + struct gbm_bo *bo = NULL; uint32_t format; if (ev->geometry.x != output->base.x || ev->geometry.y != output->base.y || - buffer == NULL || b->gbm == NULL || + buffer == NULL || buffer->width != output->base.current_mode->width ||
[PATCH weston 0/2] compositor: Support linux_dmabuf multiplanar formats for scanout/sprite planes
These patches add support multiplanar formats by using linux_dmabuf instead of gbm for scanout/sprite plane importing. When rendering linux_dmabuf buffers, gbm isn't required, and multiplanar formats can be supported by using drmModeAddFB2() instead of gbm_import(). The first patch adapts the functions that create and destroy the drm_fb struct to add support for linux_dmabuf. Tomohito Esaki (2): compositor-drm: Add scanout support for linux_dmabuf buffers compositor-drm: Support linux_dmabuf output for sprite planes without gbm src/compositor-drm.c | 175 +-- 1 file changed, 127 insertions(+), 48 deletions(-) -- 2.7.4 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH 5/6] compositor: recompute output position on mode switch
On Tue, 26 Apr 2016 23:34:07 +0200 David Fort wrote: > When an output permanently changes its resolution, the output on the right > should be moved accordingly. We also add an event for output resizing so that > plugins can react when an output is resized. > > Signed-off-by: David Fort > --- > src/compositor.c | 34 -- > src/compositor.h | 1 + > 2 files changed, 25 insertions(+), 10 deletions(-) > > diff --git a/src/compositor.c b/src/compositor.c > index b88936b..6653bb2 100644 > --- a/src/compositor.c > +++ b/src/compositor.c > @@ -143,6 +143,11 @@ static void weston_mode_switch_finish(struct > weston_output *output, > } > } > > + > +static void > +weston_compositor_reflow_outputs(struct weston_compositor *compositor, > + struct weston_output *resized_output, int > delta_width); > + > WL_EXPORT int > weston_output_mode_set_native(struct weston_output *output, > struct weston_mode *mode, > @@ -150,6 +155,7 @@ weston_output_mode_set_native(struct weston_output > *output, > { > int ret; > int mode_changed = 0, scale_changed = 0; > + struct weston_mode *old_mode; > > if (!output->switch_mode) > return -1; > @@ -165,11 +171,16 @@ weston_output_mode_set_native(struct weston_output > *output, > } > } > > + old_mode = output->native_mode; > output->native_mode = mode; > output->native_scale = scale; > > weston_mode_switch_finish(output, mode_changed, scale_changed); > > + if (old_mode) > + weston_compositor_reflow_outputs(output->compositor, output, > mode->width - old_mode->width); Hi, I think you have to account for the scale here, too. Output position and size are in global units, while mode width and height are in output pixels, and the difference between those is the output scale. Since weston_mode_switch_finish() is already called, you could just inspect output->width instead of mode, and you should get the units right directly. > + > + wl_signal_emit(&output->compositor->output_resized_signal, output); > return 0; > } > > @@ -4047,23 +4058,25 @@ bind_output(struct wl_client *client, > wl_output_send_done(resource); > } > > -/* Move other outputs when one is removed so the space remains contiguos. */ > +/* Move other outputs when one is resized so the space remains contiguous. */ > static void > -weston_compositor_remove_output(struct weston_compositor *compositor, > - struct weston_output *remove_output) > +weston_compositor_reflow_outputs(struct weston_compositor *compositor, > + struct weston_output *resized_output, int > delta_width) > { > struct weston_output *output; > - int offset = 0; > + bool start_resizing = false; > + > + if (!delta_width) > + return; > > wl_list_for_each(output, &compositor->output_list, link) { > - if (output == remove_output) { > - offset = output->width; > + if (output == resized_output) { > + start_resizing = true; > continue; > } > > - if (offset > 0) { > - weston_output_move(output, > -output->x - offset, output->y); > + if (start_resizing) { > + weston_output_move(output, output->x + delta_width, > output->y); > output->dirty = 1; > } > } > @@ -4086,7 +4099,7 @@ weston_output_destroy(struct weston_output *output) > > weston_presentation_feedback_discard_list(&output->feedback_list); > > - weston_compositor_remove_output(output->compositor, output); > + weston_compositor_reflow_outputs(output->compositor, output, > output->width); > wl_list_remove(&output->link); > > wl_signal_emit(&output->compositor->output_destroyed_signal, output); > @@ -4706,6 +4719,7 @@ weston_compositor_create(struct wl_display *display, > void *user_data) > wl_signal_init(&ec->output_created_signal); > wl_signal_init(&ec->output_destroyed_signal); > wl_signal_init(&ec->output_moved_signal); > + wl_signal_init(&ec->output_resized_signal); > wl_signal_init(&ec->session_signal); > ec->session_active = 1; > > diff --git a/src/compositor.h b/src/compositor.h > index cb9df00..b71ade0 100644 > --- a/src/compositor.h > +++ b/src/compositor.h > @@ -743,6 +743,7 @@ struct weston_compositor { > struct wl_signal output_created_signal; > struct wl_signal output_destroyed_signal; > struct wl_signal output_moved_signal; > + struct wl_signal output_resized_signal; Please add a comment explaining what the callback data argument is. > > struct wl_signal session_signal; > int session_active; With those two fixed: Reviewed-by:
Re: [PATCH 6/6] desktop-shell: resize background, panel and lock surface on output resize
On Tue, 26 Apr 2016 23:34:08 +0200 David Fort wrote: > When an output is resized (permanent mode switch), we should also notify the > shell client so that the panel, background and the lock screen fits to the > new screen dimensions. > > Signed-off-by: David Fort > --- > desktop-shell/shell.c | 60 > +++ > desktop-shell/shell.h | 7 ++ > 2 files changed, 67 insertions(+) > > diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c > index cd269a8..99dcd3e 100644 > --- a/desktop-shell/shell.c > +++ b/desktop-shell/shell.c > @@ -4375,6 +4375,16 @@ background_configure(struct weston_surface *es, > int32_t sx, int32_t sy) > } > > static void > +handle_background_surface_destroy(struct wl_listener *listener, void *data) > +{ > + struct desktop_shell *shell = > + container_of(listener, struct desktop_shell, > background_surface_listener); > + > + weston_log("background surface gone\n"); > + shell->background_surface = NULL; > +} > + > +static void > desktop_shell_set_background(struct wl_client *client, >struct wl_resource *resource, >struct wl_resource *output_resource, > @@ -4405,6 +4415,10 @@ desktop_shell_set_background(struct wl_client *client, > surface_resource, > surface->output->width, > surface->output->height); > + shell->background_surface = surface; > + > + shell->background_surface_listener.notify = > handle_background_surface_destroy; > + wl_signal_add(&surface->destroy_signal, > &shell->background_surface_listener); This will cause list corruption with multiple outputs. > } > > static int > @@ -4426,6 +4440,17 @@ panel_configure(struct weston_surface *es, int32_t sx, > int32_t sy) > } > > static void > +handle_panel_surface_destroy(struct wl_listener *listener, void *data) > +{ > + struct desktop_shell *shell = > + container_of(listener, struct desktop_shell, > panel_surface_listener); > + > + weston_log("panel surface gone\n"); > + shell->panel_surface = NULL; > +} > + > + > +static void > desktop_shell_set_panel(struct wl_client *client, > struct wl_resource *resource, > struct wl_resource *output_resource, > @@ -4456,6 +4481,10 @@ desktop_shell_set_panel(struct wl_client *client, > surface_resource, > surface->output->width, > surface->output->height); > + > + shell->panel_surface_listener.notify = handle_panel_surface_destroy; > + wl_signal_add(&surface->destroy_signal, &shell->panel_surface_listener); > + shell->panel_surface = surface; This will cause list corruption with multiple outputs. > } > > static int > @@ -6368,11 +6397,40 @@ handle_output_destroy(struct wl_listener *listener, > void *data) > shell_for_each_layer(shell, shell_output_destroy_move_layer, output); > > wl_list_remove(&output_listener->destroy_listener.link); > + wl_list_remove(&output_listener->resized_listener.link); > wl_list_remove(&output_listener->link); > free(output_listener); > } > > static void > +shell_resize_surface_to_output(struct desktop_shell *shell, > + struct weston_surface *surface, > + const struct weston_output *output) > +{ > + if (!surface) > + return; > + > + weston_desktop_shell_send_configure(shell->child.desktop_shell, 0, > + surface->resource, > + output->width, > + output->height); > +} > + > + > +static void > +handle_output_resized(struct wl_listener *listener, void *data) > +{ > + struct shell_output *output_listener = That is not a listener, that is a shell_output. You probably looked at a place that actually had a struct myfoo_listener for an example, but here it is not like that. > + container_of(listener, struct shell_output, resized_listener); > + struct weston_output *output = output_listener->output; > + struct desktop_shell *shell = output_listener->shell; > + > + shell_resize_surface_to_output(shell, shell->background_surface, > output); > + shell_resize_surface_to_output(shell, shell->panel_surface, output); > + shell_resize_surface_to_output(shell, shell->lock_surface, output); I don't think we ever had the lock surface resized to fill the whole output. The lock surface is not per-output anyway, there is only one even with multiple outputs. Handling the lock surface correctly will need more work. Not only you need to ensure it stays centered, one should also tell it to resize only as necessary. We currently do not send any resi
Re: [PATCH] rdp: don't release the seat until it is safe v2
On Fri, 20 May 2016 15:02:02 +0200 Hardening wrote: > Le 20/05/2016 11:58, Sam Spilsbury a écrit : > > On Fri, May 20, 2016 at 5:33 PM, David Fort wrote: > >> Releasing a seat is not safe, so let's just announce it without keyboard > >> and mouse until this is fixed. Without this patch we just can't reconnect > >> on > >> the RDP compositor as it crashes. > >> > >> v2: fixed the leak of the xkb_keymap > >> > >> Signed-off-by: David Fort > >> --- > >> src/compositor-rdp.c | 33 - > >> 1 file changed, 20 insertions(+), 13 deletions(-) > >> > >> diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c > >> index 4fc7c74..52cf426 100644 > >> --- a/src/compositor-rdp.c > >> +++ b/src/compositor-rdp.c > >> @@ -109,7 +109,7 @@ enum peer_item_flags { > >> struct rdp_peers_item { > >> int flags; > >> freerdp_peer *peer; > >> - struct weston_seat seat; > >> + struct weston_seat *seat; > >> > >> struct wl_list link; > >> }; > >> @@ -640,9 +640,9 @@ rdp_peer_context_free(freerdp_peer* client, > >> RdpPeerContext* context) > >> } > >> > >> if (context->item.flags & RDP_PEER_ACTIVATED) { > >> - weston_seat_release_keyboard(&context->item.seat); > >> - weston_seat_release_pointer(&context->item.seat); > >> - weston_seat_release(&context->item.seat); > >> + weston_seat_release_keyboard(context->item.seat); > >> + weston_seat_release_pointer(context->item.seat); > >> + /*weston_seat_release(context->item.seat);*/ > >> } > > > > I think instead of just having commented out code, put the reasons why > > the seat cannot be released safely at the moment. Just having it > > commented out will confuse future maintainers. > > > > Well, future maintainers actually means me. The explanation is quite > long, I don't think a comment in the code is the right place for this. > And BTW it's not something that is RDP compositor specific, all the > weston compositors have it. That is even more reason to add a comment there. Please do so, gather review tags, and re-send. The future you is not the same as today's you. You don't have to make comment exhaustive, even though that would be good. As long as there is /* XXX: should weston_seat_release() here, but it will crash on reconnect */ or something like that would be enough. > >> > >> Stream_Free(context->encode_stream, TRUE); > >> @@ -911,9 +911,16 @@ xf_peer_activate(freerdp_peer* client) > >> else > >> snprintf(seat_name, sizeof(seat_name), "RDP peer @%s", > >> settings->ClientAddress); > >> > >> - weston_seat_init(&peersItem->seat, b->compositor, seat_name); > >> - weston_seat_init_keyboard(&peersItem->seat, keymap); > >> - weston_seat_init_pointer(&peersItem->seat); > >> + peersItem->seat = zalloc(sizeof(*peersItem->seat)); > >> + if (!peersItem->seat) { > >> + xkb_keymap_unref(keymap); > >> + weston_log("unable to create a weston_seat\n"); > >> + return FALSE; > >> + } > >> + > >> + weston_seat_init(peersItem->seat, b->compositor, seat_name); > >> + weston_seat_init_keyboard(peersItem->seat, keymap); > >> + weston_seat_init_pointer(peersItem->seat); > > > > Any reason to make this dynamically allocated memory? It seems to me > > like it is adding an additional point of failure for little added > > benefit. If it needs to be dynamically allocated, I think such a > > change should come in a separate patch, since it seems unrelated to > > this one. > > > > I have already answered this in a previous mail to Bryce. To do it > short, it's because the seat has to live longer than the RdpPeerContext. > So when the RDP peer disconnects, the RdpPeerContext will be destroyed > immediately, while the seat is supposed to live until all wayland client > have released it. > > > > Reviewed-by: Sam Spilsbury > > Yeah, it indeed seems no other backend dynamically destroys and re-creates whole seats, they only do it with the specific device capabilities, so the idea of this patch is good to me. However, I think you really should store the weston_seat pointer somewhere where it does not get lost, so you can re-use it, and destroy it on compositor shutdown. Anyway, leaking seems better than crashing, so: Acked-by: Pekka Paalanen Thanks, pq pgpmxxkvxjQ86.pgp Description: OpenPGP digital signature ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel