[Spice-devel] need help explaining the algorithm

Frediano Ziglio fziglio at redhat.com
Wed Dec 5 09:32:55 UTC 2018


> 
> Hi,
> 
> On Fri, Nov 09, 2018 at 05:08:21PM +0800, Zihao Miao wrote:
> > Hi, list:
> > This is my first post to a mail list.. so..
> 
> Welcome.
> 
> > I am a college student and I am very interested in the
> > algorithm that maintains the current ring of drawables to
> > reduce the display data transfer.
> 
> > I currently read the code through the  trace of
> > disolay_channel_process_draw->display_channel_add_drawable->current_add->exclude_region->__exclude_region,
> 
> heh, "TODO: What is the intended use of this function?"
> https://gitlab.freedesktop.org/spice/spice/blob/master/server/display-channel.c#L764
> 
> > and gained some understanding of the code.
> > However, I still don't quite get the concept of the difference
> > between a draw item and a container?
> 

Not really sure about it but a draw item should just contain a single
draw command, a container bound more commands.

> > And there are questions like why current_add_with_shadow is
> > much more complicated than the current_add; what
> 
> https://gitlab.freedesktop.org/spice/spice/blob/master/server/display-channel.c#L1424
> 

Shadow terminology always puzzled me. But is related to copy screen to
screen. Is more complicated as you cannot simply delete covered drawing
as part could be used.
More or less the optimization at that level try to remove old drawing
covered by new one. As an example if you paint the entire screen with a
single color all old drawing will be covered so you can remove them
(current_add). But if you scroll part of the screen part of the old
drawing will not be needed but other will be moved (current_add_with_shadow)
so is more complicated.

> > did the pip actually send? a drawable or the whole surface?
> > where do compression come in?...
> 
> So many questions. I'm not really familiar with this code tbh so
> I'd have to study myself to reply.
> 

The compression is done before sending to be client.

> > Do you guys have any resources besides the newbee and spice
> > protocol document to learn about this algorithm?
> 
> Not really, I trust more the comments and git history.
> 

No  :-(
Yes, that part of the code is pretty complicated and old.

> > Best wishes!
> > Zihao Miao
> 
> Sorry that I could not help much right now but I hate to see this
> kind of email going on not replied for so long. We welcome better
> documentation, please do feel free to send patches with your
> understanding as documentation. It might trigger the discussions
> that you want.
> 
> Cheers,
> Victor
> 

Frediano


More information about the Spice-devel mailing list