DSS 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. OMAP2/3 Display Subsystem
  2. -------------------------
  3. This is an almost total rewrite of the OMAP FB driver in drivers/video/omap
  4. (let's call it DSS1). The main differences between DSS1 and DSS2 are DSI,
  5. TV-out and multiple display support, but there are lots of small improvements
  6. also.
  7. The DSS2 driver (omapdss module) is in arch/arm/plat-omap/dss/, and the FB,
  8. panel and controller drivers are in drivers/video/omap2/. DSS1 and DSS2 live
  9. currently side by side, you can choose which one to use.
  10. Features
  11. --------
  12. Working and tested features include:
  13. - MIPI DPI (parallel) output
  14. - MIPI DSI output in command mode
  15. - MIPI DBI (RFBI) output
  16. - SDI output
  17. - TV output
  18. - All pieces can be compiled as a module or inside kernel
  19. - Use DISPC to update any of the outputs
  20. - Use CPU to update RFBI or DSI output
  21. - OMAP DISPC planes
  22. - RGB16, RGB24 packed, RGB24 unpacked
  23. - YUV2, UYVY
  24. - Scaling
  25. - Adjusting DSS FCK to find a good pixel clock
  26. - Use DSI DPLL to create DSS FCK
  27. Tested boards include:
  28. - OMAP3 SDP board
  29. - Beagle board
  30. - N810
  31. omapdss driver
  32. --------------
  33. The DSS driver does not itself have any support for Linux framebuffer, V4L or
  34. such like the current ones, but it has an internal kernel API that upper level
  35. drivers can use.
  36. The DSS driver models OMAP's overlays, overlay managers and displays in a
  37. flexible way to enable non-common multi-display configuration. In addition to
  38. modelling the hardware overlays, omapdss supports virtual overlays and overlay
  39. managers. These can be used when updating a display with CPU or system DMA.
  40. omapdss driver support for audio
  41. --------------------------------
  42. There exist several display technologies and standards that support audio as
  43. well. Hence, it is relevant to update the DSS device driver to provide an audio
  44. interface that may be used by an audio driver or any other driver interested in
  45. the functionality.
  46. The audio_enable function is intended to prepare the relevant
  47. IP for playback (e.g., enabling an audio FIFO, taking in/out of reset
  48. some IP, enabling companion chips, etc). It is intended to be called before
  49. audio_start. The audio_disable function performs the reverse operation and is
  50. intended to be called after audio_stop.
  51. While a given DSS device driver may support audio, it is possible that for
  52. certain configurations audio is not supported (e.g., an HDMI display using a
  53. VESA video timing). The audio_supported function is intended to query whether
  54. the current configuration of the display supports audio.
  55. The audio_config function is intended to configure all the relevant audio
  56. parameters of the display. In order to make the function independent of any
  57. specific DSS device driver, a struct omap_dss_audio is defined. Its purpose
  58. is to contain all the required parameters for audio configuration. At the
  59. moment, such structure contains pointers to IEC-60958 channel status word
  60. and CEA-861 audio infoframe structures. This should be enough to support
  61. HDMI and DisplayPort, as both are based on CEA-861 and IEC-60958.
  62. The audio_enable/disable, audio_config and audio_supported functions could be
  63. implemented as functions that may sleep. Hence, they should not be called
  64. while holding a spinlock or a readlock.
  65. The audio_start/audio_stop function is intended to effectively start/stop audio
  66. playback after the configuration has taken place. These functions are designed
  67. to be used in an atomic context. Hence, audio_start should return quickly and be
  68. called only after all the needed resources for audio playback (audio FIFOs,
  69. DMA channels, companion chips, etc) have been enabled to begin data transfers.
  70. audio_stop is designed to only stop the audio transfers. The resources used
  71. for playback are released using audio_disable.
  72. The enum omap_dss_audio_state may be used to help the implementations of
  73. the interface to keep track of the audio state. The initial state is _DISABLED;
  74. then, the state transitions to _CONFIGURED, and then, when it is ready to
  75. play audio, to _ENABLED. The state _PLAYING is used when the audio is being
  76. rendered.
  77. Panel and controller drivers
  78. ----------------------------
  79. The drivers implement panel or controller specific functionality and are not
  80. usually visible to users except through omapfb driver. They register
  81. themselves to the DSS driver.
  82. omapfb driver
  83. -------------
  84. The omapfb driver implements arbitrary number of standard linux framebuffers.
  85. These framebuffers can be routed flexibly to any overlays, thus allowing very
  86. dynamic display architecture.
  87. The driver exports some omapfb specific ioctls, which are compatible with the
  88. ioctls in the old driver.
  89. The rest of the non standard features are exported via sysfs. Whether the final
  90. implementation will use sysfs, or ioctls, is still open.
  91. V4L2 drivers
  92. ------------
  93. V4L2 is being implemented in TI.
  94. From omapdss point of view the V4L2 drivers should be similar to framebuffer
  95. driver.
  96. Architecture
  97. --------------------
  98. Some clarification what the different components do:
  99. - Framebuffer is a memory area inside OMAP's SRAM/SDRAM that contains the
  100. pixel data for the image. Framebuffer has width and height and color
  101. depth.
  102. - Overlay defines where the pixels are read from and where they go on the
  103. screen. The overlay may be smaller than framebuffer, thus displaying only
  104. part of the framebuffer. The position of the overlay may be changed if
  105. the overlay is smaller than the display.
  106. - Overlay manager combines the overlays in to one image and feeds them to
  107. display.
  108. - Display is the actual physical display device.
  109. A framebuffer can be connected to multiple overlays to show the same pixel data
  110. on all of the overlays. Note that in this case the overlay input sizes must be
  111. the same, but, in case of video overlays, the output size can be different. Any
  112. framebuffer can be connected to any overlay.
  113. An overlay can be connected to one overlay manager. Also DISPC overlays can be
  114. connected only to DISPC overlay managers, and virtual overlays can be only
  115. connected to virtual overlays.
  116. An overlay manager can be connected to one display. There are certain
  117. restrictions which kinds of displays an overlay manager can be connected:
  118. - DISPC TV overlay manager can be only connected to TV display.
  119. - Virtual overlay managers can only be connected to DBI or DSI displays.
  120. - DISPC LCD overlay manager can be connected to all displays, except TV
  121. display.
  122. Sysfs
  123. -----
  124. The sysfs interface is mainly used for testing. I don't think sysfs
  125. interface is the best for this in the final version, but I don't quite know
  126. what would be the best interfaces for these things.
  127. The sysfs interface is divided to two parts: DSS and FB.
  128. /sys/class/graphics/fb? directory:
  129. mirror 0=off, 1=on
  130. rotate Rotation 0-3 for 0, 90, 180, 270 degrees
  131. rotate_type 0 = DMA rotation, 1 = VRFB rotation
  132. overlays List of overlay numbers to which framebuffer pixels go
  133. phys_addr Physical address of the framebuffer
  134. virt_addr Virtual address of the framebuffer
  135. size Size of the framebuffer
  136. /sys/devices/platform/omapdss/overlay? directory:
  137. enabled 0=off, 1=on
  138. input_size width,height (ie. the framebuffer size)
  139. manager Destination overlay manager name
  140. name
  141. output_size width,height
  142. position x,y
  143. screen_width width
  144. global_alpha global alpha 0-255 0=transparent 255=opaque
  145. /sys/devices/platform/omapdss/manager? directory:
  146. display Destination display
  147. name
  148. alpha_blending_enabled 0=off, 1=on
  149. trans_key_enabled 0=off, 1=on
  150. trans_key_type gfx-destination, video-source
  151. trans_key_value transparency color key (RGB24)
  152. default_color default background color (RGB24)
  153. /sys/devices/platform/omapdss/display? directory:
  154. ctrl_name Controller name
  155. mirror 0=off, 1=on
  156. update_mode 0=off, 1=auto, 2=manual
  157. enabled 0=off, 1=on
  158. name
  159. rotate Rotation 0-3 for 0, 90, 180, 270 degrees
  160. timings Display timings (pixclock,xres/hfp/hbp/hsw,yres/vfp/vbp/vsw)
  161. When writing, two special timings are accepted for tv-out:
  162. "pal" and "ntsc"
  163. panel_name
  164. tear_elim Tearing elimination 0=off, 1=on
  165. output_type Output type (video encoder only): "composite" or "svideo"
  166. There are also some debugfs files at <debugfs>/omapdss/ which show information
  167. about clocks and registers.
  168. Examples
  169. --------
  170. The following definitions have been made for the examples below:
  171. ovl0=/sys/devices/platform/omapdss/overlay0
  172. ovl1=/sys/devices/platform/omapdss/overlay1
  173. ovl2=/sys/devices/platform/omapdss/overlay2
  174. mgr0=/sys/devices/platform/omapdss/manager0
  175. mgr1=/sys/devices/platform/omapdss/manager1
  176. lcd=/sys/devices/platform/omapdss/display0
  177. dvi=/sys/devices/platform/omapdss/display1
  178. tv=/sys/devices/platform/omapdss/display2
  179. fb0=/sys/class/graphics/fb0
  180. fb1=/sys/class/graphics/fb1
  181. fb2=/sys/class/graphics/fb2
  182. Default setup on OMAP3 SDP
  183. --------------------------
  184. Here's the default setup on OMAP3 SDP board. All planes go to LCD. DVI
  185. and TV-out are not in use. The columns from left to right are:
  186. framebuffers, overlays, overlay managers, displays. Framebuffers are
  187. handled by omapfb, and the rest by the DSS.
  188. FB0 --- GFX -\ DVI
  189. FB1 --- VID1 --+- LCD ---- LCD
  190. FB2 --- VID2 -/ TV ----- TV
  191. Example: Switch from LCD to DVI
  192. ----------------------
  193. w=`cat $dvi/timings | cut -d "," -f 2 | cut -d "/" -f 1`
  194. h=`cat $dvi/timings | cut -d "," -f 3 | cut -d "/" -f 1`
  195. echo "0" > $lcd/enabled
  196. echo "" > $mgr0/display
  197. fbset -fb /dev/fb0 -xres $w -yres $h -vxres $w -vyres $h
  198. # at this point you have to switch the dvi/lcd dip-switch from the omap board
  199. echo "dvi" > $mgr0/display
  200. echo "1" > $dvi/enabled
  201. After this the configuration looks like:
  202. FB0 --- GFX -\ -- DVI
  203. FB1 --- VID1 --+- LCD -/ LCD
  204. FB2 --- VID2 -/ TV ----- TV
  205. Example: Clone GFX overlay to LCD and TV
  206. -------------------------------
  207. w=`cat $tv/timings | cut -d "," -f 2 | cut -d "/" -f 1`
  208. h=`cat $tv/timings | cut -d "," -f 3 | cut -d "/" -f 1`
  209. echo "0" > $ovl0/enabled
  210. echo "0" > $ovl1/enabled
  211. echo "" > $fb1/overlays
  212. echo "0,1" > $fb0/overlays
  213. echo "$w,$h" > $ovl1/output_size
  214. echo "tv" > $ovl1/manager
  215. echo "1" > $ovl0/enabled
  216. echo "1" > $ovl1/enabled
  217. echo "1" > $tv/enabled
  218. After this the configuration looks like (only relevant parts shown):
  219. FB0 +-- GFX ---- LCD ---- LCD
  220. \- VID1 ---- TV ---- TV
  221. Misc notes
  222. ----------
  223. OMAP FB allocates the framebuffer memory using the standard dma allocator. You
  224. can enable Contiguous Memory Allocator (CONFIG_CMA) to improve the dma
  225. allocator, and if CMA is enabled, you use "cma=" kernel parameter to increase
  226. the global memory area for CMA.
  227. Using DSI DPLL to generate pixel clock it is possible produce the pixel clock
  228. of 86.5MHz (max possible), and with that you get 1280x1024@57 output from DVI.
  229. Rotation and mirroring currently only supports RGB565 and RGB8888 modes. VRFB
  230. does not support mirroring.
  231. VRFB rotation requires much more memory than non-rotated framebuffer, so you
  232. probably need to increase your vram setting before using VRFB rotation. Also,
  233. many applications may not work with VRFB if they do not pay attention to all
  234. framebuffer parameters.
  235. Kernel boot arguments
  236. ---------------------
  237. omapfb.mode=<display>:<mode>[,...]
  238. - Default video mode for specified displays. For example,
  239. "dvi:800x400MR-24@60". See drivers/video/modedb.c.
  240. There are also two special modes: "pal" and "ntsc" that
  241. can be used to tv out.
  242. omapfb.vram=<fbnum>:<size>[@<physaddr>][,...]
  243. - VRAM allocated for a framebuffer. Normally omapfb allocates vram
  244. depending on the display size. With this you can manually allocate
  245. more or define the physical address of each framebuffer. For example,
  246. "1:4M" to allocate 4M for fb1.
  247. omapfb.debug=<y|n>
  248. - Enable debug printing. You have to have OMAPFB debug support enabled
  249. in kernel config.
  250. omapfb.test=<y|n>
  251. - Draw test pattern to framebuffer whenever framebuffer settings change.
  252. You need to have OMAPFB debug support enabled in kernel config.
  253. omapfb.vrfb=<y|n>
  254. - Use VRFB rotation for all framebuffers.
  255. omapfb.rotate=<angle>
  256. - Default rotation applied to all framebuffers.
  257. 0 - 0 degree rotation
  258. 1 - 90 degree rotation
  259. 2 - 180 degree rotation
  260. 3 - 270 degree rotation
  261. omapfb.mirror=<y|n>
  262. - Default mirror for all framebuffers. Only works with DMA rotation.
  263. omapdss.def_disp=<display>
  264. - Name of default display, to which all overlays will be connected.
  265. Common examples are "lcd" or "tv".
  266. omapdss.debug=<y|n>
  267. - Enable debug printing. You have to have DSS debug support enabled in
  268. kernel config.
  269. TODO
  270. ----
  271. DSS locking
  272. Error checking
  273. - Lots of checks are missing or implemented just as BUG()
  274. System DMA update for DSI
  275. - Can be used for RGB16 and RGB24P modes. Probably not for RGB24U (how
  276. to skip the empty byte?)
  277. OMAP1 support
  278. - Not sure if needed