LdB
Posts: 547
Joined: Wed Dec 07, 2016 2:29 pm

Re: Accelerated graphics

Thu Sep 14, 2017 6:47 am

One rotating wavefront OBJ 3D mesh
https://streamable.com/yte1n

Code is up
https://github.com/LdB-ECM/Raspberry-Pi ... LES2_Model

Now we are getting way beyond just a simple rotating triangle :-)

Anyhow off to find out where they have hidden the shader compiler I want some colours so it looks like this
Image

Who said you can't baremetal accelerated graphics.

User avatar
Gavinmc42
Posts: 1435
Joined: Wed Aug 28, 2013 3:31 am

Re: Accelerated graphics

Thu Sep 14, 2017 8:46 am

Had trouble with the 3D model img files, nothing on screen.
Will check later at home.

But triangle and rotate version worked.
If you can map the jpg onto the 3D surface, that will be something.
Might take me 6 months to figure it out and catch up:oops:

Hardware Scaler next on your list?
Or try the JPEG hardware?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

LdB
Posts: 547
Joined: Wed Dec 07, 2016 2:29 pm

Re: Accelerated graphics

Thu Sep 14, 2017 10:25 am

If you have the display text showing vertex count etc it means the model is too big for the screen resolution and has hit the clip limits.

It doesn't display when that happens, I haven't worked out how to turn them off :-)

I am on 1280 x 1024 and at a guess your default is smaller so let me scale the model smaller and make a quick bit of code to select the appropriate one. Thanks for that I forgot that could happen.

I am getting an ever increasing list.

1.) The VBO on the GL pipe is limited so I need to organize splitter code to transverse multiple VBO's when needed for really large models.
2.) I need to sort the text/jpeg loading which I have sort of worked out how it all happens. I know how to bind it and UV and normal maps to the triangle surface already but I need to adapt one of the free jpeg libraries for the load. I have SDCard and FAT32 running so can work on that now.
3.) I need to find the shader compiler so I can bind my own shader code.
4.) The scaler should come in solo under message system will look for that.
5.) The one I would like to do is bind a MMAL surface to two triangles (AKA a square) so I can play video on a surface. I assume the PI can do that as it came in with OpenGL 3.1.

I haven't got much interest in it but now understanding the VCOS properly I could do the camera because someone already worked out how to shim that. That stuff Eric Anholt commented just peeled open so much because you can know what is happening on the GPU GL pipeline side.
https://github.com/drhastings/cameragl

User avatar
Gavinmc42
Posts: 1435
Joined: Wed Aug 28, 2013 3:31 am

Re: Accelerated graphics

Thu Sep 14, 2017 11:51 am

My normal Pi screens are the old Dells with USB hubs which are 1280x1024.
This is my standard PI development resolution.

Had trouble with the img files on old model 2 and 3 but the triangle/quad img files work on Zero, A+ , B+ and original B.
The 3D model version does not work on any, the activity led flashes once and then nothing :(
On the Zero after the led blinks I notice a very quick flash on screen.
The monitor LED goes green so it knows something is coming in, pull off power and monitor goes the orange standby mode.

I mostly do Ultibo development on Zero's as I use USB boot mode to download my Ultibo kernel.img, no more programming SD cards ;)
viewtopic.php?f=72&t=184840
And the Zero is the fastest BCM2835 model 8-)

I had trouble with your boot files, replaced yours with the latest and both your triangle examples work on Zero USB boot :P
The RPIboot program is a bit fussy with the boot files.

Burtyb has a version for his Clusterhat that downloads extra stuff, it could be modified for data/image folders?
https://github.com/burtyb/usbboot

The 3D model won't work because the data folder does not get copied by the rpiboot program I run on Mint but I did get a quick flash of three lines , some about "waiting for interrupt".

Videos on surfaces should be possible as it was in the normal VC hello demo code so I assume it uses hardware acceleration.
That assumes you can get video working :D

There seems to be some scaler code in the Linux kernel gpu/drm/vc4 folders, not sure how useful that would be or even if Eric uses it yet?
I think on one of his posts there was something about it.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Gavinmc42
Posts: 1435
Joined: Wed Aug 28, 2013 3:31 am

Re: Accelerated graphics

Thu Sep 14, 2017 12:20 pm

There is also a mouse cursor tile engine that goes up to 64x64 pixels,
I used the mouse cursor example to pay with it
https://github.com/ultibohub/Examples/t ... ouseCursor

Been having some fun with it, is should be relatively easr for you to make a baremetal version.
https://ultibo.org/forum/viewtopic.php? ... use+cursor.
You can see why I am keen on the gpu stuff ;)

3D procedurally generated terrain with textures, only weeks away?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

LdB
Posts: 547
Joined: Wed Dec 07, 2016 2:29 pm

Re: Accelerated graphics

Thu Sep 14, 2017 1:36 pm

Just read what you were doing and yes you won't be able to run the rotating model because the code specifically mounts the sdCard and tries to load the file from that. I will add mounting USB and loading file from that to me to do list, you will be able to use it then :-)

However in the meantime I autoscaled it so it should work on every resolution.

Update: I found that Eric confirmed what I suspected that you can bind the camera output directly onto a VC4 plane (http://anholt.livejournal.com/46702.html) and he has provided hack code to do it. Might do that for another sample.

User avatar
Gavinmc42
Posts: 1435
Joined: Wed Aug 28, 2013 3:31 am

Re: Accelerated graphics

Fri Sep 15, 2017 3:35 am

Not too worried about the SD card at this time for the Zero
Ultibo already has SD card support, but there are ways to embedded the files in the kernel.img.
USB loading will be interesting.

We have some flight sims around the place, making real glass instruments based on USB Zeros would be fun and low cost.
Something I had thought about years ago, now looking doable. Just need to figure out how to do circles etc.
Better get myself some more Zero's, now that I figured out a way to use lots :lol:

Camera will be interesting.
Not sure if you can use the ISP, magic pixie dust in that, so no lens correction etc but there is a RAW camera sensor post.
viewtopic.php?f=43&t=109137
You will probably need to get i2c working first.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

LdB
Posts: 547
Joined: Wed Dec 07, 2016 2:29 pm

Re: Accelerated graphics

Mon Sep 18, 2017 6:44 pm

Okay so got textures working I just need to now write a quick texture loader (at least I have FAT32 running so only half work to loading model).

Eric Anholt was so kind as to actually answer my question of where the shader compiler is.
Quote => The entire shader compiler is in the Mesa vc4 driver.

It's open source so looks like I am also going to have to slice and dice a minimal shader compiler from it, because I really needed more work :-)

I will probably cheat for speed initially and make a couple of shaders on Raspbian and save the binary, I have worked out how to get to them.

User avatar
Gavinmc42
Posts: 1435
Joined: Wed Aug 28, 2013 3:31 am

Re: Accelerated graphics

Tue Sep 19, 2017 1:30 am

The entire shader compiler is in the Mesa vc4 driver.
in here?
https://github.com/anholt/mesa/tree/mas ... rivers/vc4

Had not looked too hard in the mesa stuff.
Hmm, gears example in there too?

This the compiler?
https://github.com/anholt/mesa/tree/master/src/compiler
Look like a bunch of learning, getting a bit complex for me.
Really don't want to learn C++ and Linux driver stuff if I can help it, I don't think I have that much neuroplasticity left :lol:
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

LdB
Posts: 547
Joined: Wed Dec 07, 2016 2:29 pm

Re: Accelerated graphics

Tue Sep 19, 2017 5:25 am

That is the one and it looks like it produces byte code which you pass to the GL pipeline, I would say.

I wish there was someone to ask some real basic questions, like how many memory handles does the VC4 have. I am packing stuff together to make bigger structures to limit how many blocks I have allocated and locked because I am concerned there are limited VC4 memory handles.
Like I am binding all my textures into one big long memory allocation, rather than 1 for each. makes loading and removing a texture much harder. The thing is you just don't know I could be doing it all wrong :-)

Return to “Bare metal”

Who is online

Users browsing this forum: No registered users and 3 guests