Linux graphics stack
2D图形架构
早期Linux图形系统的显示全部依赖X Server,X Client调用Xlib提供的借口向 X Server发送渲染命令,X Server根据 X Client的命令请求向硬件设备绘制图形,X Client与X Server之间通过X11协议通讯。通过这种方式,X Server屏蔽了所有的硬件差异,保证同一个X程序能够在不同的硬件设备上运行。
X Server需要与多种多样的硬件打交道,每个硬件提供自己的DDX驱动程序,X Server最后调用DDX的接口将图形发送给硬件设备。

3D图形架构
通过3D硬件执行3D加速能够大大提高绘制效率,根据不同的模式有两种架构:
Indirect Rendering
这种模式下,仅仅X Server能够访问3D硬件设备,X Client需要绘图时通过X11扩展协议将3D命令发送给X Server,然后由X Server控制3D硬件设备执行,这种模式称为“非直接渲染”。
这种模式与2D模式类似。

但是这种模式无法发挥出3D硬件的效率
Direct Rendering
DRI(Direct Rendering Infrastructure)架构允许X Client直接控制3D硬件设备,所以这种模式下要求X Client与X Server必须位于同一个设备上。
DRM(Direct Rendering Manager)是DRI架构下的Kernel实现,DRM负责:hardware locking, access synchronization, video memory and more.
DRM also provides userspace with an API that it can use to submit commands and data in a format that is adequate for modern GPUs, which effectively allows userspace to communicate with the graphics hardware.
Notice that many of these things have to be done specifically for the target hardware so there are different DRM drivers for each GPU.

DRI/DRM provide the building blocks that enable userspace applications to access the graphics hardware directly in an efficient and safe manner, but in order to use OpenGL we need another piece of software that, using the infrastructure provided by DRI/DRM, implements the OpenGL API while respecting the X server requirements.
Mesa
Mesa is a free software implementation of the OpenGL specification, and as such, it provides a libGL.so, which OpenGL based programs can use to output 3D graphics in Linux. Mesa can provide accelerated 3D graphics by taking advantage of the DRI architecture to gain direct access to the underlying graphics hardware in its implementation of the OpenGL API.
When our 3D application runs in an X11 environment it will output its graphics to a surface (window) allocated by the X server. Notice, however, that with DRI this will happen without intervention of the X server, so naturally there is some synchronization to do between the two, since the X server still owns the window Mesa is rendering to and is the one in charge of displaying its contents on the screen. This synchronization between the OpenGL application and the X server is part of DRI. Mesa’s implementation of GLX (the extension of the OpenGL specification that addresses the X11 platform) uses DRI to talk to the X server and accomplish this.
Mesa also has to use DRM for many things. Communication with the graphics hardware happens by sending commands (for example “draw a triangle”) and data (for example the vertex coordinates of the triangle, their color attributes, normals, etc). This process usually involves allocating a bunch of buffers in the graphics hardware where all these commands and data are copied so that the GPU can access them and do its work. This is enabled by the DRM driver, which is the one piece that takes care of managing video memory and which offers APIs to userspace (Mesa in this case) to do this for the specific target hardware. DRM is also required whenever we need to allocate and manage video memory in Mesa, so things like creating textures, uploading data to textures, allocating color, depth or stencil buffers, etc all require to use the DRM APIs for the target hardware.

引用原文:https://blogs.igalia.com/itoral/2014/07/29/a-brief-introduction-to-the-linux-graphics-stack/
Linux graphics stack的更多相关文章
- Monitoring and Tuning the Linux Networking Stack: Receiving Data
http://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/ ...
- Queueing in the Linux Network Stack !!!!!!!!!!!!!!!
https://www.coverfire.com/articles/queueing-in-the-linux-network-stack/ Queueing in the Linux Networ ...
- Linux Storage Stack Diagram存储堆栈图
这是一个描述非常好的存储栈,版本为:Linux Storage Stack Diagram v4.10,我在这里转载下图片,可以提升大家对存储栈的理解. https://www.thomas-kren ...
- Linux Kernel Stack
整理一些杂乱的内容.以下x86架构. Linux 内核栈大小 内核栈大小是固定的,默认为8k,曾经有选项可以设置为4k栈.由于大小固定,申请过大的栈内存,或者函数调用层次过深,都可能导致栈溢出. 关注 ...
- 《Monitoring and Tuning the Linux Networking Stack: Receiving Data》翻译
Overview 从宏观的角度来看,一个packet从网卡到socket接收缓冲区的路径如下所示: 驱动加载并初始化 packet到达网卡 packet通过DMA被拷贝到内核中的一个ring buff ...
- The Linux Storage Stack Diagram
相关文章: 如何提高Linux下块设备IO的整体性能?
- linux io stack
- The Linux Storage Stack Diagram 内核 4.0 版的 I/O 栈
- Linux Storage Stack Diagram 4.0
https://www.thomas-krenn.com/en/wiki/Linux_Storage_Stack_Diagram
随机推荐
- 使用汇编语言实现memcpy
把内核放入内存,究竟需做什么 写满实现内核功能的代码的文件会被编译成一个ELF文件.这个ELF文件不同于LOADER BIN文件.后者实质是一个没有使用DOS命令的COM文件.因此,只需将它原封不动地 ...
- left join与inner join
举例a.b表: bId bNum 1 20 2 30 aId aNum 1 10 2 20 3 30 left join以左表为准 select * from a left join b on a.a ...
- P3164 [CQOI2014]和谐矩阵(高斯消元 + bitset)
题意:构造一个$n*m$矩阵 使得每个元素和上下左右的xor值=0 题解:设第一行的每个元素值为未知数 可以依次得到每一行的值 然后把最后一行由题意条件 得到$m$个方程 高斯消元解一下 bitset ...
- Codeforces Round #501 (Div. 3) B. Obtaining the String (思维,字符串)
题意:有两个字符串\(S\)和\(T\),判断\(T\)是否能由\(S\)通过交换某位置的相邻字符得到,如果满足,输出交换次数及每次交换的位置,否则输出\(-1\). 题解:首先判断不满足的情况,只有 ...
- Find a multiple POJ - 2356 容斥原理(鸠巢原理)
1 /* 2 这道题用到了鸠巢原理又名容斥原理,我的参考链接:https://blog.csdn.net/guoyangfan_/article/details/102559097 3 4 题意: 5 ...
- Educational Codeforces Round 95 (Rated for Div. 2) A. Buying Torches (数学)
题意:刚开始你有一个木棍,造一个火炬需要一个木根和一个煤块,现在你可以用一个木棍换取\(x\)个木棍,或者\(y\)根木棍换一个煤块,消耗一次操作,问最少需要操作多少次才能造出\(k\)把火炬. 题解 ...
- K8S(08)交付实战-交付jenkins到k8s集群
k8s交付实战-交付jenkins到k8s集群 目录 k8s交付实战-交付jenkins到k8s集群 1 准备jenkins镜像 1.1 下载官方镜像 1.2 修改官方镜像 1.2.1 创建目录 1. ...
- 【python接口自动化】- PyMySQL数据连接
什么是 PyMySQL? PyMySQL是在Python3.x版本中用于连接MySQL服务器的一个库,Python2中则使用mysqldb.它是一个遵循 Python数据库APIv2.0规范, ...
- leetcode一些细节
取数组中点时不要写 int mid = (left + right) // 2;,「这么写有一个问题:数值越界,例如left和right都是最大int,这么操作就越界了,在二分法中尤其需要注意!」 所 ...
- next v5升级到next v7需要注意的地方
title: next v5升级到next v7需要注意的地方 date: 2020-03-04 categories: web tags: [hexo,next] 大部分的设置都是一样的,但有一些细 ...