18c2ecf20Sopenharmony_ci.. _todo:
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci=========
48c2ecf20Sopenharmony_ciTODO list
58c2ecf20Sopenharmony_ci=========
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciThis section contains a list of smaller janitorial tasks in the kernel DRM
88c2ecf20Sopenharmony_cigraphics subsystem useful as newbie projects. Or for slow rainy days.
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciDifficulty
118c2ecf20Sopenharmony_ci----------
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciTo make it easier task are categorized into different levels:
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciStarter: Good tasks to get started with the DRM subsystem.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciIntermediate: Tasks which need some experience with working in the DRM
188c2ecf20Sopenharmony_cisubsystem, or some specific GPU/display graphics knowledge. For debugging issue
198c2ecf20Sopenharmony_ciit's good to have the relevant hardware (or a virtual driver set up) available
208c2ecf20Sopenharmony_cifor testing.
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciAdvanced: Tricky tasks that need fairly good understanding of the DRM subsystem
238c2ecf20Sopenharmony_ciand graphics topics. Generally need the relevant hardware for development and
248c2ecf20Sopenharmony_citesting.
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciSubsystem-wide refactorings
278c2ecf20Sopenharmony_ci===========================
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciRemove custom dumb_map_offset implementations
308c2ecf20Sopenharmony_ci---------------------------------------------
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciAll GEM based drivers should be using drm_gem_create_mmap_offset() instead.
338c2ecf20Sopenharmony_ciAudit each individual driver, make sure it'll work with the generic
348c2ecf20Sopenharmony_ciimplementation (there's lots of outdated locking leftovers in various
358c2ecf20Sopenharmony_ciimplementations), and then remove it.
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciContact: Daniel Vetter, respective driver maintainers
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciLevel: Intermediate
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciConvert existing KMS drivers to atomic modesetting
428c2ecf20Sopenharmony_ci--------------------------------------------------
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci3.19 has the atomic modeset interfaces and helpers, so drivers can now be
458c2ecf20Sopenharmony_ciconverted over. Modern compositors like Wayland or Surfaceflinger on Android
468c2ecf20Sopenharmony_cireally want an atomic modeset interface, so this is all about the bright
478c2ecf20Sopenharmony_cifuture.
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciThere is a conversion guide for atomic and all you need is a GPU for a
508c2ecf20Sopenharmony_cinon-converted driver (again virtual HW drivers for KVM are still all
518c2ecf20Sopenharmony_cisuitable).
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciAs part of this drivers also need to convert to universal plane (which means
548c2ecf20Sopenharmony_ciexposing primary & cursor as proper plane objects). But that's much easier to
558c2ecf20Sopenharmony_cido by directly using the new atomic helper driver callbacks.
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciContact: Daniel Vetter, respective driver maintainers
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ciLevel: Advanced
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciClean up the clipped coordination confusion around planes
628c2ecf20Sopenharmony_ci---------------------------------------------------------
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ciWe have a helper to get this right with drm_plane_helper_check_update(), but
658c2ecf20Sopenharmony_ciit's not consistently used. This should be fixed, preferrably in the atomic
668c2ecf20Sopenharmony_cihelpers (and drivers then moved over to clipped coordinates). Probably the
678c2ecf20Sopenharmony_cihelper should also be moved from drm_plane_helper.c to the atomic helpers, to
688c2ecf20Sopenharmony_ciavoid confusion - the other helpers in that file are all deprecated legacy
698c2ecf20Sopenharmony_cihelpers.
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ciContact: Ville Syrjälä, Daniel Vetter, driver maintainers
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ciLevel: Advanced
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ciImprove plane atomic_check helpers
768c2ecf20Sopenharmony_ci----------------------------------
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ciAside from the clipped coordinates right above there's a few suboptimal things
798c2ecf20Sopenharmony_ciwith the current helpers:
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci- drm_plane_helper_funcs->atomic_check gets called for enabled or disabled
828c2ecf20Sopenharmony_ci  planes. At best this seems to confuse drivers, worst it means they blow up
838c2ecf20Sopenharmony_ci  when the plane is disabled without the CRTC. The only special handling is
848c2ecf20Sopenharmony_ci  resetting values in the plane state structures, which instead should be moved
858c2ecf20Sopenharmony_ci  into the drm_plane_funcs->atomic_duplicate_state functions.
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci- Once that's done, helpers could stop calling ->atomic_check for disabled
888c2ecf20Sopenharmony_ci  planes.
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci- Then we could go through all the drivers and remove the more-or-less confused
918c2ecf20Sopenharmony_ci  checks for plane_state->fb and plane_state->crtc.
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ciContact: Daniel Vetter
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ciLevel: Advanced
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ciConvert early atomic drivers to async commit helpers
988c2ecf20Sopenharmony_ci----------------------------------------------------
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ciFor the first year the atomic modeset helpers didn't support asynchronous /
1018c2ecf20Sopenharmony_cinonblocking commits, and every driver had to hand-roll them. This is fixed
1028c2ecf20Sopenharmony_cinow, but there's still a pile of existing drivers that easily could be
1038c2ecf20Sopenharmony_ciconverted over to the new infrastructure.
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ciOne issue with the helpers is that they require that drivers handle completion
1068c2ecf20Sopenharmony_cievents for atomic commits correctly. But fixing these bugs is good anyway.
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ciContact: Daniel Vetter, respective driver maintainers
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ciLevel: Advanced
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ciFallout from atomic KMS
1138c2ecf20Sopenharmony_ci-----------------------
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci``drm_atomic_helper.c`` provides a batch of functions which implement legacy
1168c2ecf20Sopenharmony_ciIOCTLs on top of the new atomic driver interface. Which is really nice for
1178c2ecf20Sopenharmony_cigradual conversion of drivers, but unfortunately the semantic mismatches are
1188c2ecf20Sopenharmony_cia bit too severe. So there's some follow-up work to adjust the function
1198c2ecf20Sopenharmony_ciinterfaces to fix these issues:
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci* atomic needs the lock acquire context. At the moment that's passed around
1228c2ecf20Sopenharmony_ci  implicitly with some horrible hacks, and it's also allocate with
1238c2ecf20Sopenharmony_ci  ``GFP_NOFAIL`` behind the scenes. All legacy paths need to start allocating
1248c2ecf20Sopenharmony_ci  the acquire context explicitly on stack and then also pass it down into
1258c2ecf20Sopenharmony_ci  drivers explicitly so that the legacy-on-atomic functions can use them.
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci  Except for some driver code this is done. This task should be finished by
1288c2ecf20Sopenharmony_ci  adding WARN_ON(!drm_drv_uses_atomic_modeset) in drm_modeset_lock_all().
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci* A bunch of the vtable hooks are now in the wrong place: DRM has a split
1318c2ecf20Sopenharmony_ci  between core vfunc tables (named ``drm_foo_funcs``), which are used to
1328c2ecf20Sopenharmony_ci  implement the userspace ABI. And then there's the optional hooks for the
1338c2ecf20Sopenharmony_ci  helper libraries (name ``drm_foo_helper_funcs``), which are purely for
1348c2ecf20Sopenharmony_ci  internal use. Some of these hooks should be move from ``_funcs`` to
1358c2ecf20Sopenharmony_ci  ``_helper_funcs`` since they are not part of the core ABI. There's a
1368c2ecf20Sopenharmony_ci  ``FIXME`` comment in the kerneldoc for each such case in ``drm_crtc.h``.
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ciContact: Daniel Vetter
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ciLevel: Intermediate
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ciGet rid of dev->struct_mutex from GEM drivers
1438c2ecf20Sopenharmony_ci---------------------------------------------
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci``dev->struct_mutex`` is the Big DRM Lock from legacy days and infested
1468c2ecf20Sopenharmony_cieverything. Nowadays in modern drivers the only bit where it's mandatory is
1478c2ecf20Sopenharmony_ciserializing GEM buffer object destruction. Which unfortunately means drivers
1488c2ecf20Sopenharmony_cihave to keep track of that lock and either call ``unreference`` or
1498c2ecf20Sopenharmony_ci``unreference_locked`` depending upon context.
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ciCore GEM doesn't have a need for ``struct_mutex`` any more since kernel 4.8,
1528c2ecf20Sopenharmony_ciand there's a ``gem_free_object_unlocked`` callback for any drivers which are
1538c2ecf20Sopenharmony_cientirely ``struct_mutex`` free.
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ciFor drivers that need ``struct_mutex`` it should be replaced with a driver-
1568c2ecf20Sopenharmony_ciprivate lock. The tricky part is the BO free functions, since those can't
1578c2ecf20Sopenharmony_cireliably take that lock any more. Instead state needs to be protected with
1588c2ecf20Sopenharmony_cisuitable subordinate locks or some cleanup work pushed to a worker thread. For
1598c2ecf20Sopenharmony_ciperformance-critical drivers it might also be better to go with a more
1608c2ecf20Sopenharmony_cifine-grained per-buffer object and per-context lockings scheme. Currently only
1618c2ecf20Sopenharmony_cithe ``msm`` and `i915` drivers use ``struct_mutex``.
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ciContact: Daniel Vetter, respective driver maintainers
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ciLevel: Advanced
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ciConvert logging to drm_* functions with drm_device paramater
1688c2ecf20Sopenharmony_ci------------------------------------------------------------
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ciFor drivers which could have multiple instances, it is necessary to
1718c2ecf20Sopenharmony_cidifferentiate between which is which in the logs. Since DRM_INFO/WARN/ERROR
1728c2ecf20Sopenharmony_cidon't do this, drivers used dev_info/warn/err to make this differentiation. We
1738c2ecf20Sopenharmony_cinow have drm_* variants of the drm print functions, so we can start to convert
1748c2ecf20Sopenharmony_cithose drivers back to using drm-formatted specific log messages.
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ciBefore you start this conversion please contact the relevant maintainers to make
1778c2ecf20Sopenharmony_cisure your work will be merged - not everyone agrees that the DRM dmesg macros
1788c2ecf20Sopenharmony_ciare better.
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ciContact: Sean Paul, Maintainer of the driver you plan to convert
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ciLevel: Starter
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ciConvert drivers to use simple modeset suspend/resume
1858c2ecf20Sopenharmony_ci----------------------------------------------------
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ciMost drivers (except i915 and nouveau) that use
1888c2ecf20Sopenharmony_cidrm_atomic_helper_suspend/resume() can probably be converted to use
1898c2ecf20Sopenharmony_cidrm_mode_config_helper_suspend/resume(). Also there's still open-coded version
1908c2ecf20Sopenharmony_ciof the atomic suspend/resume code in older atomic modeset drivers.
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ciContact: Maintainer of the driver you plan to convert
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ciLevel: Intermediate
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ciConvert drivers to use drm_fbdev_generic_setup()
1978c2ecf20Sopenharmony_ci------------------------------------------------
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ciMost drivers can use drm_fbdev_generic_setup(). Driver have to implement
2008c2ecf20Sopenharmony_ciatomic modesetting and GEM vmap support. Current generic fbdev emulation
2018c2ecf20Sopenharmony_ciexpects the framebuffer in system memory (or system-like memory).
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ciContact: Maintainer of the driver you plan to convert
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ciLevel: Intermediate
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_cidrm_framebuffer_funcs and drm_mode_config_funcs.fb_create cleanup
2088c2ecf20Sopenharmony_ci-----------------------------------------------------------------
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ciA lot more drivers could be switched over to the drm_gem_framebuffer helpers.
2118c2ecf20Sopenharmony_ciVarious hold-ups:
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci- Need to switch over to the generic dirty tracking code using
2148c2ecf20Sopenharmony_ci  drm_atomic_helper_dirtyfb first (e.g. qxl).
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci- Need to switch to drm_fbdev_generic_setup(), otherwise a lot of the custom fb
2178c2ecf20Sopenharmony_ci  setup code can't be deleted.
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci- Many drivers wrap drm_gem_fb_create() only to check for valid formats. For
2208c2ecf20Sopenharmony_ci  atomic drivers we could check for valid formats by calling
2218c2ecf20Sopenharmony_ci  drm_plane_check_pixel_format() against all planes, and pass if any plane
2228c2ecf20Sopenharmony_ci  supports the format. For non-atomic that's not possible since like the format
2238c2ecf20Sopenharmony_ci  list for the primary plane is fake and we'd therefor reject valid formats.
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci- Many drivers subclass drm_framebuffer, we'd need a embedding compatible
2268c2ecf20Sopenharmony_ci  version of the varios drm_gem_fb_create functions. Maybe called
2278c2ecf20Sopenharmony_ci  drm_gem_fb_create/_with_dirty/_with_funcs as needed.
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ciContact: Daniel Vetter
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ciLevel: Intermediate
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ciClean up mmap forwarding
2348c2ecf20Sopenharmony_ci------------------------
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ciA lot of drivers forward gem mmap calls to dma-buf mmap for imported buffers.
2378c2ecf20Sopenharmony_ciAnd also a lot of them forward dma-buf mmap to the gem mmap implementations.
2388c2ecf20Sopenharmony_ciThere's drm_gem_prime_mmap() for this now, but still needs to be rolled out.
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ciContact: Daniel Vetter
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ciLevel: Intermediate
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ciGeneric fbdev defio support
2458c2ecf20Sopenharmony_ci---------------------------
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ciThe defio support code in the fbdev core has some very specific requirements,
2488c2ecf20Sopenharmony_ciwhich means drivers need to have a special framebuffer for fbdev. The main
2498c2ecf20Sopenharmony_ciissue is that it uses some fields in struct page itself, which breaks shmem
2508c2ecf20Sopenharmony_cigem objects (and other things). To support defio, affected drivers require
2518c2ecf20Sopenharmony_cithe use of a shadow buffer, which may add CPU and memory overhead.
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ciPossible solution would be to write our own defio mmap code in the drm fbdev
2548c2ecf20Sopenharmony_ciemulation. It would need to fully wrap the existing mmap ops, forwarding
2558c2ecf20Sopenharmony_cieverything after it has done the write-protect/mkwrite trickery:
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci- In the drm_fbdev_fb_mmap helper, if we need defio, change the
2588c2ecf20Sopenharmony_ci  default page prots to write-protected with something like this::
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci      vma->vm_page_prot = pgprot_wrprotect(vma->vm_page_prot);
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci- Set the mkwrite and fsync callbacks with similar implementions to the core
2638c2ecf20Sopenharmony_ci  fbdev defio stuff. These should all work on plain ptes, they don't actually
2648c2ecf20Sopenharmony_ci  require a struct page.  uff. These should all work on plain ptes, they don't
2658c2ecf20Sopenharmony_ci  actually require a struct page.
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci- Track the dirty pages in a separate structure (bitfield with one bit per page
2688c2ecf20Sopenharmony_ci  should work) to avoid clobbering struct page.
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ciMight be good to also have some igt testcases for this.
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ciContact: Daniel Vetter, Noralf Tronnes
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ciLevel: Advanced
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ciidr_init_base()
2778c2ecf20Sopenharmony_ci---------------
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ciDRM core&drivers uses a lot of idr (integer lookup directories) for mapping
2808c2ecf20Sopenharmony_ciuserspace IDs to internal objects, and in most places ID=0 means NULL and hence
2818c2ecf20Sopenharmony_ciis never used. Switching to idr_init_base() for these would make the idr more
2828c2ecf20Sopenharmony_ciefficient.
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ciContact: Daniel Vetter
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ciLevel: Starter
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_cistruct drm_gem_object_funcs
2898c2ecf20Sopenharmony_ci---------------------------
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ciGEM objects can now have a function table instead of having the callbacks on the
2928c2ecf20Sopenharmony_ciDRM driver struct. This is now the preferred way and drivers can be moved over.
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ciWe also need a 2nd version of the CMA define that doesn't require the
2958c2ecf20Sopenharmony_civmapping to be present (different hook for prime importing). Plus this needs to
2968c2ecf20Sopenharmony_cibe rolled out to all drivers using their own implementations, too.
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ciLevel: Intermediate
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ciUse DRM_MODESET_LOCK_ALL_* helpers instead of boilerplate
3018c2ecf20Sopenharmony_ci---------------------------------------------------------
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ciFor cases where drivers are attempting to grab the modeset locks with a local
3048c2ecf20Sopenharmony_ciacquire context. Replace the boilerplate code surrounding
3058c2ecf20Sopenharmony_cidrm_modeset_lock_all_ctx() with DRM_MODESET_LOCK_ALL_BEGIN() and
3068c2ecf20Sopenharmony_ciDRM_MODESET_LOCK_ALL_END() instead.
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ciThis should also be done for all places where drm_modeset_lock_all() is still
3098c2ecf20Sopenharmony_ciused.
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ciAs a reference, take a look at the conversions already completed in drm core.
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ciContact: Sean Paul, respective driver maintainers
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ciLevel: Starter
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ciRename CMA helpers to DMA helpers
3188c2ecf20Sopenharmony_ci---------------------------------
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ciCMA (standing for contiguous memory allocator) is really a bit an accident of
3218c2ecf20Sopenharmony_ciwhat these were used for first, a much better name would be DMA helpers. In the
3228c2ecf20Sopenharmony_citext these should even be called coherent DMA memory helpers (so maybe CDM, but
3238c2ecf20Sopenharmony_cino one knows what that means) since underneath they just use dma_alloc_coherent.
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ciContact: Laurent Pinchart, Daniel Vetter
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ciLevel: Intermediate (mostly because it is a huge tasks without good partial
3288c2ecf20Sopenharmony_cimilestones, not technically itself that challenging)
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ciconnector register/unregister fixes
3318c2ecf20Sopenharmony_ci-----------------------------------
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci- For most connectors it's a no-op to call drm_connector_register/unregister
3348c2ecf20Sopenharmony_ci  directly from driver code, drm_dev_register/unregister take care of this
3358c2ecf20Sopenharmony_ci  already. We can remove all of them.
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci- For dp drivers it's a bit more a mess, since we need the connector to be
3388c2ecf20Sopenharmony_ci  registered when calling drm_dp_aux_register. Fix this by instead calling
3398c2ecf20Sopenharmony_ci  drm_dp_aux_init, and moving the actual registering into a late_register
3408c2ecf20Sopenharmony_ci  callback as recommended in the kerneldoc.
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ciLevel: Intermediate
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ciRemove load/unload callbacks from all non-DRIVER_LEGACY drivers
3458c2ecf20Sopenharmony_ci---------------------------------------------------------------
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ciThe load/unload callbacks in struct &drm_driver are very much midlayers, plus
3488c2ecf20Sopenharmony_cifor historical reasons they get the ordering wrong (and we can't fix that)
3498c2ecf20Sopenharmony_cibetween setting up the &drm_driver structure and calling drm_dev_register().
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci- Rework drivers to no longer use the load/unload callbacks, directly coding the
3528c2ecf20Sopenharmony_ci  load/unload sequence into the driver's probe function.
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci- Once all non-DRIVER_LEGACY drivers are converted, disallow the load/unload
3558c2ecf20Sopenharmony_ci  callbacks for all modern drivers.
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ciContact: Daniel Vetter
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ciLevel: Intermediate
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ciReplace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi
3628c2ecf20Sopenharmony_ci---------------------------------------------------------------
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ciOnce EDID is parsed, the monitor HDMI support information is available through
3658c2ecf20Sopenharmony_cidrm_display_info.is_hdmi. Many drivers still call drm_detect_hdmi_monitor() to
3668c2ecf20Sopenharmony_ciretrieve the same information, which is less efficient.
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ciAudit each individual driver calling drm_detect_hdmi_monitor() and switch to
3698c2ecf20Sopenharmony_cidrm_display_info.is_hdmi if applicable.
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ciContact: Laurent Pinchart, respective driver maintainers
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ciLevel: Intermediate
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ciConsolidate custom driver modeset properties
3768c2ecf20Sopenharmony_ci--------------------------------------------
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_ciBefore atomic modeset took place, many drivers where creating their own
3798c2ecf20Sopenharmony_ciproperties. Among other things, atomic brought the requirement that custom,
3808c2ecf20Sopenharmony_cidriver specific properties should not be used.
3818c2ecf20Sopenharmony_ci
3828c2ecf20Sopenharmony_ciFor this task, we aim to introduce core helpers or reuse the existing ones
3838c2ecf20Sopenharmony_ciif available:
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ciA quick, unconfirmed, examples list.
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ciIntroduce core helpers:
3888c2ecf20Sopenharmony_ci- audio (amdgpu, intel, gma500, radeon)
3898c2ecf20Sopenharmony_ci- brightness, contrast, etc (armada, nouveau) - overlay only (?)
3908c2ecf20Sopenharmony_ci- broadcast rgb (gma500, intel)
3918c2ecf20Sopenharmony_ci- colorkey (armada, nouveau, rcar) - overlay only (?)
3928c2ecf20Sopenharmony_ci- dither (amdgpu, nouveau, radeon) - varies across drivers
3938c2ecf20Sopenharmony_ci- underscan family (amdgpu, radeon, nouveau)
3948c2ecf20Sopenharmony_ci
3958c2ecf20Sopenharmony_ciAlready in core:
3968c2ecf20Sopenharmony_ci- colorspace (sti)
3978c2ecf20Sopenharmony_ci- tv format names, enhancements (gma500, intel)
3988c2ecf20Sopenharmony_ci- tv overscan, margins, etc. (gma500, intel)
3998c2ecf20Sopenharmony_ci- zorder (omapdrm) - same as zpos (?)
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ciContact: Emil Velikov, respective driver maintainers
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ciLevel: Intermediate
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ciPlumb drm_atomic_state all over
4078c2ecf20Sopenharmony_ci-------------------------------
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ciCurrently various atomic functions take just a single or a handful of
4108c2ecf20Sopenharmony_ciobject states (eg. plane state). While that single object state can
4118c2ecf20Sopenharmony_cisuffice for some simple cases, we often have to dig out additional
4128c2ecf20Sopenharmony_ciobject states for dealing with various dependencies between the individual
4138c2ecf20Sopenharmony_ciobjects or the hardware they represent. The process of digging out the
4148c2ecf20Sopenharmony_ciadditional states is rather non-intuitive and error prone.
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ciTo fix that most functions should rather take the overall
4178c2ecf20Sopenharmony_cidrm_atomic_state as one of their parameters. The other parameters
4188c2ecf20Sopenharmony_ciwould generally be the object(s) we mainly want to interact with.
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ciFor example, instead of
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ci.. code-block:: c
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci   int (*atomic_check)(struct drm_plane *plane, struct drm_plane_state *state);
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_ciwe would have something like
4278c2ecf20Sopenharmony_ci
4288c2ecf20Sopenharmony_ci.. code-block:: c
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci   int (*atomic_check)(struct drm_plane *plane, struct drm_atomic_state *state);
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_ciThe implementation can then trivially gain access to any required object
4338c2ecf20Sopenharmony_cistate(s) via drm_atomic_get_plane_state(), drm_atomic_get_new_plane_state(),
4348c2ecf20Sopenharmony_cidrm_atomic_get_old_plane_state(), and their equivalents for
4358c2ecf20Sopenharmony_ciother object types.
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ciAdditionally many drivers currently access the object->state pointer
4388c2ecf20Sopenharmony_cidirectly in their commit functions. That is not going to work if we
4398c2ecf20Sopenharmony_cieg. want to allow deeper commit pipelines as those pointers could
4408c2ecf20Sopenharmony_cithen point to the states corresponding to a future commit instead of
4418c2ecf20Sopenharmony_cithe current commit we're trying to process. Also non-blocking commits
4428c2ecf20Sopenharmony_ciexecute locklessly so there are serious concerns with dereferencing
4438c2ecf20Sopenharmony_cithe object->state pointers without holding the locks that protect them.
4448c2ecf20Sopenharmony_ciUse of drm_atomic_get_new_plane_state(), drm_atomic_get_old_plane_state(),
4458c2ecf20Sopenharmony_cietc. avoids these problems as well since they relate to a specific
4468c2ecf20Sopenharmony_cicommit via the passed in drm_atomic_state.
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ciContact: Ville Syrjälä, Daniel Vetter
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ciLevel: Intermediate
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ciCore refactorings
4548c2ecf20Sopenharmony_ci=================
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ciMake panic handling work
4578c2ecf20Sopenharmony_ci------------------------
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ciThis is a really varied tasks with lots of little bits and pieces:
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_ci* The panic path can't be tested currently, leading to constant breaking. The
4628c2ecf20Sopenharmony_ci  main issue here is that panics can be triggered from hardirq contexts and
4638c2ecf20Sopenharmony_ci  hence all panic related callback can run in hardirq context. It would be
4648c2ecf20Sopenharmony_ci  awesome if we could test at least the fbdev helper code and driver code by
4658c2ecf20Sopenharmony_ci  e.g. trigger calls through drm debugfs files. hardirq context could be
4668c2ecf20Sopenharmony_ci  achieved by using an IPI to the local processor.
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ci* There's a massive confusion of different panic handlers. DRM fbdev emulation
4698c2ecf20Sopenharmony_ci  helpers have one, but on top of that the fbcon code itself also has one. We
4708c2ecf20Sopenharmony_ci  need to make sure that they stop fighting over each another.
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci* ``drm_can_sleep()`` is a mess. It hides real bugs in normal operations and
4738c2ecf20Sopenharmony_ci  isn't a full solution for panic paths. We need to make sure that it only
4748c2ecf20Sopenharmony_ci  returns true if there's a panic going on for real, and fix up all the
4758c2ecf20Sopenharmony_ci  fallout.
4768c2ecf20Sopenharmony_ci
4778c2ecf20Sopenharmony_ci* The panic handler must never sleep, which also means it can't ever
4788c2ecf20Sopenharmony_ci  ``mutex_lock()``. Also it can't grab any other lock unconditionally, not
4798c2ecf20Sopenharmony_ci  even spinlocks (because NMI and hardirq can panic too). We need to either
4808c2ecf20Sopenharmony_ci  make sure to not call such paths, or trylock everything. Really tricky.
4818c2ecf20Sopenharmony_ci
4828c2ecf20Sopenharmony_ci* For the above locking troubles reasons it's pretty much impossible to
4838c2ecf20Sopenharmony_ci  attempt a synchronous modeset from panic handlers. The only thing we could
4848c2ecf20Sopenharmony_ci  try to achive is an atomic ``set_base`` of the primary plane, and hope that
4858c2ecf20Sopenharmony_ci  it shows up. Everything else probably needs to be delayed to some worker or
4868c2ecf20Sopenharmony_ci  something else which happens later on. Otherwise it just kills the box
4878c2ecf20Sopenharmony_ci  harder, prevent the panic from going out on e.g. netconsole.
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci* There's also proposal for a simplied DRM console instead of the full-blown
4908c2ecf20Sopenharmony_ci  fbcon and DRM fbdev emulation. Any kind of panic handling tricks should
4918c2ecf20Sopenharmony_ci  obviously work for both console, in case we ever get kmslog merged.
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ciContact: Daniel Vetter
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_ciLevel: Advanced
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ciClean up the debugfs support
4988c2ecf20Sopenharmony_ci----------------------------
4998c2ecf20Sopenharmony_ci
5008c2ecf20Sopenharmony_ciThere's a bunch of issues with it:
5018c2ecf20Sopenharmony_ci
5028c2ecf20Sopenharmony_ci- The drm_info_list ->show() function doesn't even bother to cast to the drm
5038c2ecf20Sopenharmony_ci  structure for you. This is lazy.
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_ci- We probably want to have some support for debugfs files on crtc/connectors and
5068c2ecf20Sopenharmony_ci  maybe other kms objects directly in core. There's even drm_print support in
5078c2ecf20Sopenharmony_ci  the funcs for these objects to dump kms state, so it's all there. And then the
5088c2ecf20Sopenharmony_ci  ->show() functions should obviously give you a pointer to the right object.
5098c2ecf20Sopenharmony_ci
5108c2ecf20Sopenharmony_ci- The drm_info_list stuff is centered on drm_minor instead of drm_device. For
5118c2ecf20Sopenharmony_ci  anything we want to print drm_device (or maybe drm_file) is the right thing.
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci- The drm_driver->debugfs_init hooks we have is just an artifact of the old
5148c2ecf20Sopenharmony_ci  midlayered load sequence. DRM debugfs should work more like sysfs, where you
5158c2ecf20Sopenharmony_ci  can create properties/files for an object anytime you want, and the core
5168c2ecf20Sopenharmony_ci  takes care of publishing/unpuplishing all the files at register/unregister
5178c2ecf20Sopenharmony_ci  time. Drivers shouldn't need to worry about these technicalities, and fixing
5188c2ecf20Sopenharmony_ci  this (together with the drm_minor->drm_device move) would allow us to remove
5198c2ecf20Sopenharmony_ci  debugfs_init.
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci- Drop the return code and error checking from all debugfs functions. Greg KH is
5228c2ecf20Sopenharmony_ci  working on this already.
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_ciContact: Daniel Vetter
5258c2ecf20Sopenharmony_ci
5268c2ecf20Sopenharmony_ciLevel: Intermediate
5278c2ecf20Sopenharmony_ci
5288c2ecf20Sopenharmony_ciKMS cleanups
5298c2ecf20Sopenharmony_ci------------
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ciSome of these date from the very introduction of KMS in 2008 ...
5328c2ecf20Sopenharmony_ci
5338c2ecf20Sopenharmony_ci- Make ->funcs and ->helper_private vtables optional. There's a bunch of empty
5348c2ecf20Sopenharmony_ci  function tables in drivers, but before we can remove them we need to make sure
5358c2ecf20Sopenharmony_ci  that all the users in helpers and drivers do correctly check for a NULL
5368c2ecf20Sopenharmony_ci  vtable.
5378c2ecf20Sopenharmony_ci
5388c2ecf20Sopenharmony_ci- Cleanup up the various ->destroy callbacks. A lot of them just wrapt the
5398c2ecf20Sopenharmony_ci  drm_*_cleanup implementations and can be removed. Some tack a kfree() at the
5408c2ecf20Sopenharmony_ci  end, for which we could add drm_*_cleanup_kfree(). And then there's the (for
5418c2ecf20Sopenharmony_ci  historical reasons) misnamed drm_primary_helper_destroy() function.
5428c2ecf20Sopenharmony_ci
5438c2ecf20Sopenharmony_ciLevel: Intermediate
5448c2ecf20Sopenharmony_ci
5458c2ecf20Sopenharmony_ciRemove automatic page mapping from dma-buf importing
5468c2ecf20Sopenharmony_ci----------------------------------------------------
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ciWhen importing dma-bufs, the dma-buf and PRIME frameworks automatically map
5498c2ecf20Sopenharmony_ciimported pages into the importer's DMA area. drm_gem_prime_fd_to_handle() and
5508c2ecf20Sopenharmony_cidrm_gem_prime_handle_to_fd() require that importers call dma_buf_attach()
5518c2ecf20Sopenharmony_cieven if they never do actual device DMA, but only CPU access through
5528c2ecf20Sopenharmony_cidma_buf_vmap(). This is a problem for USB devices, which do not support DMA
5538c2ecf20Sopenharmony_cioperations.
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_ciTo fix the issue, automatic page mappings should be removed from the
5568c2ecf20Sopenharmony_cibuffer-sharing code. Fixing this is a bit more involved, since the import/export
5578c2ecf20Sopenharmony_cicache is also tied to &drm_gem_object.import_attach. Meanwhile we paper over
5588c2ecf20Sopenharmony_cithis problem for USB devices by fishing out the USB host controller device, as
5598c2ecf20Sopenharmony_cilong as that supports DMA. Otherwise importing can still needlessly fail.
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ciContact: Thomas Zimmermann <tzimmermann@suse.de>, Daniel Vetter
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ciLevel: Advanced
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ciBetter Testing
5678c2ecf20Sopenharmony_ci==============
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_ciEnable trinity for DRM
5708c2ecf20Sopenharmony_ci----------------------
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ciAnd fix up the fallout. Should be really interesting ...
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_ciLevel: Advanced
5758c2ecf20Sopenharmony_ci
5768c2ecf20Sopenharmony_ciMake KMS tests in i-g-t generic
5778c2ecf20Sopenharmony_ci-------------------------------
5788c2ecf20Sopenharmony_ci
5798c2ecf20Sopenharmony_ciThe i915 driver team maintains an extensive testsuite for the i915 DRM driver,
5808c2ecf20Sopenharmony_ciincluding tons of testcases for corner-cases in the modesetting API. It would
5818c2ecf20Sopenharmony_cibe awesome if those tests (at least the ones not relying on Intel-specific GEM
5828c2ecf20Sopenharmony_cifeatures) could be made to run on any KMS driver.
5838c2ecf20Sopenharmony_ci
5848c2ecf20Sopenharmony_ciBasic work to run i-g-t tests on non-i915 is done, what's now missing is mass-
5858c2ecf20Sopenharmony_ciconverting things over. For modeset tests we also first need a bit of
5868c2ecf20Sopenharmony_ciinfrastructure to use dumb buffers for untiled buffers, to be able to run all
5878c2ecf20Sopenharmony_cithe non-i915 specific modeset tests.
5888c2ecf20Sopenharmony_ci
5898c2ecf20Sopenharmony_ciLevel: Advanced
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ciExtend virtual test driver (VKMS)
5928c2ecf20Sopenharmony_ci---------------------------------
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ciSee the documentation of :ref:`VKMS <vkms>` for more details. This is an ideal
5958c2ecf20Sopenharmony_ciinternship task, since it only requires a virtual machine and can be sized to
5968c2ecf20Sopenharmony_cifit the available time.
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_ciContact: Daniel Vetter
5998c2ecf20Sopenharmony_ci
6008c2ecf20Sopenharmony_ciLevel: See details
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ciBacklight Refactoring
6038c2ecf20Sopenharmony_ci---------------------
6048c2ecf20Sopenharmony_ci
6058c2ecf20Sopenharmony_ciBacklight drivers have a triple enable/disable state, which is a bit overkill.
6068c2ecf20Sopenharmony_ciPlan to fix this:
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci1. Roll out backlight_enable() and backlight_disable() helpers everywhere. This
6098c2ecf20Sopenharmony_ci   has started already.
6108c2ecf20Sopenharmony_ci2. In all, only look at one of the three status bits set by the above helpers.
6118c2ecf20Sopenharmony_ci3. Remove the other two status bits.
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_ciContact: Daniel Vetter
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ciLevel: Intermediate
6168c2ecf20Sopenharmony_ci
6178c2ecf20Sopenharmony_ciDriver Specific
6188c2ecf20Sopenharmony_ci===============
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ciAMD DC Display Driver
6218c2ecf20Sopenharmony_ci---------------------
6228c2ecf20Sopenharmony_ci
6238c2ecf20Sopenharmony_ciAMD DC is the display driver for AMD devices starting with Vega. There has been
6248c2ecf20Sopenharmony_cia bunch of progress cleaning it up but there's still plenty of work to be done.
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ciSee drivers/gpu/drm/amd/display/TODO for tasks.
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_ciContact: Harry Wentland, Alex Deucher
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_ciBootsplash
6318c2ecf20Sopenharmony_ci==========
6328c2ecf20Sopenharmony_ci
6338c2ecf20Sopenharmony_ciThere is support in place now for writing internal DRM clients making it
6348c2ecf20Sopenharmony_cipossible to pick up the bootsplash work that was rejected because it was written
6358c2ecf20Sopenharmony_cifor fbdev.
6368c2ecf20Sopenharmony_ci
6378c2ecf20Sopenharmony_ci- [v6,8/8] drm/client: Hack: Add bootsplash example
6388c2ecf20Sopenharmony_ci  https://patchwork.freedesktop.org/patch/306579/
6398c2ecf20Sopenharmony_ci
6408c2ecf20Sopenharmony_ci- [RFC PATCH v2 00/13] Kernel based bootsplash
6418c2ecf20Sopenharmony_ci  https://lkml.org/lkml/2017/12/13/764
6428c2ecf20Sopenharmony_ci
6438c2ecf20Sopenharmony_ciContact: Sam Ravnborg
6448c2ecf20Sopenharmony_ci
6458c2ecf20Sopenharmony_ciLevel: Advanced
6468c2ecf20Sopenharmony_ci
6478c2ecf20Sopenharmony_ciOutside DRM
6488c2ecf20Sopenharmony_ci===========
6498c2ecf20Sopenharmony_ci
6508c2ecf20Sopenharmony_ciConvert fbdev drivers to DRM
6518c2ecf20Sopenharmony_ci----------------------------
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ciThere are plenty of fbdev drivers for older hardware. Some hwardware has
6548c2ecf20Sopenharmony_cibecome obsolete, but some still provides good(-enough) framebuffers. The
6558c2ecf20Sopenharmony_cidrivers that are still useful should be converted to DRM and afterwards
6568c2ecf20Sopenharmony_ciremoved from fbdev.
6578c2ecf20Sopenharmony_ci
6588c2ecf20Sopenharmony_ciVery simple fbdev drivers can best be converted by starting with a new
6598c2ecf20Sopenharmony_ciDRM driver. Simple KMS helpers and SHMEM should be able to handle any
6608c2ecf20Sopenharmony_ciexisting hardware. The new driver's call-back functions are filled from
6618c2ecf20Sopenharmony_ciexisting fbdev code.
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_ciMore complex fbdev drivers can be refactored step-by-step into a DRM
6648c2ecf20Sopenharmony_cidriver with the help of the DRM fbconv helpers. [1] These helpers provide
6658c2ecf20Sopenharmony_cithe transition layer between the DRM core infrastructure and the fbdev
6668c2ecf20Sopenharmony_cidriver interface. Create a new DRM driver on top of the fbconv helpers,
6678c2ecf20Sopenharmony_cicopy over the fbdev driver, and hook it up to the DRM code. Examples for
6688c2ecf20Sopenharmony_ciseveral fbdev drivers are available at [1] and a tutorial of this process
6698c2ecf20Sopenharmony_ciavailable at [2]. The result is a primitive DRM driver that can run X11
6708c2ecf20Sopenharmony_ciand Weston.
6718c2ecf20Sopenharmony_ci
6728c2ecf20Sopenharmony_ci - [1] https://gitlab.freedesktop.org/tzimmermann/linux/tree/fbconv
6738c2ecf20Sopenharmony_ci - [2] https://gitlab.freedesktop.org/tzimmermann/linux/blob/fbconv/drivers/gpu/drm/drm_fbconv_helper.c
6748c2ecf20Sopenharmony_ci
6758c2ecf20Sopenharmony_ciContact: Thomas Zimmermann <tzimmermann@suse.de>
6768c2ecf20Sopenharmony_ci
6778c2ecf20Sopenharmony_ciLevel: Advanced
678