Initial versions for OSWindow and Woden

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Initial versions for OSWindow and Woden

Ronie Salgado
Hello There,

I have been working in OSWindow, which is a cross platform API for dealing with native operating system windows. This API requires using a custom VM and the library SDL2.

With this API, even the main Pharo window is handled almost completely in image side using NativeBoost.

The only support required from the VM is a small periodical check in the heartbeat about the presence of events. This no more than 10 lines of code.

This is currently working very well in my Linux machine, so I need to start testing this stuff.

For Windows, soon I will be building the custom VM. My last built was very dirty and I want to do something more clean.

For Mac OS X, I don't have one for testing. But Alex is going allow me to borrow one for some time. So be patience.

As for Woden, it is a new 3D graphics engine that I started making. This one requires currently support of OSWindow and also shows some cool stuffs.

As for prebuilt versions of the VM with OSWindow support along with preloaded images for both, OSWindow and Woden. And screenshots.

Well, I am putting them here: http://ronie.cl/OSWindow/

Greetings,
Ronie
Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

Ben Coman
Hi Ronie,  This is really exciting (and I've cross-posted to vm-dev). I
guess this will help multi-monitor displays to have a window on each
monitor?

Ronie Salgado wrote:

> Hello There,
>
> I have been working in OSWindow, which is a cross platform API for
> dealing with native operating system windows. This API requires using
> a custom VM and the library SDL2.
>
> With this API, even the main Pharo window is handled almost completely
> in image side using NativeBoost.
>
> The only support required from the VM is a small periodical check in
> the heartbeat about the presence of events. This no more than 10 lines
> of code.

Is there much you needed to change/delete from the existing VM window
initialization.  Since the VM is shared with other Smalltalk platforms,
how compatible would this be to maintain in parallel with the existing
VM windows initialization?
cheers -ben

>
> This is currently working very well in my Linux machine, so I need to
> start testing this stuff.
>
> For Windows, soon I will be building the custom VM. My last built was
> very dirty and I want to do something more clean.
>
> For Mac OS X, I don't have one for testing. But Alex is going allow me
> to borrow one for some time. So be patience.
>
> As for Woden, it is a new 3D graphics engine that I started making.
> This one requires currently support of OSWindow and also shows some
> cool stuffs.
>
> As for prebuilt versions of the VM with OSWindow support along with
> preloaded images for both, OSWindow and Woden. And screenshots.
>
> Well, I am putting them here: http://ronie.cl/OSWindow/
>
> Greetings,
> Ronie


Reply | Threaded
Open this post in threaded view
|

Re: [Vm-dev] Re: Initial versions for OSWindow and Woden

David T. Lewis
On Sat, May 31, 2014 at 08:34:47PM +0800, [hidden email] wrote:

>
> Hi Ronie,  This is really exciting (and I've cross-posted to vm-dev). I
> guess this will help multi-monitor displays to have a window on each
> monitor?
>
> Ronie Salgado wrote:
> >Hello There,
> >
> >I have been working in OSWindow, which is a cross platform API for
> >dealing with native operating system windows. This API requires using
> >a custom VM and the library SDL2.
> >
> >With this API, even the main Pharo window is handled almost completely
> >in image side using NativeBoost.
> >
> >The only support required from the VM is a small periodical check in
> >the heartbeat about the presence of events. This no more than 10 lines
> >of code.
>
> Is there much you needed to change/delete from the existing VM window
> initialization.  Since the VM is shared with other Smalltalk platforms,
> how compatible would this be to maintain in parallel with the existing
> VM windows initialization?
> cheers -ben
>

What are the 10 lines of code required to provide the VM support?

Dave


> >
> >This is currently working very well in my Linux machine, so I need to
> >start testing this stuff.
> >
> >For Windows, soon I will be building the custom VM. My last built was
> >very dirty and I want to do something more clean.
> >
> >For Mac OS X, I don't have one for testing. But Alex is going allow me
> >to borrow one for some time. So be patience.
> >
> >As for Woden, it is a new 3D graphics engine that I started making.
> >This one requires currently support of OSWindow and also shows some
> >cool stuffs.
> >
> >As for prebuilt versions of the VM with OSWindow support along with
> >preloaded images for both, OSWindow and Woden. And screenshots.
> >
> >Well, I am putting them here: http://ronie.cl/OSWindow/
> >
> >Greetings,
> >Ronie

Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

laurent laffont
In reply to this post by Ronie Salgado

Hi,

 

Seems to work well on my linux machine too (Arch 64). The main Pharo window is better handled by KDE (don't know why, but nice side effect :)

 

Laurent

 

Le samedi 31 mai 2014, 05:54:52 Ronie Salgado a écrit :

> Hello There,

>

> I have been working in OSWindow, which is a cross platform API for dealing

> with native operating system windows. This API requires using a custom VM

> and the library SDL2.

>

> With this API, even the main Pharo window is handled almost completely in

> image side using NativeBoost.

>

> The only support required from the VM is a small periodical check in the

> heartbeat about the presence of events. This no more than 10 lines of code.

>

> This is currently working very well in my Linux machine, so I need to start

> testing this stuff.

>

> For Windows, soon I will be building the custom VM. My last built was very

> dirty and I want to do something more clean.

>

> For Mac OS X, I don't have one for testing. But Alex is going allow me to

> borrow one for some time. So be patience.

>

> As for Woden, it is a new 3D graphics engine that I started making. This

> one requires currently support of OSWindow and also shows some cool stuffs.

>

> As for prebuilt versions of the VM with OSWindow support along with

> preloaded images for both, OSWindow and Woden. And screenshots.

>

> Well, I am putting them here: http://ronie.cl/OSWindow/

>

> Greetings,

> Ronie

 

Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

philippeback
Ronie,

Throw the VM sources somewhere so that I can try this on CentOS. Glibc 2_15 issue...

Phil


On Sat, May 31, 2014 at 5:12 PM, Laurent Laffont <[hidden email]> wrote:

Hi,

 

Seems to work well on my linux machine too (Arch 64). The main Pharo window is better handled by KDE (don't know why, but nice side effect :)

 

Laurent

 

Le samedi 31 mai 2014, 05:54:52 Ronie Salgado a écrit :

> Hello There,

>

> I have been working in OSWindow, which is a cross platform API for dealing

> with native operating system windows. This API requires using a custom VM

> and the library SDL2.

>

> With this API, even the main Pharo window is handled almost completely in

> image side using NativeBoost.

>

> The only support required from the VM is a small periodical check in the

> heartbeat about the presence of events. This no more than 10 lines of code.

>

> This is currently working very well in my Linux machine, so I need to start

> testing this stuff.

>

> For Windows, soon I will be building the custom VM. My last built was very

> dirty and I want to do something more clean.

>

> For Mac OS X, I don't have one for testing. But Alex is going allow me to

> borrow one for some time. So be patience.

>

> As for Woden, it is a new 3D graphics engine that I started making. This

> one requires currently support of OSWindow and also shows some cool stuffs.

>

> As for prebuilt versions of the VM with OSWindow support along with

> preloaded images for both, OSWindow and Woden. And screenshots.

>

> Well, I am putting them here: http://ronie.cl/OSWindow/

>

> Greetings,

> Ronie

 


Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

Ronie Salgado
Sorry about the missing VM source. I am uploading the changes into my github repository: https://github.com/ronsaldo/pharo-vm

As for the details of loading a OSWindow into a Pharo image, there is a fogbugz issue with all the required instructions.

Now, OSWindow relies heavily on NativeBoost, so as for Squeak integration they would need to support it. Now, I am also working on a new FFI, which will allows NB to have a better integration with the existing VM. With the FFI iam working on, it should be possible to use NB for when machine code generation is forbidden. In this project I am having discussions and working with Igor, Esteban, Clement and Eliot.

Currently OSWindow is mostly for Pharo, but it should be possible to have it for more Smalltalks.

As for the existing VM windows, we removed it completely for Linux with Igor. In Pharo, we don't want to maintain that old code in C, because is huge, really hard to understand and it has his limitations. For example, with the old VM window we have to pass mouse wheel events as if there keyboard presses. Windows and Mac OS X are next.

In OSWindow, we receive the raw events that SDL2 or an operating system specific backend provide us. Later I will try it with a joystick.

------------------
-- VM Changes
----------------------

The SDL2Display plugin has the following code:

extern struct VirtualMachine* interpreterProxy;
extern void setIoProcessEventsHandler(void * handler);

static int inited = 0;
static int inputSemaphoreIndex = 0;

/**
 * Called by the VM heartbeat if installed, to check for the presence of events.
 */
static void ioCheckForEvents() {
    if (inited) {
        SDL_PumpEvents();
        if (SDL_HasEvents(SDL_FIRSTEVENT, SDL_LASTEVENT)) {
            interpreterProxy->signalSemaphoreWithIndex(inputSemaphoreIndex);
        }
    }
}

void setSDL2InputSemaphoreIndex(int semaIndex) {
    inited = 1;
    inputSemaphoreIndex = semaIndex;
    setIoProcessEventsHandler(&ioCheckForEvents);
}

The only change needed for existing platform specific driver is to implement:
extern void setIoProcessEventsHandler(void * handler);

In Windows, I just had to add:

/*sqWin32Window.c*/

/*Line 179*//**
 * HACK: Hook for SDL2.
 */
static void (*ioCheckForEventsHooks)(void);

EXPORT(void) setIoProcessEventsHandler(void * handler) {
    ioCheckForEventsHooks = (void (*)())handler;
}

/*Line 1586 */        /* HACK: for SDL2.*/
        if(ioCheckForEventsHooks)
            ioCheckForEventsHooks();

I called them hacks, because a proper way means killing that code. As for the VM Windows code, it gives me the impression of being unnecessarily complex and to also have performance issues. In my laptop in Linux it takes about one minute to load NBOpenGL into a new image, but in Windows it takes about one hour, in the same machine.

It could be my impression, but is window using multiples thread, one for IO and another for the actual VM?

Greetings,
Ronie


2014-05-31 11:39 GMT-04:00 [hidden email] <[hidden email]>:
Ronie,

Throw the VM sources somewhere so that I can try this on CentOS. Glibc 2_15 issue...

Phil


On Sat, May 31, 2014 at 5:12 PM, Laurent Laffont <[hidden email]> wrote:

Hi,

 

Seems to work well on my linux machine too (Arch 64). The main Pharo window is better handled by KDE (don't know why, but nice side effect :)

 

Laurent

 

Le samedi 31 mai 2014, 05:54:52 Ronie Salgado a écrit :

> Hello There,

>

> I have been working in OSWindow, which is a cross platform API for dealing

> with native operating system windows. This API requires using a custom VM

> and the library SDL2.

>

> With this API, even the main Pharo window is handled almost completely in

> image side using NativeBoost.

>

> The only support required from the VM is a small periodical check in the

> heartbeat about the presence of events. This no more than 10 lines of code.

>

> This is currently working very well in my Linux machine, so I need to start

> testing this stuff.

>

> For Windows, soon I will be building the custom VM. My last built was very

> dirty and I want to do something more clean.

>

> For Mac OS X, I don't have one for testing. But Alex is going allow me to

> borrow one for some time. So be patience.

>

> As for Woden, it is a new 3D graphics engine that I started making. This

> one requires currently support of OSWindow and also shows some cool stuffs.

>

> As for prebuilt versions of the VM with OSWindow support along with

> preloaded images for both, OSWindow and Woden. And screenshots.

>

> Well, I am putting them here: http://ronie.cl/OSWindow/

>

> Greetings,

> Ronie

 



Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

Ronie Salgado
In reply to this post by Ronie Salgado
Now I added a prebuilt version of the VM for Windows in the same site.

In Windows there are some bugs, but they are completely on image side. Even the Woden image with OpenGL works.

Greetings
Ronie


2014-05-31 5:54 GMT-04:00 Ronie Salgado <[hidden email]>:
Hello There,

I have been working in OSWindow, which is a cross platform API for dealing with native operating system windows. This API requires using a custom VM and the library SDL2.

With this API, even the main Pharo window is handled almost completely in image side using NativeBoost.

The only support required from the VM is a small periodical check in the heartbeat about the presence of events. This no more than 10 lines of code.

This is currently working very well in my Linux machine, so I need to start testing this stuff.

For Windows, soon I will be building the custom VM. My last built was very dirty and I want to do something more clean.

For Mac OS X, I don't have one for testing. But Alex is going allow me to borrow one for some time. So be patience.

As for Woden, it is a new 3D graphics engine that I started making. This one requires currently support of OSWindow and also shows some cool stuffs.

As for prebuilt versions of the VM with OSWindow support along with preloaded images for both, OSWindow and Woden. And screenshots.

Well, I am putting them here: http://ronie.cl/OSWindow/

Greetings,
Ronie


OSWindow win8.png (930K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

stepharo
In reply to this post by Ronie Salgado
Hi ronie

I should sync with igor to understand what is the path to integrate what
you did with him.
Because I want new events and what you and igor did (or at least I do
not want to lose all the event cleaning I did long time
ago).

I wish a lot of success to Woden :)
Stef

On 31/5/14 11:54, Ronie Salgado wrote:

> Hello There,
>
> I have been working in OSWindow, which is a cross platform API for
> dealing with native operating system windows. This API requires using
> a custom VM and the library SDL2.
>
> With this API, even the main Pharo window is handled almost completely
> in image side using NativeBoost.
>
> The only support required from the VM is a small periodical check in
> the heartbeat about the presence of events. This no more than 10 lines
> of code.
>
> This is currently working very well in my Linux machine, so I need to
> start testing this stuff.
>
> For Windows, soon I will be building the custom VM. My last built was
> very dirty and I want to do something more clean.
>
> For Mac OS X, I don't have one for testing. But Alex is going allow me
> to borrow one for some time. So be patience.
>
> As for Woden, it is a new 3D graphics engine that I started making.
> This one requires currently support of OSWindow and also shows some
> cool stuffs.
>
> As for prebuilt versions of the VM with OSWindow support along with
> preloaded images for both, OSWindow and Woden. And screenshots.
>
> Well, I am putting them here: http://ronie.cl/OSWindow/
>
> Greetings,
> Ronie


Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

Sean P. DeNigris
Administrator
In reply to this post by Ronie Salgado
Ronie Salgado wrote
For Mac OS X, I don't have one for testing. But Alex is going allow me to
borrow one for some time. So be patience.
Any progress? I can help with testing...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: [Vm-dev] Re: Initial versions for OSWindow and Woden

Igor Stasenko
In reply to this post by David T. Lewis



On 31 May 2014 14:42, David T. Lewis <[hidden email]> wrote:

On Sat, May 31, 2014 at 08:34:47PM +0800, [hidden email] wrote:
>
> Hi Ronie,  This is really exciting (and I've cross-posted to vm-dev). I
> guess this will help multi-monitor displays to have a window on each
> monitor?
>
> Ronie Salgado wrote:
> >Hello There,
> >
> >I have been working in OSWindow, which is a cross platform API for
> >dealing with native operating system windows. This API requires using
> >a custom VM and the library SDL2.
> >
> >With this API, even the main Pharo window is handled almost completely
> >in image side using NativeBoost.
> >
> >The only support required from the VM is a small periodical check in
> >the heartbeat about the presence of events. This no more than 10 lines
> >of code.
>
> Is there much you needed to change/delete from the existing VM window
> initialization.  Since the VM is shared with other Smalltalk platforms,
> how compatible would this be to maintain in parallel with the existing
> VM windows initialization?
> cheers -ben
>

What are the 10 lines of code required to provide the VM support?


speaking about numbers,
it is like
+ 10 lines of new code in C
and
- 10000 lines of old code in C in exchange of 1/100 of smalltalk code in image.
 
sure, numbers are not precise, but you can just make a diff in git to measure.

The overall idea is to let the image decide what is the best way to do i/o with OS windowing API (if it has one), not the VM.

Dave

--
Best regards,
Igor Stasenko.
Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

Ronie Salgado
In reply to this post by Sean P. DeNigris

Any progress? I can help with testing...
Not too much progress. Don't worry. I added a morphic based fallback to woden if OSWindow is not supported.

Greetings,
Ronie


2014-08-19 18:00 GMT+01:00 Sean P. DeNigris <[hidden email]>:
Ronie Salgado wrote
> For Mac OS X, I don't have one for testing. But Alex is going allow me to
> borrow one for some time. So be patience.

Any progress? I can help with testing...



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Initial-versions-for-OSWindow-and-Woden-tp4761069p4773866.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

Tudor Girba-2
And it works great :)

Doru


On Wed, Aug 20, 2014 at 11:58 AM, Ronie Salgado <[hidden email]> wrote:

Any progress? I can help with testing...
Not too much progress. Don't worry. I added a morphic based fallback to woden if OSWindow is not supported.

Greetings,
Ronie


2014-08-19 18:00 GMT+01:00 Sean P. DeNigris <[hidden email]>:

Ronie Salgado wrote
> For Mac OS X, I don't have one for testing. But Alex is going allow me to
> borrow one for some time. So be patience.

Any progress? I can help with testing...



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Initial-versions-for-OSWindow-and-Woden-tp4761069p4773866.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.





--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

Sean P. DeNigris
Administrator
Tudor Girba-2 wrote
And it works great :)
> Not too much progress. Don't worry. I added a morphic based fallback to
> woden if OSWindow is not supported.
Ah, so "not on Mac yet" only applied to OSWindow? What would it take to have that working? Maybe I can help...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

Sean P. DeNigris
Administrator
Sean P. DeNigris wrote
Ah, so "not on Mac yet" only applied to OSWindow?
Okay, I see all Woden examples work on Mac except WDTerrainExample and WDPhysicsExample. I tried loading Woden-Bullet for #2, but there were undefined classes e.g. BTDefaultCollisionConfiguration
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

Ronie Salgado
Ah, so "not on Mac yet" only applied to OSWindow? What would it take to have
that working? Maybe I can help...
OSWindow to fully work requires a custom VM. For Mac, I actually already tried using one of Alex Mac. It worked, but when I tried an older version of Woden and OSWindow it crashed. With Igor and Esteban we will take a better look on this.

Okay, I see all Woden examples work on Mac except WDTerrainExample and
WDPhysicsExample

WDTerrainExample uses OpenCL with OpenGL interoperability, whose support I have not added yet to Mac. The API for creating an OpenCL context with OpenGL interoperability is a bit platform specific.

The WDPhysicsExample uses Bullet. The Bullet bindings are quite tricky to build/load in comparison to a typical Pharo project. It requires my modified version of Swig. This version of Swig can generate NativeBoost from a C/C++ header. It is available in: https://github.com/ronsaldo/swig

The Bullet bindings and scripts for automatically building for Linux are here: https://github.com/ronsaldo/bullet-pharo

I need to provide a more pharoish way to build Bullet and the bindings.

Best regards,
Ronie


2014-08-20 14:01 GMT+01:00 Sean P. DeNigris <[hidden email]>:
Sean P. DeNigris wrote
> Ah, so "not on Mac yet" only applied to OSWindow?

Okay, I see all Woden examples work on Mac except WDTerrainExample and
WDPhysicsExample. I tried loading Woden-Bullet for #2, but there were
undefined classes e.g. BTDefaultCollisionConfiguration



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Initial-versions-for-OSWindow-and-Woden-tp4761069p4773941.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Initial versions for OSWindow and Woden

Sean P. DeNigris
Administrator
Ronie Salgado wrote
OSWindow to fully work requires a custom VM....
The WDPhysicsExample uses Bullet. The Bullet bindings are quite tricky to
build/load in comparison to a typical Pharo project
Is there a CI job for the VM? For the full-project-load?
Cheers,
Sean