todo.rst 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972
  1. .. _todo:
  2. =========
  3. TODO list
  4. =========
  5. This section contains a list of smaller janitorial tasks in the kernel DRM
  6. graphics subsystem useful as newbie projects. Or for slow rainy days.
  7. Difficulty
  8. ----------
  9. To make it easier task are categorized into different levels:
  10. Starter: Good tasks to get started with the DRM subsystem.
  11. Intermediate: Tasks which need some experience with working in the DRM
  12. subsystem, or some specific GPU/display graphics knowledge. For debugging issue
  13. it's good to have the relevant hardware (or a virtual driver set up) available
  14. for testing.
  15. Advanced: Tricky tasks that need fairly good understanding of the DRM subsystem
  16. and graphics topics. Generally need the relevant hardware for development and
  17. testing.
  18. Expert: Only attempt these if you've successfully completed some tricky
  19. refactorings already and are an expert in the specific area
  20. Subsystem-wide refactorings
  21. ===========================
  22. Remove custom dumb_map_offset implementations
  23. ---------------------------------------------
  24. All GEM based drivers should be using drm_gem_create_mmap_offset() instead.
  25. Audit each individual driver, make sure it'll work with the generic
  26. implementation (there's lots of outdated locking leftovers in various
  27. implementations), and then remove it.
  28. Contact: Simona Vetter, respective driver maintainers
  29. Level: Intermediate
  30. Convert existing KMS drivers to atomic modesetting
  31. --------------------------------------------------
  32. 3.19 has the atomic modeset interfaces and helpers, so drivers can now be
  33. converted over. Modern compositors like Wayland or Surfaceflinger on Android
  34. really want an atomic modeset interface, so this is all about the bright
  35. future.
  36. There is a conversion guide for atomic [1]_ and all you need is a GPU for a
  37. non-converted driver. The "Atomic mode setting design overview" series [2]_
  38. [3]_ at LWN.net can also be helpful.
  39. As part of this drivers also need to convert to universal plane (which means
  40. exposing primary & cursor as proper plane objects). But that's much easier to
  41. do by directly using the new atomic helper driver callbacks.
  42. .. [1] https://blog.ffwll.ch/2014/11/atomic-modeset-support-for-kms-drivers.html
  43. .. [2] https://lwn.net/Articles/653071/
  44. .. [3] https://lwn.net/Articles/653466/
  45. Contact: Simona Vetter, respective driver maintainers
  46. Level: Advanced
  47. Clean up the clipped coordination confusion around planes
  48. ---------------------------------------------------------
  49. We have a helper to get this right with drm_plane_helper_check_update(), but
  50. it's not consistently used. This should be fixed, preferably in the atomic
  51. helpers (and drivers then moved over to clipped coordinates). Probably the
  52. helper should also be moved from drm_plane_helper.c to the atomic helpers, to
  53. avoid confusion - the other helpers in that file are all deprecated legacy
  54. helpers.
  55. Contact: Ville Syrjälä, Simona Vetter, driver maintainers
  56. Level: Advanced
  57. Improve plane atomic_check helpers
  58. ----------------------------------
  59. Aside from the clipped coordinates right above there's a few suboptimal things
  60. with the current helpers:
  61. - drm_plane_helper_funcs->atomic_check gets called for enabled or disabled
  62. planes. At best this seems to confuse drivers, worst it means they blow up
  63. when the plane is disabled without the CRTC. The only special handling is
  64. resetting values in the plane state structures, which instead should be moved
  65. into the drm_plane_funcs->atomic_duplicate_state functions.
  66. - Once that's done, helpers could stop calling ->atomic_check for disabled
  67. planes.
  68. - Then we could go through all the drivers and remove the more-or-less confused
  69. checks for plane_state->fb and plane_state->crtc.
  70. Contact: Simona Vetter
  71. Level: Advanced
  72. Convert early atomic drivers to async commit helpers
  73. ----------------------------------------------------
  74. For the first year the atomic modeset helpers didn't support asynchronous /
  75. nonblocking commits, and every driver had to hand-roll them. This is fixed
  76. now, but there's still a pile of existing drivers that easily could be
  77. converted over to the new infrastructure.
  78. One issue with the helpers is that they require that drivers handle completion
  79. events for atomic commits correctly. But fixing these bugs is good anyway.
  80. Somewhat related is the legacy_cursor_update hack, which should be replaced with
  81. the new atomic_async_check/commit functionality in the helpers in drivers that
  82. still look at that flag.
  83. Contact: Simona Vetter, respective driver maintainers
  84. Level: Advanced
  85. Rename drm_atomic_state
  86. -----------------------
  87. The KMS framework uses two slightly different definitions for the ``state``
  88. concept. For a given object (plane, CRTC, encoder, etc., so
  89. ``drm_$OBJECT_state``), the state is the entire state of that object. However,
  90. at the device level, ``drm_atomic_state`` refers to a state update for a
  91. limited number of objects.
  92. The state isn't the entire device state, but only the full state of some
  93. objects in that device. This is confusing to newcomers, and
  94. ``drm_atomic_state`` should be renamed to something clearer like
  95. ``drm_atomic_commit``.
  96. In addition to renaming the structure itself, it would also imply renaming some
  97. related functions (``drm_atomic_state_alloc``, ``drm_atomic_state_get``,
  98. ``drm_atomic_state_put``, ``drm_atomic_state_init``,
  99. ``__drm_atomic_state_free``, etc.).
  100. Contact: Maxime Ripard <mripard@kernel.org>
  101. Level: Advanced
  102. Fallout from atomic KMS
  103. -----------------------
  104. ``drm_atomic_helper.c`` provides a batch of functions which implement legacy
  105. IOCTLs on top of the new atomic driver interface. Which is really nice for
  106. gradual conversion of drivers, but unfortunately the semantic mismatches are
  107. a bit too severe. So there's some follow-up work to adjust the function
  108. interfaces to fix these issues:
  109. * atomic needs the lock acquire context. At the moment that's passed around
  110. implicitly with some horrible hacks, and it's also allocate with
  111. ``GFP_NOFAIL`` behind the scenes. All legacy paths need to start allocating
  112. the acquire context explicitly on stack and then also pass it down into
  113. drivers explicitly so that the legacy-on-atomic functions can use them.
  114. Except for some driver code this is done. This task should be finished by
  115. adding WARN_ON(!drm_drv_uses_atomic_modeset) in drm_modeset_lock_all().
  116. * A bunch of the vtable hooks are now in the wrong place: DRM has a split
  117. between core vfunc tables (named ``drm_foo_funcs``), which are used to
  118. implement the userspace ABI. And then there's the optional hooks for the
  119. helper libraries (name ``drm_foo_helper_funcs``), which are purely for
  120. internal use. Some of these hooks should be move from ``_funcs`` to
  121. ``_helper_funcs`` since they are not part of the core ABI. There's a
  122. ``FIXME`` comment in the kerneldoc for each such case in ``drm_crtc.h``.
  123. Contact: Simona Vetter
  124. Level: Intermediate
  125. Move Buffer Object Locking to dma_resv_lock()
  126. ---------------------------------------------
  127. Many drivers have their own per-object locking scheme, usually using
  128. mutex_lock(). This causes all kinds of trouble for buffer sharing, since
  129. depending which driver is the exporter and importer, the locking hierarchy is
  130. reversed.
  131. To solve this we need one standard per-object locking mechanism, which is
  132. dma_resv_lock(). This lock needs to be called as the outermost lock, with all
  133. other driver specific per-object locks removed. The problem is that rolling out
  134. the actual change to the locking contract is a flag day, due to struct dma_buf
  135. buffer sharing.
  136. Level: Expert
  137. Convert logging to drm_* functions with drm_device parameter
  138. ------------------------------------------------------------
  139. For drivers which could have multiple instances, it is necessary to
  140. differentiate between which is which in the logs. Since DRM_INFO/WARN/ERROR
  141. don't do this, drivers used dev_info/warn/err to make this differentiation. We
  142. now have drm_* variants of the drm print functions, so we can start to convert
  143. those drivers back to using drm-formatted specific log messages.
  144. Before you start this conversion please contact the relevant maintainers to make
  145. sure your work will be merged - not everyone agrees that the DRM dmesg macros
  146. are better.
  147. Contact: Sean Paul, Maintainer of the driver you plan to convert
  148. Level: Starter
  149. Convert drivers to use simple modeset suspend/resume
  150. ----------------------------------------------------
  151. Most drivers (except i915 and nouveau) that use
  152. drm_atomic_helper_suspend/resume() can probably be converted to use
  153. drm_mode_config_helper_suspend/resume(). Also there's still open-coded version
  154. of the atomic suspend/resume code in older atomic modeset drivers.
  155. Contact: Maintainer of the driver you plan to convert
  156. Level: Intermediate
  157. Reimplement functions in drm_fbdev_fb_ops without fbdev
  158. -------------------------------------------------------
  159. A number of callback functions in drm_fbdev_fb_ops could benefit from
  160. being rewritten without dependencies on the fbdev module. Some of the
  161. helpers could further benefit from using struct iosys_map instead of
  162. raw pointers.
  163. Contact: Thomas Zimmermann <tzimmermann@suse.de>, Simona Vetter
  164. Level: Advanced
  165. Benchmark and optimize blitting and format-conversion function
  166. --------------------------------------------------------------
  167. Drawing to display memory quickly is crucial for many applications'
  168. performance.
  169. On at least x86-64, sys_imageblit() is significantly slower than
  170. cfb_imageblit(), even though both use the same blitting algorithm and
  171. the latter is written for I/O memory. It turns out that cfb_imageblit()
  172. uses movl instructions, while sys_imageblit apparently does not. This
  173. seems to be a problem with gcc's optimizer. DRM's format-conversion
  174. helpers might be subject to similar issues.
  175. Benchmark and optimize fbdev's sys_() helpers and DRM's format-conversion
  176. helpers. In cases that can be further optimized, maybe implement a different
  177. algorithm. For micro-optimizations, use movl/movq instructions explicitly.
  178. That might possibly require architecture-specific helpers (e.g., storel()
  179. storeq()).
  180. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  181. Level: Intermediate
  182. drm_framebuffer_funcs and drm_mode_config_funcs.fb_create cleanup
  183. -----------------------------------------------------------------
  184. A lot more drivers could be switched over to the drm_gem_framebuffer helpers.
  185. Various hold-ups:
  186. - Need to switch over to the generic dirty tracking code using
  187. drm_atomic_helper_dirtyfb first (e.g. qxl).
  188. - Need to switch to drm_fbdev_generic_setup(), otherwise a lot of the custom fb
  189. setup code can't be deleted.
  190. - Need to switch to drm_gem_fb_create(), as now drm_gem_fb_create() checks for
  191. valid formats for atomic drivers.
  192. - Many drivers subclass drm_framebuffer, we'd need a embedding compatible
  193. version of the varios drm_gem_fb_create functions. Maybe called
  194. drm_gem_fb_create/_with_dirty/_with_funcs as needed.
  195. Contact: Simona Vetter
  196. Level: Intermediate
  197. Generic fbdev defio support
  198. ---------------------------
  199. The defio support code in the fbdev core has some very specific requirements,
  200. which means drivers need to have a special framebuffer for fbdev. The main
  201. issue is that it uses some fields in struct page itself, which breaks shmem
  202. gem objects (and other things). To support defio, affected drivers require
  203. the use of a shadow buffer, which may add CPU and memory overhead.
  204. Possible solution would be to write our own defio mmap code in the drm fbdev
  205. emulation. It would need to fully wrap the existing mmap ops, forwarding
  206. everything after it has done the write-protect/mkwrite trickery:
  207. - In the drm_fbdev_fb_mmap helper, if we need defio, change the
  208. default page prots to write-protected with something like this::
  209. vma->vm_page_prot = pgprot_wrprotect(vma->vm_page_prot);
  210. - Set the mkwrite and fsync callbacks with similar implementions to the core
  211. fbdev defio stuff. These should all work on plain ptes, they don't actually
  212. require a struct page. uff. These should all work on plain ptes, they don't
  213. actually require a struct page.
  214. - Track the dirty pages in a separate structure (bitfield with one bit per page
  215. should work) to avoid clobbering struct page.
  216. Might be good to also have some igt testcases for this.
  217. Contact: Simona Vetter, Noralf Tronnes
  218. Level: Advanced
  219. connector register/unregister fixes
  220. -----------------------------------
  221. - For most connectors it's a no-op to call drm_connector_register/unregister
  222. directly from driver code, drm_dev_register/unregister take care of this
  223. already. We can remove all of them.
  224. - For dp drivers it's a bit more a mess, since we need the connector to be
  225. registered when calling drm_dp_aux_register. Fix this by instead calling
  226. drm_dp_aux_init, and moving the actual registering into a late_register
  227. callback as recommended in the kerneldoc.
  228. Level: Intermediate
  229. Remove load/unload callbacks
  230. ----------------------------
  231. The load/unload callbacks in struct &drm_driver are very much midlayers, plus
  232. for historical reasons they get the ordering wrong (and we can't fix that)
  233. between setting up the &drm_driver structure and calling drm_dev_register().
  234. - Rework drivers to no longer use the load/unload callbacks, directly coding the
  235. load/unload sequence into the driver's probe function.
  236. - Once all drivers are converted, remove the load/unload callbacks.
  237. Contact: Simona Vetter
  238. Level: Intermediate
  239. Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi
  240. ---------------------------------------------------------------
  241. Once EDID is parsed, the monitor HDMI support information is available through
  242. drm_display_info.is_hdmi. Many drivers still call drm_detect_hdmi_monitor() to
  243. retrieve the same information, which is less efficient.
  244. Audit each individual driver calling drm_detect_hdmi_monitor() and switch to
  245. drm_display_info.is_hdmi if applicable.
  246. Contact: Laurent Pinchart, respective driver maintainers
  247. Level: Intermediate
  248. Consolidate custom driver modeset properties
  249. --------------------------------------------
  250. Before atomic modeset took place, many drivers where creating their own
  251. properties. Among other things, atomic brought the requirement that custom,
  252. driver specific properties should not be used.
  253. For this task, we aim to introduce core helpers or reuse the existing ones
  254. if available:
  255. A quick, unconfirmed, examples list.
  256. Introduce core helpers:
  257. - audio (amdgpu, intel, gma500, radeon)
  258. - brightness, contrast, etc (armada, nouveau) - overlay only (?)
  259. - broadcast rgb (gma500, intel)
  260. - colorkey (armada, nouveau, rcar) - overlay only (?)
  261. - dither (amdgpu, nouveau, radeon) - varies across drivers
  262. - underscan family (amdgpu, radeon, nouveau)
  263. Already in core:
  264. - colorspace (sti)
  265. - tv format names, enhancements (gma500, intel)
  266. - tv overscan, margins, etc. (gma500, intel)
  267. - zorder (omapdrm) - same as zpos (?)
  268. Contact: Emil Velikov, respective driver maintainers
  269. Level: Intermediate
  270. Use struct iosys_map throughout codebase
  271. ----------------------------------------
  272. Pointers to shared device memory are stored in struct iosys_map. Each
  273. instance knows whether it refers to system or I/O memory. Most of the DRM-wide
  274. interface have been converted to use struct iosys_map, but implementations
  275. often still use raw pointers.
  276. The task is to use struct iosys_map where it makes sense.
  277. * Memory managers should use struct iosys_map for dma-buf-imported buffers.
  278. * TTM might benefit from using struct iosys_map internally.
  279. * Framebuffer copying and blitting helpers should operate on struct iosys_map.
  280. Contact: Thomas Zimmermann <tzimmermann@suse.de>, Christian König, Simona Vetter
  281. Level: Intermediate
  282. Review all drivers for setting struct drm_mode_config.{max_width,max_height} correctly
  283. --------------------------------------------------------------------------------------
  284. The values in struct drm_mode_config.{max_width,max_height} describe the
  285. maximum supported framebuffer size. It's the virtual screen size, but many
  286. drivers treat it like limitations of the physical resolution.
  287. The maximum width depends on the hardware's maximum scanline pitch. The
  288. maximum height depends on the amount of addressable video memory. Review all
  289. drivers to initialize the fields to the correct values.
  290. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  291. Level: Intermediate
  292. Request memory regions in all fbdev drivers
  293. --------------------------------------------
  294. Old/ancient fbdev drivers do not request their memory properly.
  295. Go through these drivers and add code to request the memory regions
  296. that the driver uses. This requires adding calls to request_mem_region(),
  297. pci_request_region() or similar functions. Use helpers for managed cleanup
  298. where possible. Problematic areas include hardware that has exclusive ranges
  299. like VGA. VGA16fb does not request the range as it is expected.
  300. Drivers are pretty bad at doing this and there used to be conflicts among
  301. DRM and fbdev drivers. Still, it's the correct thing to do.
  302. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  303. Level: Starter
  304. Remove driver dependencies on FB_DEVICE
  305. ---------------------------------------
  306. A number of fbdev drivers provide attributes via sysfs and therefore depend
  307. on CONFIG_FB_DEVICE to be selected. Review each driver and attempt to make
  308. any dependencies on CONFIG_FB_DEVICE optional. At the minimum, the respective
  309. code in the driver could be conditionalized via ifdef CONFIG_FB_DEVICE. Not
  310. all drivers might be able to drop CONFIG_FB_DEVICE.
  311. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  312. Level: Starter
  313. Remove disable/unprepare in remove/shutdown in panel-simple and panel-edp
  314. -------------------------------------------------------------------------
  315. As of commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in
  316. drm_panel"), we have a check in the drm_panel core to make sure nobody
  317. double-calls prepare/enable/disable/unprepare. Eventually that should probably
  318. be turned into a WARN_ON() or somehow made louder.
  319. At the moment, we expect that we may still encounter the warnings in the
  320. drm_panel core when using panel-simple and panel-edp. Since those panel
  321. drivers are used with a lot of different DRM modeset drivers they still
  322. make an extra effort to disable/unprepare the panel themsevles at shutdown
  323. time. Specifically we could still encounter those warnings if the panel
  324. driver gets shutdown() _before_ the DRM modeset driver and the DRM modeset
  325. driver properly calls drm_atomic_helper_shutdown() in its own shutdown()
  326. callback. Warnings could be avoided in such a case by using something like
  327. device links to ensure that the panel gets shutdown() after the DRM modeset
  328. driver.
  329. Once all DRM modeset drivers are known to shutdown properly, the extra
  330. calls to disable/unprepare in remove/shutdown in panel-simple and panel-edp
  331. should be removed and this TODO item marked complete.
  332. Contact: Douglas Anderson <dianders@chromium.org>
  333. Level: Intermediate
  334. Transition away from using deprecated MIPI DSI functions
  335. --------------------------------------------------------
  336. There are many functions defined in ``drm_mipi_dsi.c`` which have been
  337. deprecated. Each deprecated function was deprecated in favor of its `multi`
  338. variant (e.g. `mipi_dsi_generic_write()` and `mipi_dsi_generic_write_multi()`).
  339. The `multi` variant of a function includes improved error handling and logic
  340. which makes it more convenient to make several calls in a row, as most MIPI
  341. drivers do.
  342. Drivers should be updated to use undeprecated functions. Once all usages of the
  343. deprecated MIPI DSI functions have been removed, their definitions may be
  344. removed from ``drm_mipi_dsi.c``.
  345. Contact: Douglas Anderson <dianders@chromium.org>
  346. Level: Starter
  347. Remove devm_drm_put_bridge()
  348. ----------------------------
  349. Due to how the panel bridge handles the drm_bridge object lifetime, special
  350. care must be taken to dispose of the drm_bridge object when the
  351. panel_bridge is removed. This is currently managed using
  352. devm_drm_put_bridge(), but that is an unsafe, temporary workaround. To fix
  353. that, the DRM panel lifetime needs to be reworked. After the rework is
  354. done, remove devm_drm_put_bridge() and the TODO in
  355. drm_panel_bridge_remove().
  356. Contact: Maxime Ripard <mripard@kernel.org>,
  357. Luca Ceresoli <luca.ceresoli@bootlin.com>
  358. Level: Intermediate
  359. Convert users of of_drm_find_bridge() to of_drm_find_and_get_bridge()
  360. ---------------------------------------------------------------------
  361. Taking a struct drm_bridge pointer requires getting a reference and putting
  362. it after disposing of the pointer. Most functions returning a struct
  363. drm_bridge pointer already call drm_bridge_get() to increment the refcount
  364. and their users have been updated to call drm_bridge_put() when
  365. appropriate. of_drm_find_bridge() does not get a reference and it has been
  366. deprecated in favor of of_drm_find_and_get_bridge() which does, but some
  367. users still need to be converted.
  368. Contact: Maxime Ripard <mripard@kernel.org>,
  369. Luca Ceresoli <luca.ceresoli@bootlin.com>
  370. Level: Intermediate
  371. Core refactorings
  372. =================
  373. Make panic handling work
  374. ------------------------
  375. This is a really varied tasks with lots of little bits and pieces:
  376. * The panic path can't be tested currently, leading to constant breaking. The
  377. main issue here is that panics can be triggered from hardirq contexts and
  378. hence all panic related callback can run in hardirq context. It would be
  379. awesome if we could test at least the fbdev helper code and driver code by
  380. e.g. trigger calls through drm debugfs files. hardirq context could be
  381. achieved by using an IPI to the local processor.
  382. * There's a massive confusion of different panic handlers. DRM fbdev emulation
  383. helpers had their own (long removed), but on top of that the fbcon code itself
  384. also has one. We need to make sure that they stop fighting over each other.
  385. This is worked around by checking ``oops_in_progress`` at various entry points
  386. into the DRM fbdev emulation helpers. A much cleaner approach here would be to
  387. switch fbcon to the `threaded printk support
  388. <https://lwn.net/Articles/800946/>`_.
  389. * ``drm_can_sleep()`` is a mess. It hides real bugs in normal operations and
  390. isn't a full solution for panic paths. We need to make sure that it only
  391. returns true if there's a panic going on for real, and fix up all the
  392. fallout.
  393. * The panic handler must never sleep, which also means it can't ever
  394. ``mutex_lock()``. Also it can't grab any other lock unconditionally, not
  395. even spinlocks (because NMI and hardirq can panic too). We need to either
  396. make sure to not call such paths, or trylock everything. Really tricky.
  397. * A clean solution would be an entirely separate panic output support in KMS,
  398. bypassing the current fbcon support. See `[PATCH v2 0/3] drm: Add panic handling
  399. <https://lore.kernel.org/dri-devel/20190311174218.51899-1-noralf@tronnes.org/>`_.
  400. * Encoding the actual oops and preceding dmesg in a QR might help with the
  401. dread "important stuff scrolled away" problem. See `[RFC][PATCH] Oops messages
  402. transfer using QR codes
  403. <https://lore.kernel.org/lkml/1446217392-11981-1-git-send-email-alexandru.murtaza@intel.com/>`_
  404. for some example code that could be reused.
  405. Contact: Simona Vetter
  406. Level: Advanced
  407. Clean up the debugfs support
  408. ----------------------------
  409. There's a bunch of issues with it:
  410. - Convert drivers to support the drm_debugfs_add_files() function instead of
  411. the drm_debugfs_create_files() function.
  412. - Improve late-register debugfs by rolling out the same debugfs pre-register
  413. infrastructure for connector and crtc too. That way, the drivers won't need to
  414. split their setup code into init and register anymore.
  415. - We probably want to have some support for debugfs files on crtc/connectors and
  416. maybe other kms objects directly in core. There's even drm_print support in
  417. the funcs for these objects to dump kms state, so it's all there. And then the
  418. ->show() functions should obviously give you a pointer to the right object.
  419. - The drm_driver->debugfs_init hooks we have is just an artifact of the old
  420. midlayered load sequence. DRM debugfs should work more like sysfs, where you
  421. can create properties/files for an object anytime you want, and the core
  422. takes care of publishing/unpuplishing all the files at register/unregister
  423. time. Drivers shouldn't need to worry about these technicalities, and fixing
  424. this (together with the drm_minor->drm_device move) would allow us to remove
  425. debugfs_init.
  426. Contact: Simona Vetter
  427. Level: Intermediate
  428. Object lifetime fixes
  429. ---------------------
  430. There's two related issues here
  431. - Cleanup up the various ->destroy callbacks, which often are all the same
  432. simple code.
  433. - Lots of drivers erroneously allocate DRM modeset objects using devm_kzalloc,
  434. which results in use-after free issues on driver unload. This can be serious
  435. trouble even for drivers for hardware integrated on the SoC due to
  436. EPROBE_DEFERRED backoff.
  437. Both these problems can be solved by switching over to drmm_kzalloc(), and the
  438. various convenience wrappers provided, e.g. drmm_crtc_alloc_with_planes(),
  439. drmm_universal_plane_alloc(), ... and so on.
  440. Contact: Simona Vetter
  441. Level: Intermediate
  442. Remove automatic page mapping from dma-buf importing
  443. ----------------------------------------------------
  444. When importing dma-bufs, the dma-buf and PRIME frameworks automatically map
  445. imported pages into the importer's DMA area. drm_gem_prime_fd_to_handle() and
  446. drm_gem_prime_handle_to_fd() require that importers call dma_buf_attach()
  447. even if they never do actual device DMA, but only CPU access through
  448. dma_buf_vmap(). This is a problem for USB devices, which do not support DMA
  449. operations.
  450. To fix the issue, automatic page mappings should be removed from the
  451. buffer-sharing code. Fixing this is a bit more involved, since the import/export
  452. cache is also tied to &drm_gem_object.import_attach. Meanwhile we paper over
  453. this problem for USB devices by fishing out the USB host controller device, as
  454. long as that supports DMA. Otherwise importing can still needlessly fail.
  455. Contact: Thomas Zimmermann <tzimmermann@suse.de>, Simona Vetter
  456. Level: Advanced
  457. Implement a new DUMB_CREATE2 ioctl
  458. ----------------------------------
  459. The current DUMB_CREATE ioctl is not well defined. Instead of a pixel and
  460. framebuffer format, it only accepts a color mode of vague semantics. Assuming
  461. a linear framebuffer, the color mode gives an idea of the supported pixel
  462. format. But userspace effectively has to guess the correct values. It really
  463. only works reliably with framebuffers in XRGB8888. Userspace has begun to
  464. workaround these limitations by computing arbitrary format's buffer sizes and
  465. calculating their sizes in terms of XRGB8888 pixels.
  466. One possible solution is a new ioctl DUMB_CREATE2. It should accept a DRM
  467. format and a format modifier to resolve the color mode's ambiguity. As
  468. framebuffers can be multi-planar, the new ioctl has to return the buffer size,
  469. pitch and GEM handle for each individual color plane.
  470. In the first step, the new ioctl can be limited to the current features of
  471. the existing DUMB_CREATE. Individual drivers can then be extended to support
  472. multi-planar formats. Rockchip might require this and would be a good candidate.
  473. It might also be helpful to userspace to query information about the size of
  474. a potential buffer, if allocated. Userspace would supply geometry and format;
  475. the kernel would return minimal allocation sizes and scanline pitch. There is
  476. interest to allocate that memory from another device and provide it to the
  477. DRM driver (say via dma-buf).
  478. Another requested feature is the ability to allocate a buffer by size, without
  479. format. Accelators use this for their buffer allocation and it could likely be
  480. generalized.
  481. In addition to the kernel implementation, there must be user-space support
  482. for the new ioctl. There's code in Mesa that might be able to use the new
  483. call.
  484. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  485. Level: Advanced
  486. Better Testing
  487. ==============
  488. Add unit tests using the Kernel Unit Testing (KUnit) framework
  489. --------------------------------------------------------------
  490. The `KUnit <https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html>`_
  491. provides a common framework for unit tests within the Linux kernel. Having a
  492. test suite would allow to identify regressions earlier.
  493. A good candidate for the first unit tests are the format-conversion helpers in
  494. ``drm_format_helper.c``.
  495. Contact: Javier Martinez Canillas <javierm@redhat.com>
  496. Level: Intermediate
  497. Clean up and document former selftests suites
  498. ---------------------------------------------
  499. Some KUnit test suites (drm_buddy, drm_cmdline_parser, drm_damage_helper,
  500. drm_format, drm_framebuffer, drm_dp_mst_helper, drm_mm, drm_plane_helper and
  501. drm_rect) are former selftests suites that have been converted over when KUnit
  502. was first introduced.
  503. These suites were fairly undocumented, and with different goals than what unit
  504. tests can be. Trying to identify what each test in these suites actually test
  505. for, whether that makes sense for a unit test, and either remove it if it
  506. doesn't or document it if it does would be of great help.
  507. Contact: Maxime Ripard <mripard@kernel.org>
  508. Level: Intermediate
  509. Enable trinity for DRM
  510. ----------------------
  511. And fix up the fallout. Should be really interesting ...
  512. Level: Advanced
  513. Make KMS tests in i-g-t generic
  514. -------------------------------
  515. The i915 driver team maintains an extensive testsuite for the i915 DRM driver,
  516. including tons of testcases for corner-cases in the modesetting API. It would
  517. be awesome if those tests (at least the ones not relying on Intel-specific GEM
  518. features) could be made to run on any KMS driver.
  519. Basic work to run i-g-t tests on non-i915 is done, what's now missing is mass-
  520. converting things over. For modeset tests we also first need a bit of
  521. infrastructure to use dumb buffers for untiled buffers, to be able to run all
  522. the non-i915 specific modeset tests.
  523. Level: Advanced
  524. Extend virtual test driver (VKMS)
  525. ---------------------------------
  526. See the documentation of :ref:`VKMS <vkms>` for more details. This is an ideal
  527. internship task, since it only requires a virtual machine and can be sized to
  528. fit the available time.
  529. Level: See details
  530. Backlight Refactoring
  531. ---------------------
  532. Backlight drivers have a triple enable/disable state, which is a bit overkill.
  533. Plan to fix this:
  534. 1. Roll out backlight_enable() and backlight_disable() helpers everywhere. This
  535. has started already.
  536. 2. In all, only look at one of the three status bits set by the above helpers.
  537. 3. Remove the other two status bits.
  538. Contact: Simona Vetter
  539. Level: Intermediate
  540. Driver Specific
  541. ===============
  542. AMD DC Display Driver
  543. ---------------------
  544. AMD DC is the display driver for AMD devices starting with Vega. There has been
  545. a bunch of progress cleaning it up but there's still plenty of work to be done.
  546. See drivers/gpu/drm/amd/display/TODO for tasks.
  547. Contact: Harry Wentland, Alex Deucher
  548. Bootsplash
  549. ==========
  550. There is support in place now for writing internal DRM clients making it
  551. possible to pick up the bootsplash work that was rejected because it was written
  552. for fbdev.
  553. - [v6,8/8] drm/client: Hack: Add bootsplash example
  554. https://patchwork.freedesktop.org/patch/306579/
  555. - [RFC PATCH v2 00/13] Kernel based bootsplash
  556. https://lore.kernel.org/r/20171213194755.3409-1-mstaudt@suse.de
  557. Contact: Sam Ravnborg
  558. Level: Advanced
  559. Brightness handling on devices with multiple internal panels
  560. ============================================================
  561. On x86/ACPI devices there can be multiple backlight firmware interfaces:
  562. (ACPI) video, vendor specific and others. As well as direct/native (PWM)
  563. register programming by the KMS driver.
  564. To deal with this backlight drivers used on x86/ACPI call
  565. acpi_video_get_backlight_type() which has heuristics (+quirks) to select
  566. which backlight interface to use; and backlight drivers which do not match
  567. the returned type will not register themselves, so that only one backlight
  568. device gets registered (in a single GPU setup, see below).
  569. At the moment this more or less assumes that there will only
  570. be 1 (internal) panel on a system.
  571. On systems with 2 panels this may be a problem, depending on
  572. what interface acpi_video_get_backlight_type() selects:
  573. 1. native: in this case the KMS driver is expected to know which backlight
  574. device belongs to which output so everything should just work.
  575. 2. video: this does support controlling multiple backlights, but some work
  576. will need to be done to get the output <-> backlight device mapping
  577. The above assumes both panels will require the same backlight interface type.
  578. Things will break on systems with multiple panels where the 2 panels need
  579. a different type of control. E.g. one panel needs ACPI video backlight control,
  580. where as the other is using native backlight control. Currently in this case
  581. only one of the 2 required backlight devices will get registered, based on
  582. the acpi_video_get_backlight_type() return value.
  583. If this (theoretical) case ever shows up, then supporting this will need some
  584. work. A possible solution here would be to pass a device and connector-name
  585. to acpi_video_get_backlight_type() so that it can deal with this.
  586. Note in a way we already have a case where userspace sees 2 panels,
  587. in dual GPU laptop setups with a mux. On those systems we may see
  588. either 2 native backlight devices; or 2 native backlight devices.
  589. Userspace already has code to deal with this by detecting if the related
  590. panel is active (iow which way the mux between the GPU and the panels
  591. points) and then uses that backlight device. Userspace here very much
  592. assumes a single panel though. It picks only 1 of the 2 backlight devices
  593. and then only uses that one.
  594. Note that all userspace code (that I know off) is currently hardcoded
  595. to assume a single panel.
  596. Before the recent changes to not register multiple (e.g. video + native)
  597. /sys/class/backlight devices for a single panel (on a single GPU laptop),
  598. userspace would see multiple backlight devices all controlling the same
  599. backlight.
  600. To deal with this userspace had to always picks one preferred device under
  601. /sys/class/backlight and will ignore the others. So to support brightness
  602. control on multiple panels userspace will need to be updated too.
  603. There are plans to allow brightness control through the KMS API by adding
  604. a "display brightness" property to drm_connector objects for panels. This
  605. solves a number of issues with the /sys/class/backlight API, including not
  606. being able to map a sysfs backlight device to a specific connector. Any
  607. userspace changes to add support for brightness control on devices with
  608. multiple panels really should build on top of this new KMS property.
  609. Contact: Hans de Goede
  610. Level: Advanced
  611. Buffer age or other damage accumulation algorithm for buffer damage
  612. ===================================================================
  613. Drivers that do per-buffer uploads, need a buffer damage handling (rather than
  614. frame damage like drivers that do per-plane or per-CRTC uploads), but there is
  615. no support to get the buffer age or any other damage accumulation algorithm.
  616. For this reason, the damage helpers just fallback to a full plane update if the
  617. framebuffer attached to a plane has changed since the last page-flip. Drivers
  618. set &drm_plane_state.ignore_damage_clips to true as indication to
  619. drm_atomic_helper_damage_iter_init() and drm_atomic_helper_damage_iter_next()
  620. helpers that the damage clips should be ignored.
  621. This should be improved to get damage tracking properly working on drivers that
  622. do per-buffer uploads.
  623. More information about damage tracking and references to learning materials can
  624. be found in :ref:`damage_tracking_properties`.
  625. Contact: Javier Martinez Canillas <javierm@redhat.com>
  626. Level: Advanced
  627. Querying errors from drm_syncobj
  628. ================================
  629. The drm_syncobj container can be used by driver independent code to signal
  630. complection of submission.
  631. One minor feature still missing is a generic DRM IOCTL to query the error
  632. status of binary and timeline drm_syncobj.
  633. This should probably be improved by implementing the necessary kernel interface
  634. and adding support for that in the userspace stack.
  635. Contact: Christian König
  636. Level: Starter
  637. DRM GPU Scheduler
  638. =================
  639. Provide a universal successor for drm_sched_resubmit_jobs()
  640. -----------------------------------------------------------
  641. drm_sched_resubmit_jobs() is deprecated. Main reason being that it leads to
  642. reinitializing dma_fences. See that function's docu for details. The better
  643. approach for valid resubmissions by amdgpu and Xe is (apparently) to figure out
  644. which job (and, through association: which entity) caused the hang. Then, the
  645. job's buffer data, together with all other jobs' buffer data currently in the
  646. same hardware ring, must be invalidated. This can for example be done by
  647. overwriting it. amdgpu currently determines which jobs are in the ring and need
  648. to be overwritten by keeping copies of the job. Xe obtains that information by
  649. directly accessing drm_sched's pending_list.
  650. Tasks:
  651. 1. implement scheduler functionality through which the driver can obtain the
  652. information which *broken* jobs are currently in the hardware ring.
  653. 2. Such infrastructure would then typically be used in
  654. drm_sched_backend_ops.timedout_job(). Document that.
  655. 3. Port a driver as first user.
  656. 4. Document the new alternative in the docu of deprecated
  657. drm_sched_resubmit_jobs().
  658. Contact: Christian König <christian.koenig@amd.com>
  659. Philipp Stanner <phasta@kernel.org>
  660. Level: Advanced
  661. Add locking for runqueues
  662. -------------------------
  663. There is an old FIXME by Sima in include/drm/gpu_scheduler.h. It details that
  664. struct drm_sched_rq is read at many places without any locks, not even with a
  665. READ_ONCE. At XDC 2025 no one could really tell why that is the case, whether
  666. locks are needed and whether they could be added. (But for real, that should
  667. probably be locked!). Check whether it's possible to add locks everywhere, and
  668. do so if yes.
  669. Contact: Philipp Stanner <phasta@kernel.org>
  670. Level: Intermediate
  671. Outside DRM
  672. ===========
  673. Convert fbdev drivers to DRM
  674. ----------------------------
  675. There are plenty of fbdev drivers for older hardware. Some hardware has
  676. become obsolete, but some still provides good(-enough) framebuffers. The
  677. drivers that are still useful should be converted to DRM and afterwards
  678. removed from fbdev.
  679. Very simple fbdev drivers can best be converted by starting with a new
  680. DRM driver. Simple KMS helpers and SHMEM should be able to handle any
  681. existing hardware. The new driver's call-back functions are filled from
  682. existing fbdev code.
  683. More complex fbdev drivers can be refactored step-by-step into a DRM
  684. driver with the help of the DRM fbconv helpers [4]_. These helpers provide
  685. the transition layer between the DRM core infrastructure and the fbdev
  686. driver interface. Create a new DRM driver on top of the fbconv helpers,
  687. copy over the fbdev driver, and hook it up to the DRM code. Examples for
  688. several fbdev drivers are available in Thomas Zimmermann's fbconv tree
  689. [4]_, as well as a tutorial of this process [5]_. The result is a primitive
  690. DRM driver that can run X11 and Weston.
  691. .. [4] https://gitlab.freedesktop.org/tzimmermann/linux/tree/fbconv
  692. .. [5] https://gitlab.freedesktop.org/tzimmermann/linux/blob/fbconv/drivers/gpu/drm/drm_fbconv_helper.c
  693. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  694. Level: Advanced