• Noralf Trønnes's avatar
    drm/gud: Use scatter-gather USB bulk transfer · 2eecd93b
    Noralf Trønnes authored
    There'a limit to how big a kmalloc buffer can be, and as memory gets
    fragmented it becomes more difficult to get big buffers. The downside of
    smaller buffers is that the driver has to split the transfer up which
    hampers performance. Compression might also take a hit because of the
    splitting.
    
    Solve this by allocating the transfer buffer using vmalloc and create a
    SG table to be passed on to the USB subsystem. vmalloc_32() is used to
    avoid DMA bounce buffers on USB controllers that can only access 32-bit
    addresses.
    
    This also solves the problem that split transfers can give host side
    tearing since flushing is decoupled from rendering.
    
    usb_sg_wait() doesn't have timeout handling builtin, so it is wrapped in
    a timer like 4 out of 6 users in the kernel have done.
    
    v2:
    - Use DIV_ROUND_UP (Linus)
    - Add timeout note to the commit log (Linus)
    - Expand note about upper buffer limit (Linus)
    - Change var name s/timer/ctx/ in gud_usb_bulk_timeout()
    Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210701170748.58009-2-noralf@tronnes.org
    2eecd93b
gud_internal.h 4.46 KB