aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2016-08-23 08:54:48 -0400
committerDave Airlie <airlied@redhat.com>2016-08-23 17:13:08 -0400
commit0d42204f374380b6334de7dd2fe7e7d795250290 (patch)
tree60ca1931ddc02edce178fb9d99b158de8b071902
parentd804819605b461280ca176d982ee3204721c698b (diff)
drm/doc: Document uapi requirements in DRM
Everyone knows them, except all the new folks joining from the ARM side haven't lived through all the pain of the past years and are entirely surprised when I raise this. Definitely time to document this. Last time this was a big discussion was about 6 years ago, when qcom tried to land a kernel driver without userspace. Dave Airlie made the rules really clear: http://airlied.livejournal.com/73115.html This write-up here is essentially what I've put into a presentation a while ago, which was also reviewed by Dave: http://blog.ffwll.ch/2015/05/gfx-kernel-upstreaming-requirements.html v2: Fix typos Eric&Rob spotted. v3: Nitpick from Jani. Cc: Dave Airlie <airlied@gmail.com> Cc: Oded Gabbay <oded.gabbay@gmail.com> Cc: Russell King <rmk+kernel@armlinux.org.uk> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Eric Anholt <eric@anholt.net> Cc: Thomas Hellstrom <thellstrom@vmware.com> Cc: Sinclair Yeh <syeh@vmware.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org> Cc: Mark Yao <mark.yao@rock-chips.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Rob Clark <robdclark@gmail.com> Cc: CK Hu <ck.hu@mediatek.com> Cc: Xinliang Liu <z.liuxinliang@hisilicon.com> Cc: Philipp Zabel <p.zabel@pengutronix.de> Cc: Stefan Agner <stefan@agner.ch> Cc: Inki Dae <inki.dae@samsung.com> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Boris Brezillon <boris.brezillon@free-electrons.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Christian König <christian.koenig@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Brian Starkey <brian.starkey@arm.com> Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Alexey Brodkin <abrodkin@synopsys.com> Acked-by: Dave Airlie <airlied@gmail.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--Documentation/gpu/drm-uapi.rst67
1 files changed, 67 insertions, 0 deletions
diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst
index 94876938aef3..12b47c30fe2e 100644
--- a/Documentation/gpu/drm-uapi.rst
+++ b/Documentation/gpu/drm-uapi.rst
@@ -36,6 +36,73 @@ Primary Nodes, DRM Master and Authentication
36Open-Source Userspace Requirements 36Open-Source Userspace Requirements
37================================== 37==================================
38 38
39The DRM subsystem has stricter requirements than most other kernel subsystems on
40what the userspace side for new uAPI needs to look like. This section here
41explains what exactly those requirements are, and why they exist.
42
43The short summary is that any addition of DRM uAPI requires corresponding
44open-sourced userspace patches, and those patches must be reviewed and ready for
45merging into a suitable and canonical upstream project.
46
47GFX devices (both display and render/GPU side) are really complex bits of
48hardware, with userspace and kernel by necessity having to work together really
49closely. The interfaces, for rendering and modesetting, must be extremely wide
50and flexible, and therefore it is almost always impossible to precisely define
51them for every possible corner case. This in turn makes it really practically
52infeasible to differentiate between behaviour that's required by userspace, and
53which must not be changed to avoid regressions, and behaviour which is only an
54accidental artifact of the current implementation.
55
56Without access to the full source code of all userspace users that means it
57becomes impossible to change the implementation details, since userspace could
58depend upon the accidental behaviour of the current implementation in minute
59details. And debugging such regressions without access to source code is pretty
60much impossible. As a consequence this means:
61
62- The Linux kernel's "no regression" policy holds in practice only for
63 open-source userspace of the DRM subsystem. DRM developers are perfectly fine
64 if closed-source blob drivers in userspace use the same uAPI as the open
65 drivers, but they must do so in the exact same way as the open drivers.
66 Creative (ab)use of the interfaces will, and in the past routinely has, lead
67 to breakage.
68
69- Any new userspace interface must have an open-source implementation as
70 demonstration vehicle.
71
72The other reason for requiring open-source userspace is uAPI review. Since the
73kernel and userspace parts of a GFX stack must work together so closely, code
74review can only assess whether a new interface achieves its goals by looking at
75both sides. Making sure that the interface indeed covers the use-case fully
76leads to a few additional requirements:
77
78- The open-source userspace must not be a toy/test application, but the real
79 thing. Specifically it needs to handle all the usual error and corner cases.
80 These are often the places where new uAPI falls apart and hence essential to
81 assess the fitness of a proposed interface.
82
83- The userspace side must be fully reviewed and tested to the standards of that
84 userspace project. For e.g. mesa this means piglit testcases and review on the
85 mailing list. This is again to ensure that the new interface actually gets the
86 job done.
87
88- The userspace patches must be against the canonical upstream, not some vendor
89 fork. This is to make sure that no one cheats on the review and testing
90 requirements by doing a quick fork.
91
92- The kernel patch can only be merged after all the above requirements are met,
93 but it **must** be merged **before** the userspace patches land. uAPI always flows
94 from the kernel, doing things the other way round risks divergence of the uAPI
95 definitions and header files.
96
97These are fairly steep requirements, but have grown out from years of shared
98pain and experience with uAPI added hastily, and almost always regretted about
99just as fast. GFX devices change really fast, requiring a paradigm shift and
100entire new set of uAPI interfaces every few years at least. Together with the
101Linux kernel's guarantee to keep existing userspace running for 10+ years this
102is already rather painful for the DRM subsystem, with multiple different uAPIs
103for the same thing co-existing. If we add a few more complete mistakes into the
104mix every year it would be entirely unmanageable.
105
39Render nodes 106Render nodes
40============ 107============
41 108