Changeset 47417 in vbox
- Timestamp:
- Jul 26, 2013 8:36:22 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 87567
- Location:
- trunk/src/VBox/Additions/linux/drm
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/Makefile.kmk
r41477 r47417 40 40 # 41 41 # Note! Syntax checking only. Don't bother if drmP.h is missing (introduced 42 # in 2.6.27). 42 # in 2.6.27). For the mode-setting driver make sure this is supported. 43 43 # Note! The DEBUG_HASH* stuff is for CONFIG_DYNAMIC_DEBUG-enabled kernels. 44 44 # 45 if defined(VBOX_WITH_ADDITION_DRIVERS) \ 46 && "$(strip $(foreach inc,$(VBOX_LINUX_INCS),$(wildcard $(inc)/drm/drmP.h)))" != "" 47 SYSMODS += vboxvideo_drm 48 vboxvideo_drm_TEMPLATE = VBOXGUESTR0 49 vboxvideo_drm_CFLAGS = -fshort-wchar 50 vboxvideo_drm_DEFS = \ 51 MODULE IN_RT_R0 VBOXGUEST VBOX_WITH_HGCM \ 52 KBUILD_MODNAME=KBUILD_STR\(vboxvideo\) \ 45 if defined(VBOX_WITH_ADDITION_DRIVERS) 46 if !defined(VBOX_WITH_GUEST_KMS_DRIVER) 47 if "$(strip $(foreach inc,$(VBOX_LINUX_INCS),$(wildcard $(inc)/drm/drmP.h)))" != "" 48 SYSMODS += vboxvideo_drm 49 endif 50 else 51 if "$(shell grep -s 'DRIVER_MODESET' $(foreach inc,$(VBOX_LINUX_INCS),$(inc)/drm/drmP.h))" != "" 52 SYSMODS += vboxvideo_drm 53 endif 54 endif 55 endif 56 57 vboxvideo_drm_TEMPLATE = VBOXGUESTR0 58 vboxvideo_drm_CFLAGS = -fshort-wchar 59 vboxvideo_drm_DEFS = \ 60 MODULE IN_RT_R0 VBOXGUEST VBOX_WITH_HGCM \ 61 KBUILD_MODNAME=KBUILD_STR\(vboxvideo\) \ 53 62 KBUILD_BASENAME=KBUILD_STR\(vboxvideo\) \ 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 vboxvideo_kms.c \79 vboxvideo_vga.c80 endif81 63 DEBUG_HASH=2 DEBUG_HASH2=3 64 # detect fc6 2.6.18 65 vboxvideo_drm_DEFS += \ 66 $(foreach inc,$(VBOX_LINUX_INCS),\ 67 $(if $(wildcard $(inc)/linux/utsrelease.h),\ 68 $(if $(shell if grep -q '"2.6.18.*fc6.*"' $(inc)/linux/utsrelease.h;\ 69 then echo yes; fi),KERNEL_FC6,),)) 70 # detect rhel5 2.6.18 71 vboxvideo_drm_DEFS += \ 72 $(foreach inc,$(VBOX_LINUX_INCS),\ 73 $(if $(wildcard $(inc)/linux/utsrelease.h),\ 74 $(if $(shell if grep -q '"2.6.18.*el5.*"' $(inc)/linux/utsrelease.h;\ 75 then echo yes; fi),KERNEL_FC6,),)) 76 if !defined(VBOX_WITH_GUEST_KMS_DRIVER) 77 vboxvideo_drm_SOURCES = vboxvideo_drm.c 78 else 79 vboxvideo_drm_INCS += ../../../Runtime/r0drv/linux 80 vboxvideo_drm_SOURCES = \ 81 ../../common/VBoxVideo/Modesetting.cpp \ 82 vboxvideo_crtc.c \ 83 vboxvideo_dac.c \ 84 vboxvideo_device.c \ 85 vboxvideo_display.c \ 86 vboxvideo_drv.c \ 87 vboxvideo_fbdev.c \ 88 vboxvideo_framebuffer.c \ 89 vboxvideo_kms.c \ 90 vboxvideo_vga.c 82 91 endif 83 92 -
trunk/src/VBox/Additions/linux/drm/Makefile.module.kms
r43113 r47417 22 22 23 23 MOD_OBJS = Modesetting.o vboxvideo_crtc.o vboxvideo_dac.o vboxvideo_device.o \ 24 vboxvideo_display.o vboxvideo_drv.o vboxvideo_kms.o vboxvideo_vga.o 24 vboxvideo_display.o vboxvideo_drv.o vboxvideo_fbdev.o \ 25 vboxvideo_framebuffer.o vboxvideo_kms.o vboxvideo_vga.o 25 26 26 27 ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxvideo),) -
trunk/src/VBox/Additions/linux/drm/vboxvideo.h
r47388 r47417 51 51 struct vboxvideo_mc 52 52 { 53 resource_size_t aper_size; 54 resource_size_t aper_base; 55 char __iomem *vram; 56 u32 vram_size; 53 resource_size_t vram_size; 54 resource_size_t vram_base; 57 55 }; 58 56 … … 66 64 bool fAnyX; 67 65 66 drm_local_map_t *framebuffer; 67 68 68 struct vboxvideo_mc mc; 69 69 struct vboxvideo_mode_info mode_info; -
trunk/src/VBox/Additions/linux/drm/vboxvideo_crtc.c
r47341 r47417 44 44 45 45 #include <linux/version.h> 46 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)47 46 48 47 #include <VBox/VBoxVideoGuest.h> … … 194 193 } 195 194 196 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ 195 /** Sets the color ramps on behalf of fbcon */ 196 void vboxvideo_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 197 u16 blue, int regno) 198 { 199 200 } 201 202 /** Gets the color ramps on behalf of fbcon */ 203 void vboxvideo_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 204 u16 *blue, int regno) 205 { 206 207 } -
trunk/src/VBox/Additions/linux/drm/vboxvideo_dac.c
r47341 r47417 44 44 45 45 #include <linux/version.h> 46 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)47 46 48 47 #include "vboxvideo_drv.h" … … 138 137 return encoder; 139 138 } 140 141 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ -
trunk/src/VBox/Additions/linux/drm/vboxvideo_device.c
r47388 r47417 45 45 #include <linux/version.h> 46 46 47 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)48 49 47 #include "the-linux-kernel.h" 50 48 … … 55 53 static int vboxvideo_vram_init(struct vboxvideo_device *gdev) 56 54 { 57 /* work out accessible VRAM */ 58 gdev->mc.aper_base = pci_resource_start(gdev->ddev->pdev, 1); 59 gdev->mc.aper_size = pci_resource_len(gdev->ddev->pdev, 1); 55 unsigned size; 56 int ret; 60 57 61 gdev->mc.vram = ioremap(gdev->mc.aper_base, gdev->mc.aper_size); 62 if (!gdev->mc.vram) { 63 VBOXVIDEO_ERROR("Unable to ioremap %lu MB of VRAM. Bailing out.\n", (unsigned long)gdev->mc.aper_size / MB); 64 return -1; 65 } 58 /* set accessible VRAM */ 59 gdev->mc.vram_base = pci_resource_start(gdev->ddev->pdev, 1); 60 gdev->mc.vram_size = pci_resource_len(gdev->ddev->pdev, 1); 61 66 62 gdev->fAnyX = VBoxVideoAnyWidthAllowed(); 67 63 gdev->mc.vram_size = VBoxVideoGetVRAMSize(); 68 64 65 if (!request_region(gdev->mc.vram_base, gdev->mc.vram_size, "vboxvideofb_vram")) { 66 VBOXVIDEO_ERROR("can't region_reserve VRAM\n"); 67 return -ENXIO; 68 } 69 70 ret = drm_addmap(gdev->ddev, gdev->mc.vram_base, gdev->mc.vram_size, 71 _DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, 72 &gdev->framebuffer); 69 73 return 0; 70 74 } … … 72 76 static void vboxvideo_vram_fini(struct vboxvideo_device *gdev) 73 77 { 74 iounmap(gdev->mc.vram); 75 gdev->mc.vram = NULL; 78 if (gdev->framebuffer) 79 drm_rmmap(gdev->ddev, gdev->framebuffer); 80 if (gdev->mc.vram_base) 81 release_region(gdev->mc.vram_base, gdev->mc.vram_size); 76 82 } 77 83 … … 103 109 vboxvideo_vram_fini(gdev); 104 110 } 105 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ -
trunk/src/VBox/Additions/linux/drm/vboxvideo_display.c
r47341 r47417 45 45 #include <linux/version.h> 46 46 47 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)48 49 47 #include "vboxvideo_drv.h" 50 48 … … 53 51 struct drm_encoder *encoder; 54 52 struct drm_connector *connector; 53 int ret; 55 54 int i; 56 55 … … 61 60 gdev->ddev->mode_config.max_height = VBOXVIDEO_MAX_FB_HEIGHT; 62 61 63 gdev->ddev->mode_config.fb_base = gdev->mc. aper_base;62 gdev->ddev->mode_config.fb_base = gdev->mc.vram_base; 64 63 65 64 /* allocate crtcs */ … … 83 82 drm_mode_connector_attach_encoder(connector, encoder); 84 83 84 ret = vboxvideo_fbdev_init(gdev); 85 if (ret) { 86 VBOXVIDEO_ERROR("vboxvideo_fbdev_init failed\n"); 87 return ret; 88 } 89 85 90 return 0; 86 91 } … … 88 93 void vboxvideo_modeset_fini(struct vboxvideo_device *gdev) 89 94 { 95 vboxvideo_fbdev_fini(gdev); 96 90 97 if (gdev->mode_info.mode_config_initialized) 91 98 { … … 94 101 } 95 102 } 96 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ -
trunk/src/VBox/Additions/linux/drm/vboxvideo_drv.h
r47388 r47417 68 68 #define MB (1024 * 1024) 69 69 70 /** @todo does this make sense? What exactly is this connector? */71 70 #define VBOXVIDEOFB_CONN_LIMIT VBOX_VIDEO_MAX_SCREENS 72 71 73 72 /* vboxvideo_crtc.c */ 73 void vboxvideo_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 74 u16 blue, int regno); 75 void vboxvideo_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 76 u16 *blue, int regno); 74 77 void vboxvideo_crtc_init(struct drm_device *dev, int index); 75 78 76 79 /* vboxvideo_dac.c */ 77 80 struct drm_encoder *vboxvideo_dac_init(struct drm_device *dev); 81 82 /* vboxvideo_fbdev.c */ 83 int vboxvideo_fbdev_init(struct vboxvideo_device *gdev); 84 void vboxvideo_fbdev_fini(struct vboxvideo_device *gdev); 85 86 /* vboxvideo_framebuffer.c */ 87 int vboxvideo_framebuffer_init(struct drm_device *dev, 88 struct vboxvideo_framebuffer *gfb, 89 struct DRM_MODE_FB_CMD *mode_cmd); 78 90 79 91 /* vboxvideo_device.c */ -
trunk/src/VBox/Additions/linux/drm/vboxvideo_kms.c
r44529 r47417 44 44 45 45 #include <linux/version.h> 46 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)47 46 48 47 #include "vboxvideo_drv.h" … … 97 96 }; 98 97 int vboxvideo_max_ioctl = DRM_ARRAY_SIZE(vboxvideo_ioctls); 99 100 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */ -
trunk/src/VBox/Additions/linux/drm/vboxvideo_mode.h
r39335 r47417 48 48 #include <VBox/Hardware/VBoxVideoVBE.h> 49 49 #include "drm/drmP.h" 50 #include <linux/version.h> 50 51 51 52 #define VBOXVIDEO_MAX_FB_HEIGHT VBE_DISPI_MAX_YRES … … 54 55 #define to_vboxvideo_crtc(x) container_of(x, struct vboxvideo_crtc, base) 55 56 #define to_vboxvideo_encoder(x) container_of(x, struct vboxvideo_encoder, base) 57 #define to_vboxvideo_framebuffer(x) container_of(x, struct vboxvideo_framebuffer, base) 56 58 57 59 #define VBOXVIDEO_DPMS_CLEARED (-1) 60 61 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) 62 # define DRM_MODE_FB_CMD drm_mode_fb_cmd 63 #else 64 # define DRM_MODE_FB_CMD drm_mode_fb_cmd2 65 #endif 58 66 59 67 struct vboxvideo_crtc … … 68 76 { 69 77 bool mode_config_initialized; 70 struct vboxvideo_crtc *crtcs[VBOX_VIDEO_MAX_SCREENS]; 78 struct vboxvideo_crtc *crtcs[1]; /* FIXME: how many CRTCs? */ 79 /* pointer to fbdev info structure */ 80 struct vboxvideo_fbdev *gfbdev; 71 81 }; 72 82 … … 81 91 }; 82 92 93 struct vboxvideo_framebuffer { 94 struct drm_framebuffer base; 95 }; 96 83 97 #endif /* __DRM_VBOXVIDEO_H__ */ -
trunk/src/VBox/Additions/linux/drm/vboxvideo_vga.c
r47341 r47417 44 44 45 45 #include <linux/version.h> 46 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)47 46 48 47 #include "vboxvideo_drv.h" … … 131 130 return connector; 132 131 } 133 134 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) */
Note:
See TracChangeset
for help on using the changeset viewer.