Changeset 59697 in vbox for trunk/src/VBox/Additions/linux/drm
- Timestamp:
- Feb 16, 2016 10:32:31 AM (9 years ago)
- Location:
- trunk/src/VBox/Additions/linux/drm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_drv.h
r59640 r59697 114 114 struct ttm_bo_global_ref bo_global_ref; 115 115 struct ttm_bo_device bdev; 116 bool mm_initialised; 116 117 } ttm; 117 118 … … 196 197 #endif 197 198 198 void vbox_enable_accel(struct vbox_private *vbox, unsigned crtc_id); 199 void vbox_enable_accel(struct vbox_private *vbox); 200 void vbox_disable_accel(struct vbox_private *vbox); 199 201 void vbox_enable_caps(struct vbox_private *vbox); 202 void vbox_disable_caps(struct vbox_private *vbox); 200 203 201 204 void vbox_framebuffer_dirty_rectangles(struct drm_framebuffer *fb, -
trunk/src/VBox/Additions/linux/drm/vbox_fb.c
r59640 r59697 82 82 struct drm_device *dev; 83 83 struct vbox_private *vbox; 84 unsigned i;85 84 86 85 LogFunc(("vboxvideo: %d\n", __LINE__)); … … 88 87 vbox = dev->dev_private; 89 88 vbox_refresh_modes(dev); 90 for (i = 0; i < vbox->num_crtcs; ++i)91 VBoxVBVADisable(&vbox->vbva_info[i], &vbox->submit_info, i);92 VBoxHGSMISendCapsInfo(&vbox->submit_info, 0);93 89 return drm_fb_helper_set_par(info); 94 90 } … … 448 444 free: 449 445 kfree(fbdev); 446 vbox->fbdev = NULL; 450 447 LogFunc(("vboxvideo: %d, ret=%d\n", __LINE__, ret)); 451 448 return ret; -
trunk/src/VBox/Additions/linux/drm/vbox_main.c
r59640 r59697 66 66 } 67 67 68 void vbox_enable_accel(struct vbox_private *vbox, unsigned crtc_id) 69 { 70 struct VBVABUFFER *vbva = vbox->vbva_info[crtc_id].pVBVA; 71 72 if (vbva == NULL) { 73 LogFunc(("vboxvideo: enabling VBVA.\n")); 74 vbva = (struct VBVABUFFER *) ( ((uint8_t *)vbox->vram) 75 + vbox->vram_size 76 + crtc_id * VBVA_MIN_BUFFER_SIZE); 77 if (!VBoxVBVAEnable(&vbox->vbva_info[crtc_id], &vbox->submit_info, vbva, crtc_id)) 78 AssertReleaseMsgFailed(("VBoxVBVAEnable failed - heap allocation error, very old host or driver error.\n")); 79 } 68 void vbox_enable_accel(struct vbox_private *vbox) 69 { 70 unsigned i; 71 struct VBVABUFFER *vbva; 72 73 AssertLogRelReturnVoid(vbox->vbva_info != NULL); 74 for (i = 0; i < vbox->num_crtcs; ++i) { 75 if (vbox->vbva_info[i].pVBVA == NULL) { 76 LogFunc(("vboxvideo: enabling VBVA.\n")); 77 vbva = (struct VBVABUFFER *) ( ((uint8_t *)vbox->vram) 78 + vbox->vram_size 79 + i * VBVA_MIN_BUFFER_SIZE); 80 if (!VBoxVBVAEnable(&vbox->vbva_info[i], &vbox->submit_info, vbva, i)) 81 AssertReleaseMsgFailed(("VBoxVBVAEnable failed - heap allocation error, very old host or driver error.\n")); 82 } 83 } 84 } 85 86 void vbox_disable_accel(struct vbox_private *vbox) 87 { 88 unsigned i; 89 90 for (i = 0; i < vbox->num_crtcs; ++i) 91 VBoxVBVADisable(&vbox->vbva_info[i], &vbox->submit_info, i); 80 92 } 81 93 … … 83 95 { 84 96 VBoxHGSMISendCapsInfo(&vbox->submit_info, VBVACAPS_VIDEO_MODE_HINTS | VBVACAPS_DISABLE_CURSOR_INTEGRATION | VBVACAPS_IRQ); 97 } 98 99 void vbox_disable_caps(struct vbox_private *vbox) 100 { 101 VBoxHGSMISendCapsInfo(&vbox->submit_info, 0); 85 102 } 86 103 … … 99 116 LogFunc(("vboxvideo: %d: fb=%p, num_rects=%u, vbox=%p\n", __LINE__, fb, 100 117 num_rects, vbox)); 101 if (vbox->vbva_info[0].pVBVA == NULL) { 102 for (i = 0; i < vbox->num_crtcs; ++i) 103 vbox_enable_accel(vbox, i); 104 /* Assume that if the user knows to send dirty rectangle information 105 * they can also handle hot-plug events. */ 106 vbox_enable_caps(vbox); 107 } 118 vbox_enable_accel(vbox); 108 119 spin_lock_irqsave(&vbox->dev_lock, flags); 109 120 for (i = 0; i < num_rects; ++i) … … 214 225 static void vbox_accel_fini(struct vbox_private *vbox) 215 226 { 216 unsigned i;217 218 227 if (vbox->vbva_info) 219 228 { 220 for (i = 0; i < vbox->num_crtcs; ++i) 221 VBoxVBVADisable(&vbox->vbva_info[i], &vbox->submit_info, i); 229 vbox_disable_accel(vbox); 222 230 kfree(vbox->vbva_info); 223 231 vbox->vbva_info = NULL; … … 293 301 void *guest_heap; 294 302 303 vbox->full_vram_size = VBoxVideoGetVRAMSize(); 304 vbox->any_pitch = VBoxVideoAnyWidthAllowed(); 305 DRM_INFO("VRAM %08x\n", vbox->full_vram_size); 295 306 VBoxHGSMIGetBaseMappingInfo(vbox->full_vram_size, &base_offset, NULL, 296 307 &guest_heap_offset, &guest_heap_size, &host_flags_offset); … … 314 325 } 315 326 327 static void vbox_hw_fini(struct vbox_private *vbox) 328 { 329 vbox_accel_fini(vbox); 330 if (vbox->last_mode_hints) 331 kfree(vbox->last_mode_hints); 332 vbox->last_mode_hints = NULL; 333 } 316 334 317 335 int vbox_driver_load(struct drm_device *dev, unsigned long flags) … … 337 355 goto out_free; 338 356 } 339 vbox->full_vram_size = VBoxVideoGetVRAMSize();340 vbox->any_pitch = VBoxVideoAnyWidthAllowed();341 DRM_INFO("VRAM %08x\n", vbox->full_vram_size);342 357 343 358 ret = vbox_hw_init(vbox); … … 373 388 return 0; 374 389 out_free: 390 vbox_driver_unload(dev); 391 LogFunc(("vboxvideo: %d: ret=%d\n", __LINE__, ret)); 392 return ret; 393 } 394 395 int vbox_driver_unload(struct drm_device *dev) 396 { 397 struct vbox_private *vbox = dev->dev_private; 398 399 LogFunc(("vboxvideo: %d\n", __LINE__)); 400 vbox_fbdev_fini(dev); 375 401 vbox_irq_fini(vbox); 402 vbox_mode_fini(dev); 403 if (dev->mode_config.funcs) 404 drm_mode_config_cleanup(dev); 405 406 vbox_hw_fini(vbox); 407 vbox_mm_fini(vbox); 376 408 if (vbox->vram) 377 409 pci_iounmap(dev->pdev, vbox->vram); 378 410 kfree(vbox); 379 411 dev->dev_private = NULL; 380 LogFunc(("vboxvideo: %d: ret=%d\n", __LINE__, ret));381 return ret;382 }383 384 int vbox_driver_unload(struct drm_device *dev)385 {386 struct vbox_private *vbox = dev->dev_private;387 388 LogFunc(("vboxvideo: %d\n", __LINE__));389 vbox_fbdev_fini(dev);390 vbox_irq_fini(vbox);391 vbox_mode_fini(dev);392 drm_mode_config_cleanup(dev);393 394 vbox_accel_fini(vbox);395 vbox_mm_fini(vbox);396 pci_iounmap(dev->pdev, vbox->vram);397 kfree(vbox);398 412 LogFunc(("vboxvideo: %d\n", __LINE__)); 399 413 return 0; -
trunk/src/VBox/Additions/linux/drm/vbox_mode.c
r59640 r59697 218 218 if (ret) 219 219 DRM_ERROR("failed to kmap fbcon\n"); 220 vbox_disable_accel(vbox); 221 vbox_disable_caps(vbox); 220 222 } 221 223 else { 222 unsigned i; 223 224 for (i = 0; i < vbox->num_crtcs; ++i) 225 vbox_enable_accel(vbox, i); 224 vbox_enable_accel(vbox); 225 vbox_enable_caps(vbox); 226 226 } 227 227 vbox_bo_unreserve(bo); -
trunk/src/VBox/Additions/linux/drm/vbox_ttm.c
r59526 r59697 316 316 #endif 317 317 318 vbox->ttm.mm_initialised = true; 318 319 return 0; 319 320 } … … 324 325 struct drm_device *dev = vbox->dev; 325 326 #endif 327 if (!vbox->ttm.mm_initialised) 328 return; 326 329 ttm_bo_device_release(&vbox->ttm.bdev); 327 330
Note:
See TracChangeset
for help on using the changeset viewer.