3

I am programming ARM assembly on raspberry and I am wondering whether and how it is possible to access GPU. I already looked userland repo, but I completely do not understand the stucture.

I would love to see some example how to do some very simple operation on GPU. Let's say addition.

I know that VideoCore is mapped at 0xC0000000 but I have no clue how to query it.

2

You may want to take a look at OpenMAX. Otherwise, graphic drivers are provided by BroadCOM in binary form and not open-sourced at all. You may need to sign NDA and have close friends at Broadcom to take a peek.

2

lenix is correct. The GPU drivers on Raspberry Pi (and every other ARM SoC that I know of) are delivered as a binary blob. If your goal is to learn how to write a GPU driver, then you have a lot of reverse engineering ahead of you. If your goal is to make the GPU do something, then you can call the OpenGL ES 2.0 C API from your assembly code. Since you're already working in assembly, you're probably aware, but there are two ABIs (C calling conventions) for Raspberry Pi: hard float (faster and used by the majority of Raspi distros) and soft float. Make sure you know which ABI your distro is using before you start trying to call C functions from assembly.

1

The Baking Pi course (about building an OS from scratch for the Raspberry Pi) has some material that could be interesting. It describes how to program the ARM CPU in assembly, and how to communicate with the GPU. Still this is not really programming the GPU, only communicating with it and the program it is already running.

1

There is a free software assembler, MoeASM for the RaspberryPi GPU https://wk3.org/posts/588911

Also, check out the reverse engineering work and source code samples at https://github.com/hermanhermitage/videocoreiv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.