Hi
Am 20.11.26 um 07:50 schrieb Jie Feng:
On Fri, 20 Nov 2026 at 14:48, Thomas Zimmermann <[email protected]> wrote:
Wait for in-flight URBs from the previous frame before sending out
the current frame. Throttles frame rate to USB limits.
PC display usually runs with a refresh rate of 60 Hz or more. Sending
out URBs for each frame at this rate easily overloads the USB. This
results in display lag up to several seconds. Udl currently avoids
this by limiting the number of URBs to 20 at a time. This prevents
overloading the USB, but also prevents udl from using all the
bandwidth available.
Solving this requires more flexibility in the number of in-flight
URBs. The exact value depends on the framebuffer configuration and
the available bandwidth on the USB.
Before removing the limit on the URB count, add another means of
synchronizing the frame rate to the USB. Do this in atomic_begin, so
that the USB has the maximum time between sending two frames.
Signed-off-by: Thomas Zimmermann <[email protected]>
---
drivers/gpu/drm/udl/udl_modeset.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/gpu/drm/udl/udl_modeset.c
b/drivers/gpu/drm/udl/udl_modeset.c
index bbba1dee8e4f..caa0a117e3c2 100644
--- a/drivers/gpu/drm/udl/udl_modeset.c
+++ b/drivers/gpu/drm/udl/udl_modeset.c
@@ -329,6 +329,23 @@ static const struct drm_plane_funcs
udl_primary_plane_funcs = {
* CRTC
*/
+static void udl_crtc_helper_atomic_begin(struct drm_crtc *crtc, struct
drm_atomic_commit *state)
+{
+ struct drm_device *dev = crtc->dev;
+ struct udl_device *udl = to_udl(dev);
+ int idx;
+
+ if (!drm_dev_enter(dev, &idx))
+ return;
+
+ /*
+ * It is acceptable to briefly block in this call, but
+ * having it timeout frequently indicates a problem.
+ */
+ udl_sync_pending_urbs(udl);
Using usb anchors might work better instead of the completion I suggested
in the other message. usb_wait_anchor_empty_timeout() could be used.
Nice, I wasn't aware of this helper. I briefly looked over it and it
seems useful. It would also mean that there are two lists: one for the
cache and one for the anchor. That might be a good thing in the longer
term. I'll see if I can use anchors to the benefit of this code.
Best regards
Thomas
+ drm_dev_exit(idx);
+}
+
static void udl_crtc_helper_atomic_enable(struct drm_crtc *crtc, struct
drm_atomic_commit *state)
{
struct drm_device *dev = crtc->dev;
@@ -395,6 +412,7 @@ static void udl_crtc_helper_atomic_disable(struct drm_crtc
*crtc, struct drm_ato
static const struct drm_crtc_helper_funcs udl_crtc_helper_funcs = {
.atomic_check = drm_crtc_helper_atomic_check,
+ .atomic_begin = udl_crtc_helper_atomic_begin,
.atomic_enable = udl_crtc_helper_atomic_enable,
.atomic_disable = udl_crtc_helper_atomic_disable,
};
--
2.56.0
Best regards,
Jie Feng
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)