X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=qemu%2Froms%2Fopenbios%2Farch%2Funix%2Fgui_qt%2Fqt-main.cpp;fp=qemu%2Froms%2Fopenbios%2Farch%2Funix%2Fgui_qt%2Fqt-main.cpp;h=8311fe632fba077858759a40b722f26d47636e46;hb=e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb;hp=0000000000000000000000000000000000000000;hpb=9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00;p=kvmfornfv.git diff --git a/qemu/roms/openbios/arch/unix/gui_qt/qt-main.cpp b/qemu/roms/openbios/arch/unix/gui_qt/qt-main.cpp new file mode 100644 index 000000000..8311fe632 --- /dev/null +++ b/qemu/roms/openbios/arch/unix/gui_qt/qt-main.cpp @@ -0,0 +1,97 @@ +/* tag: openbios qt user interface + * + * Copyright (C) 2003-2004 Stefan Reinauer + * + * See the file "COPYING" for further information about + * the copyright and warranty status of this work. + */ + + +extern "C" { +#include +#include +#include "unix/plugins.h" +#include "unix/plugin_pci.h" +} +#include "gui-qt.h" + +#define DEBUG + +volatile unsigned char * fb=0; +volatile int gui_running=0; + +typedef struct { + int argc; + char **argv; +} threaddata; + +void *gui_thread(void *ptr) +{ + threaddata *td=(threaddata *)ptr; + + QApplication a(td->argc, td->argv); + FrameBufferWidget w; + + a.setMainWidget(&w); + w.show(); + + fb=w.getFrameBuffer(); + + gui_running=-1; + a.exec(); + gui_running=0; + + return 0; +} + +extern "C" { +extern int plugin_qt_init(void); +int plugin_qt_init(void) +{ + pthread_t mythread; + char *args[]={ "plugin_qt" }; + threaddata mytd = { 1, args }; + +#ifdef DEBUG + printf("Initializing \"framebuffer\" plugin..."); +#endif + pthread_create(&mythread, NULL, gui_thread, &mytd); + while (!fb) + usleep(20); + +#if 0 + + /* now we have the framebuffer start address. + * updating pci config space to reflect this + */ +#if (BITS > 32) + *(u32 *)(pci_config_space+0x14)=(u32)((unsigned long)fb>>32); +#else + *(u32 *)(pci_config_space+0x14)=0; +#endif + *(u32 *)(pci_config_space+0x10)=(u32)((unsigned long)fb&0xffffffff); + + /* next is to write the rom address. We write that at a random + * address in pci config space for now. + */ +#if (BITS > 32) + *(u32 *)(pci_config_space+0x34)=(u32)((unsigned long)qt_fcode>>32); +#else + *(u32 *)(pci_config_space+0x34)=0; +#endif + *(u32 *)(pci_config_space+0x30)=(u32)((unsigned long)qt_fcode&0xffffffff); + + /* FIXME: we need to put the fcode image for this + * device to the rom resource, once it exists + */ + + /* register pci device to be available to beginagain */ + pci_register_device(0, 2, 0, pci_config_space); +#endif +#ifdef DEBUG + printf("done.\n"); +#endif + return 0; +} + +}