VirtualBox

Ignore:
Timestamp:
Feb 5, 2016 2:36:27 PM (9 years ago)
Author:
vboxsync
Message:

bugref:8087: Additions/x11: support non-root X server: add kernel driver support for hot-plug notification via IRQs and clean up VBVA enabling and disabling somewhat.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/drm/Makefile.kmk

    r59552 r59597  
    7878        vbox_drv.c \
    7979        vbox_fb.c \
     80        vbox_irq.c \
    8081        vbox_main.c \
    8182        vbox_mode.c \
  • trunk/src/VBox/Additions/linux/drm/Makefile.module.kms

    r59558 r59597  
    2525
    2626MOD_OBJS   = HGSMIBase.o HGSMICommon.o HGSMIMemAlloc.o heapoffset.o \
    27              Modesetting.o vbox_drv.o vbox_fb.o vbox_main.o vbox_mode.o \
    28              vbox_ttm.o VBVABase.o
     27             Modesetting.o vbox_drv.o vbox_fb.o vbox_irq.o vbox_main.o \
     28             vbox_mode.o vbox_ttm.o VBVABase.o
    2929
    3030ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxvideo),)
  • trunk/src/VBox/Additions/linux/drm/files_vboxvideo_drv

    r57943 r59597  
    6161    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_drv.h=>vbox_drv.h \
    6262    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_fb.c=>vbox_fb.c \
     63    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_irq.c=>vbox_irq.c \
    6364    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_main.c=>vbox_main.c \
    6465    ${PATH_ROOT}/src/VBox/Additions/linux/drm/vbox_mode.c=>vbox_mode.c \
  • trunk/src/VBox/Additions/linux/drm/vbox_drv.c

    r59568 r59597  
    212212static struct drm_driver driver =
    213213{
    214     .driver_features = DRIVER_MODESET | DRIVER_GEM,
     214    .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ,
    215215    .dev_priv_size = 0,
    216216
     
    222222
    223223    .fops = &vbox_fops,
     224    .irq_handler = vbox_irq_handler,
    224225    .name = DRIVER_NAME,
    225226    .desc = DRIVER_DESC,
  • trunk/src/VBox/Additions/linux/drm/vbox_drv.h

    r59568 r59597  
    9191    struct drm_device *dev;
    9292
    93     void __iomem *vram;
     93    uint8_t __iomem *vram;
    9494    HGSMIGUESTCOMMANDCONTEXT submit_info;
    9595    struct VBVABUFFERCONTEXT *vbva_info;
     
    117117
    118118    spinlock_t dev_lock;
     119    bool isr_installed;
     120    struct work_struct hotplug_work;
    119121};
    120122
     
    123125
    124126struct vbox_gem_object;
     127
     128#ifndef VGA_PORT_HGSMI_HOST
     129# define VGA_PORT_HGSMI_HOST             0x3b0
     130# define VGA_PORT_HGSMI_GUEST            0x3d0
     131#endif
    125132
    126133struct vbox_connector {
     
    188195#endif
    189196
     197void vbox_enable_vbva(struct vbox_private *vbox, unsigned crtc_id);
     198void vbox_enable_caps(struct vbox_private *vbox);
     199
    190200void vbox_framebuffer_dirty_rectangles(struct drm_framebuffer *fb,
    191201                                       struct drm_clip_rect *rects,
     
    276286int vbox_bo_push_sysram(struct vbox_bo *bo);
    277287int vbox_mmap(struct file *filp, struct vm_area_struct *vma);
    278 #endif
     288
     289/* vbox_irq.c */
     290int vbox_irq_init(struct vbox_private *vbox);
     291void vbox_irq_fini(struct vbox_private *vbox);
     292irqreturn_t vbox_irq_handler(int irq, void *arg);
     293#endif
  • trunk/src/VBox/Additions/linux/drm/vbox_main.c

    r59573 r59597  
    6666}
    6767
     68void vbox_enable_vbva(struct vbox_private *vbox, unsigned crtc_id)
     69{
     70    struct VBVABUFFER *pVBVA = vbox->vbva_info[crtc_id].pVBVA;
     71
     72    if (pVBVA == NULL)     {
     73        LogFunc(("vboxvideo: enabling VBVA.\n"));
     74        pVBVA = (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, pVBVA, crtc_id))
     78            AssertReleaseMsgFailed(("VBoxVBVAEnable failed - heap allocation error, very old host or driver error.\n"));
     79    }
     80}
     81
     82void vbox_enable_caps(struct vbox_private *vbox)
     83{
     84    VBoxHGSMISendCapsInfo(&vbox->submit_info, VBVACAPS_VIDEO_MODE_HINTS | VBVACAPS_DISABLE_CURSOR_INTEGRATION | VBVACAPS_IRQ);
     85}
     86
    6887/** Send information about dirty rectangles to VBVA.  If necessary we enable
    6988 * VBVA first, as this is normally disabled after a mode set in case a user
    70  * takes over the console that is not aware of VBVA (i.e. the VESA BIOS). */
     89 * takes over the console that is not aware of VBVA (i.e. the VESA BIOS, and
     90 * particularly the old X.Org VESA driver). */
    7191void vbox_framebuffer_dirty_rectangles(struct drm_framebuffer *fb,
    7292                                       struct drm_clip_rect *rects,
     
    7999    LogFunc(("vboxvideo: %d: fb=%p, num_rects=%u, vbox=%p\n", __LINE__, fb,
    80100             num_rects, vbox));
     101    if (vbox->vbva_info[0].pVBVA == NULL) {
     102        for (i = 0; i < vbox->num_crtcs; ++i)
     103            vbox_enable_vbva(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    }
    81108    spin_lock_irqsave(&vbox->dev_lock, flags);
    82109    for (i = 0; i < num_rects; ++i)
     
    86113        {
    87114            unsigned crtc_id = to_vbox_crtc(crtc)->crtc_id;
    88             struct VBVABUFFER *pVBVA = vbox->vbva_info[crtc_id].pVBVA;
    89115            VBVACMDHDR cmdHdr;
    90116
    91             if (!pVBVA)
    92             {
    93                 LogFunc(("vboxvideo: enabling VBVA.\n"));
    94                 pVBVA = (struct VBVABUFFER *) (  ((uint8_t *)vbox->vram)
    95                                                + vbox->vram_size
    96                                                + crtc_id * VBVA_MIN_BUFFER_SIZE);
    97                 if (!VBoxVBVAEnable(&vbox->vbva_info[crtc_id], &vbox->submit_info, pVBVA, crtc_id))
    98                     AssertReleaseMsgFailed(("VBoxVBVAEnable failed - heap allocation error, very old host or driver error.\n"));
    99                 /* Assume that if the user knows to send dirty rectangle information
    100                  * they can also handle hot-plug events. */
    101                 VBoxHGSMISendCapsInfo(&vbox->submit_info, VBVACAPS_VIDEO_MODE_HINTS | VBVACAPS_DISABLE_CURSOR_INTEGRATION);
    102             }
    103117            if (   CRTC_FB(crtc) != fb
    104118                || rects[i].x1 >   crtc->x
     
    346360    dev->mode_config.max_height = VBE_DISPI_MAX_YRES;
    347361
     362    ret = vbox_irq_init(vbox);
     363    if (ret)
     364        goto out_free;
     365
    348366    ret = vbox_mode_init(dev);
    349367    if (ret)
     
    370388
    371389    LogFunc(("vboxvideo: %d\n", __LINE__));
     390    vbox_fbdev_fini(dev);
    372391    vbox_mode_fini(dev);
    373     vbox_fbdev_fini(dev);
     392    vbox_irq_fini(vbox);
    374393    drm_mode_config_cleanup(dev);
    375394
  • trunk/src/VBox/Additions/linux/drm/vbox_mode.c

    r59568 r59597  
    9999                                vbox_crtc->blanked ? 0 : cBPP, fFlags);
    100100    VBoxHGSMIReportFlagsLocation(&vbox->submit_info, vbox->host_flags_offset);
    101     VBoxHGSMISendCapsInfo(&vbox->submit_info, VBVACAPS_VIDEO_MODE_HINTS | VBVACAPS_DISABLE_CURSOR_INTEGRATION);
     101    vbox_enable_caps(vbox);
    102102    LogFunc(("vboxvideo: %d\n", __LINE__));
    103103}
     
    218218        if (ret)
    219219            DRM_ERROR("failed to kmap fbcon\n");
     220    }
     221    else {
     222        unsigned i;
     223
     224        for (i = 0; i < vbox->num_crtcs; ++i)
     225            vbox_enable_vbva(vbox, i);
    220226    }
    221227    vbox_bo_unreserve(bo);
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