strace的用法

http://suzf.net/thread-0512-839.html

sudo su

https://cloud.tencent.com/developer/article/1571948    依赖库

2004  ./tessdemo
 2005  sudo trace-cmd record -p function -P tessdemo
 2006  cp trace.dat  /mnt/share
 2007  cat trace.dat

 

1  ls
    2  ls -all
    3  cd ..
    4  ls
    5  cd /home/yuhang
    6  ls -all
    7  df -h
    8  gparted
    9  gparted --help
   10  fdisk -l
   11  df -h
   12  sudo apt-get autoclean
   13  sudo apt-get clean
   14  sudo apt-get autoremove
   15  sudo find /var/log -type f -mtime +30 -exec rm -f {} \;
   16  du -sh *
   17  ls
   18  ls -all
   19  ls
   20  ls gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
   21  ls gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2  -all
   22  rm -f gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2
   23  ls
   24  cd Downloads/
   25  ls
   26  rm -f jre-for-linux.bin
   27  cd main
   28  cd ..
   29  ls
   30  cd eabi-2016/
   31  ls
   32  df -h
   33  ls -all |grep .
   34  ls -all
   35  cd ..
   36  cd yuhang
   37  ls -all |grep .
   38  ls -all
   39  ls -all |grep .
   40  cd .espressif/
   41  ls
   42  cd ..
   43  ls -all .espressif/
   44  df .espressif/
   45  cd ..
   46  ls
   47  cd yuhang
   48  ls
   49  cd aosp
   50  ls
   51  gparted
   52  reboot
   53  cd debug
   54  ls
   55  cd tracing/
   56  ls
   57  cat available_
   58  cat available_tracers
   59  echo function > current_tracer
   60  cat current_tracer
   61  function
   62  ls
   63  ls events/
   64  trace-cmd report | head -10
   65  apt installl trace-cmd
   66  apt-get installl trace-cmd
   67  ls
   68  cat available_events
   69  ls
   70  cat available_filter_functions
   71  ls
   72  cat error_log
   73  cat printk_formats
   74  ls
   75  cat trace
   76  ls
   77  cp -r ./ /mnt/share
   78  ls
   79  cat trace_pipe
   80  cat trace_pipe |grep drm
   81  cat trace_pipe |grep mesa

 

 

 

 

 

查看ubuntu下gpu命令

zengyuhang@zengyuhang-X556UQK:~$ lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corporation Device 5916 (rev 02)
zengyuhang@zengyuhang-X556UQK:~$ lspci | grep -i nvidia
01:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940MX] (rev a2)
zengyuhang@zengyuhang-X556UQK:~$

 

zengyuhang@zengyuhang-X556UQK:~$ lspci -v -s 01:00.0
01:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940MX] (rev a2)
    Subsystem: ASUSTeK Computer Inc. GM108M [GeForce 940MX]
    Flags: bus master, fast devsel, latency 0, IRQ 128
    Memory at ee000000 (32-bit, non-prefetchable) [size=16M]
    Memory at d0000000 (64-bit, prefetchable) [size=256M]
    Memory at e0000000 (64-bit, prefetchable) [size=32M]
    I/O ports at e000 [size=128]
    Expansion ROM at ef000000 [disabled] [size=512K]
    Capabilities: <access denied>
    Kernel driver in use: nouveau
    Kernel modules: nvidiafb, nouveau

zengyuhang@zengyuhang-X556UQK:~$ lspci -v -s 00:02.0
00:02.0 VGA compatible controller: Intel Corporation Device 5916 (rev 02) (prog-if 00 [VGA controller])
    Subsystem: ASUSTeK Computer Inc. Device 1490
    Flags: bus master, fast devsel, latency 0, IRQ 129
    Memory at ed000000 (64-bit, non-prefetchable) [size=16M]
    Memory at c0000000 (64-bit, prefetchable) [size=256M]
    I/O ports at f000 [size=64]
    [virtual] Expansion ROM at 000c0000 [disabled] [size=128K]
    Capabilities: <access denied>
    Kernel driver in use: i915
    Kernel modules: i915

 

https://www.cnblogs.com/fanblogs/p/11161675.html

编译过程

https://blog.csdn.net/gqb_driver/article/details/8994789  安装opengl

gcc test.c -o bounce  -lGL -lGLU  -lglut -lm

sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev freeglut3-dev


安装依赖库

 

可参考https://gitee.com/yuhang2__2/mesa.git  中的

        build_log.txt     --》  build结果相关的log
        mesa_build_sh.txt    --》  shell记录,安装的相关依赖库
        meson_config.txt     --》  meson配置文件的Log
        pc.txt    --》  dmesg命令

       strace_test.txt   --》 strace使用的log

gdb_mesa.txt  -->   gdb log

 

gdb debug  https://blog.csdn.net/chdhust/article/details/48979283

 

https://www.cnblogs.com/OctoptusLian/p/9871178.html   跑opengl的demo例子

gcc ray.c -o ray  -lGL -lGLU  -lglut -lm

~/Downloads/MesaDemos-7.5/Mesa-7.5/progs/demos$ gcc tessdemo.c -o tessdemo  -lGL -lGLU  -lglut -lm
yuhang@yuhang-VirtualBox:~/Downloads/MesaDemos-7.5/Mesa-7.5/progs/demos$ ./tessdemo
GLU version string: 1.3
Use left mouse button to place vertices.
Press middle mouse button when done.
Select tesselate from the pop-up menu.

 

2033  ls
 2034  gedit ray.c
 2035  gcc -o ray ray.c
 2036  g++ -o ray ray.c
 2037  sudo apt-get install libg11-mesa-dev
 2038  sudo apt-get install libgl1-mesa-dev
 2039  sudo apt-get install libglew-dev
 2040  g++ -o ray ray.c
 2041  sudo apt-get install libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6-dev
 2042  sudo apt-get update
 2043  ls
 2044  gcc teapot.c -o teapot  -lGL -lGLU  -lglut -lm
 2045  gcc ray.c -o ray  -lGL -lGLU  -lglut -lm
 2046  ./ray
 2047  history

 

gdb debug

 

yuhang@yuhang-VirtualBox:~/Downloads/MesaDemos-7.5/Mesa-7.5/progs/demos$ gcc -g  gears.c -o tessdemo  -lGL -lGLU  -lglut -lm
yuhang@yuhang-VirtualBox:~/Downloads/MesaDemos-7.5/Mesa-7.5/progs/demos$ gdb tessdemo
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from tessdemo...done.
(gdb) ls
Undefined command: "ls".  Try "help".
(gdb) bt
No stack.
(gdb) run
Starting program: /home/yuhang/Downloads/MesaDemos-7.5/Mesa-7.5/progs/demos/tessdemo
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffec70c700 (LWP 2354)]
[New Thread 0x7fffebf0b700 (LWP 2355)]
[New Thread 0x7fffeb70a700 (LWP 2356)]
[New Thread 0x7fffeaf09700 (LWP 2357)]
1 frames in  6.269 seconds =  0.160 FPS
1729 frames in  5.001 seconds = 345.731 FPS
1791 frames in  5.002 seconds = 358.057 FPS
1845 frames in  5.001 seconds = 368.926 FPS
1945 frames in  5.003 seconds = 388.767 FPS
1817 frames in  5.000 seconds = 363.400 FPS
1928 frames in  5.000 seconds = 385.600 FPS
1782 frames in  5.000 seconds = 356.400 FPS
2266 frames in  5.006 seconds = 452.657 FPS

bt
2692 frames in  5.000 seconds = 538.400 FPS
2936 frames in  5.000 seconds = 587.200 FPS
2982 frames in  5.000 seconds = 596.400 FPS
2963 frames in  5.001 seconds = 592.482 FPS
1654 frames in  5.000 seconds = 330.800 FPS
ls
2881 frames in  5.001 seconds = 576.085 FPS
^C
Thread 1 "tessdemo" received signal SIGINT, Interrupt.
0x00007ffff29d0918 in lp_rast_shade_quads_mask_sample (
    task=task@entry=0x5555557f1c68, inputs=inputs@entry=0x555555afa670, x=40,
    y=244, mask=65516) at ../src/gallium/drivers/llvmpipe/lp_rast.c:481
481          variant->jit_function[RAST_EDGE_TEST](&state->jit_context,
(gdb) bt
#0  0x00007ffff29d0918 in lp_rast_shade_quads_mask_sample (
    task=task@entry=0x5555557f1c68, inputs=inputs@entry=0x555555afa670, x=40,
    y=244, mask=65516) at ../src/gallium/drivers/llvmpipe/lp_rast.c:481
#1  0x00007ffff29d9039 in do_block_4_32_3 (c=<optimized out>,
    y=<optimized out>, x=<optimized out>, plane=<optimized out>,
    tri=<optimized out>, task=<optimized out>)
    at ../src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h:88
#2  do_block_16_32_3 (c=0x7fffffffd5d0, y=<optimized out>, x=<optimized out>,
    plane=0x7fffffffd670, tri=0x555555afa670, task=0x5555557f1c68)
    at ../src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h:173
#3  lp_rast_triangle_32_3 (task=<optimized out>, arg=...)
    at ../src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h:326
#4  0x00007ffff29cfcdb in do_rasterize_bin (bin=<optimized out>,
    x=<optimized out>, y=<optimized out>, task=<optimized out>)
    at ../src/gallium/drivers/llvmpipe/lp_rast.c:658
#5  rasterize_bin (y=<optimized out>, x=<optimized out>, bin=<optimized out>,
    task=0x5555557f1c68) at ../src/gallium/drivers/llvmpipe/lp_rast.c:677
#6  rasterize_scene (task=0x5555557f1c68, scene=0x7fffea578010)
    at ../src/gallium/drivers/llvmpipe/lp_rast.c:738
#7  0x00007ffff29d0c00 in lp_rast_queue_scene (rast=0x5555557f1c50,
    scene=scene@entry=0x7fffea578010)
    at ../src/gallium/drivers/llvmpipe/lp_rast.c:786
#8  0x00007ffff29e57e8 in lp_setup_rasterize_scene (setup=0x55555584f440)
---Type <return> to continue, or q <return> to quit---
    at ../src/gallium/drivers/llvmpipe/lp_setup.c:181
#9  set_scene_state (setup=setup@entry=0x55555584f440,
    new_state=new_state@entry=SETUP_FLUSHED, reason=<optimized out>)
    at ../src/gallium/drivers/llvmpipe/lp_setup.c:332
#10 0x00007ffff29e60e3 in lp_setup_flush (setup=0x55555584f440, fence=0x0,
    reason=<optimized out>) at ../src/gallium/drivers/llvmpipe/lp_setup.c:361
#11 0x00007ffff2351119 in st_flush (flags=0, fence=0x0, st=<optimized out>)
    at ../src/mesa/state_tracker/st_cb_flush.c:60
#12 st_glFlush (ctx=<optimized out>)
    at ../src/mesa/state_tracker/st_cb_flush.c:101
#13 0x00007ffff7926b0e in glutSwapBuffers ()
   from /usr/lib/x86_64-linux-gnu/libglut.so.3
#14 0x0000555555556a7c in draw () at gears.c:212
#15 0x00007ffff7930194 in ?? () from /usr/lib/x86_64-linux-gnu/libglut.so.3
#16 0x00007ffff7933c39 in fgEnumWindows ()
   from /usr/lib/x86_64-linux-gnu/libglut.so.3
#17 0x00007ffff79307bd in glutMainLoopEvent ()
   from /usr/lib/x86_64-linux-gnu/libglut.so.3
#18 0x00007ffff7930ff5 in glutMainLoop ()
   from /usr/lib/x86_64-linux-gnu/libglut.so.3
#19 0x0000555555557225 in main (argc=1, argv=0x7fffffffdbf8) at gears.c:403
(gdb)
(gdb)
(gdb)

info address -- Describe where symbol SYM is stored
info all-registers -- List of all registers and their contents

(gdb) info all-registers
rax            0x555555afa6c0    93824998155968
rbx            0x7fffea4817e0    140737123981280
rcx            0x1    1
rdx            0x555555afa670    93824998155888
rsi            0x20    32
rdi            0x7fffffffd460    140737488344160
rbp            0x59100    0x59100
rsp            0x7fffffffd3f0    0x7fffffffd3f0
r8             0x555555afa680    93824998155904
r9             0x5555557f1ce8    93824994974952
r10            0x28    40
r11            0xa0    160
r12            0x7fffea4df4a0    140737124365472
r13            0x7fffea578010    140737124990992
r14            0xf4    244
r15            0x5555557f1c68    93824994974824
rip            0x7ffff29d0918    0x7ffff29d0918 <lp_rast_shade_quads_mask_sample+792>
eflags         0x202    [ IF ]
cs             0x33    51
ss             0x2b    43
ds             0x0    0
es             0x0    0
---Type <return> to continue, or q <return> to quit---
fs             0x0    0
gs             0x0    0
st0            0    (raw 0x00000000000000000000)
st1            0    (raw 0x00000000000000000000)
st2            0    (raw 0x00000000000000000000)
st3            0    (raw 0x00000000000000000000)
st4            0    (raw 0x00000000000000000000)
st5            1    (raw 0x3fff8000000000000000)
st6            1    (raw 0x3fff8000000000000000)
st7            3    (raw 0x4000c000000000000000)
fctrl          0x37f    895
fstat          0x0    0
ftag           0xffff    65535
fiseg          0x7fff    32767
fioff          0xed88bf70    -309805200
foseg          0x7fff    32767
fooff          0xffffc0a8    -16216
fop            0x0    0
mxcsr          0x9fe3    [ IE DE PE DAZ IM DM ZM OM UM PM FZ ]
ymm0           {v8_float = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
    0x0, 0x0, 0x0, 0x0}, v4_double = {0x7fffffffffffffff, 0x7fffffffffffffff,
    0x0, 0x0}, v32_int8 = {0x7f <repeats 16 times>, 0x0 <repeats 16 times>},
  v16_int16 = {0x7f7f, 0x7f7f, 0x7f7f, 0x7f7f, 0x7f7f, 0x7f7f, 0x7f7f, 0x7f7f,
---Type <return> to continue, or q <return> to quit---
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0x7f7f7f7f,
    0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {
    0x7f7f7f7f7f7f7f7f, 0x7f7f7f7f7f7f7f7f, 0x0, 0x0}, v2_int128 = {
    0x7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f, 0x0}}
ymm1           {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xad, 0xeb, 0x85, 0x0, 0xad,
    0xb7, 0x7a, 0x0, 0xad, 0x83, 0x6f, 0x0, 0xad, 0x4f, 0x64,
    0x0 <repeats 17 times>}, v16_int16 = {0xebad, 0x85, 0xb7ad, 0x7a, 0x83ad,
    0x6f, 0x4fad, 0x64, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {
    0x85ebad, 0x7ab7ad, 0x6f83ad, 0x644fad, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {
    0x7ab7ad0085ebad, 0x644fad006f83ad, 0x0, 0x0}, v2_int128 = {
    0x644fad006f83ad007ab7ad0085ebad, 0x0}}
ymm2           {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x8000000000000000, 0x8000000000000000, 0x0, 0x0}, v32_int8 = {
    0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f,
    0xff, 0x7f, 0xff, 0x7f, 0x0 <repeats 16 times>}, v16_int16 = {0x7fff,
    0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0x7fff7fff, 0x7fff7fff, 0x7fff7fff,
    0x7fff7fff, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x7fff7fff7fff7fff,
    0x7fff7fff7fff7fff, 0x0, 0x0}, v2_int128 = {
    0x7fff7fff7fff7fff7fff7fff7fff7fff, 0x0}}
ymm3           {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xad, 0xdf, 0x74, 0x0, 0xad,
---Type <return> to continue, or q <return> to quit---
    0xab, 0x69, 0x0, 0xad, 0x77, 0x5e, 0x0, 0xad, 0x43, 0x53,
    0x0 <repeats 17 times>}, v16_int16 = {0xdfad, 0x74, 0xabad, 0x69, 0x77ad,
    0x5e, 0x43ad, 0x53, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {
    0x74dfad, 0x69abad, 0x5e77ad, 0x5343ad, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {
    0x69abad0074dfad, 0x5343ad005e77ad, 0x0, 0x0}, v2_int128 = {
    0x5343ad005e77ad0069abad0074dfad, 0x0}}
ymm4           {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x0 <repeats 32 times>},
  v16_int16 = {0x0 <repeats 16 times>}, v8_int32 = {0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0}, v4_int64 = {0x0, 0x0, 0x0, 0x0}, v2_int128 = {0x0, 0x0}}
ymm5           {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x0, 0x86, 0x8,
    0x0 <repeats 29 times>}, v16_int16 = {0x8600, 0x8,
    0x0 <repeats 14 times>}, v8_int32 = {0x88600, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0}, v4_int64 = {0x88600, 0x0, 0x0, 0x0}, v2_int128 = {0x88600, 0x0}}
ymm6           {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xad, 0xbd, 0x4a,
    0x0 <repeats 29 times>}, v16_int16 = {0xbdad, 0x4a,
    0x0 <repeats 14 times>}, v8_int32 = {0x4abdad, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0}, v4_int64 = {0x4abdad, 0x0, 0x0, 0x0}, v2_int128 = {0x4abdad,
    0x0}}
ymm7           {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xad, 0x25, 0x61,
---Type <return> to continue, or q <return> to quit---
    0x0 <repeats 29 times>}, v16_int16 = {0x25ad, 0x61,
    0x0 <repeats 14 times>}, v8_int32 = {0x6125ad, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0}, v4_int64 = {0x6125ad, 0x0, 0x0, 0x0}, v2_int128 = {0x6125ad,
    0x0}}
ymm8           {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x8000000000000000, 0x8000000000000000, 0x0, 0x0}, v32_int8 = {
    0x0, 0x18, 0xc1, 0xff, 0x0, 0x18, 0xc1, 0xff, 0x0, 0x18, 0xc1, 0xff, 0x0,
    0x18, 0xc1, 0xff, 0x0 <repeats 16 times>}, v16_int16 = {0x1800, 0xffc1,
    0x1800, 0xffc1, 0x1800, 0xffc1, 0x1800, 0xffc1, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0}, v8_int32 = {0xffc11800, 0xffc11800, 0xffc11800,
    0xffc11800, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0xffc11800ffc11800,
    0xffc11800ffc11800, 0x0, 0x0}, v2_int128 = {
    0xffc11800ffc11800ffc11800ffc11800, 0x0}}
ymm9           {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x0, 0x8000000000000000, 0x0, 0x0}, v32_int8 = {0xff, 0xff,
    0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
    0xff, 0x0 <repeats 16 times>}, v16_int16 = {0xffff, 0xffff, 0x0, 0x0,
    0xffff, 0xffff, 0xffff, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v8_int32 = {0xffffffff, 0x0, 0xffffffff, 0xffffffff, 0x0, 0x0, 0x0, 0x0},
  v4_int64 = {0xffffffff, 0xffffffffffffffff, 0x0, 0x0}, v2_int128 = {
    0xffffffffffffffff00000000ffffffff, 0x0}}
ymm10          {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x8000000000000000, 0x8000000000000000, 0x0, 0x0}, v32_int8 = {
---Type <return> to continue, or q <return> to quit---
    0xff <repeats 16 times>, 0x0 <repeats 16 times>}, v16_int16 = {0xffff,
    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0xffffffff, 0xffffffff, 0xffffffff,
    0xffffffff, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0xffffffffffffffff,
    0xffffffffffffffff, 0x0, 0x0}, v2_int128 = {
    0xffffffffffffffffffffffffffffffff, 0x0}}
ymm11          {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x8000000000000000, 0x8000000000000000, 0x0, 0x0}, v32_int8 = {
    0xff <repeats 16 times>, 0x0 <repeats 16 times>}, v16_int16 = {0xffff,
    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0xffffffff, 0xffffffff, 0xffffffff,
    0xffffffff, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0xffffffffffffffff,
    0xffffffffffffffff, 0x0, 0x0}, v2_int128 = {
    0xffffffffffffffffffffffffffffffff, 0x0}}
ymm12          {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x8000000000000000, 0x8000000000000000, 0x0, 0x0}, v32_int8 = {
    0xff <repeats 16 times>, 0x0 <repeats 16 times>}, v16_int16 = {0xffff,
    0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0xffffffff, 0xffffffff, 0xffffffff,
    0xffffffff, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0xffffffffffffffff,
    0xffffffffffffffff, 0x0, 0x0}, v2_int128 = {
    0xffffffffffffffffffffffffffffffff, 0x0}}
ymm13          {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
---Type <return> to continue, or q <return> to quit---
  v4_double = {0x8000000000000000, 0x8000000000000000, 0x0, 0x0}, v32_int8 = {
    0x0, 0xda, 0xd8, 0xe3, 0x0, 0xd8, 0xdf, 0xe3, 0x0, 0xfe, 0xdc, 0xe3, 0x0,
    0xfc, 0xe3, 0xe3, 0x0 <repeats 16 times>}, v16_int16 = {0xda00, 0xe3d8,
    0xd800, 0xe3df, 0xfe00, 0xe3dc, 0xfc00, 0xe3e3, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0}, v8_int32 = {0xe3d8da00, 0xe3dfd800, 0xe3dcfe00,
    0xe3e3fc00, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0xe3dfd800e3d8da00,
    0xe3e3fc00e3dcfe00, 0x0, 0x0}, v2_int128 = {
    0xe3e3fc00e3dcfe00e3dfd800e3d8da00, 0x0}}
ymm14          {v8_float = {0x1, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x0, 0x0, 0x80, 0x3f, 0x0,
    0x0, 0x80, 0x3f, 0x0, 0x0, 0x80, 0x3f, 0x0, 0x0, 0x80, 0x3f,
    0x0 <repeats 16 times>}, v16_int16 = {0x0, 0x3f80, 0x0, 0x3f80, 0x0,
    0x3f80, 0x0, 0x3f80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {
    0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000, 0x0, 0x0, 0x0, 0x0},
  v4_int64 = {0x3f8000003f800000, 0x3f8000003f800000, 0x0, 0x0}, v2_int128 = {
    0x3f8000003f8000003f8000003f800000, 0x0}}
ymm15          {v8_float = {0x2c, 0x2c, 0x2c, 0x2c, 0x0, 0x0, 0x0, 0x0},
  v4_double = {0x1000004230, 0x1000004230, 0x0, 0x0}, v32_int8 = {0x0, 0x0,
    0x30, 0x42, 0x0, 0x0, 0x30, 0x42, 0x0, 0x0, 0x30, 0x42, 0x0, 0x0, 0x30,
    0x42, 0x0 <repeats 16 times>}, v16_int16 = {0x0, 0x4230, 0x0, 0x4230, 0x0,
    0x4230, 0x0, 0x4230, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {
    0x42300000, 0x42300000, 0x42300000, 0x42300000, 0x0, 0x0, 0x0, 0x0},
  v4_int64 = {0x4230000042300000, 0x4230000042300000, 0x0, 0x0}, v2_int128 = {
---Type <return> to continue, or q <return> to quit---
    0x42300000423000004230000042300000, 0x0}}

info args -- Argument variables of current stack frame

(gdb) info args
task = 0x5555557f1c68
inputs = 0x555555afa670
x = 40
y = 244
mask = 65516

 

info auto-load -- Print current status of auto-loaded files

(gdb) info auto-load
gdb-scripts:  No auto-load scripts.
libthread-db:  No auto-loaded libthread-db.
local-gdbinit:  Local .gdbinit file was not found.
python-scripts:  
Loaded  Script                                                                 
Yes     /usr/share/gdb/auto-load/lib/x86_64-linux-gnu/libpthread-2.27.so-gdb.py
Yes     /usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25-gdb.py

 

info auxv -- Display the inferior's auxiliary vector

(gdb) info auxv
33   AT_SYSINFO_EHDR      System-supplied DSO's ELF header 0x7ffff7ffb000
16   AT_HWCAP             Machine-dependent CPU capability hints 0x178bfbff
6    AT_PAGESZ            System page size               4096
17   AT_CLKTCK            Frequency of times()           100
3    AT_PHDR              Program headers for program    0x555555554040
4    AT_PHENT             Size of program header entry   56
5    AT_PHNUM             Number of program headers      9
7    AT_BASE              Base address of interpreter    0x7ffff7dd3000
8    AT_FLAGS             Flags                          0x0
9    AT_ENTRY             Entry point of program         0x555555555480
11   AT_UID               Real user ID                   1000
12   AT_EUID              Effective user ID              1000
13   AT_GID               Real group ID                  1000
14   AT_EGID              Effective group ID             1000
23   AT_SECURE            Boolean, was exec setuid-like? 0
25   AT_RANDOM            Address of 16 random bytes     0x7fffffffdf49
26   AT_HWCAP2            Extension of AT_HWCAP          0x0
31   AT_EXECFN            File name of executable        0x7fffffffefb5 "/home/yuhang/Downloads/MesaDemos-7.5/Mesa-7.5/progs/demos/tessdemo"
15   AT_PLATFORM          String identifying platform    0x7fffffffdf59 "x86_64"
0    AT_NULL              End of vector                  0x0

 

info bookmarks -- Status of user-settable bookmarks


info breakpoints -- Status of specified breakpoints (all user-settable breakpoints if no argument)
info checkpoints -- IDs of currently known checkpoints
info classes -- All Objective-C classes
info common -- Print out the values contained in a Fortran COMMON block
info copying -- Conditions for redistributing copies of GDB
info dcache -- Print information on the dcache performance

(gdb) info dcache
Dcache 4096 lines of 64 bytes each.
Contains data for Thread 0x7ffff7fd0740 (LWP 2350)
Line 0: address 0x7fffffffd400 [59 hits]
Line 1: address 0x7fffffffd440 [39 hits]
Line 2: address 0x7fffffffd500 [151 hits]
Line 3: address 0x7fffffffd540 [7 hits]
Line 4: address 0x7fffffffd580 [15 hits]
Line 5: address 0x7fffffffd6c0 [111 hits]
Line 6: address 0x7fffffffd700 [15 hits]
Line 7: address 0x7fffffffd740 [103 hits]
Line 8: address 0x7fffffffd780 [55 hits]
Line 9: address 0x7fffffffd7c0 [111 hits]
Line 10: address 0x7fffffffd800 [31 hits]
Line 11: address 0x7fffffffd840 [31 hits]
Line 12: address 0x7fffffffd880 [31 hits]
Line 13: address 0x7fffffffda00 [31 hits]
Line 14: address 0x7fffffffdac0 [39 hits]
Line 15: address 0x7fffffffdb00 [35 hits]
Cache state: 16 active lines, 864 hits

 

info display -- Expressions to display when program stops
info exceptions -- List all Ada exception names


info extensions -- All filename extensions associated with a source language
info files -- Names of targets and files being debugged

(gdb) info files
Symbols from "/home/yuhang/Downloads/MesaDemos-7.5/Mesa-7.5/progs/demos/tessdemo".
Native process:
    Using the running image of child Thread 0x7ffff7fd0740 (LWP 2350).
    While running this, GDB does not access memory from...
Local exec file:
    `/home/yuhang/Downloads/MesaDemos-7.5/Mesa-7.5/progs/demos/tessdemo',
        file type elf64-x86-64.
    Entry point: 0x555555555480
    0x0000555555554238 - 0x0000555555554254 is .interp
    0x0000555555554254 - 0x0000555555554274 is .note.ABI-tag
    0x0000555555554274 - 0x0000555555554298 is .note.gnu.build-id
    0x0000555555554298 - 0x00005555555542d4 is .gnu.hash
    0x00005555555542d8 - 0x0000555555554860 is .dynsym
    0x0000555555554860 - 0x0000555555554b56 is .dynstr
    0x0000555555554b56 - 0x0000555555554bcc is .gnu.version

 

info float -- Print the status of the floating point unit

(gdb) info float
  R7: Empty   0x4000c000000000000000
  R6: Empty   0x3fff8000000000000000
  R5: Empty   0x3fff8000000000000000
  R4: Empty   0x00000000000000000000
  R3: Empty   0x00000000000000000000
  R2: Empty   0x00000000000000000000
  R1: Empty   0x00000000000000000000
=>R0: Empty   0x00000000000000000000

Status Word:         0x0000                                            
                       TOP: 0
Control Word:        0x037f   IM DM ZM OM UM PM
                       PC: Extended Precision (64-bits)
                       RC: Round to nearest
Tag Word:            0xffff
Instruction Pointer: 0x7fff:0xed88bf70
Operand Pointer:     0x7fff:0xffffc0a8
Opcode:              0x0000

 

info frame -- All about selected stack frame

(gdb) info frame
Stack level 0, frame at 0x7fffffffd530:
 rip = 0x7ffff29d0918 in lp_rast_shade_quads_mask_sample
    (../src/gallium/drivers/llvmpipe/lp_rast.c:481); saved rip = 0x7ffff29d9039
 called by frame at 0x7fffffffd700
 source language c.
 Arglist at 0x7fffffffd3e8, args: task=task@entry=0x5555557f1c68,
    inputs=inputs@entry=0x555555afa670, x=40, y=244, mask=65516
 Locals at 0x7fffffffd3e8, Previous frame's sp is 0x7fffffffd530
 Saved registers:
  rbx at 0x7fffffffd4f8, rbp at 0x7fffffffd500, r12 at 0x7fffffffd508,
  r13 at 0x7fffffffd510, r14 at 0x7fffffffd518, r15 at 0x7fffffffd520,
  rip at 0x7fffffffd528

Reading symbols from tessdemo...done.
(gdb) start
Temporary breakpoint 1 at 0x3181: file gears.c, line 388.
Starting program: /home/yuhang/Downloads/MesaDemos-7.5/Mesa-7.5/progs/demos/tessdemo
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdbf8) at gears.c:388
388      glutInit(&argc, argv);

(gdb) next 100
[New Thread 0x7fffec70c700 (LWP 3137)]
[New Thread 0x7fffebf0b700 (LWP 3138)]
[New Thread 0x7fffeb70a700 (LWP 3139)]
[New Thread 0x7fffeaf09700 (LWP 3140)]
1 frames in 14.224 seconds =  0.070 FPS
1515 frames in  5.001 seconds = 302.939 FPS
2352 frames in  5.002 seconds = 470.212 FPS
2431 frames in  5.006 seconds = 485.617 FPS
1642 frames in  5.001 seconds = 328.334 FPS
2508 frames in  5.001 seconds = 501.500 FPS
1558 frames in  5.003 seconds = 311.413 FPS
2332 frames in  5.004 seconds = 466.027 FPS
2113 frames in  5.017 seconds = 421.168 FPS
2173 frames in  5.000 seconds = 434.600 FPS
2630 frames in  5.000 seconds = 526.000 FPS
^C
Thread 1 "tessdemo" received signal SIGINT, Interrupt.
0x00007ffff29cb710 in llvmpipe_get_format_alignment (format=<optimized out>)
    at ../src/gallium/drivers/llvmpipe/lp_texture.c:718
718          size += desc->channel[i].size;

 

info frame-filter -- List all registered Python frame-filters
info functions -- All function names
---Type <return> to continue, or q <return> to quit---
info guile -- Prefix command for Guile info displays
info handle -- What debugger does when program gets various signals
info inferiors -- IDs of specified inferiors (all inferiors if no argument)
info line -- Core addresses of the code for a source line
info locals -- Local variables of current stack frame
info macro -- Show the definition of MACRO
info macros -- Show the definitions of all macros at LINESPEC
info mem -- Memory region attributes
info os -- Show OS data ARG
info pretty-printer -- GDB command to list all registered pretty-printers
info probes -- Show available static probes
info proc -- Show /proc process information about any running process
info program -- Execution status of the program
info record -- Info record options
info registers -- List of integer registers and their contents
info scope -- List the variables local to a scope
info selectors -- All Objective-C selectors
info set -- Show all GDB settings
info sharedlibrary -- Status of loaded shared object libraries
info signals -- What debugger does when program gets various signals
info skip -- Display the status of skips
info source -- Information about the current source file
info sources -- Source files in the program
---Type <return> to continue, or q <return> to quit---
info stack -- Backtrace of the stack
info static-tracepoint-markers -- List target static tracepoints markers
info symbol -- Describe what symbol is at location ADDR
info target -- Names of targets and files being debugged
info tasks -- Provide information about all known Ada tasks
info terminal -- Print inferior's saved terminal status
info threads -- Display currently known threads

(gdb) info threads
  Id   Target Id         Frame
* 1    Thread 0x7ffff7fd0740 (LWP 2350) "tessdemo" 0x00007ffff29d0918 in lp_rast_shade_quads_mask_sample (task=task@entry=0x5555557f1c68,
    inputs=inputs@entry=0x555555afa670, x=40, y=244, mask=65516)
    at ../src/gallium/drivers/llvmpipe/lp_rast.c:481
  2    Thread 0x7fffec70c700 (LWP 2354) "tessdem:disk$0" 0x00007ffff4731ad3 in futex_wait_cancelable (private=<optimized out>, expected=0,
    futex_word=0x5555557ef218)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  3    Thread 0x7fffebf0b700 (LWP 2355) "tessdem:disk$1" 0x00007ffff4731ad3 in futex_wait_cancelable (private=<optimized out>, expected=0,
    futex_word=0x5555557ef218)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  4    Thread 0x7fffeb70a700 (LWP 2356) "tessdem:disk$2" 0x00007ffff4731ad3 in futex_wait_cancelable (private=<optimized out>, expected=0,
    futex_word=0x5555557ef218)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
  5    Thread 0x7fffeaf09700 (LWP 2357) "tessdem:disk$3" 0x00007ffff4731ad3 in futex_wait_cancelable (private=<optimized out>, expected=0,
    futex_word=0x5555557ef218)
    at ../sysdeps/unix/sysv/linux/futex-internal.h:88
info tracepoints -- Status of specified tracepoints (all tracepoints if no argument)
info tvariables -- Status of trace state variables and their values
info type-printers -- GDB command to list all registered type-printers
info types -- All type names
info unwinder -- GDB command to list unwinders
info variables -- All global and static variable names
info vector -- Print the status of the vector unit
info vtbl -- Show the virtual function table for a C++ object
info warranty -- Various kinds of warranty you do not have
info watchpoints -- Status of specified watchpoints (all watchpoints if no argument)
info win -- List of all displayed windows
info xmethod -- GDB command to list registered xmethod matchers

 

介绍

Mesa项目开始时是OpenGL规范的开源实现, OpenGL规范是一种用于渲染交互式3D图形的系统。

多年来,该项目已发展为实现更多图形API,包括OpenGL ESOpenCLOpenMAXVDPAUVA API, XvMCVulkanEGL

多种设备驱动程序允许Mesa库在许多不同的环境中使用,从软件仿真到现代GPU的完整硬件加速。

Mesa与其他几个开源项目相关:Direct Rendering InfrastructureX.org,以在Linux,FreeBSD和其他操作系统上提供OpenGL支持。

项目历史

Mesa项目最初由Brian Paul启动。这是该项目的简短历史。

1993年8月:我在业余时间开始从事Mesa工作。该项目当时没有名称。我只是对编写一个使用当时新的OpenGL API的简单3D图形库感兴趣。我部分地受到了VOGL库的启发,该库模拟了IRIS GL的一个子集。自1991年以来,我一直在IRIS GL进行编程。

1994年11月:我与SGI联系,以寻求在互联网上分发我的类似OpenGL的图形库的许可。SGI普遍接受这个想法,在与SGI法律部门协商后,我获得了发布它的许可。

1995年2月:Mesa 1.0在互联网上发布。我希望会有几个人对此感兴趣,但不会成千上万。我很快就会每天收到补丁,新功能和感谢信。这鼓励了我继续从事Mesa工作。有一天,梅萨这个名字突然出现在我的脑海。SGI要求我不要在项目名称中使用术语 “ Open”“ GL”,并且我不想使用新的缩写。后来,我听说了NeXTStep的Mesa编程语言和Mesa电子表格。

在早期,OpenGL在很多系统上都不可用。SGI甚至花了一些时间才能在整个产品线中提供支持。梅萨在那段时间填补了一个大漏洞。对于很多人来说,Mesa是他们对OpenGL的第一个介绍。我认为SGI意识到Mesa实际上有助于推广OpenGL API,因此他们并没有受到该项目的威胁。

1995-1996年:我在业余时间和在麦迪逊威斯康星大学的空间科学与工程中心工作期间继续从事Mesa的研究。我的主管Bill Hibbard允许我这样做,因为Mesa现在正在用于 Vis5D项目。

1996年10月:Mesa 2.0发布。它实现了OpenGL 1.1规范。

1997年3月:Mesa 2.2发布。它通过Glide库支持新的3dfx Voodoo图形卡。它是第一个真正流行的Linux硬件OpenGL实现。

1998年9月:Mesa 3.0发布。这是OpenGL 1.2 API的第一个公开可用的实现。

1999年3月:我参加了第一次OpenGL ARB会议。多年来,我为一些官方OpenGL扩展的开发做出了贡献。

1999年9月:我被Precision Insight,Inc.聘用。Mesa是XFree86新DRI项目中3D硬件加速的关键组成部分。3dfx,3dLabs,Intel,Matrox和ATI硬件的驱动程序即将推出。

2001年10月:Mesa 4.0发布。它实现了OpenGL 1.3规范。

2001年11月:我与Keith Whitwell,Jens Owen,David Dawes和Frank LaMonica共同创立了Tungsten Graphics,Inc.。Tungsten Graphics在2008年12月被VMware收购。

2002年11月:Mesa 5.0发布。它实现了OpenGL 1.4规范。

2003年1月:Mesa 6.0发布。它实现了OpenGL 1.5规范以及GL_ARB_vertex_program和GL_ARB_fragment_program扩展。

2007年6月:Mesa 7.0发布,实现了OpenGL 2.1规范和OpenGL Shading Language。

2008年:Keith Whitwell和其他Tungsten Graphics员工开发了 -一种新的GPU抽象层。最新的Mesa驱动程序基于Gallium,而其他API(例如OpenVG)则在Gallium之上实现。

2012年2月:Mesa 8.0发布,实现了OpenGL 3.0规范和OpenGL Shading Language版本1.30。

2016年7月:Mesa 12.0发布,包括OpenGL 4.3支持和对Vulkan for Intel GPU的初始支持。另外,还有另一个基于LLVM的并由Intel开发的Gallium软件驱动程序(“ swr”)。

正在进行中:Mesa是OpenGL实施,适用于由Intel,AMD,NVIDIA,Qualcomm,Broadcom,Vivante以及VMware和VirGL虚拟GPU设计的设备。还有几种基于软件的渲染器:swrast(旧的Mesa光栅化器),softpipe(镓参考驱动器),llvmpipe(基于LLVM / JIT的高速光栅化器)和swr(另一个基于LLVM的驱动器)。

驱动程序和Mesa核心的工作仍在继续,以实现OpenGL,Op​​enGL ES和Vulkan规范的更新版本。

平台和驱动程序

Mesa主要是在Linux系统上开发和使用的。但是也支持Windows,其他类型的Unix和其他系统,例如Haiku。我们正在积极开发和维护多个硬件和软件驱动程序。

主要API是OpenGL,但也支持OpenGL ES 1,ES2和ES 3,OpenCL,VDPAU,XvMC和EGL接口。

硬件驱动程序包括:

软件驱动程序包括:

  • llvmpipe-使用LLVM生成x86 JIT代码并具有多线程

  • softpipe-参考镓驱动程序

  • svga -VMware虚拟GPU的驱动程序

  • swr-针对可视化工作负载进行了x86优化的软件渲染器

  • virgl-为qemu访客提供加速图形的研究项目

  • swrast-旧版/原始版Mesa软件光栅化器

其他驱动程序信息:

不推荐使用的系统和驱动程序

过去,还有其他用于较旧的GPU和操作系统的驱动程序。这些已从Mesa源树和分发中删除。但是,如果有人感兴趣,可以在Git存储库中找到该代码。该列表包括:

  • 3dfx/glide

  • Matrox

  • ATI R128

  • Savage

  • VIA Unichrome

  • SIS

  • 3Dlabs gamma

  • DOS

  • fbdev

  • DEC/VMS

  • Mach64

  • Intel i810

许可和版权

免责声明

Mesa是带有API的3-D图形库,它与OpenGL 1非常相似。就Mesa利用OpenGL命令语法或状态机的程度而言,它已获得Silicon Graphics,Inc.(SGI)的授权使用。但是,作者不拥有SGI的OpenGL许可证,也没有声称Mesa在任何方面都是OpenGL的兼容替代品或与SGI相关联的。那些想要OpenGL的许可实现的人应该联系许可的供应商。

请不要将库称为MesaGL(出于法律原因)。它只是MesaMesa 3-D图形库

1个

OpenGL是Silicon Graphics Incorporated的商标。

经常问的问题

上次更新时间:2018年9月19日

1.高级问答

1.1什么是Mesa?

Mesa是OpenGL规范的开源实现。OpenGL是用于编写交互式3D应用程序的编程库。有关更多信息,请参见OpenGL网站

Mesa 9.x支持OpenGL 3.1规范。

1.2 Mesa是否支持/使用图形硬件?

是。具体来说,Mesa充当X.org的开源DRI驱动程序的OpenGL核心。

1.3 Mesa今天有什么目的?

硬件加速的OpenGL实现可用于当今大多数流行的操作系统。不过,Mesa至少可以达到以下目的:

  • Mesa被用作开源X.org DRI硬件驱动程序的核心。

  • Mesa非常便于移植,并允许在没有其他OpenGL解决方案的系统上使用OpenGL。

  • 使用Mesa进行软件渲染可作为验证硬件驱动程序的参考。

  • OpenGL的软件实现对于实验非常有用,例如测试新的渲染技术。

  • Mesa可以使用深色彩通道渲染图像:支持16位整数和32位浮点色彩通道。此功能现在仅出现在硬件中。

  • Mesa的内部限制(最大灯光,剪辑平面,纹理大小等)可以根据特殊需要进行更改(很难克服硬件限制)。

1.4“ Stand-Alone” Mesa和DRI驱动程序有什么区别?

独立的MesaMesa的原始版本。在运行X Window系统的系统上,它通过Xlib API进行所有渲染:

  • 支持GLX API,但这实际上只是对真实事物的模拟。

  • 不支持GLX有线协议,并且X服务器未加载OpenGL扩展。

  • 没有硬件加速。

  • OpenGL库libGL.so包含所有内容(编程API,GLX函数和所有渲染代码)。

另外,Mesa充当DRI(直接渲染基础结构)中许多OpenGL硬件驱动程序的核心:

  • libGL.so库提供GL和GLX API函数,一个GLX协议编码器和一个设备驱动程序加载器。

  • 设备驱动程序模块(例如r200_dri.so)包含核心Mesa代码的内置副本。

  • X服务器将加载GLX模块。GLX模块解码传入的GLX协议,并将命令分派给呈现模块。对于DRI,此模块基本上是软件Mesa渲染器。

1.5如何升级我的DRI安装以使用新的Mesa版本?

过去这并不容易。现在,DRI驱动程序包含在Mesa树中,并且可以与X服务器分开编译。只需按照Mesa编译说明进行操作即可

1.6是否还有其他OpenGL的开源实现?

是的,可以使用SGI的OpenGL示例实现(SI) 。SI是在OpenGL最初设计时编写的。不幸的是,SI的发展停滞了。Mesa具有现代功能和扩展功能,是最新的。

Vincent是用于移动设备的OpenGL ES的开源实现。

miniGL 是用于PalmOS设备的OpenGL的子集。该网站已消失,但仍可在sourceforge.net上找到源代码 。

TinyGL是OpenGL的子集。

SoftGL是移动设备的OpenGL子集。

Chromium不是传统的OpenGL实现(它位​​于OpenGL之上),但是确实导出了OpenGL API。它允许平铺渲染,最后排序渲染等。

ClosedGL 是TI图形计算器的OpenGL子集库。

可能还有其他开放的OpenGL实现,但是Mesa是最受欢迎的功能齐全的。

2.编译和安装问题

2.1安装Mesa的最简单方法是什么?

如果您使用的是基于Linux的系统,则您的发行CD最有可能已经具有可以轻松安装的Mesa软件包(例如RPM或DEB)。

2.2我得到未定义的符号,例如bgnpolygon,v3f等…

您的应用程序是使用IRIS GL而不是OpenGL编写的。IRIS GL是OpenGL的前身,并且(几乎)完全是另一回事。Mesa不是解决方案。

2.3 GLUT库在哪里?

GLUT(OpenGL实用工具包)不再位于单独的 MesaGLUT-x.y.z.tar.gz文件中。如果尚未安装GLUT,则应该获取 freeglut

2.4 GLw库在哪里?

GLw(OpenGL小部件库)现在可从单独的git仓库中获得。除非您在OpenGL中使用非常老的Xt / Motif应用程序,否则不需要它。

2.5库和标头的正确位置是什么?

在基于Linux的系统上,您需要遵循Linux ABI标准。基本上,您需要以下内容:

/usr/include/GL/gl.h

主要的OpenGL标头

/usr/include/GL/glu.h

OpenGL GLU(实用程序)标头

/usr/include/GL/glx.h

OpenGL GLX标头

/usr/include/GL/glext.h

OpenGL扩展头

/usr/include/GL/glxext.h

OpenGL GLX扩展头

/usr/include/GL/osmesa.h

Mesa屏幕外渲染标题

/usr/lib/libGL.so

与的符号链接 libGL.so.1

/usr/lib/libGL.so.1

与的符号链接 libGL.so.1.xyz

/usr/lib/libGL.so.xyz

实际的OpenGL / Mesa库。xyz表示Mesa版本号。

在配置梅萨,有一些影响,你应该照顾与安装望三个介子选项:--prefix, --libdir,和。要将Mesa安装到可供所有程序使用的系统位置,请设置 。设置为Linux发行版安装系统库的位置,通常是或 。设置为Linux发行版安装DRI驱动程序的目录。要查找系统的DRI驱动程序目录,请尝试执行。例如,如果列出命令,则设置。-D dri-drivers-path--prefix=/usr--libdir/usr/lib/usr/lib64-D dri-drivers-pathfind /usr -type d -name drifind/usr/lib64/dri-D dri-drivers-path=/usr/lib64/dri

确定安装位置的正确值之后,使用配置Mesa, 然后使用安装。meson configure --prefix=/usr --libdir=xxx -D dri-drivers-path=xxxsudo ninja install

3.运行时/渲染问题

3.1渲染速度慢/为什么不使用我的图形硬件?

如果Mesa无法使用其硬件加速驱动程序,它将退回到其软件渲染器之一上。(例如经典的swrast,softpipe或llvmpipe)

您可以运行该glxinfo程序来了解OpenGL库。寻找和值。这将确定谁正在使用哪个驱动程序的OpenGL库以及检测到的硬件类型。OpenGL vendorOpenGL renderer

如果您使用的是硬件加速驱动程序,则需要 。direct rendering: Yes

如果基于DRI的驱动程序无法正常工作,请访问DRI网站以获取故障排除信息。

3.2我看到深度(Z)缓冲错误。为什么?

确保远剪切平面与近剪切平面的比率不太大。看 这里 了解详情。

Mesa默认情况下使用16位深度缓冲区,该缓冲区比32位缓冲区更小且清除速度更快,但准确性不高。如果您需要更深入的信息,可以glXChooseVisual在代码中修改参数。

3.3为什么深度缓冲根本不起作用?

确保您请求的是深度视觉缓冲。如果设置了 MESA_DEBUG环境变量,它将在没有深度缓冲区时警告您尝试启用深度测试。

具体来说,请确保glutInitDisplayMode正在使用 GLUT_DEPTHglXChooseVisual使用的非零值调用GLX_DEPTH_SIZE

该讨论也适用于模板缓冲区,累积缓冲区和Alpha通道。

3.4为什么glGetString()总是返回NULL

调用之前,请确保您具有活动/当前OpenGL渲染上下文glGetString

3.5 GL_POINTSGL_LINES不要触摸正确的像素

如果尝试使用GL_POINTS或 GL_LINES看到孔或间隙来绘制填充区域,则是因为存在浮点到整数舍入问题。但这不是错误。请参见《 OpenGL编程指南》的附录H-“ OpenGL正确性提示”。基本上,将(0.375,0.375,0.0)的平移应用于您的坐标将解决此问题。

4.开发者问题

4.1我该如何贡献?

首先,加入mesa-dev邮件列表。那就是讨论Mesa开发的地方。

OpenGL的规格是圣经对OpenGL实施工作。您应该阅读它。

Mesa的大部分开发工作都涉及实现新的OpenGL扩展,编写硬件驱动程序(用于DRI)和代码优化。

4.2如何编写新的设备驱动程序?

不幸的是,编写设备驱动程序并不容易。它需要对OpenGL,Mesa代码和目标硬件/操作系统有详细的了解。3D图形并不简单。

最好的入门方法是使用现有驱动程序作为起点。对于经典的硬件驱动程序,i965驱动程序就是一个很好的例子。对于Gallium3D硬件驱动程序,r300g,r600g和i915g是很好的例子。

DRI网站上有有关编写硬件驱动程序的更多信息。该过程记录不好,因为Mesa驱动程序界面会随着时间而变化,而且我们很少有空闲时间来编写文档。话虽如此,许多人设法弄清楚了这一过程。

加入适当的邮件列表并提出问题(以及搜索档案)是获取信息的好方法。

4.3为什么GL_EXT_texture_compression_s3tc在Mesa中未实现?

哦,但是!在2017年10月2日之前,由于与S3TC算法有关的知识产权(IP)和/或专利问题,Mesa项目不包括S3TC支持。

从Mesa 17.3.0开始,由于专利已过期,Mesa现在正式支持S3TC。

在此之前的版本中,需要第三方插件库

编码风格

Mesa已有20多年的历史了,编码风格已经随着时间而发展。一些旧零件使用的样式有些过时。台面的不同部分可以使用在本地EditorConfig(.editorconfig)和/或Emacs(.dir-locals.el)文件中设置的不同编码样式。或者,以下内容适用。如果以下准则没有涵盖某些内容,请尝试遵循现有的邻近代码的格式。

基本格式指南

  • 3个空格的缩进,没有制表符。

  • 将行数限制为78个或更少的字符。这个想法是为了防止在80列的编辑器和终端中换行。也有例外,例如您要定义大型静态信息表。

  • 开括号与if / for / while语句位于同一行。例如:

    if (condition) {
       foo;
    } else {
       bar;
    }
    
  • 在运算符之前/之后放置一个空格。例如,而不是a = b + c;a=b+c;

  • 这个GNU indent命令通常可以正确地格式化:

    indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
    
  • 在您认为对其他开发人员有帮助的地方使用注释。下面是几个特定的​​案例和样式示例。请注意,我们大致遵循Doxygen 约定。

    单行注释:

    /* null-out pointer to prevent dangling reference below */
    bufferObj = NULL;
    

    要么,

    bufferObj = NULL;  /* prevent dangling reference below */
    

    多行注释:

    /* If this is a new buffer object id, or one which was generated but
     * never used before, allocate a buffer object now.
     */
    

    在谨慎的情况下,我们尝试引用OpenGL规范:

    /* Page 38 of the PDF of the OpenGL ES 3.0 spec says:
     *
     *     "An INVALID_OPERATION error is generated for any of the following
     *     conditions:
     *
     *     * <length> is zero."
     *
     * Additionally, page 94 of the PDF of the OpenGL 4.5 core spec
     * (30.10.2014) also says this, so it's no longer allowed for desktop GL,
     * either.
     */
    

    功能注释示例:

    /**
     * Create and initialize a new buffer object.  Called via the
     * ctx->Driver.CreateObject() driver callback function.
     * \param  name  integer name of the object
     * \param  type  one of GL_FOO, GL_BAR, etc.
     * \return  pointer to new object or NULL if error
     */
    struct gl_object *
    _mesa_create_object(GLuint name, GLenum type)
    {
       /* function body */
    }
    
  • 如上所示,将函数返回类型和限定符放在一行上,将函数名称和参数放在下一行上。这使查找函数定义变得容易。此外,开括号本身会进入下一行(请参见上文)。grep ^function_name dir/*

  • 函数名称根据函数类型遵循各种约定:

    glFooBar()       - a public GL entry point (in glapi_dispatch.c)
    _mesa_FooBar()   - the internal immediate mode function
    save_FooBar()    - retained mode (display list) function in dlist.c
    foo_bar()        - a static (private) function
    _mesa_foo_bar()  - an internal non-static Mesa function
    
  • 常量,宏和枚举名称为ALL_UPPERCASE,单词之间带有_。

  • Mesa通常使用驼峰大小写作为局部变量(例如 localVarname:),而Gallium通常使用下划线(例如:) local_var_name

  • 全局变量几乎从未使用过,因为Mesa应该是线程安全的。

  • 布尔值。地方不直接可见的GL API应该更喜欢使用的booltrue以及falseGLbooleanGL_TRUEGL_FALSE。在C代码中,这可能意味着需要添加。该 的方法和 可作为参考。#include <stdbool.h>try_emit_*src/mesa/program/ir_to_mesa.cppsrc/mesa/state_tracker/st_glsl_to_tgsi.cpp

 

源代码树

这是Mesa目录树以及每个目录中包含的内容的简短摘要。

  • docs-文档

  • 包含-公共OpenGL头文件

  • src

    • AMD -AMD特定来源

      • addrlib-创建映像的常用资源

      • 通用-RADV,radeonsi和ACO之间的通用代码

      • 编译器-ACO着色器编译器

      • llvm -RADV和radeonsi之间用于使用LLVM编译着色器的通用代码

      • 寄存器-寄存器定义

      • vulkan -AMD Southern Island和更高版本的RADV Vulkan实施

    • 编译器-不同编译器的通用实用程序源。

      • glsl -GLSL IR和编译器

      • nir -NIR IR和编译器

      • spirv -SPIR-V编译器

    • egl -EGL库资源

      • 驱动程序-EGL驱动程序

      • -主EGL库的实现。这是实现所有EGL API函数的地方,例如eglCreateContext()。

    • freedreno -Adreno特定来源

      • fdl -mipmap布局管理器

      • vulkan - Turnip是Qualcomm Adreno的Vulkan实现

    • gbm-通用缓冲区管理器是设备缓冲区的内存分配器

    • 英特尔-特定于英特尔的资源

      • blorp -BLit或Resolve Pass是一个blit和HiZ解析框架

      • vulkan -Anvil是适用于Intel gen 7(Ivy Bridge)及更高版本的Vulkan实现

    • mapi -Mesa API

      • glapi -OpenGL API调度层。这是生成所有gl入口点(如glClear,glBegin等)以及GL分配表的地方。所有GL函数调用都将通过分派表跳转到main /中找到的函数。

    • 台面-台面主要来源

      • -芯梅萨代码(主要状态管理)

      • 驱动程序-Mesa驱动程序(不适用于Gallium)

        • 通用-可能由所有驱动程序共享的代码

        • dri-直接渲染基础结构驱动程序

          • 通用-所有DRI驱动程序共享的代码

          • i915 -Intel i915 / i945的驱动程序

          • i965 -Intel i965的驱动程序

          • nouveau -nVidia nv04 / nv10 / nv20的驱动程序

          • radeon -ATI R100驱动程序

          • r200 -ATI R200驱动程序

          • swrast-使用swrast模块的软件光栅化程序驱动程序

        • x11-基于Xlib的软件驱动程序

        • osmesa-屏幕外软件驱动程序

      • 数学-顶点数组转换和转换代码(不适用于镓)

      • 程序-顶点/片段着色器和GLSL编译器代码

      • sparc -SPARC系统的汇编代码/优化(不适用于Gallium)

      • state_tracker-从梅萨到镓的翻译器。基本上,这是与Gallium对话的Mesa设备驱动程序。该目录有时会移至src / mesa / drivers / gallium。

      • swrast-软件光栅化模块。用于在软件中绘制点,线,三角形,位图,图像等。(不适用于镓)

      • swrast_setup-软件原始设置。是否执行多边形剔除,glPolygonMode,多边形偏移等操作(不适用于镓)

      • tnl-软件顶点转换'n照明。(不适用于镓)

      • tnl_dd-设备驱动程序的TNL代码。(不适用于镓)

      • vbo-顶点缓冲区对象代码。所有带有glBegin / glEnd,glDrawArrays,显示列表等的图形都将通过此模块。结果是一组定义良好的顶点数组,这些顶点数组传递到设备驱动程序(或tnl模块)进行渲染。

      • x86-32位x86系统的汇编代码/优化(不适用于Gallium)

      • x86-64-64位x86系统的汇编代码/优化(不适用于Gallium)

    • -Gallium3D源代码

      • 包括-定义Gallium3D接口的Gallium3D头文件

      • 驱动程序-Gallium3D设备驱动程序

        • etnaviv -Vivante的驱动程序。

        • freedreno-高通Adreno的驱动程序。

        • I915 -驱动英特尔的i915 /直到i945。

        • iris -Intel gen 8(Broadwell)及更高版本的驱动程序。

        • lima -ARM Mali-400(Utgard)系列的驱动程序。

        • llvmpipe-使用LLVM生成运行时代码的软件驱动程序。

        • nouveau -NVIDIA GPU的驱动程序。

        • panfrost -ARM Mali Txxx(Midgard)和Gxx(Bifrost)GPU的驱动程序。

        • radeon -r600和radeonsi驱动程序的共享模块。

        • r300 -ATI R300-R500驱动程序。

        • r600 -ATI / AMD R600驱动程序-Northern Island(Terascale)。

        • radeonsi -AMD Southern Island及更高版本(GCN,RDNA)的驱动程序。

        • softpipe-软件参考驱动程序。

        • svga -VMware SVGA虚拟GPU的驱动程序。

        • swr-具有大规模并行顶点处理的软件驱动程序。

        • tegra -NVIDIA Tegra GPU的驱动程序。

        • v3d -Broadcom VideoCore 5和更高版本的驱动程序。

        • vc4 -Broadcom VideoCore 4的驱动程序。

        • virgl -QEMU的Virtio虚拟GPU的驱动程序。

        • zink-使用Vulkan进行渲染的驱动程序。

      • 辅助-镓支持代码

        • cso_cache-常量状态对象缓存。用于过滤掉前端和驱动程序之间的冗余状态更改。

        • draw-软件顶点处理和基本装配模块。这包括顶点程序的执行,剪切,剔除以及用于绘制宽线,点画线,多边形点画,双面照明等的可选阶段。旨在供驱动程序用于不具有顶点着色器的硬件。几何着色器也将在此模块中实现。

        • gallivm-用于镓的LLVM模块。用于TGSI着色器的基于LLVM的编译,优化和代码生成。不完整

        • hud -Heads-Up Display,显示GPU统计信息的覆盖图

        • pipebuffer-用于管理缓冲区的实用程序模块

        • rbug-镓远程调试实用程序

        • rtasm-运行时汇编/机器代码生成。当前,存在针对x86 / SSE,PowerPC和Cell SPU的运行时代码生成。

        • 细分-由软件驱动程序用来实现细分着色器

        • tgsi -TG着色器基础结构。用于编码,操作和解释GPU程序的代码。

        • 翻译-将顶点数据从一种格式转换为另一种格式的模块。

        • util-用于算术,哈希,表面创建,内存管理,2D blitting,简单渲染等的各种实用程序。

        • vl-视频解码/编码的实用代码

        • 还有XXX个

      • 前端-这些使用设备驱动程序实现各种库

        • 三叶草-OpenCL前端

        • dri -DRI驱动程序的元前端,请参阅mesa / state_tracker

        • glx -GLX的元前端

        • hgl -Haiku OpenGL

        • -D3D9前端,请参阅targets / d3dadapter9

        • omx -OpenMAX Bellagio前端

        • osmesa-屏幕外OpenGL渲染库

        • va -VA-API前端

        • vdpau -VDPAU前端

        • wgl -Windows WGL前端

        • xa -XA前端

        • xvmc -XvMC前端

      • winsys-设备驱动程序独立于平台,winsys将它们连接到各种平台。每个设备系列通常有一个winsys,并且在winsys目录中可以有多种连接到不同平台的工具。

        • drm -Linux上的Direct Rendering Manager

        • gdi -Windows

        • xlib -X Window系统上的间接渲染

        • 还有XXX个

    • 目标-这些控制如何将镓代码编译到不同的库中。这些每个都大致对应一个前端。

      • d3dadapter9 - d3dadapter9.so的葡萄酒

      • DRI - libgallium_dri.so通过libGL.so装

      • graw-没有前端的原始镓接口

      • 还有XXX个

    • GLX -使用DRI驱动程序构建libGL.so的GLX库代码。

    • 装载机-通过libGL.so用于查找和加载相应的DRI驱动。

    • 霜冻-霜冻特定来源

      • bifrost-用于Bifrost生成GPU的着色器编译器

      • lib -GPU数据结构(命令流)支持代码`

      • midgard-适用于Midgard一代GPU的着色器编译器

      • 共享-利马和Panfrost之间共享马里代码

      • util -Midgard和Bifrost着色器编译器之间的共享代码

    • util-各种实用程序代码

    • vulkan -Vulkan驱动程序的通用代码

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐