VirtualBox

Ignore:
Timestamp:
Mar 7, 2016 6:59:38 PM (9 years ago)
Author:
vboxsync
Message:

bugref:8087: Additions/x11: support non-root X server: change back the spin-locking in the fbdev emulation code to match what is done in the ast driver, and switch over the rest, which is used to synchronise access to the virtual hardware, to use a mutex instead of a spin-lock.

Location:
trunk/src/VBox/Additions/linux/drm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/drm/vbox_drv.h

    r59936 r59947  
    117117    } ttm;
    118118
    119     spinlock_t dev_lock;
     119    struct mutex hw_mutex;
    120120    bool isr_installed;
    121121    struct work_struct hotplug_work;
     
    171171    struct ttm_bo_kmap_obj mapping;
    172172    int x1, y1, x2, y2; /* dirty rect */
     173    spinlock_t dirty_lock;
    173174};
    174175
  • trunk/src/VBox/Additions/linux/drm/vbox_fb.c

    r59697 r59947  
    131131    x2 = x + width - 1;
    132132    y2 = y + height - 1;
    133     spin_lock_irqsave(&vbox->dev_lock, flags);
     133    spin_lock_irqsave(&fbdev->dirty_lock, flags);
    134134
    135135    if (fbdev->y1 < y)
     
    147147        fbdev->y1 = y;
    148148        fbdev->y2 = y2;
    149         spin_unlock_irqrestore(&vbox->dev_lock, flags);
     149        spin_unlock_irqrestore(&fbdev->dirty_lock, flags);
    150150        LogFunc(("vboxvideo: %d\n", __LINE__));
    151151        return;
     
    154154    fbdev->x1 = fbdev->y1 = INT_MAX;
    155155    fbdev->x2 = fbdev->y2 = 0;
    156     spin_unlock_irqrestore(&vbox->dev_lock, flags);
     156    spin_unlock_irqrestore(&fbdev->dirty_lock, flags);
    157157
    158158    if (!bo->kmap.virtual) {
     
    418418
    419419    vbox->fbdev = fbdev;
     420    spin_lock_init(&fbdev->dirty_lock);
     421
    420422#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
    421423    fbdev->helper.funcs = &vbox_fb_helper_funcs;
  • trunk/src/VBox/Additions/linux/drm/vbox_main.c

    r59697 r59947  
    117117             num_rects, vbox));
    118118    vbox_enable_accel(vbox);
    119     spin_lock_irqsave(&vbox->dev_lock, flags);
     119    mutex_lock(&vbox->hw_mutex);
    120120    for (i = 0; i < num_rects; ++i)
    121121    {
     
    147147        }
    148148    }
    149     spin_unlock_irqrestore(&vbox->dev_lock, flags);
     149    mutex_unlock(&vbox->hw_mutex);
    150150    LogFunc(("vboxvideo: %d\n", __LINE__));
    151151}
     
    348348    vbox->dev = dev;
    349349
    350     spin_lock_init(&vbox->dev_lock);
     350    mutex_init(&vbox->hw_mutex);
    351351    /* I hope this won't interfere with the memory manager. */
    352352    vbox->vram = pci_iomap(dev->pdev, 0, 0);
  • trunk/src/VBox/Additions/linux/drm/vbox_mode.c

    r59936 r59947  
    146146    struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc);
    147147    struct vbox_private *vbox = crtc->dev->dev_private;
    148     unsigned long flags;
    149148
    150149    LogFunc(("vboxvideo: %d: vbox_crtc=%p, mode=%d\n", __LINE__, vbox_crtc,
     
    160159        break;
    161160    }
    162     spin_lock_irqsave(&vbox->dev_lock, flags);
     161    mutex_lock(&vbox->hw_mutex);
    163162    vbox_do_modeset(crtc, &crtc->hwmode);
    164     spin_unlock_irqrestore(&vbox->dev_lock, flags);
     163    mutex_unlock(&vbox->hw_mutex);
    165164    LogFunc(("vboxvideo: %d\n", __LINE__));
    166165}
     
    249248{
    250249    struct vbox_private *vbox = crtc->dev->dev_private;
    251     unsigned long flags;
    252250    int rc = 0;
    253251
    254252    LogFunc(("vboxvideo: %d: vbox=%p\n", __LINE__, vbox));
    255253    vbox_crtc_mode_set_base(crtc, x, y, old_fb);
    256     spin_lock_irqsave(&vbox->dev_lock, flags);
     254    mutex_lock(&vbox->hw_mutex);
    257255    rc = vbox_set_view(crtc);
    258256    if (!rc)
    259257        vbox_do_modeset(crtc, mode);
    260     spin_unlock_irqrestore(&vbox->dev_lock, flags);
     258    mutex_unlock(&vbox->hw_mutex);
    261259    LogFunc(("vboxvideo: %d\n", __LINE__));
    262260    return rc;
     
    567565    struct vbox_private *vbox = dev->dev_private;
    568566    struct drm_crtc *crtci;
    569     unsigned long flags;
    570 
    571     LogFunc(("vboxvideo: %d\n", __LINE__));
    572     spin_lock_irqsave(&vbox->dev_lock, flags);
     567
     568    LogFunc(("vboxvideo: %d\n", __LINE__));
     569    mutex_lock(&vbox->hw_mutex);
    573570    list_for_each_entry(crtci, &dev->mode_config.crtc_list, head)
    574571        vbox_do_modeset(crtci, &crtci->hwmode);
    575     spin_unlock_irqrestore(&vbox->dev_lock, flags);
     572    mutex_unlock(&vbox->hw_mutex);
    576573    LogFunc(("vboxvideo: %d\n", __LINE__));
    577574}
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