Vous êtes sur la page 1sur 46

Intel Linux Graphics

Following the open source road from Kernel to UI toolkits

Eugeni Dodonov

Intel Linux Graphics

Lets 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?

Lets figure it out

LinuxCon Brazil 2011

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

What Intel Linux Graphics is not?

PowerVR-based cards GMA500, GMA600, or Poulsbo Those are closed-source

LinuxCon Brazil 2011

So, how does this all work?

So, how does this all work?

Lets 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

A long, long time ago, in a galaxy far away

First generation of Intel graphics: i740 i810

7 LinuxCon Brazil 2011

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

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

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

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

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

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 thats about all I can tell you about it. Besides the fact that it is great .


LinuxCon Brazil 2011

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

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


LinuxCon Brazil 2011

Who are the members of the Intel Linux Graphics family?


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

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

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.

FBC, Frame Buffer Compression. Allows the card to compress pixel data prior to sending it to the GPU, using less memory bandwidth.

Semaphores in hardware. Allows for a faster GPU scheduling.


Some are already ON by default, some hopefully will be by the Kernel 3.2 release.
19 LinuxCon Brazil 2011

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.



LinuxCon Brazil 2011

Trivia 4
Did you know that Intel has a set of tools and utilities for managing, monitoring, and having detailed control over the hardware?

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

Trivia 4 - examples



LinuxCon Brazil 2011

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?

23 LinuxCon Brazil 2011

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 doesnt, 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

Mesa 3D


LinuxCon Brazil 2011

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

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

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.
28 LinuxCon Brazil 2011

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

(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

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

A hot topic in todays 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

Waylands background
Started by Kristian Hgsberg (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 wont go away that soon. Really, it wont.



LinuxCon Brazil 2011

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

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.

Thats it.


LinuxCon Brazil 2011

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

Trivia 8
It is possible to mix Wayland applications which run from X Window System with the ones running from the console.


LinuxCon Brazil 2011

Wrapping up


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

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 wont be aware of until you tell us! http://intellinuxgraphics.org/how_to_report_bug.html


LinuxCon Brazil 2011

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

Contributing 3
We have a great QA team. We have a huge community. We have amazing developers. But we dont 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

Contributing 4
Use your creativity!

After all, the source is out there!


LinuxCon Brazil 2011

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

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. Intels 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.

LinuxCon Brazil 2011