- Timestamp:
- Feb 10, 2016 7:54:34 PM (9 years ago)
- Location:
- trunk/src/VBox/Additions/linux/drm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/drm/vbox_irq.c
r59598 r59634 46 46 #include "vbox_drv.h" 47 47 48 #include <VBox/VBoxVideo.h> 49 48 50 #include <drm/drm_crtc_helper.h> 49 51 … … 78 80 } 79 81 82 /** 83 * Query the host for 84 */ 85 static void vbox_update_mode_hints(struct vbox_private *vbox) 86 { 87 struct drm_device *dev = vbox->dev; 88 struct drm_connector *connector; 89 struct vbox_connector *vbox_connector; 90 struct VBVAMODEHINT *hints; 91 int rc; 92 93 rc = VBoxHGSMIGetModeHints(&vbox->submit_info, vbox->num_crtcs, 94 vbox->last_mode_hints); 95 AssertMsgRCReturnVoid(rc, ("VBoxHGSMIGetModeHints failed, rc=%Rrc.\n", rc)); 96 drm_modeset_lock_all(dev); 97 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 98 vbox_connector = to_vbox_connector(connector); 99 hints = &vbox->last_mode_hints[vbox_connector->crtc_id]; 100 if (hints->magic == VBVAMODEHINT_MAGIC) { 101 LogFunc(("vboxvideo: %d: crtc_id=%u, mode %hdx%hd(enabled:%d),%hdx%hd\n", 102 __LINE__, (unsigned)vbox_connector->crtc_id, 103 (short)hints->cx, (short)hints->cy, (int)hints->fEnabled, 104 (short)hints->dx, (short)hints->dy)); 105 vbox_connector->mode_hint.width = hints->cx & 0x8fff; 106 vbox_connector->mode_hint.height = hints->cy & 0x8fff; 107 vbox_connector->mode_hint.disconnected = !(hints->fEnabled); 108 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) 109 if ((hints->dx < 0xffff) && (hints->dy < 0xffff)) { 110 drm_object_property_set_value(&connector->base, 111 dev->mode_config.suggested_x_property, hints->dx & 0x8fff); 112 drm_object_property_set_value(&connector->base, 113 dev->mode_config.suggested_y_property, hints->dy & 0x8fff); 114 } 115 #endif 116 } 117 } 118 drm_modeset_unlock_all(dev); 119 } 120 80 121 static void vbox_hotplug_worker(struct work_struct *work) 81 122 { … … 84 125 85 126 LogFunc(("vboxvideo: %d: vbox=%p\n", __LINE__, vbox)); 127 vbox_update_mode_hints(vbox); 86 128 drm_kms_helper_hotplug_event(vbox->dev); 87 129 if (vbox->fbdev) … … 94 136 95 137 LogFunc(("vboxvideo: %d: vbox=%p\n", __LINE__, vbox)); 138 vbox_update_mode_hints(vbox); 96 139 ret = drm_irq_install(vbox->dev, vbox->dev->pdev->irq); 97 140 if (unlikely(ret != 0)) { -
trunk/src/VBox/Additions/linux/drm/vbox_main.c
r59597 r59634 360 360 dev->mode_config.max_height = VBE_DISPI_MAX_YRES; 361 361 362 ret = vbox_mode_init(dev); 363 if (ret) 364 goto out_free; 365 362 366 ret = vbox_irq_init(vbox); 363 if (ret)364 goto out_free;365 366 ret = vbox_mode_init(dev);367 367 if (ret) 368 368 goto out_free; … … 375 375 return 0; 376 376 out_free: 377 vbox_irq_fini(vbox); 377 378 if (vbox->vram) 378 379 pci_iounmap(dev->pdev, vbox->vram); … … 389 390 LogFunc(("vboxvideo: %d\n", __LINE__)); 390 391 vbox_fbdev_fini(dev); 392 vbox_irq_fini(vbox); 391 393 vbox_mode_fini(dev); 392 vbox_irq_fini(vbox);393 394 drm_mode_config_cleanup(dev); 394 395 -
trunk/src/VBox/Additions/linux/drm/vbox_mode.c
r59597 r59634 412 412 } 413 413 414 static void vboxUpdateHints(struct vbox_connector *vbox_connector)415 {416 struct vbox_private *pVBox;417 int rc;418 419 LogFunc(("vboxvideo: %d: vbox_connector=%p\n", __LINE__, vbox_connector));420 pVBox = vbox_connector->base.dev->dev_private;421 rc = VBoxHGSMIGetModeHints(&pVBox->submit_info, pVBox->num_crtcs, pVBox->last_mode_hints);422 AssertMsgRCReturnVoid(rc, ("VBoxHGSMIGetModeHints failed, rc=%Rrc.\n", rc));423 if (pVBox->last_mode_hints[vbox_connector->crtc_id].magic == VBVAMODEHINT_MAGIC)424 {425 vbox_connector->mode_hint.width = pVBox->last_mode_hints[vbox_connector->crtc_id].cx & 0x8fff;426 vbox_connector->mode_hint.height = pVBox->last_mode_hints[vbox_connector->crtc_id].cy & 0x8fff;427 vbox_connector->mode_hint.disconnected = !(pVBox->last_mode_hints[vbox_connector->crtc_id].fEnabled);428 LogFunc(("vboxvideo: %d: width=%u, height=%u, disconnected=%RTbool\n", __LINE__,429 (unsigned)vbox_connector->mode_hint.width, (unsigned)vbox_connector->mode_hint.height,430 vbox_connector->mode_hint.disconnected));431 }432 }433 434 414 static int vbox_get_modes(struct drm_connector *connector) 435 415 { … … 441 421 LogFunc(("vboxvideo: %d: connector=%p\n", __LINE__, connector)); 442 422 vbox_connector = to_vbox_connector(connector); 443 vboxUpdateHints(vbox_connector);444 423 cModes = drm_add_modes_noedid(connector, 2560, 1600); 445 424 widthPreferred = vbox_connector->mode_hint.width ? vbox_connector->mode_hint.width : 1024; … … 486 465 LogFunc(("vboxvideo: %d: connector=%p\n", __LINE__, connector)); 487 466 vbox_connector = to_vbox_connector(connector); 488 vboxUpdateHints(vbox_connector);489 467 return !vbox_connector->mode_hint.disconnected; 490 468 } … … 578 556 connector->doublescan_allowed = 0; 579 557 558 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) 559 drm_mode_create_suggested_offset_properties(dev); 560 drm_object_attach_property(&connector->base, 561 dev->mode_config.suggested_x_property, 0); 562 drm_object_attach_property(&connector->base, 563 dev->mode_config.suggested_y_property, 0); 564 #endif 580 565 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) 581 566 drm_sysfs_connector_add(connector);
Note:
See TracChangeset
for help on using the changeset viewer.