Udl caches once-allocated URBs for later use. By default, it has a fixed number of 20 URBs in flight at most. Depending on the USB, this can either consume too much bandwidth or keep free bandwidth unused.
Replace the fixed-size cache with dynamic allocation of the URBs required. Adapt page-flip rate according to the actually available bandwidth on the USB. Patches 1 to 6 clean up the code, fix a few minor issue and provide a clean interface for allocating and freeing URBs. Patch 7 switches the URB cache to managed release. As before, the cache collects all outstanding URBs as part of the USB device removal. Patches 8 to 11 implement dynamic allocation of URBs. The URB cache tracks the number of URBs in flight and allocates new ones of the cache has been exhausted. The udl driver now sends out as many URBs as necessary for the current frame without limitting itself to 20 URBs at a time. To avoid overloading the USB, udl waits in atomic_begin() for the previous frame's URBs to complete. This adapts page-flip rate to the bandwidth available on the USB. Patch 11 contains a minor improvement of the cache locality. Tested with superttuxkart and vkcube on weston. Note that display output might not happen faster in any way. This series only addresses one of many bottlenecks (e.g., message packing, software rendering). Thomas Zimmermann (11): drm/udl: Release URB in udl_put_urb() drm/udl: Do not use URB completion handler for error cleanup drm/udl: Store per-URB allocation length in struct urb_node drm/udl: Allocate bulk URBs in helper functions drm/udl: Free bulk URBs in helper functions drm/udl: Rework the error handling in udl_submit_urb() drm/udl: Managed cleanup of URB cache drm/udl: Track number of URBs in flight drm/udl: Synchronize pending URBs on each frame drm/udl: Allocate URBs on demand drm/udl: Implement URB cache as LIFO stack drivers/gpu/drm/udl/udl_drv.c | 2 - drivers/gpu/drm/udl/udl_drv.h | 8 +- drivers/gpu/drm/udl/udl_main.c | 280 +++++++++++++++-------------- drivers/gpu/drm/udl/udl_modeset.c | 20 ++- drivers/gpu/drm/udl/udl_transfer.c | 2 +- 5 files changed, 168 insertions(+), 144 deletions(-) base-commit: 7d502136b31169f6b5575f7f89c3da60cdf7891d -- 2.56.0
