VirtualBox

Changeset 60115 in vbox for trunk/src/VBox/Additions/x11


Ignore:
Timestamp:
Mar 21, 2016 11:26:27 AM (9 years ago)
Author:
vboxsync
Message:

bugref:8288: Additions/x11: rework VBoxClient video mode hint handling: drop resizing without intervention by an X11 client in the vboxvideo user space driver and set a default resolution of 800x600 until a client changes it. In a normal non-log-in-screen X session VBoxClient will be started immediately and do the necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c

    r60083 r60115  
    10111011#endif
    10121012
    1013 #ifdef VBOXVIDEO_13
    1014 
    1015 static void setVirtualSizeRandR12(ScrnInfoPtr pScrn, bool fScreenInitTime)
    1016 {
    1017     VBOXPtr pVBox = VBOXGetRec(pScrn);
    1018     unsigned i;
    1019     unsigned cx = 0;
    1020     unsigned cy = 0;
    1021 
    1022     for (i = 0; i < pVBox->cScreens; ++i)
    1023     {
    1024         if (   pVBox->fHaveHGSMIModeHints && pVBox->pScreens[i].afHaveLocation)
    1025         {
    1026             pVBox->pScreens[i].paCrtcs->x = pVBox->pScreens[i].aPreferredLocation.x;
    1027             pVBox->pScreens[i].paCrtcs->y = pVBox->pScreens[i].aPreferredLocation.y;
    1028         }
    1029         if (   pVBox->pScreens[i].paOutputs->status == XF86OutputStatusConnected
    1030             && pVBox->pScreens[i].paCrtcs->x + pVBox->pScreens[i].aPreferredSize.cx < VBOX_VIDEO_MAX_VIRTUAL
    1031             && pVBox->pScreens[i].paCrtcs->y + pVBox->pScreens[i].aPreferredSize.cy < VBOX_VIDEO_MAX_VIRTUAL)
    1032         {
    1033             cx = max(cx, pVBox->pScreens[i].paCrtcs->x + pVBox->pScreens[i].aPreferredSize.cx);
    1034             cy = max(cy, pVBox->pScreens[i].paCrtcs->y + pVBox->pScreens[i].aPreferredSize.cy);
    1035         }
    1036     }
    1037     if (cx != 0 && cy != 0)
    1038     {
    1039         /* Do not set the virtual resolution in limited context as that can
    1040          * cause problems setting up RandR 1.2 which needs it set to the
    1041          * maximum size at this point. */
    1042         if (!fScreenInitTime)
    1043         {
    1044             TRACE_LOG("cx=%u, cy=%u\n", cx, cy);
    1045             xf86ScrnToScreen(pScrn)->width = cx;
    1046             xf86ScrnToScreen(pScrn)->height = cy;
    1047             xf86ScrnToScreen(pScrn)->mmWidth = cx * 254 / 960;
    1048             xf86ScrnToScreen(pScrn)->mmHeight = cy * 254 / 960;
    1049             adjustScreenPixmap(pScrn, cx, cy);
    1050             vbvxSetSolarisMouseRange(cx, cy);
    1051         }
    1052     }
    1053 }
    1054 
    1055 static void setScreenSizesRandR12(ScrnInfoPtr pScrn, bool fScreenInitTime)
    1056 {
    1057     VBOXPtr pVBox = VBOXGetRec(pScrn);
    1058     unsigned i;
    1059 
    1060     for (i = 0; i < pVBox->cScreens; ++i)
    1061     {
    1062         if (!pVBox->pScreens[i].afConnected)
    1063             continue;
    1064         /* The Crtc can get "unset" if the screen was disconnected previously.
    1065          * I couldn't find an API to re-set it which did not have side-effects.
    1066          */
    1067         pVBox->pScreens[i].paOutputs->crtc = pVBox->pScreens[i].paCrtcs;
    1068         xf86CrtcSetMode(pVBox->pScreens[i].paCrtcs, pVBox->pScreens[i].paOutputs->probed_modes, RR_Rotate_0,
    1069                         pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y);
    1070         if (!fScreenInitTime)
    1071             RRCrtcNotify(pVBox->pScreens[i].paCrtcs->randr_crtc, pVBox->pScreens[i].paOutputs->randr_output->modes[0],
    1072                          pVBox->pScreens[i].paCrtcs->x, pVBox->pScreens[i].paCrtcs->y, RR_Rotate_0,
    1073 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5
    1074                          NULL,
    1075 #endif
    1076                          1, &pVBox->pScreens[i].paOutputs->randr_output);
    1077     }
    1078 }
    1079 
    1080 static void setSizesRandR12(ScrnInfoPtr pScrn, bool fScreenInitTime)
    1081 {
    1082     VBOXPtr pVBox = VBOXGetRec(pScrn);
    1083 
    1084     if (!fScreenInitTime)
    1085     {
    1086 # if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5
    1087         RRGetInfo(xf86ScrnToScreen(pScrn), TRUE);
    1088 # else
    1089         RRGetInfo(xf86ScrnToScreen(pScrn));
    1090 # endif
    1091     }
    1092     setVirtualSizeRandR12(pScrn, fScreenInitTime);
    1093     setScreenSizesRandR12(pScrn, fScreenInitTime);
    1094     if (!fScreenInitTime)
    1095     {
    1096         /* We use RRScreenSizeSet() here and not RRScreenSizeNotify() because
    1097          * the first also pushes the virtual screen size to the input driver.
    1098          * We were doing this manually by setting screenInfo.width and height
    1099          * and calling xf86UpdateDesktopDimensions() where appropriate, but this
    1100          * failed on Ubuntu 12.04.0 due to a problematic X server back-port. */
    1101         RRScreenSizeSet(xf86ScrnToScreen(pScrn), xf86ScrnToScreen(pScrn)->width, xf86ScrnToScreen(pScrn)->height,
    1102                         xf86ScrnToScreen(pScrn)->mmWidth, xf86ScrnToScreen(pScrn)->mmHeight);
    1103         RRTellChanged(xf86ScrnToScreen(pScrn));
    1104     }
    1105 }
    1106 
    1107 #else
     1013#ifndef VBOXVIDEO_13
    11081014
    11091015#define PREFERRED_MODE_ATOM_NAME "VBOXVIDEO_PREFERRED_MODE"
     
    11321038    TRACE_LOG("fScreenInitTime=%d\n", (int)fScreenInitTime);
    11331039#ifdef VBOXVIDEO_13
    1134     setSizesRandR12(pScrn, fScreenInitTime);
     1040# if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5
     1041    RRGetInfo(xf86ScrnToScreen(pScrn), TRUE);
     1042# else
     1043    RRGetInfo(xf86ScrnToScreen(pScrn));
     1044# endif
    11351045#else
    11361046    setSizesRandR11(pScrn);
     
    12471157        return FALSE;
    12481158    VBoxInitialiseSizeHints(pScrn);
    1249     /* Get any screen size hints from HGSMI. */
    1250     vbvxReadSizesAndCursorIntegrationFromHGSMI(pScrn, NULL);
    12511159
    12521160#ifdef VBOXVIDEO_13
     
    13051213
    13061214    /* set first video mode */
    1307     setSizesAndCursorIntegration(pScrn, true);
     1215    if (!xf86SetDesiredModes(pScrn)) {
     1216        return FALSE;
     1217    }
    13081218#else
    13091219    /* set first video mode */
     
    13691279    /* Re-set video mode */
    13701280#ifdef VBOXVIDEO_13
    1371     vbvxReadSizesAndCursorIntegrationFromHGSMI(pScrn, NULL);
    1372     setSizesAndCursorIntegration(pScrn, false);
     1281    if (!xf86SetDesiredModes(pScrn)) {
     1282        return FALSE;
     1283    }
    13731284#else
    13741285    updateGraphicsCapability(pScrn, TRUE);
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