mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 09:46:20 +00:00
vbox6: 3D support skeleton
files required for VBox6's VMSVGA/VBoxSVGA with 3D accelaration (accelerate3D="true"). issue #4380
This commit is contained in:
parent
c35d2aff45
commit
27883c976c
@ -1,5 +1,7 @@
|
||||
include $(REP_DIR)/lib/mk/virtualbox6-common.inc
|
||||
|
||||
LIBS += stdcxx mesa
|
||||
|
||||
SRC_CC += Devices/Audio/AudioHlp.cpp
|
||||
SRC_CC += Devices/Audio/AudioMixBuffer.cpp
|
||||
SRC_CC += Devices/Audio/AudioMixer.cpp
|
||||
@ -19,12 +21,28 @@ SRC_CC += Devices/EFI/DevSmc.cpp
|
||||
SRC_CC += Devices/EFI/FlashCore.cpp
|
||||
SRC_CC += Devices/GIMDev/DrvUDP.cpp
|
||||
SRC_CC += Devices/GIMDev/GIMDev.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA-SVGA.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA-SVGA3d-glHlp.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA-SVGA3d-hlp.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA-SVGA3d-info.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA-SVGA3d-savedstate.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA-SVGA3d-shared.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA-SVGA3d.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA_VBVA.cpp
|
||||
SRC_CC += Devices/Graphics/DevVGA_VDMA.cpp
|
||||
SRC_CC += Devices/Graphics/HGSMI/HGSMIHost.cpp
|
||||
SRC_CC += Devices/Graphics/HGSMI/SHGSMIHost.cpp
|
||||
SRC_C += Devices/Graphics/shaderlib/directx.c
|
||||
SRC_C += Devices/Graphics/shaderlib/glsl_shader.c
|
||||
SRC_C += Devices/Graphics/shaderlib/libWineStub/debug.c
|
||||
SRC_C += Devices/Graphics/shaderlib/shader.c
|
||||
SRC_C += Devices/Graphics/shaderlib/shader_sm1.c
|
||||
SRC_C += Devices/Graphics/shaderlib/shader_sm4.c
|
||||
SRC_C += Devices/Graphics/shaderlib/shaderapi.c
|
||||
SRC_C += Devices/Graphics/shaderlib/stateblock.c
|
||||
SRC_C += Devices/Graphics/shaderlib/utils.c
|
||||
SRC_CC += Devices/Input/DevPS2.cpp
|
||||
SRC_CC += Devices/Input/DevPS2K.cpp
|
||||
SRC_CC += Devices/Input/DevPS2M.cpp
|
||||
@ -105,11 +123,29 @@ SRC_CC += GuestHost/DragAndDrop/DnDPath.cpp
|
||||
|
||||
INC_DIR += $(VBOX_DIR)/Devices/build
|
||||
INC_DIR += $(VBOX_DIR)/Devices/Bus
|
||||
INC_DIR += $(VBOX_DIR)/Devices/Graphics/shaderlib/wine/include
|
||||
INC_DIR += $(VIRTUALBOX_DIR)/include/VBox/Graphics
|
||||
|
||||
# found in src/VBox/Devices/Makefile.kmk
|
||||
CC_OPT += -DVBOX_HGCM_HOST_CODE
|
||||
|
||||
# SVGA3D/wine specific config
|
||||
WINE_CC_OPT := -D__WINESRC__ -DWINE_NOWINSOCK -D_USE_MATH_DEFINES \
|
||||
-DVBOX_USING_WINDDK_W7_OR_LATER \
|
||||
-DVBOX_WINE_WITH_SINGLE_SWAPCHAIN_CONTEXT \
|
||||
-DVBOX_WINE_WITH_IPRT \
|
||||
-UVBOX_WITH_WDDM
|
||||
|
||||
CC_OPT_Devices/Graphics/shaderlib/directx = $(WINE_CC_OPT)
|
||||
CC_OPT_Devices/Graphics/shaderlib/glsl_shader = $(WINE_CC_OPT)
|
||||
CC_OPT_Devices/Graphics/shaderlib/libWineStub/debug = $(WINE_CC_OPT)
|
||||
CC_OPT_Devices/Graphics/shaderlib/shader = $(WINE_CC_OPT)
|
||||
CC_OPT_Devices/Graphics/shaderlib/shader_sm1 = $(WINE_CC_OPT)
|
||||
CC_OPT_Devices/Graphics/shaderlib/shader_sm4 = $(WINE_CC_OPT)
|
||||
CC_OPT_Devices/Graphics/shaderlib/shaderapi = $(WINE_CC_OPT)
|
||||
CC_OPT_Devices/Graphics/shaderlib/stateblock = $(WINE_CC_OPT)
|
||||
CC_OPT_Devices/Graphics/shaderlib/utils = $(WINE_CC_OPT)
|
||||
|
||||
Devices/Graphics/DevVGA.o: vbetables.h
|
||||
|
||||
vbetables.h: vbetables-gen
|
||||
|
@ -80,7 +80,7 @@ VBOX_CC_OPT += -DVBOX_VERSION_MAJOR=$(VBOX_VERSION_MAJOR) \
|
||||
|
||||
VBOX_CC_OPT += -DVBOX_WITH_WDDM -DVBOXWDDM_WITH_VBVA
|
||||
VBOX_CC_OPT += -DVBOX_WITH_VDMA
|
||||
VBOX_CC_OPT += -DVBOX_WITH_VMSVGA
|
||||
VBOX_CC_OPT += -DVBOX_WITH_VMSVGA -DVBOX_WITH_VMSVGA3D -DVMSVGA3D_OPENGL
|
||||
VBOX_CC_OPT += -DVBOX_HDD_NO_DYNAMIC_BACKENDS
|
||||
VBOX_CC_OPT += -DVBOX_WITH_SCSI
|
||||
VBOX_CC_OPT += -DVBOX_WITH_HOSTNETIF_API
|
||||
|
81
repos/ports/src/virtualbox6/glx_x11.cc
Normal file
81
repos/ports/src/virtualbox6/glx_x11.cc
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* \brief GLX/X11 emulation for SVGA3D
|
||||
* \author Christian Helmuth
|
||||
* \date 2021-10-01
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2021 Genode Labs GmbH
|
||||
*
|
||||
* This file is distributed under the terms of the GNU General Public License
|
||||
* version 2.
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
|
||||
/* GLX/X11 includes */
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <GL/glx.h>
|
||||
|
||||
/* VirtualBox includes */
|
||||
#include <iprt/types.h>
|
||||
#include <iprt/err.h>
|
||||
|
||||
/* local includes */
|
||||
#include <stub_macros.h>
|
||||
|
||||
static bool const debug = true;
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
/* from VBoxSVGA3DLazyLoad.asm */
|
||||
extern "C" int ExplicitlyLoadVBoxSVGA3D(bool fResolveAllImports, PRTERRINFO pErrInfo) TRACE(VINF_SUCCESS);
|
||||
|
||||
|
||||
/*
|
||||
* GLX
|
||||
*/
|
||||
|
||||
//static void impl_glXGetProcAddress(GLubyte const *procname)
|
||||
//{
|
||||
//}
|
||||
|
||||
void (*glXGetProcAddress(const GLubyte *procname))(void)
|
||||
{
|
||||
log(__func__, ": procname='", (char const *)procname, "'");
|
||||
|
||||
return (void(*)())nullptr;
|
||||
}
|
||||
|
||||
extern "C" GLXFBConfig * glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems) STOP
|
||||
extern "C" XVisualInfo * glXChooseVisual(Display *dpy, int screen, int *attribList) STOP
|
||||
extern "C" GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct) STOP
|
||||
extern "C" void glXDestroyContext(Display *dpy, GLXContext ctx) STOP
|
||||
extern "C" int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value) STOP
|
||||
extern "C" XVisualInfo * glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config) STOP
|
||||
extern "C" Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx) STOP
|
||||
extern "C" Bool glXQueryVersion(Display *dpy, int *maj, int *min) STOP
|
||||
|
||||
|
||||
/*
|
||||
* Xlib
|
||||
*/
|
||||
|
||||
extern "C" int XCloseDisplay(Display *) STOP
|
||||
extern "C" Colormap XCreateColormap(Display *, Window, Visual *, int) STOP
|
||||
extern "C" Window XCreateWindow( Display *, Window, int, int, unsigned int, unsigned int, unsigned int, int, unsigned int, Visual *, unsigned long, XSetWindowAttributes *) STOP
|
||||
extern "C" Window XDefaultRootWindow(Display *) STOP
|
||||
extern "C" int XDestroyWindow(Display *, Window) STOP
|
||||
extern "C" XErrorHandler XSetErrorHandler(XErrorHandler) STOP
|
||||
extern "C" int XFree(void *) STOP
|
||||
extern "C" Status XGetWindowAttributes(Display *, Window, XWindowAttributes *) STOP
|
||||
extern "C" int XMapWindow(Display *, Window) STOP
|
||||
extern "C" int XNextEvent(Display *, XEvent *) STOP
|
||||
extern "C" Display * XOpenDisplay(char *name) STOP
|
||||
extern "C" int XPending(Display *) STOP
|
||||
extern "C" int XScreenNumberOfScreen(Screen *) STOP
|
||||
extern "C" int XSync(Display *, Bool) STOP
|
47
repos/ports/src/virtualbox6/include/GL/glx.h
Normal file
47
repos/ports/src/virtualbox6/include/GL/glx.h
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef _GL__GLX_H_
|
||||
#define _GL__GLX_H_
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define GLX_RGBA 4
|
||||
#define GLX_DOUBLEBUFFER 5
|
||||
#define GLX_RED_SIZE 8
|
||||
#define GLX_GREEN_SIZE 9
|
||||
#define GLX_BLUE_SIZE 10
|
||||
#define GLX_ALPHA_SIZE 11
|
||||
#define GLX_DEPTH_SIZE 12
|
||||
#define GLX_STENCIL_SIZE 13
|
||||
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
|
||||
typedef struct _GLXContext { void *dummy; } * GLXContext;
|
||||
typedef struct _GLXFBConfig { void *dummy; } * GLXFBConfig;
|
||||
|
||||
typedef XID GLXDrawable;
|
||||
|
||||
extern void (*glXGetProcAddress(const GLubyte *procname))(void);
|
||||
|
||||
extern GLXFBConfig * glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems);
|
||||
extern XVisualInfo * glXChooseVisual(Display *dpy, int screen, int *attribList);
|
||||
extern GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
|
||||
extern void glXDestroyContext(Display *dpy, GLXContext ctx);
|
||||
extern int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value);
|
||||
extern XVisualInfo * glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config);
|
||||
extern Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx);
|
||||
extern Bool glXQueryVersion(Display *dpy, int *maj, int *min);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GL__GLX_H_ */
|
32
repos/ports/src/virtualbox6/include/X11/X.h
Normal file
32
repos/ports/src/virtualbox6/include/X11/X.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef _X11__X_H_
|
||||
#define _X11__X_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* originally in X11/Xmd.h */
|
||||
typedef unsigned int CARD32;
|
||||
|
||||
typedef CARD32 XID;
|
||||
typedef CARD32 VisualID;
|
||||
typedef XID Window;
|
||||
typedef XID Colormap;
|
||||
|
||||
#define None 0L
|
||||
#define InputOutput 1
|
||||
#define AllocNone 0
|
||||
|
||||
#define StructureNotifyMask (1L<<17)
|
||||
|
||||
#define CWBackPixel (1L<<1)
|
||||
#define CWBorderPixel (1L<<3)
|
||||
#define CWOverrideRedirect (1L<<9)
|
||||
#define CWEventMask (1L<<11)
|
||||
#define CWColormap (1L<<13)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _X11__X_H_ */
|
6
repos/ports/src/virtualbox6/include/X11/Xatom.h
Normal file
6
repos/ports/src/virtualbox6/include/X11/Xatom.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef _X11__XATOM_H_
|
||||
#define _X11__XATOM_H_
|
||||
|
||||
/* included but content not used */
|
||||
|
||||
#endif /* _X11__XATOM_H_ */
|
59
repos/ports/src/virtualbox6/include/X11/Xlib.h
Normal file
59
repos/ports/src/virtualbox6/include/X11/Xlib.h
Normal file
@ -0,0 +1,59 @@
|
||||
#ifndef _X11__XLIB_H_
|
||||
#define _X11__XLIB_H_
|
||||
|
||||
#include <X11/X.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define Bool int
|
||||
#define Status int
|
||||
#define True 1
|
||||
#define False 0
|
||||
|
||||
typedef struct { void *dummy; } Display;
|
||||
typedef struct { void *dummy; } Screen;
|
||||
typedef struct { void *dummy; } Visual;
|
||||
|
||||
typedef struct { unsigned char error_code; } XErrorEvent;
|
||||
|
||||
typedef union _XEvent {
|
||||
int type;
|
||||
XErrorEvent xerror;
|
||||
} XEvent;
|
||||
|
||||
typedef struct { Screen *screen; } XWindowAttributes;
|
||||
|
||||
typedef struct {
|
||||
unsigned long background_pixel;
|
||||
unsigned long border_pixel;
|
||||
long event_mask;
|
||||
Bool override_redirect;
|
||||
Colormap colormap;
|
||||
} XSetWindowAttributes;
|
||||
|
||||
typedef int (*XErrorHandler) (Display *, XErrorEvent *);
|
||||
|
||||
extern int XCloseDisplay(Display *);
|
||||
extern Colormap XCreateColormap(Display *, Window, Visual *, int);
|
||||
extern Window XCreateWindow( Display *, Window, int, int, unsigned int, unsigned int, unsigned int, int, unsigned int, Visual *, unsigned long, XSetWindowAttributes *);
|
||||
extern Window XDefaultRootWindow(Display *);
|
||||
extern int XDestroyWindow(Display *, Window);
|
||||
extern XErrorHandler XSetErrorHandler(XErrorHandler);
|
||||
extern int XFree(void *);
|
||||
extern Status XGetWindowAttributes(Display *, Window, XWindowAttributes *);
|
||||
extern int XMapWindow(Display *, Window);
|
||||
extern int XNextEvent(Display *, XEvent *);
|
||||
extern Display * XOpenDisplay(char *name);
|
||||
extern int XPending(Display *);
|
||||
extern int XScreenNumberOfScreen(Screen *);
|
||||
extern int XSync(Display *, Bool);
|
||||
|
||||
#define DefaultScreen(display) (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _X11__XLIB_H_ */
|
27
repos/ports/src/virtualbox6/include/X11/Xutil.h
Normal file
27
repos/ports/src/virtualbox6/include/X11/Xutil.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef _X11__XUTIL_H_
|
||||
#define _X11__XUTIL_H_
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
Visual *visual;
|
||||
VisualID visualid;
|
||||
int screen;
|
||||
int depth;
|
||||
unsigned long red_mask;
|
||||
unsigned long green_mask;
|
||||
unsigned long blue_mask;
|
||||
int colormap_size;
|
||||
int bits_per_rgb;
|
||||
} XVisualInfo;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _X11__XUTIL_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
Patch for DevAHCI model to really kick the consumer of requests (WiP)
|
||||
Patch for DevAHCI model to really kick the consumer of requests
|
||||
|
||||
+++ a/src/virtualbox6/src/VBox/Devices/Storage/DevAHCI.cpp
|
||||
+++ b/src/virtualbox6/src/VBox/Devices/Storage/DevAHCI.cpp
|
||||
|
12
repos/ports/src/virtualbox6/patches/devsvga.patch
Normal file
12
repos/ports/src/virtualbox6/patches/devsvga.patch
Normal file
@ -0,0 +1,12 @@
|
||||
Patch to RT_OS_LINUX in SVGA OpenGL layer
|
||||
|
||||
--- a/src/virtualbox6/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
|
||||
+++ b/src/virtualbox6/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
|
||||
@@ -47,6 +47,7 @@
|
||||
|
||||
#include "DevVGA-SVGA.h"
|
||||
#include "DevVGA-SVGA3d.h"
|
||||
+#define RT_OS_LINUX /* we have to force RT_OS_LINUX */
|
||||
#include "DevVGA-SVGA3d-internal.h"
|
||||
|
||||
#ifdef DUMP_SHADER_DISASSEMBLY
|
@ -8,3 +8,4 @@ smp_sipi.patch
|
||||
tm_poke.patch
|
||||
exec_state.patch
|
||||
rttimer.patch
|
||||
devsvga.patch
|
||||
|
@ -8,7 +8,7 @@ include $(REP_DIR)/lib/mk/virtualbox6-common.inc
|
||||
|
||||
CC_WARN += -Wall
|
||||
|
||||
SRC_CC := main.cc drivers.cc
|
||||
SRC_CC := main.cc drivers.cc glx_x11.cc
|
||||
SRC_CC += libc.cc unimpl.cc dummies.cc pdm.cc devices.cc nem.cc
|
||||
SRC_CC += pthread.cc network.cc devxhci.cc
|
||||
SRC_CC += sup.cc sup_sem.cc sup_gmm.cc sup_drv.cc sup_vm.cc sup_vcpu.cc sup_gim.cc
|
||||
@ -18,6 +18,7 @@ LIBS += base
|
||||
LIBS += stdcxx
|
||||
LIBS += libiconv
|
||||
LIBS += qemu-usb
|
||||
LIBS += mesa
|
||||
|
||||
CC_OPT_main = -Wno-multistatement-macros
|
||||
CC_OPT += -DProgress=ClientProgress
|
||||
|
Loading…
x
Reference in New Issue
Block a user