Post on 24-Apr-2015
Intel Linux Graphics Following the open source road from
Kernel to UI toolkits
Eugeni Dodonov
LinuxCon Brazil 2011 2
Intel Linux Graphics
Let‟s start with 3 simple questions:
• How many of you run Linux on your notebooks and desktops?
• How many of you run Linux on your notebooks and desktops and
have integrated Intel graphics cards?
• How many of you run Linux on your notebooks and desktops, have
integrated Intel graphics cards, and ever had to download or install
some sort of drivers for them to work?
• Why?
• Let‟s figure it out…
LinuxCon Brazil 2011 3
What is Intel Linux Graphics?
A stack of graphics projects to support Intel Graphics cards
Composed of a range of projects from Kernel to end user facing UI
toolkits and applications:
• Kernel
• DRM
• Mesa 3D
• VAAPI
• Cairo
• DDX
• Wayland
• Fully open-source
• Fully upstream
LinuxCon Brazil 2011 4
What Intel Linux Graphics is not?
PowerVR-based cards
• GMA500, GMA600, or Poulsbo
• Those are closed-source
So, how does this all work?
5
LinuxCon Brazil 2011 6
So, how does this all work?
Let‟s start with the basics.
• At the very bottom, we have the GPU.
• To make things more interesting, we have different generations of
GPUs.
• Gen2, Gen3, Gen4, Gen5, Gen6, Gen7
• What are they?
LinuxCon Brazil 2011 7
A long, long time ago, in a galaxy far away…
First generation of Intel graphics:
• i740
• i810
• Museum
LinuxCon Brazil 2011 8
2nd generation, or Gen2
• i830, 845, 85x, 865
• Around a decade ago
• Support DirectX* 8.0 and OpenGL* 1.3 in hardware
• Support some video decoding
• But no hardware transform-and-lighting…
LinuxCon Brazil 2011 9
3rd generation, or modern days
• i915g, i915gm, 945g, 945gm, g33 and pineview
• More video processing, support for hardware video overlaying
• Support for DirectX* 9.0c, OpenGL* 1.4
• Supports Pixel Shader 2.0 in hardware
• But still no hardware transform and lighting…
LinuxCon Brazil 2011 10
4th generation, not so distant past
• Available somewhere around Intel® Core™ architecture
• i965g, i965gm, g45, gm45, g35
• Now yes, hardware transform and lighting support!
• Unified Shader Processor, support for Pixel Shader 3.0 and (later) Shader
4.0
• Still around us, but the real fun starts next…
LinuxCon Brazil 2011 11
5th generation, Intel® Core™ I architecture
• No more North Bridge, with the PCH design graphics support is
integrated into CPU.
• Ironlake family of chipsets.
• You can use most almost-modern graphics applications and play most
games.
• You can play OpenArena, Urban Terror*, and World of Padman with 30+
FPS (according to Phoronix benchmarks)
• Support mpeg and h264 decoding by hardware
LinuxCon Brazil 2011 12
6th generation, present day
• Intel Sandy Bridge architecture
• 70+ FPS in OpenArena in 1600x900 resolution, according to Phoronix
benchmarks
• In hardware, support for a whole new set of enhancements.
• Almost doubles graphics performance for integrated graphics
(+70% faster according to Anandtech benchmarks).
• Most modern Intel® Graphics chip out there.
LinuxCon Brazil 2011 13
7th generation, the future
• You all know that there will be new Intel architecture out there in a
couple of months.
• You all know that it will be called “Ivy Bridge”.
• …but that‟s about all I can tell you about it.
• Besides the fact that it is great .
LinuxCon Brazil 2011 14
Trivia 1
Do you know that you can discover a lot about your gfx card generation
and features from your kernel?
• cat /sys/kernel/debug/dri/0/i915_capabilities
LinuxCon Brazil 2011 15
Trivia 2
Use the Source, Luke!
• You can find out a lot about your graphics card by looking at the
sources.
• In kernel/drivers/gpu/drm/i915/i915_drv.c you can find a
precise mapping of different cards to their generations and other
details.
• Which brings us to our next topic…
Who are the members
of the Intel Linux Graphics family?
16
LinuxCon Brazil 2011 17
The Kernel
So, we have the GPU, but how to use it?
• The Kernel is the root of everything on a Linux system.
• Thanks, Linus!
• For Intel Linux Graphics, we have many places in the Kernel
• The most important are:
• Drivers/char/agp/intel-*.[ch]
• Chipset-specific support
• Drivers/gpu/drm
• DRM code
• Drivers/gpu/drm/i915
• i915.ko kernel driver. This is what talks to the hardware.
LinuxCon Brazil 2011 18
The Kernel, part 2
What does the kernel do?
• Does the mode setting (KMS, or Kernel Mode Setting) – resolutions,
refresh rate, different outputs and settings…
• GPU memory management
• Passing rendering instructions to the GPU
• Gives a /dev/dri/ interface for userspace applications to talk to
different GPUs in an unified way
• Power management
• And all the other low-level stuff
LinuxCon Brazil 2011 19
Trivia 3
Did you know that Intel Graphics cards have several power and
performance-related options?
• RC6 – deep sleep state. Allows the card not to use any power when
idle. Up to 60% battery improvements, according to Phoronix testing.
• i915.i915_enable_rc6=1
• FBC, Frame Buffer Compression. Allows the card to compress pixel
data prior to sending it to the GPU, using less memory bandwidth.
• i915.i915_enable_fbc=1
• Semaphores in hardware. Allows for a faster GPU scheduling.
• i915.semaphores=1
• Some are already ON by default, some hopefully will be by the Kernel
3.2 release.
LinuxCon Brazil 2011 20
But how do you talk to the Kernel?
DRM, Direct Rendering Manager.
• A component of Direct Rendering Infrastructure, which allows
applications to talk to the GPU directly.
• Used for video acceleration, rendering, 3D…
• Allows access to different GPU hardware (Intel, Radeon, Nouveau,
…) using a common /dev/dri interface.
• Userspace support using the libdrm project.
• http://cgit.freedesktop.org/mesa/drm/
LinuxCon Brazil 2011 21
Trivia 4
Did you know that Intel has a set of tools and utilities for managing,
monitoring, and having detailed control over the hardware?
http://cgit.freedesktop.org/xorg/app/intel-gpu-tools/
• Intel_gpu_top, test_display, intel_reg_dumper, intel_error_decode,
intel_gpu_time…
Besides intel-gpu-tools, libdrm also has some nice utilities, which are
usually not that widely known.
• Modetest – tests different video modes and outputs
• Kmstest – tests Kernel mode setting
• And many others
LinuxCon Brazil 2011 22
Trivia 4 - examples
Intel_gpu_top
Intel_reg_dumper
LinuxCon Brazil 2011 23
What comes on top of libdrm?
So, we have DRM, but what uses it?
• Mesa 3D
• DDX
• VAAPI
• Cairo backends
• Wayland
• …and so on
• What are all of those?
LinuxCon Brazil 2011 24
Mesa 3D
Open-source implementation of OpenGL API.
Developed since 1993 by thousands of contributors.
Supports OpenGL 2.1, heading towards OpenGL 3.0 completeness by
the end of the year.
Supports most GPUs out there. And when it doesn‟t, it has software
rendering.
Fully open-source. Doubtless, the best source of information for those
wanting to understand how OpenGL works.
Has huge regressions testing suite (piglit).
LinuxCon Brazil 2011 25
Mesa 3D
LinuxCon Brazil 2011 26
Trivia 5
It is possible to record all the GL operations from Mesa, and use them for
analysis later using the APITRACE (https://github.com/apitrace/apitrace)
tool.
Or even replay the entire execution!
LinuxCon Brazil 2011 27
And what about 2D?
DDX, or Device Dependent X, or xf86-video-intel.
• 2D driver of the X server for Intel cards.
• This is what you use when you run X.
• http://cgit.freedesktop.org/xorg/driver/xf86-video-intel
LinuxCon Brazil 2011 28
Trivia 6
Currently, the officially support Acceleration mode for the 2D rendering is
UXA, developed back in 2008.
Earlier this year, Chris Wilson from Intel proposed and implemented a
new backend, called SNA (Sandy Bridge New Acceleration, or
Snazzy).
Improves Cairo performance by up to 15x in some cases, and 3D games
performance by up to 40-60% (depending on the game).
Most of the improvements come from optimized batch buffer processing,
so 2D operations are carried out together with 3D ones. Previously,
those were split and serialized between different rendering rings.
Not yet fully stable, but can be used through the --enable-sna compile
switch.
LinuxCon Brazil 2011 29
Video Acceleration from Intel
VAAPI – Video Acceleration API
• Provides access to GPU hardware for hw-accelerated video processing
(encoding, decoding, subpicture blending, and rendering).
• Supports mpeg-2, H.263, H.264, VC-1
(depending on the generation of video chips).
• Supports accelerating motion compensation, iDCT, intra-frame prediction,
variable-length decoding, bitstream processing, ….
• http://www.freedesktop.org/wiki/Software/vaapi
LinuxCon Brazil 2011 30
Cairo
(No, not the City)
• Library for vector graphics-based and device-independent API.
• A library for 2D drawings over a multitude of backends (xlib, xlib-xrender,
xcb, gl, glx, egl, glesv2; png, pdf, ps...)
• Used by many open-source projects: gtk, firefox, webkit, poppler, and so on.
• http://cairographics.org
LinuxCon Brazil 2011 31
Trivia 7
For performance analysis, it is possible to record all the Cairo operations
during execution, and analyze them later using the cairo-perf-trace
utility.
And it is also possible to compare different Cairo backends (x11, egl,
drm, and many others) to see which works better for each case.
Chris Wilson maintains a repository of interesting Cairo traces at
http://cgit.freedesktop.org/cairo-traces/
LinuxCon Brazil 2011 32
Wayland
A hot topic in today‟s Linux graphics world
But what is Wayland?
• New display-server protocol to allow compositing window managers to
communicate between applications and video hardware.
• It is not a reinvention of X11.
• It is not X12.
• It is not a magic silver bullet which will automagically fix all the X11 issues
and problems and provide the answer to life, the universe, and everything.
• (This would be 42, by the way)
• It is Wayland.
LinuxCon Brazil 2011 33
Wayland’s background
Started by Kristian Høgsberg (krh) as a free-time project.
Why?
• X Window System protocol and architecture came from 1980s, and most of
their aspects are not relevant anymore.
• However, we just cannot drop X due to the number of applications and users
out there.
• So, X won‟t go away that soon. Really, it won‟t.
But….
LinuxCon Brazil 2011 34
What is the idea of Wayland?
It is an attempt at getting the best ideas to allow applications to talk to
GPU by the means of compositing server.
- And keep it simple!
LinuxCon Brazil 2011 35
Wayland: how does it work?
Wayland is a protocol for communication between applications and a
compositing manager.
How does it work?
• A compositor runs on top of KMS and EVDEV.
• Applications talk to the compositor using the Wayland protocol.
• Compositor provides a rendering context to the applications (a window).
• Applications do whatever they want with this context, and notify the
compositor when their window contents are updated (or damaged).
• Compositor draws and „composes‟ windows on screen.
• Compositor checks the „scene graph‟ do detect which window should
receive the user input.
• That’s it.
LinuxCon Brazil 2011 36
Wayland: why?
So, why Wayland instead of extending X server?
• X protocol is big.
• X architecture is complex.
• Wayland is tiny.
• Wayland is simple.
• They can co-exist!
• Wayland compositors can run X applications.
• Wayland compositors can run on top of X.
LinuxCon Brazil 2011 37
Trivia 8
It is possible to mix Wayland applications which run from X Window
System with the ones running from the console.
38
Wrapping up…
LinuxCon Brazil 2011 39
So, what are the conclusions?
What is Intel Linux Graphics?
• A stack of open-source graphics projects
• Covers an entire range from the hardware to user-facing applications,
passing through Kernel and middleware libraries
• Fully upstream
• Fully open source
http://www.intellinuxgraphics.org/
• Developed by:
• Intel
• With the help of Redhat, Canonical, Suse, …
• And YOU (the community!)
• How can I contribute or help?
LinuxCon Brazil 2011 40
Contributing
Writing bug reports?
• Yes, there are bugs.
• Yes, there are different bugs.
• And yes, there are bugs which we are not aware of. And we won‟t be aware
of until you tell us!
• http://intellinuxgraphics.org/how_to_report_bug.html
LinuxCon Brazil 2011 41
Contributing 2
Coding and sending patches.
• It is all open source!
• Some Intel employees started this way (Daniel Vetter).
• You can help on a range of projects!
• Kernel patches
• MESA GL extensions
• Cairo patches
• Wayland development – contributors are welcome!
LinuxCon Brazil 2011 42
Contributing 3
Testing
• We have a great QA team.
• We have a huge community.
• We have amazing developers.
• But we don‟t have all the combinations of hardware, distributions, versions,
and their variations.
• If you have an issue, let us know!
• This is how open source community works.
LinuxCon Brazil 2011 43
Contributing 4
Use your creativity!
After all, the source is out there!
LinuxCon Brazil 2011 44
Want to learn more?
Main site: http://www.intellinuxgraphics.org/
Many developers post to the Planet Freedesktop at:
http://planet.freedesktop.org/
I have a blog where I semi-periodically cover everything that happens
within the Intel Linux Graphics land and community at:
http://dodonov.net/blog/category/intel/.
Some exciting news is on the horizon for Intel Linux Graphics.
Stay tuned!
LinuxCon Brazil 2011 45
Legal disclaimer
INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED,
BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED
BY THIS DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS
ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO THIS INFORMATION INCLUDING
LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER
INTELLECTUAL PROPERTY RIGHT.
Performance tests and ratings are measured using specific computer systems and/or components and
reflect the approximate performance of Intel products as measured by those tests. Any difference in
system hardware or software design or configuration may affect actual performance. Buyers should
consult other sources of information to evaluate the performance of systems or components they are
considering purchasing. For more information on performance tests and on the performance of Intel
products, reference www.intel.com/software/products.
Intel®‟s Roadmap Update presentations may contain forward-looking statements and projections. All
statements and projections made that are not historical facts are subject to a number of risks and
uncertainties, and actual results may differ substantially. Please refer to our recent Earnings
Release and Form 10-Q for more information on the Risk Factors that could cause actual results to
differ.
Intel Core and Intel logo are trademarks of Intel Corporation in the U.S. and other countries.
Other names and brands may be claimed as the property of others.
Copyright © 2011 Intel Corporation.