VirtualBox

Ignore:
Timestamp:
Jul 26, 2016 10:23:12 AM (8 years ago)
Author:
vboxsync
Message:

bugref:8087: Additions/x11: support non-root X server: only touch VBVA under the lock, as functions which touch VBVA can be called on several threads at once. Also, do not disable VBVA when someone acquires master, as the frame buffer can still send rectangles after that, which re-enables it.

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

Legend:

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

    r62527 r62557  
    217217{
    218218    struct vbox_private *vbox = dev->dev_private;
     219    /* We do not yet know whether the new owner can handle hotplug, so we
     220     * do not advertise dynamic modes on the first query and send a
     221     * tentative hotplug notification after that to see if they query again. */
    219222    vbox->initial_mode_queried = false;
    220     vbox_disable_accel(vbox);
    221223    return 0;
    222224}
     
    228230    struct vbox_private *vbox = dev->dev_private;
    229231    vbox->initial_mode_queried = false;
     232    mutex_lock(&vbox->hw_mutex);
     233    /* Disable VBVA when someone releases master in case the next person tries
     234     * to do VESA. */
     235    /** @todo work out if anyone is likely to and whether it will even work. */
    230236    vbox_disable_accel(vbox);
     237    mutex_unlock(&vbox->hw_mutex);
    231238}
    232239
  • trunk/src/VBox/Additions/linux/drm/vbox_main.c

    r62550 r62557  
    111111{
    112112    struct vbox_private *vbox = fb->dev->dev_private;
     113    struct drm_crtc *crtc;
    113114    unsigned i;
    114115
    115116    LogFunc(("vboxvideo: %d: fb=%p, num_rects=%u, vbox=%p\n", __LINE__, fb,
    116117             num_rects, vbox));
    117     vbox_enable_accel(vbox);
    118118    mutex_lock(&vbox->hw_mutex);
    119     for (i = 0; i < num_rects; ++i)
    120     {
    121         struct drm_crtc *crtc;
    122         list_for_each_entry(crtc, &fb->dev->mode_config.crtc_list, head)
    123         {
    124             unsigned crtc_id = to_vbox_crtc(crtc)->crtc_id;
    125             VBVACMDHDR cmd_hdr;
    126 
    127             if (   CRTC_FB(crtc) != fb
    128                 || rects[i].x1 >   crtc->x
    129                                   + crtc->hwmode.hdisplay
    130                 || rects[i].y1 >   crtc->y
    131                                   + crtc->hwmode.vdisplay
    132                 || rects[i].x2 < crtc->x
    133                 || rects[i].y2 < crtc->y)
    134                 continue;
    135             cmd_hdr.x = (int16_t)rects[i].x1;
    136             cmd_hdr.y = (int16_t)rects[i].y1;
    137             cmd_hdr.w = (uint16_t)rects[i].x2 - rects[i].x1;
    138             cmd_hdr.h = (uint16_t)rects[i].y2 - rects[i].y1;
    139             if (VBoxVBVABufferBeginUpdate(&vbox->vbva_info[crtc_id],
    140                                           &vbox->submit_info))
     119    list_for_each_entry(crtc, &fb->dev->mode_config.crtc_list, head) {
     120        if (CRTC_FB(crtc) == fb) {
     121            vbox_enable_accel(vbox);
     122            for (i = 0; i < num_rects; ++i)
    141123            {
    142                 VBoxVBVAWrite(&vbox->vbva_info[crtc_id], &vbox->submit_info, &cmd_hdr,
    143                               sizeof(cmd_hdr));
    144                 VBoxVBVABufferEndUpdate(&vbox->vbva_info[crtc_id]);
     124                unsigned crtc_id = to_vbox_crtc(crtc)->crtc_id;
     125                VBVACMDHDR cmd_hdr;
     126
     127                if (   rects[i].x1 >   crtc->x
     128                                      + crtc->hwmode.hdisplay
     129                    || rects[i].y1 >   crtc->y
     130                                      + crtc->hwmode.vdisplay
     131                    || rects[i].x2 < crtc->x
     132                    || rects[i].y2 < crtc->y)
     133                    continue;
     134                cmd_hdr.x = (int16_t)rects[i].x1;
     135                cmd_hdr.y = (int16_t)rects[i].y1;
     136                cmd_hdr.w = (uint16_t)rects[i].x2 - rects[i].x1;
     137                cmd_hdr.h = (uint16_t)rects[i].y2 - rects[i].y1;
     138                if (VBoxVBVABufferBeginUpdate(&vbox->vbva_info[crtc_id],
     139                                              &vbox->submit_info))
     140                {
     141                    VBoxVBVAWrite(&vbox->vbva_info[crtc_id], &vbox->submit_info, &cmd_hdr,
     142                                  sizeof(cmd_hdr));
     143                    VBoxVBVABufferEndUpdate(&vbox->vbva_info[crtc_id]);
     144                }
    145145            }
    146146        }
  • trunk/src/VBox/Additions/linux/drm/vbox_mode.c

    r62550 r62557  
    260260    vbox_crtc_mode_set_base(crtc, x, y, old_fb);
    261261    mutex_lock(&vbox->hw_mutex);
     262    /* Disable VBVA when someone sets a new mode until they send us dirty
     263     * rectangles, which proves that they can.  A single screen can work
     264     * without VBVA. */
     265    vbox_disable_accel(vbox);
    262266    rc = vbox_set_view(crtc);
    263267    if (!rc)
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