[compiz] Drawing On the Desktop

David Reveman davidr at novell.com
Mon Dec 11 18:08:32 PST 2006


On Wed, 2006-12-06 at 21:33 +0100, Eckhart Pedersen wrote:
> Hi,
> 
> I am currently developing a xsnow like plugin for beryl called xglsnow 
> (http://cornergraf.net/projects/xglsnow/).
> 
> I have been told(1) that my way of drawing to the desktop is not very good and 
> that a better way might exist. I realize beryl is not the same as compiz, but I 
> hope that the differences are not too big on this matter, if not excuse me for 
> this post.
> 
> My drawing currently works like this:
> 
> PaintScreen: Paint the screen with a beryl specific mask called 
> PAINT_SCREEN_ORDER_BACK_TO_FRONT_MASK

PAINT_SCREEN_ORDER_BACK_TO_FRONT_MASK doesn't exist in compiz and I
doesn't know why it's been added to beryl. By the name I guess it's the
same as PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK, which exists in
compiz. This flag is used to tell the screen drawing code that
top-to-bottom clipping can't be used.

There shouldn't be any reason to why you would have to use this in your
case, it will only slow things down a lot.

> 
> DonePaintScreen: Damage Desktop Window

That way you'll end up redrawing the desktop window at the current
refresh rate.

> 
> PaintWindow: if desktop window then render snow

That's OK. You should make sure that you're only redrawing the region
requested. That region will likely never be the full size of the desktop
window.

> 
> Is this really not so good? Can it be done better?

It seems about right. However, there might be a few things you're doing
wrong that might cause it to perform badly.

> 
> Also, the continous redrawing is rather expensive, is there a good way to 
> implement some Max FPS option? I have tried without success so far(2)

Just register a timeout function that calls damageScreen at an
appropriate interval.

You should be able to make a plugin like this perform very well. If you
make the plugin work with compiz, I might have time to look at it
quickly and fix any obvious performance issues.

> 
> Thanks in advance,
> Eckhart Pedersen
> 
> (1) http://forum.go-compiz.org/viewtopic.php?t=169
> (2) http://forum.beryl-project.org/viewtopic.php?t=462

(2) link doesn't work.

-David



More information about the compiz mailing list