VirtualBox

Changeset 59634 in vbox for trunk


Ignore:
Timestamp:
Feb 10, 2016 7:54:34 PM (9 years ago)
Author:
vboxsync
Message:

bugref:8087: Additions/x11: support non-root X server: add support for passing virtual screen relative position information via connector properties. Not very useful at present, as the X.Org modesetting driver does not pick up changes.

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  
    4646#include "vbox_drv.h"
    4747
     48#include <VBox/VBoxVideo.h>
     49
    4850#include <drm/drm_crtc_helper.h>
    4951
     
    7880}
    7981
     82/**
     83 * Query the host for
     84 */
     85static 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
    80121static void vbox_hotplug_worker(struct work_struct *work)
    81122{
     
    84125
    85126    LogFunc(("vboxvideo: %d: vbox=%p\n", __LINE__, vbox));
     127    vbox_update_mode_hints(vbox);
    86128    drm_kms_helper_hotplug_event(vbox->dev);
    87129    if (vbox->fbdev)
     
    94136
    95137    LogFunc(("vboxvideo: %d: vbox=%p\n", __LINE__, vbox));
     138    vbox_update_mode_hints(vbox);
    96139        ret = drm_irq_install(vbox->dev, vbox->dev->pdev->irq);
    97140        if (unlikely(ret != 0)) {
  • trunk/src/VBox/Additions/linux/drm/vbox_main.c

    r59597 r59634  
    360360    dev->mode_config.max_height = VBE_DISPI_MAX_YRES;
    361361
     362    ret = vbox_mode_init(dev);
     363    if (ret)
     364        goto out_free;
     365
    362366    ret = vbox_irq_init(vbox);
    363     if (ret)
    364         goto out_free;
    365 
    366     ret = vbox_mode_init(dev);
    367367    if (ret)
    368368        goto out_free;
     
    375375    return 0;
    376376out_free:
     377    vbox_irq_fini(vbox);
    377378    if (vbox->vram)
    378379        pci_iounmap(dev->pdev, vbox->vram);
     
    389390    LogFunc(("vboxvideo: %d\n", __LINE__));
    390391    vbox_fbdev_fini(dev);
     392    vbox_irq_fini(vbox);
    391393    vbox_mode_fini(dev);
    392     vbox_irq_fini(vbox);
    393394    drm_mode_config_cleanup(dev);
    394395
  • trunk/src/VBox/Additions/linux/drm/vbox_mode.c

    r59597 r59634  
    412412}
    413413
    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 
    434414static int vbox_get_modes(struct drm_connector *connector)
    435415{
     
    441421    LogFunc(("vboxvideo: %d: connector=%p\n", __LINE__, connector));
    442422    vbox_connector = to_vbox_connector(connector);
    443     vboxUpdateHints(vbox_connector);
    444423    cModes = drm_add_modes_noedid(connector, 2560, 1600);
    445424    widthPreferred = vbox_connector->mode_hint.width ? vbox_connector->mode_hint.width : 1024;
     
    486465    LogFunc(("vboxvideo: %d: connector=%p\n", __LINE__, connector));
    487466    vbox_connector = to_vbox_connector(connector);
    488     vboxUpdateHints(vbox_connector);
    489467    return !vbox_connector->mode_hint.disconnected;
    490468}
     
    578556    connector->doublescan_allowed = 0;
    579557
     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
    580565#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
    581566    drm_sysfs_connector_add(connector);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette