Update on DisplayLink Linux support (udlfb in 2.6.34)

Posted on 14. Mar, 2010 by Bernie Thompson in udlfb

A 10-part udlfb patch series with several enhancements were recently accepted into the Linux kernel staging tree of 2.6.34. Greg’s maintainer patch series passing them on starts here.

This catches the official kernel staging tree with everything on git.plugable.com up to Feb, 2010.

Background

udlfb provides Linux framebuffer (fbdev) support plus a private “damage” notification ioctl used by the Roberto DeIoris’ “displaylink” X server. Udlfb automatically detects and supports all current DisplayLink USB graphics chips – 120,160,115,125,165,195. It supports 16bpp, with modes up to the maximum supported by the DisplayLink chips. Plugging any DisplayLink device into a Linux PC with this support should result in a “green screen” which means udlfb has loaded, set the monitor default mode, and drawn to the device successfully.

What udlfb does *not* do on its own is make configuring X easy – X sits on udlfb, but getting X running still involves editing configuration files like xorg.conf in different ways depending on what you’re trying to do, what distro version you have, and what primary GPU you have.

Features in Linux kernel 2.6.34 so far

  • Improved performance (about 20% average improvement over a variety of “benchmarks” like x11perf, gtkperf, glxgears). Video playback, flash games, etc. are all improved
  • Asynchronous urb dispatch and no mutexes held for extended periods during render
  • Slightly lower CPU consumption, fewer non-localized memory accesses, slightly higher average compression
  • Better handling of switching from X to fbcon VTs and back
  • Driver unloads more cleanly from either bottom-up (USB removal) or top-down (shutdown). Problem reports welcome.
  • More standard EDID parsing and mode handling, using fbdev’s built in mode libraries (but creates a new dependency on them being enabled in kernel)
  • Performance metrics reported through sysfs (read /sys/class/graphics/fbX/*metrics* – but will move to debugfs)
  • EDID reported through sysfs (read /sys/class/graphics/graphics/fbX/edid)
  • Can compile as module with or without defio or sys_ dependencies
  • Lots of cleanup – tested on 64-bit, closer to endian clean, checkpatch.pl clean
  • Support for standard fbdev clients (via defio) – unfortunately buggy yet (see todos)

Depending on timing, some additional todo items might make it, we’ll see.

Versioning

At one point, we wanted udlfb to have its own project cycles and release versioning to help clarify things here while udlfb evolved in the early days. Got pushback on doing this from the kernel maintainers. So versioning of udlfb is purely by kernel version – “this bug is in udlfb in kernel 2.6.34rc1″ or whatever. There’ll also be a newer changes that haven’t been submitted to the kernel (e.g. at http://git.plugable.com/). And it’s probably best to just version that per commit/checkin. “This bug shows up in commit 234b4e22…”. This is nice in a way – just check the stuff in somewhere let the world know what you’re doing – the only “release process” you need to coordinate with is getting the patches into the kernel itself. Or feel free also to send patches here, we’ll try to help them through the process.

Todo

  • Add code to read pixel resolution limits from the device’s USB descriptors, and adhere to them. Avoids blank screen when monitors caps exceeds that of the adapter
  • Add pseudo-32bpp mode to help the case of using Xinerama to extend desktop across PCIe/USB adapters. Not planning true 24/32-bpp mode yet because of complexity and perf tradeoffs
  • Disable defio by default, unfortunately, because of several bugs without obvious solutions
    • rendering problems with pages (lines) that no longer get updated – writes to those are no longer triggering deferred processing
    • When running 2 USB adapters, dirty pages for one instance seem to affect the other, and vice versa (udlfb has no common state, so appears to be in defio or mmu handling)
    • cases where we hit a kernel oops in the deferred io handler when it tries to touch the pages it’s been asked to handle.
  • Move perf metrics from sysfs to debugfs and add ABI doc for what remains, per GregKH
  • Fix two ignored return values that Greg’s build environment caught
  • Get a safe method from DisplayLink to detect future chips that might not be compatible with current ones, and bail out of probe

There’s lot of other stuff that could be done – and any patches are very welcome. One big open question is whether fbdev has legs, or whether this effort should be converted over to KMS/DRM/DRI.

Emacs macro to ease the pain of checkpatchitis

Posted on 19. Feb, 2010 by Bernie Thompson in udlfb

In order to submit patches to the Linux kernel — as I’ve been doing lately to help improve Linux’s DisplayLink driver udlfb — the changed code has to pass a script called checkpatch.pl, which flags violations of the Linux kernel style guidelines.

Style wars (e.g. “tabs vs. spaces”) are a never-ending source of tension on projects, so I actually appreciate automation like checkpatch.pl to just lay down the law, and be done with it.

But .. having to sift through endless warnings when you run checkpatch.pl late in the development process is frustrating. And there’s no way most occasional kernel patchers will remember all the rules (especially if you strongly disagree with some of them — which I do). It’s much better if your editor can just warn you when you step off the golden path of enlightenment. I use emacs, so I looked around for solutions, but they were only incomplete, or not real-time (e.g. checkpatch.pl has an –emacs option to run in the compile window of emacs).

So here’s something a little less incomplete that I’ve added to my .emacs file to catch the majority of checkpatch.pl errors in real-time (by highlighting the offending code in red). Works only on recent emacs versions. Hopefully it’ll be useful to others pounding away on their patches.

;; *** BEGIN highlight checkpatch.pl warnings and errors ***
(add-hook 'c-mode-common-hook
    (lambda ()
      ;; this sets defaults to match many checkpatch.pl guidelines
      (c-set-style "linux")))
;; but doesn't warn us about violations these regexp catch common ones
(custom-set-faces
    '(my-warning-face ((((class color)) (:background "red"))) t))
(add-hook 'font-lock-mode-hook
    (function
        (lambda ()
            (setq font-lock-keywords
                (append font-lock-keywords
		    '(("^.\\{81\\}" (0 'my-warning-face t)))
                    '(("\\/\\/.*" (0 'my-warning-face t)))
                    '((";[_A-Za-z0-9]+" (0 'my-warning-face t)))
                    '((",[_A-Za-z0-9]+" (0 'my-warning-face t)))
                    '(("return[[:blank:]]*(.+);" (0 'my-warning-face t)))
                    '(("([_A-Za-z0-9]+[\\*]+)" (0 'my-warning-face t)))
                    '(("[[:blank:]]+\\)"(0 'my-warning-face t)))
		    '(("^[[:blank:]]+{[[:blank:]]*$" (0 'my-warning-face t)))
		    '(("[_A-Za-z0-9]+\\*[[:blank:]]" (0 'my-warning-face t)))
		)))))
;; exercise to reader - move regexps into c hook
;; *** END highlight checkpatch.pl warnings and errors ***

Any enhancements or corrections are welcome.

Preparing more udlfb patches for linux-next

Posted on 12. Feb, 2010 by Bernie Thompson in udlfb

There are limits on how much a small device company can and should do in contributing to open source driver support. But with a historical connection to DisplayLink and more products coming with the technology included, contributing what we can to the generic DisplayLink driver on Linux makes some sense.

Also note this driver is just a foundation on which other stuff (like X) sits, so it doesn’t mean Linux is easy for real end users yet. But it’s getting closer.

Here’s the announce that went to the list today:

The next patch series for udlfb is “nearly ready” for submission, hopefully will be coming in the next few days.

Testing and any problem reports would be helpful. The code that will be submitted is at http://git.plugable.com/gitphp/index.php?p=udlfb&a=summary

There are many dozens of checkins in git as inter-related problems have been explored and the code incrementally improved. Before submitting, I’ll be reconstituting them into a smaller number of more analyzable email patches: make everything checkpatch.pl clean, reorganize things to match final layout, then per-feature patches. We’ll see how that goes.

Major features:

* Support for standard fbdev clients (via defio)
* Improved performance (about 20% average improvement over a variety of “benchmarks” like x11perf, gtkperf, glxgears)
* Asynchronous urb dispatch and no mutexes held for extended periods during render
* Slightly lower CPU consumption, less touching memory, slightly higher average compression
* Better handling of switching from X to fbcon VTs and back
* Driver should unload cleanly from either bottom-up (USB removal) or top-down (shutdown). Problem reports welcome.
* Performance metrics reported through sysfs (read /sys/class/graphics/fbX/*metrics*)
* EDID reported through sysfs (read /sys/class/graphics/graphics/fbX/edid)
* Can compile as module with or without defio or sys_ dependencies
* Lots of cleanup – tested on 64-bit, closer to endian clean, checkpatch.pl clean

What it does not have:

* The defio rendering problems (e.g. with xf86-video-fbdev X server) are still unsolved
* Still 16bpp only. Pseudo-truecolor 32->16 is on the wishlist.
* No DL 1×5 SKU detection yet (you’ll get a blank screen if your monitor’s res exceeds the adapter)

Page 3 of 812345...Last »