Patches to SqueakFFIPrims and FFI-Kernel to support "manual surfaces"

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

Patches to SqueakFFIPrims and FFI-Kernel to support "manual surfaces"

Josh Gargus
 
Hi,

Here's a zip file that contains patches to SqueakFFIPrims (both Slang and C support files) and FFI-Kernels in order to support "manual surfaces", as embodied in the new class ExternalForm.  There's a README in the zip file that describes how the changes fit together, so here I'll just describe the goal.

The intent is to have a subclass of Form, ExternalForm, that uses an arbitrary pointer as the location of its pixel-data.  It achieves this by acting as a client of SurfacePlugin much like any other, with the added twist of a primitive that enables Squeak code to set/clear the pointer.  This is useful when working with such APIs as OpenGL and OpenCL, which provide a "map-image" API for interacting with images which reside in GPU memory.  For example, if you want to access the updated contents of an OpenCL image, you would call clEnqueueMapImage().  This returns a pointer to CPU-accessible memory; by using this as the pointer for an ExternalForm, we can seamlessly use the OpenCL image just like any other Squeak Form.

Cheers,
Josh


PatchesForExternalForm.zip (25K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Patches to SqueakFFIPrims and FFI-Kernel to support "manual surfaces"

David T. Lewis
 
On Sat, Jan 30, 2010 at 10:27:00AM -0800, Josh Gargus wrote:

>  
> Hi,
>
> Here's a zip file that contains patches to SqueakFFIPrims (both Slang and
> C support files) and FFI-Kernels in order to support "manual surfaces",
> as embodied in the new class ExternalForm.  There's a README in the zip
> file that describes how the changes fit together, so here I'll just
> describe the goal.
>
> The intent is to have a subclass of Form, ExternalForm, that uses an
> arbitrary pointer as the location of its pixel-data.  It achieves this
> by acting as a client of SurfacePlugin much like any other, with the added
> twist of a primitive that enables Squeak code to set/clear the pointer.
> This is useful when working with such APIs as OpenGL and OpenCL, which
> provide a "map-image" API for interacting with images which reside in
> GPU memory.  For example, if you want to access the updated contents of
> an OpenCL image, you would call clEnqueueMapImage().  This returns a
> pointer to CPU-accessible memory; by using this as the pointer for an
> ExternalForm, we can seamlessly use the OpenCL image just like any other
> Squeak Form.

Josh,

Sounds good!

Just FYI, there are 64 bit issues with both FFI and SurfacePlugin.

  Mantis 7237: Make FFI work on 64 bit platforms
    (http://bugs.squeak.org/view.php?id=7237)
  Mantis 7433: Gstreamer and Pango plugins fail on 64-bit host
    (http://bugs.squeak.org/view.php?id=7433)

Patches for FFI are available but not yet integrated (this is a
big set of changes that affects the interpreter as well as the
plugin). The issues with SurfacePlugin and dependent plugins have
not been addressed yet.

I'm mentioning this just so you are aware of the issues.

Dave

Reply | Threaded
Open this post in threaded view
|

Re: Patches to SqueakFFIPrims and FFI-Kernel to support "manual surfaces"

johnmci
In reply to this post by Josh Gargus

Ah, well here is an interesting issue for you to solve then.

http://bugs.squeak.org/view.php?id=5236


On 2010-01-30, at 10:27 AM, Josh Gargus wrote:

> Hi,
>
> Here's a zip file that contains patches to SqueakFFIPrims (both Slang and C support files) and FFI-Kernels in order to support "manual surfaces", as embodied in the new class ExternalForm.  There's a README in the zip file that describes how the changes fit together, so here I'll just describe the goal.
>
> The intent is to have a subclass of Form, ExternalForm, that uses an arbitrary pointer as the location of its pixel-data.  It achieves this by acting as a client of SurfacePlugin much like any other, with the added twist of a primitive that enables Squeak code to set/clear the pointer.  This is useful when working with such APIs as OpenGL and OpenCL, which provide a "map-image" API for interacting with images which reside in GPU memory.  For example, if you want to access the updated contents of an OpenCL image, you would call clEnqueueMapImage().  This returns a pointer to CPU-accessible memory; by using this as the pointer for an ExternalForm, we can seamlessly use the OpenCL image just like any other Squeak Form.
>
> Cheers,
> Josh
>
> <PatchesForExternalForm.zip>

--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================




Reply | Threaded
Open this post in threaded view
|

Re: Patches to SqueakFFIPrims and FFI-Kernel to support "manual surfaces"

Josh Gargus
In reply to this post by David T. Lewis

On Jan 30, 2010, at 11:35 AM, David T. Lewis wrote:

>
> On Sat, Jan 30, 2010 at 10:27:00AM -0800, Josh Gargus wrote:
>>
>> Hi,
>>
>> Here's a zip file that contains patches to SqueakFFIPrims (both Slang and
>> C support files) and FFI-Kernels in order to support "manual surfaces",
>> as embodied in the new class ExternalForm.  There's a README in the zip
>> file that describes how the changes fit together, so here I'll just
>> describe the goal.
>>
>> The intent is to have a subclass of Form, ExternalForm, that uses an
>> arbitrary pointer as the location of its pixel-data.  It achieves this
>> by acting as a client of SurfacePlugin much like any other, with the added
>> twist of a primitive that enables Squeak code to set/clear the pointer.
>> This is useful when working with such APIs as OpenGL and OpenCL, which
>> provide a "map-image" API for interacting with images which reside in
>> GPU memory.  For example, if you want to access the updated contents of
>> an OpenCL image, you would call clEnqueueMapImage().  This returns a
>> pointer to CPU-accessible memory; by using this as the pointer for an
>> ExternalForm, we can seamlessly use the OpenCL image just like any other
>> Squeak Form.
>
> Josh,
>
> Sounds good!
>
> Just FYI, there are 64 bit issues with both FFI and SurfacePlugin.
>
>  Mantis 7237: Make FFI work on 64 bit platforms
>    (http://bugs.squeak.org/view.php?id=7237)
>  Mantis 7433: Gstreamer and Pango plugins fail on 64-bit host
>    (http://bugs.squeak.org/view.php?id=7433)
>
> Patches for FFI are available but not yet integrated (this is a
> big set of changes that affects the interpreter as well as the
> plugin). The issues with SurfacePlugin and dependent plugins have
> not been addressed yet.


Thanks for the info.  I noticed that SurfacePlugin has 32-bit assumptions built in, and I just went with the flow.  When SurfacePlugin is fixed (whenever/however that happens), my new primitives will also need fixing.

Cheers,
Josh




>
> I'm mentioning this just so you are aware of the issues.
>
> Dave
>

Reply | Threaded
Open this post in threaded view
|

Re: Patches to SqueakFFIPrims and FFI-Kernel to support "manual surfaces"

Josh Gargus
In reply to this post by johnmci


On Jan 30, 2010, at 11:54 AM, John M McIntosh wrote:

>
> Ah, well here is an interesting issue for you to solve then.
>
> http://bugs.squeak.org/view.php?id=5236


Another good one to be aware of, thanks.  It's not biting me currently, so I'm going to try to push forward with my current goals.

Cheers,
Josh



>
>
> On 2010-01-30, at 10:27 AM, Josh Gargus wrote:
>
>> Hi,
>>
>> Here's a zip file that contains patches to SqueakFFIPrims (both Slang and C support files) and FFI-Kernels in order to support "manual surfaces", as embodied in the new class ExternalForm.  There's a README in the zip file that describes how the changes fit together, so here I'll just describe the goal.
>>
>> The intent is to have a subclass of Form, ExternalForm, that uses an arbitrary pointer as the location of its pixel-data.  It achieves this by acting as a client of SurfacePlugin much like any other, with the added twist of a primitive that enables Squeak code to set/clear the pointer.  This is useful when working with such APIs as OpenGL and OpenCL, which provide a "map-image" API for interacting with images which reside in GPU memory.  For example, if you want to access the updated contents of an OpenCL image, you would call clEnqueueMapImage().  This returns a pointer to CPU-accessible memory; by using this as the pointer for an ExternalForm, we can seamlessly use the OpenCL image just like any other Squeak Form.
>>
>> Cheers,
>> Josh
>>
>> <PatchesForExternalForm.zip>
>
> --
> ===========================================================================
> John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> ===========================================================================
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Patches to SqueakFFIPrims and FFI-Kernel to support "manual surfaces"

David T. Lewis
In reply to this post by Josh Gargus
 
On Sat, Jan 30, 2010 at 01:51:06PM -0800, Josh Gargus wrote:
>
> Thanks for the info.  I noticed that SurfacePlugin has 32-bit assumptions
> built in, and I just went with the flow. When SurfacePlugin is fixed
> (whenever/however that happens), my new primitives will also need fixing.

Yes, that is the right thing to do.

Dave

Reply | Threaded
Open this post in threaded view
|

Re: Patches to SqueakFFIPrims and FFI-Kernel to support "manual surfaces"

Andreas.Raab
In reply to this post by Josh Gargus
 
As I'm sure you've noticed I committed Josh's changes to SVN and Monticello.

Cheers,
   - Andreas

Josh Gargus wrote:

>  
>
>
> ------------------------------------------------------------------------
>
> Hi,
>
> Here's a zip file that contains patches to SqueakFFIPrims (both Slang and C support files) and FFI-Kernels in order to support "manual surfaces", as embodied in the new class ExternalForm.  There's a README in the zip file that describes how the changes fit together, so here I'll just describe the goal.
>
> The intent is to have a subclass of Form, ExternalForm, that uses an arbitrary pointer as the location of its pixel-data.  It achieves this by acting as a client of SurfacePlugin much like any other, with the added twist of a primitive that enables Squeak code to set/clear the pointer.  This is useful when working with such APIs as OpenGL and OpenCL, which provide a "map-image" API for interacting with images which reside in GPU memory.  For example, if you want to access the updated contents of an OpenCL image, you would call clEnqueueMapImage().  This returns a pointer to CPU-accessible memory; by using this as the pointer for an ExternalForm, we can seamlessly use the OpenCL image just like any other Squeak Form.
>
> Cheers,
> Josh
>