todo.rst 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867
  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. Get rid of dev->struct_mutex from GEM drivers
  126. ---------------------------------------------
  127. ``dev->struct_mutex`` is the Big DRM Lock from legacy days and infested
  128. everything. Nowadays in modern drivers the only bit where it's mandatory is
  129. serializing GEM buffer object destruction. Which unfortunately means drivers
  130. have to keep track of that lock and either call ``unreference`` or
  131. ``unreference_locked`` depending upon context.
  132. Core GEM doesn't have a need for ``struct_mutex`` any more since kernel 4.8,
  133. and there's a GEM object ``free`` callback for any drivers which are
  134. entirely ``struct_mutex`` free.
  135. For drivers that need ``struct_mutex`` it should be replaced with a driver-
  136. private lock. The tricky part is the BO free functions, since those can't
  137. reliably take that lock any more. Instead state needs to be protected with
  138. suitable subordinate locks or some cleanup work pushed to a worker thread. For
  139. performance-critical drivers it might also be better to go with a more
  140. fine-grained per-buffer object and per-context lockings scheme. Currently only
  141. the ``msm`` and `i915` drivers use ``struct_mutex``.
  142. Contact: Simona Vetter, respective driver maintainers
  143. Level: Advanced
  144. Move Buffer Object Locking to dma_resv_lock()
  145. ---------------------------------------------
  146. Many drivers have their own per-object locking scheme, usually using
  147. mutex_lock(). This causes all kinds of trouble for buffer sharing, since
  148. depending which driver is the exporter and importer, the locking hierarchy is
  149. reversed.
  150. To solve this we need one standard per-object locking mechanism, which is
  151. dma_resv_lock(). This lock needs to be called as the outermost lock, with all
  152. other driver specific per-object locks removed. The problem is that rolling out
  153. the actual change to the locking contract is a flag day, due to struct dma_buf
  154. buffer sharing.
  155. Level: Expert
  156. Convert logging to drm_* functions with drm_device parameter
  157. ------------------------------------------------------------
  158. For drivers which could have multiple instances, it is necessary to
  159. differentiate between which is which in the logs. Since DRM_INFO/WARN/ERROR
  160. don't do this, drivers used dev_info/warn/err to make this differentiation. We
  161. now have drm_* variants of the drm print functions, so we can start to convert
  162. those drivers back to using drm-formatted specific log messages.
  163. Before you start this conversion please contact the relevant maintainers to make
  164. sure your work will be merged - not everyone agrees that the DRM dmesg macros
  165. are better.
  166. Contact: Sean Paul, Maintainer of the driver you plan to convert
  167. Level: Starter
  168. Convert drivers to use simple modeset suspend/resume
  169. ----------------------------------------------------
  170. Most drivers (except i915 and nouveau) that use
  171. drm_atomic_helper_suspend/resume() can probably be converted to use
  172. drm_mode_config_helper_suspend/resume(). Also there's still open-coded version
  173. of the atomic suspend/resume code in older atomic modeset drivers.
  174. Contact: Maintainer of the driver you plan to convert
  175. Level: Intermediate
  176. Reimplement functions in drm_fbdev_fb_ops without fbdev
  177. -------------------------------------------------------
  178. A number of callback functions in drm_fbdev_fb_ops could benefit from
  179. being rewritten without dependencies on the fbdev module. Some of the
  180. helpers could further benefit from using struct iosys_map instead of
  181. raw pointers.
  182. Contact: Thomas Zimmermann <tzimmermann@suse.de>, Simona Vetter
  183. Level: Advanced
  184. Benchmark and optimize blitting and format-conversion function
  185. --------------------------------------------------------------
  186. Drawing to display memory quickly is crucial for many applications'
  187. performance.
  188. On at least x86-64, sys_imageblit() is significantly slower than
  189. cfb_imageblit(), even though both use the same blitting algorithm and
  190. the latter is written for I/O memory. It turns out that cfb_imageblit()
  191. uses movl instructions, while sys_imageblit apparently does not. This
  192. seems to be a problem with gcc's optimizer. DRM's format-conversion
  193. helpers might be subject to similar issues.
  194. Benchmark and optimize fbdev's sys_() helpers and DRM's format-conversion
  195. helpers. In cases that can be further optimized, maybe implement a different
  196. algorithm. For micro-optimizations, use movl/movq instructions explicitly.
  197. That might possibly require architecture-specific helpers (e.g., storel()
  198. storeq()).
  199. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  200. Level: Intermediate
  201. drm_framebuffer_funcs and drm_mode_config_funcs.fb_create cleanup
  202. -----------------------------------------------------------------
  203. A lot more drivers could be switched over to the drm_gem_framebuffer helpers.
  204. Various hold-ups:
  205. - Need to switch over to the generic dirty tracking code using
  206. drm_atomic_helper_dirtyfb first (e.g. qxl).
  207. - Need to switch to drm_fbdev_generic_setup(), otherwise a lot of the custom fb
  208. setup code can't be deleted.
  209. - Need to switch to drm_gem_fb_create(), as now drm_gem_fb_create() checks for
  210. valid formats for atomic drivers.
  211. - Many drivers subclass drm_framebuffer, we'd need a embedding compatible
  212. version of the varios drm_gem_fb_create functions. Maybe called
  213. drm_gem_fb_create/_with_dirty/_with_funcs as needed.
  214. Contact: Simona Vetter
  215. Level: Intermediate
  216. Generic fbdev defio support
  217. ---------------------------
  218. The defio support code in the fbdev core has some very specific requirements,
  219. which means drivers need to have a special framebuffer for fbdev. The main
  220. issue is that it uses some fields in struct page itself, which breaks shmem
  221. gem objects (and other things). To support defio, affected drivers require
  222. the use of a shadow buffer, which may add CPU and memory overhead.
  223. Possible solution would be to write our own defio mmap code in the drm fbdev
  224. emulation. It would need to fully wrap the existing mmap ops, forwarding
  225. everything after it has done the write-protect/mkwrite trickery:
  226. - In the drm_fbdev_fb_mmap helper, if we need defio, change the
  227. default page prots to write-protected with something like this::
  228. vma->vm_page_prot = pgprot_wrprotect(vma->vm_page_prot);
  229. - Set the mkwrite and fsync callbacks with similar implementions to the core
  230. fbdev defio stuff. These should all work on plain ptes, they don't actually
  231. require a struct page. uff. These should all work on plain ptes, they don't
  232. actually require a struct page.
  233. - Track the dirty pages in a separate structure (bitfield with one bit per page
  234. should work) to avoid clobbering struct page.
  235. Might be good to also have some igt testcases for this.
  236. Contact: Simona Vetter, Noralf Tronnes
  237. Level: Advanced
  238. connector register/unregister fixes
  239. -----------------------------------
  240. - For most connectors it's a no-op to call drm_connector_register/unregister
  241. directly from driver code, drm_dev_register/unregister take care of this
  242. already. We can remove all of them.
  243. - For dp drivers it's a bit more a mess, since we need the connector to be
  244. registered when calling drm_dp_aux_register. Fix this by instead calling
  245. drm_dp_aux_init, and moving the actual registering into a late_register
  246. callback as recommended in the kerneldoc.
  247. Level: Intermediate
  248. Remove load/unload callbacks
  249. ----------------------------
  250. The load/unload callbacks in struct &drm_driver are very much midlayers, plus
  251. for historical reasons they get the ordering wrong (and we can't fix that)
  252. between setting up the &drm_driver structure and calling drm_dev_register().
  253. - Rework drivers to no longer use the load/unload callbacks, directly coding the
  254. load/unload sequence into the driver's probe function.
  255. - Once all drivers are converted, remove the load/unload callbacks.
  256. Contact: Simona Vetter
  257. Level: Intermediate
  258. Replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi
  259. ---------------------------------------------------------------
  260. Once EDID is parsed, the monitor HDMI support information is available through
  261. drm_display_info.is_hdmi. Many drivers still call drm_detect_hdmi_monitor() to
  262. retrieve the same information, which is less efficient.
  263. Audit each individual driver calling drm_detect_hdmi_monitor() and switch to
  264. drm_display_info.is_hdmi if applicable.
  265. Contact: Laurent Pinchart, respective driver maintainers
  266. Level: Intermediate
  267. Consolidate custom driver modeset properties
  268. --------------------------------------------
  269. Before atomic modeset took place, many drivers where creating their own
  270. properties. Among other things, atomic brought the requirement that custom,
  271. driver specific properties should not be used.
  272. For this task, we aim to introduce core helpers or reuse the existing ones
  273. if available:
  274. A quick, unconfirmed, examples list.
  275. Introduce core helpers:
  276. - audio (amdgpu, intel, gma500, radeon)
  277. - brightness, contrast, etc (armada, nouveau) - overlay only (?)
  278. - broadcast rgb (gma500, intel)
  279. - colorkey (armada, nouveau, rcar) - overlay only (?)
  280. - dither (amdgpu, nouveau, radeon) - varies across drivers
  281. - underscan family (amdgpu, radeon, nouveau)
  282. Already in core:
  283. - colorspace (sti)
  284. - tv format names, enhancements (gma500, intel)
  285. - tv overscan, margins, etc. (gma500, intel)
  286. - zorder (omapdrm) - same as zpos (?)
  287. Contact: Emil Velikov, respective driver maintainers
  288. Level: Intermediate
  289. Use struct iosys_map throughout codebase
  290. ----------------------------------------
  291. Pointers to shared device memory are stored in struct iosys_map. Each
  292. instance knows whether it refers to system or I/O memory. Most of the DRM-wide
  293. interface have been converted to use struct iosys_map, but implementations
  294. often still use raw pointers.
  295. The task is to use struct iosys_map where it makes sense.
  296. * Memory managers should use struct iosys_map for dma-buf-imported buffers.
  297. * TTM might benefit from using struct iosys_map internally.
  298. * Framebuffer copying and blitting helpers should operate on struct iosys_map.
  299. Contact: Thomas Zimmermann <tzimmermann@suse.de>, Christian König, Simona Vetter
  300. Level: Intermediate
  301. Review all drivers for setting struct drm_mode_config.{max_width,max_height} correctly
  302. --------------------------------------------------------------------------------------
  303. The values in struct drm_mode_config.{max_width,max_height} describe the
  304. maximum supported framebuffer size. It's the virtual screen size, but many
  305. drivers treat it like limitations of the physical resolution.
  306. The maximum width depends on the hardware's maximum scanline pitch. The
  307. maximum height depends on the amount of addressable video memory. Review all
  308. drivers to initialize the fields to the correct values.
  309. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  310. Level: Intermediate
  311. Request memory regions in all drivers
  312. -------------------------------------
  313. Go through all drivers and add code to request the memory regions that the
  314. driver uses. This requires adding calls to request_mem_region(),
  315. pci_request_region() or similar functions. Use helpers for managed cleanup
  316. where possible.
  317. Drivers are pretty bad at doing this and there used to be conflicts among
  318. DRM and fbdev drivers. Still, it's the correct thing to do.
  319. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  320. Level: Starter
  321. Remove driver dependencies on FB_DEVICE
  322. ---------------------------------------
  323. A number of fbdev drivers provide attributes via sysfs and therefore depend
  324. on CONFIG_FB_DEVICE to be selected. Review each driver and attempt to make
  325. any dependencies on CONFIG_FB_DEVICE optional. At the minimum, the respective
  326. code in the driver could be conditionalized via ifdef CONFIG_FB_DEVICE. Not
  327. all drivers might be able to drop CONFIG_FB_DEVICE.
  328. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  329. Level: Starter
  330. Remove disable/unprepare in remove/shutdown in panel-simple and panel-edp
  331. -------------------------------------------------------------------------
  332. As of commit d2aacaf07395 ("drm/panel: Check for already prepared/enabled in
  333. drm_panel"), we have a check in the drm_panel core to make sure nobody
  334. double-calls prepare/enable/disable/unprepare. Eventually that should probably
  335. be turned into a WARN_ON() or somehow made louder.
  336. At the moment, we expect that we may still encounter the warnings in the
  337. drm_panel core when using panel-simple and panel-edp. Since those panel
  338. drivers are used with a lot of different DRM modeset drivers they still
  339. make an extra effort to disable/unprepare the panel themsevles at shutdown
  340. time. Specifically we could still encounter those warnings if the panel
  341. driver gets shutdown() _before_ the DRM modeset driver and the DRM modeset
  342. driver properly calls drm_atomic_helper_shutdown() in its own shutdown()
  343. callback. Warnings could be avoided in such a case by using something like
  344. device links to ensure that the panel gets shutdown() after the DRM modeset
  345. driver.
  346. Once all DRM modeset drivers are known to shutdown properly, the extra
  347. calls to disable/unprepare in remove/shutdown in panel-simple and panel-edp
  348. should be removed and this TODO item marked complete.
  349. Contact: Douglas Anderson <dianders@chromium.org>
  350. Level: Intermediate
  351. Transition away from using mipi_dsi_*_write_seq()
  352. -------------------------------------------------
  353. The macros mipi_dsi_generic_write_seq() and mipi_dsi_dcs_write_seq() are
  354. non-intuitive because, if there are errors, they return out of the *caller's*
  355. function. We should move all callers to use mipi_dsi_generic_write_seq_multi()
  356. and mipi_dsi_dcs_write_seq_multi() macros instead.
  357. Once all callers are transitioned, the macros and the functions that they call,
  358. mipi_dsi_generic_write_chatty() and mipi_dsi_dcs_write_buffer_chatty(), can
  359. probably be removed. Alternatively, if people feel like the _multi() variants
  360. are overkill for some use cases, we could keep the mipi_dsi_*_write_seq()
  361. variants but change them not to return out of the caller.
  362. Contact: Douglas Anderson <dianders@chromium.org>
  363. Level: Starter
  364. Core refactorings
  365. =================
  366. Make panic handling work
  367. ------------------------
  368. This is a really varied tasks with lots of little bits and pieces:
  369. * The panic path can't be tested currently, leading to constant breaking. The
  370. main issue here is that panics can be triggered from hardirq contexts and
  371. hence all panic related callback can run in hardirq context. It would be
  372. awesome if we could test at least the fbdev helper code and driver code by
  373. e.g. trigger calls through drm debugfs files. hardirq context could be
  374. achieved by using an IPI to the local processor.
  375. * There's a massive confusion of different panic handlers. DRM fbdev emulation
  376. helpers had their own (long removed), but on top of that the fbcon code itself
  377. also has one. We need to make sure that they stop fighting over each other.
  378. This is worked around by checking ``oops_in_progress`` at various entry points
  379. into the DRM fbdev emulation helpers. A much cleaner approach here would be to
  380. switch fbcon to the `threaded printk support
  381. <https://lwn.net/Articles/800946/>`_.
  382. * ``drm_can_sleep()`` is a mess. It hides real bugs in normal operations and
  383. isn't a full solution for panic paths. We need to make sure that it only
  384. returns true if there's a panic going on for real, and fix up all the
  385. fallout.
  386. * The panic handler must never sleep, which also means it can't ever
  387. ``mutex_lock()``. Also it can't grab any other lock unconditionally, not
  388. even spinlocks (because NMI and hardirq can panic too). We need to either
  389. make sure to not call such paths, or trylock everything. Really tricky.
  390. * A clean solution would be an entirely separate panic output support in KMS,
  391. bypassing the current fbcon support. See `[PATCH v2 0/3] drm: Add panic handling
  392. <https://lore.kernel.org/dri-devel/20190311174218.51899-1-noralf@tronnes.org/>`_.
  393. * Encoding the actual oops and preceding dmesg in a QR might help with the
  394. dread "important stuff scrolled away" problem. See `[RFC][PATCH] Oops messages
  395. transfer using QR codes
  396. <https://lore.kernel.org/lkml/1446217392-11981-1-git-send-email-alexandru.murtaza@intel.com/>`_
  397. for some example code that could be reused.
  398. Contact: Simona Vetter
  399. Level: Advanced
  400. Clean up the debugfs support
  401. ----------------------------
  402. There's a bunch of issues with it:
  403. - Convert drivers to support the drm_debugfs_add_files() function instead of
  404. the drm_debugfs_create_files() function.
  405. - Improve late-register debugfs by rolling out the same debugfs pre-register
  406. infrastructure for connector and crtc too. That way, the drivers won't need to
  407. split their setup code into init and register anymore.
  408. - We probably want to have some support for debugfs files on crtc/connectors and
  409. maybe other kms objects directly in core. There's even drm_print support in
  410. the funcs for these objects to dump kms state, so it's all there. And then the
  411. ->show() functions should obviously give you a pointer to the right object.
  412. - The drm_driver->debugfs_init hooks we have is just an artifact of the old
  413. midlayered load sequence. DRM debugfs should work more like sysfs, where you
  414. can create properties/files for an object anytime you want, and the core
  415. takes care of publishing/unpuplishing all the files at register/unregister
  416. time. Drivers shouldn't need to worry about these technicalities, and fixing
  417. this (together with the drm_minor->drm_device move) would allow us to remove
  418. debugfs_init.
  419. Contact: Simona Vetter
  420. Level: Intermediate
  421. Object lifetime fixes
  422. ---------------------
  423. There's two related issues here
  424. - Cleanup up the various ->destroy callbacks, which often are all the same
  425. simple code.
  426. - Lots of drivers erroneously allocate DRM modeset objects using devm_kzalloc,
  427. which results in use-after free issues on driver unload. This can be serious
  428. trouble even for drivers for hardware integrated on the SoC due to
  429. EPROBE_DEFERRED backoff.
  430. Both these problems can be solved by switching over to drmm_kzalloc(), and the
  431. various convenience wrappers provided, e.g. drmm_crtc_alloc_with_planes(),
  432. drmm_universal_plane_alloc(), ... and so on.
  433. Contact: Simona Vetter
  434. Level: Intermediate
  435. Remove automatic page mapping from dma-buf importing
  436. ----------------------------------------------------
  437. When importing dma-bufs, the dma-buf and PRIME frameworks automatically map
  438. imported pages into the importer's DMA area. drm_gem_prime_fd_to_handle() and
  439. drm_gem_prime_handle_to_fd() require that importers call dma_buf_attach()
  440. even if they never do actual device DMA, but only CPU access through
  441. dma_buf_vmap(). This is a problem for USB devices, which do not support DMA
  442. operations.
  443. To fix the issue, automatic page mappings should be removed from the
  444. buffer-sharing code. Fixing this is a bit more involved, since the import/export
  445. cache is also tied to &drm_gem_object.import_attach. Meanwhile we paper over
  446. this problem for USB devices by fishing out the USB host controller device, as
  447. long as that supports DMA. Otherwise importing can still needlessly fail.
  448. Contact: Thomas Zimmermann <tzimmermann@suse.de>, Simona Vetter
  449. Level: Advanced
  450. Better Testing
  451. ==============
  452. Add unit tests using the Kernel Unit Testing (KUnit) framework
  453. --------------------------------------------------------------
  454. The `KUnit <https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html>`_
  455. provides a common framework for unit tests within the Linux kernel. Having a
  456. test suite would allow to identify regressions earlier.
  457. A good candidate for the first unit tests are the format-conversion helpers in
  458. ``drm_format_helper.c``.
  459. Contact: Javier Martinez Canillas <javierm@redhat.com>
  460. Level: Intermediate
  461. Clean up and document former selftests suites
  462. ---------------------------------------------
  463. Some KUnit test suites (drm_buddy, drm_cmdline_parser, drm_damage_helper,
  464. drm_format, drm_framebuffer, drm_dp_mst_helper, drm_mm, drm_plane_helper and
  465. drm_rect) are former selftests suites that have been converted over when KUnit
  466. was first introduced.
  467. These suites were fairly undocumented, and with different goals than what unit
  468. tests can be. Trying to identify what each test in these suites actually test
  469. for, whether that makes sense for a unit test, and either remove it if it
  470. doesn't or document it if it does would be of great help.
  471. Contact: Maxime Ripard <mripard@kernel.org>
  472. Level: Intermediate
  473. Enable trinity for DRM
  474. ----------------------
  475. And fix up the fallout. Should be really interesting ...
  476. Level: Advanced
  477. Make KMS tests in i-g-t generic
  478. -------------------------------
  479. The i915 driver team maintains an extensive testsuite for the i915 DRM driver,
  480. including tons of testcases for corner-cases in the modesetting API. It would
  481. be awesome if those tests (at least the ones not relying on Intel-specific GEM
  482. features) could be made to run on any KMS driver.
  483. Basic work to run i-g-t tests on non-i915 is done, what's now missing is mass-
  484. converting things over. For modeset tests we also first need a bit of
  485. infrastructure to use dumb buffers for untiled buffers, to be able to run all
  486. the non-i915 specific modeset tests.
  487. Level: Advanced
  488. Extend virtual test driver (VKMS)
  489. ---------------------------------
  490. See the documentation of :ref:`VKMS <vkms>` for more details. This is an ideal
  491. internship task, since it only requires a virtual machine and can be sized to
  492. fit the available time.
  493. Level: See details
  494. Backlight Refactoring
  495. ---------------------
  496. Backlight drivers have a triple enable/disable state, which is a bit overkill.
  497. Plan to fix this:
  498. 1. Roll out backlight_enable() and backlight_disable() helpers everywhere. This
  499. has started already.
  500. 2. In all, only look at one of the three status bits set by the above helpers.
  501. 3. Remove the other two status bits.
  502. Contact: Simona Vetter
  503. Level: Intermediate
  504. Driver Specific
  505. ===============
  506. AMD DC Display Driver
  507. ---------------------
  508. AMD DC is the display driver for AMD devices starting with Vega. There has been
  509. a bunch of progress cleaning it up but there's still plenty of work to be done.
  510. See drivers/gpu/drm/amd/display/TODO for tasks.
  511. Contact: Harry Wentland, Alex Deucher
  512. Bootsplash
  513. ==========
  514. There is support in place now for writing internal DRM clients making it
  515. possible to pick up the bootsplash work that was rejected because it was written
  516. for fbdev.
  517. - [v6,8/8] drm/client: Hack: Add bootsplash example
  518. https://patchwork.freedesktop.org/patch/306579/
  519. - [RFC PATCH v2 00/13] Kernel based bootsplash
  520. https://lore.kernel.org/r/20171213194755.3409-1-mstaudt@suse.de
  521. Contact: Sam Ravnborg
  522. Level: Advanced
  523. Brightness handling on devices with multiple internal panels
  524. ============================================================
  525. On x86/ACPI devices there can be multiple backlight firmware interfaces:
  526. (ACPI) video, vendor specific and others. As well as direct/native (PWM)
  527. register programming by the KMS driver.
  528. To deal with this backlight drivers used on x86/ACPI call
  529. acpi_video_get_backlight_type() which has heuristics (+quirks) to select
  530. which backlight interface to use; and backlight drivers which do not match
  531. the returned type will not register themselves, so that only one backlight
  532. device gets registered (in a single GPU setup, see below).
  533. At the moment this more or less assumes that there will only
  534. be 1 (internal) panel on a system.
  535. On systems with 2 panels this may be a problem, depending on
  536. what interface acpi_video_get_backlight_type() selects:
  537. 1. native: in this case the KMS driver is expected to know which backlight
  538. device belongs to which output so everything should just work.
  539. 2. video: this does support controlling multiple backlights, but some work
  540. will need to be done to get the output <-> backlight device mapping
  541. The above assumes both panels will require the same backlight interface type.
  542. Things will break on systems with multiple panels where the 2 panels need
  543. a different type of control. E.g. one panel needs ACPI video backlight control,
  544. where as the other is using native backlight control. Currently in this case
  545. only one of the 2 required backlight devices will get registered, based on
  546. the acpi_video_get_backlight_type() return value.
  547. If this (theoretical) case ever shows up, then supporting this will need some
  548. work. A possible solution here would be to pass a device and connector-name
  549. to acpi_video_get_backlight_type() so that it can deal with this.
  550. Note in a way we already have a case where userspace sees 2 panels,
  551. in dual GPU laptop setups with a mux. On those systems we may see
  552. either 2 native backlight devices; or 2 native backlight devices.
  553. Userspace already has code to deal with this by detecting if the related
  554. panel is active (iow which way the mux between the GPU and the panels
  555. points) and then uses that backlight device. Userspace here very much
  556. assumes a single panel though. It picks only 1 of the 2 backlight devices
  557. and then only uses that one.
  558. Note that all userspace code (that I know off) is currently hardcoded
  559. to assume a single panel.
  560. Before the recent changes to not register multiple (e.g. video + native)
  561. /sys/class/backlight devices for a single panel (on a single GPU laptop),
  562. userspace would see multiple backlight devices all controlling the same
  563. backlight.
  564. To deal with this userspace had to always picks one preferred device under
  565. /sys/class/backlight and will ignore the others. So to support brightness
  566. control on multiple panels userspace will need to be updated too.
  567. There are plans to allow brightness control through the KMS API by adding
  568. a "display brightness" property to drm_connector objects for panels. This
  569. solves a number of issues with the /sys/class/backlight API, including not
  570. being able to map a sysfs backlight device to a specific connector. Any
  571. userspace changes to add support for brightness control on devices with
  572. multiple panels really should build on top of this new KMS property.
  573. Contact: Hans de Goede
  574. Level: Advanced
  575. Buffer age or other damage accumulation algorithm for buffer damage
  576. ===================================================================
  577. Drivers that do per-buffer uploads, need a buffer damage handling (rather than
  578. frame damage like drivers that do per-plane or per-CRTC uploads), but there is
  579. no support to get the buffer age or any other damage accumulation algorithm.
  580. For this reason, the damage helpers just fallback to a full plane update if the
  581. framebuffer attached to a plane has changed since the last page-flip. Drivers
  582. set &drm_plane_state.ignore_damage_clips to true as indication to
  583. drm_atomic_helper_damage_iter_init() and drm_atomic_helper_damage_iter_next()
  584. helpers that the damage clips should be ignored.
  585. This should be improved to get damage tracking properly working on drivers that
  586. do per-buffer uploads.
  587. More information about damage tracking and references to learning materials can
  588. be found in :ref:`damage_tracking_properties`.
  589. Contact: Javier Martinez Canillas <javierm@redhat.com>
  590. Level: Advanced
  591. Outside DRM
  592. ===========
  593. Convert fbdev drivers to DRM
  594. ----------------------------
  595. There are plenty of fbdev drivers for older hardware. Some hardware has
  596. become obsolete, but some still provides good(-enough) framebuffers. The
  597. drivers that are still useful should be converted to DRM and afterwards
  598. removed from fbdev.
  599. Very simple fbdev drivers can best be converted by starting with a new
  600. DRM driver. Simple KMS helpers and SHMEM should be able to handle any
  601. existing hardware. The new driver's call-back functions are filled from
  602. existing fbdev code.
  603. More complex fbdev drivers can be refactored step-by-step into a DRM
  604. driver with the help of the DRM fbconv helpers [4]_. These helpers provide
  605. the transition layer between the DRM core infrastructure and the fbdev
  606. driver interface. Create a new DRM driver on top of the fbconv helpers,
  607. copy over the fbdev driver, and hook it up to the DRM code. Examples for
  608. several fbdev drivers are available in Thomas Zimmermann's fbconv tree
  609. [4]_, as well as a tutorial of this process [5]_. The result is a primitive
  610. DRM driver that can run X11 and Weston.
  611. .. [4] https://gitlab.freedesktop.org/tzimmermann/linux/tree/fbconv
  612. .. [5] https://gitlab.freedesktop.org/tzimmermann/linux/blob/fbconv/drivers/gpu/drm/drm_fbconv_helper.c
  613. Contact: Thomas Zimmermann <tzimmermann@suse.de>
  614. Level: Advanced