Hello, 
add cc to list 

On Seg, 2014-03-17 at 08:07 +0100, Michael Thayer wrote: 
> Hello Sérgio,
> 
> On 17/03/14 02:44, Sérgio Basto wrote:
> [...]
> > I'd like communicate my newest patch also to compile guest additions for
> > Fedora 19, 20 and 21, only with X11 and Mesa system sources, the patch
> > is also available on cvs of rpmfusion [1]
> >
> > We have some tricks there :
> > 1 - ./src/VBox/Additions/common/crOpenGL/fakedri_drv.c have some code
> > that depends on internals of X11 source code and that code have been
> > removed for X-server 1.15 in Fedora rawhide (21), therefore we couldn't
> > compile it. Afterward I found that code is just need to one function :
> >      vboxPatchMesaGLAPITable();
> > Comment that function and all code that depends on that, make it
> > possible (again) compile with system source code and also dropped the
> > need of xorg-x11-server-source, now just need "normal" devel packages.
> 
> It looks to me as if you are removing the code which sets up the driver 
> functionality in Mesa, and I would expect that with this patch you would 
> get no hardware accelerated 3D at all (possibly software accelerated 
> instead, possibly still reported as hardware accelerated). 

Many thanks for your reply, OK , hopefully we are talking about drivers
for guest system , so is not much used, though that PatchMesaGLAPITable 
was sort of a fix ... 

My main goal as packager of rpmfusion is unbundle sources that are
bundle in Vbox , so I need remove 
src/VBox/Additions/x11/x11include
src/VBox/Additions/x11/x11stubs
src/VBox/GuestHost/OpenGL/include/GLglext.h ( I found this one today )

after some investigation, came up that I can almost compile with system
sources on Fedora 20 with:

-#include "src/mesa/main/mtypes.h"
-#include "src/mesa/main/dd.h"
-#include "src/mesa/glapi/dispatch.h"
-#include "src/mesa/glapi/glapi.h"
-#include "src/mesa/glapi/glapitable.h"
-#include "src/mesa/glapi/glapioffsets.h"
-#include "src/mesa/drivers/dri/common/dri_util.h"
+#include <stdlib.h>
+#include <string.h>
+#include "include/xorg-server.h"
+#include <GL/glext.h>
#include "GL/internal/dri_interface.h"
+#include "glx/glapi.h"
+#include "glx/glapitable.h"
+#include "glx/dispatch.h"
+#include "glx/glprocs.h"
+#include <xf86drm.h>

with -I /usr/share/xorg-x11-server-source/ (from xorg-x11-server-source
package) 

but for Fedora 21 with new xorg-x11-server-1.15.0, glx/glapi.h and
glx/glapitable.h disappears. 

also, _glapi_get_proc_offset have been removed before Fedora 20
( xorg-x11-server-1.14.4  ) look at :
http://lists.x.org/archives/xorg-devel/2011-March/019853.html 

So for Fedora 20, I could replace _glapi_get_proc_offset or sort of, see
patch in attach , but for Fedora 21 vboxPatchMesaGLAPITable(); have
_glapi_get_dispatch functions that are completely obsoleted , even
removed :-/  

>  Have you 
> tested this?  

yes glxinfo change is behavior , but can't be precise right now.

> It is usually pretty easy to tell, as you tend to get 
> glitches with hardware acceleration when 3D windows (e.g. glxgears) are 
> moved, or other windows raised to be on top of them, whereas with 
> software acceleration you will not see any glitches.
> Regards,
> 
> Michael
> 
> > 2nd trick is #define HAVE_STRNDUP 1 , I don't understand why is need,
> > but is need, for more information, see bug report on freedesktop.org [2]

#include "include/xorg-server.h" seems the correct way ... 

> > Other thing that I evaluate, is compile with libXcomposite , libXdamage,
> > libXfixes and libXext of the system .
> >
> > If you could add VBOX_USE_SYSTEM_XORG_HEADERS=1
> > for ./src/VBox/Additions/ and other cases will be great.

Vbox have in src/VBox/Additions/x11/x11stubs/
libXcomposite-1.0.0/ libXdamage-1.1.0/    libXext-6.4.0/
libXfixes-3.1.0/     Makefile.kmk

in Fedora 20 we have: 
libXcomposite-0.4.4-4.fc20
libXdamage-1.1.4-4.fc20
libXext-1.3.2-2.fc20
libXfixes-5.0.1-2.fc20


I also removed src/VBox/Additions/x11/x11stubs and compile with system
sources. 

It kind of work, don't see any problem , like I wrote this is an
exercise with guest systems.


> > Thanks,
> >
> > [1]
> > http://cvs.rpmfusion.org/viewvc/*checkout*/rpms/VirtualBox/devel/VirtualBox-4.3.6-mesa.patch?root=free&revision=1.3&content-type=text%2Fplain
> >
> > [2] https://bugs.freedesktop.org/show_bug.cgi?id=47971
> >



-- 
Sérgio M. B.
fakedri_drv.c,h:
Just compile with X11 system source and we may remove bundle X11 source code.

--- ./Config.kmk	2012-03-13 13:14:01.000000000 +0000
+++ ./Config.kmk	2012-03-27 23:55:28.070630137 +0100
@@ -2166,15 +2166,9 @@ ifdef VBOX_WITH_CROGL
  endif
 
  if1of ($(KBUILD_TARGET), freebsd linux solaris)
- # VBOX_PATH_MESA_SOURCE = $(PATH_ROOT)/src/libs/mesa-7.2
-  VBOX_PATH_MESA_SOURCE = $(VBOX_PATH_X11_ROOT)/mesa-7.2
   VBOX_MESA_INCS = \
-        $(VBOX_PATH_MESA_SOURCE) \
-        $(VBOX_PATH_MESA_SOURCE)/include \
-        $(VBOX_PATH_MESA_SOURCE)/src/mesa/ \
-        $(VBOX_PATH_MESA_SOURCE)/src/mesa/glapi \
-        $(VBOX_PATH_MESA_SOURCE)/src/mesa/main \
-        $(VBOX_PATH_MESA_SOURCE)/src/mesa/drivers/dri/common
+        /usr/share/xorg-x11-server-source/ \
+        /usr/share/xorg-x11-server-source/include
  endif
 
  VBOX_DARWIN_OPENGL_INST     = obj/VBoxOGL/GL/
--- ./src/VBox/Additions/common/crOpenGL/Makefile.kmk.mesa	2012-09-13 09:26:18.000000000 +0100
+++ ./src/VBox/Additions/common/crOpenGL/Makefile.kmk	2012-09-23 01:08:36.032101751 +0100
@@ -82,18 +82,12 @@ VBoxOGL_TEMPLATE       = VBOXCROGLR3GUES
 VBoxOGL_INCS           = .
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
  VBoxOGL_INCS     += \
-	$(VBOX_PATH_X11_ROOT)/libXdamage-1.1 \
-	$(VBOX_PATH_X11_ROOT)/libXcomposite-0.4.0 \
-	$(VBOX_PATH_X11_ROOT)/libXext-1.3.1 \
-	$(VBOX_PATH_X11_ROOT)/libXfixes-4.0.3 \
-	$(VBOX_PATH_X11_ROOT)/damageproto-1.1.0 \
-	$(VBOX_PATH_X11_ROOT)/compositeproto-0.4 \
-	$(VBOX_PATH_X11_ROOT)/fixesproto-4.0 \
-	$(VBOX_PATH_X11_ROOT)/libx11-1.1.5-other \
-	$(VBOX_PATH_X11_ROOT)/xextproto-7.1.1 \
-	$(VBOX_PATH_X11_ROOT)/xproto-7.0.18 \
+	/usr/include/x11 \
+	/usr/include/xorg \
+	/usr/include/pixman-1 \
 	$(VBOX_MESA_INCS) \
-	$(PATH_ROOT)/src/VBox/Additions/x11/x11include/libdrm-2.4.13
+	/usr/include/drm \
+	/usr/include/libdrm
  VBoxOGL_DEFS     += VBOX_NO_NATIVEGL
 endif
 
@@ -222,11 +216,20 @@ VBoxOGL_LIBS = \
 	$(VBOX_LIB_OGL_CRUTIL) \
 	$(PATH_STAGE_LIB)/additions/VBoxOGLspuload$(VBOX_SUFF_LIB)
 if1of ($(KBUILD_TARGET), linux solaris freebsd)
- VBoxOGL_LIBS += \
- 	$(PATH_STAGE_LIB)/libXcomposite.so \
- 	$(PATH_STAGE_LIB)/libXdamage.so \
- 	$(PATH_STAGE_LIB)/libXfixes.so \
- 	$(PATH_STAGE_LIB)/libXext.so
+ if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),linux.x86 )
+  VBoxOGL_LIBS += \
+ 	/usr/lib/libXcomposite.so \
+ 	/usr/lib/libXdamage.so \
+ 	/usr/lib/libXfixes.so \
+ 	/usr/lib/libXext.so
+ endif
+ if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH),linux.amd64 )
+  VBoxOGL_LIBS += \
+ 	/usr/lib64/libXcomposite.so \
+ 	/usr/lib64/libXdamage.so \
+ 	/usr/lib64/libXfixes.so \
+ 	/usr/lib64/libXext.so
+ endif
  ifdef VBoxOGL_FAKEDRI
   ifeq ($(KBUILD_TARGET), freebsd)
     VBoxOGL_LIBS += \
--- ./src/VBox/Additions/common/crOpenGL/fakedri_drv.h.mesa	2013-12-18 16:06:06.000000000 +0000
+++ ./src/VBox/Additions/common/crOpenGL/fakedri_drv.h	2013-12-24 17:01:55.086948605 +0000
@@ -20,14 +20,16 @@
 #ifndef ___CROPENGL_FAKEDRIDRV_H
 #define ___CROPENGL_FAKEDRIDRV_H
 
-#include "src/mesa/main/mtypes.h"
-#include "src/mesa/main/dd.h"
-#include "src/mesa/glapi/dispatch.h"
-#include "src/mesa/glapi/glapi.h"
-#include "src/mesa/glapi/glapitable.h"
-#include "src/mesa/glapi/glapioffsets.h"
-#include "src/mesa/drivers/dri/common/dri_util.h"
+#include <stdlib.h>
+#include <string.h>
+#include "include/xorg-server.h"
+#include <GL/glext.h>
 #include "GL/internal/dri_interface.h"
+#include "glx/glapi.h"
+#include "glx/glapitable.h"
+#include "glx/dispatch.h"
+#include "glx/glprocs.h"
+#include <xf86drm.h>
 
 #include "glx_proto.h"
 
--- ./src/VBox/Additions/common/crOpenGL/fakedri_drv.c.mesa	2013-12-18 16:06:06.000000000 +0000
+++ ./src/VBox/Additions/common/crOpenGL/fakedri_drv.c	2013-12-24 19:56:30.880070340 +0000
@@ -136,8 +136,42 @@ static const __DRIswrastExtension *gpSwD
 
 extern const __DRIextension * __driDriverExtensions[];
 
+/**
+ * Search the table of static entrypoint functions for the named function
+ * and return the corresponding glprocs_table_t entry.
+ */
+static const glprocs_table_t *
+find_entry(const char *n)
+{
+    GLuint i;
+
+    for (i = 0; static_functions[i].Name_offset >= 0; i++) {
+        const char *testName =
+            gl_string_table + static_functions[i].Name_offset;
+        if (strcmp(testName, n) == 0) {
+            return &static_functions[i];
+        }
+    }
+    return NULL;
+}
+
+/**
+ * Return dispatch table offset of the named static (built-in) function.
+ * Return -1 if function not found.
+ */
+static GLint
+get_static_proc_offset(const char *funcName)
+{
+    const glprocs_table_t *const f = find_entry(funcName);
+
+    if (f) {
+        return f->Offset;
+    }
+    return -1;
+}
+
 #define VBOX_SET_MESA_FUNC(table, name, func) \
-    if (_glapi_get_proc_offset(name)>=0) SET_by_offset(table, _glapi_get_proc_offset(name), func); \
+    if (get_static_proc_offset(name)>=0) SET_by_offset(table, get_static_proc_offset(name), func); \
     else crWarning("%s not found in mesa table", name)
 
 #define GLAPI_ENTRY(Func) VBOX_SET_MESA_FUNC(vbox_glapi_table, "gl"#Func, cr_gl##Func);
_______________________________________________
vbox-dev mailing list
[email protected]
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to