mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
hw/display/milkymist-tmu2: Move inlined code from header to source
Move the complexity of milkymist_tmu2_create() into the source file. Doing so we avoid to include the X11/OpenGL headers in all LM32 devices, and we also avoid the duplicate declaration of glx_fbconfig_attr[] (it is already declared in hw/display/milkymist-tmu2.c). Since TYPE_MILKYMIST_TMU2 is now accessible, use it. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20190130120005.23123-5-philmd@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
57d434407a
commit
70cc0c1fb0
5 changed files with 92 additions and 63 deletions
|
@ -88,69 +88,6 @@ static inline DeviceState *milkymist_pfpu_create(hwaddr base,
|
|||
return dev;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_X11) && defined(CONFIG_OPENGL)
|
||||
#include <X11/Xlib.h>
|
||||
#include <epoxy/gl.h>
|
||||
#include <epoxy/glx.h>
|
||||
static const int glx_fbconfig_attr[] = {
|
||||
GLX_GREEN_SIZE, 5,
|
||||
GLX_GREEN_SIZE, 6,
|
||||
GLX_BLUE_SIZE, 5,
|
||||
None
|
||||
};
|
||||
#endif
|
||||
|
||||
static inline DeviceState *milkymist_tmu2_create(hwaddr base,
|
||||
qemu_irq irq)
|
||||
{
|
||||
#if defined(CONFIG_X11) && defined(CONFIG_OPENGL)
|
||||
DeviceState *dev;
|
||||
Display *d;
|
||||
GLXFBConfig *configs;
|
||||
int nelements;
|
||||
int ver_major, ver_minor;
|
||||
|
||||
/* check that GLX will work */
|
||||
d = XOpenDisplay(NULL);
|
||||
if (d == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!glXQueryVersion(d, &ver_major, &ver_minor)) {
|
||||
/* Yeah, sometimes getting the GLX version can fail.
|
||||
* Isn't X beautiful? */
|
||||
XCloseDisplay(d);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((ver_major < 1) || ((ver_major == 1) && (ver_minor < 3))) {
|
||||
printf("Your GLX version is %d.%d,"
|
||||
"but TMU emulation needs at least 1.3. TMU disabled.\n",
|
||||
ver_major, ver_minor);
|
||||
XCloseDisplay(d);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
configs = glXChooseFBConfig(d, 0, glx_fbconfig_attr, &nelements);
|
||||
if (configs == NULL) {
|
||||
XCloseDisplay(d);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
XFree(configs);
|
||||
XCloseDisplay(d);
|
||||
|
||||
dev = qdev_create(NULL, "milkymist-tmu2");
|
||||
qdev_init_nofail(dev);
|
||||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq);
|
||||
|
||||
return dev;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline DeviceState *milkymist_ac97_create(hwaddr base,
|
||||
qemu_irq crrequest_irq, qemu_irq crreply_irq, qemu_irq dmar_irq,
|
||||
qemu_irq dmaw_irq)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue