Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Liviu Ionescu
> On 13 Dec 2016, at 09:04, Fam Zheng wrote: > > using qemu_bh_schedule_idle in the QEMU main loop and poll event there > periodically. ok, so my TODO list includes two items: to move user events on an event notifier and to run the SDL_PollEvent() on qemu_bh_schedule_idle. I'll do this, but a

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Fam Zheng
On Mon, 12/12 17:07, Liviu Ionescu wrote: > > > On 12 Dec 2016, at 16:51, Fam Zheng wrote: > > > > On Mon, 12/12 15:22, Liviu Ionescu wrote: > >> so, back to square one; any suggestion on how to avoid the periodic timer > >> required to poll SDL system events? > > > > Good question, I've missed

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Liviu Ionescu
> On 12 Dec 2016, at 16:51, Fam Zheng wrote: > > On Mon, 12/12 15:22, Liviu Ionescu wrote: >> so, back to square one; any suggestion on how to avoid the periodic timer >> required to poll SDL system events? > > Good question, I've missed that! > > Sadly I don't find it possible. The main threa

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Fam Zheng
On Mon, 12/12 15:22, Liviu Ionescu wrote: > so, back to square one; any suggestion on how to avoid the periodic timer > required to poll SDL system events? Good question, I've missed that! Sadly I don't find it possible. The main thread of QEMU has to run the glib event loop so it cannot block on

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Liviu Ionescu
> On 12 Dec 2016, at 14:28, Fam Zheng wrote: > > ... Take a look at event_notifier_set_handler() and event_notifier_set(). > ... qemu_bh_new() and qemu_bh_schedule(). > > Both can register a callback that will be called in main loop once fired. ok, thank you, I'll consider them. if I understa

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Fam Zheng
On Mon, 12/12 13:27, Liviu Ionescu wrote: > > > On 12 Dec 2016, at 12:36, Fam Zheng wrote: > > > > an EventNotifier in the main thread which is notified by the vCPU > > thread upon a new graphics operation? > > the idea of using notifications is ok, but I could not figure out what api to > use

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Liviu Ionescu
> On 12 Dec 2016, at 12:36, Fam Zheng wrote: > > an EventNotifier in the main thread which is notified by the vCPU > thread upon a new graphics operation? the idea of using notifications is ok, but I could not figure out what api to use to implement it. can you provide more details? regards,

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Daniel P. Berrange
On Mon, Dec 12, 2016 at 06:36:16PM +0800, Fam Zheng wrote: > On Mon, 12/12 12:20, Liviu Ionescu wrote: > > > > > On 12 Dec 2016, at 11:39, Fam Zheng wrote: > > > > > > ... I myself know next to nothing about SDL project. > > > > ok, neither do I. > > > > > > do you have any comments on the cu

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Fam Zheng
On Mon, 12/12 12:20, Liviu Ionescu wrote: > > > On 12 Dec 2016, at 11:39, Fam Zheng wrote: > > > > ... I myself know next to nothing about SDL project. > > ok, neither do I. > > > do you have any comments on the current situation of the SDL integration in > QEMU? any comments on the conclusio

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Liviu Ionescu
> On 12 Dec 2016, at 11:39, Fam Zheng wrote: > > ... I myself know next to nothing about SDL project. ok, neither do I. do you have any comments on the current situation of the SDL integration in QEMU? any comments on the conclusions I reached after integrating SDL2 into GNU ARM Eclipse QEM

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-12 Thread Fam Zheng
On Mon, 12/12 09:43, Liviu Ionescu wrote: > > > On 12 Dec 2016, at 09:39, Fam Zheng wrote: > > > >> any idea how difficult would be to push any changes to SDL? > > > > Not sure I understand this question, could you be more specific? > > I guess making SDL run asynchronously will need some majo

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-11 Thread Liviu Ionescu
> On 12 Dec 2016, at 09:39, Fam Zheng wrote: > >> any idea how difficult would be to push any changes to SDL? > > Not sure I understand this question, could you be more specific? I guess making SDL run asynchronously will need some major changes to the SDL source code, not simple patches that

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-11 Thread Fam Zheng
On Mon, 12/12 09:18, Liviu Ionescu wrote: > > > On 12 Dec 2016, at 05:35, Fam Zheng wrote: > > > > Isn't it possible to notify the main thread with an EventNotifier and > > process > > the deferred events in its handler? > > ideally, the SDL main loop might be re-implemented asynchronously, fo

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-11 Thread Liviu Ionescu
> On 12 Dec 2016, at 05:35, Fam Zheng wrote: > > Isn't it possible to notify the main thread with an EventNotifier and process > the deferred events in its handler? ideally, the SDL main loop might be re-implemented asynchronously, for example using a pipe to pass the events, and in this case

Re: [Qemu-devel] experience with SDL2, event loop & main thread

2016-12-11 Thread Fam Zheng
On Sat, 12/10 18:16, Liviu Ionescu wrote: > conclusions: > > - the graphical event loop and all graphical primitives must be called from > the main thread context > - in qemu this is not possible directly; an inefficient but functional > solution uses a timer programmed to call a function every f

[Qemu-devel] experience with SDL2, event loop & main thread

2016-12-10 Thread Liviu Ionescu
given the reported problems with the SDL integration, here are some things I learned while updating GNU ARM Eclipse QEMU to use SDL2 (SDL1 is already issuing various warnings when running on macOS 10.12, and anyway it has several limitations). --- initially I expected that the project requires