Hi, I have other few simple questions:<div><br></div><div>1) file: red_worker.c, function: red_worker_main():</div><div>What does evt_listener->action(evt_listener, event->events) do? Does it call handle_dev_input() function? Is it called every time an event occurs on socket?</div>
<div><br></div><div>2)file: red_worker.c</div><div>In red_worker_main() there is a call to red_process_commands().What type of command does this function handle?</div><div><br></div><div>3) What is a RedDrawable?</div><div>
<br></div><div>Thanks a lot<br><br><div class="gmail_quote">2011/5/5 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, May 05, 2011 at 09:45:11AM +0200, Andrea Celestino wrote:<br>
> Ok, in this way the option -streaming-video=[all|off|filter] will be set<br>
> before any workers are started and I can't send message to change the<br>
> streaming video option.... In which way can I change streaming-video option?<br>
<br>
</div>The change done from the command line affects all the workers started afterwards.<br>
If what you mean is that you want to change during run time, we used to have qemu<br>
monitor commands for that, but it seems they are not in upstream. Can be added<br>
back easily.<br>
<div class="im"><br>
><br>
> p.s. Can I send email to your email address directly or you prefer the<br>
> mailing list?<br>
<br>
</div>I prefer the mailing list, but I answer both :) The preferred way is to the<br>
mailing list, and cc me.<br>
<div><div></div><div class="h5"><br>
><br>
> 2011/5/4 Alon Levy <<a href="mailto:alevy@redhat.com">alevy@redhat.com</a>><br>
><br>
> > On Wed, May 04, 2011 at 05:00:49PM +0200, Andrea Celestino wrote:<br>
> > > Sorry for the forwarded message.<br>
> > > About 3, is it correct that it doesn't send<br>
> > > RED_WORKER_MESSAGE_SET_STREAMING_VIDEO? The variable "now" is NULL so the<br>
> > > program doesn't go inside the while loop and it doesn't send the message<br>
> > and<br>
> > > data..<br>
> ><br>
> > yes, it is fine (looked at the source finally) - the dispatchers are the<br>
> > list of<br>
> > already active workers, if this parameter is set before any workers are<br>
> > started,<br>
> > then none needs to be updated, they will receive the correct value when<br>
> > they are<br>
> > created. Follow the initialization of them (better to follow where this<br>
> > variable<br>
> > is actually used, and you'll see that it is received in the process of<br>
> > creating<br>
> > a new red worker thread). There is a worker thread for every card, so for a<br>
> > single<br>
> > qxl pci card you will have one worker, the dispatcher is used to talk to it<br>
> > over<br>
> > a pipe.<br>
> ><br>
> > ><br>
> > > 2011/5/4 Alon Levy <<a href="mailto:alevy@redhat.com">alevy@redhat.com</a>><br>
> > ><br>
> > > > On Wed, May 04, 2011 at 03:27:52PM +0200, Andrea Celestino wrote:<br>
> > > > > Hi,<br>
> > > > > I have gathered other questions about spice and how it handles<br>
> > streaming<br>
> > > > > video. I think you can help me:<br>
> > > > ><br>
> > > > > 1)File red_worker.c.<br>
> > > > > I would like to have more information about these members of the<br>
> > struct<br>
> > > > > RedWorker :<br>
> > > > ><br>
> > > > > - RedSurface surfaces[NUM_SURFACES],<br>
> > > > one for each surface. The first is the primary surface, which is the<br>
> > > > equivalent<br>
> > > > of the framebuffer. Each RedSurface contains a canvas (i.e. pixmap<br>
> > > > implemented / opengl<br>
> > > > implemented) and the operations that are active on that surface (i.e.<br>
> > the<br>
> > > > state<br>
> > > > the client meant to have at any point would be taking the canvas and<br>
> > > > applying all the<br>
> > > > surface kept operations from oldest to newest).<br>
> > > ><br>
> > > > > - Ring current_list,<br>
> > > > List of operations I think - drawables that are being used.<br>
> > > ><br>
> > > > > - _Drawable drawables[NUM_DRAWABLES];<br>
> > > > Preallocated drawables. Just used instead of mallocing everything when<br>
> > > > required.<br>
> > > ><br>
> > > > > - Stream streams_buf[NUM_STREAMS];<br>
> > > > Same for streams.<br>
> > > ><br>
> > > > ><br>
> > > > > 2)Function red_worker_main(), what does *red_handle_streams_timout()*<br>
> > do?<br>
> > > > Don't recall.<br>
> > > ><br>
> > > > ><br>
> > > > > 3)When you run qemu with option *-streaming_video=off* for example,<br>
> > the<br>
> > > > > function *spice_server_set_streaming_video() *in reds.c, calls *<br>
> > > > > red_dispatcher_on_sv_change(). *<br>
> > > > > **In this function there is a while loop on RedDispatcher *now.<br>
> > > > Dispatcher<br>
> > > > > is created in red_dispatcher_init_function, that it's called later,<br>
> > in<br>
> > > > this<br>
> > > > > way *now *is NULL and it doesn't enter in the while loop. As a<br>
> > > > consequence<br>
> > > > > of this, *red_dispatcher_on_sv_change() *doesn't send<br>
> > > > > *RED_WORKER_MESSAGE_SET_STREAMING_VIDEO<br>
> > > > > *message.<br>
> > > > ><br>
> > > > > Did I make myself clear?<br>
> > > ><br>
> > > > Not sure about 3 - what is the question?<br>
> > > ><br>
> > > > > Thanks very much.<br>
> > > > ><br>
> > > > ><br>
> > > > > 2011/4/21 Alon Levy <<a href="mailto:alevy@redhat.com">alevy@redhat.com</a>><br>
> > > > ><br>
> > > > > > 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<br>
> > not<br>
> > > > 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>
> > > > > > A lot. Seriously - this requires a little more checking then I can<br>
> > give<br>
> > > > you<br>
> > > > > > off<br>
> > > > > > the top of my head. Questions 2 and 3 are more specific, so easier<br>
> > to<br>
> > > > > > answer.<br>
> > > > > > I would seriously suggest trying systemtap or just adding some<br>
> > prints<br>
> > > > to<br>
> > > > > > see<br>
> > > > > > what is going on. Start from red_process_drawable.<br>
> > > > > ><br>
> > > > > > > 2- You said:<br>
> > > > > > > "determine if a given draw operation (has to be an opaque copy<br>
> > iirc)<br>
> > > > is<br>
> > > > > > > repeated to the same area."<br>
> > > > > > > What do you mean with "opaque copy iirc"?<br>
> > > > > ><br>
> > > > > > iirc - if I recall correctly, meaning I'm not sure.<br>
> > > > > > opaque copy - an operation that copies a bitmap to a surface. The<br>
> > video<br>
> > > > > > streaming<br>
> > > > > > is done based on seeing repeated operations that copy a bitmap to<br>
> > the<br>
> > > > same<br>
> > > > > > surface, always surface 0 (that is the primary surface, we ignore<br>
> > > > repeated<br>
> > > > > > copies<br>
> > > > > > to non primary surfaces).<br>
> > > > > > opaque - meaning the destination bits are overwritten by the source<br>
> > > > bits,<br>
> > > > > > no binary<br>
> > > > > > operation is done (xor/and/or).<br>
> > > > > ><br>
> > > > > > ><br>
> > > > > > > 3- There are a red worker thread for each QXL device instance.<br>
> > How<br>
> > > > many<br>
> > > > > > QXL<br>
> > > > > > > device instance are there?<br>
> > > > > ><br>
> > > > > > One per device. But you can ignore the support for multiple devices<br>
> > for<br>
> > > > > > this,<br>
> > > > > > so just one if you run a single device ("-vga qxl").<br>
> > > > > ><br>
> > > > > > > 4- Which function does red_worker.c use to detect video<br>
> > streaming?<br>
> > > > > > ><br>
> > > > > > 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<br>
> > > > > > red_use_stream_trace)<br>
> > > > > ><br>
> > > > > > > Thanks for any helps you can give me<br>
> > > > > > Sure, please take a look at the above points and try what I<br>
> > suggested.<br>
> > > > > ><br>
> > > > > > Alon<br>
> > > > > ><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<br>
> > wrote:<br>
> > > > > > > > > I would like to improve the streaming video performance in<br>
> > Spice,<br>
> > > > do<br>
> > > > > > you<br>
> > > > > > > > > think that is possible to improve it? In what way?<br>
> > > > > > > > > Are there documents that describes in detail how spice works<br>
> > with<br>
> > > > > > video?<br>
> > > > > > > ><br>
> > > > > > > > The best I can offer in terms of documentation is the pdfs in<br>
> > the<br>
> > > > > > documents<br>
> > > > > > > > section of <a href="http://spice-space.org" target="_blank">spice-space.org</a>, I imagine you are looking for<br>
> > > > something<br>
> > > > > > more,<br>
> > > > > > > > sorry to disappoint.<br>
> > > > > > > ><br>
> > > > > > > > The code you are interested in is server/red_worker.c, but<br>
> > that's<br>
> > > > not<br>
> > > > > > very<br>
> > > > > > > > helpful since that file is huge. Would be nice to split the<br>
> > video<br>
> > > > > > related<br>
> > > > > > > > stuff to a separate file.<br>
> > > > > > > ><br>
> > > > > > > > worker->streaming_video - determines how we handle streaming<br>
> > video<br>
> > > > > > > ><br>
> > > > > > > > git grep stream -- server/red_worker.c<br>
> > > > > > > ><br>
> > > > > > > > I can give you better pointers if you ask more specific<br>
> > questions,<br>
> > > > 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<br>
> > copy<br>
> > > > iirc)<br>
> > > > > > is<br>
> > > > > > > > repeated to the same area.<br>
> > > > > > > > * if so, starts a mjpeg encoder and sends the stream to the<br>
> > client<br>
> > > > > > > ><br>
> > > > > > > > how to improve this (some is on the Features page in<br>
> > spice-space):<br>
> > > > > > > > * learn to do various video acceleration apis (windows has it,<br>
> > > > linux<br>
> > > > > > has<br>
> > > > > > > > it)<br>
> > > > > > > > * this is by far the best way to go regarding performance,<br>
> > unless<br>
> > > > you<br>
> > > > > > are<br>
> > > > > > > > willing to sacrifice cpu for bandwidth in which case I guess<br>
> > you<br>
> > > > would<br>
> > > > > > > > reencode.<br>
> > > > > > > > * otoh this is a pretty large change to multiple parts of<br>
> > spice:<br>
> > > > > > > > * you need to update the driver for each platform you choose<br>
> > to<br>
> > > > > > 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<br>
> > (based<br>
> > > > on<br>
> > > > > > 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<br>
> > > > wrote:<br>
> > > > > > > > > > > Hi,<br>
> > > > > > > > > > > I have installed Spice and now I'm trying to use it. I'm<br>
> > > > > > interested<br>
> > > > > > > > in<br>
> > > > > > > > > > how<br>
> > > > > > > > > > > spice manage streaming video. I read that there is the<br>
> > option<br>
> > > > > > > > > > ><br>
> > > > > > > > > > > -streaming-video=[all|off|filter]<br>
> > > > > > > > > > ><br>
> > > > > > > > > > > Can you explain me the difference between these three<br>
> > option?<br>
> > > > > > > > > > > Which source file read the command line?<br>
> > > > > > > > > > > Why I have tried to play a video in a player but i have<br>
> > not<br>
> > > > > > notice<br>
> > > > > > > > any<br>
> > > > > > > > > > > difference between the two options 'off' and 'filter'?<br>
> > > > > > > > > > ><br>
> > > > > > > > > ><br>
> > > > > > > > > > Look at<br>
> > > > > > > ><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<br>
> > > > based<br>
> > > > > > 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>
> > > > > > > > > > ><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>
> > > > > ><br>
> > > ><br>
> ><br>
</div></div></blockquote></div><br></div>