SlideShare a Scribd company logo
1
2
Mesa and its debugging
Vadym Shovkoplias
Andrii Khulap
December 11, 2018
3
Agenda
1. About myself
2. Mesa library
3. Debugging tools
3.1. Mesa environment variables
3.2. Basic debugging tools
3.3. GDB
3.4. Apitrace and Frameretrace
3.5. Steam specifics
44
About myself
5
About my self
Vadym and Andrii have more than 10 years of development experience. The main
specialty of Andrii is the built-in devices and software for them and main
speciality of Vadim is the development of software applications for embedded
systems based on Linux and Android.
850+2000+
1000+
100+
TOP 4
IT-employer of
Ukraine
4 000+
Technology
professionals
350+
Ongoing
projects
25 +
Years in the
Ukrainian market
GlobalLogic
Kharkiv
● GlobalLogic Kharkiv — fastest growing
engineering center in Ukraine
● 30% of our consultants celebrated 5+ years
with Kharkiv GlobalLogic
● 30 active accounts / 80 ongoing projects
Key Domains:
- Medical
- Automotive
- Finance
- Industrial
Horizontal practices:
- Big Data
- Embedded
- Cloud (MS Azure, GCS, AWS)
- Data Science
88
About Mesa
9
Mesa
• Open source project with OpenGL and
Vulkan implementations
• Multi platform support by several
graphics vendors
• Used in Linux, Windows and MacOS
10
Hardware support
• Intel
• AMD
• Nvidia
• Broadcom
• Qualcomm
• VMWare
• Vivante
11
Software drivers
• llvmpipe
Uses LLVM for x86 JIT code generation
and is multi-threaded
• Softpipe
A reference Gallium driver
• Swrast
The legacy/original Mesa software
rasterizer
12
https://mesamatrix.net/
# Driver Extentions OpenGL OpenGL ES
1 mesa (92.6%) 226 4.5 3.2
2 radeonsi (90.2%) 220 4.5 3.1
3 i965 (89.8%) 219 4.5 3.2
4 nvc0 (87.7%) 214 4.5 3.1
5 r600 (81.1%) 198 4.4 3.1
6 softpipe (70.9%) 173 3.3 N/A
7 llvmpipe (64.8%) 158 3.3 N/A
8 nv50 (62.3%) 152 3.3 N/A
9 freedreno (62.3%) 152 3.1 N/A
10 swr (57.8%) 141 3.3 N/A
OpenGL support
13
Development workflow
https://bugs.freedesktop.org/descri
becomponents.cgi?product=Mesa
Bugzilla
https://www.mesa3d.org/lists.html
Mailing lists and IRC
https://www.mesa3d.org/submitting
patches.html
Submitting patches
14
Project statistics
Patches:
Pushed: 67
On review: 51
Rejected: 26
Bugs:
Total: 156
- Debugged/analyzed: 86
- Fixed: 70
1515
Debugging tools
16
Mesa environment variables
Normally, no environment variables need to be set. Most of the environment
variables used by Mesa are for debugging purposes, but they can sometimes
be useful for debugging end-user issues.
Example:
export LIBGL_ALWAYS_SOFTWARE=1 (if set, always use software rendering)
17
Mesa environment variables: Shader dump
18
The basic debugging tool is console output
• Use printf() or fprintf() to output any valuable information
• It will output to the terminal where tested application is started
19
Use static analyzers to find possible causes
• Some bugs or issues can be caused by simple mistakes that can be found by
automated tools.
• Like smatch or cppcheck
For example, smatch warning:
[src/intel/vulkan/anv_nir_apply_pipeline_layout.c:457]: (error)
Possible null pointer dereference: null_data
And the library code itself:
struct anv_push_constants *null_data = NULL;
const struct brw_image_param *image_param = null_data->images;
20
GDB
Building mesa with GDB support
# export CFLAGS='-O0 -ggdb3'
# export CXXFLAGS='-O0 -ggdb3'
# ./autogen.sh --with-gallium-drivers="" --with-dri-drivers=i965
# make -j4
21
You able to debug Mesa even with
comercial apps and games without
debug symbols.
Run the application in GDB:
GDB
22
Run the program with r and receive
a backtrace with bt:
GDB
23
Apitrace is a tool to capture and replay OpenGL calls
24
Frameretrace - view and analyze each render for any frame
25
Renderdoc
26
Piglit is a collection of automated tests for OpenGL
implementations.
• At this moment, there are around 60k tests total. There are performance
(rendering time) test as well as compatibility tests. Test results can be used for
regression testing.
• Useful to check if patch has some side effects on other areas.
• Piglit tests can be run either directly or as a profiles (test sets). Running quick
profile will take around 20 minutes. Profiles like “all” will run for several hours.
• The results will be in json format. But the html (good looking) summaries can also
be created.
27
Steam games specifics - using GDB
• Usually steam games doesn’t contain any debug information. But we still can see
useful backtraces and mesa calls.
• You need to determine game’s PID. Not steam or some launcher/helper.
Use ps -aux for example.
• Then you may easily attach gdb to that process
(gdb) attach 2057
(gdb) continue
28
Steam games specifics - customizing environment
You can configure steam GUI to launch the script with “preparations”:
• Create the script and place it in the /home/${USER}/bin
E.g steam_dbg.sh:
#!/bin/bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/andriy/mesa/lib
"$@" > /home/andriy/steam_game.log
• Go to library, right click on a game and choose “Properties”
• On General tab click “Set launch options”
• Specify the run options: steam_dbg.sh %command%
29
Useful Links
• https://cgit.freedesktop.org/mesa/mesa/
• https://lists.freedesktop.org/mailman/listinfo/mesa-dev
• https://lists.freedesktop.org/mailman/listinfo/piglit
• https://bugs.freedesktop.org/describecomponents.cgi?product=Mesa
• https://fosdem.org/2018/schedule/event/apitrace/
• https://github.com/janesma/apitrace/wiki/frameretrace-branch
30
Thank you
31

More Related Content

PPTX
Html5 devconf nodejs_devops_shubhra
PPTX
1. introduction
PDF
Intro to open source telemetry linux con 2016
PPTX
How to lock a Python in a cage? Managing Python environment inside an R project
PPTX
Skeleton key malware detection owasp
PDF
Managing large scale projects in R with R Suite
PPTX
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
PPTX
Game Engine Code Quality: Is Everything Really That Bad?
Html5 devconf nodejs_devops_shubhra
1. introduction
Intro to open source telemetry linux con 2016
How to lock a Python in a cage? Managing Python environment inside an R project
Skeleton key malware detection owasp
Managing large scale projects in R with R Suite
Make Your and Other Programmer’s Life Easier with Static Analysis (Unreal Eng...
Game Engine Code Quality: Is Everything Really That Bad?

What's hot (10)

PPTX
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
PPTX
GoSF Jan 2016 - Go Write a Plugin for Snap!
PPTX
One Key to Rule Them All: Detecting the Skeleton Key Malware
PPTX
OpenCV acceleration battle:OpenCL on Firefly-RK3288(MALI-T764) vs. FPGA on Ze...
PPTX
Bots on guard of sdlc
PDF
Parser Breakout Session
PDF
Spark summit2014 techtalk - testing spark
PPT
Mod06 new development tools
PDF
Machinekit - Build Real Time Systems with Python
PDF
Snap Telemetry Framework & Plugin Architecture at GrafanaCon 2016
How to Fix Hundreds of Bugs in Legacy Code and Not Die (Unreal Engine 4)
GoSF Jan 2016 - Go Write a Plugin for Snap!
One Key to Rule Them All: Detecting the Skeleton Key Malware
OpenCV acceleration battle:OpenCL on Firefly-RK3288(MALI-T764) vs. FPGA on Ze...
Bots on guard of sdlc
Parser Breakout Session
Spark summit2014 techtalk - testing spark
Mod06 new development tools
Machinekit - Build Real Time Systems with Python
Snap Telemetry Framework & Plugin Architecture at GrafanaCon 2016
Ad

Similar to Mesa and Its Debugging, Вадим Шовкопляс (20)

PPTX
Mesa and Its Debugging
PPTX
Labview1_ Computer Applications in Control_ACRRL
PDF
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
PDF
PDF
Oleksii Moskalenko "Continuous Delivery of ML Pipelines to Production"
PDF
digitaldesign-s20-lecture3b-fpga-afterlecture.pdf
PPTX
C# Production Debugging Made Easy
PDF
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
PDF
An Introduction To Android
PDF
Массовый параллелизм для гетерогенных вычислений на C++ для беспилотных автом...
DOCX
Computer graphics workbook
PDF
Newbie’s guide to_the_gpgpu_universe
PDF
Utilizing AMD GPUs: Tuning, programming models, and roadmap
PDF
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
PDF
Embedded Graphics Drivers in Mesa (ELCE 2019)
PPTX
Simplifying Multi-User SOLIDWORKS Implementations
PDF
Larson and toubro
PDF
“A New, Open-standards-based, Open-source Programming Model for All Accelerat...
PDF
On technology transfer: experience from the CARP project... and beyond
PPTX
Open Standards for ADAS: Andrew Richards, Codeplay, at AutoSens 2016
Mesa and Its Debugging
Labview1_ Computer Applications in Control_ACRRL
Webinar: Começando seus trabalhos com Machine Learning utilizando ferramentas...
Oleksii Moskalenko "Continuous Delivery of ML Pipelines to Production"
digitaldesign-s20-lecture3b-fpga-afterlecture.pdf
C# Production Debugging Made Easy
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
An Introduction To Android
Массовый параллелизм для гетерогенных вычислений на C++ для беспилотных автом...
Computer graphics workbook
Newbie’s guide to_the_gpgpu_universe
Utilizing AMD GPUs: Tuning, programming models, and roadmap
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
Embedded Graphics Drivers in Mesa (ELCE 2019)
Simplifying Multi-User SOLIDWORKS Implementations
Larson and toubro
“A New, Open-standards-based, Open-source Programming Model for All Accelerat...
On technology transfer: experience from the CARP project... and beyond
Open Standards for ADAS: Andrew Richards, Codeplay, at AutoSens 2016
Ad

More from Sigma Software (20)

PPTX
Fast is Best. Using .NET MinimalAPIs
PPTX
"Are you developing or declining? Don't become an IT-dinosaur"
PPTX
Michael Smolin, "Decrypting customer's cultural code"
PPTX
Max Kunytsia, “Why is continuous product discovery better than continuous del...
PPTX
Marcelino Moreno, "Product Management Mindset"
PDF
Andrii Pastushok, "Product Discovery in Outsourcing - What, When, and How"
PPTX
Elena Turkenych “BA vs PM: Who' the right person, for the right job, with the...
PPTX
Eleonora Budanova “BA+PM+DEV team: how to build the synergy”
PPTX
Stoyan Atanasov “How crucial is the BA role in an IT Project"
PPTX
Olexandra Kovalyova, "Equivalence Partitioning, Boundary Values ​​Analysis, C...
PPTX
Yana Lysa — "Decision Tables, State-Transition testing, Pairwase Testing"
PPTX
VOLVO x HACK SPRINT
PPTX
Business digitalization trends and challenges
PPTX
Дмитро Терещенко, "How to secure your application with Secure SDLC"
PPTX
Яна Лиса, “Ефективні методи написання хороших мануальних тестових сценаріїв”
PDF
Тетяна Осетрова, “Модель зрілості розподіленної проектної команди”
PDF
Training solutions and content creation
PDF
False news - false truth: tips & tricks how to avoid them
PPTX
Анна Бойко, "Хороший контракт vs очікування клієнтів. Що вбереже вас, якщо вд...
PPTX
Дмитрий Лапшин, "The importance of TEX and Internal Quality. How explain and ...
Fast is Best. Using .NET MinimalAPIs
"Are you developing or declining? Don't become an IT-dinosaur"
Michael Smolin, "Decrypting customer's cultural code"
Max Kunytsia, “Why is continuous product discovery better than continuous del...
Marcelino Moreno, "Product Management Mindset"
Andrii Pastushok, "Product Discovery in Outsourcing - What, When, and How"
Elena Turkenych “BA vs PM: Who' the right person, for the right job, with the...
Eleonora Budanova “BA+PM+DEV team: how to build the synergy”
Stoyan Atanasov “How crucial is the BA role in an IT Project"
Olexandra Kovalyova, "Equivalence Partitioning, Boundary Values ​​Analysis, C...
Yana Lysa — "Decision Tables, State-Transition testing, Pairwase Testing"
VOLVO x HACK SPRINT
Business digitalization trends and challenges
Дмитро Терещенко, "How to secure your application with Secure SDLC"
Яна Лиса, “Ефективні методи написання хороших мануальних тестових сценаріїв”
Тетяна Осетрова, “Модель зрілості розподіленної проектної команди”
Training solutions and content creation
False news - false truth: tips & tricks how to avoid them
Анна Бойко, "Хороший контракт vs очікування клієнтів. Що вбереже вас, якщо вд...
Дмитрий Лапшин, "The importance of TEX and Internal Quality. How explain and ...

Recently uploaded (20)

PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
System and Network Administraation Chapter 3
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
AI in Product Development-omnex systems
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
System and Network Administration Chapter 2
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Digital Strategies for Manufacturing Companies
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
L1 - Introduction to python Backend.pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
top salesforce developer skills in 2025.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Upgrade and Innovation Strategies for SAP ERP Customers
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
ISO 45001 Occupational Health and Safety Management System
System and Network Administraation Chapter 3
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
AI in Product Development-omnex systems
Understanding Forklifts - TECH EHS Solution
Operating system designcfffgfgggggggvggggggggg
PTS Company Brochure 2025 (1).pdf.......
System and Network Administration Chapter 2
2025 Textile ERP Trends: SAP, Odoo & Oracle
Digital Strategies for Manufacturing Companies
Wondershare Filmora 15 Crack With Activation Key [2025
L1 - Introduction to python Backend.pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Which alternative to Crystal Reports is best for small or large businesses.pdf
top salesforce developer skills in 2025.pdf

Mesa and Its Debugging, Вадим Шовкопляс

  • 1. 1
  • 2. 2 Mesa and its debugging Vadym Shovkoplias Andrii Khulap December 11, 2018
  • 3. 3 Agenda 1. About myself 2. Mesa library 3. Debugging tools 3.1. Mesa environment variables 3.2. Basic debugging tools 3.3. GDB 3.4. Apitrace and Frameretrace 3.5. Steam specifics
  • 5. 5 About my self Vadym and Andrii have more than 10 years of development experience. The main specialty of Andrii is the built-in devices and software for them and main speciality of Vadim is the development of software applications for embedded systems based on Linux and Android.
  • 6. 850+2000+ 1000+ 100+ TOP 4 IT-employer of Ukraine 4 000+ Technology professionals 350+ Ongoing projects 25 + Years in the Ukrainian market
  • 7. GlobalLogic Kharkiv ● GlobalLogic Kharkiv — fastest growing engineering center in Ukraine ● 30% of our consultants celebrated 5+ years with Kharkiv GlobalLogic ● 30 active accounts / 80 ongoing projects Key Domains: - Medical - Automotive - Finance - Industrial Horizontal practices: - Big Data - Embedded - Cloud (MS Azure, GCS, AWS) - Data Science
  • 9. 9 Mesa • Open source project with OpenGL and Vulkan implementations • Multi platform support by several graphics vendors • Used in Linux, Windows and MacOS
  • 10. 10 Hardware support • Intel • AMD • Nvidia • Broadcom • Qualcomm • VMWare • Vivante
  • 11. 11 Software drivers • llvmpipe Uses LLVM for x86 JIT code generation and is multi-threaded • Softpipe A reference Gallium driver • Swrast The legacy/original Mesa software rasterizer
  • 12. 12 https://mesamatrix.net/ # Driver Extentions OpenGL OpenGL ES 1 mesa (92.6%) 226 4.5 3.2 2 radeonsi (90.2%) 220 4.5 3.1 3 i965 (89.8%) 219 4.5 3.2 4 nvc0 (87.7%) 214 4.5 3.1 5 r600 (81.1%) 198 4.4 3.1 6 softpipe (70.9%) 173 3.3 N/A 7 llvmpipe (64.8%) 158 3.3 N/A 8 nv50 (62.3%) 152 3.3 N/A 9 freedreno (62.3%) 152 3.1 N/A 10 swr (57.8%) 141 3.3 N/A OpenGL support
  • 14. 14 Project statistics Patches: Pushed: 67 On review: 51 Rejected: 26 Bugs: Total: 156 - Debugged/analyzed: 86 - Fixed: 70
  • 16. 16 Mesa environment variables Normally, no environment variables need to be set. Most of the environment variables used by Mesa are for debugging purposes, but they can sometimes be useful for debugging end-user issues. Example: export LIBGL_ALWAYS_SOFTWARE=1 (if set, always use software rendering)
  • 18. 18 The basic debugging tool is console output • Use printf() or fprintf() to output any valuable information • It will output to the terminal where tested application is started
  • 19. 19 Use static analyzers to find possible causes • Some bugs or issues can be caused by simple mistakes that can be found by automated tools. • Like smatch or cppcheck For example, smatch warning: [src/intel/vulkan/anv_nir_apply_pipeline_layout.c:457]: (error) Possible null pointer dereference: null_data And the library code itself: struct anv_push_constants *null_data = NULL; const struct brw_image_param *image_param = null_data->images;
  • 20. 20 GDB Building mesa with GDB support # export CFLAGS='-O0 -ggdb3' # export CXXFLAGS='-O0 -ggdb3' # ./autogen.sh --with-gallium-drivers="" --with-dri-drivers=i965 # make -j4
  • 21. 21 You able to debug Mesa even with comercial apps and games without debug symbols. Run the application in GDB: GDB
  • 22. 22 Run the program with r and receive a backtrace with bt: GDB
  • 23. 23 Apitrace is a tool to capture and replay OpenGL calls
  • 24. 24 Frameretrace - view and analyze each render for any frame
  • 26. 26 Piglit is a collection of automated tests for OpenGL implementations. • At this moment, there are around 60k tests total. There are performance (rendering time) test as well as compatibility tests. Test results can be used for regression testing. • Useful to check if patch has some side effects on other areas. • Piglit tests can be run either directly or as a profiles (test sets). Running quick profile will take around 20 minutes. Profiles like “all” will run for several hours. • The results will be in json format. But the html (good looking) summaries can also be created.
  • 27. 27 Steam games specifics - using GDB • Usually steam games doesn’t contain any debug information. But we still can see useful backtraces and mesa calls. • You need to determine game’s PID. Not steam or some launcher/helper. Use ps -aux for example. • Then you may easily attach gdb to that process (gdb) attach 2057 (gdb) continue
  • 28. 28 Steam games specifics - customizing environment You can configure steam GUI to launch the script with “preparations”: • Create the script and place it in the /home/${USER}/bin E.g steam_dbg.sh: #!/bin/bash export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/andriy/mesa/lib "$@" > /home/andriy/steam_game.log • Go to library, right click on a game and choose “Properties” • On General tab click “Set launch options” • Specify the run options: steam_dbg.sh %command%
  • 29. 29 Useful Links • https://cgit.freedesktop.org/mesa/mesa/ • https://lists.freedesktop.org/mailman/listinfo/mesa-dev • https://lists.freedesktop.org/mailman/listinfo/piglit • https://bugs.freedesktop.org/describecomponents.cgi?product=Mesa • https://fosdem.org/2018/schedule/event/apitrace/ • https://github.com/janesma/apitrace/wiki/frameretrace-branch
  • 31. 31