Aran
Posts: 36
Joined: Fri Jan 25, 2019 5:55 pm

Re: Spider-OS a new operating system

Tue Mar 05, 2019 10:35 pm

I see that the assembler unleashes the passions. Perhaps after all, every language has these advantages in specific areas. I also think of Julia, who seems to be a good compromise between modernity and performance.
Personnaly I remain an irreducible of assembly language ;-)

DavidS, I'm a little taken by the time right now, but you're right I intend to put my online development of Spider-OS on my site. Besides, I will perhaps make a table of contents when there will be many posts.
In any case, happy that it pleases.

Heater
Posts: 13666
Joined: Tue Jul 17, 2012 3:02 pm

Re: Spider-OS a new operating system

Wed Mar 06, 2019 5:35 am

Aran,
I see that the assembler unleashes the passions.
Certainly does. I love it!

I do have to push back about some absurd claims made about it though. Perhaps I just should not.
Perhaps after all, every language has these advantages in specific areas.
Very wise.
Memory in C++ is a leaky abstraction .

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Spider-OS a new operating system

Fri Mar 15, 2019 10:55 am

As it seems that you are intending to use a purely compositing window manager, I feel that I should point out that this makes for a very large use of memory. It may be a better bet to look at using a compositing window manager for the front most window and any that are flagged as compositing only (usefull in some graphics intensive cases).

Compositing could easily take upto 8MB each, and with only a total available of 1024MB even alocating half of that to the window data comes to 512MB/8MB=64 windows of maximum currently visible content size. And at about 4GB/s maximum single point throughput (2GB/s for copying mem) on the system bus without interfering with anything else you will find that you run short in a hurry.

Using a simple rectangle clipping window manager for most cases is more effecient. It also makes implementing DMA easy for drawing to the frame buffer from the visable portions of current windows that are clipped by other windows/menus/objects.
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

Aran
Posts: 36
Joined: Fri Jan 25, 2019 5:55 pm

Re: Spider-OS a new operating system

Fri Mar 15, 2019 9:44 pm

Hi DavidS,

yes indeed it is a compositing window manager. But I did some optimizations. I created a function that optimally places the windows in memory. An area of ​​1920 * 1080 is divided into 8 zones of 480 * 270. Thus a window takes the place only covered areas. So my windows do not take 8 MB each time ;-)

At the moment, I am working on the Videocore, and I really want to integrate it into the window manager to optimize all that.

Moreover with a compositing window manager, we can do a lot of visual effects, as shown on wikipedia : https://en.wikipedia.org/wiki/Compositi ... ow_manager

Aran
Posts: 36
Joined: Fri Jan 25, 2019 5:55 pm

Re: Spider-OS a new operating system

Fri Apr 05, 2019 7:28 pm

Hello,

I just published a new post on Videocore. I managed to display a 3D cube with textured faces, and in rotation. For this, I use the TMU and indexed vertices, and some mathematical formulas.

A screenshot of the result obtained on my Raspberry Pi.

I make you a tutorial here. Some explanations on the 3D, and of course the assembly code ;-)

Image

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

Re: Spider-OS a new operating system

Sat Apr 06, 2019 1:47 am

The rotation is fun but for your O/S don't you need to translate your window buffer as a texture onto just two triangles that represent that window in flat 2D space?

Or are you doing a 3D UI?

With your wanting to do things for speed the rotation can be actually be done in the shader by the VC4 rather than the ARM you can just pass it a float being the angle. To create the shader download MESA, setup a GLSL rotation shader and use VC4_DEBUG=qpu and it will dump the VC4 shader code.

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

Re: Spider-OS a new operating system

Sat Apr 06, 2019 5:10 am

Very impressive.
Have you tried OpenVG yet?

I'm wondering if OpenVG will work with z buffer.
Bring stuff to the foreground by changing the z.
I have been drawing stuff last if I want it on top.
If there was a threshold the OpenVG windows would disappear, sort of into the fog?

The other advantage I found with OpenVG is the window can be any shape as it is not pushing rects of pixels around.
A real 3D GUI, well that is beyond my comprehension apart from that Looking Glass stuff.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
Paeryn
Posts: 2704
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Spider-OS a new operating system

Sat Apr 06, 2019 12:23 pm

Gavinmc42 wrote:
Sat Apr 06, 2019 5:10 am
I'm wondering if OpenVG will work with z buffer.
Bring stuff to the foreground by changing the z.
I have been drawing stuff last if I want it on top.
If there was a threshold the OpenVG windows would disappear, sort of into the fog?
No, OpenVG is strictly 2D, all rendering happens on top of what is already there. From reading the docs the VC4 uses the 3D hardware for the rendering but coordinates have an implicit Z=0.5, W=1.0. Also OpenVG has a coverage mode in which case the tile memory which would be used for the Z and Stencil buffers is appropriated for use as the Coverage buffer.
She who travels light — forgot something.

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

Re: Spider-OS a new operating system

Sun Apr 07, 2019 1:13 am

No, OpenVG is strictly 2D, all rendering happens on top of what is already there.
Rats, I thought I had seen that VG tiger on a 3D cube somewhere, perhaps it was converted to pixels first?
OpenVG to texture map?

Found some Looking Glass videos, still impressive even now and back then it was done with 32MB of GPU memory ;)
Was interesting to see video from the back, reminded me of that Pi cube that has Big Buck Bunny on it.

Looking Glass was a Java project, would it be faster in C on a Pi these days?
To me and probably most people OS's and GUI's go hand in hand.
Sure I can use command line, I am DOS era old, but until I get an new "old" mechanical keyboard I still use GUI's and drop and drag:D.
The Pi's allow us to explore options and try new things or even make old things new.

Like writing an OS from scratch, I never would of dreamed that was still doable be just one person.
Yet it is being done by at least a half dozen.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

StevoD
Posts: 28
Joined: Tue Aug 29, 2017 11:37 am

Re: Spider-OS a new operating system

Sun Apr 07, 2019 9:35 am

Aran wrote:
Fri Apr 05, 2019 7:28 pm

A screenshot of the result obtained on my Raspberry Pi.

I make you a tutorial here. Some explanations on the 3D, and of course the assembly code ;-)
The rotating cube is one thing but any chance you can post the code you used to do the video grab, bare metal video screenshot to youtube is kinda unique as far as I know.

Aran
Posts: 36
Joined: Fri Jan 25, 2019 5:55 pm

Re: Spider-OS a new operating system

Sun Apr 07, 2019 10:30 am

The rotating cube is one thing but any chance you can post the code you used to do the video grab, bare metal video screenshot to youtube is kinda unique as far as I know.
I do not use code, that's the trick ;-) I have this equipment to capture the video via hdmi : http://www.hauppauge.co.uk/site/product ... -plus.html
The rotation is fun but for your O/S don't you need to translate your window buffer as a texture onto just two triangles that represent that window in flat 2D space?

Or are you doing a 3D UI?
I do not pretend to create a graphic system in 3D :-) I study Videocore in fact, to eventually add 3D effects.
With your wanting to do things for speed the rotation can be actually be done in the shader by the VC4 rather than the ARM you can just pass it a float being the angle. To create the shader download MESA, setup a GLSL rotation shader and use VC4_DEBUG=qpu and it will dump the VC4 shader code.
LdB, good point. Indeed it will be faster, if it is the chip that performs 3D calculations directly. I just hit, that the chip integrates native OpenGL language, so we can send the compiled code. I did not know how to do, thanks for the way with MESA.

I install MESA with this link : https://fdossena.com/?p=mesa/build.frag, but I admit that I have not yet understood how to use it ?

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

Re: Spider-OS a new operating system

Mon Apr 08, 2019 1:46 am

I have been trying to move all my Pi development to Pi's.
Because I wanted to do aarch64 baremetal I had to wait for a 64bit OS.

Gentoo64 was the first one that worked and stayed working ;)
It also had newer mesa3d OpenGL drivers, so I just installed the mesa3d examples and had fun straight away.
ftp://ftp.freedesktop.org/pub/mesa/demos/

Of course doing it baremetal gets Linux out of the way and the C dependency hell that can be.
Python is not much better ;) I tried that Python 3D stuff when it first came out, nope not basic enough for me.

Nice trick with the HDMI capture, we were thinking you were some sort of code wizard :lol:
Love the tutorials too, I might understand them one day :oops:
So many old tutorials are not relatable to Pi's or are too simple.
They mostly stop at the rotating triangle/cube.

That's another reason I like the mesa3d examples, they are in one C file and do all sorts of interesting things.
None are optimised for Pi hardware and use OpenGL.
How fast would they be if converted to OpenGLES2?
I would love to convert them to Free Pascal OpenGLES2 so I could use them in Ultibo, but I don't seem to have enough time ;)
Too many interesting things to do with Pi's

Pi's have mobile hardware- OpenGLES but most examples are for desktop PCs, OpenGL :(

That Looking Glass Project has now got me really interested in 3D.
Back when it came out I wanted it, then bastard versions came out like Compiz which ran very slow on the hardware around at the time.
I had hopes for Wayland, but those sorts of things are another layer on top of many layers.

Too many layers and too many dependanices.
Time to go simpler, I just want a nice looking single user OS.

Just heard, Palm are back, making mini phones.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: Spider-OS a new operating system

Mon Apr 08, 2019 2:30 am

Gavinmc42 wrote:
Mon Apr 08, 2019 1:46 am
I have been trying to move all my Pi development to Pi's.
Because I wanted to do aarch64 baremetal I had to wait for a 64bit OS.
You can compile AARCH64 on a 32bit O/S windows or linux, when cross compiling the O/S does not determine the output.

Alternatively you are talking about doing some bit bashing in a linux console program which isn't really baremetal?

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

Re: Spider-OS a new operating system

Mon Apr 08, 2019 3:52 am

You can compile AARCH64 on a 32bit O/S windows or linux
Sure but more fun to do it native and run it on the same box.
Or use an aarch64 OS and cross compile to aarch32.

Cross compiling means rebooting into different OS on Pi or coping exe from x84 to Pi's.
Compile, copy, test, debug cycles take longer doing it this way.

This is also why I am thinking about embedding an interpreted language into my OS.
I found shell script very useful for simple stuff(even webservers) and lots of things don't need C, .libs, IDEs etc.
I have used Micropython on Pi's with shell script for a bit more speed.
Maxed out a Pi B to 2% cpu usage, speed sometimes it not the issue, simple, reliable and it even works editing while running.

Oberon does a sort of extendable OS via modules.
Not sure if any others do that? A Forth based OS?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: Spider-OS a new operating system

Mon Apr 08, 2019 7:58 am

Not sure any of that is features I would want in any O/S .. but it's your O/S so you do what you like :-)

I was just making sure your realized you can cross to AARCh64 and you got that so all good and lets not get sidetracked into lots of other stuff.

Aran
Posts: 36
Joined: Fri Jan 25, 2019 5:55 pm

Re: Spider-OS a new operating system

Mon Apr 08, 2019 5:04 pm

Hello Gavinmc42,

thanks for the ftp link, i will be able to have fun with all that. So I'll have to go to C (GLSL version) ;-) to make the shaders more easily and get the VC4 code (via MESA).

The Raspberry Pi supports OpenGL-ES 2.0 at the hardware level, I intend to enjoy it.
It deviates a bit from my initial project, but after all, it's just for fun.

There is so much to do to have an operating system, so I do it quietly without an absolute goal. I will continue to release posts to show my work anyway.

Aran
Posts: 36
Joined: Fri Jan 25, 2019 5:55 pm

Re: Spider-OS a new operating system

Wed Jul 03, 2019 10:11 pm

Hello everyone,

I published a new post on Videocore. I managed to perform 3D calculations directly using vertex shaders.
As it is a bit more complicated, I did a tutorial to program different shapes from the simplest (a filigree rectangle), through a colored rectangle or textured, to finish with a pyramid.
You have to go through programming in GL mode, GL Shader State Record settings, Vertex Pipe Memory settings, and vertex shaders (fragment, vertex and coordinate).
But it becomes pleasant, because one can then easily perform movements, zoom and rotation of 3D objects by sending parameters to vertex shaders.
And as on the screenshot, I made an interactive demo to rotate a spaceship with the keyboard.

Image

Andyroo

Re: Spider-OS a new operating system

Wed Jul 03, 2019 11:08 pm

That is very smooth motion - reminds me a bit of the BBC Elite samples oh so many years ago.

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

Re: Spider-OS a new operating system

Thu Jul 04, 2019 1:31 am

Can I send you some other stuff on videocore to document :-) ... really nice writeup I can never make the time or effort.

I have worked out a pile of stuff with the Pi4 that I really need to do that sort of thing with but I am lazy.

Aran
Posts: 36
Joined: Fri Jan 25, 2019 5:55 pm

Re: Spider-OS a new operating system

Thu Jul 04, 2019 5:38 pm

@ Andyroo
Yes it's so much more nice to watch when the animation is not jerky. An operation made possible by allocating GPU memory for the code, and refreshing the cache.

@ LdB
I admit it takes me a lot of time to write the tutorials. But it's so beneficial because I have to check everything and structure my code. In addition it makes references, and it's much simpler than having to decipher a program written a long time ago.
And also you can enjoy it ;-)

User avatar
DavidS
Posts: 4334
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: Spider-OS a new operating system

Thu Jul 04, 2019 5:49 pm

@Aron:
thank you for that. It is your work that finally got me to begin looking at playing with OpenGL on bare metal, as I never did get a good enough grasp on it before. For me it is way more difficult than simple things like DWC USB :) .
RPi = The best ARM based RISC OS computer around
More than 95% of posts made from RISC OS on RPi 1B/1B+ computers. Most of the rest from RISC OS on RPi 2B/3B/3B+ computers

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

Re: Spider-OS a new operating system

Fri Jul 05, 2019 7:54 am

Correct me if I'm wrong but this is not OpenGL but GLES a subset of GL.
Page 63 of manual

Each pipeline can operate in one of three major modes:
• GL mode, in which vertex shading is employed
• NV mode, without vertex shading, using pre-shaded vertices stored in memory
• VG mode, where vertices are supplied directly from the input primitive list as XY coordinates only.

Not sure how you did it but I'm impressed.
Now that my first Pi4 is here I now have decent a native development box.

I do hope we get enough info soon to try this on a VC6.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Aran
Posts: 36
Joined: Fri Jan 25, 2019 5:55 pm

Re: Spider-OS a new operating system

Fri Jul 05, 2019 5:09 pm

@DavidS :
Glad to have helped you. But I'm not sure that USB is simpler. I have so much to add in my driver !

@Gavinmc42 :
OpenGL-ES (or GLES) is a reduced version of OpenGL with less functionality (more suitable for embedded platforms, like Pi).
On page 63 of the manual, we find the different mode of operation of Videocore: ie with the use or not of the vertex shaders.
In OpenGL language we can for example program the type of shape that we want to draw, with the primitives GL_LINES, GL_TRIANGLES ...
The vertex shaders are programmed with another language: the GLSL (OpenGL Shading Language). It looks like this:

Code: Select all

const GLchar* vertexSource = R"glsl(
    #version 120
    attribute vec2 position;    // vpm_read in vertices

    void main()
    {
        gl_Position = vec4(position, 1.0, 1.0);
    }
)glsl";

const GLchar* fragmentSource = R"glsl(
    #version 120

    void main()
    {
        gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);    // uniform : R, G, B, A
    }
)glsl";
When compiling the code, this generates assembly code for the three vertex shaders: fragment, vertex, and coordinates. For example for the fragment shader:

Code: Select all

0x100009e7009e7000 nop nop, r0, r0 ; nop nop, r0, r0
0x100009e7009e7000 nop nop, r0, r0 ; nop nop, r0, r0
0x10020ba715827d80 mov tlb_color_all, uni ; nop nop, r0, r0
0x300009e7009e7000 sig_end nop nop, r0, r0 ; nop nop, r0, r0
0x100009e7009e7000 nop nop, r0, r0 ; nop nop, r0, r0
0x500009e7009e7000 sig_unlock_score nop nop, r0, r0 ; nop nop, r0, r0
And what does this code correspond to ? Well, programming of the vertex shaders as I show in my tutorial :-)
I was inspired to debug my own code.

With the new Raspberry Pi 4, we go to Videocore VI supporting OpenGL-ES 3.0 (GLES 2.0 compatible).
I also hope that we will have a documentation to be able to have fun with !

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

Re: Spider-OS a new operating system

Fri Jul 05, 2019 5:54 pm

Can we stop the confusion ... OpenGL and GLES are standards they say nothing for how you implement.
https://en.wikipedia.org/wiki/OpenGL
The OpenGL specification describes an abstract API for drawing 2D and 3D graphics. Although it is possible for the API to be implemented entirely in software, it is designed to be implemented mostly or entirely in hardware.
We are punching the VC4 hardware GL pipeline nothing less nothing more ... we are NOT DOING OpenGL or GLES.

As Aran said we look at what OpenGL and GLES do with the hardware and then we write code to exploit the hardware. We share some similarities because of how we derived the code or there is only 1 way to do a function in hardware. Most of the time I ignore and in many instances actively violate those specifications.

If we get a Vulkan or DirectX driver for the VideoCore VI it will be a heck of a lot easier to baremetal than the VC4.

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

Re: Spider-OS a new operating system

Sat Jul 06, 2019 2:11 am

If we get a Vulkan or DirectX driver for the VideoCore VI it will be a heck of a lot easier to baremetal than the VC4.
I'm hoping Broadcom have a Vulkan driver, if not they should get one ;)
A whole generation of kids growing up coding Vulkan, that has to be good for the many industries.
Mind you Vulkan is so ugly another layer above that would be nicer.

I understand about using GL hardware directly.
I sort of do the same with the VG, I just happen to use a great library in Ultibo that is based on AJ Starks great stuff.
With those I don't need to learn the hardware, just the library, not really baremetal but easier for me ;)

I tried learning OpenGLES but too many dependencies and most of it was Android not Linux.
OpenGL only really got useful for me on a 3B+ with Gentoo64.
Way to to much bloat for the simple embedded Pi apps and gadgets I make.

So yep this GL is of real interest to me, I hope to one day understand it :oops:
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Bare metal, Assembly language”