SlideShare a Scribd company logo
1 of 36
Download to read offline
Embedded Graphics
Drivers in Mesa
About GPUs
• It is a specialized electronic circuit designed to
rapidly manipulate and alter memory to accelerate
the creation of images in a frame buffer intended
for output to a display device. Wikipedia.
• They are becoming increasingly general purpose
processors that can run programs (shaders).
• They are highly threaded and typically use SIMD to
operate on multiple inputs at the same time.
• Still contain fixed function pieces for graphics-
specific functions:
• Texture sampling
• Primitive assembly
• etc
Linux graphics stack
based on diagram by Shmuel Csaba Otto Traian; GNU FDL 1.3+ and CC-BY-SA 3.0+; created 2014-03-02, last updated 2015-05-30
System Call Interface (SCI)
Hardware
Linux kernel
Wayland Compositor or
X server
3D
computer
game
DRM
GPU
Mesa 3D
DRM
library Subroutines
Graphics
RAM
Display
controller
KMS
Screen
Game engine
Geometry
data
Texture
data
Sound
data
X11 protocol
Wayland
protocol
or
or
Graphics APIs
• OpenGL 1.0 was released in January 1992 by
Silicon Graphics (SGI).
• Based around SGI hardware of the time which had
very fixed functionality.
• Eg, explicit API to draw a triangle with a colour:
/* Set a blue colour */
glColor3f(0.0f, 0.0f, 1.0f);
/* Draw a triangle, describing its points */
glBegin(GL_TRIANGLES);
glVertex3f(0.0f,1.0f,0.0f);
glVertex3f(-1.0f,-1.0f,0.0f);
glVertex3f(1.0f,-1.0f,0.0f);
glEnd();
• In 2004 OpenGL 2.0 was released.
• Introduced the concept of shaders.
• Can now influence the rendering with programs
called shaders.
• Eg, choose a colour programatically:
void main()
{
/* Choose the colour based on the X-position of the pixel */
gl_FragColor = vec4(gl_FragCoord.x * 0.008 - 1.0, 0.0, 0.0, 1.0);
}
• In later versions of GL more and more functionality
is moved into the programmable shaders.
• Much more programmable, much less fixed-
function.
• Inputs are more often given in buffers rather than
via API calls.
• Eg, vertex data now in a buffer:
# Position Colour
-1 -1 0xff0000ff
0 -1 0xff0000ff
-1 0 0xff0000ff
0 -1 0xff0000ff
-1 0 0xff0000ff
0 0 0xff0000ff
Buffer containing
vertices
glVertexAttribPointer(0, 2, GL_FLOAT,
GL_FALSE, 12, 0);
glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE,
GL_TRUE, 12, 8);
Commands describing
buffer layout
OpenGL ES
• Simplified version of OpenGL targetting embedded
devices.
• Removes most of the legacy cruft and things that
are hard to implement in hardware.
• Is increasingly similar to modern versions of
OpenGL which also try to deprecate old
functionality.
• Vulkan 1.0 released in 2016
• Clean break from legacy OpenGL
• Much less driver overhead
• Everything is specified in buffers
• The application has the responsibility to manage
buffers and synchronisation.
• Harder to use but allows applications to exploit the
hardware better
• Suitable for both embedded and desktop hardware
Mesa
• Open-source implementation of the OpenGL and
Vulkan specifications for a variety of hardware on
user-space as a library.
• The Mesa project was originally started by Brian
Paul.
• Version 1.0 released in February 1995.
• Originally used only software rendering
• Now has support for many different hardware
devices
• Current version is 19.2.
• There are drivers for:
• Intel (i965, i915, anv)
• AMD (radv, radeonsi, r600)
• NVIDIA (nouveau)
• Imagination Technologies (imx)
• Broadcom (vc4, vc5)
• Qualcomm (freedreno)
• Software renderers (classic swrast, softpipe,
llvmpipe, OpenSWR)
• VMware virtual GPU
• Etc
• Supports:
• OpenGL 4.6
• OpenGL ES 3.2
• Vulkan 1.1
• All are the latest versions
• Caveat: not all drivers support the latest version
Architecture of Mesa
GalliumDRI
Mesa
state tracker
Application
i965
Freedreno
Panfrost
nvc0
vc4
r600
Mesa
Drivers
OpenGL
API
Callback interface for
drivers
Shared state tracker
for simpler
driver interface
State tracker to
manage GL API
• Mesa has a loader that selects the driver by asking
for the vendor id, chip id... from the kernel driver
via DRM.
• There is a map of PCI IDs and user-space Mesa
drivers.
• When it is found, Mesa loads the respective driver
and sees if the driver succeeds
• In case of failure, the loader tries software
renderers.
• It is possible to force software renderer
• LIBGL ALWAYS SOFTWARE=1
• The GL API is filtered through the Mesa state
tracker into a simpler set of callbacks into the
driver.
• This handles many things such as GL’s weird
object management.
• Unifies different APIs from different versions of
GL.
• For the i965 Intel driver, these callbacks are
handled directly.
• For most other drivers, Gallium is used as an extra
layer.
• This handles even more state tracking such as
caching state objects.
• Drivers have even less code to implement.
Compiler architecture
GLSL IR
GLSL shader
i965
Freedreno
llvmpipe
radeonsi
vc4
r600
Mesa
Drivers
Abstract syntax
tree
SPIR-V shader
LLVM
TGSINIR
Used in Vulkan
or optionally in
OpenGL 4.6
Shader compiled
to SPIR-V by
application
High-level
intermediate
representation
Lowlevel IR
many optimisations
performed here
IR
used
by
G
allium
External general
compiler project
GLSL example
uniform vec4 args1, args2;
void main()
{
gl_FragColor = log2(args1) + args2;
}
GLSL IR
GLSL IR for native fragment shader 3:
(
(declare (location=2 shader_out ) vec4 gl_FragColor)
(declare (location=0 uniform ) vec4 args1)
(declare (location=1 uniform ) vec4 args2)
( function main
(signature void
(parameters)
(
(assign (xyzw)
(var_ref gl_FragColor)
(expression vec4 + (expression vec4 log2 (var_ref args1) )
(var_ref args2) ) )
))
)
)
NIR
impl main {
block block_0:
/* preds: */
vec1 32 ssa_0 = load_const (0x00000000 /* 0.000000 */)
vec4 32 ssa_1 = intrinsic load_uniform (ssa_0) (0, 16, 160)
vec1 32 ssa_2 = flog2 ssa_1.x
vec1 32 ssa_3 = flog2 ssa_1.y
vec1 32 ssa_4 = flog2 ssa_1.z
vec1 32 ssa_5 = flog2 ssa_1.w
vec4 32 ssa_6 = intrinsic load_uniform (ssa_0) (16, 16, 160)
vec1 32 ssa_7 = fadd ssa_2, ssa_6.x
vec1 32 ssa_8 = fadd ssa_3, ssa_6.y
vec1 32 ssa_9 = fadd ssa_4, ssa_6.z
vec1 32 ssa_10 = fadd ssa_5, ssa_6.w
vec4 32 ssa_11 = vec4 ssa_7, ssa_8, ssa_9, ssa_10
intrinsic store_output (ssa_11, ssa_0) (4, 15, 0, 160)
/* succs: block_1 */
block block_1:
}
Intel i965 instruction set
START B0 (54 cycles)
math log(16) g3<1>F g2<0,1,0>F null<8,8,1>F
math log(16) g5<1>F g2.1<0,1,0>F null<8,8,1>F
math log(16) g7<1>F g2.2<0,1,0>F null<8,8,1>F
math log(16) g9<1>F g2.3<0,1,0>F null<8,8,1>F
add(16) g120<1>F g3<8,8,1>F g2.4<0,1,0>F
add(16) g122<1>F g5<8,8,1>F g2.5<0,1,0>F
add(16) g124<1>F g7<8,8,1>F g2.6<0,1,0>F
add(16) g126<1>F g9<8,8,1>F g2.7<0,1,0>F
sendc(16) null<1>UW g120<8,8,1>UD 0x90031000
render MsgDesc: RT write SIMD16 LastRT mlen 8 rlen 0
END B0
Embedded drivers
Freedreno
• For Qualcomm Adreno devices
• Started by Rob Clark in 2012
• Reversed engineered
• Supports GL 3.1 and GLES 3.1
• Continued development by Google and Igalia
Devices
• Phones/Tablets:
• Nexus 4 (a3xx)
• Nexus 7 Flo (a3xx)
• Pixel 3a (a6xx)
• ARM boards:
• Inforce 6540 (a4xx)
• Inforce 6640 (a5xx)
• bSTem (a3xx)
• apq8074 dragonboard (a3xx)
vc4
• For Broadcom VideoCore IV GPUs
• Used in the Raspberry Pi 3
• Written by Eric Anholt while working at Broadcom
• Developed using the released docs from Broadcom
• Supports OpenGL ES 3.1
• Under continued development including by Igalia
vc3d
• Project to create a driver for the VideoCore VI GPU
in the Rasperry Pi 4
• Very different architecture to the previous one
• Also started by Eric Anholt
• Being continued by Igalia
Panfrost
• For ARM Mali Txxx (Midgard) and Gxx (Bifrost) GPUs
• Used in Chromebooks
• Started by Alyssa Rosenzweig
• Reverse engineered
• Merged into Mesa master
• ARM is now contributing to it too
• Demo from XDC 2019 shows running desktop GL
2.0
• They are looking to support GL 3.0 and Vulkan
Thanks
Questions?

More Related Content

What's hot (9)

Advanced c programming in Linux
Advanced c programming in Linux Advanced c programming in Linux
Advanced c programming in Linux
 
QEMU and Raspberry Pi. Instant Embedded Development
QEMU and Raspberry Pi. Instant Embedded DevelopmentQEMU and Raspberry Pi. Instant Embedded Development
QEMU and Raspberry Pi. Instant Embedded Development
 
Introduction of ISHI-KAI with OpenMPW
Introduction of ISHI-KAI with OpenMPWIntroduction of ISHI-KAI with OpenMPW
Introduction of ISHI-KAI with OpenMPW
 
Gplとの付き合い方
Gplとの付き合い方Gplとの付き合い方
Gplとの付き合い方
 
Lab-1-ROS-Intro.pdf
Lab-1-ROS-Intro.pdfLab-1-ROS-Intro.pdf
Lab-1-ROS-Intro.pdf
 
Real-Time Operating Systems
Real-Time Operating SystemsReal-Time Operating Systems
Real-Time Operating Systems
 
ARM Fundamentals
ARM FundamentalsARM Fundamentals
ARM Fundamentals
 
HSA Kernel Code (KFD v0.6)
HSA Kernel Code (KFD v0.6)HSA Kernel Code (KFD v0.6)
HSA Kernel Code (KFD v0.6)
 
Estimativas em projetos de software
Estimativas em projetos de softwareEstimativas em projetos de software
Estimativas em projetos de software
 

Similar to Embedded Graphics Drivers in Mesa (ELCE 2019)

[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio [Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio Owen Wu
 
The Architecture of Intel Processor Graphics: Gen 11
The Architecture of Intel Processor Graphics: Gen 11The Architecture of Intel Processor Graphics: Gen 11
The Architecture of Intel Processor Graphics: Gen 11DESMOND YUEN
 
The Architecture of 11th Generation Intel® Processor Graphics
The Architecture of 11th Generation Intel® Processor GraphicsThe Architecture of 11th Generation Intel® Processor Graphics
The Architecture of 11th Generation Intel® Processor GraphicsIntel® Software
 
The next generation of GPU APIs for Game Engines
The next generation of GPU APIs for Game EnginesThe next generation of GPU APIs for Game Engines
The next generation of GPU APIs for Game EnginesPooya Eimandar
 
Mesa and Its Debugging, Вадим Шовкопляс
Mesa and Its Debugging, Вадим ШовкоплясMesa and Its Debugging, Вадим Шовкопляс
Mesa and Its Debugging, Вадим ШовкоплясSigma Software
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Prabindh Sundareson
 
Dynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfDynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfAgneshShetty
 
0xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp020xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp02chon2010
 
Seminar presentation on OpenGL
Seminar presentation on OpenGLSeminar presentation on OpenGL
Seminar presentation on OpenGLMegha V
 
NIOS II Processor.ppt
NIOS II Processor.pptNIOS II Processor.ppt
NIOS II Processor.pptAtef46
 
On-going challenges in the Raspberry Pi driver stack – XDC 2023
On-going challenges in the Raspberry Pi driver stack – XDC 2023On-going challenges in the Raspberry Pi driver stack – XDC 2023
On-going challenges in the Raspberry Pi driver stack – XDC 2023Igalia
 
On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...
On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...
On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...Juan A. Suárez Romero
 
[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...
[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...
[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...BeMyApp
 
LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205Linaro
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computingArka Ghosh
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computingArka Ghosh
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computingArka Ghosh
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computingArka Ghosh
 

Similar to Embedded Graphics Drivers in Mesa (ELCE 2019) (20)

[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio [Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
[Unite Seoul 2019] Mali GPU Architecture and Mobile Studio
 
The Architecture of Intel Processor Graphics: Gen 11
The Architecture of Intel Processor Graphics: Gen 11The Architecture of Intel Processor Graphics: Gen 11
The Architecture of Intel Processor Graphics: Gen 11
 
The Architecture of 11th Generation Intel® Processor Graphics
The Architecture of 11th Generation Intel® Processor GraphicsThe Architecture of 11th Generation Intel® Processor Graphics
The Architecture of 11th Generation Intel® Processor Graphics
 
The next generation of GPU APIs for Game Engines
The next generation of GPU APIs for Game EnginesThe next generation of GPU APIs for Game Engines
The next generation of GPU APIs for Game Engines
 
Mesa and Its Debugging, Вадим Шовкопляс
Mesa and Its Debugging, Вадим ШовкоплясMesa and Its Debugging, Вадим Шовкопляс
Mesa and Its Debugging, Вадим Шовкопляс
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011
 
Dynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdfDynamic sorting algorithm vizualizer.pdf
Dynamic sorting algorithm vizualizer.pdf
 
0xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp020xdroid osdc-2010-100426084937-phpapp02
0xdroid osdc-2010-100426084937-phpapp02
 
Seminar presentation on OpenGL
Seminar presentation on OpenGLSeminar presentation on OpenGL
Seminar presentation on OpenGL
 
NIOS II Processor.ppt
NIOS II Processor.pptNIOS II Processor.ppt
NIOS II Processor.ppt
 
On-going challenges in the Raspberry Pi driver stack – XDC 2023
On-going challenges in the Raspberry Pi driver stack – XDC 2023On-going challenges in the Raspberry Pi driver stack – XDC 2023
On-going challenges in the Raspberry Pi driver stack – XDC 2023
 
On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...
On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...
On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...
 
[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...
[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...
[Android Codefest Germany] Adding x86 target to your Android app by Xavier Ha...
 
LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
 
LEGaTO Integration
LEGaTO IntegrationLEGaTO Integration
LEGaTO Integration
 
Programar para GPUs
Programar para GPUsProgramar para GPUs
Programar para GPUs
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
 
Vpu technology &gpgpu computing
Vpu technology &gpgpu computingVpu technology &gpgpu computing
Vpu technology &gpgpu computing
 

More from Igalia

Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JITIgalia
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!Igalia
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerIgalia
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in MesaIgalia
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIgalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera LinuxIgalia
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVMIgalia
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsIgalia
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesIgalia
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSIgalia
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webIgalia
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersIgalia
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...Igalia
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on RaspberryIgalia
 
Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...Igalia
 
Async page flip in DRM atomic API
Async page flip in DRM  atomic APIAsync page flip in DRM  atomic API
Async page flip in DRM atomic APIIgalia
 
From the proposal to ECMAScript – Step by Step
From the proposal to ECMAScript – Step by StepFrom the proposal to ECMAScript – Step by Step
From the proposal to ECMAScript – Step by StepIgalia
 
Migrating Babel from CommonJS to ESM
Migrating Babel     from CommonJS to ESMMigrating Babel     from CommonJS to ESM
Migrating Babel from CommonJS to ESMIgalia
 
The rainbow treasure map: Advanced color management on Linux with AMD/Steam D...
The rainbow treasure map: Advanced color management on Linux with AMD/Steam D...The rainbow treasure map: Advanced color management on Linux with AMD/Steam D...
The rainbow treasure map: Advanced color management on Linux with AMD/Steam D...Igalia
 
Freedreno on Android – XDC 2023
Freedreno on Android          – XDC 2023Freedreno on Android          – XDC 2023
Freedreno on Android – XDC 2023Igalia
 

More from Igalia (20)

Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JIT
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamer
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera Linux
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVM
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devices
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the web
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shaders
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on Raspberry
 
Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...Enable hardware acceleration for GL applications without glamor on Xorg modes...
Enable hardware acceleration for GL applications without glamor on Xorg modes...
 
Async page flip in DRM atomic API
Async page flip in DRM  atomic APIAsync page flip in DRM  atomic API
Async page flip in DRM atomic API
 
From the proposal to ECMAScript – Step by Step
From the proposal to ECMAScript – Step by StepFrom the proposal to ECMAScript – Step by Step
From the proposal to ECMAScript – Step by Step
 
Migrating Babel from CommonJS to ESM
Migrating Babel     from CommonJS to ESMMigrating Babel     from CommonJS to ESM
Migrating Babel from CommonJS to ESM
 
The rainbow treasure map: Advanced color management on Linux with AMD/Steam D...
The rainbow treasure map: Advanced color management on Linux with AMD/Steam D...The rainbow treasure map: Advanced color management on Linux with AMD/Steam D...
The rainbow treasure map: Advanced color management on Linux with AMD/Steam D...
 
Freedreno on Android – XDC 2023
Freedreno on Android          – XDC 2023Freedreno on Android          – XDC 2023
Freedreno on Android – XDC 2023
 

Recently uploaded

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 

Recently uploaded (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 

Embedded Graphics Drivers in Mesa (ELCE 2019)

  • 2. About GPUs • It is a specialized electronic circuit designed to rapidly manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. Wikipedia.
  • 3. • They are becoming increasingly general purpose processors that can run programs (shaders). • They are highly threaded and typically use SIMD to operate on multiple inputs at the same time. • Still contain fixed function pieces for graphics- specific functions: • Texture sampling • Primitive assembly • etc
  • 5. based on diagram by Shmuel Csaba Otto Traian; GNU FDL 1.3+ and CC-BY-SA 3.0+; created 2014-03-02, last updated 2015-05-30 System Call Interface (SCI) Hardware Linux kernel Wayland Compositor or X server 3D computer game DRM GPU Mesa 3D DRM library Subroutines Graphics RAM Display controller KMS Screen Game engine Geometry data Texture data Sound data X11 protocol Wayland protocol or or
  • 7.
  • 8. • OpenGL 1.0 was released in January 1992 by Silicon Graphics (SGI). • Based around SGI hardware of the time which had very fixed functionality. • Eg, explicit API to draw a triangle with a colour: /* Set a blue colour */ glColor3f(0.0f, 0.0f, 1.0f); /* Draw a triangle, describing its points */ glBegin(GL_TRIANGLES); glVertex3f(0.0f,1.0f,0.0f); glVertex3f(-1.0f,-1.0f,0.0f); glVertex3f(1.0f,-1.0f,0.0f); glEnd();
  • 9. • In 2004 OpenGL 2.0 was released. • Introduced the concept of shaders. • Can now influence the rendering with programs called shaders. • Eg, choose a colour programatically: void main() { /* Choose the colour based on the X-position of the pixel */ gl_FragColor = vec4(gl_FragCoord.x * 0.008 - 1.0, 0.0, 0.0, 1.0); }
  • 10. • In later versions of GL more and more functionality is moved into the programmable shaders. • Much more programmable, much less fixed- function. • Inputs are more often given in buffers rather than via API calls. • Eg, vertex data now in a buffer: # Position Colour -1 -1 0xff0000ff 0 -1 0xff0000ff -1 0 0xff0000ff 0 -1 0xff0000ff -1 0 0xff0000ff 0 0 0xff0000ff Buffer containing vertices glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 12, 0); glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, 12, 8); Commands describing buffer layout
  • 11. OpenGL ES • Simplified version of OpenGL targetting embedded devices. • Removes most of the legacy cruft and things that are hard to implement in hardware. • Is increasingly similar to modern versions of OpenGL which also try to deprecate old functionality.
  • 12.
  • 13. • Vulkan 1.0 released in 2016 • Clean break from legacy OpenGL • Much less driver overhead • Everything is specified in buffers • The application has the responsibility to manage buffers and synchronisation. • Harder to use but allows applications to exploit the hardware better • Suitable for both embedded and desktop hardware
  • 14. Mesa
  • 15. • Open-source implementation of the OpenGL and Vulkan specifications for a variety of hardware on user-space as a library. • The Mesa project was originally started by Brian Paul. • Version 1.0 released in February 1995. • Originally used only software rendering • Now has support for many different hardware devices • Current version is 19.2.
  • 16. • There are drivers for: • Intel (i965, i915, anv) • AMD (radv, radeonsi, r600) • NVIDIA (nouveau) • Imagination Technologies (imx) • Broadcom (vc4, vc5) • Qualcomm (freedreno) • Software renderers (classic swrast, softpipe, llvmpipe, OpenSWR) • VMware virtual GPU • Etc
  • 17. • Supports: • OpenGL 4.6 • OpenGL ES 3.2 • Vulkan 1.1 • All are the latest versions • Caveat: not all drivers support the latest version
  • 18.
  • 20. GalliumDRI Mesa state tracker Application i965 Freedreno Panfrost nvc0 vc4 r600 Mesa Drivers OpenGL API Callback interface for drivers Shared state tracker for simpler driver interface State tracker to manage GL API
  • 21. • Mesa has a loader that selects the driver by asking for the vendor id, chip id... from the kernel driver via DRM. • There is a map of PCI IDs and user-space Mesa drivers. • When it is found, Mesa loads the respective driver and sees if the driver succeeds • In case of failure, the loader tries software renderers. • It is possible to force software renderer • LIBGL ALWAYS SOFTWARE=1
  • 22. • The GL API is filtered through the Mesa state tracker into a simpler set of callbacks into the driver. • This handles many things such as GL’s weird object management. • Unifies different APIs from different versions of GL. • For the i965 Intel driver, these callbacks are handled directly. • For most other drivers, Gallium is used as an extra layer. • This handles even more state tracking such as caching state objects. • Drivers have even less code to implement.
  • 24. GLSL IR GLSL shader i965 Freedreno llvmpipe radeonsi vc4 r600 Mesa Drivers Abstract syntax tree SPIR-V shader LLVM TGSINIR Used in Vulkan or optionally in OpenGL 4.6 Shader compiled to SPIR-V by application High-level intermediate representation Lowlevel IR many optimisations performed here IR used by G allium External general compiler project
  • 25. GLSL example uniform vec4 args1, args2; void main() { gl_FragColor = log2(args1) + args2; }
  • 26. GLSL IR GLSL IR for native fragment shader 3: ( (declare (location=2 shader_out ) vec4 gl_FragColor) (declare (location=0 uniform ) vec4 args1) (declare (location=1 uniform ) vec4 args2) ( function main (signature void (parameters) ( (assign (xyzw) (var_ref gl_FragColor) (expression vec4 + (expression vec4 log2 (var_ref args1) ) (var_ref args2) ) ) )) ) )
  • 27. NIR impl main { block block_0: /* preds: */ vec1 32 ssa_0 = load_const (0x00000000 /* 0.000000 */) vec4 32 ssa_1 = intrinsic load_uniform (ssa_0) (0, 16, 160) vec1 32 ssa_2 = flog2 ssa_1.x vec1 32 ssa_3 = flog2 ssa_1.y vec1 32 ssa_4 = flog2 ssa_1.z vec1 32 ssa_5 = flog2 ssa_1.w vec4 32 ssa_6 = intrinsic load_uniform (ssa_0) (16, 16, 160) vec1 32 ssa_7 = fadd ssa_2, ssa_6.x vec1 32 ssa_8 = fadd ssa_3, ssa_6.y vec1 32 ssa_9 = fadd ssa_4, ssa_6.z vec1 32 ssa_10 = fadd ssa_5, ssa_6.w vec4 32 ssa_11 = vec4 ssa_7, ssa_8, ssa_9, ssa_10 intrinsic store_output (ssa_11, ssa_0) (4, 15, 0, 160) /* succs: block_1 */ block block_1: }
  • 28. Intel i965 instruction set START B0 (54 cycles) math log(16) g3<1>F g2<0,1,0>F null<8,8,1>F math log(16) g5<1>F g2.1<0,1,0>F null<8,8,1>F math log(16) g7<1>F g2.2<0,1,0>F null<8,8,1>F math log(16) g9<1>F g2.3<0,1,0>F null<8,8,1>F add(16) g120<1>F g3<8,8,1>F g2.4<0,1,0>F add(16) g122<1>F g5<8,8,1>F g2.5<0,1,0>F add(16) g124<1>F g7<8,8,1>F g2.6<0,1,0>F add(16) g126<1>F g9<8,8,1>F g2.7<0,1,0>F sendc(16) null<1>UW g120<8,8,1>UD 0x90031000 render MsgDesc: RT write SIMD16 LastRT mlen 8 rlen 0 END B0
  • 30. Freedreno • For Qualcomm Adreno devices • Started by Rob Clark in 2012 • Reversed engineered • Supports GL 3.1 and GLES 3.1 • Continued development by Google and Igalia
  • 31. Devices • Phones/Tablets: • Nexus 4 (a3xx) • Nexus 7 Flo (a3xx) • Pixel 3a (a6xx) • ARM boards: • Inforce 6540 (a4xx) • Inforce 6640 (a5xx) • bSTem (a3xx) • apq8074 dragonboard (a3xx)
  • 32. vc4 • For Broadcom VideoCore IV GPUs • Used in the Raspberry Pi 3 • Written by Eric Anholt while working at Broadcom • Developed using the released docs from Broadcom • Supports OpenGL ES 3.1 • Under continued development including by Igalia
  • 33. vc3d • Project to create a driver for the VideoCore VI GPU in the Rasperry Pi 4 • Very different architecture to the previous one • Also started by Eric Anholt • Being continued by Igalia
  • 34. Panfrost • For ARM Mali Txxx (Midgard) and Gxx (Bifrost) GPUs • Used in Chromebooks • Started by Alyssa Rosenzweig • Reverse engineered • Merged into Mesa master • ARM is now contributing to it too • Demo from XDC 2019 shows running desktop GL 2.0 • They are looking to support GL 3.0 and Vulkan
  • 35.