18c2ecf20Sopenharmony_ci============ 28c2ecf20Sopenharmony_ciIntroduction 38c2ecf20Sopenharmony_ci============ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciThe Linux DRM layer contains code intended to support the needs of 68c2ecf20Sopenharmony_cicomplex graphics devices, usually containing programmable pipelines well 78c2ecf20Sopenharmony_cisuited to 3D graphics acceleration. Graphics drivers in the kernel may 88c2ecf20Sopenharmony_cimake use of DRM functions to make tasks like memory management, 98c2ecf20Sopenharmony_ciinterrupt handling and DMA easier, and provide a uniform interface to 108c2ecf20Sopenharmony_ciapplications. 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ciA note on versions: this guide covers features found in the DRM tree, 138c2ecf20Sopenharmony_ciincluding the TTM memory manager, output configuration and mode setting, 148c2ecf20Sopenharmony_ciand the new vblank internals, in addition to all the regular features 158c2ecf20Sopenharmony_cifound in current kernels. 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci[Insert diagram of typical DRM stack here] 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciStyle Guidelines 208c2ecf20Sopenharmony_ci================ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ciFor consistency this documentation uses American English. Abbreviations 238c2ecf20Sopenharmony_ciare written as all-uppercase, for example: DRM, KMS, IOCTL, CRTC, and so 248c2ecf20Sopenharmony_cion. To aid in reading, documentations make full use of the markup 258c2ecf20Sopenharmony_cicharacters kerneldoc provides: @parameter for function parameters, 268c2ecf20Sopenharmony_ci@member for structure members (within the same structure), &struct structure to 278c2ecf20Sopenharmony_cireference structures and function() for functions. These all get automatically 288c2ecf20Sopenharmony_cihyperlinked if kerneldoc for the referenced objects exists. When referencing 298c2ecf20Sopenharmony_cientries in function vtables (and structure members in general) please use 308c2ecf20Sopenharmony_ci&vtable_name.vfunc. Unfortunately this does not yet yield a direct link to the 318c2ecf20Sopenharmony_cimember, only the structure. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciExcept in special situations (to separate locked from unlocked variants) 348c2ecf20Sopenharmony_cilocking requirements for functions aren't documented in the kerneldoc. 358c2ecf20Sopenharmony_ciInstead locking should be check at runtime using e.g. 368c2ecf20Sopenharmony_ci``WARN_ON(!mutex_is_locked(...));``. Since it's much easier to ignore 378c2ecf20Sopenharmony_cidocumentation than runtime noise this provides more value. And on top of 388c2ecf20Sopenharmony_cithat runtime checks do need to be updated when the locking rules change, 398c2ecf20Sopenharmony_ciincreasing the chances that they're correct. Within the documentation 408c2ecf20Sopenharmony_cithe locking rules should be explained in the relevant structures: Either 418c2ecf20Sopenharmony_ciin the comment for the lock explaining what it protects, or data fields 428c2ecf20Sopenharmony_cineed a note about which lock protects them, or both. 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciFunctions which have a non-\ ``void`` return value should have a section 458c2ecf20Sopenharmony_cicalled "Returns" explaining the expected return values in different 468c2ecf20Sopenharmony_cicases and their meanings. Currently there's no consensus whether that 478c2ecf20Sopenharmony_cisection name should be all upper-case or not, and whether it should end 488c2ecf20Sopenharmony_ciin a colon or not. Go with the file-local style. Other common section 498c2ecf20Sopenharmony_cinames are "Notes" with information for dangerous or tricky corner cases, 508c2ecf20Sopenharmony_ciand "FIXME" where the interface could be cleaned up. 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciAlso read the :ref:`guidelines for the kernel documentation at large <doc_guide>`. 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciDocumentation Requirements for kAPI 558c2ecf20Sopenharmony_ci----------------------------------- 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ciAll kernel APIs exported to other modules must be documented, including their 588c2ecf20Sopenharmony_cidatastructures and at least a short introductory section explaining the overall 598c2ecf20Sopenharmony_ciconcepts. Documentation should be put into the code itself as kerneldoc comments 608c2ecf20Sopenharmony_cias much as reasonable. 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ciDo not blindly document everything, but document only what's relevant for driver 638c2ecf20Sopenharmony_ciauthors: Internal functions of drm.ko and definitely static functions should not 648c2ecf20Sopenharmony_cihave formal kerneldoc comments. Use normal C comments if you feel like a comment 658c2ecf20Sopenharmony_ciis warranted. You may use kerneldoc syntax in the comment, but it shall not 668c2ecf20Sopenharmony_cistart with a /** kerneldoc marker. Similar for data structures, annotate 678c2ecf20Sopenharmony_cianything entirely private with ``/* private: */`` comments as per the 688c2ecf20Sopenharmony_cidocumentation guide. 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ciGetting Started 718c2ecf20Sopenharmony_ci=============== 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciDevelopers interested in helping out with the DRM subsystem are very welcome. 748c2ecf20Sopenharmony_ciOften people will resort to sending in patches for various issues reported by 758c2ecf20Sopenharmony_cicheckpatch or sparse. We welcome such contributions. 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ciAnyone looking to kick it up a notch can find a list of janitorial tasks on 788c2ecf20Sopenharmony_cithe :ref:`TODO list <todo>`. 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ciContribution Process 818c2ecf20Sopenharmony_ci==================== 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ciMostly the DRM subsystem works like any other kernel subsystem, see :ref:`the 848c2ecf20Sopenharmony_cimain process guidelines and documentation <process_index>` for how things work. 858c2ecf20Sopenharmony_ciHere we just document some of the specialities of the GPU subsystem. 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ciFeature Merge Deadlines 888c2ecf20Sopenharmony_ci----------------------- 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ciAll feature work must be in the linux-next tree by the -rc6 release of the 918c2ecf20Sopenharmony_cicurrent release cycle, otherwise they must be postponed and can't reach the next 928c2ecf20Sopenharmony_cimerge window. All patches must have landed in the drm-next tree by latest -rc7, 938c2ecf20Sopenharmony_cibut if your branch is not in linux-next then this must have happened by -rc6 948c2ecf20Sopenharmony_cialready. 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ciAfter that point only bugfixes (like after the upstream merge window has closed 978c2ecf20Sopenharmony_ciwith the -rc1 release) are allowed. No new platform enabling or new drivers are 988c2ecf20Sopenharmony_ciallowed. 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ciThis means that there's a blackout-period of about one month where feature work 1018c2ecf20Sopenharmony_cican't be merged. The recommended way to deal with that is having a -next tree 1028c2ecf20Sopenharmony_cithat's always open, but making sure to not feed it into linux-next during the 1038c2ecf20Sopenharmony_ciblackout period. As an example, drm-misc works like that. 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ciCode of Conduct 1068c2ecf20Sopenharmony_ci--------------- 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ciAs a freedesktop.org project, dri-devel, and the DRM community, follows the 1098c2ecf20Sopenharmony_ciContributor Covenant, found at: https://www.freedesktop.org/wiki/CodeOfConduct 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ciPlease conduct yourself in a respectful and civilised manner when 1128c2ecf20Sopenharmony_ciinteracting with community members on mailing lists, IRC, or bug 1138c2ecf20Sopenharmony_citrackers. The community represents the project as a whole, and abusive 1148c2ecf20Sopenharmony_cior bullying behaviour is not tolerated by the project. 115