This really fixes SharedOpenGL with Mesa/DRI.
Nvidia doesn't work (my setup was broken and it used software rendering
thatswhy i thought it worked)

Alexander

Am Mittwoch, den 18.07.2007, 17:21 +0200 schrieb Alexander Eichner:
> This is the new version of the patch.
> It removes the need for a global display variable and replaces the
> PixelFormat to XVisualInfo conversion code with one which uses
> GLXFBConfig. All demos are now working with nvidia drivers.
> 
> Alexander Eichner
> 
> Am Mittwoch, den 11.07.2007, 12:59 +0200 schrieb Alexander Eichner:
> > there were some things left in the Makefile.kmk from a previous attempt
> > to get Display variable via global qApp object.
> > Prevents VirtualBox from building on other Distros like Fedira 7.
> > Removed it. Updated patch attached.
> > 
> > Alexander
> > 
> > Am Mittwoch, den 11.07.2007, 11:51 +0200 schrieb Alexander Eichner:
> > > the attached patch adds basic Shared OpenGL support for Windows guests
> > > on Linux hosts.
> > > It currently works with the mesa software renderer.
> > > tests with the accelerated but proprietary nvidia driver resulted in a
> > > segmentation fault.
> > > Another problem is that it needs a global Display variable which is
> > > defined in the VirtualBox frontend.
> > > The patched is released under the MIT license
> > > 
> > > Regards,
> > > Alexander Eichner
> > > _______________________________________________
> > > vbox-dev mailing list
> > > [email protected]
> > > http://vbox.innotek.de/mailman/listinfo/vbox-dev
> > _______________________________________________
> > vbox-dev mailing list
> > [email protected]
> > http://vbox.innotek.de/mailman/listinfo/vbox-dev
> _______________________________________________
> vbox-dev mailing list
> [email protected]
> http://vbox.innotek.de/mailman/listinfo/vbox-dev
Index: src/VBox/HostServices/SharedOpenGL/gllindrv.cpp
===================================================================
--- src/VBox/HostServices/SharedOpenGL/gllindrv.cpp	(Revision 3716)
+++ src/VBox/HostServices/SharedOpenGL/gllindrv.cpp	(Arbeitskopie)
@@ -41,6 +41,14 @@
 {
     return (XIO_handler(d));
 }*/
+
+/* X11 server connection for all OpenGL clients.
+ * Neccessary because Mesa and DRI cannot handle more than one
+ * connection per thread (only hardware acceleration, software rendering
+ * runs fine with more than one connection). 
+ * Would crash in vboxglDisconnect if on every vboxglConnect
+ * a new Display is created */
+Display *glXDisplay = NULL;
 
 static Bool WaitForNotify( Display *dpy, XEvent *event, XPointer arg ) {
     return (event->type == MapNotify) && (event->xmap.window == (Window) arg);
@@ -156,6 +164,8 @@
 int vboxglGlobalInit()
 {
     Log(("vboxglGlobalInit\n"));
+
+    glXDisplay = XOpenDisplay(NULL);
 
     /*vboxInitOpenGLExtensions();*/
     return VINF_SUCCESS;
@@ -251,7 +261,7 @@
     pClient->PixelFormatToFBConfigMapper = NULL;
     pClient->xWindow = 0;
 
-    pClient->dpy = XOpenDisplay(NULL);
+    pClient->dpy = glXDisplay;
 
     if (pClient->dpy) {
         int  screenNum, major, minor;
@@ -297,16 +307,14 @@
     Log(("vboxglDisconnect\n"));
 
 #ifdef VBOX_OGL_DEBUG_WINDOW_OUTPUT
-    if (pClient->dpy) {
-        if (pClient->xWindow != 0) {
-            XUnmapWindow(pClient->dpy, pClient->xWindow);
-            XDestroyWindow(pClient->dpy, pClient->xWindow);
-        }
-        if (pClient->PixelFormatToFBConfigMapper) {
-            XFree(pClient->PixelFormatToFBConfigMapper);
-        }
-        XCloseDisplay(pClient->dpy);
+    if (pClient->xWindow != 0) {
+        XUnmapWindow(pClient->dpy, pClient->xWindow);
+        XDestroyWindow(pClient->dpy, pClient->xWindow);
     }
+    if (pClient->PixelFormatToFBConfigMapper) {
+        XFree(pClient->PixelFormatToFBConfigMapper);
+    }
+
     pClient->dpy = NULL;
     pClient->xWindow = 0;
     pClient->actFBConfig = NULL;
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev

Reply via email to