xref: /openbmc/linux/drivers/gpu/drm/msm/NOTES (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
1c8afe684SRob ClarkNOTES about msm drm/kms driver:
2c8afe684SRob Clark
3c8afe684SRob ClarkIn the current snapdragon SoC's, we have (at least) 3 different
4c8afe684SRob Clarkdisplay controller blocks at play:
5c8afe684SRob Clark + MDP3 - ?? seems to be what is on geeksphone peak device
6c8afe684SRob Clark + MDP4 - S3 (APQ8060, touchpad), S4-pro (APQ8064, nexus4 & ifc6410)
7*06c0dd96SRob Clark + MDP5 - snapdragon 800
8c8afe684SRob Clark
9c8afe684SRob Clark(I don't have a completely clear picture on which display controller
10c8afe684SRob Clarkmaps to which part #)
11c8afe684SRob Clark
12c8afe684SRob ClarkPlus a handful of blocks around them for HDMI/DSI/etc output.
13c8afe684SRob Clark
14c8afe684SRob ClarkAnd on gpu side of things:
15c8afe684SRob Clark + zero, one, or two 2d cores (z180)
16c8afe684SRob Clark + and either a2xx or a3xx 3d core.
17c8afe684SRob Clark
18c8afe684SRob ClarkBut, HDMI/DSI/etc blocks seem like they can be shared across multiple
19c8afe684SRob Clarkdisplay controller blocks.  And I for sure don't want to have to deal
20c8afe684SRob Clarkwith N different kms devices from xf86-video-freedreno.  Plus, it
21c8afe684SRob Clarkseems like we can do some clever tricks like use GPU to trigger
22c8afe684SRob Clarkpageflip after rendering completes (ie. have the kms/crtc code build
23c8afe684SRob Clarkup gpu cmdstream to update scanout and write FLUSH register after).
24c8afe684SRob Clark
25c8afe684SRob ClarkSo, the approach is one drm driver, with some modularity.  Different
26c8afe684SRob Clark'struct msm_kms' implementations, depending on display controller.
27c8afe684SRob ClarkAnd one or more 'struct msm_gpu' for the various different gpu sub-
28c8afe684SRob Clarkmodules.
29c8afe684SRob Clark
30c8afe684SRob Clark(Second part is not implemented yet.  So far this is just basic KMS
31c8afe684SRob Clarkdriver, and not exposing any custom ioctls to userspace for now.)
32c8afe684SRob Clark
33c8afe684SRob ClarkThe kms module provides the plane, crtc, and encoder objects, and
34c8afe684SRob Clarkloads whatever connectors are appropriate.
35c8afe684SRob Clark
36c8afe684SRob ClarkFor MDP4, the mapping is:
37c8afe684SRob Clark
38c8afe684SRob Clark  plane   -> PIPE{RGBn,VGn}              \
39c8afe684SRob Clark  crtc    -> OVLP{n} + DMA{P,S,E} (??)   |-> MDP "device"
40c8afe684SRob Clark  encoder -> DTV/LCDC/DSI (within MDP4)  /
41c8afe684SRob Clark  connector -> HDMI/DSI/etc              --> other device(s)
42c8afe684SRob Clark
43c8afe684SRob ClarkSince the irq's that drm core mostly cares about are vblank/framedone,
44c8afe684SRob Clarkwe'll let msm_mdp4_kms provide the irq install/uninstall/etc functions
45c8afe684SRob Clarkand treat the MDP4 block's irq as "the" irq.  Even though the connectors
46c8afe684SRob Clarkmay have their own irqs which they install themselves.  For this reason
47c8afe684SRob Clarkthe display controller is the "master" device.
48c8afe684SRob Clark
49*06c0dd96SRob ClarkFor MDP5, the mapping is:
50*06c0dd96SRob Clark
51*06c0dd96SRob Clark  plane   -> PIPE{RGBn,VIGn}             \
52*06c0dd96SRob Clark  crtc    -> LM (layer mixer)            |-> MDP "device"
53*06c0dd96SRob Clark  encoder -> INTF                        /
54*06c0dd96SRob Clark  connector -> HDMI/DSI/eDP/etc          --> other device(s)
55*06c0dd96SRob Clark
56*06c0dd96SRob ClarkUnlike MDP4, it appears we can get by with a single encoder, rather
57*06c0dd96SRob Clarkthan needing a different implementation for DTV, DSI, etc.  (Ie. the
58*06c0dd96SRob Clarkregister interface is same, just different bases.)
59*06c0dd96SRob Clark
60*06c0dd96SRob ClarkAlso unlike MDP4, with MDP5 all the IRQs for other blocks (HDMI, DSI,
61*06c0dd96SRob Clarketc) are routed through MDP.
62*06c0dd96SRob Clark
63*06c0dd96SRob ClarkAnd finally, MDP5 has this "Shared Memory Pool" (called "SMP"), from
64*06c0dd96SRob Clarkwhich blocks need to be allocated to the active pipes based on fetch
65*06c0dd96SRob Clarkstride.
66*06c0dd96SRob Clark
67c8afe684SRob ClarkEach connector probably ends up being a separate device, just for the
68c8afe684SRob Clarklogistics of finding/mapping io region, irq, etc.  Idealy we would
69c8afe684SRob Clarkhave a better way than just stashing the platform device in a global
70c8afe684SRob Clark(ie. like DT super-node.. but I don't have any snapdragon hw yet that
71c8afe684SRob Clarkis using DT).
72c8afe684SRob Clark
73c8afe684SRob ClarkNote that so far I've not been able to get any docs on the hw, and it
74c8afe684SRob Clarkseems that access to such docs would prevent me from working on the
75c8afe684SRob Clarkfreedreno gallium driver.  So there may be some mistakes in register
76c8afe684SRob Clarknames (I had to invent a few, since no sufficient hint was given in
77c8afe684SRob Clarkthe downstream android fbdev driver), bitfield sizes, etc.  My current
78c8afe684SRob Clarkstate of understanding the registers is given in the envytools rnndb
79c8afe684SRob Clarkfiles at:
80c8afe684SRob Clark
81c8afe684SRob Clark  https://github.com/freedreno/envytools/tree/master/rnndb
82c8afe684SRob Clark  (the mdp4/hdmi/dsi directories)
83c8afe684SRob Clark
84c8afe684SRob ClarkThese files are used both for a parser tool (in the same tree) to
85c8afe684SRob Clarkparse logged register reads/writes (both from downstream android fbdev
86c8afe684SRob Clarkdriver, and this driver with register logging enabled), as well as to
87c8afe684SRob Clarkgenerate the register level headers.
88