Linux GPU系列-02-ARM MALI GPU工作流程介绍

先讲讲ARM MALI GPU的工作流程,为后续做下铺垫。

GPU工作流程-pipeline

介绍GPU的工作流程,一般都是介绍GPU的pipeline,主要包括三部分:

  • Vertex处理,做MPV(Model,View, Project trasform)和Screen mapping坐标变换,clip裁剪
  • Rasterization处理,主要遍历三角形
  • Fragment处理,差值计算处理顶点颜色,纹理贴图等

整个流程如下图所示:
GPU pipeline

GPU pipeline2

GPU内部组成

为了完成上述流程,把GPU内部模块按照功能划分的话,如下图所示:

GPU_internal

CPU和GPU交互

CPU和GPU交互内容如下,不同的GPU卡不完全相同,但是总体还是一致的。

cpu_gpu_com1

cpu_gpu_com2

cpu_gpu_com3

ARM MALI GPU工作流程

由于MALI是基于TBR(Tiled based rendering)所以多一个Tiling或者binning的步骤。

如下图

ARM T880 Tile

Tile和Vertext、Fragement间的交互如下:

ARM T880 pipeline

ARM MALI Midgard硬件单元框架

Midgard的逻辑框图

Midgard软件接口

驱动把job提交给job manager,再由job manager分发给具体的硬件单元执行;job存在之前说的ring buffer中。
job有几种类型:

Midgard软件接口

job manager根据job类型分发:

Midgard软件接口

结合OpenGL api观察整个流程

Midgard软件接口

OpenGL API主要组织好job所需的数据,为后续的shader core计算做好准备。
Midgard软件接口

再补充些概念

  • binning pass:对于TBR来说,就是拆成primitive的过程
  • rendering pass:对每个primitive进行渲染着色的过程,一个rendering pass可以有多个sub pass,更精准的描述可以参考下面stackflow的答复

    The term “render pass” is more nebulous. The most common meaning refers to multipass rendering techniques.
    In multipass techniques, you render the same “object” multiple times, with each rendering of the object doing
    a separate computation that gets accumulated into the final value. Each rendering of the object with a particular
    set of state is called a “pass” or “render pass”.

    Note that a render pass is not necessarily a draw call. Objects could require multiple draw calls to render.
    While this is typically slower than making a single draw call, it may be necessary for various reasons.

  • draw call:对应到Open GL里面glDraw这样的API,这些API的调用触发vertex被渲染,但是同时针对一个vertex调用多次API,仍然是一个draw call。

MALI PASS

QCOM Adreno PASS

参考

Open Source Graphics 101
Shader Learing Render Pipeline篇
T880 Mobile GPU
ARM Midgard Architecture
The Bifrost GPU architecture and the ARM Mali-G71 GPU
Optimizing Roblox: Vulkan Best Practices for Mobile Developers
Adreno GPU Architecture
What exactly is a GPU binning pass
What is a renderpass?
渲染流程
Unity - DrawCall, Batch, SetPassCall区别
Render Hell 2.0
3D computer graphics

知道是不会有人点的,但万一有人呢:)