From bd2a61db01eba84c49a852338f171e5cf844308a Mon Sep 17 00:00:00 2001 From: Nobuhiko Tanibata Date: Wed, 14 May 2014 11:00:17 +0900 Subject: weston 1.4.93 --- .gitignore | 3 +++ Makefile.am | 10 +++++----- clients/desktop-shell.c | 2 ++ clients/editor.c | 33 +++++++++++++++++++++---------- clients/keyboard.c | 2 +- clients/simple-touch.c | 48 +++++++++++++++++++++++++++++++--------------- clients/window.c | 21 +++++++++++++++----- configure.ac | 4 ++-- desktop-shell/shell.c | 30 ++++++++++++++++++++++++++--- man/weston.man | 6 ++++++ patch.sh | 30 +++++++++++++++++++++++++++++ protocol/desktop-shell.xml | 25 +++++++++++++----------- src/compositor-drm.c | 33 +++++++++++++++++++++++-------- src/compositor-wayland.c | 13 +++++++++---- src/compositor.c | 12 ++++++++---- src/libinput-seat.c | 9 ++++++++- src/rpi-renderer.c | 4 ++-- src/vaapi-recorder.c | 42 +++++++++++++++++++++++++++++++--------- src/vaapi-recorder.h | 2 +- src/zoom.c | 47 --------------------------------------------- tests/weston-tests-env | 11 +++++++++-- wcap/main.c | 4 ++++ wcap/wcap-decode.c | 9 +++++++++ 23 files changed, 270 insertions(+), 130 deletions(-) create mode 100755 patch.sh diff --git a/.gitignore b/.gitignore index e0a73c03..f9a6a7b3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,12 @@ *.jpg *.la *.lo +*.log *.o *.pc *.so *.swp +*.trs *~ ctags cscope.out @@ -21,6 +23,7 @@ cscope.out /config.status /configure /libtool +/logs /stamp-h1 /test-driver /weston.ini diff --git a/Makefile.am b/Makefile.am index a247c3d4..343adc6c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -828,7 +828,7 @@ LA_LOG_COMPILER = $(srcdir)/tests/weston-tests-env WESTON_LOG_COMPILER = $(srcdir)/tests/weston-tests-env clean-local: - -rm -rf tests/logs + -rm -rf logs # To remove when automake 1.11 support is dropped export abs_builddir @@ -927,10 +927,10 @@ buffer_count_weston_LDADD = libtest-client.la $(EGL_TESTS_LIBS) endif if ENABLE_XWAYLAND_TEST -weston_tests += xwayland.weston -xwayland_weston_SOURCES = tests/xwayland-test.c -xwayland_weston_CFLAGS = $(GCC_CFLAGS) $(XWAYLAND_TEST_CFLAGS) -xwayland_weston_LDADD = libtest-client.la $(XWAYLAND_TEST_LIBS) +weston_tests += xwayland-test.weston +xwayland_test_weston_SOURCES = tests/xwayland-test.c +xwayland_test_weston_CFLAGS = $(GCC_CFLAGS) $(XWAYLAND_TEST_CFLAGS) +xwayland_test_weston_LDADD = libtest-client.la $(XWAYLAND_TEST_LIBS) endif matrix_test_SOURCES = \ diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 4880888a..e121cc73 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -724,6 +724,7 @@ background_draw(struct widget *widget, void *data) case BACKGROUND_SCALE: cairo_matrix_init_scale(&matrix, sx, sy); cairo_pattern_set_matrix(pattern, &matrix); + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD); break; case BACKGROUND_SCALE_CROP: s = (sx < sy) ? sx : sy; @@ -733,6 +734,7 @@ background_draw(struct widget *widget, void *data) cairo_matrix_init_translate(&matrix, tx, ty); cairo_matrix_scale(&matrix, s, s); cairo_pattern_set_matrix(pattern, &matrix); + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD); break; case BACKGROUND_TILE: cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); diff --git a/clients/editor.c b/clients/editor.c index 3b00833e..f3f61419 100644 --- a/clients/editor.c +++ b/clients/editor.c @@ -1011,7 +1011,17 @@ text_entry_draw_cursor(struct text_entry *entry, cairo_t *cr) cairo_stroke(cr); } -static const int text_offset_left = 10; +static int +text_offset_left(struct rectangle *allocation) +{ + return 10; +} + +static int +text_offset_top(struct rectangle *allocation) +{ + return allocation->height / 2; +} static void text_entry_redraw_handler(struct widget *widget, void *data) @@ -1048,7 +1058,9 @@ text_entry_redraw_handler(struct widget *widget, void *data) cairo_set_source_rgba(cr, 0, 0, 0, 1); - cairo_translate(cr, text_offset_left, allocation.height / 2); + cairo_translate(cr, + text_offset_left(&allocation), + text_offset_top(&allocation)); if (!entry->layout) entry->layout = pango_cairo_create_layout(cr); @@ -1075,6 +1087,7 @@ text_entry_motion_handler(struct widget *widget, { struct text_entry *entry = data; struct rectangle allocation; + int tx, ty; if (!entry->button_pressed) { return CURSOR_IBEAM; @@ -1082,10 +1095,10 @@ text_entry_motion_handler(struct widget *widget, widget_get_allocation(entry->widget, &allocation); - text_entry_set_cursor_position(entry, - x - allocation.x - text_offset_left, - y - allocation.y - text_offset_left, - false); + tx = x - allocation.x - text_offset_left(&allocation); + ty = y - allocation.y - text_offset_top(&allocation); + + text_entry_set_cursor_position(entry, tx, ty, false); return CURSOR_IBEAM; } @@ -1105,8 +1118,8 @@ text_entry_button_handler(struct widget *widget, widget_get_allocation(entry->widget, &allocation); input_get_position(input, &x, &y); - x -= allocation.x + text_offset_left; - y -= allocation.y + text_offset_left; + x -= allocation.x + text_offset_left(&allocation); + y -= allocation.y + text_offset_top(&allocation); editor = window_get_user_data(entry->window); @@ -1149,8 +1162,8 @@ text_entry_touch_handler(struct widget *widget, struct input *input, widget_get_allocation(entry->widget, &allocation); - x = tx - (allocation.x + text_offset_left); - y = ty - (allocation.y + text_offset_left); + x = tx - (allocation.x + text_offset_left(&allocation)); + y = ty - (allocation.y + text_offset_top(&allocation)); editor = window_get_user_data(entry->window); text_entry_activate(entry, seat); diff --git a/clients/keyboard.c b/clients/keyboard.c index cd1ad586..7c11cec5 100644 --- a/clients/keyboard.c +++ b/clients/keyboard.c @@ -530,7 +530,7 @@ append(char *s1, const char *s2) static void keyboard_handle_key(struct keyboard *keyboard, uint32_t time, const struct key *key, struct input *input, enum wl_pointer_button_state state) { - const char *label; + const char *label = NULL; switch(keyboard->state) { case KEYBOARD_STATE_DEFAULT : diff --git a/clients/simple-touch.c b/clients/simple-touch.c index b5a84d78..d8439aca 100644 --- a/clients/simple-touch.c +++ b/clients/simple-touch.c @@ -36,14 +36,18 @@ #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) +struct seat { + struct touch *touch; + struct wl_seat *seat; + struct wl_touch *wl_touch; +}; + struct touch { struct wl_display *display; struct wl_registry *registry; struct wl_compositor *compositor; struct wl_shell *shell; struct wl_shm *shm; - struct wl_seat *seat; - struct wl_touch *wl_touch; struct wl_pointer *pointer; struct wl_keyboard *keyboard; struct wl_surface *surface; @@ -199,18 +203,19 @@ static const struct wl_touch_listener touch_listener = { }; static void -seat_handle_capabilities(void *data, struct wl_seat *seat, +seat_handle_capabilities(void *data, struct wl_seat *wl_seat, enum wl_seat_capability caps) { - struct touch *touch = data; - - if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !touch->wl_touch) { - touch->wl_touch = wl_seat_get_touch(seat); - wl_touch_set_user_data(touch->wl_touch, touch); - wl_touch_add_listener(touch->wl_touch, &touch_listener, touch); - } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && touch->wl_touch) { - wl_touch_destroy(touch->wl_touch); - touch->wl_touch = NULL; + struct seat *seat = data; + struct touch *touch = seat->touch; + + if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !seat->wl_touch) { + seat->wl_touch = wl_seat_get_touch(wl_seat); + wl_touch_set_user_data(seat->wl_touch, touch); + wl_touch_add_listener(seat->wl_touch, &touch_listener, touch); + } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && seat->wl_touch) { + wl_touch_destroy(seat->wl_touch); + seat->wl_touch = NULL; } } @@ -218,6 +223,21 @@ static const struct wl_seat_listener seat_listener = { seat_handle_capabilities, }; +static void +add_seat(struct touch *touch, uint32_t name, uint32_t version) +{ + struct seat *seat; + + seat = malloc(sizeof *seat); + assert(seat); + + seat->touch = touch; + seat->wl_touch = NULL; + seat->seat = wl_registry_bind(touch->registry, name, + &wl_seat_interface, 1); + wl_seat_add_listener(seat->seat, &seat_listener, seat); +} + static void handle_ping(void *data, struct wl_shell_surface *shell_surface, uint32_t serial) @@ -261,9 +281,7 @@ handle_global(void *data, struct wl_registry *registry, &wl_shm_interface, 1); wl_shm_add_listener(touch->shm, &shm_listener, touch); } else if (strcmp(interface, "wl_seat") == 0) { - touch->seat = wl_registry_bind(registry, name, - &wl_seat_interface, 1); - wl_seat_add_listener(touch->seat, &seat_listener, touch); + add_seat(touch, name, version); } } diff --git a/clients/window.c b/clients/window.c index f12ce396..4592ef96 100644 --- a/clients/window.c +++ b/clients/window.c @@ -2605,10 +2605,15 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer, return; } + window = wl_surface_get_user_data(surface); + if (surface != window->main_surface->surface) { + DBG("Ignoring input event from subsurface %p\n", surface); + return; + } + input->display->serial = serial; input->pointer_enter_serial = serial; - input->pointer_focus = wl_surface_get_user_data(surface); - window = input->pointer_focus; + input->pointer_focus = window; if (window->resizing) { window->resizing = 0; @@ -2644,12 +2649,12 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer, float sx = wl_fixed_to_double(sx_w); float sy = wl_fixed_to_double(sy_w); - input->sx = sx; - input->sy = sy; - if (!window) return; + input->sx = sx; + input->sy = sy; + /* when making the window smaller - e.g. after a unmaximise we might * still have a pending motion event that the compositor has picked * based on the old surface dimensions @@ -2979,6 +2984,12 @@ touch_handle_down(void *data, struct wl_touch *wl_touch, return; } + if (surface != input->touch_focus->main_surface->surface) { + DBG("Ignoring input event from subsurface %p\n", surface); + input->touch_focus = NULL; + return; + } + if (input->grab) widget = input->grab; else diff --git a/configure.ac b/configure.ac index 0252faef..031a26f1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ m4_define([weston_major_version], [1]) m4_define([weston_minor_version], [4]) -m4_define([weston_micro_version], [92]) +m4_define([weston_micro_version], [93]) m4_define([weston_version], [weston_major_version.weston_minor_version.weston_micro_version]) @@ -222,7 +222,7 @@ if test x$enable_rdp_compositor = xyes; then CPPFLAGS="$SAVED_CPPFLAGS" fi -AC_ARG_ENABLE([screen-sharing], [--enable-screen-sharing],, +AC_ARG_ENABLE([screen-sharing], [ --enable-screen-sharing],, enable_screen_sharing=no) AM_CONDITIONAL([ENABLE_SCREEN_SHARING], [test x$enable_screen_sharing = xyes]) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 00922352..84f5c838 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -731,7 +731,7 @@ restore_focus_state(struct desktop_shell *shell, struct workspace *ws) wl_list_for_each_safe(seat, next_seat, &pending_seat_list, link) { wl_list_insert(&shell->compositor->seat_list, &seat->link); - if (state->seat->keyboard == NULL) + if (seat->keyboard == NULL) continue; weston_keyboard_set_focus(seat->keyboard, NULL); @@ -1027,8 +1027,17 @@ finish_workspace_change_animation(struct desktop_shell *shell, struct workspace *from, struct workspace *to) { + struct weston_view *view; + weston_compositor_schedule_repaint(shell->compositor); + /* Views that extend past the bottom of the output are still + * visible after the workspace animation ends but before its layer + * is hidden. In that case, we need to damage below those views so + * that the screen is properly repainted. */ + wl_list_for_each(view, &from->layer.view_list, layer_link) + weston_view_damage_below(view); + wl_list_remove(&shell->workspaces.animation.link); workspace_deactivate_transforms(from); workspace_deactivate_transforms(to); @@ -1444,7 +1453,7 @@ surface_touch_move(struct shell_surface *shsurf, struct weston_seat *seat) if (!shsurf) return -1; - if (shsurf->state.fullscreen) + if (shsurf->state.fullscreen || shsurf->state.maximized) return 0; move = malloc(sizeof *move); @@ -2797,6 +2806,19 @@ set_xwayland(struct shell_surface *shsurf, int x, int y, uint32_t flags) shsurf->state_changed = true; } +static void +shell_interface_set_fullscreen(struct shell_surface *shsurf, + uint32_t method, + uint32_t framerate, + struct weston_output *output) +{ + surface_clear_next_states(shsurf); + set_fullscreen(shsurf, method, framerate, output); + + shsurf->next_state.fullscreen = true; + shsurf->state_changed = true; +} + static int shell_interface_move(struct shell_surface *shsurf, struct weston_seat *ws) { @@ -4477,6 +4499,8 @@ lower_fullscreen_layer(struct desktop_shell *shell) /* Hide the black view */ wl_list_remove(&shsurf->fullscreen.black_view->layer_link); wl_list_init(&shsurf->fullscreen.black_view->layer_link); + weston_view_damage_below(shsurf->fullscreen.black_view); + } /* Lower the view to the workspace layer */ @@ -6113,7 +6137,7 @@ module_init(struct weston_compositor *ec, ec->shell_interface.get_primary_view = get_primary_view; ec->shell_interface.set_toplevel = set_toplevel; ec->shell_interface.set_transient = set_transient; - ec->shell_interface.set_fullscreen = set_fullscreen; + ec->shell_interface.set_fullscreen = shell_interface_set_fullscreen; ec->shell_interface.set_xwayland = set_xwayland; ec->shell_interface.move = shell_interface_move; ec->shell_interface.resize = surface_resize; diff --git a/man/weston.man b/man/weston.man index fd1c7a51..735235f5 100644 --- a/man/weston.man +++ b/man/weston.man @@ -130,6 +130,12 @@ suite. The file is searched for in .IR "__weston_modules_dir__" , or you can pass an absolute path. .TP +.BR \-\-no-config +Do not read +.I weston.ini +for the compositor. Avoids e.g. loading compositor modules via the +configuration file, which is useful for unit tests. +.TP \fB\-\^S\fR\fIname\fR, \fB\-\-socket\fR=\fIname\fR Weston will listen in the Wayland socket called .IR name . diff --git a/patch.sh b/patch.sh new file mode 100755 index 00000000..f92531b4 --- /dev/null +++ b/patch.sh @@ -0,0 +1,30 @@ +#!/bin/sh +patch -p1 < ../weston/0001-xwayland-Fix-fullscreen-mode.patch +patch -p1 < ../weston/0002-wcap-Check-for-mmap-and-malloc-return-value-in-wcap-.patch +patch -p1 < ../weston/0003-compositor-drm-Don-t-use-vaapi-recorder-with-unsuppo.patch +patch -p1 < ../weston/0004-Apply-the-zoom-transformation-before-the-output-tran.patch +patch -p1 < ../weston/0005-compositor-wayland-free-output-before-returning.patch +patch -p1 < ../weston/0006-compositor-wayland-assign-the-correct-mode.patch +patch -p1 < ../weston/0007-compositor-wayland-avoid-possible-NULL-deref-in-hand.patch +patch -p1 < ../weston/0008-clients-Initialize-label-in-keyboard-handling-code.patch +patch -p1 < ../weston/0009-shell-Fix-artifacts-caused-by-workspace-change-anima.patch +patch -p1 < ../weston/0010-simple-touch-Handle-multiple-seats-properly.patch +patch -p1 < ../weston/0011-shell-Fix-crash-when-restoring-focus-state-during-wo.patch +patch -p1 < ../weston/0012-shell-Don-t-allow-maximized-surfaces-to-be-moved-wit.patch +patch -p1 < ../weston/0013-desktop-shell-Fix-black-edges-on-scaled-desktop-patt.patch +patch -p1 < ../weston/0014-rpi-build-fix-for-compute_rects-debug.patch +patch -p1 < ../weston/0015-vaapi-recorder-Don-t-loop-trying-to-write-on-out-of-.patch +patch -p1 < ../weston/0016-libinput-seat-literal-values-for-WESTON_LIBINPUT_LOG.patch +patch -p1 < ../weston/0017-compositor-add-no-config-command-line-option.patch +patch -p1 < ../weston/0018-tests-use-no-config.patch +patch -p1 < ../weston/0019-tests-load-the-right-xwayland-plugin.patch +patch -p1 < ../weston/0020-tests-load-the-right-shell-plugin.patch +patch -p1 < ../weston/0021-tests-rename-xwayland-test.patch +patch -p1 < ../weston/0022-editor-Fix-cursor-positioning-with-pointer-and-touch.patch +patch -p1 < ../weston/0023-configure.ac-Fix-indent-for-screen-share-option.patch +patch -p1 < ../weston/0024-desktop-shell-Damage-the-black-view-when-we-remove-i.patch +patch -p1 < ../weston/0025-desktop-shell-Fix-order-of-desktop_shell-messages.patch +patch -p1 < ../weston/0026-gitignore-log-files-now-in-root-directory.patch +patch -p1 < ../weston/0027-build-let-make-clean-remove-logs-again.patch +patch -p1 < ../weston/0028-window-Ignore-input-events-from-subsurfaces.patch +patch -p1 < ../weston/0029-configure.ac-Bump-version-1.4.93.patch diff --git a/protocol/desktop-shell.xml b/protocol/desktop-shell.xml index 65e44a73..fdcb17ba 100644 --- a/protocol/desktop-shell.xml +++ b/protocol/desktop-shell.xml @@ -33,17 +33,6 @@ - - - Tell the server, that enough desktop elements have been drawn - to make the desktop look ready for use. During start-up, the - server can wait for this request with a black screen before - starting to fade in the desktop, for instance. If the client - parts of a desktop take a long time to initialize, we avoid - showing temporary garbage. - - - @@ -91,6 +80,20 @@ + + + + + + Tell the server, that enough desktop elements have been drawn + to make the desktop look ready for use. During start-up, the + server can wait for this request with a black screen before + starting to fade in the desktop, for instance. If the client + parts of a desktop take a long time to initialize, we avoid + showing temporary garbage. + + + diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 44413081..7d514e40 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -2557,6 +2557,18 @@ planes_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data } #ifdef BUILD_VAAPI_RECORDER +static void +recorder_destroy(struct drm_output *output) +{ + vaapi_recorder_destroy(output->recorder); + output->recorder = NULL; + + output->base.disable_planes--; + + wl_list_remove(&output->recorder_frame_listener.link); + weston_log("[libva recorder] done\n"); +} + static void recorder_frame_notify(struct wl_listener *listener, void *data) { @@ -2579,7 +2591,12 @@ recorder_frame_notify(struct wl_listener *listener, void *data) return; } - vaapi_recorder_frame(output->recorder, fd, output->current->stride); + ret = vaapi_recorder_frame(output->recorder, fd, + output->current->stride); + if (ret < 0) { + weston_log("[libva recorder] aborted: %m\n"); + recorder_destroy(output); + } } static void * @@ -2611,6 +2628,12 @@ recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key, struct drm_output, base.link); if (!output->recorder) { + if (output->format != GBM_FORMAT_XRGB8888) { + weston_log("failed to start vaapi recorder: " + "output format not supported\n"); + return; + } + width = output->base.current_mode->width; height = output->base.current_mode->height; @@ -2631,13 +2654,7 @@ recorder_binding(struct weston_seat *seat, uint32_t time, uint32_t key, weston_log("[libva recorder] initialized\n"); } else { - vaapi_recorder_destroy(output->recorder); - output->recorder = NULL; - - output->base.disable_planes--; - - wl_list_remove(&output->recorder_frame_listener.link); - weston_log("[libva recorder] done\n"); + recorder_destroy(output); } } #else diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index 67f15be9..a08b71ab 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -1149,7 +1149,7 @@ wayland_output_create_for_parent_output(struct wayland_compositor *c, if (poutput->current_mode) { mode = poutput->current_mode; } else if (poutput->preferred_mode) { - mode = poutput->current_mode; + mode = poutput->preferred_mode; } else if (!wl_list_empty(&poutput->mode_list)) { mode = container_of(poutput->mode_list.next, struct weston_mode, link); @@ -1424,8 +1424,10 @@ input_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, struct xkb_keymap *keymap; char *map_str; - if (!data) - goto error; + if (!data) { + close(fd); + return; + } if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) { map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); @@ -1723,8 +1725,11 @@ wayland_compositor_register_output(struct wayland_compositor *c, uint32_t id) output->id = id; output->global = wl_registry_bind(c->parent.registry, id, &wl_output_interface, 1); - if (!output->global) + if (!output->global) { + free(output); return; + } + wl_output_add_listener(output->global, &output_listener, output); output->scale = 0; diff --git a/src/compositor.c b/src/compositor.c index 3d65e4cd..574db2de 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -3198,8 +3198,6 @@ weston_output_update_matrix(struct weston_output *output) 2.0 / output->width, -2.0 / output->height, 1); - weston_output_compute_transform(output); - if (output->zoom.active) { magnification = 1 / (1 - output->zoom.spring_z.current); weston_output_update_zoom(output); @@ -3209,6 +3207,8 @@ weston_output_update_matrix(struct weston_output *output) magnification, 1.0); } + weston_output_compute_transform(output); + output->dirty = 0; } @@ -4042,6 +4042,7 @@ usage(int error_code) " -i, --idle-time=SECS\tIdle time in seconds\n" " --modules\t\tLoad the comma-separated list of modules\n" " --log==FILE\t\tLog to the given file\n" + " --no-config\t\tDo not read weston.ini\n" " -h, --help\t\tThis help message\n\n"); fprintf(stderr, @@ -4152,7 +4153,8 @@ int main(int argc, char *argv[]) int32_t help = 0; char *socket_name = "wayland-0"; int32_t version = 0; - struct weston_config *config; + int32_t noconfig = 0; + struct weston_config *config = NULL; struct weston_config_section *section; struct wl_client *primary_client; struct wl_listener primary_client_destroyed; @@ -4166,6 +4168,7 @@ int main(int argc, char *argv[]) { WESTON_OPTION_STRING, "log", 0, &log }, { WESTON_OPTION_BOOLEAN, "help", 'h', &help }, { WESTON_OPTION_BOOLEAN, "version", 0, &version }, + { WESTON_OPTION_BOOLEAN, "no-config", 0, &noconfig }, }; parse_options(core_options, ARRAY_LENGTH(core_options), &argc, argv); @@ -4204,7 +4207,8 @@ int main(int argc, char *argv[]) signals[3] = wl_event_loop_add_signal(loop, SIGCHLD, sigchld_handler, NULL); - config = weston_config_parse("weston.ini"); + if (noconfig == 0) + config = weston_config_parse("weston.ini"); if (config != NULL) { weston_log("Using config file '%s'\n", weston_config_get_full_path(config)); diff --git a/src/libinput-seat.c b/src/libinput-seat.c index a38d4705..d59ae429 100644 --- a/src/libinput-seat.c +++ b/src/libinput-seat.c @@ -271,8 +271,15 @@ udev_input_init(struct udev_input *input, struct weston_compositor *c, struct ud libinput_log_set_handler(&libinput_log_func, NULL); log_priority = getenv("WESTON_LIBINPUT_LOG_PRIORITY"); + if (log_priority) { - libinput_log_set_priority(strtol(log_priority, NULL, 10)); + if (strcmp(log_priority, "debug") == 0) { + libinput_log_set_priority(LIBINPUT_LOG_PRIORITY_DEBUG); + } else if (strcmp(log_priority, "info") == 0) { + libinput_log_set_priority(LIBINPUT_LOG_PRIORITY_INFO); + } else if (strcmp(log_priority, "error") == 0) { + libinput_log_set_priority(LIBINPUT_LOG_PRIORITY_ERROR); + } } input->libinput = libinput_udev_create_for_seat(&libinput_interface, input, diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c index 3a7f65cc..c222eb66 100644 --- a/src/rpi-renderer.c +++ b/src/rpi-renderer.c @@ -858,8 +858,8 @@ rpir_view_compute_rects(struct rpir_view *view, src_height = int_max(src_height, 0); DBG("rpir_view %p %dx%d: p1 %f, %f; p2 %f, %f\n", view, - view->view->geometry.width, - view->view->geometry.height, + view->view->surface->width, + view->view->surface->height, p1.f[0], p1.f[1], p2.f[0], p2.f[1]); DBG("src rect %d;%d, %d;%d, %d;%dx%d;%d\n", src_x >> 16, src_x & 0xffff, diff --git a/src/vaapi-recorder.c b/src/vaapi-recorder.c index 0095a42d..921494df 100644 --- a/src/vaapi-recorder.c +++ b/src/vaapi-recorder.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -93,6 +94,7 @@ struct vaapi_recorder { int width, height; int frame_count; + int error; int destroying; pthread_t worker_thread; pthread_mutex_t mutex; @@ -761,7 +763,13 @@ encoder_create_output_buffer(struct vaapi_recorder *r) return VA_INVALID_ID; } -static int +enum output_write_status { + OUTPUT_WRITE_SUCCESS, + OUTPUT_WRITE_OVERFLOW, + OUTPUT_WRITE_FATAL +}; + +static enum output_write_status encoder_write_output(struct vaapi_recorder *r, VABufferID output_buf) { VACodedBufferSegment *segment; @@ -770,19 +778,22 @@ encoder_write_output(struct vaapi_recorder *r, VABufferID output_buf) status = vaMapBuffer(r->va_dpy, output_buf, (void **) &segment); if (status != VA_STATUS_SUCCESS) - return -1; + return OUTPUT_WRITE_FATAL; if (segment->status & VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK) { r->encoder.output_size *= 2; vaUnmapBuffer(r->va_dpy, output_buf); - return -1; + return OUTPUT_WRITE_OVERFLOW; } count = write(r->output_fd, segment->buf, segment->size); vaUnmapBuffer(r->va_dpy, output_buf); - return count; + if (count < 0) + return OUTPUT_WRITE_FATAL; + + return OUTPUT_WRITE_SUCCESS; } static void @@ -792,9 +803,8 @@ encoder_encode(struct vaapi_recorder *r, VASurfaceID input) VABufferID buffers[8]; int count = 0; - - int slice_type; - int ret, i; + int i, slice_type; + enum output_write_status ret; if ((r->frame_count % r->encoder.intra_period) == 0) slice_type = SLICE_TYPE_I; @@ -829,7 +839,10 @@ encoder_encode(struct vaapi_recorder *r, VASurfaceID input) output_buf = VA_INVALID_ID; vaDestroyBuffer(r->va_dpy, buffers[--count]); - } while (ret < 0); + } while (ret == OUTPUT_WRITE_OVERFLOW); + + if (ret == OUTPUT_WRITE_FATAL) + r->error = errno; for (i = 0; i < count; i++) vaDestroyBuffer(r->va_dpy, buffers[i]); @@ -1138,11 +1151,19 @@ worker_thread_function(void *data) return NULL; } -void +int vaapi_recorder_frame(struct vaapi_recorder *r, int prime_fd, int stride) { + int ret = 0; + pthread_mutex_lock(&r->mutex); + if (r->error) { + errno = r->error; + ret = -1; + goto unlock; + } + /* The mutex is never released while encoding, so this point should * never be reached if input.valid is true. */ assert(!r->input.valid); @@ -1152,5 +1173,8 @@ vaapi_recorder_frame(struct vaapi_recorder *r, int prime_fd, int stride) r->input.valid = 1; pthread_cond_signal(&r->input_cond); +unlock: pthread_mutex_unlock(&r->mutex); + + return ret; } diff --git a/src/vaapi-recorder.h b/src/vaapi-recorder.h index 664b1f96..e3046980 100644 --- a/src/vaapi-recorder.h +++ b/src/vaapi-recorder.h @@ -29,7 +29,7 @@ struct vaapi_recorder * vaapi_recorder_create(int drm_fd, int width, int height, const char *filename); void vaapi_recorder_destroy(struct vaapi_recorder *r); -void +int vaapi_recorder_frame(struct vaapi_recorder *r, int fd, int stride); #endif /* _VAAPI_RECORDER_H_ */ diff --git a/src/zoom.c b/src/zoom.c index 622c0d7c..7553849d 100644 --- a/src/zoom.c +++ b/src/zoom.c @@ -110,50 +110,6 @@ zoom_area_center_from_pointer(struct weston_output *output, *y -= ((((*y - offset_y) / (float) h) - 0.5) * (h * (1.0 - level))); } -static void -weston_zoom_apply_output_transform(struct weston_output *output, - float *x, float *y) -{ - float tx, ty; - - switch(output->transform) { - case WL_OUTPUT_TRANSFORM_NORMAL: - default: - return; - case WL_OUTPUT_TRANSFORM_90: - tx = -*y; - ty = *x; - break; - case WL_OUTPUT_TRANSFORM_180: - tx = -*x; - ty = -*y; - break; - case WL_OUTPUT_TRANSFORM_270: - tx = *y; - ty = -*x; - break; - case WL_OUTPUT_TRANSFORM_FLIPPED: - tx = -*x; - ty = *y; - break; - case WL_OUTPUT_TRANSFORM_FLIPPED_90: - tx = -*y; - ty = -*x; - break; - case WL_OUTPUT_TRANSFORM_FLIPPED_180: - tx = *x; - ty = -*y; - break; - case WL_OUTPUT_TRANSFORM_FLIPPED_270: - tx = *y; - ty = *x; - break; - } - - *x = tx; - *y = ty; -} - static void weston_output_update_zoom_transform(struct weston_output *output) { @@ -183,9 +139,6 @@ weston_output_update_zoom_transform(struct weston_output *output) ((((global_y - output->y) / output->height) * (level * 2)) - level) * ratio; - weston_zoom_apply_output_transform(output, &output->zoom.trans_x, - &output->zoom.trans_y); - trans_max = level * 2 - level; trans_min = -trans_max; diff --git a/tests/weston-tests-env b/tests/weston-tests-env index 91800530..473e0925 100755 --- a/tests/weston-tests-env +++ b/tests/weston-tests-env @@ -22,12 +22,17 @@ if test -z "$BACKEND"; then fi BACKEND=$abs_builddir/.libs/$BACKEND +SHELL_PLUGIN=$abs_builddir/.libs/desktop-shell.so +TEST_PLUGIN=$abs_builddir/.libs/weston-test.so +XWAYLAND_PLUGIN=$abs_builddir/.libs/xwayland.so case $TESTNAME in *.la|*.so) $WESTON --backend=$BACKEND \ + --no-config \ + --shell=$SHELL_PLUGIN \ --socket=test-$(basename $TESTNAME) \ - --modules=$abs_builddir/.libs/${TESTNAME/.la/.so},xwayland.so \ + --modules=$abs_builddir/.libs/${TESTNAME/.la/.so},$XWAYLAND_PLUGIN \ --log="$SERVERLOG" \ &> "$OUTLOG" ;; @@ -35,7 +40,9 @@ case $TESTNAME in WESTON_TEST_CLIENT_PATH=$abs_builddir/$TESTNAME $WESTON \ --socket=test-$(basename $TESTNAME) \ --backend=$BACKEND \ + --no-config \ + --shell=$SHELL_PLUGIN \ --log="$SERVERLOG" \ - --modules=$abs_builddir/.libs/weston-test.so,xwayland.so \ + --modules=$TEST_PLUGIN,$XWAYLAND_PLUGIN \ &> "$OUTLOG" esac diff --git a/wcap/main.c b/wcap/main.c index 29bb9c30..16d37f00 100644 --- a/wcap/main.c +++ b/wcap/main.c @@ -251,6 +251,10 @@ int main(int argc, char *argv[]) } decoder = wcap_decoder_create(argv[1]); + if (decoder == NULL) { + fprintf(stderr, "Creating wcap decoder failed\n"); + exit(EXIT_FAILURE); + } if (yuv4mpeg2 && isatty(1)) { fprintf(stderr, "Not dumping yuv4mpeg2 data to terminal. Pipe output to a file or a process.\n"); diff --git a/wcap/wcap-decode.c b/wcap/wcap-decode.c index 87d93379..76ecc2f4 100644 --- a/wcap/wcap-decode.c +++ b/wcap/wcap-decode.c @@ -126,6 +126,11 @@ wcap_decoder_create(const char *filename) decoder->size = buf.st_size; decoder->map = mmap(NULL, decoder->size, PROT_READ, MAP_PRIVATE, decoder->fd, 0); + if (decoder->map == MAP_FAILED) { + fprintf(stderr, "mmap failed\n"); + free(decoder); + return NULL; + } header = decoder->map; decoder->format = header->format; @@ -137,6 +142,10 @@ wcap_decoder_create(const char *filename) frame_size = header->width * header->height * 4; decoder->frame = malloc(frame_size); + if (decoder->frame == NULL) { + free(decoder); + return NULL; + } memset(decoder->frame, 0, frame_size); return decoder; -- cgit v1.2.1