Allow seamless and pointer integration to be turned off
This commit is contained in:
parent
bd7cfc8749
commit
cdccc913ab
@ -158,6 +158,14 @@ int kmain() {
|
|||||||
"Downloads a userspace filesystem from a remote",
|
"Downloads a userspace filesystem from a remote",
|
||||||
"server and extracts it at boot.");
|
"server and extracts it at boot.");
|
||||||
|
|
||||||
|
BOOT_OPTION(_vboxrects, 0, "VirtualBox Seamless support",
|
||||||
|
"(Requires Guest Additions) Enables support for the",
|
||||||
|
"Seamless Desktop mode in VirtualBox.");
|
||||||
|
|
||||||
|
BOOT_OPTION(_vboxpointer, 1, "VirtualBox Pointer",
|
||||||
|
"(Requires Guest Additions) Enables support for the",
|
||||||
|
"VirtualBox hardware pointer mapping.");
|
||||||
|
|
||||||
#ifdef EFI_PLATFORM
|
#ifdef EFI_PLATFORM
|
||||||
BOOT_OPTION(_efilargest, 0, "Prefer largest mode.",
|
BOOT_OPTION(_efilargest, 0, "Prefer largest mode.",
|
||||||
"When using EFI mode setting, use the largest mode.",
|
"When using EFI mode setting, use the largest mode.",
|
||||||
@ -220,6 +228,14 @@ int kmain() {
|
|||||||
strcat(cmdline, DEBUG_SERIAL_CMDLINE);
|
strcat(cmdline, DEBUG_SERIAL_CMDLINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_vbox && !_vboxrects) {
|
||||||
|
strcat(cmdline, "novboxseamless ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_vbox && !_vboxpointer) {
|
||||||
|
strcat(cmdline, "novboxpointer ");
|
||||||
|
}
|
||||||
|
|
||||||
/* Configure modules */
|
/* Configure modules */
|
||||||
if (!_normal_ata) {
|
if (!_normal_ata) {
|
||||||
modules[6] = "NONE";
|
modules[6] = "NONE";
|
||||||
|
135
modules/vbox.c
135
modules/vbox.c
@ -129,7 +129,7 @@ static struct vbox_mouse * vbox_mg;
|
|||||||
static uint32_t vbox_phys_mouse_get;
|
static uint32_t vbox_phys_mouse_get;
|
||||||
static struct vbox_visibleregion * vbox_visibleregion;
|
static struct vbox_visibleregion * vbox_visibleregion;
|
||||||
static uint32_t vbox_phys_visibleregion;
|
static uint32_t vbox_phys_visibleregion;
|
||||||
static struct vbox_pointershape * vbox_pointershape;
|
static struct vbox_pointershape * vbox_pointershape = NULL;
|
||||||
static uint32_t vbox_phys_pointershape;
|
static uint32_t vbox_phys_pointershape;
|
||||||
|
|
||||||
static volatile uint32_t * vbox_vmmdev = 0;
|
static volatile uint32_t * vbox_vmmdev = 0;
|
||||||
@ -187,7 +187,7 @@ void vbox_set_log(void) {
|
|||||||
debug_file = &vb;
|
debug_file = &vb;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define VBOX_MOUSE_ON (1 << 0) | (1 << 4) | (1 << 2)
|
#define VBOX_MOUSE_ON (1 << 0) | (1 << 4)
|
||||||
#define VBOX_MOUSE_OFF (0)
|
#define VBOX_MOUSE_OFF (0)
|
||||||
|
|
||||||
static void mouse_on_off(unsigned int status) {
|
static void mouse_on_off(unsigned int status) {
|
||||||
@ -298,14 +298,6 @@ static int vbox_check(void) {
|
|||||||
|
|
||||||
vfs_mount("/dev/absmouse", mouse_pipe);
|
vfs_mount("/dev/absmouse", mouse_pipe);
|
||||||
|
|
||||||
rect_pipe = malloc(sizeof(fs_node_t));
|
|
||||||
memset(rect_pipe, 0, sizeof(fs_node_t));
|
|
||||||
rect_pipe->mask = 0666;
|
|
||||||
rect_pipe->flags = FS_CHARDEVICE;
|
|
||||||
rect_pipe->write = write_rectpipe;
|
|
||||||
|
|
||||||
vfs_mount("/dev/vboxrects", rect_pipe);
|
|
||||||
|
|
||||||
vbox_irq = pci_get_interrupt(vbox_device);
|
vbox_irq = pci_get_interrupt(vbox_device);
|
||||||
debug_print(WARNING, "(vbox) device IRQ is set to %d", vbox_irq);
|
debug_print(WARNING, "(vbox) device IRQ is set to %d", vbox_irq);
|
||||||
fprintf(&vb, "irq line is %d\n", vbox_irq);
|
fprintf(&vb, "irq line is %d\n", vbox_irq);
|
||||||
@ -331,7 +323,7 @@ static int vbox_check(void) {
|
|||||||
caps->header.rc = 0;
|
caps->header.rc = 0;
|
||||||
caps->header.reserved1 = 0;
|
caps->header.reserved1 = 0;
|
||||||
caps->header.reserved2 = 0;
|
caps->header.reserved2 = 0;
|
||||||
caps->caps = VMMCAP_Graphics | VMMCAP_SeamlessMode;
|
caps->caps = VMMCAP_Graphics | (args_present("novboxseamless") ? 0 : VMMCAP_SeamlessMode);
|
||||||
outportl(vbox_port, vbox_phys);
|
outportl(vbox_port, vbox_phys);
|
||||||
|
|
||||||
vbox_irq_ack = (void*)kvmalloc_p(0x1000, &vbox_phys_ack);
|
vbox_irq_ack = (void*)kvmalloc_p(0x1000, &vbox_phys_ack);
|
||||||
@ -368,70 +360,83 @@ static int vbox_check(void) {
|
|||||||
vbox_mg->header.reserved1 = 0;
|
vbox_mg->header.reserved1 = 0;
|
||||||
vbox_mg->header.reserved2 = 0;
|
vbox_mg->header.reserved2 = 0;
|
||||||
|
|
||||||
vbox_pointershape = (void*)kvmalloc_p(0x4000, &vbox_phys_pointershape);
|
if (!args_present("novboxpointer")) {
|
||||||
if (vbox_pointershape) {
|
vbox_pointershape = (void*)kvmalloc_p(0x4000, &vbox_phys_pointershape);
|
||||||
fprintf(&vb, "Got a valid set of pages to load up a cursor.\n");
|
|
||||||
vbox_pointershape->header.version = VBOX_REQUEST_HEADER_VERSION;
|
|
||||||
vbox_pointershape->header.requestType = VMM_SetPointerShape;
|
|
||||||
vbox_pointershape->header.rc = 0;
|
|
||||||
vbox_pointershape->header.reserved1 = 0;
|
|
||||||
vbox_pointershape->header.reserved2 = 0;
|
|
||||||
vbox_pointershape->flags = (1 << 0) | (1 << 1) | (1 << 2);
|
|
||||||
vbox_pointershape->xHot = 26;
|
|
||||||
vbox_pointershape->yHot = 26;
|
|
||||||
vbox_pointershape->width = 48;
|
|
||||||
vbox_pointershape->height = 48;
|
|
||||||
|
|
||||||
unsigned int mask_bytes = ((vbox_pointershape->width + 7) / 8) * vbox_pointershape->height;
|
if (vbox_pointershape) {
|
||||||
|
fprintf(&vb, "Got a valid set of pages to load up a cursor.\n");
|
||||||
|
vbox_pointershape->header.version = VBOX_REQUEST_HEADER_VERSION;
|
||||||
|
vbox_pointershape->header.requestType = VMM_SetPointerShape;
|
||||||
|
vbox_pointershape->header.rc = 0;
|
||||||
|
vbox_pointershape->header.reserved1 = 0;
|
||||||
|
vbox_pointershape->header.reserved2 = 0;
|
||||||
|
vbox_pointershape->flags = (1 << 0) | (1 << 1) | (1 << 2);
|
||||||
|
vbox_pointershape->xHot = 26;
|
||||||
|
vbox_pointershape->yHot = 26;
|
||||||
|
vbox_pointershape->width = 48;
|
||||||
|
vbox_pointershape->height = 48;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < mask_bytes; ++i) {
|
unsigned int mask_bytes = ((vbox_pointershape->width + 7) / 8) * vbox_pointershape->height;
|
||||||
vbox_pointershape->data[i] = 0x00;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (mask_bytes & 3) {
|
for (uint32_t i = 0; i < mask_bytes; ++i) {
|
||||||
mask_bytes++;
|
vbox_pointershape->data[i] = 0x00;
|
||||||
}
|
}
|
||||||
int base = mask_bytes;
|
|
||||||
fprintf(&vb, "mask_bytes = %d\n", mask_bytes);
|
|
||||||
|
|
||||||
vbox_pointershape->header.size = sizeof(struct vbox_pointershape) + (48*48*4)+mask_bytes; /* update later */
|
while (mask_bytes & 3) {
|
||||||
|
mask_bytes++;
|
||||||
|
}
|
||||||
|
int base = mask_bytes;
|
||||||
|
fprintf(&vb, "mask_bytes = %d\n", mask_bytes);
|
||||||
|
|
||||||
for (int i = 0; i < 48 * 48; ++i) {
|
vbox_pointershape->header.size = sizeof(struct vbox_pointershape) + (48*48*4)+mask_bytes; /* update later */
|
||||||
vbox_pointershape->data[base+i*4] = 0x00; /* blue */
|
|
||||||
vbox_pointershape->data[base+i*4+1] = 0x00; /* red */
|
|
||||||
vbox_pointershape->data[base+i*4+2] = 0x00; /* green */
|
|
||||||
vbox_pointershape->data[base+i*4+3] = 0x00; /* alpha */
|
|
||||||
}
|
|
||||||
outportl(vbox_port, vbox_phys_pointershape);
|
|
||||||
|
|
||||||
if (vbox_pointershape->header.rc < 0) {
|
for (int i = 0; i < 48 * 48; ++i) {
|
||||||
fprintf(&vb, "Bad response code: -%d\n", -vbox_pointershape->header.rc);
|
vbox_pointershape->data[base+i*4] = 0x00; /* blue */
|
||||||
} else {
|
vbox_pointershape->data[base+i*4+1] = 0x00; /* red */
|
||||||
/* Success, let's install the device file */
|
vbox_pointershape->data[base+i*4+2] = 0x00; /* green */
|
||||||
fprintf(&vb, "Successfully initialized cursor, going to allow compositor to set it.\n");
|
vbox_pointershape->data[base+i*4+3] = 0x00; /* alpha */
|
||||||
pointer_pipe = malloc(sizeof(fs_node_t));
|
}
|
||||||
memset(pointer_pipe, 0, sizeof(fs_node_t));
|
outportl(vbox_port, vbox_phys_pointershape);
|
||||||
pointer_pipe->mask = 0666;
|
|
||||||
pointer_pipe->flags = FS_CHARDEVICE;
|
|
||||||
pointer_pipe->write = write_pointer;
|
|
||||||
|
|
||||||
vfs_mount("/dev/vboxpointer", pointer_pipe);
|
if (vbox_pointershape->header.rc < 0) {
|
||||||
|
fprintf(&vb, "Bad response code: -%d\n", -vbox_pointershape->header.rc);
|
||||||
|
} else {
|
||||||
|
/* Success, let's install the device file */
|
||||||
|
fprintf(&vb, "Successfully initialized cursor, going to allow compositor to set it.\n");
|
||||||
|
pointer_pipe = malloc(sizeof(fs_node_t));
|
||||||
|
memset(pointer_pipe, 0, sizeof(fs_node_t));
|
||||||
|
pointer_pipe->mask = 0666;
|
||||||
|
pointer_pipe->flags = FS_CHARDEVICE;
|
||||||
|
pointer_pipe->write = write_pointer;
|
||||||
|
|
||||||
|
vfs_mount("/dev/vboxpointer", pointer_pipe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vbox_visibleregion = (void*)kvmalloc_p(0x1000, &vbox_phys_visibleregion);
|
if (!args_present("novboxseamless")) {
|
||||||
vbox_visibleregion->header.size = sizeof(struct vbox_header) + sizeof(uint32_t) + sizeof(int32_t) * 4; /* TODO + more for additional rects? */
|
vbox_visibleregion = (void*)kvmalloc_p(0x1000, &vbox_phys_visibleregion);
|
||||||
vbox_visibleregion->header.version = VBOX_REQUEST_HEADER_VERSION;
|
vbox_visibleregion->header.size = sizeof(struct vbox_header) + sizeof(uint32_t) + sizeof(int32_t) * 4; /* TODO + more for additional rects? */
|
||||||
vbox_visibleregion->header.requestType = VMM_VideoSetVisibleRegion;
|
vbox_visibleregion->header.version = VBOX_REQUEST_HEADER_VERSION;
|
||||||
vbox_visibleregion->header.rc = 0;
|
vbox_visibleregion->header.requestType = VMM_VideoSetVisibleRegion;
|
||||||
vbox_visibleregion->header.reserved1 = 0;
|
vbox_visibleregion->header.rc = 0;
|
||||||
vbox_visibleregion->header.reserved2 = 0;
|
vbox_visibleregion->header.reserved1 = 0;
|
||||||
vbox_visibleregion->count = 1;
|
vbox_visibleregion->header.reserved2 = 0;
|
||||||
vbox_visibleregion->rect[0].xLeft = 0;
|
vbox_visibleregion->count = 1;
|
||||||
vbox_visibleregion->rect[0].yTop = 0;
|
vbox_visibleregion->rect[0].xLeft = 0;
|
||||||
vbox_visibleregion->rect[0].xRight = 1440;
|
vbox_visibleregion->rect[0].yTop = 0;
|
||||||
vbox_visibleregion->rect[0].yBottom = 900;
|
vbox_visibleregion->rect[0].xRight = 1440;
|
||||||
outportl(vbox_port, vbox_phys_visibleregion);
|
vbox_visibleregion->rect[0].yBottom = 900;
|
||||||
|
outportl(vbox_port, vbox_phys_visibleregion);
|
||||||
|
|
||||||
|
rect_pipe = malloc(sizeof(fs_node_t));
|
||||||
|
memset(rect_pipe, 0, sizeof(fs_node_t));
|
||||||
|
rect_pipe->mask = 0666;
|
||||||
|
rect_pipe->flags = FS_CHARDEVICE;
|
||||||
|
rect_pipe->write = write_rectpipe;
|
||||||
|
|
||||||
|
vfs_mount("/dev/vboxrects", rect_pipe);
|
||||||
|
}
|
||||||
|
|
||||||
/* device memory region mapping? */
|
/* device memory region mapping? */
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user