DSS 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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. Panel and controller drivers
  41. ----------------------------
  42. The drivers implement panel or controller specific functionality and are not
  43. usually visible to users except through omapfb driver. They register
  44. themselves to the DSS driver.
  45. omapfb driver
  46. -------------
  47. The omapfb driver implements arbitrary number of standard linux framebuffers.
  48. These framebuffers can be routed flexibly to any overlays, thus allowing very
  49. dynamic display architecture.
  50. The driver exports some omapfb specific ioctls, which are compatible with the
  51. ioctls in the old driver.
  52. The rest of the non standard features are exported via sysfs. Whether the final
  53. implementation will use sysfs, or ioctls, is still open.
  54. V4L2 drivers
  55. ------------
  56. V4L2 is being implemented in TI.
  57. From omapdss point of view the V4L2 drivers should be similar to framebuffer
  58. driver.
  59. Architecture
  60. --------------------
  61. Some clarification what the different components do:
  62. - Framebuffer is a memory area inside OMAP's SRAM/SDRAM that contains the
  63. pixel data for the image. Framebuffer has width and height and color
  64. depth.
  65. - Overlay defines where the pixels are read from and where they go on the
  66. screen. The overlay may be smaller than framebuffer, thus displaying only
  67. part of the framebuffer. The position of the overlay may be changed if
  68. the overlay is smaller than the display.
  69. - Overlay manager combines the overlays in to one image and feeds them to
  70. display.
  71. - Display is the actual physical display device.
  72. A framebuffer can be connected to multiple overlays to show the same pixel data
  73. on all of the overlays. Note that in this case the overlay input sizes must be
  74. the same, but, in case of video overlays, the output size can be different. Any
  75. framebuffer can be connected to any overlay.
  76. An overlay can be connected to one overlay manager. Also DISPC overlays can be
  77. connected only to DISPC overlay managers, and virtual overlays can be only
  78. connected to virtual overlays.
  79. An overlay manager can be connected to one display. There are certain
  80. restrictions which kinds of displays an overlay manager can be connected:
  81. - DISPC TV overlay manager can be only connected to TV display.
  82. - Virtual overlay managers can only be connected to DBI or DSI displays.
  83. - DISPC LCD overlay manager can be connected to all displays, except TV
  84. display.
  85. Sysfs
  86. -----
  87. The sysfs interface is mainly used for testing. I don't think sysfs
  88. interface is the best for this in the final version, but I don't quite know
  89. what would be the best interfaces for these things.
  90. The sysfs interface is divided to two parts: DSS and FB.
  91. /sys/class/graphics/fb? directory:
  92. mirror 0=off, 1=on
  93. rotate Rotation 0-3 for 0, 90, 180, 270 degrees
  94. rotate_type 0 = DMA rotation, 1 = VRFB rotation
  95. overlays List of overlay numbers to which framebuffer pixels go
  96. phys_addr Physical address of the framebuffer
  97. virt_addr Virtual address of the framebuffer
  98. size Size of the framebuffer
  99. /sys/devices/platform/omapdss/overlay? directory:
  100. enabled 0=off, 1=on
  101. input_size width,height (ie. the framebuffer size)
  102. manager Destination overlay manager name
  103. name
  104. output_size width,height
  105. position x,y
  106. screen_width width
  107. global_alpha global alpha 0-255 0=transparent 255=opaque
  108. /sys/devices/platform/omapdss/manager? directory:
  109. display Destination display
  110. name
  111. alpha_blending_enabled 0=off, 1=on
  112. trans_key_enabled 0=off, 1=on
  113. trans_key_type gfx-destination, video-source
  114. trans_key_value transparency color key (RGB24)
  115. default_color default background color (RGB24)
  116. /sys/devices/platform/omapdss/display? directory:
  117. ctrl_name Controller name
  118. mirror 0=off, 1=on
  119. update_mode 0=off, 1=auto, 2=manual
  120. enabled 0=off, 1=on
  121. name
  122. rotate Rotation 0-3 for 0, 90, 180, 270 degrees
  123. timings Display timings (pixclock,xres/hfp/hbp/hsw,yres/vfp/vbp/vsw)
  124. When writing, two special timings are accepted for tv-out:
  125. "pal" and "ntsc"
  126. panel_name
  127. tear_elim Tearing elimination 0=off, 1=on
  128. There are also some debugfs files at <debugfs>/omapdss/ which show information
  129. about clocks and registers.
  130. Examples
  131. --------
  132. The following definitions have been made for the examples below:
  133. ovl0=/sys/devices/platform/omapdss/overlay0
  134. ovl1=/sys/devices/platform/omapdss/overlay1
  135. ovl2=/sys/devices/platform/omapdss/overlay2
  136. mgr0=/sys/devices/platform/omapdss/manager0
  137. mgr1=/sys/devices/platform/omapdss/manager1
  138. lcd=/sys/devices/platform/omapdss/display0
  139. dvi=/sys/devices/platform/omapdss/display1
  140. tv=/sys/devices/platform/omapdss/display2
  141. fb0=/sys/class/graphics/fb0
  142. fb1=/sys/class/graphics/fb1
  143. fb2=/sys/class/graphics/fb2
  144. Default setup on OMAP3 SDP
  145. --------------------------
  146. Here's the default setup on OMAP3 SDP board. All planes go to LCD. DVI
  147. and TV-out are not in use. The columns from left to right are:
  148. framebuffers, overlays, overlay managers, displays. Framebuffers are
  149. handled by omapfb, and the rest by the DSS.
  150. FB0 --- GFX -\ DVI
  151. FB1 --- VID1 --+- LCD ---- LCD
  152. FB2 --- VID2 -/ TV ----- TV
  153. Example: Switch from LCD to DVI
  154. ----------------------
  155. w=`cat $dvi/timings | cut -d "," -f 2 | cut -d "/" -f 1`
  156. h=`cat $dvi/timings | cut -d "," -f 3 | cut -d "/" -f 1`
  157. echo "0" > $lcd/enabled
  158. echo "" > $mgr0/display
  159. fbset -fb /dev/fb0 -xres $w -yres $h -vxres $w -vyres $h
  160. # at this point you have to switch the dvi/lcd dip-switch from the omap board
  161. echo "dvi" > $mgr0/display
  162. echo "1" > $dvi/enabled
  163. After this the configuration looks like:
  164. FB0 --- GFX -\ -- DVI
  165. FB1 --- VID1 --+- LCD -/ LCD
  166. FB2 --- VID2 -/ TV ----- TV
  167. Example: Clone GFX overlay to LCD and TV
  168. -------------------------------
  169. w=`cat $tv/timings | cut -d "," -f 2 | cut -d "/" -f 1`
  170. h=`cat $tv/timings | cut -d "," -f 3 | cut -d "/" -f 1`
  171. echo "0" > $ovl0/enabled
  172. echo "0" > $ovl1/enabled
  173. echo "" > $fb1/overlays
  174. echo "0,1" > $fb0/overlays
  175. echo "$w,$h" > $ovl1/output_size
  176. echo "tv" > $ovl1/manager
  177. echo "1" > $ovl0/enabled
  178. echo "1" > $ovl1/enabled
  179. echo "1" > $tv/enabled
  180. After this the configuration looks like (only relevant parts shown):
  181. FB0 +-- GFX ---- LCD ---- LCD
  182. \- VID1 ---- TV ---- TV
  183. Misc notes
  184. ----------
  185. OMAP FB allocates the framebuffer memory using the OMAP VRAM allocator.
  186. Using DSI DPLL to generate pixel clock it is possible produce the pixel clock
  187. of 86.5MHz (max possible), and with that you get 1280x1024@57 output from DVI.
  188. Rotation and mirroring currently only supports RGB565 and RGB8888 modes. VRFB
  189. does not support mirroring.
  190. VRFB rotation requires much more memory than non-rotated framebuffer, so you
  191. probably need to increase your vram setting before using VRFB rotation. Also,
  192. many applications may not work with VRFB if they do not pay attention to all
  193. framebuffer parameters.
  194. Kernel boot arguments
  195. ---------------------
  196. vram=<size>[,<physaddr>]
  197. - Amount of total VRAM to preallocate and optionally a physical start
  198. memory address. For example, "10M". omapfb allocates memory for
  199. framebuffers from VRAM.
  200. omapfb.mode=<display>:<mode>[,...]
  201. - Default video mode for specified displays. For example,
  202. "dvi:800x400MR-24@60". See drivers/video/modedb.c.
  203. There are also two special modes: "pal" and "ntsc" that
  204. can be used to tv out.
  205. omapfb.vram=<fbnum>:<size>[@<physaddr>][,...]
  206. - VRAM allocated for a framebuffer. Normally omapfb allocates vram
  207. depending on the display size. With this you can manually allocate
  208. more or define the physical address of each framebuffer. For example,
  209. "1:4M" to allocate 4M for fb1.
  210. omapfb.debug=<y|n>
  211. - Enable debug printing. You have to have OMAPFB debug support enabled
  212. in kernel config.
  213. omapfb.test=<y|n>
  214. - Draw test pattern to framebuffer whenever framebuffer settings change.
  215. You need to have OMAPFB debug support enabled in kernel config.
  216. omapfb.vrfb=<y|n>
  217. - Use VRFB rotation for all framebuffers.
  218. omapfb.rotate=<angle>
  219. - Default rotation applied to all framebuffers.
  220. 0 - 0 degree rotation
  221. 1 - 90 degree rotation
  222. 2 - 180 degree rotation
  223. 3 - 270 degree rotation
  224. omapfb.mirror=<y|n>
  225. - Default mirror for all framebuffers. Only works with DMA rotation.
  226. omapdss.def_disp=<display>
  227. - Name of default display, to which all overlays will be connected.
  228. Common examples are "lcd" or "tv".
  229. omapdss.debug=<y|n>
  230. - Enable debug printing. You have to have DSS debug support enabled in
  231. kernel config.
  232. TODO
  233. ----
  234. DSS locking
  235. Error checking
  236. - Lots of checks are missing or implemented just as BUG()
  237. System DMA update for DSI
  238. - Can be used for RGB16 and RGB24P modes. Probably not for RGB24U (how
  239. to skip the empty byte?)
  240. OMAP1 support
  241. - Not sure if needed