diff options
Diffstat (limited to 'src/VBox/Additions/linux/drm')
19 files changed, 487 insertions, 1198 deletions
diff --git a/src/VBox/Additions/linux/drm/Makefile.kmk b/src/VBox/Additions/linux/drm/Makefile.kmk index 4b1da745..e95b0f7b 100644 --- a/src/VBox/Additions/linux/drm/Makefile.kmk +++ b/src/VBox/Additions/linux/drm/Makefile.kmk @@ -39,46 +39,57 @@ vboxvideo_drm-mod_EXEC_SOURCES = \ # The kernel module. # # Note! Syntax checking only. Don't bother if drmP.h is missing (introduced -# in 2.6.27). +# in 2.6.27). For the mode-setting driver make sure this is supported. # Note! The DEBUG_HASH* stuff is for CONFIG_DYNAMIC_DEBUG-enabled kernels. # -if defined(VBOX_WITH_ADDITION_DRIVERS) \ - && "$(strip $(foreach inc,$(VBOX_LINUX_INCS),$(wildcard $(inc)/drm/drmP.h)))" != "" - SYSMODS += vboxvideo_drm - vboxvideo_drm_TEMPLATE = VBOXGUESTR0 - vboxvideo_drm_CFLAGS = -fshort-wchar - vboxvideo_drm_DEFS = \ - MODULE IN_RT_R0 VBOXGUEST VBOX_WITH_HGCM \ - KBUILD_MODNAME=KBUILD_STR\(vboxvideo\) \ - KBUILD_BASENAME=KBUILD_STR\(vboxvideo\) \ - DEBUG_HASH=2 DEBUG_HASH2=3 - # detect fc6 2.6.18 - vboxvideo_drm_DEFS += \ - $(foreach inc,$(VBOX_LINUX_INCS),\ - $(if $(wildcard $(inc)/linux/utsrelease.h),\ - $(if $(shell if grep -q '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h;\ - then echo yes; fi),KERNEL_FC6,),)) - # detect rhel5 2.6.18 - vboxvideo_drm_DEFS += \ - $(foreach inc,$(VBOX_LINUX_INCS),\ - $(if $(wildcard $(inc)/linux/utsrelease.h),\ - $(if $(shell if grep -q '"2.6.18.*el5.*"' $(inc)/linux/utsrelease.h;\ - then echo yes; fi),KERNEL_FC6,),)) +if defined(VBOX_WITH_ADDITION_DRIVERS) if !defined(VBOX_WITH_GUEST_KMS_DRIVER) - vboxvideo_drm_SOURCES = vboxvideo_drm.c + if "$(strip $(foreach inc,$(VBOX_LINUX_INCS),$(wildcard $(inc)/drm/drmP.h)))" != "" + SYSMODS += vboxvideo_drm + endif else - vboxvideo_drm_INCS += ../../../Runtime/r0drv/linux - vboxvideo_drm_SOURCES = \ - ../../common/VBoxVideo/Modesetting.cpp \ - vboxvideo_crtc.c \ - vboxvideo_dac.c \ - vboxvideo_device.c \ - vboxvideo_display.c \ - vboxvideo_drv.c \ - vboxvideo_kms.c \ - vboxvideo_vga.c + if "$(shell grep -s 'DRIVER_MODESET' $(foreach inc,$(VBOX_LINUX_INCS),$(inc)/drm/drmP.h))" != "" + SYSMODS += vboxvideo_drm + endif endif +endif +vboxvideo_drm_TEMPLATE = VBOXGUESTR0 +vboxvideo_drm_CFLAGS = -fshort-wchar +vboxvideo_drm_DEFS = \ + MODULE IN_RT_R0 VBOXGUEST VBOX_WITH_HGCM \ + KBUILD_MODNAME=KBUILD_STR\(vboxvideo\) \ + KBUILD_BASENAME=KBUILD_STR\(vboxvideo\) \ + DEBUG_HASH=2 DEBUG_HASH2=3 +# detect fc6 2.6.18 +vboxvideo_drm_DEFS += \ + $(foreach inc,$(VBOX_LINUX_INCS),\ + $(if $(wildcard $(inc)/linux/utsrelease.h),\ + $(if $(shell if grep -q '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h;\ + then echo yes; fi),KERNEL_FC6,),)) +# detect rhel5 2.6.18 +vboxvideo_drm_DEFS += \ + $(foreach inc,$(VBOX_LINUX_INCS),\ + $(if $(wildcard $(inc)/linux/utsrelease.h),\ + $(if $(shell if grep -q '"2.6.18.*el5.*"' $(inc)/linux/utsrelease.h;\ + then echo yes; fi),KERNEL_FC6,),)) +if !defined(VBOX_WITH_GUEST_KMS_DRIVER) + vboxvideo_drm_SOURCES = vboxvideo_drm.c +else + vboxvideo_drm_INCS += \ + ../../../Runtime/include \ + ../../../Runtime/r0drv/linux + vboxvideo_drm_SOURCES = \ + ../../common/VBoxVideo/HGSMIBase.cpp \ + ../../common/VBoxVideo/Modesetting.cpp \ + ../../common/VBoxVideo/VBVABase.cpp \ + ../../../GuestHost/HGSMI/HGSMICommon.cpp \ + ../../../Runtime/common/alloc/heapoffset.cpp \ + vbox_drv.c \ + vbox_fb.c \ + vbox_main.c \ + vbox_mode.c \ + vbox_ttm.c endif include $(FILE_KBUILD_SUB_FOOTER) diff --git a/src/VBox/Additions/linux/drm/Makefile.module b/src/VBox/Additions/linux/drm/Makefile.module index c382be7b..58daaefa 100644 --- a/src/VBox/Additions/linux/drm/Makefile.module +++ b/src/VBox/Additions/linux/drm/Makefile.module @@ -3,7 +3,7 @@ # # (For 2.6.x this file must be 'Makefile'!) # -# Copyright (C) 2006-2010 Oracle Corporation +# Copyright (C) 2006-2011 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; @@ -31,6 +31,12 @@ MOD_CFLAGS = -fshort-wchar -include $(MANGLING) MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux) # What on earth is this? MOD_INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxvideo,/ /include /r0drv/linux) +# Enterprise Linux 6.5 does not include the drm user API headers with the kernel +# headers. +MOD_INCL += $(foreach inc,$(KERN_INCL) include,\ + $(if $(wildcard $(inc)/linux/utsrelease.h),\ + $(if $(shell grep '"2.6.32.*el6.*"' $(inc)/linux/utsrelease.h),\ + -I/usr/include,),)) MOD_DEFS := -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \ -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DLOG_TO_BACKDOOR -DIN_MODULE \ -DIN_GUEST_R0 diff --git a/src/VBox/Additions/linux/drm/Makefile.module.kms b/src/VBox/Additions/linux/drm/Makefile.module.kms index 8d0a3628..80cbd984 100644 --- a/src/VBox/Additions/linux/drm/Makefile.module.kms +++ b/src/VBox/Additions/linux/drm/Makefile.module.kms @@ -20,8 +20,8 @@ include $(obj)/Makefile.include.header MOD_NAME = vboxvideo -MOD_OBJS = Modesetting.o vboxvideo_crtc.o vboxvideo_dac.o vboxvideo_device.o \ - vboxvideo_display.o vboxvideo_drv.o vboxvideo_kms.o vboxvideo_vga.o +MOD_OBJS = HGSMIBase.o HGSMICommon.o heapoffset.o Modesetting.o vbox_drv.o \ + vbox_fb.o vbox_main.o vbox_mode.o vbox_ttm.o VBVABase.o ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxvideo),) MANGLING := $(KBUILD_EXTMOD)/vboxvideo/include/VBox/VBoxGuestMangling.h @@ -29,9 +29,10 @@ else MANGLING := $(KBUILD_EXTMOD)/include/VBox/VBoxGuestMangling.h endif MOD_CFLAGS = -fshort-wchar -include $(MANGLING) -MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux) +MOD_INCL = $(addprefix -I$(KBUILD_EXTMOD),/ /include) # What on earth is this? -MOD_INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxvideo,/ /include /r0drv/linux) +MOD_INCL += $(addprefix -I$(KBUILD_EXTMOD)/vboxvideo,/ /include) +MOD_INCL += -Iinclude/drm MOD_DEFS := -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \ -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DLOG_TO_BACKDOOR -DIN_MODULE \ -DIN_GUEST_R0 diff --git a/src/VBox/Additions/linux/drm/files_vboxvideo_drm b/src/VBox/Additions/linux/drm/files_vboxvideo_drm index 9f18c86f..2a652de4 100755 --- a/src/VBox/Additions/linux/drm/files_vboxvideo_drm +++ b/src/VBox/Additions/linux/drm/files_vboxvideo_drm @@ -5,7 +5,7 @@ # # -# Copyright (C) 2007-2010 Oracle Corporation +# Copyright (C) 2007-2011 Oracle Corporation # # This file is part of VirtualBox Open Source Edition (OSE), as # available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/linux/drm/files_vboxvideo_drv b/src/VBox/Additions/linux/drm/files_vboxvideo_drv index 181d1148..67b6c4e0 100755 --- a/src/VBox/Additions/linux/drm/files_vboxvideo_drv +++ b/src/VBox/Additions/linux/drm/files_vboxvideo_drv @@ -24,14 +24,17 @@ FILES_VBOXVIDEO_DRM_NOBIN=" \ ${PATH_ROOT}/include/iprt/assert.h=>include/iprt/assert.h \ ${PATH_ROOT}/include/iprt/cdefs.h=>include/iprt/cdefs.h \ ${PATH_ROOT}/include/iprt/err.h=>include/iprt/err.h \ + ${PATH_ROOT}/include/iprt/heap.h=>include/iprt/heap.h \ ${PATH_ROOT}/include/iprt/log.h=>include/iprt/log.h \ ${PATH_ROOT}/include/iprt/param.h=>include/iprt/param.h \ ${PATH_ROOT}/include/iprt/stdarg.h=>include/iprt/stdarg.h \ ${PATH_ROOT}/include/iprt/stdint.h=>include/iprt/stdint.h \ + ${PATH_ROOT}/include/iprt/string.h=>include/iprt/string.h \ ${PATH_ROOT}/include/iprt/types.h=>include/iprt/types.h \ ${PATH_ROOT}/include/iprt/mangling.h=>include/iprt/mangling.h \ ${PATH_ROOT}/include/VBox/cdefs.h=>include/VBox/cdefs.h \ ${PATH_ROOT}/include/VBox/err.h=>include/VBox/err.h \ + ${PATH_ROOT}/include/VBox/log.h=>include/VBox/log.h \ ${PATH_ROOT}/include/VBox/ostypes.h=>include/VBox/ostypes.h \ ${PATH_ROOT}/include/VBox/param.h=>include/VBox/param.h \ ${PATH_ROOT}/include/VBox/types.h=>include/VBox/types.h \ @@ -46,18 +49,20 @@ FILES_VBOXVIDEO_DRM_NOBIN=" \ ${PATH_ROOT}/include/VBox/HGSMI/HGSMIChannels.h=>include/VBox/HGSMI/HGSMIChannels.h \ ${PATH_ROOT}/include/VBox/HGSMI/HGSMIChSetup.h=>include/VBox/HGSMI/HGSMIChSetup.h \ ${PATH_ROOT}/include/VBox/Hardware/VBoxVideoVBE.h=>include/VBox/Hardware/VBoxVideoVBE.h \ + ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp=>HGSMIBase.c \ ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp=>Modesetting.c \ - ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo.h=>vboxvideo.h \ - ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_crtc.c=>vboxvideo_crtc.c \ - ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_dac.c=>vboxvideo_dac.c \ - ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_device.c=>vboxvideo_device.c \ - ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_display.c=>vboxvideo_display.c \ - ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_drv.c=>vboxvideo_drv.c \ - ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_drv.h=>vboxvideo_drv.h \ - ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_kms.c=>vboxvideo_kms.c \ - ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_mode.h=>vboxvideo_mode.h \ - ${PATH_ROOT}/src/VBox/Additions/linux/drm/vboxvideo_vga.c=>vboxvideo_vga.c \ - ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h=>r0drv/linux/the-linux-kernel.h \ + ${PATH_ROOT}/src/VBox/Additions/common/VBoxVideo/VBVABase.cpp=>VBVABase.c \ + ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.c=>vbox_drv.c \ + ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.h=>vbox_drv.h \ + ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_fb.c=>vbox_fb.c \ + ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_main.c=>vbox_main.c \ + ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_mode.c=>vbox_mode.c \ + ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_ttm.c=>vbox_ttm.c \ + ${PATH_ROOT}/src/VBox/GuestHost/HGSMI/HGSMICommon.cpp=>HGSMICommon.c \ + ${PATH_ROOT}/src/VBox/Runtime/common/alloc/heapoffset.cpp=>heapoffset.c \ + ${PATH_ROOT}/src/VBox/Runtime/include/internal/iprt.h=>include/internal/iprt.h \ + ${PATH_ROOT}/src/VBox/Runtime/include/internal/magics.h=>include/internal/magics.h \ + ${PATH_ROOT}/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h=>include/the-linux-kernel.h \ ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.header=>Makefile.include.header \ ${PATH_ROOT}/src/VBox/Installer/linux/Makefile.include.footer=>Makefile.include.footer \ ${PATH_ROOT}/src/VBox/Additions/linux/drm/Makefile.module.kms=>Makefile \ diff --git a/src/VBox/Additions/linux/drm/vbox_drv.c b/src/VBox/Additions/linux/drm/vbox_drv.c new file mode 100644 index 00000000..df7997f0 --- /dev/null +++ b/src/VBox/Additions/linux/drm/vbox_drv.c @@ -0,0 +1,151 @@ +/** @file $Id: vbox_drv.c $ + * + * VirtualBox Additions Linux kernel video driver + */ + +/* + * Copyright (C) 2013 Oracle Corporation + * + * This file is part of VirtualBox Open Source Edition (OSE), as + * available from http://www.virtualbox.org. This file is free software; + * you can redistribute it and/or modify it under the terms of the GNU + * General Public License (GPL) as published by the Free Software + * Foundation, in version 2 as it comes in the "COPYING" file of the + * VirtualBox OSE distribution. VirtualBox OSE is distributed in the + * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. + * -------------------------------------------------------------------- + * + * This code is based on + * ast_drv.c + * with the following copyright and permission notice: + * + * Copyright 2012 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + */ +/* + * Authors: Dave Airlie <airlied@redhat.com> + */ +#include "vbox_drv.h" + +#include <linux/module.h> +#include <linux/console.h> + +#include <drm/drmP.h> +#include <drm/drm_crtc_helper.h> + +int vbox_modeset = -1; + +MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); +module_param_named(modeset, vbox_modeset, int, 0400); + +static struct drm_driver driver; + +static DEFINE_PCI_DEVICE_TABLE(pciidlist) = { + {0x80ee, 0xbeef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + {0, 0, 0}, +}; + +MODULE_DEVICE_TABLE(pci, pciidlist); + +static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) +{ + return drm_get_pci_dev(pdev, ent, &driver); +} + + +static void +vbox_pci_remove(struct pci_dev *pdev) +{ + struct drm_device *dev = pci_get_drvdata(pdev); + + drm_put_dev(dev); +} + + +static struct pci_driver vbox_pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + .probe = vbox_pci_probe, + .remove = vbox_pci_remove, +}; + +static const struct file_operations vbox_fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, + .unlocked_ioctl = drm_ioctl, + .mmap = vbox_mmap, + .poll = drm_poll, + .fasync = drm_fasync, +#ifdef CONFIG_COMPAT + .compat_ioctl = drm_compat_ioctl, +#endif + .read = drm_read, +}; + +static struct drm_driver driver = { + .driver_features = DRIVER_USE_MTRR | DRIVER_MODESET | DRIVER_GEM, + .dev_priv_size = 0, + + .load = vbox_driver_load, + .unload = vbox_driver_unload, + + .fops = &vbox_fops, + .name = DRIVER_NAME, + .desc = DRIVER_DESC, + .date = DRIVER_DATE, + .major = DRIVER_MAJOR, + .minor = DRIVER_MINOR, + .patchlevel = DRIVER_PATCHLEVEL, + + .gem_init_object = vbox_gem_init_object, + .gem_free_object = vbox_gem_free_object, + .dumb_create = vbox_dumb_create, + .dumb_map_offset = vbox_dumb_mmap_offset, + .dumb_destroy = vbox_dumb_destroy, + +}; + +static int __init vbox_init(void) +{ +#ifdef CONFIG_VGA_CONSOLE + if (vgacon_text_force() && vbox_modeset == -1) + return -EINVAL; +#endif + + if (vbox_modeset == 0) + return -EINVAL; + return drm_pci_init(&driver, &vbox_pci_driver); +} +static void __exit vbox_exit(void) +{ + drm_pci_exit(&driver, &vbox_pci_driver); +} + +module_init(vbox_init); +module_exit(vbox_exit); + +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL and additional rights"); + diff --git a/src/VBox/Additions/linux/drm/vbox_drv.h b/src/VBox/Additions/linux/drm/vbox_drv.h new file mode 100644 index 00000000..523710c5 --- /dev/null +++ b/src/VBox/Additions/linux/drm/vbox_drv.h @@ -0,0 +1,226 @@ +/** @file $Id: vbox_drv.h $ + * + * VirtualBox Additions Linux kernel video driver + */ + +/* + * Copyright (C) 2013 Oracle Corporation + * + * This file is part of VirtualBox Open Source Edition (OSE), as + * available from http://www.virtualbox.org. This file is free software; + * you can redistribute it and/or modify it under the terms of the GNU + * General Public License (GPL) as published by the Free Software + * Foundation, in version 2 as it comes in the "COPYING" file of the + * VirtualBox OSE distribution. VirtualBox OSE is distributed in the + * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. + * -------------------------------------------------------------------- + * + * This code is based on + * ast_drv.h + * with the following copyright and permission notice: + * + * Copyright 2012 Red Hat Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + */ +/* + * Authors: Dave Airlie <airlied@redhat.com> + */ +#ifndef __VBOX_DRV_H__ +#define __VBOX_DRV_H__ + +#include <VBox/VBoxVideoGuest.h> + +#include "the-linux-kernel.h" + +#include <drm/drmP.h> +#include <drm/drm_fb_helper.h> + +#include <drm/ttm/ttm_bo_api.h> +#include <drm/ttm/ttm_bo_driver.h> +#include <drm/ttm/ttm_placement.h> +#include <drm/ttm/ttm_memory.h> +#include <drm/ttm/ttm_module.h> + +/* #include "vboxvideo.h" */ + +#include "product-generated.h" + +#define DRIVER_AUTHOR VBOX_VENDOR + +#define DRIVER_NAME "vboxvideo" +#define DRIVER_DESC VBOX_PRODUCT " Graphics Card" +#define DRIVER_DATE "20130823" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 + +struct vbox_fbdev; + +struct vbox_private { + struct drm_device *dev; + + void __iomem *vram; + HGSMIGUESTCOMMANDCONTEXT Ctx; + struct VBVABUFFERCONTEXT *paVBVACtx; + bool fAnyX; + unsigned cCrtcs; + bool vga2_clone; + uint32_t vram_size; + + struct vbox_fbdev *fbdev; + + int fb_mtrr; + + struct { + struct drm_global_reference mem_global_ref; + struct ttm_bo_global_ref bo_global_ref; + struct ttm_bo_device bdev; + } ttm; + + struct drm_gem_object *cursor_cache; + uint64_t cursor_cache_gpu_addr; + struct ttm_bo_kmap_obj cache_kmap; + int next_cursor; +}; + +int vbox_driver_load(struct drm_device *dev, unsigned long flags); +int vbox_driver_unload(struct drm_device *dev); + +struct vbox_gem_object; + +struct vbox_connector { + struct drm_connector base; +}; + +struct vbox_crtc { + struct drm_crtc base; + bool fBlanked; + unsigned crtc_id; + struct drm_gem_object *cursor_bo; + uint64_t cursor_addr; + int cursor_width, cursor_height; + u8 offset_x, offset_y; +}; + +struct vbox_encoder { + struct drm_encoder base; +}; + +struct vbox_framebuffer { + struct drm_framebuffer base; + struct drm_gem_object *obj; + uint64_t offBase; +}; + +struct vbox_fbdev { + struct drm_fb_helper helper; + struct vbox_framebuffer afb; + struct list_head fbdev_list; + void *sysram; + int size; + struct ttm_bo_kmap_obj mapping; + int x1, y1, x2, y2; /* dirty rect */ + spinlock_t dirty_lock; +}; + +#define to_vbox_crtc(x) container_of(x, struct vbox_crtc, base) +#define to_vbox_connector(x) container_of(x, struct vbox_connector, base) +#define to_vbox_encoder(x) container_of(x, struct vbox_encoder, base) +#define to_vbox_framebuffer(x) container_of(x, struct vbox_framebuffer, base) + +extern int vbox_mode_init(struct drm_device *dev); +extern void vbox_mode_fini(struct drm_device *dev); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) +# define DRM_MODE_FB_CMD drm_mode_fb_cmd +#else +# define DRM_MODE_FB_CMD drm_mode_fb_cmd2 +#endif + +int vbox_framebuffer_init(struct drm_device *dev, + struct vbox_framebuffer *vbox_fb, + struct DRM_MODE_FB_CMD *mode_cmd, + struct drm_gem_object *obj); + +int vbox_fbdev_init(struct drm_device *dev); +void vbox_fbdev_fini(struct drm_device *dev); +void vbox_fbdev_set_suspend(struct drm_device *dev, int state); + +struct vbox_bo { + struct ttm_buffer_object bo; + struct ttm_placement placement; + struct ttm_bo_kmap_obj kmap; + struct drm_gem_object gem; + u32 placements[3]; + int pin_count; +}; +#define gem_to_vbox_bo(gobj) container_of((gobj), struct vbox_bo, gem) + +static inline struct vbox_bo * +vbox_bo(struct ttm_buffer_object *bo) +{ + return container_of(bo, struct vbox_bo, bo); +} + + +#define to_vbox_obj(x) container_of(x, struct vbox_gem_object, base) + +extern int vbox_dumb_create(struct drm_file *file, + struct drm_device *dev, + struct drm_mode_create_dumb *args); +extern int vbox_dumb_destroy(struct drm_file *file, + struct drm_device *dev, + uint32_t handle); + +extern int vbox_gem_init_object(struct drm_gem_object *obj); +extern void vbox_gem_free_object(struct drm_gem_object *obj); +extern int vbox_dumb_mmap_offset(struct drm_file *file, + struct drm_device *dev, + uint32_t handle, + uint64_t *offset); + +#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) + +int vbox_mm_init(struct vbox_private *vbox); +void vbox_mm_fini(struct vbox_private *vbox); + +int vbox_bo_create(struct drm_device *dev, int size, int align, + uint32_t flags, struct vbox_bo **pvboxbo); + +int vbox_gem_create(struct drm_device *dev, + u32 size, bool iskernel, + struct drm_gem_object **obj); + +int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr); +int vbox_bo_unpin(struct vbox_bo *bo); + +int vbox_bo_reserve(struct vbox_bo *bo, bool no_wait); +void vbox_bo_unreserve(struct vbox_bo *bo); +void vbox_ttm_placement(struct vbox_bo *bo, int domain); +int vbox_bo_push_sysram(struct vbox_bo *bo); +int vbox_mmap(struct file *filp, struct vm_area_struct *vma); + +/* vbox post */ +void vbox_post_gpu(struct drm_device *dev); +#endif diff --git a/src/VBox/Additions/linux/drm/vboxvideo.h b/src/VBox/Additions/linux/drm/vboxvideo.h deleted file mode 100644 index 907b70e7..00000000 --- a/src/VBox/Additions/linux/drm/vboxvideo.h +++ /dev/null @@ -1,73 +0,0 @@ -/** @file $Id: vboxvideo.h $ - * - * VirtualBox Additions Linux kernel video driver - */ - -/* - * Copyright (C) 2011 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * -------------------------------------------------------------------- - * - * This code is based on - * glint.h - * with the following copyright and permission notice: - * - * Copyright 2010 Matt Turner. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Matt Turner - */ - -#ifndef __DRM_VBOXVIDEO_H__ -#define __DRM_VBOXVIDEO_H__ - -#include "vboxvideo_mode.h" -#include "drm/drmP.h" - -struct vboxvideo_mc -{ - resource_size_t aper_size; - resource_size_t aper_base; - u32 vram_size; -}; - -struct vboxvideo_device -{ - struct device *dev; - struct drm_device *ddev; - struct pci_dev *pdev; - unsigned long flags; - /** @todo move this into flags */ - bool fAnyX; - - struct vboxvideo_mc mc; - struct vboxvideo_mode_info mode_info; - - int num_crtc; -}; - -#endif /* __DRM_VBOXVIDEO_H__ */ diff --git a/src/VBox/Additions/linux/drm/vboxvideo_crtc.c b/src/VBox/Additions/linux/drm/vboxvideo_crtc.c deleted file mode 100644 index aa4c2742..00000000 --- a/src/VBox/Additions/linux/drm/vboxvideo_crtc.c +++ /dev/null @@ -1,188 +0,0 @@ -/** @file $Id: vboxvideo_crtc.c $ - * - * VirtualBox Additions Linux kernel video driver, KMS support - */ - -/* - * Copyright (C) 2011 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * -------------------------------------------------------------------- - * - * This code is based on - * glint_crtc.c - * with the following copyright and permission notice: - * - * Copyright 2010 Matt Turner. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Matt Turner - */ - -#include <linux/version.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) - -#include <VBox/VBoxVideoGuest.h> - -#include "vboxvideo_drv.h" - -#include "drm/drm_crtc_helper.h" - -static void vboxvideo_crtc_dpms(struct drm_crtc *crtc, int mode) -{ - struct vboxvideo_crtc *vboxvideo_crtc = to_vboxvideo_crtc(crtc); - struct drm_device *dev = crtc->dev; - struct vboxvideo_device *gdev = dev->dev_private; - - if (mode == vboxvideo_crtc->last_dpms) /* Don't do unnecesary mode changes. */ - return; - - vboxvideo_crtc->last_dpms = mode; - - switch (mode) { - case DRM_MODE_DPMS_STANDBY: - case DRM_MODE_DPMS_SUSPEND: - case DRM_MODE_DPMS_OFF: - vboxvideo_crtc->enabled = false; - break; - case DRM_MODE_DPMS_ON: - vboxvideo_crtc->enabled = true; - break; - } -} - -static bool vboxvideo_crtc_mode_fixup(struct drm_crtc *crtc, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - return true; -} - -static int vboxvideo_crtc_mode_set(struct drm_crtc *crtc, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode, - int x, int y, struct drm_framebuffer *old_fb) -{ - /* - struct vboxvideo_crtc *vboxvideo_crtc = to_vboxvideo_crtc(crtc); - - vboxvideo_crtc_set_base(crtc, x, y, old_fb); - vboxvideo_set_crtc_timing(crtc, adjusted_mode); - vboxvideo_set_pll(crtc, adjusted_mode); - */ - return 0; -} - -static void vboxvideo_crtc_prepare(struct drm_crtc *crtc) -{ - struct drm_device *dev = crtc->dev; - struct drm_crtc *crtci; - - /* - list_for_each_entry(crtci, &dev->mode_config.crtc_list, head) - vboxvideo_crtc_dpms(crtci, DRM_MODE_DPMS_OFF); - */ -} - -static void vboxvideo_crtc_commit(struct drm_crtc *crtc) -{ - struct drm_device *dev = crtc->dev; - struct drm_crtc *crtci; - - /* - list_for_each_entry(crtci, &dev->mode_config.crtc_list, head) { - if (crtci->enabled) - vboxvideo_crtc_dpms(crtci, DRM_MODE_DPMS_ON); - } - */ -} - -static void vboxvideo_crtc_load_lut(struct drm_crtc *crtc) -{ - /* Dummy */ -} - -static void vboxvideo_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, - u16 *green, u16 *blue, uint32_t size) -{ - /* Dummy */ -} - -static void vboxvideo_crtc_destroy(struct drm_crtc *crtc) -{ - struct vboxvideo_crtc *vboxvideo_crtc = to_vboxvideo_crtc(crtc); - - drm_crtc_cleanup(crtc); - kfree(vboxvideo_crtc); -} - -static const struct drm_crtc_funcs vboxvideo_crtc_funcs = { - /* - .cursor_set = vboxvideo_crtc_cursor_set, - .cursor_move = vboxvideo_crtc_cursor_move, - */ - .cursor_set = NULL, - .cursor_move = NULL, - .gamma_set = vboxvideo_crtc_gamma_set, - .set_config = drm_crtc_helper_set_config, - .destroy = vboxvideo_crtc_destroy, -}; - -static const struct drm_crtc_helper_funcs vboxvideo_helper_funcs = { - .dpms = vboxvideo_crtc_dpms, - .mode_fixup = vboxvideo_crtc_mode_fixup, - .mode_set = vboxvideo_crtc_mode_set, - /* - .mode_set_base = vboxvideo_crtc_set_base, - */ - .prepare = vboxvideo_crtc_prepare, - .commit = vboxvideo_crtc_commit, - .load_lut = vboxvideo_crtc_load_lut, -}; - -void vboxvideo_crtc_init(struct drm_device *dev, int index) -{ - struct vboxvideo_device *gdev = dev->dev_private; - struct vboxvideo_crtc *vboxvideo_crtc; - int i; - - vboxvideo_crtc = kzalloc( sizeof(struct vboxvideo_crtc) - + (VBOXVIDEOFB_CONN_LIMIT - * sizeof(struct drm_connector *)), - GFP_KERNEL); - if (vboxvideo_crtc == NULL) - return; - - drm_crtc_init(dev, &vboxvideo_crtc->base, &vboxvideo_crtc_funcs); - - vboxvideo_crtc->crtc_id = index; - vboxvideo_crtc->last_dpms = VBOXVIDEO_DPMS_CLEARED; - gdev->mode_info.crtcs[index] = vboxvideo_crtc; - - drm_crtc_helper_add(&vboxvideo_crtc->base, &vboxvideo_helper_funcs); -} - -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ diff --git a/src/VBox/Additions/linux/drm/vboxvideo_dac.c b/src/VBox/Additions/linux/drm/vboxvideo_dac.c deleted file mode 100644 index 94e1e700..00000000 --- a/src/VBox/Additions/linux/drm/vboxvideo_dac.c +++ /dev/null @@ -1,137 +0,0 @@ -/** @file $Id: vboxvideo_dac.c $ - * - * VirtualBox Additions Linux kernel video driver, DAC functions - */ - -/* - * Copyright (C) 2011 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * -------------------------------------------------------------------- - * - * This code is based on - * glint_dac.c - * with the following copyright and permission notice: - * - * Copyright 2010 Matt Turner. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Matt Turner - */ - -#include <linux/version.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) - -#include "vboxvideo_drv.h" - -#include "drm/drm_crtc_helper.h" - -static void vboxvideo_dac_dpms(struct drm_encoder *encoder, int mode) -{ - struct drm_device *dev = encoder->dev; - struct vboxvideo_device *gdev = dev->dev_private; - struct vboxvideo_encoder *vboxvideo_encoder = to_vboxvideo_encoder(encoder); - - if (mode == vboxvideo_encoder->last_dpms) /* Don't do unnecesary mode changes. */ - return; - - vboxvideo_encoder->last_dpms = mode; - - switch (mode) { - case DRM_MODE_DPMS_STANDBY: - case DRM_MODE_DPMS_SUSPEND: - case DRM_MODE_DPMS_OFF: - /* Do nothing for now */ - break; - case DRM_MODE_DPMS_ON: - /* Do nothing for now */ - break; - } -} - -static bool vboxvideo_dac_mode_fixup(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - return true; -} - -static void vboxvideo_dac_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - -} - -static void vboxvideo_dac_prepare(struct drm_encoder *encoder) -{ - -} - -static void vboxvideo_dac_commit(struct drm_encoder *encoder) -{ - -} - -void vboxvideo_encoder_destroy(struct drm_encoder *encoder) -{ - struct vboxvideo_encoder *vboxvideo_encoder = to_vboxvideo_encoder(encoder); - drm_encoder_cleanup(encoder); - kfree(vboxvideo_encoder); -} - -static const struct drm_encoder_helper_funcs vboxvideo_dac_helper_funcs = { - .dpms = vboxvideo_dac_dpms, - .mode_fixup = vboxvideo_dac_mode_fixup, - .mode_set = vboxvideo_dac_mode_set, - .prepare = vboxvideo_dac_prepare, - .commit = vboxvideo_dac_commit, -}; - -static const struct drm_encoder_funcs vboxvideo_dac_encoder_funcs = { - .destroy = vboxvideo_encoder_destroy, -}; - -struct drm_encoder *vboxvideo_dac_init(struct drm_device *dev) -{ - struct drm_encoder *encoder; - struct vboxvideo_encoder *vboxvideo_encoder; - - vboxvideo_encoder = kzalloc(sizeof(struct vboxvideo_encoder), GFP_KERNEL); - if (!vboxvideo_encoder) - return NULL; - - vboxvideo_encoder->last_dpms = VBOXVIDEO_DPMS_CLEARED; - encoder = &vboxvideo_encoder->base; - encoder->possible_crtcs = 0x1; - - drm_encoder_init(dev, encoder, &vboxvideo_dac_encoder_funcs, DRM_MODE_ENCODER_DAC); - drm_encoder_helper_add(encoder, &vboxvideo_dac_helper_funcs); - - return encoder; -} - -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ diff --git a/src/VBox/Additions/linux/drm/vboxvideo_device.c b/src/VBox/Additions/linux/drm/vboxvideo_device.c deleted file mode 100644 index e23d4774..00000000 --- a/src/VBox/Additions/linux/drm/vboxvideo_device.c +++ /dev/null @@ -1,79 +0,0 @@ -/** @file $Id: vboxvideo_device.c $ - * - * VirtualBox Additions Linux kernel video driver - */ - -/* - * Copyright (C) 2011 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * -------------------------------------------------------------------- - * - * This code is based on - * vboxvideo_device.c - * with the following copyright and permission notice: - * - * Copyright 2010 Matt Turner. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Matt Turner - */ - -#include <linux/version.h> - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) - -#include "the-linux-kernel.h" - -#include "vboxvideo_drv.h" - -#include <VBox/VBoxVideoGuest.h> - -int vboxvideo_device_init(struct vboxvideo_device *gdev, - struct drm_device *ddev, - struct pci_dev *pdev, - uint32_t flags) -{ - gdev->dev = &pdev->dev; - gdev->ddev = ddev; - gdev->pdev = pdev; - gdev->flags = flags; - gdev->num_crtc = 1; - - /** @todo hardware initialisation goes here once we start doing more complex - * stuff. - */ - gdev->fAnyX = VBoxVideoAnyWidthAllowed(); - gdev->mc.vram_size = VBoxVideoGetVRAMSize(); - - return 0; -} - -void vboxvideo_device_fini(struct vboxvideo_device *gdev) -{ - -} -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ diff --git a/src/VBox/Additions/linux/drm/vboxvideo_display.c b/src/VBox/Additions/linux/drm/vboxvideo_display.c deleted file mode 100644 index 16294aba..00000000 --- a/src/VBox/Additions/linux/drm/vboxvideo_display.c +++ /dev/null @@ -1,93 +0,0 @@ -/** @file $Id: vboxvideo_display.c $ - * - * VirtualBox Additions Linux kernel video driver - */ - -/* - * Copyright (C) 2011 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * -------------------------------------------------------------------- - * - * This code is based on - * vboxvideo_device.c - * with the following copyright and permission notice: - * - * Copyright 2010 Matt Turner. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Matt Turner - */ - -#include <linux/version.h> - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) - -#include "vboxvideo_drv.h" - -int vboxvideo_modeset_init(struct vboxvideo_device *gdev) -{ - struct drm_encoder *encoder; - struct drm_connector *connector; - int i; - - drm_mode_config_init(gdev->ddev); - gdev->mode_info.mode_config_initialized = true; - - gdev->ddev->mode_config.max_width = VBOXVIDEO_MAX_FB_WIDTH; - gdev->ddev->mode_config.max_height = VBOXVIDEO_MAX_FB_HEIGHT; - - gdev->ddev->mode_config.fb_base = gdev->mc.aper_base; - - /* allocate crtcs */ - for (i = 0; i < gdev->num_crtc; i++) - { - vboxvideo_crtc_init(gdev->ddev, i); - } - - encoder = vboxvideo_dac_init(gdev->ddev); - if (!encoder) { - VBOXVIDEO_ERROR("vboxvideo_dac_init failed\n"); - return -1; - } - - connector = vboxvideo_vga_init(gdev->ddev); - if (!connector) { - VBOXVIDEO_ERROR("vboxvideo_vga_init failed\n"); - return -1; - } - return 0; -} - -void vboxvideo_modeset_fini(struct vboxvideo_device *gdev) -{ - if (gdev->mode_info.mode_config_initialized) - { - drm_mode_config_cleanup(gdev->ddev); - gdev->mode_info.mode_config_initialized = false; - } -} -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ diff --git a/src/VBox/Additions/linux/drm/vboxvideo_drm.c b/src/VBox/Additions/linux/drm/vboxvideo_drm.c index 02c23183..37b9df7e 100644 --- a/src/VBox/Additions/linux/drm/vboxvideo_drm.c +++ b/src/VBox/Additions/linux/drm/vboxvideo_drm.c @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -64,11 +64,14 @@ # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) # ifdef RHEL_RELEASE_CODE -# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,1) +# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 1) # define DRM_RHEL61 # endif -# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,3) -# define DRM_RHEL63 +# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 3) +# define DRM_FOPS_AS_POINTER +# endif +# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4) +# define DRM_NO_RECLAIM_BUFFERS # endif # endif # endif @@ -76,10 +79,30 @@ #include "drm/drmP.h" #include "vboxvideo_drm.h" +# ifndef RHEL_RELEASE_CODE +# if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 39) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) +# if defined(DRM_MODE_OBJECT_PLANE) && defined(DRM_IOCTL_MODE_ADDFB2) +# define DRM_FOPS_AS_POINTER +# endif +# endif +# endif + +#ifdef CONFIG_SUSE_KERNEL +/* This is to cover the SLES 11 SP3 kernel back-ports. */ +# if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,61) +# if LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0) +# define DRM_FOPS_AS_POINTER +# define DRM_NO_RECLAIM_BUFFERS +# endif +# endif +#endif + static struct pci_device_id pciidlist[] = { vboxvideo_PCI_IDS }; +MODULE_DEVICE_TABLE(pci, pciidlist); + int vboxvideo_driver_load(struct drm_device * dev, unsigned long flags) { # if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) @@ -88,7 +111,7 @@ int vboxvideo_driver_load(struct drm_device * dev, unsigned long flags) return 0; #endif } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_RHEL63) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_FOPS_AS_POINTER) /* since linux-3.3.0-rc1 drm_driver::fops is pointer */ static struct file_operations driver_fops = { @@ -98,7 +121,6 @@ static struct file_operations driver_fops = .unlocked_ioctl = drm_ioctl, .mmap = drm_mmap, .poll = drm_poll, - .fasync = drm_fasync, }; #endif @@ -106,7 +128,7 @@ static struct drm_driver driver = { /* .driver_features = DRIVER_USE_MTRR, */ .load = vboxvideo_driver_load, -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) && !defined(DRM_NO_RECLAIM_BUFFERS) .reclaim_buffers = drm_core_reclaim_buffers, #endif /* As of Linux 2.6.37, always the internal functions are used. */ @@ -114,7 +136,7 @@ static struct drm_driver driver = .get_map_ofs = drm_core_get_map_ofs, .get_reg_ofs = drm_core_get_reg_ofs, #endif -# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && !defined(DRM_RHEL63) +# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && !defined(DRM_FOPS_AS_POINTER) .fops = { .owner = THIS_MODULE, @@ -129,12 +151,11 @@ static struct drm_driver driver = #endif .mmap = drm_mmap, .poll = drm_poll, - .fasync = drm_fasync, }, -#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_RHEL63) */ +#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0) || defined(DRM_FOPS_AS_POINTER) */ .fops = &driver_fops, #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && !defined(DRM_RHEL61) +#ifndef DRIVER_BUS_PCI .pci_driver = { .name = DRIVER_NAME, @@ -149,7 +170,7 @@ static struct drm_driver driver = .patchlevel = DRIVER_PATCHLEVEL, }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) || defined(DRM_RHEL61) +#ifdef DRIVER_BUS_PCI static struct pci_driver pci_driver = { .name = DRIVER_NAME, @@ -159,7 +180,7 @@ static struct pci_driver pci_driver = static int __init vboxvideo_init(void) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && !defined(DRM_RHEL61) +#ifndef DRIVER_BUS_PCI return drm_init(&driver); #else return drm_pci_init(&driver, &pci_driver); @@ -168,7 +189,7 @@ static int __init vboxvideo_init(void) static void __exit vboxvideo_exit(void) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && !defined(DRM_RHEL61) +#ifndef DRIVER_BUS_PCI drm_exit(&driver); #else drm_pci_exit(&driver, &pci_driver); diff --git a/src/VBox/Additions/linux/drm/vboxvideo_drm.h b/src/VBox/Additions/linux/drm/vboxvideo_drm.h index 0613a9d2..11407e94 100644 --- a/src/VBox/Additions/linux/drm/vboxvideo_drm.h +++ b/src/VBox/Additions/linux/drm/vboxvideo_drm.h @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2010 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Additions/linux/drm/vboxvideo_drv.c b/src/VBox/Additions/linux/drm/vboxvideo_drv.c deleted file mode 100644 index c5df61ce..00000000 --- a/src/VBox/Additions/linux/drm/vboxvideo_drv.c +++ /dev/null @@ -1,148 +0,0 @@ -/** @file $Id: vboxvideo_drv.c $ - * - * VirtualBox Additions Linux kernel video driver - */ - -/* - * Copyright (C) 2011 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * -------------------------------------------------------------------- - * - * This code is based on - * glint_drv.c - * with the following copyright and permission notice: - * - * Copyright 2010 Matt Turner. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Matt Turner - */ - -#include <linux/version.h> -#include <linux/module.h> -#include "version-generated.h" - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) - -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32) -# ifdef RHEL_RELEASE_CODE -# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,1) -# define DRM_RHEL61 -# endif -# endif -# endif - -#include "vboxvideo_drv.h" - -static struct pci_device_id pciidlist[] = { - vboxvideo_PCI_IDS -}; - -static struct drm_driver driver = -{ - .driver_features = 0, - .load = vboxvideo_driver_load, - .unload = vboxvideo_driver_unload, - .reclaim_buffers = drm_core_reclaim_buffers, - /* As of Linux 2.6.37, always the internal functions are used. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37) && !defined(DRM_RHEL61) - .get_map_ofs = drm_core_get_map_ofs, - .get_reg_ofs = drm_core_get_reg_ofs, -#endif - .ioctls = vboxvideo_ioctls, - .fops = - { - .owner = THIS_MODULE, - .open = drm_open, - .release = drm_release, - /* This was changed with Linux 2.6.33 but Fedora backported this - * change to their 2.6.32 kernel. */ -#if defined(DRM_UNLOCKED) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) - .unlocked_ioctl = drm_ioctl, -#else - .ioctl = drm_ioctl, -#endif - .mmap = drm_mmap, - .poll = drm_poll, - .fasync = drm_fasync, - }, -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) - .pci_driver = - { - .name = DRIVER_NAME, - .id_table = pciidlist, - }, -#endif - .name = DRIVER_NAME, - .desc = DRIVER_DESC, - .date = DRIVER_DATE, - .major = DRIVER_MAJOR, - .minor = DRIVER_MINOR, - .patchlevel = DRIVER_PATCHLEVEL, -}; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) -static struct pci_driver pci_driver = -{ - .name = DRIVER_NAME, - .id_table = pciidlist, -}; -#endif - -static int __init vboxvideo_init(void) -{ - printk(KERN_INFO "vboxvideo initializing\n"); - driver.num_ioctls = vboxvideo_max_ioctl; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) - return drm_init(&driver); -#else - return drm_pci_init(&driver, &pci_driver); -#endif -} - -static void __exit vboxvideo_exit(void) -{ - printk(KERN_INFO "vboxvideo exiting\n"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) - drm_exit(&driver); -#else - drm_pci_exit(&driver, &pci_driver); -#endif -} - -module_init(vboxvideo_init); -module_exit(vboxvideo_exit); - -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); - -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ - -#ifdef MODULE_VERSION -MODULE_VERSION(VBOX_VERSION_STRING); -#endif -MODULE_LICENSE("GPL and additional rights"); diff --git a/src/VBox/Additions/linux/drm/vboxvideo_drv.h b/src/VBox/Additions/linux/drm/vboxvideo_drv.h deleted file mode 100644 index 7cbd5f5a..00000000 --- a/src/VBox/Additions/linux/drm/vboxvideo_drv.h +++ /dev/null @@ -1,101 +0,0 @@ -/** @file $Id: vboxvideo_drv.h $ - * - * VirtualBox Additions Linux kernel video driver - */ - -/* - * Copyright (C) 2011 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * -------------------------------------------------------------------- - * - * This code is based on - * glint_drv.h - * with the following copyright and permission notice: - * - * Copyright 2010 Matt Turner. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Matt Turner - */ - -#ifndef __DRM_VBOXVIDEO_DRV_H__ -#define __DRM_VBOXVIDEO_DRV_H__ - -/* General customization: - */ - -#include "vboxvideo.h" - -#include "product-generated.h" - -#define DRIVER_AUTHOR VBOX_VENDOR - -#define DRIVER_NAME "vboxvideo" -#define DRIVER_DESC VBOX_PRODUCT " Graphics Card" -#define DRIVER_DATE "20090303" - -#define DRIVER_MAJOR 1 -#define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 0 - -#define VBOXVIDEO_INFO(fmt, arg...) DRM_INFO(DRIVER_NAME ": " fmt, ##arg) -#define VBOXVIDEO_ERROR(fmt, arg...) DRM_ERROR(DRIVER_NAME ": " fmt, ##arg) - -/** @todo does this make sense? What exactly is this connector? */ -#define VBOXVIDEOFB_CONN_LIMIT VBOX_VIDEO_MAX_SCREENS - -/* vboxvideo_crtc.c */ -void vboxvideo_crtc_init(struct drm_device *dev, int index); - -/* vboxvideo_dac.c */ -struct drm_encoder *vboxvideo_dac_init(struct drm_device *dev); - -/* vboxvideo_device.c */ -int vboxvideo_device_init(struct vboxvideo_device *gdev, - struct drm_device *ddev, - struct pci_dev *pdev, - uint32_t flags); -void vboxvideo_device_fini(struct vboxvideo_device *gdev); - -/* vboxvideo_display.c */ -int vboxvideo_modeset_init(struct vboxvideo_device *gdev); -void vboxvideo_modeset_fini(struct vboxvideo_device *gdev); - -/* vboxvideo_kms.c */ -int vboxvideo_driver_load(struct drm_device *dev, unsigned long flags); -int vboxvideo_driver_unload(struct drm_device *dev); -extern struct drm_ioctl_desc vboxvideo_ioctls[]; -extern int vboxvideo_max_ioctl; - -/* vboxvideo_vga.c */ -struct drm_connector *vboxvideo_vga_init(struct drm_device *dev); - -#define vboxvideo_PCI_IDS \ - {0x80ee, 0xbeef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ - {0, 0, 0} - -#endif /* __DRM_VBOXVIDEO_DRV_H__ */ diff --git a/src/VBox/Additions/linux/drm/vboxvideo_kms.c b/src/VBox/Additions/linux/drm/vboxvideo_kms.c deleted file mode 100644 index 1fe68efe..00000000 --- a/src/VBox/Additions/linux/drm/vboxvideo_kms.c +++ /dev/null @@ -1,100 +0,0 @@ -/** @file $Id: vboxvideo_kms.c $ - * - * VirtualBox Additions Linux kernel video driver, KMS support - */ - -/* - * Copyright (C) 2011 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * -------------------------------------------------------------------- - * - * This code is based on - * glint_kms.c - * with the following copyright and permission notice: - * - * Copyright 2010 Matt Turner. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Matt Turner - */ - -#include <linux/version.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) - -#include "vboxvideo_drv.h" - -int vboxvideo_driver_load(struct drm_device * dev, unsigned long flags) -{ - struct vboxvideo_device *gdev; - int r; - - gdev = kzalloc(sizeof(struct vboxvideo_device), GFP_KERNEL); - if (gdev == NULL) { - return -ENOMEM; - } - dev->dev_private = (void *)gdev; - - r = vboxvideo_device_init(gdev, dev, dev->pdev, flags); - if (r) { - dev_err(&dev->pdev->dev, "Fatal error during GPU init\n"); - goto out; - } - - r = vboxvideo_modeset_init(gdev); - if (r) { - dev_err(&dev->pdev->dev, "Fatal error during modeset init\n"); - goto out; - } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) - r = drm_vblank_init(dev, 1); - if (r) - dev_err(&dev->pdev->dev, "Fatal error during vblank init\n"); -#endif -out: - if (r) - vboxvideo_driver_unload(dev); - return r; -} - -int vboxvideo_driver_unload(struct drm_device * dev) -{ - struct vboxvideo_device *gdev = dev->dev_private; - - if (gdev == NULL) - return 0; - vboxvideo_modeset_fini(gdev); - vboxvideo_device_fini(gdev); - kfree(gdev); - dev->dev_private = NULL; - return 0; -} - -struct drm_ioctl_desc vboxvideo_ioctls[] = { -}; -int vboxvideo_max_ioctl = DRM_ARRAY_SIZE(vboxvideo_ioctls); - -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ diff --git a/src/VBox/Additions/linux/drm/vboxvideo_mode.h b/src/VBox/Additions/linux/drm/vboxvideo_mode.h deleted file mode 100644 index 5480a4c4..00000000 --- a/src/VBox/Additions/linux/drm/vboxvideo_mode.h +++ /dev/null @@ -1,83 +0,0 @@ -/** @file $Id: vboxvideo_mode.h $ - * - * VirtualBox Additions Linux kernel video driver - */ - -/* - * Copyright (C) 2011 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * -------------------------------------------------------------------- - * - * This code is based on - * glint_mode.h - * with the following copyright and permission notice: - * - * Copyright 2010 Matt Turner. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Matt Turner - */ - -#ifndef __DRM_VBOXVIDEO_MODE_H__ -#define __DRM_VBOXVIDEO_MODE_H__ - -#include <VBox/Hardware/VBoxVideoVBE.h> -#include "drm/drmP.h" - -#define VBOXVIDEO_MAX_FB_HEIGHT VBE_DISPI_MAX_YRES -#define VBOXVIDEO_MAX_FB_WIDTH VBE_DISPI_MAX_XRES - -#define to_vboxvideo_crtc(x) container_of(x, struct vboxvideo_crtc, base) -#define to_vboxvideo_encoder(x) container_of(x, struct vboxvideo_encoder, base) - -#define VBOXVIDEO_DPMS_CLEARED (-1) - -struct vboxvideo_crtc -{ - struct drm_crtc base; - int crtc_id; - int last_dpms; - bool enabled; -}; - -struct vboxvideo_mode_info -{ - bool mode_config_initialized; - struct vboxvideo_crtc *crtcs[VBOX_VIDEO_MAX_SCREENS]; -}; - -struct vboxvideo_encoder -{ - struct drm_encoder base; - int last_dpms; -}; - -struct vboxvideo_connector { - struct drm_connector base; -}; - -#endif /* __DRM_VBOXVIDEO_H__ */ diff --git a/src/VBox/Additions/linux/drm/vboxvideo_vga.c b/src/VBox/Additions/linux/drm/vboxvideo_vga.c deleted file mode 100644 index a8717b2f..00000000 --- a/src/VBox/Additions/linux/drm/vboxvideo_vga.c +++ /dev/null @@ -1,130 +0,0 @@ -/** @file $Id: vboxvideo_vga.c $ - * - * VirtualBox Additions Linux kernel video driver, VGA functions - */ - -/* - * Copyright (C) 2011 Oracle Corporation - * - * This file is part of VirtualBox Open Source Edition (OSE), as - * available from http://www.virtualbox.org. This file is free software; - * you can redistribute it and/or modify it under the terms of the GNU - * General Public License (GPL) as published by the Free Software - * Foundation, in version 2 as it comes in the "COPYING" file of the - * VirtualBox OSE distribution. VirtualBox OSE is distributed in the - * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. - * -------------------------------------------------------------------- - * - * This code is based on - * glint_vga.c - * with the following copyright and permission notice: - * - * Copyright 2010 Matt Turner. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: Matt Turner - */ - -#include <linux/version.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) - -#include "vboxvideo_drv.h" -#include "drm/drm_crtc_helper.h" - -static int vboxvideo_vga_get_modes(struct drm_connector *connector) -{ - /* return 0 modes, so that we don't have to implement DDC/I2C yet. */ - return 0; -} - -static int vboxvideo_vga_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) -{ - /* XXX check mode bandwidth */ - /* XXX verify against max DAC output frequency */ - return MODE_OK; -} - -struct drm_encoder *vboxvideo_connector_best_encoder(struct drm_connector - *connector) -{ - int enc_id = connector->encoder_ids[0]; - struct drm_mode_object *obj; - struct drm_encoder *encoder; - - /* pick the encoder ids */ - if (enc_id) { - obj = drm_mode_object_find(connector->dev, enc_id, DRM_MODE_OBJECT_ENCODER); - if (!obj) - return NULL; - encoder = obj_to_encoder(obj); - return encoder; - } - return NULL; -} - -static enum drm_connector_status vboxvideo_vga_detect(struct drm_connector - *connector) -{ - return connector_status_connected; -} - -static void vboxvideo_connector_destroy(struct drm_connector *connector) -{ - drm_connector_cleanup(connector); - kfree(connector); -} - -struct drm_connector_helper_funcs vboxvideo_vga_connector_helper_funcs = -{ - .get_modes = vboxvideo_vga_get_modes, - .mode_valid = vboxvideo_vga_mode_valid, - .best_encoder = vboxvideo_connector_best_encoder, -}; - -struct drm_connector_funcs vboxvideo_vga_connector_funcs = -{ - .dpms = drm_helper_connector_dpms, - .detect = vboxvideo_vga_detect, - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = vboxvideo_connector_destroy, -}; - -struct drm_connector *vboxvideo_vga_init(struct drm_device *dev) -{ - struct drm_connector *connector; - struct vboxvideo_connector *vboxvideo_connector; - - vboxvideo_connector = kzalloc(sizeof(struct vboxvideo_connector), - GFP_KERNEL); - if (!vboxvideo_connector) - return NULL; - - connector = &vboxvideo_connector->base; - - drm_connector_init(dev, connector, - &vboxvideo_vga_connector_funcs, DRM_MODE_CONNECTOR_VGA); - - drm_connector_helper_add(connector, &vboxvideo_vga_connector_helper_funcs); - - return connector; -} - -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ |