来自 ChatGPT 的解释

What is Vulkan ICD?

Vulkan ICD (Installable Client Driver) is a software component that enables the Vulkan API (Application Programming Interface) to interact with the hardware of a computer system. Vulkan is a low-level graphics API developed by the Khronos Group, which provides developers with more control over hardware resources, leading to improved performance and efficiency in graphics-intensive applications such as video games. The Vulkan ICD is responsible for managing the communication between the Vulkan API and the graphics hardware of a system. It is typically provided by the manufacturer of the graphics card as a driver for the system.

Read more »

Light Display Manager 是一个轻量级的跨桌面环境的 Display Manager, 可以支持多种显示技术,如 X11, Mir, Wayland.

Build

Dependencies

  • 开发包依赖

    • libpam0g-dev
    • libgcrypt20-dev
    • libglib2.0-dev
    • libxklavier-dev
  • 构建工具依赖

    • intltool
    • yelp-tools
    • gtk-doc-tools
  • 安装

Lightdm 可执行程序路径 /usr/sbin/lightdm, 日志默认路径 /var/log/lightdm/lightdm.log. 所以构建时可以使用

  • --prefix 指定安装路径 (默认 /usr/local)
  • --localstatedir 指定日志路径 (默认 $prefix/var/log/lightdm)
  • --sysconfdir 指定 lightdm.conf 路径 (默认 $prefix/etc/lightdm)
1
2
3
./autogen.sh --prefix=/usr --localstatedir=/var --sysconfdir=/etc --disable-tests
make -j $JOBS
sudo make install

Graphics Boot-up

flowchart TD
    A["systemd"]
    B["/usr/sbin/lightdm"]
    C["`[Seat:*]
        # Dump core
        xserver-command=X -core`"]
    D["`X
        Symbolic link to Xorg`"]

    A -- lightdm.service --> B -- /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf --> C --> D

P.S. lightdm --show-config 可以显示与 lightdm 相关的配置

《程序员的自我修养–链接,装载与库》这本书是在读研时才看的,印象很深,现在想想这本书讲的都是程序员,尤其是从事系统编程需要的知识。这里我将平时使用的跟编译,链接和构建应用程序及库相关的知识记录下来,希望以后能温故知新。

Read more »

Glossary

  • PoC: Proof of Concept, 概念验证
  • Chisel: tExtended on Scala
  • GDSII: 版图
  • RTL: Register-Transfer Level, RTL 语言包括 SystemVerilog, Verilog, VHDL等
  • FIRRTL: Chisel 的“翻译器”, Chisel -> Verilog
  • shift left: 把验证和调试放在 tape in 阶段
  • GEM5: C Simulator for GPU
  • PPA: Power, Performance, Area, used in deciding how to optimize semiconductor designs
Read more »

LLVM & llvm-project

LLVM 是 Low-Level Virtual Machine 的简写,但事实上它与虚拟机关系不大。我们更熟悉它是一套工具链,包括 clang /'klæŋ/, lld, lldb 等等。接触 LLVM 是因为 Mesa llvmpipe 使用 LLVM, 还有 AMDGPU 和 Radeon 的编译器后端都使用 LLVM IR,所以要编译 Mesa 的 -Dgallium-drivers=llvmpipe,radeonsi 都依赖于 LLVM 的诸多组件, 构建 Linux 内核的 eBPF 程序也依赖 LLVM, 构建 perfetto 也依赖 LLVM。这里主要记录 LLVM 的构建和使用的一些问题。

Read more »

Regular Expressions

GNU Extensions

Shorthand Classes

shorthand equivalence
\w [[:alnum:]_]
\W [^[:alnum:]_]
\s [[:space:]]
\S [^[:space:]]

Word Boundaries

shorthand matches
\b position at a word boundary
\B position not at a word boundary
\< position at the start of a word
\> position at the end of a word
\` (backtick) position at the start of subject string
\' (single quote) position at the end of subject string

Perl Compatiable Regular Expression (PCRE)

grep multiline mode

  • -P: 使用 Perl 正则表达式扩展
  • -z: 让 grep 把输入的行看成是一个多个行的集合,一个整体
  • .*?: 后面的 ? 表示 .*non-greedy 模式匹配,也就是尽可能少(短)的匹配
  • (?s): 让 . 匹配包括 \n 在内的任意字符,也就是所谓的 dot all flag.

rg multiline mode

  • -U, --multiline 使能多行匹配,允许正则表达式里包含 \n (普通模式下不允许),但 -U 并不会改变 . 的语义,所以你仍然需要显式地给 . 指定 (?s) flag

    • rg -U 'struct file_operations .*? = ?\{(?s).*?\.mmap = (?s).*?\};' -tc drivers/gpu
      这个例子找出内核 GPU 驱动中所有重写了 mmap file operation 方法的c文件

Lookarounds: Lookahead, Lookbehind

语法 名称 含义
(?=foo) 正向先行断言 Positive Lookahead 向前(右) 字符串里必须有 foo
(?!foo) 负向先行断言 Negative Lookahead 向前(右) 字符串里不能有 foo
(?<=foo) 正向后行断言 Positive Lookbehind 向后(左) 字符串里必须有 foo
(?<!foo) 负向后行断言 Negative Lookbehind 向后(左) 字符串里不能有 foo
  • 它们只是检查是否匹配,不作为最终匹配结果的一部分,即所谓"断言"
  • 它们可以解决 Non greedy 匹配有时解决不了的问题
  • rg (ripgrep) 默认不支持 lookahead, lookbehind, 需要加 -P--pcre2 选项
0%