The document discusses the i965g driver, which is the hardware-specific OpenGL driver for Intel graphics cards on Linux. It provides an overview of the driver's components and architecture, describing how it interfaces with other graphics software layers and translates OpenGL commands to hardware states. It also outlines the driver's current status and future plans to support newer OpenGL versions and hardware generations.
2. Overview
When is it developed?
when the baby naps: 30 to 60 minutes a time, two times a day
to work on something bigger: use the sleeping hours
the progress is slow
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 2 / 25
3. Overview
When is it developed?
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 3 / 25
4. Overview
When is it developed?
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 4 / 25
5. Overview
How is the quality?
rely solely on Piglit for testing
the skeleton is kept solid
the details are ugly sometimes
duplicated code
long functions
deep nested loops
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 5 / 25
6. Overview
Current Status
at OpenGL 2.1
to have OpenGL 3.0,
GL EXT transform feedback (almost done)
MSAA
OpenGL 3.1 (the latest version supported by Mesa)
primitive restart
instanced drawing
texture buffer objects
uniform buffer objects
these are small in terms of changes needed in i965g pipe driver
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 6 / 25
7. Linux Graphics
Graphics Drivers on Linux
DRM driver
mode setting
buffer allocation
command submission
synchronization
...
a user space library to communicate with the DRM driver
Xorg video driver
OpenGL driver
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 7 / 25
8. Linux Graphics
OpenGL drivers
GLX
equivalent to WGL on Windows
dlopen() DRI drivers
the trend is to replace it with EGL
glapi
provide GL entrypoints that can jump into the DRI driver
glXGetProcAddress() (or eglGetProcAddress())
DRI driver
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 8 / 25
9. Linux Graphics
DRI drivers
core mesa
common code shared by all drivers
set GL error as required by the spec
context state bookkeeping
emulate non-HW features (display list, vertex specificaion, and etc.)
many more
GLSL frontend
HW-specific driver code
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 9 / 25
10. Linux Graphics
i965g
i965g replaces only the HW-specific driver code
not the DRM driver
not the Xorg video driver
not the GLSL frontend nor mesa core in the DRI driver
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 10 / 25
11. Linux Graphics
i965g: components
mesa state tracker
translate OpenGL states/commands/shaders to pipe states, functions, and TGSI
DRI state tracker
implement DRI driver model
i965g pipe driver and winsys
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 11 / 25
12. Linux Graphics
i965g: winsys and pipe driver
winsys is the OS-dependent part
pipe driver is the OS-independent part
all window system dependencies are handled in GLX
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 12 / 25
13. i965g
State Trackers
A state tracker implements an well-defined API using a pipe driver. It tracks the states
defined and manipulated by the API, and translates them to pipe states.
mesa state tracker implements OpenGL 3.1
vega state tracker implements OpenVG 1.1
clover state tracker implements OpenCL 1.1
xorg state tracker implements Xorg video driver model
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 13 / 25
14. i965g
Pipe States
State trackers translate API states to pipe states, which are defined by C structs. For
example, the blend pipe state,
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 14 / 25
16. i965g
Pipe States, cont’d
Some translations are less trivial
Each shader is translated into assembly-like TGSI instructions
For each GL texture unit used in a shader, a pipe sampler state and a
pipe sampler view are created
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 16 / 25
17. i965g
Pipe States, cont’d
Pipe states are defined in a way such that they are close to what the GPUs expect
pipe drivers can handle them easily and efficiently
pipe drivers do not need to know anything about state trackers and the APIs they
support
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 17 / 25
18. i965g
i965g pipe driver
resource (texture/buffer) allocation
sync/query objects
blitter
TGSI compiler
state emission
Most functions are independent. The one that connects all together is how HW states
are emitted.
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 18 / 25
19. i965g
State Emission
When a pipe state is changed, remember the new state (simple C struct) and mark it
dirty.
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 19 / 25
20. i965g
State Emission, cont’d
Just before drawing anything,
call i965 finalize states() to resolve non-orthogonal pipe states, potentially
marking more pipe states dirty
emit all HW states that are affected by the dirty pipe states
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 20 / 25
21. i965g
State Emission, cont’d
i965 3d, the 3D pipeline, knows which pipe states affect which HW states. It checks the
dirty flags and decide which HW states need to be emitted.
For example,
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 21 / 25
22. i965g
State Emission, cont’d
i965 gpe, the GPE (Graphics Processing Engine), is in charge of adding the HW state or
command to the command parser.
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 22 / 25
23. i965g
State Emission, cont’d
i965 cp, the command parser, will send the commands to GPU for execution when its
buffer is full or when the state trackers ask the pipe driver to flush.
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 23 / 25
24. i965g
Future Directions
GEN7+ support
OpenCL 1.1 support
support OpenGL 3.0 and 3.1
pick an application for performance tuning
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 24 / 25
25. i965g
Links
For i965g,
https://github.com/olvaffe/mesa/tree/i965g-next
For information about the kernel driver,
http://blog.ffwll.ch/2012/10/i915gem-crashcourse.html
For information about the 2D driver,
http://cgit.freedesktop.org/xorg/driver/xf86-video-intel/
Chia-I Wu (olv@lunarg.com) i965g - DRAFT Feb 14, 2013 25 / 25