Changeset 49518 in vbox for trunk/src/VBox
- Timestamp:
- Nov 16, 2013 3:46:44 PM (11 years ago)
- Location:
- trunk/src/VBox/Additions/linux/drm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_drv.c
r48364 r49518 61 61 static struct drm_driver driver; 62 62 63 static DEFINE_PCI_DEVICE_TABLE(pciidlist) = { 64 {0x80ee, 0xbeef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 65 {0, 0, 0}, 63 static DEFINE_PCI_DEVICE_TABLE(pciidlist) = 64 { 65 {0x80ee, 0xbeef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 66 {0, 0, 0}, 66 67 }; 67 68 … … 70 71 static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 71 72 { 72 73 return drm_get_pci_dev(pdev, ent, &driver); 73 74 } 74 75 75 76 76 static void 77 vbox_pci_remove(struct pci_dev *pdev) 77 static void vbox_pci_remove(struct pci_dev *pdev) 78 78 { 79 79 struct drm_device *dev = pci_get_drvdata(pdev); 80 80 81 81 drm_put_dev(dev); 82 82 } 83 83 84 84 85 static struct pci_driver vbox_pci_driver = { 86 .name = DRIVER_NAME, 87 .id_table = pciidlist, 88 .probe = vbox_pci_probe, 89 .remove = vbox_pci_remove, 85 static struct pci_driver vbox_pci_driver = 86 { 87 .name = DRIVER_NAME, 88 .id_table = pciidlist, 89 .probe = vbox_pci_probe, 90 .remove = vbox_pci_remove, 90 91 }; 91 92 92 static const struct file_operations vbox_fops = { 93 .owner = THIS_MODULE, 94 .open = drm_open, 95 .release = drm_release, 96 .unlocked_ioctl = drm_ioctl, 97 .mmap = vbox_mmap, 98 .poll = drm_poll, 99 .fasync = drm_fasync, 93 static const struct file_operations vbox_fops = 94 { 95 .owner = THIS_MODULE, 96 .open = drm_open, 97 .release = drm_release, 98 .unlocked_ioctl = drm_ioctl, 99 .mmap = vbox_mmap, 100 .poll = drm_poll, 101 .fasync = drm_fasync, 100 102 #ifdef CONFIG_COMPAT 101 103 .compat_ioctl = drm_compat_ioctl, 102 104 #endif 103 105 .read = drm_read, 104 106 }; 105 107 106 static struct drm_driver driver = { 107 .driver_features = DRIVER_USE_MTRR | DRIVER_MODESET | DRIVER_GEM, 108 .dev_priv_size = 0, 108 static struct drm_driver driver = 109 { 110 .driver_features = DRIVER_USE_MTRR | DRIVER_MODESET | DRIVER_GEM, 111 .dev_priv_size = 0, 109 112 110 111 113 .load = vbox_driver_load, 114 .unload = vbox_driver_unload, 112 115 113 114 115 116 117 118 119 116 .fops = &vbox_fops, 117 .name = DRIVER_NAME, 118 .desc = DRIVER_DESC, 119 .date = DRIVER_DATE, 120 .major = DRIVER_MAJOR, 121 .minor = DRIVER_MINOR, 122 .patchlevel = DRIVER_PATCHLEVEL, 120 123 121 122 123 124 125 124 .gem_init_object = vbox_gem_init_object, 125 .gem_free_object = vbox_gem_free_object, 126 .dumb_create = vbox_dumb_create, 127 .dumb_map_offset = vbox_dumb_mmap_offset, 128 .dumb_destroy = vbox_dumb_destroy, 126 129 127 130 }; … … 130 133 { 131 134 #ifdef CONFIG_VGA_CONSOLE 132 133 135 if (vgacon_text_force() && vbox_modeset == -1) 136 return -EINVAL; 134 137 #endif 135 138 136 137 138 139 if (vbox_modeset == 0) 140 return -EINVAL; 141 return drm_pci_init(&driver, &vbox_pci_driver); 139 142 } 140 143 static void __exit vbox_exit(void) 141 144 { 142 145 drm_pci_exit(&driver, &vbox_pci_driver); 143 146 } 144 147 -
trunk/src/VBox/Additions/linux/drm/vbox_drv.h
r49278 r49518 80 80 struct vbox_fbdev; 81 81 82 struct vbox_private { 83 struct drm_device *dev; 84 85 void __iomem *vram; 82 struct vbox_private 83 { 84 struct drm_device *dev; 85 86 void __iomem *vram; 86 87 HGSMIGUESTCOMMANDCONTEXT Ctx; 87 88 struct VBVABUFFERCONTEXT *paVBVACtx; 88 89 bool fAnyX; 89 90 unsigned cCrtcs; 90 bool vga2_clone; 91 uint32_t vram_size; 92 93 struct vbox_fbdev *fbdev; 94 95 int fb_mtrr; 96 97 struct { 98 struct drm_global_reference mem_global_ref; 99 struct ttm_bo_global_ref bo_global_ref; 100 struct ttm_bo_device bdev; 101 } ttm; 102 103 struct drm_gem_object *cursor_cache; 104 uint64_t cursor_cache_gpu_addr; 105 struct ttm_bo_kmap_obj cache_kmap; 106 int next_cursor; 107 spinlock_t dev_lock; 91 bool vga2_clone; 92 uint32_t vram_size; 93 94 struct vbox_fbdev *fbdev; 95 96 int fb_mtrr; 97 98 struct 99 { 100 struct drm_global_reference mem_global_ref; 101 struct ttm_bo_global_ref bo_global_ref; 102 struct ttm_bo_device bdev; 103 } ttm; 104 105 struct drm_gem_object *cursor_cache; 106 uint64_t cursor_cache_gpu_addr; 107 struct ttm_bo_kmap_obj cache_kmap; 108 int next_cursor; 109 spinlock_t dev_lock; 108 110 }; 109 111 … … 113 115 struct vbox_gem_object; 114 116 115 struct vbox_connector { 116 struct drm_connector base; 117 }; 118 119 struct vbox_crtc { 120 struct drm_crtc base; 121 bool fBlanked; 122 unsigned crtc_id; 123 uint32_t offFB; 124 struct drm_gem_object *cursor_bo; 125 uint64_t cursor_addr; 126 int cursor_width, cursor_height; 127 u8 offset_x, offset_y; 128 }; 129 130 struct vbox_encoder { 131 struct drm_encoder base; 132 }; 133 134 struct vbox_framebuffer { 135 struct drm_framebuffer base; 136 struct drm_gem_object *obj; 137 }; 138 139 struct vbox_fbdev { 140 struct drm_fb_helper helper; 141 struct vbox_framebuffer afb; 142 struct list_head fbdev_list; 143 void *sysram; 144 int size; 145 struct ttm_bo_kmap_obj mapping; 146 int x1, y1, x2, y2; /* dirty rect */ 117 struct vbox_connector 118 { 119 struct drm_connector base; 120 }; 121 122 struct vbox_crtc 123 { 124 struct drm_crtc base; 125 bool fBlanked; 126 unsigned crtc_id; 127 uint32_t offFB; 128 struct drm_gem_object *cursor_bo; 129 uint64_t cursor_addr; 130 int cursor_width, cursor_height; 131 u8 offset_x, offset_y; 132 }; 133 134 struct vbox_encoder 135 { 136 struct drm_encoder base; 137 }; 138 139 struct vbox_framebuffer 140 { 141 struct drm_framebuffer base; 142 struct drm_gem_object *obj; 143 }; 144 145 struct vbox_fbdev 146 { 147 struct drm_fb_helper helper; 148 struct vbox_framebuffer afb; 149 struct list_head fbdev_list; 150 void *sysram; 151 int size; 152 struct ttm_bo_kmap_obj mapping; 153 int x1, y1, x2, y2; /* dirty rect */ 147 154 }; 148 155 … … 166 173 167 174 int vbox_framebuffer_init(struct drm_device *dev, 168 169 170 175 struct vbox_framebuffer *vbox_fb, 176 struct DRM_MODE_FB_CMD *mode_cmd, 177 struct drm_gem_object *obj); 171 178 172 179 int vbox_fbdev_init(struct drm_device *dev); … … 174 181 void vbox_fbdev_set_suspend(struct drm_device *dev, int state); 175 182 176 struct vbox_bo { 177 struct ttm_buffer_object bo; 178 struct ttm_placement placement; 179 struct ttm_bo_kmap_obj kmap; 180 struct drm_gem_object gem; 181 u32 placements[3]; 182 int pin_count; 183 struct vbox_bo 184 { 185 struct ttm_buffer_object bo; 186 struct ttm_placement placement; 187 struct ttm_bo_kmap_obj kmap; 188 struct drm_gem_object gem; 189 u32 placements[3]; 190 int pin_count; 183 191 }; 184 192 #define gem_to_vbox_bo(gobj) container_of((gobj), struct vbox_bo, gem) 185 193 186 static inline struct vbox_bo * 187 vbox_bo(struct ttm_buffer_object *bo) 188 { 189 return container_of(bo, struct vbox_bo, bo); 194 static inline struct vbox_bo * vbox_bo(struct ttm_buffer_object *bo) 195 { 196 return container_of(bo, struct vbox_bo, bo); 190 197 } 191 198 … … 194 201 195 202 extern int vbox_dumb_create(struct drm_file *file, 196 197 203 struct drm_device *dev, 204 struct drm_mode_create_dumb *args); 198 205 extern int vbox_dumb_destroy(struct drm_file *file, 199 200 206 struct drm_device *dev, 207 uint32_t handle); 201 208 202 209 extern int vbox_gem_init_object(struct drm_gem_object *obj); 203 210 extern void vbox_gem_free_object(struct drm_gem_object *obj); 204 211 extern int vbox_dumb_mmap_offset(struct drm_file *file, 205 206 207 212 struct drm_device *dev, 213 uint32_t handle, 214 uint64_t *offset); 208 215 209 216 #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) … … 213 220 214 221 int vbox_bo_create(struct drm_device *dev, int size, int align, 215 222 uint32_t flags, struct vbox_bo **pvboxbo); 216 223 217 224 int vbox_gem_create(struct drm_device *dev, 218 219 225 u32 size, bool iskernel, 226 struct drm_gem_object **obj); 220 227 221 228 int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr);
Note:
See TracChangeset
for help on using the changeset viewer.