VirtualBox

Changeset 53966 in vbox


Ignore:
Timestamp:
Jan 26, 2015 8:38:30 PM (10 years ago)
Author:
vboxsync
Message:

Devices/Graphics, Main: optionally send cursor integration toggle and guest cursor position information through the graphics device. X11/Linux Additions support.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxVideoGuest.h

    r53530 r53966  
    257257                                             uint8_t *pPixels,
    258258                                             uint32_t cbLength);
     259RTDECL(int)      VBoxHGSMICursorPosition(PHGSMIGUESTCOMMANDCONTEXT pCtx, bool fReportPosition, uint32_t x, uint32_t y,
     260                                         uint32_t *pxHost, uint32_t *pyHost);
    259261
    260262/** @}  */
     
    329331                                             uint16_t cBPP,
    330332                                             uint16_t fFlags);
     333RTDECL(int)      VBoxHGSMIUpdateInputMapping(PHGSMIGUESTCOMMANDCONTEXT pCtx, int32_t  cOriginX, int32_t  cOriginY,
     334                                             uint32_t cWidth, uint32_t cHeight);
    331335RTDECL(int) VBoxHGSMIGetModeHints(PHGSMIGUESTCOMMANDCONTEXT pCtx,
    332336                                  unsigned cScreens, VBVAMODEHINT *paHints);
  • trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp

    r53530 r53966  
    581581
    582582
     583/**
     584 * Report the guest cursor position.  The host may wish to use this information
     585 * to re-position its own cursor (though this is currently unlikely).  The
     586 * current host cursor position is returned.
     587 * @param  pCtx             The context containing the heap used.
     588 * @param  fReportPosition  Are we reporting a position?
     589 * @param  x                Guest cursor X position.
     590 * @param  y                Guest cursor Y position.
     591 * @param  pxHost           Host cursor X position is stored here.  Optional.
     592 * @param  pyHost           Host cursor Y position is stored here.  Optional.
     593 * @returns  iprt status code.
     594 * @returns  VERR_NO_MEMORY      HGSMI heap allocation failed.
     595 */
     596RTDECL(int) VBoxHGSMICursorPosition(PHGSMIGUESTCOMMANDCONTEXT pCtx, bool fReportPosition, uint32_t x, uint32_t y,
     597                                    uint32_t *pxHost, uint32_t *pyHost)
     598{
     599    int rc = VINF_SUCCESS;
     600    VBVACURSORPOSITION *p;
     601    LogRelFlowFunc(("x=%u, y=%u\n", (unsigned)x, (unsigned)y));
     602
     603    /* Allocate the IO buffer. */
     604    p = (VBVACURSORPOSITION *)VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVACURSORPOSITION), HGSMI_CH_VBVA, VBVA_CURSOR_POSITION);
     605    if (p)
     606    {
     607        /* Prepare data to be sent to the host. */
     608        p->fReportPosition = fReportPosition ? 1 : 0;
     609        p->x = x;
     610        p->y = y;
     611        rc = VBoxHGSMIBufferSubmit(pCtx, p);
     612        if (RT_SUCCESS(rc))
     613        {
     614            if (pxHost)
     615                *pxHost = p->x;
     616            if (pyHost)
     617                *pyHost = p->y;
     618            LogRelFlowFunc(("return: x=%u, y=%u\n", (unsigned)x, (unsigned)y));
     619        }
     620        /* Free the IO buffer. */
     621        VBoxHGSMIBufferFree(pCtx, p);
     622    }
     623    else
     624        rc = VERR_NO_MEMORY;
     625    LogFunc(("rc = %d\n", rc));
     626    return rc;
     627}
     628
     629
    583630/** @todo Mouse pointer position to be read from VMMDev memory, address of the memory region
    584631 * can be queried from VMMDev via an IOCTL. This VMMDev memory region will contain
  • trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp

    r53530 r53966  
    280280}
    281281
     282
     283/** Report the rectangle relative to which absolute pointer events should be
     284 *  expressed.  This information remains valid until the next VBVA resize event
     285 *  for any screen, at which time it is reset to the bounding rectangle of all
     286 *  virtual screens.
     287 * @param  pCtx      The context containing the heap to use.
     288 * @param  cOriginX  Upper left X co-ordinate relative to the first screen.
     289 * @param  cOriginY  Upper left Y co-ordinate relative to the first screen.
     290 * @param  cWidth    Rectangle width.
     291 * @param  cHeight   Rectangle height.
     292 * @returns  iprt status code.
     293 * @returns  VERR_NO_MEMORY      HGSMI heap allocation failed.
     294 */
     295RTDECL(int)      VBoxHGSMIUpdateInputMapping(PHGSMIGUESTCOMMANDCONTEXT pCtx, int32_t  cOriginX, int32_t  cOriginY,
     296                                             uint32_t cWidth, uint32_t cHeight)
     297{
     298    int rc = VINF_SUCCESS;
     299    VBVAREPORTINPUTMAPPING *p;
     300    LogRelFlowFunc(("cOriginX=%u, cOriginY=%u, cWidth=%u, cHeight=%u\n",
     301                    (unsigned)cOriginX, (unsigned)cOriginX,
     302                    (unsigned)cWidth, (unsigned)cHeight));
     303
     304    /* Allocate the IO buffer. */
     305    p = (VBVAREPORTINPUTMAPPING *)VBoxHGSMIBufferAlloc(pCtx, sizeof(VBVAREPORTINPUTMAPPING), HGSMI_CH_VBVA,
     306                                                       VBVA_REPORT_INPUT_MAPPING);
     307    if (p)
     308    {
     309        /* Prepare data to be sent to the host. */
     310        p->x  = cOriginX;
     311        p->y  = cOriginY;
     312        p->cx = cWidth;
     313        p->cy = cHeight;
     314        rc = VBoxHGSMIBufferSubmit(pCtx, p);
     315        /* Free the IO buffer. */
     316        VBoxHGSMIBufferFree(pCtx, p);
     317    }
     318    else
     319        rc = VERR_NO_MEMORY;
     320    LogFunc(("rc = %d\n", rc));
     321    return rc;
     322}
     323
     324
    282325/**
    283326 * Get most recent video mode hints.
  • trunk/src/VBox/Additions/x11/VBoxClient/display.cpp

    r53624 r53966  
    2525#include <X11/Xlib.h>
    2626#include <X11/Xatom.h>
    27 #include <X11/cursorfont.h>
    2827
    2928#include <iprt/assert.h>
     
    3938#include "VBoxClient.h"
    4039
    41 /** State information we need for interacting with the X server. */
    42 struct x11State
    43 {
     40/* TESTING: Dynamic resizing and mouse integration toggling should work
     41 * correctly with a range of X servers (pre-1.3, 1.3 and later under Linux, 1.3
     42 * and later under Solaris) with Guest Additions installed.  Switching to a
     43 * virtual terminal while a user session is in place should disable dynamic
     44 * resizing and cursor integration, switching back should re-enable them. */
     45
     46/** Most recent information received for a particular screen. */
     47struct screenInformation
     48{
     49    unsigned cx;
     50    unsigned cy;
     51    unsigned cBPP;
     52    unsigned x;
     53    unsigned y;
     54    bool fEnabled;
     55    bool fUpdateSize;
     56    bool fUpdatePosition;
     57};
     58
     59/** Display magic number, start of a UUID. */
     60#define DISPLAYSTATE_MAGIC UINT32_C(0xf0029993)
     61
     62/** State information needed for the service.  The main VBoxClient code provides
     63 *  the daemon logic needed by all services. */
     64struct DISPLAYSTATE
     65{
     66    /** The service interface. */
     67    struct VBCLSERVICE *pInterface;
     68    /** Magic number for sanity checks. */
     69    uint32_t magic;
     70    /** Are we initialised yet? */
     71    bool mfInit;
    4472    /** The connection to the server. */
    4573    Display *pDisplay;
     
    5078     * would it make sense to use absolute paths on all systems? */
    5179    const char *pcszXrandr;
    52     /** The size of our array of size hints. */
    53     unsigned cSizeHints;
    54     /** Array of size hints.  Large enough to hold the highest display
    55      * number we have had a hint for so far, reallocated when a higher one
    56      * comes.  Zero means no hint for that display. */
    57     long *paSizeHints;
     80    /** The number of screens we are currently aware of. */
     81    unsigned cScreensTracked;
     82    /** Array of information about different screens. */
     83    struct screenInformation *paScreenInformation;
    5884};
    5985
     
    92118}
    93119
    94 static int initX11(struct x11State *pState)
     120static int initDisplay(struct DISPLAYSTATE *pState)
    95121{
    96122    char szCommand[256];
     
    111137    if (WEXITSTATUS(status) == 0)
    112138        pState->fHaveRandR12 = true;
    113     pState->cSizeHints = 0;
    114     pState->paSizeHints = NULL;
     139    pState->cScreensTracked = 0;
     140    pState->paScreenInformation = NULL;
    115141    return VINF_SUCCESS;
    116142}
    117143
    118 static void setModeX11(struct x11State *pState, unsigned cx, unsigned cy,
    119                        unsigned cBPP, unsigned iDisplay, unsigned x,
    120                        unsigned y, bool fEnabled, bool fChangeOrigin)
     144static void updateScreenInformation(struct DISPLAYSTATE *pState, unsigned cx, unsigned cy, unsigned cBPP, unsigned iDisplay,
     145                                    unsigned x, unsigned y, bool fEnabled, bool fUpdatePosition)
     146{
     147    uint32_t i;
     148
     149    if (iDisplay >= pState->cScreensTracked)
     150    {
     151        pState->paScreenInformation =
     152                (struct screenInformation *)RTMemRealloc(pState->paScreenInformation,
     153                                                         (iDisplay + 1) * sizeof(*pState->paScreenInformation));
     154        if (!pState->paScreenInformation)
     155            VBClFatalError(("Failed to re-allocate screen information.\n"));
     156        for (i = pState->cScreensTracked; i < iDisplay + 1; ++i)
     157            RT_ZERO(pState->paScreenInformation[i]);
     158        pState->cScreensTracked = iDisplay + 1;
     159    }
     160    pState->paScreenInformation[iDisplay].cx = cx;
     161    pState->paScreenInformation[iDisplay].cy = cy;
     162    pState->paScreenInformation[iDisplay].cBPP = cBPP;
     163    pState->paScreenInformation[iDisplay].x = x;
     164    pState->paScreenInformation[iDisplay].y = y;
     165    pState->paScreenInformation[iDisplay].fEnabled = fEnabled;
     166    pState->paScreenInformation[iDisplay].fUpdateSize = true;
     167    pState->paScreenInformation[iDisplay].fUpdatePosition = fUpdatePosition;
     168}
     169
     170static void updateSizeHintsProperty(struct DISPLAYSTATE *pState)
     171{
     172    int32_t *paSizeHints = (int32_t *)RTMemTmpAllocZ(pState->cScreensTracked * sizeof(int32_t));
     173    unsigned i;
     174
     175    if (paSizeHints == NULL)
     176        VBClFatalError(("Failed to allocate size hint property memory.\n"));
     177    for (i = 0; i < pState->cScreensTracked; ++i)
     178    {
     179        if (   pState->paScreenInformation[i].fEnabled
     180            && pState->paScreenInformation[i].cx != 0 && pState->paScreenInformation[i].cy != 0)
     181            paSizeHints[i] = (pState->paScreenInformation[i].cx & 0x8fff) << 16 | (pState->paScreenInformation[i].cy & 0x8fff);
     182        else if (pState->paScreenInformation[i].cx != 0 && pState->paScreenInformation[i].cy != 0)
     183            paSizeHints[i] = -1;
     184    }
     185    XChangeProperty(pState->pDisplay, DefaultRootWindow(pState->pDisplay), XInternAtom(pState->pDisplay, "VBOX_SIZE_HINTS", 0),
     186                    XA_INTEGER, 32, PropModeReplace, (unsigned char *)paSizeHints, pState->cScreensTracked);
     187    XFlush(pState->pDisplay);
     188    RTMemTmpFree(paSizeHints);
     189}
     190
     191static void notifyXServer(struct DISPLAYSTATE *pState)
    121192{
    122193    char szCommand[256];
    123     uint32_t i;
     194    unsigned i;
     195    bool fUpdateInformation = false;
    124196
    125197    /** @note The xrandr command can fail if something else accesses RandR at
    126198     *  the same time.  We just ignore failure for now and let the user try
    127199     *  again as we do not know what someone else is doing. */
    128     if (iDisplay >= pState->cSizeHints)
     200    for (i = 0; i < pState->cScreensTracked; ++i)
     201        if (pState->paScreenInformation[i].fUpdateSize)
     202            fUpdateInformation = true;
     203    if (   !pState->fHaveRandR12 && pState->paScreenInformation[0].fUpdateSize
     204        && pState->paScreenInformation[0].cx > 0 && pState->paScreenInformation[0].cy > 0)
    129205    {
    130         pState->paSizeHints = (long *)RTMemRealloc(pState->paSizeHints,
    131                                                   (iDisplay + 1)
    132                                                 * sizeof(*pState->paSizeHints));
    133         if (!pState->paSizeHints)
    134             VBClFatalError(("Failed to re-allocate size hint memory.\n"));
    135         for (i = pState->cSizeHints; i < iDisplay + 1; ++i)
    136             pState->paSizeHints[i] = 0;
    137         pState->cSizeHints = iDisplay + 1;
     206        RTStrPrintf(szCommand, sizeof(szCommand), "%s -s %ux%u",
     207                    pState->pcszXrandr, pState->paScreenInformation[0].cx, pState->paScreenInformation[0].cy);
     208        system(szCommand);
     209        pState->paScreenInformation[0].fUpdateSize = false;
    138210    }
    139     if (!fEnabled || (cx != 0 && cy != 0))
     211    else if (pState->fHaveRandR12 && fUpdateInformation)
     212        for (i = 0; i < pState->cScreensTracked; ++i)
     213        {
     214            if (pState->paScreenInformation[i].fUpdateSize)
     215            {
     216                RTStrPrintf(szCommand, sizeof(szCommand), "%s --output VGA-%u --preferred", pState->pcszXrandr, i);
     217                system(szCommand);
     218            }
     219            if (pState->paScreenInformation[i].fUpdatePosition)
     220            {
     221                RTStrPrintf(szCommand, sizeof(szCommand), "%s --output VGA-%u --auto --pos %ux%u",
     222                            pState->pcszXrandr, i, pState->paScreenInformation[i].x, pState->paScreenInformation[i].y);
     223                system(szCommand);
     224            }
     225            pState->paScreenInformation[i].fUpdateSize = pState->paScreenInformation[i].fUpdatePosition = false;
     226        }
     227    else
    140228    {
    141         pState->paSizeHints[iDisplay] = (cx & 0x8fff) << 16 | (cy & 0x8fff);
    142         XChangeProperty(pState->pDisplay, DefaultRootWindow(pState->pDisplay),
    143                         XInternAtom(pState->pDisplay, "VBOX_SIZE_HINTS", 0),
    144                         XA_INTEGER, 32, PropModeReplace,
    145                         (unsigned char *)pState->paSizeHints,
    146                         pState->cSizeHints);
    147         XFlush(pState->pDisplay);
    148     }
    149     if (!pState->fHaveRandR12)
    150     {
    151         RTStrPrintf(szCommand, sizeof(szCommand),
    152                     "%s -s %ux%u", pState->pcszXrandr, cx, cy);
     229        RTStrPrintf(szCommand, sizeof(szCommand), "%s", pState->pcszXrandr);
    153230        system(szCommand);
    154231    }
     232}
     233
     234static void updateMouseCapabilities(struct DISPLAYSTATE *pState)
     235{
     236    uint32_t fFeatures = 0;
     237    int rc;
     238    unsigned i;
     239
     240    rc = VbglR3GetMouseStatus(&fFeatures, NULL, NULL);
     241   
     242    if (rc != VINF_SUCCESS)
     243        VBClFatalError(("Failed to get mouse status, rc=%Rrc\n", rc));
     244    XChangeProperty(pState->pDisplay, DefaultRootWindow(pState->pDisplay),
     245                    XInternAtom(pState->pDisplay, "VBOX_MOUSE_CAPABILITIES", 0), XA_INTEGER, 32, PropModeReplace,
     246                    (unsigned char *)&fFeatures, 1);
     247    XFlush(pState->pDisplay);
     248    if (pState->fHaveRandR12)
     249        for (i = 0; i < pState->cScreensTracked; ++i)
     250            pState->paScreenInformation[i].fUpdateSize = true;
    155251    else
    156     {
    157         if (fChangeOrigin && fEnabled)
    158         {
    159             /* Extended Display support possible . Secondary monitor
    160              * position supported */
    161             RTStrPrintf(szCommand, sizeof(szCommand),
    162                         "%s --output VGA-%u --auto --pos %ux%u",
    163                         pState->pcszXrandr, iDisplay, x, y);
    164             system(szCommand);
    165         }
    166         if ((!fChangeOrigin || fEnabled) && cx != 0 && cy != 0)
    167         {
    168             RTStrPrintf(szCommand, sizeof(szCommand),
    169                         "%s --output VGA-%u --preferred",
    170                         pState->pcszXrandr, iDisplay);
    171             system(szCommand);
    172         }
    173         if (!fEnabled)
    174         {
    175             /* disable the virtual monitor */
    176             RTStrPrintf(szCommand, sizeof(szCommand),
    177                         "%s --output VGA-%u --off",
    178                          pState->pcszXrandr, iDisplay);
    179             system(szCommand);
    180         }
    181     }
     252        pState->paScreenInformation[0].fUpdateSize = true;
    182253}
    183254
    184255/**
    185256 * Display change request monitor thread function.
    186  * Before entering the loop, we re-read the last request
    187  * received, and if the first one received inside the
    188  * loop is identical we ignore it, because it is probably
    189  * stale.
    190257 */
    191 static void runDisplay(struct x11State *pState)
     258static void runDisplay(struct DISPLAYSTATE *pState)
    192259{
    193260    int status, rc;
    194     unsigned i, cScreens;
     261    unsigned i, cScreensTracked;
    195262    char szCommand[256];
    196     Cursor hClockCursor = XCreateFontCursor(pState->pDisplay, XC_watch);
    197     Cursor hArrowCursor = XCreateFontCursor(pState->pDisplay, XC_left_ptr);
    198263
    199264    LogRelFlowFunc(("\n"));
    200     rc = VbglR3VideoModeGetHighestSavedScreen(&cScreens);
     265    rc = VbglR3VideoModeGetHighestSavedScreen(&cScreensTracked);
    201266    if (rc != VINF_SUCCESS && rc != VERR_NOT_SUPPORTED)
    202         VBClFatalError(("Failed to get the number of saved screen modes, rc=%Rrc\n",
    203                     rc));
     267        VBClFatalError(("Failed to get the number of saved screen modes, rc=%Rrc\n", rc));
     268    /* Make sure that we have an entry for screen 1 at least. */
     269    updateScreenInformation(pState, 1024, 768, 0, 1, 0, 0, true, false);
    204270    if (rc == VINF_SUCCESS)
    205         /* The "8" is to sanity test that VbglR3VideoModeGetHighestSavedScreen()
    206          * worked right. */
    207         for (i = 0; i < RT_MAX(cScreens + 1, 8); ++i)
     271        /* The "8" is for the sanity test below. */
     272        for (i = 0; i < RT_MAX(cScreensTracked + 1, 8); ++i)
    208273        {
    209274            unsigned cx = 0, cy = 0, cBPP = 0, x = 0, y = 0;
     
    212277            rc = VbglR3RetrieveVideoMode(i, &cx, &cy, &cBPP, &x, &y,
    213278                                         &fEnabled);
    214             /* Sanity test. */
    215             if (i > cScreens && rc != VERR_NOT_FOUND)
     279            /* Sanity test for VbglR3VideoModeGetHighestSavedScreen(). */
     280            if (i > cScreensTracked && rc != VERR_NOT_FOUND)
    216281                VBClFatalError(("Internal error retrieving the number of saved screen modes.\n"));
    217282            if (rc == VINF_SUCCESS)
    218                 setModeX11(pState, cx, cy, cBPP, i, x, y, fEnabled,
    219                            true);
     283                updateScreenInformation(pState, cx, cy, cBPP, i, x, y, fEnabled, true);
    220284        }
    221285    while (true)
    222286    {
    223287        uint32_t fEvents;
     288        updateMouseCapabilities(pState);
     289        updateSizeHintsProperty(pState);
     290        notifyXServer(pState);
    224291        do
    225292            rc = VbglR3WaitEvent(  VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST
     
    229296        if (RT_FAILURE(rc))  /* VERR_NO_MEMORY? */
    230297            VBClFatalError(("event wait failed, rc=%Rrc\n", rc));
    231         if (fEvents & VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED)
    232         {
    233             /* Jiggle the mouse pointer to trigger a switch to a software
    234              * cursor if necessary. */
    235             XGrabPointer(pState->pDisplay,
    236                          DefaultRootWindow(pState->pDisplay), true, 0,
    237                          GrabModeAsync, GrabModeAsync, None, hClockCursor,
    238                          CurrentTime);
    239             XFlush(pState->pDisplay);
    240             XGrabPointer(pState->pDisplay,
    241                          DefaultRootWindow(pState->pDisplay), true, 0,
    242                          GrabModeAsync, GrabModeAsync, None, hArrowCursor,
    243                          CurrentTime);
    244             XFlush(pState->pDisplay);
    245             XUngrabPointer(pState->pDisplay, CurrentTime);
    246             XFlush(pState->pDisplay);
    247         }
    248         /* And if it is a size hint, set the new size. */
     298        /* If it is a size hint, set the new size. */
    249299        if (fEvents & VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST)
    250300        {
    251301            uint32_t cx = 0, cy = 0, cBPP = 0, iDisplay = 0, x = 0, y = 0;
    252             bool fEnabled = true, fChangeOrigin = true;
     302            bool fEnabled = true, fUpdatePosition = true;
    253303            VMMDevSeamlessMode Mode;
    254304
    255305            rc = VbglR3GetDisplayChangeRequest(&cx, &cy, &cBPP, &iDisplay,
    256306                                               &x, &y, &fEnabled,
    257                                                &fChangeOrigin, true);
    258             /* Extended display version not supported on host */
     307                                               &fUpdatePosition, true);
    259308            if (rc != VINF_SUCCESS)
    260309                VBClFatalError(("Failed to get display change request, rc=%Rrc\n",
     
    262311            else
    263312                LogRelFlowFunc(("Got size hint from host cx=%d, cy=%d, bpp=%d, iDisplay=%d, x=%d, y=%d fEnabled=%d\n",
    264                                 cx, cy, cBPP, iDisplay, x, y,
    265                                 fEnabled));
     313                                cx, cy, cBPP, iDisplay, x, y, fEnabled));
    266314            if (iDisplay > INT32_MAX)
    267315                VBClFatalError(("Received a size hint for too high display number %u\n",
    268316                            (unsigned) iDisplay));
     317            updateScreenInformation(pState, cx, cy, cBPP, i, x, y, fEnabled, fUpdatePosition);
    269318            rc = VbglR3SeamlessGetLastEvent(&Mode);
    270319            if (RT_FAILURE(rc))
     
    277326                    VBClFatalError(("Failed to save size hint, rc=%Rrc\n", rc));
    278327            }
    279             setModeX11(pState, cx, cy, cBPP, iDisplay, x, y, fEnabled,
    280                        fChangeOrigin);
    281328        }
    282329    }
    283330}
    284331
    285 /** Display magic number, start of a UUID. */
    286 #define DISPLAYSERVICE_MAGIC 0xf0029993
    287 
    288 /** VBoxClient service class wrapping the logic for the display service while
    289  *  the main VBoxClient code provides the daemon logic needed by all services.
    290  */
    291 struct DISPLAYSERVICE
    292 {
    293     /** The service interface. */
    294     struct VBCLSERVICE *pInterface;
    295     /** Magic number for sanity checks. */
    296     uint32_t magic;
    297     /** State related to the X server. */
    298     struct x11State mState;
    299     /** Are we initialised yet? */
    300     bool mfInit;
    301 };
    302 
    303332static const char *getPidFilePath()
    304333{
     
    306335}
    307336
    308 static struct DISPLAYSERVICE *getClassFromInterface(struct VBCLSERVICE **
    309                                                          ppInterface)
    310 {
    311     struct DISPLAYSERVICE *pSelf = (struct DISPLAYSERVICE *)ppInterface;
    312     if (pSelf->magic != DISPLAYSERVICE_MAGIC)
     337static struct DISPLAYSTATE *getStateFromInterface(struct VBCLSERVICE **ppInterface)
     338{
     339    struct DISPLAYSTATE *pSelf = (struct DISPLAYSTATE *)ppInterface;
     340    if (pSelf->magic != DISPLAYSTATE_MAGIC)
    313341        VBClFatalError(("Bad display service object!\n"));
    314342    return pSelf;
     
    317345static int init(struct VBCLSERVICE **ppInterface)
    318346{
    319     struct DISPLAYSERVICE *pSelf = getClassFromInterface(ppInterface);
     347    struct DISPLAYSTATE *pSelf = getStateFromInterface(ppInterface);
    320348    int rc;
    321349
    322350    if (pSelf->mfInit)
    323351        return VERR_WRONG_ORDER;
    324     rc = initX11(&pSelf->mState);
     352    rc = initDisplay(pSelf);
    325353    if (RT_FAILURE(rc))
    326354        return rc;
     
    333361static int run(struct VBCLSERVICE **ppInterface, bool fDaemonised)
    334362{
    335     struct DISPLAYSERVICE *pSelf = getClassFromInterface(ppInterface);
     363    struct DISPLAYSTATE *pSelf = getStateFromInterface(ppInterface);
    336364    int rc;
    337365
     
    341369    if (RT_FAILURE(rc))
    342370        VBClFatalError(("Failed to start the VT monitor thread: %Rrc\n", rc));
    343     runDisplay(&pSelf->mState);
     371    runDisplay(pSelf);
    344372    return VERR_INTERNAL_ERROR;  /* "Should never reach here." */
    345373}
     
    347375static int pause(struct VBCLSERVICE **ppInterface)
    348376{
    349     struct DISPLAYSERVICE *pSelf = getClassFromInterface(ppInterface);
     377    struct DISPLAYSTATE *pSelf = getStateFromInterface(ppInterface);
    350378
    351379    if (!pSelf->mfInit)
     
    356384static int resume(struct VBCLSERVICE **ppInterface)
    357385{
    358     struct DISPLAYSERVICE *pSelf = getClassFromInterface(ppInterface);
     386    struct DISPLAYSTATE *pSelf = getStateFromInterface(ppInterface);
    359387
    360388    if (!pSelf->mfInit)
     
    381409struct VBCLSERVICE **VBClGetDisplayService()
    382410{
    383     struct DISPLAYSERVICE *pService =
    384         (struct DISPLAYSERVICE *)RTMemAlloc(sizeof(*pService));
     411    struct DISPLAYSTATE *pService = (struct DISPLAYSTATE *)RTMemAlloc(sizeof(*pService));
    385412
    386413    if (!pService)
    387414        VBClFatalError(("Out of memory\n"));
    388415    pService->pInterface = &vbclDisplayInterface;
    389     pService->magic = DISPLAYSERVICE_MAGIC;
     416    pService->magic = DISPLAYSTATE_MAGIC;
    390417    pService->mfInit = false;
    391418    return &pService->pInterface;
  • trunk/src/VBox/Additions/x11/vboxvideo/getmode.c

    r53812 r53966  
    1717
    1818#include "vboxvideo.h"
     19#include <VBox/VMMDev.h>
    1920
    2021#define NEED_XF86_TYPES
     
    249250}
    250251
    251 # define SIZE_HINTS_PROPERTY "VBOX_SIZE_HINTS"
     252static void updateUseHardwareCursor(VBOXPtr pVBox, uint32_t fCursorCapabilities)
     253{
     254    bool fGuestCanReportAbsolutePosition = false;
     255    bool fHostWishesToReportAbsolutePosition = false;
     256
     257    if (   (fCursorCapabilities & VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE)
     258#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5
     259            /* As of this version (server 1.6) all major Linux releases
     260             * are known to handle USB tablets correctly. */
     261        || (fCursorCapabilities & VMMDEV_MOUSE_HOST_HAS_ABS_DEV)
     262#endif
     263        )
     264        fGuestCanReportAbsolutePosition = true;
     265    if (   !(fCursorCapabilities & VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER)
     266        && (fCursorCapabilities & VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE))
     267        fHostWishesToReportAbsolutePosition = true;
     268    pVBox->fUseHardwareCursor = fGuestCanReportAbsolutePosition && fHostWishesToReportAbsolutePosition;
     269}
     270
     271# define SIZE_HINTS_PROPERTY         "VBOX_SIZE_HINTS"
     272# define MOUSE_CAPABILITIES_PROPERTY "VBOX_MOUSE_CAPABILITIES"
    252273
    253274/** Read in information about the most recent size hints requested for the
    254275 * guest screens.  A client application sets the hint information as a root
    255276 * window property. */
     277/* TESTING: dynamic resizing and absolute pointer toggling work on old guest X servers and recent ones on Linux at the log-in screen. */
     278/** @note we try to maximise code coverage by typically using all code paths (HGSMI and properties) in a single X session. */
    256279void VBoxUpdateSizeHints(ScrnInfoPtr pScrn)
    257280{
    258281    VBOXPtr pVBox = VBOXGetRec(pScrn);
    259     size_t cModes;
    260     int32_t *paModes;
     282    size_t cModesFromProperty, cDummy;
     283    int32_t *paModeHints, *pfCursorCapabilities;
    261284    unsigned i;
    262 
     285    uint32_t fCursorCapabilities;
     286    bool fOldUseHardwareCursor = pVBox->fUseHardwareCursor;
     287
     288    if (vbvxGetIntegerPropery(pScrn, SIZE_HINTS_PROPERTY, &cModesFromProperty, &paModeHints) != VINF_SUCCESS)
     289        paModeHints = NULL;
     290    if (   vbvxGetIntegerPropery(pScrn, MOUSE_CAPABILITIES_PROPERTY, &cDummy, &pfCursorCapabilities) != VINF_SUCCESS
     291        || cDummy != 1)
     292        pfCursorCapabilities = NULL;
    263293#ifdef VBOXVIDEO_13
    264     if (RT_SUCCESS(VBoxHGSMIGetModeHints(&pVBox->guestCtx, pVBox->cScreens,
    265                                          pVBox->paVBVAModeHints)))
     294    if (!pVBox->fHaveReadHGSMIModeHintData && RT_SUCCESS(VBoxHGSMIGetModeHints(&pVBox->guestCtx, pVBox->cScreens,
     295                                                         pVBox->paVBVAModeHints)))
    266296    {
    267297        for (i = 0; i < pVBox->cScreens; ++i)
     
    269299            if (pVBox->paVBVAModeHints[i].magic == VBVAMODEHINT_MAGIC)
    270300            {
    271                 pVBox->pScreens[i].aPreferredSize.cx =
    272                     pVBox->paVBVAModeHints[i].cx;
    273                 pVBox->pScreens[i].aPreferredSize.cy =
    274                     pVBox->paVBVAModeHints[i].cy;
    275                 pVBox->pScreens[i].afConnected =
    276                     pVBox->paVBVAModeHints[i].fEnabled;
     301                pVBox->pScreens[i].aPreferredSize.cx = pVBox->paVBVAModeHints[i].cx;
     302                pVBox->pScreens[i].aPreferredSize.cy = pVBox->paVBVAModeHints[i].cy;
     303                pVBox->pScreens[i].afConnected = pVBox->paVBVAModeHints[i].fEnabled;
     304                /* Do not re-read this if we have data from HGSMI. */
     305                if (paModeHints != NULL && i < cModesFromProperty)
     306                    pVBox->pScreens[i].lastModeHintFromProperty = paModeHints[i];
    277307            }
    278308        }
    279         return;
    280     }
     309    }
     310    if (!pVBox->fHaveReadHGSMIModeHintData)
     311    {
     312        if (RT_SUCCESS(VBoxQueryConfHGSMI(&pVBox->guestCtx, VBOX_VBVA_CONF32_CURSOR_CAPABILITIES, &fCursorCapabilities)))
     313            updateUseHardwareCursor(pVBox, fCursorCapabilities);
     314        else
     315            pVBox->fUseHardwareCursor = false;
     316        /* Do not re-read this if we have data from HGSMI. */
     317        if (pfCursorCapabilities != NULL)
     318            pVBox->fLastCursorCapabilitiesFromProperty = *pfCursorCapabilities;
     319    }
     320    pVBox->fHaveReadHGSMIModeHintData = true;
    281321#endif
    282     if (vbvxGetIntegerPropery(pScrn, SIZE_HINTS_PROPERTY, &cModes, &paModes) != VINF_SUCCESS)
    283         return;
    284     for (i = 0; i < cModes && i < pVBox->cScreens; ++i)
    285     {
    286         if (paModes[i] != 0)
     322    if (paModeHints != NULL)
     323        for (i = 0; i < cModesFromProperty && i < pVBox->cScreens; ++i)
    287324        {
    288             pVBox->pScreens[i].aPreferredSize.cx =
    289                 paModes[i] >> 16;
    290             pVBox->pScreens[i].aPreferredSize.cy =
    291                 paModes[i] & 0x8fff;
     325            if (paModeHints[i] != 0 && paModeHints[i] != pVBox->pScreens[i].lastModeHintFromProperty)
     326            {
     327                if (paModeHints[i] == -1)
     328                    pVBox->pScreens[i].afConnected = false;
     329                else
     330                {
     331                    pVBox->pScreens[i].aPreferredSize.cx = paModeHints[i] >> 16;
     332                    pVBox->pScreens[i].aPreferredSize.cy = paModeHints[i] & 0x8fff;
     333                    pVBox->pScreens[i].afConnected = true;
     334                }
     335                pVBox->pScreens[i].lastModeHintFromProperty = paModeHints[i];
     336            }
    292337        }
    293     }
     338    if (pfCursorCapabilities != NULL && *pfCursorCapabilities != pVBox->fLastCursorCapabilitiesFromProperty)
     339    {
     340        updateUseHardwareCursor(pVBox, (uint32_t)*pfCursorCapabilities);
     341        pVBox->fLastCursorCapabilitiesFromProperty = *pfCursorCapabilities;
     342    }
     343    pVBox->fForceModeSet = (pVBox->fUseHardwareCursor != fOldUseHardwareCursor);
    294344}
    295345
     
    302352static int (*g_pfnVBoxRandRSwappedProc)(ClientPtr) = NULL;
    303353
     354/* TESTING: dynamic resizing and toggling cursor integration work with older guest X servers (1.2 and older). */
    304355static void vboxRandRDispatchCore(ClientPtr pClient)
    305356{
     
    318369    pScrn = xf86Screens[pWin->drawable.pScreen->myNum];
    319370    pVBox = VBOXGetRec(pScrn);
     371    TRACE_LOG("pVBox->fForceModeSet=%u, pVBox->fUseHardwareCursor=%u\n", (unsigned)pVBox->fForceModeSet,
     372              pVBox->fUseHardwareCursor);
    320373    VBoxUpdateSizeHints(pScrn);
    321374    pMode = pScrn->modes;
    322375    if (pScrn->currentMode == pMode)
    323         pMode = pMode->next;
     376    {
     377        if (pVBox->fForceModeSet)  /* Swap modes so that the new mode is before the current one. */
     378        {
     379            pScrn->currentMode = pMode->next;
     380            pMode->next->HDisplay = pMode->HDisplay;
     381            pMode->next->VDisplay = pMode->VDisplay;
     382        }
     383        else
     384            pMode = pMode->next;
     385    }
    324386    pMode->HDisplay = pVBox->pScreens[0].aPreferredSize.cx;
    325387    pMode->VDisplay = pVBox->pScreens[0].aPreferredSize.cy;
     388    pVBox->fForceModeSet = false;
    326389}
    327390
     
    413476#ifdef VBOXVIDEO_13
    414477# ifdef RT_OS_LINUX
     478/* TESTING: dynamic resizing works on recent Linux guest X servers at the log-in screen. */
     479/** @note to maximise code coverage we only read data from HGSMI once, and only when responding to an ACPI event. */
    415480static void acpiEventHandler(int fd, void *pvData)
    416481{
     482    ScreenPtr pScreen = (ScreenPtr)pvData;
     483    VBOXPtr pVBox = VBOXGetRec(xf86Screens[pScreen->myNum]);
    417484    struct input_event event;
    418485    ssize_t rc;
    419486
    420     RRGetInfo((ScreenPtr)pvData
     487    pVBox->fHaveReadHGSMIModeHintData = false;
     488    RRGetInfo(pScreen
    421489# if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5
    422490              , TRUE
    423491# endif
    424492             );
     493    VBVXASSERT(pVBox->fHaveReadHGSMIModeHintData == true, ("fHaveReadHGSMIModeHintData not set.\n"));
    425494    do
    426495        rc = read(fd, &event, sizeof(event));
    427496    while (rc > 0 || (rc == -1 && errno == EINTR));
    428     if (rc == -1 && errno != EAGAIN)  /* Why not just return 0? */
    429         FatalError("Reading ACPI input event failed.\n");
     497    /* Why do they return EAGAIN instead of zero bytes read like everyone else does? */
     498    VBVXASSERT(rc != -1 || errno == EAGAIN, ("Reading ACPI input event failed.\n"));
    430499}
    431500
  • trunk/src/VBox/Additions/x11/vboxvideo/pointer.c

    r53428 r53966  
    1515 */
    1616
    17 #include <VBox/VMMDev.h>
    1817#include <VBox/VBoxGuestLib.h>
    1918
     
    112111
    113112/**************************************************************************
    114 * Helper functions and macros                                             *
    115 **************************************************************************/
    116 
    117 /* This is called by the X server every time it loads a new cursor to see
    118  * whether our "cursor hardware" can handle the cursor.  This provides us with
    119  * a mechanism (the only one!) to switch back from a software to a hardware
    120  * cursor. */
    121 static Bool
    122 vbox_host_uses_hwcursor(ScrnInfoPtr pScrn)
    123 {
    124     Bool rc = TRUE;
    125     uint32_t fFeatures = 0;
    126     VBOXPtr pVBox = pScrn->driverPrivate;
    127 
    128     /* We may want to force the use of a software cursor.  Currently this is
    129      * needed if the guest uses a large virtual resolution, as in this case
    130      * the host and guest tend to disagree about the pointer location. */
    131     if (pVBox->forceSWCursor)
    132         rc = FALSE;
    133     /* Query information about mouse integration from the host. */
    134     if (rc) {
    135         int vrc = VbglR3GetMouseStatus(&fFeatures, NULL, NULL);
    136         if (RT_FAILURE(vrc))
    137             rc = FALSE;
    138     }
    139     /* If we got the information from the host then make sure the host wants
    140      * to draw the pointer. */
    141     if (rc)
    142     {
    143         if (   (fFeatures & VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE)
    144 #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 5
    145                 /* As of this version (server 1.6) all major Linux releases
    146                  * are known to handle USB tablets correctly. */
    147             || (fFeatures & VMMDEV_MOUSE_HOST_HAS_ABS_DEV)
    148 #endif
    149             )
    150             /* Assume this will never be unloaded as long as the X session is
    151              * running. */
    152             pVBox->guestCanAbsolute = TRUE;
    153         if (   (fFeatures & VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER)
    154             || !pVBox->guestCanAbsolute
    155             || !(fFeatures & VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE)
    156            )
    157             rc = FALSE;
    158     }
    159     return rc;
    160 }
    161 
    162 /**************************************************************************
    163113* Main functions                                                          *
    164114**************************************************************************/
     
    174124}
    175125
    176 Bool
    177 vbox_init(int scrnIndex, VBOXPtr pVBox)
    178 {
    179     Bool rc = TRUE;
    180     int vrc;
    181     uint32_t fMouseFeatures = 0;
    182 
    183     TRACE_ENTRY();
    184     vrc = VbglR3Init();
    185     if (RT_FAILURE(vrc))
    186     {
    187         xf86DrvMsg(scrnIndex, X_ERROR,
    188                    "Failed to initialize the VirtualBox device (rc=%d) - make sure that the VirtualBox guest additions are properly installed.  If you are not sure, try reinstalling them.  The X Window graphics drivers will run in compatibility mode.\n",
    189                    vrc);
    190         rc = FALSE;
    191     }
    192     pVBox->useDevice = rc;
    193     return rc;
    194 }
    195 
    196126static void
    197127vbox_vmm_hide_cursor(ScrnInfoPtr pScrn, VBOXPtr pVBox)
     
    200130
    201131    rc = VBoxHGSMIUpdatePointerShape(&pVBox->guestCtx, 0, 0, 0, 0, 0, NULL, 0);
    202     if (RT_FAILURE(rc))
    203     {
    204         xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not hide the virtual mouse pointer, VBox error %d.\n", rc);
    205         /* Play safe, and disable the hardware cursor until the next mode
    206          * switch, since obviously something happened that we didn't
    207          * anticipate. */
    208         pVBox->forceSWCursor = TRUE;
    209     }
     132    VBVXASSERT(rc == VINF_SUCCESS, ("Could not hide the virtual mouse pointer, VBox error %d.\n", rc));
    210133}
    211134
     
    215138    int rc;
    216139
    217     if (!vbox_host_uses_hwcursor(pScrn))
     140    if (!pVBox->fUseHardwareCursor)
    218141        return;
    219142    rc = VBoxHGSMIUpdatePointerShape(&pVBox->guestCtx, VBOX_MOUSE_POINTER_VISIBLE,
    220143                                     0, 0, 0, 0, NULL, 0);
    221     if (RT_FAILURE(rc)) {
    222         xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not unhide the virtual mouse pointer.\n");
    223         /* Play safe, and disable the hardware cursor until the next mode
    224          * switch, since obviously something happened that we didn't
    225          * anticipate. */
    226         pVBox->forceSWCursor = TRUE;
    227     }
     144    VBVXASSERT(rc == VINF_SUCCESS, ("Could not unhide the virtual mouse pointer.\n"));
    228145}
    229146
     
    243160             pImage->cHotX, pImage->cHotY, pImage->cWidth, pImage->cHeight,
    244161             pImage->pPixels, pImage->cbLength);
    245     if (RT_FAILURE(rc)) {
    246         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,  "Unable to set the virtual mouse pointer image.\n");
    247         /* Play safe, and disable the hardware cursor until the next mode
    248          * switch, since obviously something happened that we didn't
    249          * anticipate. */
    250         pVBox->forceSWCursor = TRUE;
    251     }
     162    VBVXASSERT(rc == VINF_SUCCESS, ("Unable to set the virtual mouse pointer image.\n"));
    252163}
    253164
     
    265176vbox_set_cursor_position(ScrnInfoPtr pScrn, int x, int y)
    266177{
    267     /* Nothing to do here, as we are telling the guest where the mouse is,
    268      * not vice versa. */
    269     NOREF(pScrn);
    270     NOREF(x);
    271     NOREF(y);
     178    VBOXPtr pVBox = pScrn->driverPrivate;
     179
     180    /* This currently does nothing. */
     181    VBoxHGSMICursorPosition(&pVBox->guestCtx, true, x, y, NULL, NULL);
    272182}
    273183
     
    300210{
    301211    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    302     return vbox_host_uses_hwcursor(pScrn);
     212    VBOXPtr pVBox = pScrn->driverPrivate;
     213    return pVBox->fUseHardwareCursor;
    303214}
    304215
     
    433344{
    434345    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    435     Bool rc = TRUE;
    436 
    437     if (!vbox_host_uses_hwcursor(pScrn))
    438         rc = FALSE;
    439     if (   rc
    440         && (   (pCurs->bits->height > VBOX_MAX_CURSOR_HEIGHT)
    441             || (pCurs->bits->width > VBOX_MAX_CURSOR_WIDTH)
    442             || (pScrn->bitsPerPixel <= 8)
    443            )
    444        )
    445         rc = FALSE;
    446     return rc;
     346    VBOXPtr pVBox = pScrn->driverPrivate;
     347
     348    if (!pVBox->fUseHardwareCursor)
     349        return FALSE;
     350    if (   (pCurs->bits->height > VBOX_MAX_CURSOR_HEIGHT)
     351        || (pCurs->bits->width > VBOX_MAX_CURSOR_WIDTH)
     352        || (pScrn->bitsPerPixel <= 8))
     353        return FALSE;
     354    return TRUE;
    447355}
    448356
     
    565473#endif
    566474
    567         /* Hide the host cursor before we initialise if we wish to use a
    568          * software cursor. */
    569         if (pVBox->forceSWCursor)
    570             vbox_vmm_hide_cursor(pScrn, pVBox);
    571475        rc = xf86InitCursor(pScreen, pCurs);
    572476    }
  • trunk/src/VBox/Additions/x11/vboxvideo/setmode.c

    r53544 r53966  
    102102    bool fEnabled;
    103103    uint16_t fFlags;
     104    int rc;
    104105
    105106    TRACE_LOG("cDisplay=%u, cWidth=%u, cHeight=%u, x=%d, y=%d, displayWidth=%d\n",
     
    132133                                offStart, pVBox->cbLine, cwReal, cHeight,
    133134                                fEnabled ? vboxBPP(pScrn) : 0, fFlags);
     135    if (cDisplay == 0)
     136    {
     137        rc = VBoxHGSMIUpdateInputMapping(&pVBox->guestCtx, 0 - pVBox->pScreens[0].aScreenLocation.x,
     138                                         0 - pVBox->pScreens[0].aScreenLocation.y, pScrn->virtualX, pScrn->virtualY);
     139        if (RT_FAILURE(rc))
     140            FatalError("Failed to update the input mapping.\n");
     141    }
    134142    return TRUE;
    135143}
     
    145153    uint64_t cbLine = vboxLineLength(pScrn, width);
    146154    int displayWidth = vboxDisplayPitch(pScrn, cbLine);
     155    int rc;
    147156
    148157    TRACE_LOG("width=%d, height=%d\n", width, height);
     
    177186#ifdef VBOXVIDEO_13
    178187    /* Write the new values to the hardware */
     188    /** @todo why is this only for VBOXVIDEO_13? */
    179189    {
    180190        unsigned i;
     
    185195                            pVBox->pScreens[i].aScreenLocation.y);
    186196    }
     197#else
     198    rc = VBoxHGSMIUpdateInputMapping(&pVBox->guestCtx, 0 - pVBox->pScreens[0].aScreenLocation.x,
     199                                     0 - pVBox->pScreens[0].aScreenLocation.y, pScrn->virtualX, pScrn->virtualY);
     200    if (RT_FAILURE(rc))
     201        FatalError("Failed to update the input mapping.\n");
    187202#endif
    188203#ifdef RT_OS_SOLARIS
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c

    r53812 r53966  
    455455}
    456456
    457 static DisplayModePtr
    458 vbox_output_add_mode (VBOXPtr pVBox, DisplayModePtr *pModes,
    459                       const char *pszName, int x, int y,
    460                       Bool isPreferred, Bool isUserDef)
     457static DisplayModePtr vbox_output_add_mode(VBOXPtr pVBox, DisplayModePtr *pModes, const char *pszName, int x, int y,
     458                                           Bool isPreferred, Bool fDifferentRefresh, Bool isUserDef)
    461459{
    462460    TRACE_LOG("pszName=%s, x=%d, y=%d\n", pszName ? pszName : "(null)", x, y);
    463461    DisplayModePtr pMode = xnfcalloc(1, sizeof(DisplayModeRec));
     462    int cRefresh = fDifferentRefresh ? 70 : 60;
    464463
    465464    pMode->status        = MODE_OK;
     
    482481    pMode->VSyncEnd      = pMode->VDisplay + 4;
    483482    pMode->VTotal        = pMode->VDisplay + 6;
    484     pMode->Clock         = pMode->HTotal * pMode->VTotal * 60 / 1000; /* kHz */
     483    pMode->Clock         = pMode->HTotal * pMode->VTotal * cRefresh / 1000; /* kHz */
    485484    if (NULL == pszName) {
    486485        xf86SetModeDefaultName(pMode);
     
    504503    iScreen = (uintptr_t)output->driver_private;
    505504    VBoxUpdateSizeHints(pScrn);
    506     pMode = vbox_output_add_mode(pVBox, &pModes, NULL,
    507                                  pVBox->pScreens[iScreen].aPreferredSize.cx,
    508                                  pVBox->pScreens[iScreen].aPreferredSize.cy, TRUE,
    509                                  FALSE);
     505    pMode = vbox_output_add_mode(pVBox, &pModes, NULL, pVBox->pScreens[iScreen].aPreferredSize.cx,
     506                                 pVBox->pScreens[iScreen].aPreferredSize.cy, TRUE, pVBox->fUseHardwareCursor, FALSE);
    510507    VBOXEDIDSet(output, pMode);
    511508    /* Add standard modes supported by the host */
     
    515512        if (cIndex == 0)
    516513            break;
    517         vbox_output_add_mode(pVBox, &pModes, NULL, x, y, FALSE, FALSE);
     514        vbox_output_add_mode(pVBox, &pModes, NULL, x, y, FALSE, FALSE, FALSE);
    518515    }
    519516
     
    523520    {
    524521        if (2 == sscanf(pScrn->display->modes[i], "%ux%u", &x, &y))
    525             vbox_output_add_mode(pVBox, &pModes, pScrn->display->modes[i], x, y,
    526                                  FALSE, TRUE);
     522            vbox_output_add_mode(pVBox, &pModes, pScrn->display->modes[i], x, y, FALSE, FALSE, TRUE);
    527523    }
    528524    TRACE_EXIT();
     
    798794        return FALSE;
    799795
    800     /* Initialise the guest library */
    801     vbox_init(pScrn->scrnIndex, pVBox);
    802 
    803796    /* Entity information seems to mean bus information. */
    804797    pVBox->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
  • trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h

    r53777 r53966  
    165165    /** Has this screen been enabled by the host? */
    166166    Bool afConnected;
     167    /** The last mode hint data read from the X11 property. */
     168    int32_t lastModeHintFromProperty;
    167169};
    168170
     
    194196    /** @todo we never actually free this */
    195197    xf86CursorInfoPtr pCurs;
    196     Bool useDevice;
    197     Bool forceSWCursor;
    198     /** Do we know that the guest can handle absolute co-ordinates? */
    199     Bool guestCanAbsolute;
     198    /** Do we currently want to use the host cursor? */
     199    Bool fUseHardwareCursor;
     200    /** Do we want to force a reset of the current mode because the host cursor support changed?  Only used by old servers. */
     201    Bool fForceModeSet;
     202    /** The last cursor capabilities data read from the X11 property. */
     203    int32_t fLastCursorCapabilitiesFromProperty;
    200204    /** Number of screens attached */
    201205    uint32_t cScreens;
     
    212216    /** Input handler handle for ACPI hot-plug listener. */
    213217    void *hACPIEventHandler;
     218    /** Have we read all available HGSMI mode hint data? */
     219    bool fHaveReadHGSMIModeHintData;
    214220# endif
    215221#else
     
    242248
    243249/* setmode.c */
    244 extern Bool vbox_init(int scrnIndex, VBOXPtr pVBox);
    245250extern Bool vbox_cursor_init (ScreenPtr pScreen);
    246251extern void vbox_open (ScrnInfoPtr pScrn, ScreenPtr pScreen, VBOXPtr pVBox);
    247252extern void vbox_close (ScrnInfoPtr pScrn, VBOXPtr pVBox);
    248 extern Bool vbox_device_available(VBOXPtr pVBox);
    249253
    250254extern Bool vboxEnableVbva(ScrnInfoPtr pScrn);
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