vbox: remove signal receiver usage for fb & input

avoids deadlocks due to new libc and vfs usage
This commit is contained in:
Alexander Boettcher 2017-02-20 13:44:12 +01:00 committed by Christian Helmuth
parent 328da2975f
commit 3226dd0649
6 changed files with 66 additions and 94 deletions

View File

@ -179,7 +179,7 @@ void GenodeConsole::update_video_mode()
32);
}
void GenodeConsole::handle_input(unsigned)
void GenodeConsole::handle_input()
{
static LONG64 mt_events [64];
unsigned mt_number = 0;
@ -329,7 +329,7 @@ void GenodeConsole::handle_input(unsigned)
RTTimeMilliTS());
}
void GenodeConsole::handle_mode_change(unsigned)
void GenodeConsole::handle_mode_change()
{
Display *d = getDisplay();
Genodefb *fb = dynamic_cast<Genodefb *>(d->getFramebuffer());
@ -365,7 +365,7 @@ void GenodeConsole::init_clipboard()
}
}
void GenodeConsole::handle_cb_rom_change(unsigned)
void GenodeConsole::handle_cb_rom_change()
{
if (!_clipboard_rom)
return;
@ -373,7 +373,7 @@ void GenodeConsole::handle_cb_rom_change(unsigned)
vboxClipboardSync(nullptr);
}
void GenodeConsole::event_loop(IKeyboard * gKeyboard, IMouse * gMouse)
void GenodeConsole::init_backends(IKeyboard * gKeyboard, IMouse * gMouse)
{
_vbox_keyboard = gKeyboard;
_vbox_mouse = gMouse;
@ -383,16 +383,6 @@ void GenodeConsole::event_loop(IKeyboard * gKeyboard, IMouse * gMouse)
Genodefb *fb = dynamic_cast<Genodefb *>(d->getFramebuffer());
fb->mode_sigh(_mode_change_signal_dispatcher);
for (;;) {
Genode::Signal sig = _receiver.wait_for_signal();
Genode::Signal_dispatcher_base *dispatcher =
dynamic_cast<Genode::Signal_dispatcher_base *>(sig.context());
if (dispatcher)
dispatcher->dispatch(sig.num());
}
}
void GenodeConsole::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,

View File

@ -111,20 +111,19 @@ class GenodeConsole : public Console {
private:
Input::Connection _input;
Genode::Signal_receiver _receiver;
unsigned _ax, _ay;
bool _last_received_motion_event_was_absolute;
Report::Connection _shape_report_connection;
Genode::Attached_dataspace _shape_report_ds;
Vbox_pointer::Shape_report *_shape_report;
Genode::Reporter *_clipboard_reporter;
Genode::Attached_rom_dataspace *_clipboard_rom;
IKeyboard *_vbox_keyboard;
IMouse *_vbox_mouse;
Genode::Signal_dispatcher<GenodeConsole> _input_signal_dispatcher;
Genode::Signal_dispatcher<GenodeConsole> _mode_change_signal_dispatcher;
Genode::Signal_dispatcher<GenodeConsole> _clipboard_signal_dispatcher;
Input::Connection _input;
unsigned _ax, _ay;
bool _last_received_motion_event_was_absolute;
Report::Connection _shape_report_connection;
Genode::Attached_dataspace _shape_report_ds;
Vbox_pointer::Shape_report *_shape_report;
Genode::Reporter *_clipboard_reporter;
Genode::Attached_rom_dataspace *_clipboard_rom;
IKeyboard *_vbox_keyboard;
IMouse *_vbox_mouse;
Genode::Signal_handler<GenodeConsole> _input_signal_dispatcher;
Genode::Signal_handler<GenodeConsole> _mode_change_signal_dispatcher;
Genode::Signal_handler<GenodeConsole> _clipboard_signal_dispatcher;
bool _key_status[Input::KEY_MAX + 1];
@ -151,9 +150,9 @@ class GenodeConsole : public Console {
_clipboard_rom(nullptr),
_vbox_keyboard(0),
_vbox_mouse(0),
_input_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_input),
_mode_change_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_mode_change),
_clipboard_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_cb_rom_change)
_input_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_input),
_mode_change_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_mode_change),
_clipboard_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_cb_rom_change)
{
for (unsigned i = 0; i <= Input::KEY_MAX; i++)
_key_status[i] = 0;
@ -163,7 +162,7 @@ class GenodeConsole : public Console {
void init_clipboard();
void event_loop(IKeyboard * gKeyboard, IMouse * gMouse);
void init_backends(IKeyboard * gKeyboard, IMouse * gMouse);
void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative,
BOOL supportsMT, BOOL needsHostCursor);
@ -229,7 +228,7 @@ class GenodeConsole : public Console {
void update_video_mode();
void handle_input(unsigned);
void handle_mode_change(unsigned);
void handle_cb_rom_change(unsigned);
void handle_input();
void handle_mode_change();
void handle_cb_rom_change();
};

View File

@ -96,13 +96,13 @@ HRESULT setupmachine(Genode::Env &env)
static com::Utf8Str vm_name(c_vbox_vmname);
/* Machine object */
ComObjPtr<Machine> machine;
static ComObjPtr<Machine> machine;
rc = machine.createObject();
if (FAILED(rc))
return rc;
/* Virtualbox object */
ComObjPtr<VirtualBox> virtualbox;
static ComObjPtr<VirtualBox> virtualbox;
rc = virtualbox.createObject();
if (FAILED(rc))
return rc;
@ -120,7 +120,7 @@ HRESULT setupmachine(Genode::Env &env)
return rc;
// open a session
ComObjPtr<Session> session;
static ComObjPtr<Session> session;
rc = session.createObject();
if (FAILED(rc))
return rc;
@ -130,17 +130,17 @@ HRESULT setupmachine(Genode::Env &env)
return rc;
/* Console object */
ComPtr<IConsole> gConsole;
static ComPtr<IConsole> gConsole;
rc = session->COMGETTER(Console)(gConsole.asOutParam());
/* handle input of Genode and forward it to VMM layer */
ComPtr<GenodeConsole> genodeConsole = gConsole;
static ComPtr<GenodeConsole> genodeConsole = gConsole;
RTLogPrintf("genodeConsole = %p\n", genodeConsole);
genodeConsole->init_clipboard();
/* Display object */
ComPtr<IDisplay> display;
static ComPtr<IDisplay> display;
rc = gConsole->COMGETTER(Display)(display.asOutParam());
if (FAILED(rc))
return rc;
@ -182,16 +182,15 @@ HRESULT setupmachine(Genode::Env &env)
Assert (&*gMouse);
/* request keyboard object */
ComPtr<IKeyboard> gKeyboard;
static ComPtr<IKeyboard> gKeyboard;
rc = gConsole->COMGETTER(Keyboard)(gKeyboard.asOutParam());
if (FAILED(rc))
return rc;
Assert (&*gKeyboard);
genodeConsole->event_loop(gKeyboard, gMouse);
genodeConsole->init_backends(gKeyboard, gMouse);
Assert(!"return not expected");
return E_FAIL;
return rc;
}
@ -252,5 +251,4 @@ void Libc::Component::construct(Libc::Env &env)
throw -2;
}
});
Genode::error("VMM exiting ...");
}

View File

@ -124,7 +124,7 @@ void GenodeConsole::update_video_mode()
32);
}
void GenodeConsole::handle_input(unsigned)
void GenodeConsole::handle_input()
{
static LONG64 mt_events [64];
unsigned mt_number = 0;
@ -274,7 +274,7 @@ void GenodeConsole::handle_input(unsigned)
RTTimeMilliTS());
}
void GenodeConsole::handle_mode_change(unsigned)
void GenodeConsole::handle_mode_change()
{
IFramebuffer *pFramebuffer = NULL;
HRESULT rc = i_getDisplay()->QueryFramebuffer(0, &pFramebuffer);
@ -313,7 +313,7 @@ void GenodeConsole::init_clipboard()
}
}
void GenodeConsole::handle_cb_rom_change(unsigned)
void GenodeConsole::handle_cb_rom_change()
{
if (!_clipboard_rom)
return;
@ -321,7 +321,7 @@ void GenodeConsole::handle_cb_rom_change(unsigned)
vboxClipboardSync(nullptr);
}
void GenodeConsole::event_loop(IKeyboard * gKeyboard, IMouse * gMouse)
void GenodeConsole::init_backends(IKeyboard * gKeyboard, IMouse * gMouse)
{
_vbox_keyboard = gKeyboard;
_vbox_mouse = gMouse;
@ -334,17 +334,6 @@ void GenodeConsole::event_loop(IKeyboard * gKeyboard, IMouse * gMouse)
Genodefb *fb = dynamic_cast<Genodefb *>(pFramebuffer);
fb->mode_sigh(_mode_change_signal_dispatcher);
for (;;) {
Genode::Signal sig = _receiver.wait_for_signal();
Genode::Signal_dispatcher_base *dispatcher =
dynamic_cast<Genode::Signal_dispatcher_base *>(sig.context());
if (dispatcher)
dispatcher->dispatch(sig.num());
}
}
void GenodeConsole::i_onMouseCapabilityChange(BOOL supportsAbsolute,

View File

@ -111,20 +111,19 @@ class GenodeConsole : public Console {
private:
Input::Connection _input;
Genode::Signal_receiver _receiver;
unsigned _ax, _ay;
bool _last_received_motion_event_was_absolute;
Report::Connection _shape_report_connection;
Genode::Attached_dataspace _shape_report_ds;
Vbox_pointer::Shape_report *_shape_report;
Genode::Reporter *_clipboard_reporter;
Genode::Attached_rom_dataspace *_clipboard_rom;
IKeyboard *_vbox_keyboard;
IMouse *_vbox_mouse;
Genode::Signal_dispatcher<GenodeConsole> _input_signal_dispatcher;
Genode::Signal_dispatcher<GenodeConsole> _mode_change_signal_dispatcher;
Genode::Signal_dispatcher<GenodeConsole> _clipboard_signal_dispatcher;
Input::Connection _input;
unsigned _ax, _ay;
bool _last_received_motion_event_was_absolute;
Report::Connection _shape_report_connection;
Genode::Attached_dataspace _shape_report_ds;
Vbox_pointer::Shape_report *_shape_report;
Genode::Reporter *_clipboard_reporter;
Genode::Attached_rom_dataspace *_clipboard_rom;
IKeyboard *_vbox_keyboard;
IMouse *_vbox_mouse;
Genode::Signal_handler<GenodeConsole> _input_signal_dispatcher;
Genode::Signal_handler<GenodeConsole> _mode_change_signal_dispatcher;
Genode::Signal_handler<GenodeConsole> _clipboard_signal_dispatcher;
bool _key_status[Input::KEY_MAX + 1];
@ -151,9 +150,9 @@ class GenodeConsole : public Console {
_clipboard_rom(nullptr),
_vbox_keyboard(0),
_vbox_mouse(0),
_input_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_input),
_mode_change_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_mode_change),
_clipboard_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_cb_rom_change)
_input_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_input),
_mode_change_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_mode_change),
_clipboard_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_cb_rom_change)
{
for (unsigned i = 0; i <= Input::KEY_MAX; i++)
_key_status[i] = 0;
@ -163,7 +162,7 @@ class GenodeConsole : public Console {
void init_clipboard();
void event_loop(IKeyboard * gKeyboard, IMouse * gMouse);
void init_backends(IKeyboard * gKeyboard, IMouse * gMouse);
void i_onMouseCapabilityChange(BOOL supportsAbsolute,
BOOL supportsRelative, BOOL supportsMT,
@ -229,7 +228,7 @@ class GenodeConsole : public Console {
void update_video_mode();
void handle_input(unsigned);
void handle_mode_change(unsigned);
void handle_cb_rom_change(unsigned);
void handle_input();
void handle_mode_change();
void handle_cb_rom_change();
};

View File

@ -99,13 +99,13 @@ HRESULT setupmachine(Genode::Env &env)
static com::Utf8Str vm_name(c_vbox_vmname);
/* Machine object */
ComObjPtr<Machine> machine;
static ComObjPtr<Machine> machine;
rc = machine.createObject();
if (FAILED(rc))
return rc;
/* Virtualbox object */
ComObjPtr<VirtualBox> virtualbox;
static ComObjPtr<VirtualBox> virtualbox;
rc = virtualbox.createObject();
if (FAILED(rc))
return rc;
@ -125,7 +125,7 @@ HRESULT setupmachine(Genode::Env &env)
return rc;
// open a session
ComObjPtr<Session> session;
static ComObjPtr<Session> session;
rc = session.createObject();
if (FAILED(rc))
return rc;
@ -157,17 +157,17 @@ HRESULT setupmachine(Genode::Env &env)
}
/* Console object */
ComPtr<IConsole> gConsole;
static ComPtr<IConsole> gConsole;
rc = session->COMGETTER(Console)(gConsole.asOutParam());
/* handle input of Genode and forward it to VMM layer */
ComPtr<GenodeConsole> genodeConsole = gConsole;
static ComPtr<GenodeConsole> genodeConsole = gConsole;
RTLogPrintf("genodeConsole = %p\n", genodeConsole);
genodeConsole->init_clipboard();
/* Display object */
ComPtr<IDisplay> display;
static ComPtr<IDisplay> display;
rc = gConsole->COMGETTER(Display)(display.asOutParam());
if (FAILED(rc))
return rc;
@ -213,16 +213,15 @@ HRESULT setupmachine(Genode::Env &env)
Assert (&*gMouse);
/* request keyboard object */
ComPtr<IKeyboard> gKeyboard;
static ComPtr<IKeyboard> gKeyboard;
rc = gConsole->COMGETTER(Keyboard)(gKeyboard.asOutParam());
if (FAILED(rc))
return rc;
Assert (&*gKeyboard);
genodeConsole->event_loop(gKeyboard, gMouse);
genodeConsole->init_backends(gKeyboard, gMouse);
Assert(!"return not expected");
return E_FAIL;
return rc;
}
@ -284,6 +283,4 @@ void Libc::Component::construct(Libc::Env &env)
throw -2;
}
});
Genode::error("VMM exiting ...");
}