Your SlideShare is downloading. ×
0
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Gallium3D - Mesa's New Driver Model
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Gallium3D - Mesa's New Driver Model

5,788

Published on

0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,788
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
167
Comments
0
Likes
8
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Gallium3D - Mesa’s New Driver Model Chia-I Wu olvaffe@gmail.com Mar 27, 2011Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 1 / 24
  • 2. AgendaWho Am I? main developer of Mesa EGL stack Android(-x86) port of Mesa experiences in OpenGL stacks Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 2 / 24
  • 3. AgendaWho Am I? main developer of Mesa EGL stack Android(-x86) port of Mesa experiences in OpenGL stacks a member of 0xlab Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 2 / 24
  • 4. AgendaAgenda OpenGL and Linux: DRI classic and Gallium3D driver models how does it make a developer happy Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 3 / 24
  • 5. OpenGL and LinuxMesa v.s. Proprietary DriversIsn’t this the case? Mesa Proprietary stability . v performance . v feature set . v it’s free v . Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 4 / 24
  • 6. OpenGL and LinuxNot Always Figure: nouveau v.s. nVidia binary driver (phronix) Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 5 / 24
  • 7. OpenGL and LinuxPeople BIG TEAMS / BIG BUDGET Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 6 / 24
  • 8. OpenGL and LinuxDRIDirect Rendering Infrastructure, DRI direct rendering Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 7 / 24
  • 9. OpenGL and LinuxDRIDirect Rendering Infrastructure, DRI direct rendering core X rendering indirect rendering Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 7 / 24
  • 10. OpenGL and LinuxDRI Components Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 8 / 24
  • 11. OpenGL and LinuxDRI Components <hw> dri.so is the DRI or 3D driver <hw> drv.so is the DDX or 2D driver <hw>.ko is the DRM kernel module libdrm <hw>.so is the user space library for the DRM module GLX and DRI2 are X11 protocols Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 8 / 24
  • 12. OpenGL and LinuxThey are all complex DRM driver for buffer management, mode setting, ... (radeon has ∼70k LoC) DDX driver for 2D operations, video, mode setting, ... (radeon has ∼100k LoC) DRI driver for OpenGL (radeon has ∼90k LoC) Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 9 / 24
  • 13. OpenGL and LinuxOpenGL under Mesa Classic Driver Model libGL.so <hw>_dri.so libdrm_<hw>.so DRI driver interface Mesa common code HW codeIn the classic model, there is common code that checks the arguments of an OpenGL call and updates internal states it then calls into the HW code using the function table implemented thereThere is an almost one-to-one mapping between OpenGL API and the function table thatthe HW code implements. Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 10 / 24
  • 14. OpenGL and LinuxDissection of the DRI driver libGL.so <hw>_dri.so libdrm_<hw>.so DRI driver interface Mesa common code HW code OS dependent: the HW code display server dependent: none OpenGL dependent: the common and HW code Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 11 / 24
  • 15. OpenGL and LinuxProblems with the Classic ModelThe problems with the classic model are it is OpenGL(ES) only; even the hardware can support OpenVG, OpenCL, ... the driver uses OpenGL data types and objects the driver must handle the differences between OpenGL and the hardware an implementation issue instead of a design issue in view of the DRI architecture Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 12 / 24
  • 16. Gallium3DIdeal Model Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 13 / 24
  • 17. Gallium3DGallium3D libGL.so <hw>_dri.so libdrm_<hw>.so DRI state tracker pipe driver pipe winsys OpenGL state tracker OS dependent: the pipe winsys display server dependent: none OpenGL dependent: OpenGL state tracker Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 14 / 24
  • 18. Gallium3DGallium3D libGL.so <hw>_dri.so libdrm_<hw>.so DRI state tracker pipe driver pipe winsys OpenGL state tracker OS dependent: the pipe winsys display server dependent: none OpenGL dependent: OpenGL state tracker The pipe driver is highly protable and has a well-defined interface! Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 14 / 24
  • 19. Gallium3DClassic Model to Gallium3D Model libGL.so <hw>_dri.so libdrm_<hw>.so DRI driver interface Mesa common code HW code DRI state tracker pipe driver pipe winsys OpenGL state trackerThis is a non-trivial process DRI and OpenGL state trackers are written once and shared the pipe driver and winsys must be written for each HW new drivers should adopt the Gallium3D model from beginning Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 15 / 24
  • 20. Gallium3DGallium3D: examples libEGL.so egl_dri2.so <hw>_dri.so libdrm_<hw>.so DRI state tracker pipe driver pipe winsys OpenVG state tracker libOpenCL.so <hw>_dri.so libdrm_<hw>.so DRI state tracker pipe driver pipe winsys OpenCL state tracker(You can also have all OpenGL, OpenVG, and OpenCL state trackers inside a single DRIdriver) Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 16 / 24
  • 21. Gallium3DGallium3D: even for DDX Xorg <hw>_drv.so (DDX) libdrm_<hw>.so DDX state tracker pipe driver pipe winsysA modern DDX driver is more than a 2D driver EXA/UXA Xrender video decoding mode setting KMS Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 17 / 24
  • 22. Gallium3DGallium3D: SVGAVMWare has a virtual GPU named SVGA. The aquisition of Tungsten Graphics gives vmwgfx.ko DRM module Gallium3D based DRI driver Gallium3D based DDX driver Gallium3D based D3D9 driver (D3D9 state tracker + Windows winsys) Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 18 / 24
  • 23. DevelopersGallium3D coreGallium3D core consists of two interfaces: struct pipe screen and struct pipe context helper functions for format conversions, buffer management, vertex processing, and etc. wrappers of OS or compiler dependent functions, such as threads, timing, I/OPipe drivers implement struct pipe screen and struct pipe context interfaces.State trackers are users of the interfaces. Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 19 / 24
  • 24. Developersstruct pipe screenThe pipe screen is an abstraction of the adapter. It is used for querying adapter capabilities/limitations creating resources fencing and other misc operations Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 20 / 24
  • 25. Developersstruct pipe contextThe pipe context is an abstraction of the graphics pipeline (and some misc operations) vertex buffers vertex fetcher vertex shader geometry shader stream output buffers textures and constant buffers rasterizer fragment shader per-fragment ops color and depth buffers Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 21 / 24
  • 26. DevelopersPseudo Code/∗ c r e a t e t h e p i p e s c r e e n ∗/s t r u c t p i p e s c r e e n ∗ s c r e e n = o p e n h w d e v i c e ( dev name ) ;/∗ c r e a t e a p i p e c o n t e x t ∗/s t r u c t p i p e s c r e e n ∗ p i p e = s c r e e n −>c o n t e x t c r e a t e ( / ∗ . . . ∗ / ) ;struct pipe resource ∗ res ;/∗ c r e a t e a r e s o u r c e from t h e s c r e e n ∗/r e s = s c r e e n −>r e s o u r c e c r e a t e ( / ∗ . . . ∗ / ) ;/∗ s e t t h e r e s o u r c e a s t h e f r a m e b u f f e r ∗/p i p e −>s e t f r a m e b u f f e r s t a t e ( / ∗ . . . ∗ / ) ; Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 22 / 24
  • 27. DevelopersIt is easierGallium3D driver model has well-defined interfaces and types is close to the hardware has reusable state trackers has lots of helper functions supports pipe screen/context wrapping: trace, rbug, galahad Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 23 / 24
  • 28. Q&AQ&AQuestions? Chia-I Wu (olvaffe@gmail.com) Gallium3D - Mesa’s New Driver Model Mar 27, 2011 24 / 24

×