A fork/continuation of the original since the author has been away for a while. Supports kernels up to 6.15 with lots of other changes.

  • InvertedParallax@lemm.ee
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 day ago

    if your input is barely too late for one 125Hz poll,

    So those polls are generally isochronous to the USB bus transaction state, not based on polling frequency of the CPU, what happens is:

    1. USB interrupt URB comes in to HCI controller,.URB descriptor written to descriptor chain.

    2. Controller adds to descriptor chain, once chain length > WAT (| Timeout), interrupt and start processing incoming URBs.

    3. In interrupt controller, follow chain, push URBs onto usb stack queue, trigger handler tasklet

    4. Stack processes URB, routes to proper class driver

    5. Class driver checks if URB has file handle open (or has open ref from drivers like HID/input).

    6. If so, poll or other input read() returns value.

    Now it’s possible there are multi-input poll reads in games, and I’m doing linux of course.

    For MSFT it’s URB -> IRP -> WDM filter driver stack -> kernel32/directinput or win32 input stack (WNDPROCs after routing).

    In any of these cases, I’m struggling to see how interrupts would come in faster with the same code on PC.

    See, the same code probably runs on both MSFT and normal hardware, so it’s going to have the same structure, unless you actually believe a dev team is optimizing input latency that much, that’s often the lowest priority, they’ll optimize video lag more because it’s more noticeable. The engines themselves use DirectInput, and that’s routed through to libinput in WINE, and the same for all devices.

    Btw, DirectInput has a device-based interface, so it couldn’t poll like this anyway, basically each controller has its own input queue that is round-robin and pluck stuff out of their input stream when available.

    In any case, you’re not getting the latency improvement, both because it’s so different in software and because nothing can appreciate this.

    I’m not trying to be extra autistic for no reason, I’ve just had to make these decisions before, and these are how we have to think.