Lines Matching refs:mt
66 uint16_t mt; member
108 struct evdev_mt *mt; in evdev_mt_init() local
123 size += sizeof(mt->slots[0]) * slots; in evdev_mt_init()
125 size += sizeof(mt->match_slots[0]) * slots; in evdev_mt_init()
126 size += sizeof(mt->matrix[0]) * (slots + 6) * slots; in evdev_mt_init()
129 mt = malloc(size, M_EVDEV, M_WAITOK | M_ZERO); in evdev_mt_init()
130 evdev->ev_mt = mt; in evdev_mt_init()
131 mt->type_a = type_a; in evdev_mt_init()
134 mt->match_slots = mt->slots + slots; in evdev_mt_init()
135 mt->matrix = (int *)(mt->match_slots + slots); in evdev_mt_init()
140 mt->slots[slot].id = -1; in evdev_mt_init()
197 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_push_slot() local
200 if ((type_a || (mt != NULL && mt->type_a)) && state == NULL) in evdev_mt_push_slot()
206 if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK) && mt->type_a) { in evdev_mt_push_slot()
207 mt->match_slots[mt->match_slot] = *state; in evdev_mt_push_slot()
212 mt->match_slots[mt->match_slot] = *state; in evdev_mt_push_slot()
317 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_match_frame() local
322 MPASS(mt->matrix != NULL); in evdev_mt_match_frame()
328 p = mt->matrix; in evdev_mt_match_frame()
329 num_touches = bitcount(mt->touches); in evdev_mt_match_frame()
331 FOREACHBIT(mt->touches, slot) in evdev_mt_match_frame()
333 dx = pt[i].x - mt->slots[slot].x; in evdev_mt_match_frame()
334 dy = pt[i].y - mt->slots[slot].y; in evdev_mt_match_frame()
341 FOREACHBIT(mt->touches, slot) { in evdev_mt_match_frame()
342 dx = pt[i].x - mt->slots[slot].x; in evdev_mt_match_frame()
343 dy = pt[i].y - mt->slots[slot].y; in evdev_mt_match_frame()
349 evdev_mt_matching(mt->matrix, m, n, p); in evdev_mt_match_frame()
363 FOREACHBIT(mt->touches, slot) in evdev_mt_match_frame()
365 pt[i].id = mt->tracking_ids[slot]; in evdev_mt_match_frame()
371 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_send_frame() local
383 slot->id = ffc_slot(evdev, mt->touches | mt->frame); in evdev_mt_send_frame()
406 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_record_event() local
414 KASSERT(mt->type_a, ("Not a MT type A protocol")); in evdev_mt_record_event()
415 mt->match_frame |= 1U << mt->match_slot; in evdev_mt_record_event()
416 mt->match_slot++; in evdev_mt_record_event()
423 KASSERT(!mt->type_a, ("Not a MT type B protocol")); in evdev_mt_record_event()
425 mt->match_slot = value; in evdev_mt_record_event()
426 mt->match_frame |= 1U << mt->match_slot; in evdev_mt_record_event()
429 KASSERT(!mt->type_a, ("Not a MT type B protocol")); in evdev_mt_record_event()
431 mt->match_frame &= ~(1U << mt->match_slot); in evdev_mt_record_event()
434 KASSERT(mt->match_slot >= 0, ("Negative slot")); in evdev_mt_record_event()
435 KASSERT(mt->match_slot <= MAXIMAL_MT_SLOT(evdev), in evdev_mt_record_event()
437 mt->match_slots[mt->match_slot]. in evdev_mt_record_event()
452 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_replay_events() local
457 FOREACHBIT(mt->match_frame, slot) { in evdev_mt_replay_events()
459 mt->match_slots[size] = mt->match_slots[slot]; in evdev_mt_replay_events()
462 evdev_mt_match_frame(evdev, mt->match_slots, size); in evdev_mt_replay_events()
463 evdev_mt_send_frame(evdev, mt->match_slots, size); in evdev_mt_replay_events()
464 mt->match_slot = 0; in evdev_mt_replay_events()
465 mt->match_frame = 0; in evdev_mt_replay_events()
483 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_set_last_slot() local
487 mt->frame |= 1U << slot; in evdev_mt_set_last_slot()
488 mt->last_reported_slot = slot; in evdev_mt_set_last_slot()
494 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_get_value() local
498 return (mt->slots[slot].val[ABS_MT_INDEX(code)]); in evdev_mt_get_value()
505 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_set_value() local
511 mt->touches |= 1U << slot; in evdev_mt_set_value()
513 mt->touches &= ~(1U << slot); in evdev_mt_set_value()
515 mt->slots[slot].val[ABS_MT_INDEX(code)] = value; in evdev_mt_set_value()
521 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_id_to_slot() local
524 KASSERT(!mt->type_a, ("Not a MT type B protocol")); in evdev_mt_id_to_slot()
531 return (ffc_slot(evdev, mt->match_frame)); in evdev_mt_id_to_slot()
533 FOREACHBIT(mt->touches, slot) in evdev_mt_id_to_slot()
534 if (mt->tracking_ids[slot] == tracking_id) in evdev_mt_id_to_slot()
540 return (ffc_slot(evdev, mt->touches | mt->frame)); in evdev_mt_id_to_slot()
546 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_reassign_id() local
550 mt->tracking_ids[slot] = id; in evdev_mt_reassign_id()
556 KASSERT(id == mt->tracking_ids[slot], in evdev_mt_reassign_id()
561 mt->tracking_ids[slot] = id; in evdev_mt_reassign_id()
563 nid = mt->tracking_id++; in evdev_mt_reassign_id()
564 FOREACHBIT(mt->touches, slot) in evdev_mt_reassign_id()
599 if (!bit_test(evdev->ev_abs_flags, evdev_mtstmap[i].mt) || in evdev_mt_support_st_compat()
602 ai = evdev->ev_absinfo + evdev_mtstmap[i].mt; in evdev_mt_support_st_compat()
625 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_send_st_compat() local
630 nfingers = bitcount(mt->touches); in evdev_mt_send_st_compat()
634 st_slot = ffs(mt->touches) - 1; in evdev_mt_send_st_compat()
636 FOREACHBIT(mt->mtst_events, i) in evdev_mt_send_st_compat()
639 st_slot, evdev_mtstmap[i].mt), in evdev_mt_send_st_compat()
640 evdev->ev_absinfo[evdev_mtstmap[i].mt].minimum, in evdev_mt_send_st_compat()
641 evdev->ev_absinfo[evdev_mtstmap[i].mt].maximum, in evdev_mt_send_st_compat()
655 struct evdev_mt *mt = evdev->ev_mt; in evdev_mt_send_autorel() local
659 KASSERT(mt->match_frame == 0, ("Unmatched events exist")); in evdev_mt_send_autorel()
661 FOREACHBIT(mt->touches & ~mt->frame, slot) in evdev_mt_send_autorel()