Best way organizing XRender additions for the X11 pipeline?

View: New views
15 Messages — Rating Filter:   Alert me  

Best way organizing XRender additions for the X11 pipeline?

by Bugzilla from linuxhippy@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I've some spare-time left so maybe I find some time to implement the
most used software-fallbacks using XRender. There has been significant
progress when it comes to XRender. With the EXA framework a few
open-source drivers will soon be capable of accalerating fancy things,
and nvidia has excellent XREnder accelaration in their latest binary
driver.

I wonder what would be better:
- Copy the source and implement an "XRender" pipeline replacing as
much of X11 drawing functionality as possible.
- Extend the existing one and let software-fallbacks there if no
XRender is available.

I would prefer the second, since XRender is just another extension.

lg Clemens

Re: Best way organizing XRender additions for the X11 pipeline?

by Jesse W. Hathaway :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Hello,
>
> I've some spare-time left so maybe I find some time to implement the
> most used software-fallbacks using XRender. There has been significant
> progress when it comes to XRender. With the EXA framework a few
> open-source drivers will soon be capable of accalerating fancy things,
> and nvidia has excellent XREnder accelaration in their latest binary
> driver.
>
> I wonder what would be better:
> - Copy the source and implement an "XRender" pipeline replacing as
> much of X11 drawing functionality as possible.
> - Extend the existing one and let software-fallbacks there if no
> XRender is available.

Has creating a Cairo, cairographics.org, pipeline been considered? A
Cairo pipeline would give you software fall backs as well as
acceleration when available. Also given the increasing interest in
using Cairo for X11 rendering its performance should only get better
over time. Finally you could compare performance across Windows and
OSX since Cairo supports both platforms.

-Jesse

Re: Best way organizing XRender additions for the X11 pipeline?

by Bugzilla from linuxhippy@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Has creating a Cairo, cairographics.org, pipeline been considered? A
> Cairo pipeline would give you software fall backs as well as
> acceleration when available.
Well I would welcome a Cairo-Java2D implementation, although I don't
see many benefits. However choice is never a bad idea if its offered
for free.
If you don't plan to do it ... its the usual problem with OSS
projects: Many people telling others what they should do, but only a
few writing code. Sorry for beeing not friendly ;)

> Finally you could compare performance across Windows and
> OSX since Cairo supports both platforms.
Yes Cairo supports both platforms, but performance differs a lot on
different platforms, except if you use software-rendering which is not
something desireable.

lg Clemens

Re: Best way organizing XRender additions for the X11 pipeline?

by Jesse W. Hathaway :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> > Has creating a Cairo, cairographics.org, pipeline been considered? A
> > Cairo pipeline would give you software fall backs as well as
> > acceleration when available.
> Well I would welcome a Cairo-Java2D implementation, although I don't
> see many benefits. However choice is never a bad idea if its offered
> for free.

I think the primary benefits are: precise vector based graphical output,
insulation from direct X11 drawing operators, and multiple acceleration
backends (OpenGL, Render via xlib or XCB).

> If you don't plan to do it ... its the usual problem with OSS
> projects: Many people telling others what they should do, but only a
> few writing code. Sorry for beeing not friendly ;)

agreed, no offense taken

> > Finally you could compare performance across Windows and
> > OSX since Cairo supports both platforms.
> Yes Cairo supports both platforms, but performance differs a lot on
> different platforms, except if you use software-rendering which is not
> something desireable.
>
> lg Clemens

--
The trenchant blade, Toledo trusty,
For want of fighting was grown rusty,
And ate into itself, for lack
Of somebody to hew and hack.
                     -- Samuel Butler

Re: Best way organizing XRender additions for the X11 pipeline?

by Bugzilla from linuxhippy@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I think the primary benefits are: precise vector based graphical output,
> insulation from direct X11 drawing operators, and multiple acceleration
> backends (OpenGL, Render via xlib or XCB).
I agree to some degree - and if I would have to write java from
scratch I would immediatly choose cairo as API for 2d rendering. (not
creating Java2d api on top of it)
However for Java2D almost everything is already there (GDI, Direct3d,
OpenGL, X11, Quarzt, Software, ...), its working well :) and layering
Java2D on top Cairo probably isn't that simple.

> agreed, no offense taken
Thats great, it was not my intention to offend you.

lg Clemens

Re: Best way organizing XRender additions for theX11 pipeline?

by Ben Loud :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm not an expert, but I don't think Cairo would be appropriate for
OpenJDK, at least not as a complete Java2D implementation. Not that it
cant work, Classpath did just that quite successfully. But OpenJDK
already has a huge amount of a 2D stack implemented that they've
developed over many years including comprehensive and high quality
support for image rendering and transforming, compositing, color
mapping, text layout and rasterization etc. and its all high performing
and works great with OpenGL and D3D pipelines.

As far as I can tell, Cairo only exposes a high level API (like Java2D)
so to use it, you would probably have to throw away all the existing
OpenJDK Java2D code in order to use it. That would be a real shame since
many would argue its the best in the business! (it's the main reason I
choose Java as my platform). Besides I don't think Cairo supports
anywhere near the number of image formats that Java2D does and its
hardware acceleration isnt yet in the same league. And if I remember
correctly, it doesn't support non-antialiased rendering.

If there was anything in Cairo that Java2D could benefit from, it would
be just the part that does AA rasterizing of shapes in to tiles. But
factoring that out would probably be tricky. Besides, doing it ourselves
would be so much more fun :)

But if there are X11 drawing calls that can be replaced with XRender
then I'd be all for that! I know almost nothing about *nix graphics
technologies. Maybe someone can enlighten me on the details. It looks
like it can do compositing, image affine transforms, image convolution
(nice!), glyph caching and even linear and radial gradients. Does Java2D
not take advtange of any this yet? Sounds like a promising oppertunity.
But the only documentation I could find on it was sketchy. It looks like
it can make surfaces in VRAM and do compositing entirely in hardware. It
might then have potential to perform as well as OpenGL. Definitely worth
exploring! Go for it Clemens!

-----Original Message-----
From: 2d-dev-bounces@...
[mailto:2d-dev-bounces@...] On Behalf Of Jesse W. Hathaway
Sent: Wednesday, 5 December 2007 1:41 AM
To: 2d-dev@...
Subject: Re: [OpenJDK 2D-Dev] Best way organizing XRender additions for
theX11 pipeline?

> Hello,
>
> I've some spare-time left so maybe I find some time to implement the
> most used software-fallbacks using XRender. There has been significant
> progress when it comes to XRender. With the EXA framework a few
> open-source drivers will soon be capable of accalerating fancy things,
> and nvidia has excellent XREnder accelaration in their latest binary
> driver.
>
> I wonder what would be better:
> - Copy the source and implement an "XRender" pipeline replacing as
> much of X11 drawing functionality as possible.
> - Extend the existing one and let software-fallbacks there if no
> XRender is available.

Has creating a Cairo, cairographics.org, pipeline been considered? A
Cairo pipeline would give you software fall backs as well as
acceleration when available. Also given the increasing interest in
using Cairo for X11 rendering its performance should only get better
over time. Finally you could compare performance across Windows and
OSX since Cairo supports both platforms.

-Jesse
"Warning:
The information contained in this email and any attached files is
confidential to BAE Systems Australia. If you are not the intended
recipient, any use, disclosure or copying of this email or any
attachments is expressly prohibited.  If you have received this email
in error, please notify us immediately. VIRUS: Every care has been
taken to ensure this email and its attachments are virus free,
however, any loss or damage incurred in using this email is not the
sender's responsibility.  It is your responsibility to ensure virus
checks are completed before installing any data sent in this email to
your computer."



Re: Best way organizing XRender additions for theX11 pipeline?

by Carl Worth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 5 Dec 2007 11:43:42 +1030, "LOUD, Ben" wrote:
> I'm not an expert, but I don't think Cairo would be appropriate for
> OpenJDK, at least not as a complete Java2D implementation.

I've been involved with the cairo implementation since the beginning,
(and even before that). I don't know a *lot* about Java2D but you're
probably quite right that there are likely to be things missing in
cairo that would be needed for a complete Java2D implementation.

> As far as I can tell, Cairo only exposes a high level API (like Java2D)
> so to use it, you would probably have to throw away all the existing
> OpenJDK Java2D code in order to use it.

I'm really not sure what that means exactly.

> But if there are X11 drawing calls that can be replaced with XRender
> then I'd be all for that! I know almost nothing about *nix graphics
> technologies. Maybe someone can enlighten me on the details. It looks
> like it can do compositing, image affine transforms, image convolution
> (nice!), glyph caching and even linear and radial gradients. Does Java2D
> not take advtange of any this yet? Sounds like a promising oppertunity.
> But the only documentation I could find on it was sketchy. It looks like
> it can make surfaces in VRAM and do compositing entirely in hardware. It
> might then have potential to perform as well as OpenGL. Definitely worth
> exploring! Go for it Clemens!
Yes, the X Render extension does support that list. And honestly, the
reason it isn't better documented is that we wrote cairo specifically
to be an easier-to-use interface for X Render functionality[*].

So if you do want to start using Render inside Java2D, (which seems
only a good thing when targeting an X server), the recommended
approach would be to use cairo to do that. This wouldn't mean that you
would have to use cairo to replace other existing non-X backends in
Java2D at all, of course.

If anyone is interested in exploring this further, I'd be more than
happy to answer any questions about cairo's functionality, how to use
it, or how it might be improved in the future.

Thanks,

-Carl

[*] Initial versions of cairo were strictly targeting X Render---the
capability of targeting Win32, Quartz, PostScript, PDF, SVG, OpenGL,
etc. all came much later.


attachment0 (196 bytes) Download Attachment

Re: Best way organizing XRender additions for theX11 pipeline?

by Bugzilla from linuxhippy@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

> Yes, the X Render extension does support that list. And honestly, the
> reason it isn't better documented is that we wrote cairo specifically
> to be an easier-to-use interface for X Render functionality[*].
>
> So if you do want to start using Render inside Java2D, (which seems
> only a good thing when targeting an X server), the recommended
> approach would be to use cairo to do that. This wouldn't mean that you
> would have to use cairo to replace other existing non-X backends in
> Java2D at all, of course.
Despite the fact that cairo is a wonderful piece of software and its
great that we have it - I still don't see the advantage of using
cairo.
In Java2D/X11 everything is already there: the API, tesselation ... -
the only missing part are some rasterization fast-paths.

Do you know some documentation about Render, or some samples? Should I
look at Cairo's source?

Thanks, lg Clemens

Re: Best way organizing XRender additions for theX11 pipeline?

by Carl Worth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 5 Dec 2007 10:41:09 +0100, "Clemens Eisserer" wrote:
> Despite the fact that cairo is a wonderful piece of software and its
> great that we have it - I still don't see the advantage of using
> cairo.

If nothing else, it's much easier to use than Render's
interface. That's my only point for now.

> In Java2D/X11 everything is already there: the API, tesselation ... -
> the only missing part are some rasterization fast-paths.
>
> Do you know some documentation about Render, or some samples? Should I
> look at Cairo's source?

The only real documentation I know of is the Render protocol
specification, (which is what I used when I wrote the first
Render-using code in cairo). And cairo is the only real sample I
know. Do feel free to look at cairo's source to learn things, of
course.

-Carl


attachment0 (196 bytes) Download Attachment

Re: Best way organizing XRender additions for theX11 pipeline?

by Ben Loud :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Re: [OpenJDK 2D-Dev] Best way organizing XRender additions for theX11 pipeline?
Wow, Carl Worth himself! Great to see you on the list. Cairo no doubt is a wonderful package, a true gem of free software. All i meant by my "high level" comment was that its a complete top to bottom graphics package, when really the only part that OpenJDK desperately needs is one part of the pipeline, the part that rasterises paths to produce masks. OpenJDKs existing Java2D can do the rest (and do it very well) including compositing, text, transforms, color conversion etc. I couldnt see how Cairo could be made to work together with all of this existing code.
 
Unless maybe if we implemented AATileGenerator to create an A8 Cairo image surfaces as tiles, and rasterize paths to those. Then Java2D can do the rest, including compositing to to X11/GDI/OGL/D3D/whatever. It just means we'd be be including Cairo for just a subset of its functionality. I'd be all for it though. Im sceptical that the pure Java Pices rasterizer that replaced Ductus could ever perform as well as we'd like.
 
I wonder how difficult it would be to factor out Cairo's rasterisation and stroking code so we could just use that. We wouldnt need its compositng, font support, SVG and PDF backends etc. etc. Of course I know zero about Cairo's internals but if its feasible, it might be worth a look. I'd love to see it happen.
 
I doubt we'd need cairo to take advantage of X Render though. That doesnt sound to me like the difficult part. I would think it would similar to what they've already done for OGL and D3D.
 
2D team, thoughts? Is X Render used at all or do you have any plans to use it? Do you think theres any potential for Cairo as a rasterizer if it were possible to isolate that code?


From: Carl Worth [mailto:cworth@...]
Sent: Wed 5/12/2007 6:45 PM
To: LOUD, Ben
Cc: 2d-dev@...
Subject: Re: [OpenJDK 2D-Dev] Best way organizing XRender additions for theX11 pipeline?

On Wed, 5 Dec 2007 11:43:42 +1030, "LOUD, Ben" wrote:
> I'm not an expert, but I don't think Cairo would be appropriate for
> OpenJDK, at least not as a complete Java2D implementation.

I've been involved with the cairo implementation since the beginning,
(and even before that). I don't know a *lot* about Java2D but you're
probably quite right that there are likely to be things missing in
cairo that would be needed for a complete Java2D implementation.

> As far as I can tell, Cairo only exposes a high level API (like Java2D)
> so to use it, you would probably have to throw away all the existing
> OpenJDK Java2D code in order to use it.

I'm really not sure what that means exactly.


> But if there are X11 drawing calls that can be replaced with XRender
> then I'd be all for that! I know almost nothing about *nix graphics
> technologies. Maybe someone can enlighten me on the details. It looks
> like it can do compositing, image affine transforms, image convolution
> (nice!), glyph caching and even linear and radial gradients. Does Java2D
> not take advtange of any this yet? Sounds like a promising oppertunity.
> But the only documentation I could find on it was sketchy. It looks like
> it can make surfaces in VRAM and do compositing entirely in hardware. It
> might then have potential to perform as well as OpenGL. Definitely worth
> exploring! Go for it Clemens!

Yes, the X Render extension does support that list. And honestly, the
reason it isn't better documented is that we wrote cairo specifically
to be an easier-to-use interface for X Render functionality[*].

So if you do want to start using Render inside Java2D, (which seems
only a good thing when targeting an X server), the recommended
approach would be to use cairo to do that. This wouldn't mean that you
would have to use cairo to replace other existing non-X backends in
Java2D at all, of course.

If anyone is interested in exploring this further, I'd be more than
happy to answer any questions about cairo's functionality, how to use
it, or how it might be improved in the future.

Thanks,

-Carl

[*] Initial versions of cairo were strictly targeting X Render---the
capability of targeting Win32, Quartz, PostScript, PDF, SVG, OpenGL,
etc. all came much later.

"Warning:
The information contained in this email and any attached files is
confidential to BAE Systems Australia. If you are not the intended
recipient, any use, disclosure or copying of this email or any
attachments is expressly prohibited.  If you have received this email
in error, please notify us immediately. VIRUS: Every care has been
taken to ensure this email and its attachments are virus free,
however, any loss or damage incurred in using this email is not the
sender's responsibility.  It is your responsibility to ensure virus
checks are completed before installing any data sent in this email to
your computer."


Re: Best way organizing XRender additions for theX11 pipeline?

by Carl Worth-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 5 Dec 2007 21:48:36 +1030, "LOUD, Ben" wrote:
> Wow, Carl Worth himself! Great to see you on the list. Cairo no
> doubt is a wonderful package, a true gem of free software.

Blah, blah, blah...

> All i meant by my "high level" comment was that its a complete top
> to bottom graphics package, when really the only part that OpenJDK
> desperately needs is one part of the pipeline, the part that
> rasterises paths to produce masks.

I don't disagree that cairo is high-level and likely quite similar to
the existing OpenJDK Java2D interfaces.

But as for "rasterizing a path to produce a mask", that isn't an
operation that Render provides at all, and it's also not something
that is hidden in layers inside cairo. You can get at an efficient
means of doing that with Render by calling into existing cairo
interfaces just fine.

Meanwhile, if instead of "paths" you've actually already got something
tessellated and just need it to be rasterized, then sure, you can call
into XRenderCompositeTrapezoids to do just that if you'd like.

But note that there's a big difference between just calling
XRenderCompositeTrapezoids to get rasterization and using Render
efficiently. For one thing, as suggested by its name, that call can do
both rasterization and compositing, (potentially with accelerated
support from the graphics hardware), so you're not winning by using it
only or rasterization.

> I wonder how difficult it would be to factor out Cairo's
> rasterisation and stroking code so we could just use that. We
> wouldnt need its compositng, font support, SVG and PDF backends
> etc. etc. Of course I know zero about Cairo's internals but if its
> feasible, it might be worth a look. I'd love to see it happen.

Here, I'm totally lost. Things like the SVG and PDF backends are the
lightest things in cairo, (no dependencies at all, for example), so
they should be the least of your concerns. Meanwhile for
"rasterization and stroking" the _code_ that is in cairo---the
software implementation in pixman actually---isn't the most
interesting part. It's not the fastest rasterizer around, so you'd
be making a big mistake to do a bunch of work to try to extract
it. Instead, what is interesting about cairo's rasterization is the
interface to get at faster underlying systems. In the current
conversation you only care about one target (X Render) but as above,
calling into cairo for rasterization alone should work fine. There's
no need to factor anything out.

> I doubt we'd need cairo to take advantage of X Render though. That
> doesnt sound to me like the difficult part. I would think it would
> similar to what they've already done for OGL and D3D.

There are parts of using Render that are a fair amount of work. For
example, getting efficient text output through Render requires the
client to manage a server-side cache of glyph images, etc. Maybe
that's similar to what you've done for OGL and D3D as you say. But
there's not strictly any need to write new code for that. But don't
let me get in your way---please write whatever code you enjoy.

So I'm just trying to say that cairo exists, and should still work
well for the _original_ purpose of cairo, (provide a simple interface
for getting at X Render functionality), even if you just ignore
everything else that cairo can also do.

-Carl


attachment0 (196 bytes) Download Attachment

Re: Best way organizing XRenderadditions for theX11 pipeline?

by Ben Loud :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Re: [OpenJDK 2D-Dev] Best way organizing XRenderadditions for theX11 pipeline?
>> Meanwhile, if instead of "paths" you've actually already got something
>> tessellated and just need it to be rasterized, then sure, you can call
>> into XRenderCompositeTrapezoids to do just that if you'd like.
 
ahh ok this is interesting. I see your point. I've been speaking under the assumption that X Render wouldnt be involved in this step. I believe in Java2D, all the work of producing coverage values is always done in software, and OGL or whatever only does the compositing. I hadnt considered that Render could accelerate both.

From: 2d-dev-bounces@... on behalf of Carl Worth
Sent: Thu 6/12/2007 4:23 AM
To: LOUD, Ben
Cc: 2d-dev@...
Subject: Re: [OpenJDK 2D-Dev] Best way organizing XRenderadditions for theX11 pipeline?

On Wed, 5 Dec 2007 21:48:36 +1030, "LOUD, Ben" wrote:
> Wow, Carl Worth himself! Great to see you on the list. Cairo no
> doubt is a wonderful package, a true gem of free software.

Blah, blah, blah...

> All i meant by my "high level" comment was that its a complete top
> to bottom graphics package, when really the only part that OpenJDK
> desperately needs is one part of the pipeline, the part that
> rasterises paths to produce masks.

I don't disagree that cairo is high-level and likely quite similar to
the existing OpenJDK Java2D interfaces.

But as for "rasterizing a path to produce a mask", that isn't an
operation that Render provides at all, and it's also not something
that is hidden in layers inside cairo. You can get at an efficient
means of doing that with Render by calling into existing cairo
interfaces just fine.

Meanwhile, if instead of "paths" you've actually already got something
tessellated and just need it to be rasterized, then sure, you can call
into XRenderCompositeTrapezoids to do just that if you'd like.

But note that there's a big difference between just calling
XRenderCompositeTrapezoids to get rasterization and using Render
efficiently. For one thing, as suggested by its name, that call can do
both rasterization and compositing, (potentially with accelerated
support from the graphics hardware), so you're not winning by using it
only or rasterization.

> I wonder how difficult it would be to factor out Cairo's
> rasterisation and stroking code so we could just use that. We
> wouldnt need its compositng, font support, SVG and PDF backends
> etc. etc. Of course I know zero about Cairo's internals but if its
> feasible, it might be worth a look. I'd love to see it happen.

Here, I'm totally lost. Things like the SVG and PDF backends are the
lightest things in cairo, (no dependencies at all, for example), so
they should be the least of your concerns. Meanwhile for
"rasterization and stroking" the _code_ that is in cairo---the
software implementation in pixman actually---isn't the most
interesting part. It's not the fastest rasterizer around, so you'd
be making a big mistake to do a bunch of work to try to extract
it. Instead, what is interesting about cairo's rasterization is the
interface to get at faster underlying systems. In the current
conversation you only care about one target (X Render) but as above,
calling into cairo for rasterization alone should work fine. There's
no need to factor anything out.

> I doubt we'd need cairo to take advantage of X Render though. That
> doesnt sound to me like the difficult part. I would think it would
> similar to what they've already done for OGL and D3D.

There are parts of using Render that are a fair amount of work. For
example, getting efficient text output through Render requires the
client to manage a server-side cache of glyph images, etc. Maybe
that's similar to what you've done for OGL and D3D as you say. But
there's not strictly any need to write new code for that. But don't
let me get in your way---please write whatever code you enjoy.

So I'm just trying to say that cairo exists, and should still work
well for the _original_ purpose of cairo, (provide a simple interface
for getting at X Render functionality), even if you just ignore
everything else that cairo can also do.

-Carl
"Warning:
The information contained in this email and any attached files is
confidential to BAE Systems Australia. If you are not the intended
recipient, any use, disclosure or copying of this email or any
attachments is expressly prohibited.  If you have received this email
in error, please notify us immediately. VIRUS: Every care has been
taken to ensure this email and its attachments are virus free,
however, any loss or damage incurred in using this email is not the
sender's responsibility.  It is your responsibility to ensure virus
checks are completed before installing any data sent in this email to
your computer."


Re: Best way organizing XRenderadditions for theX11 pipeline?

by Dmitri Trembovetski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



LOUD, Ben wrote:
>  >> Meanwhile, if instead of "paths" you've actually already got something
>  >> tessellated and just need it to be rasterized, then sure, you can call
>  >> into XRenderCompositeTrapezoids to do just that if you'd like.
>  
> ahh ok this is interesting. I see your point. I've been speaking under
> the assumption that X Render wouldnt be involved in this step. I believe
> in Java2D, all the work of producing coverage values is always done in
> software, and OGL or whatever only does the compositing. I hadnt
> considered that Render could accelerate both.

   Yes indeed, in Java2D this part is done in software.
   However, I think that it would be nice to start out with
   just XRender pipeline (may be sitting on top of the
   x11 pipeline - the same way the old ddraw pipeline
   extends gdi one).
   I'm not really familiar with XRender myself so I don't
   know if you could mix X11 and Xrender rendering to
   the same drawable.

   I think we'll need something to address performance issues with
   apps using AA rendering and alpha compositing on X.
   We've been careful not to use too much of both in our
   built-in Swing L&Fs, but with the introductions of
   Nimbus that goes out of the window - it is fully vector
   graphics driven, with AA and AC everywhere.
   The performance on X11 will suck as a result of that,
   unfortunately.

   I have my doubts about fully integrating Cairo at this
   point (just because it would be much more extensive
   undertaking) but it should be relatively straightforward to
   implement an XRender pipeline.

   You can follow the example of x11 and opengl pipelnes.

   Unfortunately you don't have access to the new D3D
   and opengl pipelines which we're working on for
   6uN - we have improved code sharing between the pipelines
   (d3d, ogl) a lot, generalized a bunch of stuff, so it might have
   been easier to start from there.
   We could forward port the shared pieces to openjdk once
   we have some breathing time.

   Anyway, the I would approach this would be something like this.

   You'd need to create a SurfaceData subclass (say, XRSurfaceData) with
   appropriate SurfaceType. See OGL/GLXSurfaceData for
   the inspiration. Whether your surface type would be a subtype
   of X11* surface types depends on whether you can do x11
   rendering to XRender surfaces (Pictures?).

   Then you'd define the pipes and blits which render to
   and from your surfaces (see OGLRenderer, OGLBlitLoops).

   You'd need to create appropriate SurfaceManager (Volatile- and
   Caching-) so it would create surfaces of your type
   for Buffered- and Volatile-images, and BufferStrategy.
   (see GLXVolatileSurfaceManager). Also see SurfaceManagerFactory -
   this is where SurfaceManagers are created.

   Also, you'd need to create your own GraphicsConfiguration
   subclass (see GLXGraphicsConfig) so that the window surfaces
   of your type can be created.

   There's tons more details, of course. But this is a
   general direction.

   Thanks,
     Dmitri


> ------------------------------------------------------------------------
> *From:* 2d-dev-bounces@... on behalf of Carl Worth
> *Sent:* Thu 6/12/2007 4:23 AM
> *To:* LOUD, Ben
> *Cc:* 2d-dev@...
> *Subject:* Re: [OpenJDK 2D-Dev] Best way organizing XRenderadditions for
> theX11 pipeline?
>
> On Wed, 5 Dec 2007 21:48:36 +1030, "LOUD, Ben" wrote:
>  > Wow, Carl Worth himself! Great to see you on the list. Cairo no
>  > doubt is a wonderful package, a true gem of free software.
>
> Blah, blah, blah...
>
>  > All i meant by my "high level" comment was that its a complete top
>  > to bottom graphics package, when really the only part that OpenJDK
>  > desperately needs is one part of the pipeline, the part that
>  > rasterises paths to produce masks.
>
> I don't disagree that cairo is high-level and likely quite similar to
> the existing OpenJDK Java2D interfaces.
>
> But as for "rasterizing a path to produce a mask", that isn't an
> operation that Render provides at all, and it's also not something
> that is hidden in layers inside cairo. You can get at an efficient
> means of doing that with Render by calling into existing cairo
> interfaces just fine.
>
> Meanwhile, if instead of "paths" you've actually already got something
> tessellated and just need it to be rasterized, then sure, you can call
> into XRenderCompositeTrapezoids to do just that if you'd like.
>
> But note that there's a big difference between just calling
> XRenderCompositeTrapezoids to get rasterization and using Render
> efficiently. For one thing, as suggested by its name, that call can do
> both rasterization and compositing, (potentially with accelerated
> support from the graphics hardware), so you're not winning by using it
> only or rasterization.
>
>  > I wonder how difficult it would be to factor out Cairo's
>  > rasterisation and stroking code so we could just use that. We
>  > wouldnt need its compositng, font support, SVG and PDF backends
>  > etc. etc. Of course I know zero about Cairo's internals but if its
>  > feasible, it might be worth a look. I'd love to see it happen.
>
> Here, I'm totally lost. Things like the SVG and PDF backends are the
> lightest things in cairo, (no dependencies at all, for example), so
> they should be the least of your concerns. Meanwhile for
> "rasterization and stroking" the _code_ that is in cairo---the
> software implementation in pixman actually---isn't the most
> interesting part. It's not the fastest rasterizer around, so you'd
> be making a big mistake to do a bunch of work to try to extract
> it. Instead, what is interesting about cairo's rasterization is the
> interface to get at faster underlying systems. In the current
> conversation you only care about one target (X Render) but as above,
> calling into cairo for rasterization alone should work fine. There's
> no need to factor anything out.
>
>  > I doubt we'd need cairo to take advantage of X Render though. That
>  > doesnt sound to me like the difficult part. I would think it would
>  > similar to what they've already done for OGL and D3D.
>
> There are parts of using Render that are a fair amount of work. For
> example, getting efficient text output through Render requires the
> client to manage a server-side cache of glyph images, etc. Maybe
> that's similar to what you've done for OGL and D3D as you say. But
> there's not strictly any need to write new code for that. But don't
> let me get in your way---please write whatever code you enjoy.
>
> So I'm just trying to say that cairo exists, and should still work
> well for the _original_ purpose of cairo, (provide a simple interface
> for getting at X Render functionality), even if you just ignore
> everything else that cairo can also do.
>
> -Carl
>
> "Warning:
> The information contained in this email and any attached files is
> confidential to BAE Systems Australia. If you are not the intended
> recipient, any use, disclosure or copying of this email or any
> attachments is expressly prohibited.  If you have received this email
> in error, please notify us immediately. VIRUS: Every care has been
> taken to ensure this email and its attachments are virus free,
> however, any loss or damage incurred in using this email is not the
> sender's responsibility.  It is your responsibility to ensure virus
> checks are completed before installing any data sent in this email to
> your computer."
>

Re: Best way organizing XRenderadditions for theX11 pipeline?

by Dmitri Trembovetski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


   As a matter of fact, Chris Campbell from the 2D team
   did an initial investigation on XRender pipeline
   a while back (I just found an internal wiki page with
   the results of that investigation).

   I hope he doesn't mind me posting his thoughts here:
It doesn't appear that we can simply extend the existing X11Renderer code. XRender only knows how to fill rectangles,
trapezoids, and triangles, so we'd have to do some restructuring so that we issue other types of primitives in terms of
these operations. Probably need a complete rewrite of X11Renderer.

Also, XRender operations speak to a "Picture", which can be derived from an existing Drawable, so we'd need to somehow
keep a reference to a Picture in the X11SDOps structure.

It appears that XRender operations are not affected by basic Xlib GC state (such as color, clip region, logic op, etc),
so we'd need a separate state validation path in X11SurfaceData (or perhaps a subclass?) that handles things like
setting the current clip region, composite op, etc.

The OpenGLPipeline deviates slightly from the ColorModel? spec in that it treats opaque destinations as premultiplied.
(This is not allowable under the current ColorModel? spec, but so far no one has called us out on it. We were hoping to
relax the spec in Mustang but we never go around to it unfortunately.) We will probably need to do something similar for
this new pipeline, because we will be blending premultiplied components to an opaque destination.

A good place to start would be to try to implement MaskFill using XRender. We could cache a small (32x32) Picture in the
PictStandardA8? format to use as the mask.

   And, we have a couple of bugs already filed for the
   use of XRender:
     * 6307603: [X11] Use RENDER extension for complex operations done in software
     * 5086814: RFE: Java 2D: consider Xrender for anti-aliased text on remote X11

   Thanks,
     Dmitri
   Java2D Team

Dmitri Trembovetski wrote:

>
>
> LOUD, Ben wrote:
>>  >> Meanwhile, if instead of "paths" you've actually already got
>> something
>>  >> tessellated and just need it to be rasterized, then sure, you can
>> call
>>  >> into XRenderCompositeTrapezoids to do just that if you'd like.
>>  
>> ahh ok this is interesting. I see your point. I've been speaking under
>> the assumption that X Render wouldnt be involved in this step. I
>> believe in Java2D, all the work of producing coverage values is always
>> done in software, and OGL or whatever only does the compositing. I
>> hadnt considered that Render could accelerate both.
>
>   Yes indeed, in Java2D this part is done in software.
>   However, I think that it would be nice to start out with
>   just XRender pipeline (may be sitting on top of the
>   x11 pipeline - the same way the old ddraw pipeline
>   extends gdi one).
>   I'm not really familiar with XRender myself so I don't
>   know if you could mix X11 and Xrender rendering to
>   the same drawable.
>
>   I think we'll need something to address performance issues with
>   apps using AA rendering and alpha compositing on X.
>   We've been careful not to use too much of both in our
>   built-in Swing L&Fs, but with the introductions of
>   Nimbus that goes out of the window - it is fully vector
>   graphics driven, with AA and AC everywhere.
>   The performance on X11 will suck as a result of that,
>   unfortunately.
>
>   I have my doubts about fully integrating Cairo at this
>   point (just because it would be much more extensive
>   undertaking) but it should be relatively straightforward to
>   implement an XRender pipeline.
>
>   You can follow the example of x11 and opengl pipelnes.
>
>   Unfortunately you don't have access to the new D3D
>   and opengl pipelines which we're working on for
>   6uN - we have improved code sharing between the pipelines
>   (d3d, ogl) a lot, generalized a bunch of stuff, so it might have
>   been easier to start from there.
>   We could forward port the shared pieces to openjdk once
>   we have some breathing time.
>
>   Anyway, the I would approach this would be something like this.
>
>   You'd need to create a SurfaceData subclass (say, XRSurfaceData) with
>   appropriate SurfaceType. See OGL/GLXSurfaceData for
>   the inspiration. Whether your surface type would be a subtype
>   of X11* surface types depends on whether you can do x11
>   rendering to XRender surfaces (Pictures?).
>
>   Then you'd define the pipes and blits which render to
>   and from your surfaces (see OGLRenderer, OGLBlitLoops).
>
>   You'd need to create appropriate SurfaceManager (Volatile- and
>   Caching-) so it would create surfaces of your type
>   for Buffered- and Volatile-images, and BufferStrategy.
>   (see GLXVolatileSurfaceManager). Also see SurfaceManagerFactory -
>   this is where SurfaceManagers are created.
>
>   Also, you'd need to create your own GraphicsConfiguration
>   subclass (see GLXGraphicsConfig) so that the window surfaces
>   of your type can be created.
>
>   There's tons more details, of course. But this is a
>   general direction.
>
>   Thanks,
>     Dmitri
>
>
>> ------------------------------------------------------------------------
>> *From:* 2d-dev-bounces@... on behalf of Carl Worth
>> *Sent:* Thu 6/12/2007 4:23 AM
>> *To:* LOUD, Ben
>> *Cc:* 2d-dev@...
>> *Subject:* Re: [OpenJDK 2D-Dev] Best way organizing XRenderadditions
>> for theX11 pipeline?
>>
>> On Wed, 5 Dec 2007 21:48:36 +1030, "LOUD, Ben" wrote:
>>  > Wow, Carl Worth himself! Great to see you on the list. Cairo no
>>  > doubt is a wonderful package, a true gem of free software.
>>
>> Blah, blah, blah...
>>
>>  > All i meant by my "high level" comment was that its a complete top
>>  > to bottom graphics package, when really the only part that OpenJDK
>>  > desperately needs is one part of the pipeline, the part that
>>  > rasterises paths to produce masks.
>>
>> I don't disagree that cairo is high-level and likely quite similar to
>> the existing OpenJDK Java2D interfaces.
>>
>> But as for "rasterizing a path to produce a mask", that isn't an
>> operation that Render provides at all, and it's also not something
>> that is hidden in layers inside cairo. You can get at an efficient
>> means of doing that with Render by calling into existing cairo
>> interfaces just fine.
>>
>> Meanwhile, if instead of "paths" you've actually already got something
>> tessellated and just need it to be rasterized, then sure, you can call
>> into XRenderCompositeTrapezoids to do just that if you'd like.
>>
>> But note that there's a big difference between just calling
>> XRenderCompositeTrapezoids to get rasterization and using Render
>> efficiently. For one thing, as suggested by its name, that call can do
>> both rasterization and compositing, (potentially with accelerated
>> support from the graphics hardware), so you're not winning by using it
>> only or rasterization.
>>
>>  > I wonder how difficult it would be to factor out Cairo's
>>  > rasterisation and stroking code so we could just use that. We
>>  > wouldnt need its compositng, font support, SVG and PDF backends
>>  > etc. etc. Of course I know zero about Cairo's internals but if its
>>  > feasible, it might be worth a look. I'd love to see it happen.
>>
>> Here, I'm totally lost. Things like the SVG and PDF backends are the
>> lightest things in cairo, (no dependencies at all, for example), so
>> they should be the least of your concerns. Meanwhile for
>> "rasterization and stroking" the _code_ that is in cairo---the
>> software implementation in pixman actually---isn't the most
>> interesting part. It's not the fastest rasterizer around, so you'd
>> be making a big mistake to do a bunch of work to try to extract
>> it. Instead, what is interesting about cairo's rasterization is the
>> interface to get at faster underlying systems. In the current
>> conversation you only care about one target (X Render) but as above,
>> calling into cairo for rasterization alone should work fine. There's
>> no need to factor anything out.
>>
>>  > I doubt we'd need cairo to take advantage of X Render though. That
>>  > doesnt sound to me like the difficult part. I would think it would
>>  > similar to what they've already done for OGL and D3D.
>>
>> There are parts of using Render that are a fair amount of work. For
>> example, getting efficient text output through Render requires the
>> client to manage a server-side cache of glyph images, etc. Maybe
>> that's similar to what you've done for OGL and D3D as you say. But
>> there's not strictly any need to write new code for that. But don't
>> let me get in your way---please write whatever code you enjoy.
>>
>> So I'm just trying to say that cairo exists, and should still work
>> well for the _original_ purpose of cairo, (provide a simple interface
>> for getting at X Render functionality), even if you just ignore
>> everything else that cairo can also do.
>>
>> -Carl
>>
>> "Warning:
>> The information contained in this email and any attached files is
>> confidential to BAE Systems Australia. If you are not the intended
>> recipient, any use, disclosure or copying of this email or any
>> attachments is expressly prohibited.  If you have received this email
>> in error, please notify us immediately. VIRUS: Every care has been
>> taken to ensure this email and its attachments are virus free,
>> however, any loss or damage incurred in using this email is not the
>> sender's responsibility.  It is your responsibility to ensure virus
>> checks are completed before installing any data sent in this email to
>> your computer."
>>

Re: Best way organizing XRenderadditions for theX11 pipeline?

by Bugzilla from linuxhippy@gmail.com :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Dmitri,

... and thanks a lot for the large amount of information.

I think I will try to implement XRender "fast-paths" for the most
common cases, instead of "forking" the pipeline. I hope it can be done
to not replace the X11 pipeline but rather extend it, as you mentioned
like GDI and DDraw.

Yes, I also think that a rewrite of the X11 pipeline very much in the
style of the OGL/D3D pipelines would be great - even the source
available in jdk7 is much cleaner and than the source of the X11
pipeline.
A complete rewrite of the X11 pipeline would be way too much work for
me, I have quite a hard time at university - I guess it would be
better to get at least something working than an unfinished project
somewhere on sourceforge ;)

I'll play arround a bit with it, hope the amount of questions will
nobody bother ;)

Thanks, lg Clemens