From: JengHyun Kang Date: Thu, 11 Feb 2016 06:44:36 +0000 (+0900) Subject: Add ttrace X-Git-Tag: submit/tizen/20220208.100129~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c971157dbebade378490a56672c58d91eeaff34d;p=platform%2Fupstream%2Flibinput.git Add ttrace Change-Id: I82a316d226c967a396f6ce5671feeafbfb37bd0f --- diff --git a/meson.build b/meson.build index b94f53d2..25fa15c3 100644 --- a/meson.build +++ b/meson.build @@ -162,6 +162,14 @@ else dep_libwacom = declare_dependency() endif +############ ttrace configuration ############ + +dep_ttrace = dependency('ttrace', required : false) +if dep_ttrace.found() + config_h.set10('ENABLE_TTRACE', 1) +endif + + ############ udev bits ############ executable('libinput-device-group', @@ -382,7 +390,8 @@ deps_libinput = [ dep_rt, dep_libwacom, dep_libinput_util, - dep_libquirks + dep_libquirks, + dep_ttrace ] libinput_version_h_config = configuration_data() diff --git a/packaging/libinput.spec b/packaging/libinput.spec index af0deada..d666dee2 100644 --- a/packaging/libinput.spec +++ b/packaging/libinput.spec @@ -16,7 +16,7 @@ BuildRequires: pkgconfig(libevdev) BuildRequires: pkgconfig(libevent) BuildRequires: pkgconfig(libudev) BuildRequires: pkgconfig(mtdev) -BuildRequires: pkgconfig(wacom) +BuildRequires: pkgconfig(ttrace) %description diff --git a/src/evdev-fallback.c b/src/evdev-fallback.c index 256735bf..cd1e1ca1 100644 --- a/src/evdev-fallback.c +++ b/src/evdev-fallback.c @@ -168,8 +168,12 @@ fallback_flush_relative_motion(struct fallback_dispatch *dispatch, struct normalized_coords accel, unaccel; struct device_float_coords raw; - if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) + TRACE_BEGIN(fallback_flush_relative_motion); + + if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) { + TRACE_END(); return; + } fallback_rotate_relative(dispatch, device); @@ -180,8 +184,10 @@ fallback_flush_relative_motion(struct fallback_dispatch *dispatch, dispatch->rel.y = 0; /* Use unaccelerated deltas for pointing stick scroll */ - if (post_trackpoint_scroll(device, unaccel, time)) + if (post_trackpoint_scroll(device, unaccel, time)) { + TRACE_END(); return; + } if (device->pointer.filter) { /* Apply pointer acceleration. */ @@ -195,10 +201,13 @@ fallback_flush_relative_motion(struct fallback_dispatch *dispatch, accel = unaccel; } - if (normalized_is_zero(accel) && normalized_is_zero(unaccel)) + if (normalized_is_zero(accel) && normalized_is_zero(unaccel)) { + TRACE_END(); return; + } pointer_notify_motion(base, time, &accel, &raw); + TRACE_END(); } static void @@ -535,9 +544,13 @@ fallback_process_key(struct fallback_dispatch *dispatch, { enum key_type type; + TRACE_BEGIN(fallbak_process_key); + /* ignore kernel key repeat */ - if (e->value == 2) + if (e->value == 2) { + TRACE_END(); return; + } if (e->code == BTN_TOUCH) { if (!device->is_mt) @@ -545,6 +558,7 @@ fallback_process_key(struct fallback_dispatch *dispatch, device, time, e->value); + TRACE_END(); return; } @@ -559,8 +573,10 @@ fallback_process_key(struct fallback_dispatch *dispatch, case KEY_TYPE_KEY: case KEY_TYPE_BUTTON: if ((e->value && hw_is_key_down(dispatch, e->code)) || - (e->value == 0 && !hw_is_key_down(dispatch, e->code))) + (e->value == 0 && !hw_is_key_down(dispatch, e->code))) { + TRACE_END(); return; + } dispatch->pending_event |= EVDEV_KEY; break; @@ -583,6 +599,7 @@ fallback_process_key(struct fallback_dispatch *dispatch, case KEY_TYPE_BUTTON: break; } + TRACE_END(); } static void @@ -841,8 +858,12 @@ fallback_process_relative(struct fallback_dispatch *dispatch, struct evdev_device *device, struct input_event *e, uint64_t time) { - if (fallback_reject_relative(device, e, time)) + TRACE_BEGIN(fallback_process_relative); + + if (fallback_reject_relative(device, e, time)) { + TRACE_END(); return; + } switch (e->code) { case REL_X: @@ -862,6 +883,7 @@ fallback_process_relative(struct fallback_dispatch *dispatch, dispatch->pending_event |= EVDEV_WHEEL; break; } + TRACE_END(); } static inline void @@ -870,11 +892,13 @@ fallback_process_absolute(struct fallback_dispatch *dispatch, struct input_event *e, uint64_t time) { + TRACE_BEGIN(fallback_process_absolute); if (device->is_mt) { fallback_process_touch(dispatch, device, e, time); } else { fallback_process_absolute_motion(dispatch, device, e); } + TRACE_END(); } static inline bool diff --git a/src/evdev.c b/src/evdev.c index 886df79a..16418d9c 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1017,7 +1017,11 @@ evdev_process_event(struct evdev_device *device, struct input_event *e) libinput_timer_flush(evdev_libinput_context(device), time); + TRACE_BEGIN(evdev_process_event); + dispatch->interface->process(dispatch, device, e, time); + + TRACE_END(); } static inline void diff --git a/src/libinput-private.h b/src/libinput-private.h index 5e32f6e9..eccbb96a 100644 --- a/src/libinput-private.h +++ b/src/libinput-private.h @@ -41,6 +41,16 @@ #include "libinput-util.h" #include "libinput-version.h" +#ifdef ENABLE_TTRACE +#include + +#define TRACE_BEGIN(NAME) traceBegin(TTRACE_TAG_INPUT, "INPUT:LIBINPUT:"#NAME) +#define TRACE_END() traceEnd(TTRACE_TAG_INPUT) +#else +#define TRACE_BEGIN(NAME) +#define TRACE_END() +#endif + struct libinput_source; /* A coordinate pair in device coordinates */ diff --git a/src/libinput.c b/src/libinput.c index f842bda6..e7ad40d9 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -2397,6 +2397,8 @@ notify_added_device(struct libinput_device *device) { struct libinput_event_device_notify *added_device_event; + TRACE_BEGIN(notify_added_device); + added_device_event = zalloc(sizeof *added_device_event); post_base_event(device, @@ -2408,6 +2410,7 @@ notify_added_device(struct libinput_device *device) * pretend to free it */ free(added_device_event); #endif + TRACE_END(); } void @@ -2415,6 +2418,8 @@ notify_removed_device(struct libinput_device *device) { struct libinput_event_device_notify *removed_device_event; + TRACE_BEGIN(notify_removed_device); + removed_device_event = zalloc(sizeof *removed_device_event); post_base_event(device, @@ -2426,6 +2431,7 @@ notify_removed_device(struct libinput_device *device) * pretend to free it */ free(removed_device_event); #endif + TRACE_END(); } static inline bool @@ -2478,8 +2484,12 @@ keyboard_notify_key(struct libinput_device *device, struct libinput_event_keyboard *key_event; uint32_t seat_key_count; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) + TRACE_BEGIN(keyboard_notify_key); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_KEYBOARD)) { + TRACE_END(); return; + } key_event = zalloc(sizeof *key_event); @@ -2495,6 +2505,8 @@ keyboard_notify_key(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_KEYBOARD_KEY, &key_event->base); + + TRACE_END(); } void @@ -2505,9 +2517,13 @@ pointer_notify_motion(struct libinput_device *device, { struct libinput_event_pointer *motion_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) - return; + TRACE_BEGIN(pointer_notify_motion); + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) { + TRACE_END(); + return; + } + motion_event = zalloc(sizeof *motion_event); *motion_event = (struct libinput_event_pointer) { @@ -2519,6 +2535,8 @@ pointer_notify_motion(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_POINTER_MOTION, &motion_event->base); + + TRACE_END(); } void @@ -2528,8 +2546,12 @@ pointer_notify_motion_absolute(struct libinput_device *device, { struct libinput_event_pointer *motion_absolute_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) + TRACE_BEGIN(pointer_notify_motion_absolute); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) { + TRACE_END(); return; + } motion_absolute_event = zalloc(sizeof *motion_absolute_event); @@ -2541,6 +2563,8 @@ pointer_notify_motion_absolute(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, &motion_absolute_event->base); + + TRACE_END(); } void @@ -2552,8 +2576,12 @@ pointer_notify_button(struct libinput_device *device, struct libinput_event_pointer *button_event; int32_t seat_button_count; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) + TRACE_BEGIN(pointer_notify_button); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) { + TRACE_END(); return; + } button_event = zalloc(sizeof *button_event); @@ -2571,6 +2599,8 @@ pointer_notify_button(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_POINTER_BUTTON, &button_event->base); + + TRACE_END(); } void @@ -2583,8 +2613,12 @@ pointer_notify_axis(struct libinput_device *device, { struct libinput_event_pointer *axis_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) + TRACE_BEGIN(pointer_notify_axis); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_POINTER)) { + TRACE_END(); return; + } axis_event = zalloc(sizeof *axis_event); @@ -2599,6 +2633,8 @@ pointer_notify_axis(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_POINTER_AXIS, &axis_event->base); + + TRACE_END(); } void @@ -2612,8 +2648,12 @@ touch_notify_touch_down(struct libinput_device *device, { struct libinput_event_touch *touch_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) + TRACE_BEGIN(touch_notify_touch_down); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) { + TRACE_END(); return; + } touch_event = zalloc(sizeof *touch_event); @@ -2629,6 +2669,8 @@ touch_notify_touch_down(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_TOUCH_DOWN, &touch_event->base); + + TRACE_END(); } void @@ -2642,8 +2684,12 @@ touch_notify_touch_motion(struct libinput_device *device, { struct libinput_event_touch *touch_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) + TRACE_BEGIN(touch_notify_touch_motion); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) { + TRACE_END(); return; + } touch_event = zalloc(sizeof *touch_event); @@ -2659,6 +2705,8 @@ touch_notify_touch_motion(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_TOUCH_MOTION, &touch_event->base); + + TRACE_END(); } void @@ -2669,8 +2717,12 @@ touch_notify_touch_up(struct libinput_device *device, { struct libinput_event_touch *touch_event; - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) + TRACE_BEGIN(touch_notify_touch_up); + + if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_TOUCH)) { + TRACE_END(); return; + } touch_event = zalloc(sizeof *touch_event); @@ -2683,6 +2735,8 @@ touch_notify_touch_up(struct libinput_device *device, post_device_event(device, time, LIBINPUT_EVENT_TOUCH_UP, &touch_event->base); + + TRACE_END(); } void