• Dafna Hirschfeld's avatar
    media: stk1160: use dma_alloc_noncontiguous API · 68d0c331
    Dafna Hirschfeld authored
    Replace the urb buffers allocation to use the noncontiguous API.
    
    This improves performance on ARM platforms where DMA coherent allocations
    produce uncached mappings. Note that the noncontiguous API
    requires the driver to handle synchronization.
    
    This commit is similar to this one for the uvc driver:
    
      https://lkml.org/lkml/2021/3/12/1506
    
    Performance tests on rock-pi4 (Arm64) shows about 15x
    improvements:
    
    == DMA NONCONTIGUOUS ==
    total durations: 20.63678480 sec
    urb processing durations: 0.286864889 sec
    uS/qty: 286864/2508 avg: 114.379 min: 0.583 max: 155.461 (uS)
    FPS: 24.92
    lost: 0 done: 500
    raw decode speed: 11.603 Gbits/s
    bytes 414831228.000
    bytes/urb: 165403
    
    == DMA COHERENT ==
    total durations: 20.73551767 sec
    urb processing durations: 4.541559160 sec
    uS/qty: 4541559/2509 avg: 1810.107 min: 0.583 max: 2113.163 (uS)
    FPS: 24.90
    lost: 0 done: 500
    raw decode speed: 730.738 Mbits/s
    bytes 414785444.000
    bytes/urb: 165319
    
    Performance tests on x86 laptop show no significant
    difference:
    
    == DMA NONCONTIGUOUS ==
    total durations: 20.220590102 sec
    urb processing durations: 0.63021818 sec
    uS/qty: 63021/2512 avg: 25.088 min: 0.138 max: 146.750 (uS)
    FPS: 24.72
    lost: 0 done: 500
    raw decode speed: 52.751 Gbits/s
    bytes 415421032.000
    bytes/urb: 165374
    
    == DMA COHERENT ==
    total durations: 20.220475614 sec
    urb processing durations: 0.64751972 sec
    uS/qty: 64751/2512 avg: 25.777 min: 0.168 max: 132.250 (uS)
    FPS: 24.72
    lost: 0 done: 500
    raw decode speed: 51.927 Gbits/s
    bytes 415422794.000
    bytes/urb: 165375
    
    [hverkuil: incorporated Ezequiel's suggestions from his review]
    Signed-off-by: default avatarDafna Hirschfeld <dafna.hirschfeld@collabora.com>
    Reviewed-by: default avatarEzequiel Garcia <ezequiel@vanguardiasur.com.ar>
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
    68d0c331
stk1160-v4l.c 20.5 KB