Hi,<div>I have gathered other questions about spice and how it handles streaming video. I think you can help me:</div><div><br></div><div>1)File red_worker.c.</div><div>I would like to have more information about these members of the struct RedWorker :</div>
<div><ul><li>RedSurface surfaces[NUM_SURFACES], </li><li>Ring current_list, </li><li>_Drawable drawables[NUM_DRAWABLES]; </li><li>Stream streams_buf[NUM_STREAMS];</li></ul></div><div>2)Function red_worker_main(), what does <b>red_handle_streams_timout()</b> do?</div>
<div><br></div><div>3)When you run qemu with option <b>-streaming_video=off</b> for example, the function <b>spice_server_set_streaming_video() </b>in reds.c, calls <b>red_dispatcher_on_sv_change(). </b></div><div><b></b>In this function there is a while loop on RedDispatcher *now. Dispatcher is created in red_dispatcher_init_function, that it's called later, in this way <b>now </b>is NULL and it doesn't enter in the while loop. As a consequence of this, <meta http-equiv="content-type" content="text/html; charset=utf-8"> <b>red_dispatcher_on_sv_change() </b>doesn't send <meta http-equiv="content-type" content="text/html; charset=utf-8"> <b>RED_WORKER_MESSAGE_SET_STREAMING_VIDEO </b>message.</div>
<div><br></div><div>Did I make myself clear?</div><div>Thanks very much.<br><br><div class="gmail_quote">2011/4/21 Alon Levy <span dir="ltr"><<a href="mailto:alevy@redhat.com">alevy@redhat.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Apr 21, 2011 at 10:22:15AM +0200, Andrea Celestino wrote:<br>
> Thanks.<br>
> Now I am trying to study the code I am interested in.<br>
> Unfortunately, the file red_worker.c is very huge and there are not any<br>
> comments that can help me.<br>
><br>
> I would like to know:<br>
> 1- which parts/functions of red_worker.c are video related stuff?<br>
</div>A lot. Seriously - this requires a little more checking then I can give you off<br>
the top of my head. Questions 2 and 3 are more specific, so easier to answer.<br>
I would seriously suggest trying systemtap or just adding some prints to see<br>
what is going on. Start from red_process_drawable.<br>
<div class="im"><br>
> 2- You said:<br>
> "determine if a given draw operation (has to be an opaque copy iirc) is<br>
> repeated to the same area."<br>
> What do you mean with "opaque copy iirc"?<br>
<br>
</div>iirc - if I recall correctly, meaning I'm not sure.<br>
opaque copy - an operation that copies a bitmap to a surface. The video streaming<br>
is done based on seeing repeated operations that copy a bitmap to the same<br>
surface, always surface 0 (that is the primary surface, we ignore repeated copies<br>
to non primary surfaces).<br>
opaque - meaning the destination bits are overwritten by the source bits, no binary<br>
operation is done (xor/and/or).<br>
<div class="im"><br>
><br>
> 3- There are a red worker thread for each QXL device instance. How many QXL<br>
> device instance are there?<br>
<br>
</div>One per device. But you can ignore the support for multiple devices for this,<br>
so just one if you run a single device ("-vga qxl").<br>
<div class="im"><br>
> 4- Which function does red_worker.c use to detect video streaming?<br>
><br>
</div>interesting functions are:<br>
__red_is_next_stream_frame<br>
anything with ->stream<br>
red_attach_stream<br>
anything with mjpeg<br>
red_current_add, the bottom part (that checks for OPAQUE and calls red_use_stream_trace)<br>
<div class="im"><br>
> Thanks for any helps you can give me<br>
</div>Sure, please take a look at the above points and try what I suggested.<br>
<font color="#888888"><br>
Alon<br>
</font><div><div></div><div class="h5"><br>
><br>
> 2011/4/15 Alon Levy <<a href="mailto:alevy@redhat.com">alevy@redhat.com</a>><br>
><br>
> > On Thu, Apr 14, 2011 at 03:20:40PM +0200, Andrea Celestino wrote:<br>
> > > I would like to improve the streaming video performance in Spice, do you<br>
> > > think that is possible to improve it? In what way?<br>
> > > Are there documents that describes in detail how spice works with video?<br>
> ><br>
> > The best I can offer in terms of documentation is the pdfs in the documents<br>
> > section of <a href="http://spice-space.org" target="_blank">spice-space.org</a>, I imagine you are looking for something more,<br>
> > sorry to disappoint.<br>
> ><br>
> > The code you are interested in is server/red_worker.c, but that's not very<br>
> > helpful since that file is huge. Would be nice to split the video related<br>
> > stuff to a separate file.<br>
> ><br>
> > worker->streaming_video - determines how we handle streaming video<br>
> ><br>
> > git grep stream -- server/red_worker.c<br>
> ><br>
> > I can give you better pointers if you ask more specific questions, but<br>
> > doing<br>
> > the documentation myself right now.. too much work.<br>
> ><br>
> > overview of what spice does:<br>
> > * determine if a given draw operation (has to be an opaque copy iirc) is<br>
> > repeated to the same area.<br>
> > * if so, starts a mjpeg encoder and sends the stream to the client<br>
> ><br>
> > how to improve this (some is on the Features page in spice-space):<br>
> > * learn to do various video acceleration apis (windows has it, linux has<br>
> > it)<br>
> > * this is by far the best way to go regarding performance, unless you are<br>
> > willing to sacrifice cpu for bandwidth in which case I guess you would<br>
> > reencode.<br>
> > * otoh this is a pretty large change to multiple parts of spice:<br>
> > * you need to update the driver for each platform you choose to support,<br>
> > update the protocol, teach server and client<br>
> > * it's definitely on the todo list, but no date set.<br>
> > * replace mjpeg with a different encoder<br>
> > * if it's just a better performing encoder, clear win.<br>
> > * otherwise you get the usual cpu/bw tradeoff.<br>
> > * or you could try to learn which encoder fits which stream (based on some<br>
> > metric, could be the performance of the encoders themselves)<br>
> > * just throwing an idea.<br>
> ><br>
> > Alon<br>
> ><br>
> > ><br>
> > > 2011/4/11 Alon Levy <<a href="mailto:alevy@redhat.com">alevy@redhat.com</a>><br>
> > ><br>
> > > > On Mon, Apr 11, 2011 at 03:48:08PM +0200, Andrea Celestino wrote:<br>
> > > > > Hi,<br>
> > > > > I have installed Spice and now I'm trying to use it. I'm interested<br>
> > in<br>
> > > > how<br>
> > > > > spice manage streaming video. I read that there is the option<br>
> > > > ><br>
> > > > > -streaming-video=[all|off|filter]<br>
> > > > ><br>
> > > > > Can you explain me the difference between these three option?<br>
> > > > > Which source file read the command line?<br>
> > > > > Why I have tried to play a video in a player but i have not notice<br>
> > any<br>
> > > > > difference between the two options 'off' and 'filter'?<br>
> > > > ><br>
> > > ><br>
> > > > Look at<br>
> > <a href="http://cgit.freedesktop.org/spice/spice/tree/server/red_worker.c" target="_blank">http://cgit.freedesktop.org/spice/spice/tree/server/red_worker.c</a><br>
> > > ><br>
> > > > search for STREAM_VIDEO_FILTER<br>
> > > ><br>
> > > > The switch toggles modes for creating streams:<br>
> > > > off - never create<br>
> > > > all/filter - create either based on smallest size, or just based on<br>
> > > > number of consecutive opaque copies to same area.<br>
> > > ><br>
> > > > > Thanks very much for the help.<br>
> > > ><br>
> > > > > _______________________________________________<br>
> > > > > Spice-devel mailing list<br>
> > > > > <a href="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.org</a><br>
> > > > > <a href="http://lists.freedesktop.org/mailman/listinfo/spice-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br>
> > > ><br>
> > > ><br>
> ><br>
> > > _______________________________________________<br>
> > > Spice-devel mailing list<br>
> > > <a href="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.org</a><br>
> > > <a href="http://lists.freedesktop.org/mailman/listinfo/spice-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br>
> ><br>
> ><br>
</div></div></blockquote></div><br></div>