DRM Janitor Tasks

Smaller janitorial tasks in the kernel DRM graphics subsystem useful as newbie projects. Or for slow rainy days.

Subsystem-wide refactorings

Proper primary plane support

Convert all drivers to explicitly set up the primary plane, or at least have the appropriate list of supported pixel formats.

Contact: Daniel Vetter, Matt Roper

Support for cursor planes

Needs to wait for Matt's cursor plane patches to land first, but similar to the primary plane task.

Contact: Daniel Vetter, Matt Roper

De-midlayer drivers

With the recent drm_bus cleanup patches for 3.17 it is no longer required to have a drm_bus structure set up. Drivers can directly set up the drm device structure instead of relying on bus methods in drm_usb.c and drm_platform.c. The goal is to get rid of the driver's ->load callback and open-code the load sequence properly, using the new two-stage drm_device setup.

Once all existing drivers are converted we can also remove those bus support files for usb/platform devices.

All you need is a gpu for a non-converted driver (currently almost all of them, but also all the virtual ones used by kvm, so everyone qualifies).

Contact: Daniel Vetter, Thierry Redding, respective driver maintainers

Convert existing KMS drivers to atomic modesetting

3.19 has the atomic modeset interfaces and helpers, so drivers can now be converted over. Modern compositors like Wayland or Surfaceflinger on Android really want an atomic modeset interface, so this is all about the bright future.

There is a conversion guide for atomic and all you need is a gpu for a non-converted driver (again virtual hw drivers for kvm are still all suitable).

Contact: Daniel Vetter, respective driver maintainers

Fallout from atomic kms

drm_atomic_helper.c provides a batch of functions which implement legacy ioctls on top of the new atomic driver interface. Which is really nice for gradual conversion of drivers, but unfortunately the semantic mismatches are a bit too severe. So there's some follow-up work to adjust the function interfaces to fix these issues: * atomic can fail with -ENOEM, but legacy ->dpms has a void return value. Needs to grow an int, with error handling everywhere wired up. * atomic needs the lock acquire context. Atm that's passed around implicitly with some horrible hacks, and it's also allocate with GFP_NOFAIL behind the scenes. All legacy paths need to start allocating the acquire context explicitly on stack and then also pass it down into drivers explicitly so that the legacy-on-atomic functions can use them.

Contact: Daniel Vetter

debugfs interface to intercept DP AUX

If we can redirect the dp aux transactions and inject hotplug events into drivers through debugfs we can write automated tests for the rather complex DP detection code. Especially MST is really complicated and has lots of interesting corner-cases when plugging/unplugging parts of the sink tree.

First steps would be to add the basic interface and a very basic SST DP sink testcase. Follow-up tasks would be to extend that to MST and interesting testcases.

Contact: Daniel Vetter

DRM Core refactorings

Create a drm-internal header

Currently the drm subsystem has only one global header, drmP.h. This is used both for functions exported to helper libraries and drivers and functions only used internally in the drm.ko module. The goal would be to move all header declarations not needed outside of drm.ko into drivers/gpu/drm/drm_*internal.h header files. EXPORTSYMBOL also needs to be dropped for these functions.

This would nicely tie in with the below task to create kerneldoc after the api is cleaned up. Or with the "hide legacy cruft better" task.

Contact: Daniel Vetter

This is mostly done now.

Add missing kerneldoc for exported functions

The drm reference documentation is still lacking kerneldoc in a few areas. The task would be to clean up interfaces like moving functions around between files to better group them and improving the interfaces like dropping return values for functions that never fail. Then write kerneldoc for all exported functions and an overview section and integrate it all into the drm DocBook.

See https://www.kernel.org/doc/htmldocs/drm/ for what's there already.

Contact: Daniel Vetter

Hide legacy cruft better

Way back DRM supported only drivers which shadow-attached to pci devices with userspace or fbdev drivers setting up outputs. Modern DRM drives take charge of the entire device, you can spot them with the DRIVER_MODESET flag.

Unfortunately there's still large piles of legacy code around which needs to be hidden so that driver writers don't accidentally end up using it. And to prevent security issues in those legacy ioctls from being exploited on modern drviers. This has multiple possible subtasks:

  • Make sure legacy ioctls can't be used on modern drivers.
  • Extract support code for legacy features into a drm-legacy.ko kernel module and compile it only when one of the legacy drivers is enabled.
  • Extract legacy functions into their own headers and remove it that from the monolithic drmP.h header.
  • Remove any lingering cruft from the OS abstraction layer from modern drivers.

Contact: Daniel Vetter

Better Testing

Enable trinity for drm

And fix up the fallout. Should be really interesting ...

Make KMS tests in i-g-t generic

The i915 driver team maintains an extensive testsuite for the i915 drm driver, including tons of testcases for corner-cases in the modesetting api. It would be awesome if those tests (at least the ones not relying on intel-specific gem features) could be made to run on any kms driver.

Contact: Daniel Vetter

Driver Specific

Nuke i915 user-modesetting support

In 3.17 (after more than a year of deprecating the code harder) UMS support is fully disabled and can't be built any more. So once 3.17 is out of a bit we can start to nuke all the support code only used by UMS. Pretty much all of it should be behind DRIVER_MODESET checks, but those are all over the place.

If someone notices the lack of UMS support plan B is to still nuke it, but have a 2nd copy of the old code lying around to bitrot.

Outside DRM

Better kerneldoc

Most of the drm documentation is kerneldoc embedded into the overall DocBook structure. Unfortunately the kerneldoc system is seriously lacking compared to contemporary solutions used elsewhere like gtkdoc:

  • No support for markdown, which makes creating lists and tables a nightmare. We need two copies of them, one in the code as a plain (non-kerneldoc) comment and one as fairly horrible DocBook xml table.

  • No support for auto-generated links. Functions/structures/etc are only marked up but not automatically cross-referenced when generating the DocBook from the kerneldoc comments.

Adding these features would improve the value and usefulness of the drm docs by a lot. Unfortunately kerneldoc is processed by a fairly horrid perl script ... So probably requires a full rewrite.

An interesting way to rewrite the kerneldoc parser would be use sparse. It would at least solve the C parsing problem, adding broken down kernel-doc comments to the AST.

Contact: Daniel Vetter, Thomas Wood