Reference \:
> * Raspberry Pi GPU Audio Video Programming
> https://github.com/Apress/raspberry-pi-gpu-audio-video-prog
> * Respberry Pi Wiki
> https://zh.wikipedia.org/zh-tw/%E6%A0%91%E8%8E%93%E6%B4%BE
# Raspberry Pi 3 Setup
## Monitoring Raspberry Pi
https://chem.libretexts.org/Courses/Intercollegiate_Courses/Internet_of_Science_Things/5%3A_Appendix_3%3A_General_Tasks/5.9%3A_Monitoring_your_Raspberry_Pi#:~:text=Monitoring%20Clock%20Frequency%2C%20Voltage%20and%20Temperature,-Using%20the%20vcgencmd&text=According%20to%20Raspberry%20Pi%20Documentation,with%20a%20half%2Dfilled%20thermometer.
## Python Virtual Environment Create
https://learn.microsoft.com/zh-tw/windows/python/web-frameworks
```bash
sudo apt install python3-pip
sudo apt install python3-venv
cd python_dev
python3 -m venv .venv
source .venv/bin/activate
deactivate
```
By the way, all the python environment in my system is created in this way
## Check Raspberry Pi Model in CommandLine
https://linuxconfig.org/how-to-check-raspberry-pi-model
## Check Raspberry Pi OS Info
```clike
cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
uname --all
Linux raspberrypi 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux
```
## Raspberry Pi 3 B+ `xv` Built-in Function `show()`
```bash
sudo apt-get install xli -y
cd /usr/local/bin
sudo ln -s /usr/bin/xli xv
```
# Introduction
> There are a multitude of APIs and programming styles for programming graphics systems. The Raspberry Pi supports a few of these: OpenGL ES for 3D programming, OpenVG for 2D vector graphics programming, and OpenMAX for video and audio.
:::info
:information_source: **Information of Libraries used in the book**
* OpenGL ES
> * https://blog.csdn.net/m0_60259116/article/details/124059906#:~:text=OpenGL%20ES%20
> * https://blog.csdn.net/qq_23034515/article/details/108283747
* OpenVG
> OpenVG is an alternative approach to graphics to OpenGL. While OpenGL renders onto textures, OpenVG is more concerned with drawing lines to form shapes and then rendering within those shapes.
* OpenMAX
> * https://zh.wikipedia.org/zh-tw/OpenMAX
:::
# Hardware Info & Libraries
## VideoCore® IV Reference 3D Architecture Reference Guide
Reference \:
> https://docs.broadcom.com/doc/12358545
> https://github.com/hermanhermitage/videocoreiv
**QPU**
> The VideoCore IV 3D architecture is scalable, based around multiple specialist floating-point shading processors called QPUs
> Scalability is principally provided by multiple instances of a special purpose floating-point shader processor, termed a Quad Processor \(QPU\). The QPU is a 16-way SIMD processor. Each processor has two vector floatingpoint ALUs which carry out multiply and non-multiply operations in parallel with single instruction cycle latency. Internally the QPU is a 4\-way SIMD processor multiplexed 4× over four cycles, making it particularly suited to processing streams of quads of pixels.
## VC4CL \: OpenCL Implementation
Reference \:
> * https://github.com/doe300/VC4CL
> * https://yunusmuhammad007.medium.com/build-install-opencl-on-raspberry-pi-3-fb8139acd493
OpenCL implementation on VideoCore IV is the best way to use the GPU on Raspberry Pi 3 in my opinion.
```clike
Number of platforms 1
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Platform Vendor doe300
Platform Version OpenCL 1.2 VC4CL 0.4.9999 (b5a6097)
Platform Profile EMBEDDED_PROFILE
Platform Extensions cl_khr_il_program cl_khr_spir cl_khr_create_command_queue cl_altera_device_temperature cl_altera_live_object_tracking cl_khr_icd cl_khr_extended_versioning cl_khr_spirv_no_integer_wrap_decoration cl_khr_suggested_local_work_size cl_vc4cl_performance_counters
Platform Extensions function suffix VC4CL
Platform Name OpenCL for the Raspberry Pi VideoCore IV GPU
Number of devices 1
Device Name VideoCore IV GPU
Device Vendor Broadcom
Device Vendor ID 0x14e4
Device Version OpenCL 1.2 VC4CL 0.4.9999 (b5a6097)
Device Numeric Version 0x402000 (1.2.0)
Driver Version 0.4.9999
Device OpenCL C Version OpenCL C 1.2
Device Type GPU
Device Profile EMBEDDED_PROFILE
Device Available Yes
Compiler Available Yes
Linker Available Yes
Max compute units 1
Available core IDs 0
gpuserv: vc_gpuserv_init: starting initialisation
Max clock frequency 300MHz
Core Temperature (Altera) 43 C
Device Partition (core)
Max number of sub-devices 0
Supported partition types None
Supported affinity domains (n/a)
Max work item dimensions 3
Max work item sizes 12x12x12
Max work group size 12
Preferred work group size multiple (kernel) 1
Preferred / native vector sizes
```
## Libraries
* QPULib
https://github.com/mn416/QPULib
* PiMD
https://pkoenig10.github.io/pimd/