VirtualBox

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


Ignore:
Timestamp:
Mar 4, 2008 1:09:18 PM (17 years ago)
Author:
vboxsync
Message:

Additions/x11: * fix for the case in which the video driver is loaded but the mouse driver not - in this case the mouse pointer will be drawn in software. * More logging clean-ups

Location:
trunk/src/VBox/Additions/x11
Files:
7 edited

Legend:

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

    r7168 r7274  
    3535#endif
    3636#ifdef DEBUG_X
    37 #define TRACE_ENTRY() for (;;) \
     37#define TRACE_ENTRY() do \
    3838    { \
    3939        ErrorF ("%s\n", __FUNCTION__); \
    40         break; \
    41     }
     40    } while(0)
     41#define TRACE_LINE() do \
     42    { \
     43        ErrorF ("%s: line %d\n", __FUNCTION__, __LINE__); \
     44    } while(0)
    4245#define PUT_PIXEL(c) ErrorF ("%c", c)
    4346#define dolog(...) ErrorF  (__VA_ARGS__)
    4447#else
    45 #define PUT_PIXEL(c) (void) c
    46 #define TRACE_ENTRY() (void) 0
    47 #define dolog(...)
     48#define PUT_PIXEL(c) do { } while(0)
     49#define TRACE_ENTRY() do { } while(0)
     50#define TRACE_LINE() do { } while(0)
     51#define dolog(...) do { } while(0)
    4852#endif
    4953
     
    96100
    97101static Bool
    98 vbox_host_can_hwcursor(ScrnInfoPtr pScrn, VBOXPtr pVBox)
    99 {
    100     VMMDevReqMouseStatus req;
    101     int rc;
    102     int scrnIndex = pScrn->scrnIndex;
    103 
    104     uint32_t fFeatures;
    105     NOREF(req);
    106     rc = VbglR3GetMouseStatus(&fFeatures, NULL, NULL);
    107     if (VBOX_FAILURE(rc))
    108         RETERROR(scrnIndex, FALSE,
    109                  "Unable to determine whether the virtual machine supports mouse pointer integration - request initialization failed with return code %d\n", rc);
    110 
    111     return (fFeatures & VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER) ? FALSE : TRUE;
    112 }
     102vbox_host_uses_hwcursor(ScrnInfoPtr pScrn)
     103{
     104    Bool rc = FALSE;
     105    uint32_t fFeatures = 0;
     106
     107    TRACE_ENTRY();
     108    int vrc = VbglR3GetMouseStatus(&fFeatures, NULL, NULL);
     109    if (VBOX_FAILURE(vrc))
     110        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
     111                 "Unable to determine whether the virtual machine supports mouse pointer integration - request initialization failed with return code %d\n", vrc);
     112    else
     113    {
     114        if (   !(fFeatures & VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER)
     115            && (fFeatures & VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE))
     116            rc = TRUE;
     117    }
     118    return rc;
     119}
     120
    113121
    114122void
     
    346354            pVBox->reqp = p;
    347355            pVBox->pCurs = NULL;
    348             pVBox->useHwCursor = vbox_host_can_hwcursor(pScrn, pVBox);
    349356            pVBox->pointerHeaderSize = size;
    350357            pVBox->pointerOffscreen = FALSE;
     
    472479{
    473480    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    474     VBOXPtr pVBox = pScrn->driverPrivate;
    475     return pVBox->useHwCursor;
     481    return vbox_host_uses_hwcursor(pScrn);
    476482}
    477483
     
    534540    dolog ("w=%d h=%d sm=%d sr=%d p=%d\n",
    535541           w, h, (int) sizeMask, (int) sizeRgba, (int) dstPitch);
    536     dolog ("m=%p c=%p cp=%p\n", m, c, cp);
     542    dolog ("m=%p c=%p cp=%p\n", m, c, (void *)cp);
    537543
    538544    fc = color_to_byte (pCurs->foreBlue)
     
    615621{
    616622    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    617     return pCurs->bits->height <= VBOX_MAX_CURSOR_HEIGHT
    618         && pCurs->bits->width <= VBOX_MAX_CURSOR_WIDTH
    619         && pScrn->bitsPerPixel > 8;
    620 }
     623    Bool rc = TRUE;
     624
     625    if (!vbox_host_uses_hwcursor(pScrn))
     626        rc = FALSE;
     627    if (   rc
     628        && (   (pCurs->bits->height > VBOX_MAX_CURSOR_HEIGHT)
     629            || (pCurs->bits->width > VBOX_MAX_CURSOR_WIDTH)
     630            || (pScrn->bitsPerPixel <= 8)
     631           )
     632       )
     633        rc = FALSE;
     634    return rc;
     635}
     636
    621637
    622638static void
     
    715731    xf86CursorInfoPtr pCurs;
    716732    Bool rc;
    717 
    718     if (pVBox->useHwCursor)
    719     {
    720         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
    721                   "The host system is drawing the mouse cursor.\n");
    722     }
    723     else
    724     {
    725         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
    726                   "The guest system is drawing the mouse cursor.\n");
    727         return TRUE;
    728     }
    729733
    730734    pVBox->pCurs = pCurs = xf86CreateCursorInfoRec();
  • trunk/src/VBox/Additions/x11/xgraphics/vboxutils_68.c

    r7086 r7274  
    4040#endif
    4141#ifdef DEBUG_X
    42 #define TRACE_ENTRY() for (;;) {                \
    43     ErrorF ("%s\n", __FUNCTION__);              \
    44     break;                                      \
    45 }
     42#define TRACE_ENTRY() do \
     43    { \
     44        ErrorF ("%s\n", __FUNCTION__); \
     45    } while(0)
     46#define TRACE_LINE() do \
     47    { \
     48        ErrorF ("%s: line %d\n", __FUNCTION__, __LINE__); \
     49    } while(0)
    4650#define PUT_PIXEL(c) ErrorF ("%c", c)
    4751#define dolog(...) ErrorF  (__VA_ARGS__)
    4852#else
    49 #define PUT_PIXEL(c) (void) c
    50 #define TRACE_ENTRY() (void) 0
    51 #define dolog(...)
     53#define PUT_PIXEL(c) do { } while(0)
     54#define TRACE_ENTRY() do { } while(0)
     55#define TRACE_LINE() do { } while(0)
     56#define dolog(...) do { } while(0)
    5257#endif
    5358
     
    130135
    131136static Bool
    132 vbox_host_can_hwcursor(ScrnInfoPtr pScrn, VBOXPtr pVBox)
    133 {
     137vbox_host_uses_hwcursor(ScrnInfoPtr pScrn)
     138{
     139    Bool rc = FALSE;
     140    VBOXPtr pVBox = pScrn->driverPrivate;
    134141    VMMDevReqMouseStatus req;
    135     int rc;
    136     int scrnIndex = pScrn->scrnIndex;
    137 
    138 #ifdef RT_OS_SOLARIS
    139     uint32_t fFeatures;
    140     NOREF(req);
    141     rc = VbglR3GetMouseStatus(&fFeatures, NULL, NULL);
    142     if (VBOX_FAILURE(rc))
    143         RETERROR(scrnIndex, FALSE,
     142
     143    int vrc = vmmdevInitRequest ((VMMDevRequestHeader*)&req, VMMDevReq_GetMouseStatus);
     144    if (RT_FAILURE (vrc))
     145        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
    144146            "Unable to determine whether the virtual machine supports mouse pointer integration - request initialization failed with return code %d\n", rc);
    145 
    146     return (fFeatures & VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER) ? FALSE : TRUE;
    147 #else
    148     rc = vmmdevInitRequest ((VMMDevRequestHeader*)&req, VMMDevReq_GetMouseStatus);
    149     if (VBOX_FAILURE (rc))
    150         RETERROR(scrnIndex, FALSE,
    151             "Unable to determine whether the virtual machine supports mouse pointer integration - request initialization failed with return code %d\n", rc);
    152 
    153     if (ioctl(pVBox->vbox_fd, IOCTL_VBOXGUEST_VMMREQUEST, (void*)&req) < 0)
    154         RETERROR(scrnIndex, FALSE,
     147    if (   RT_SUCCESS(vrc)
     148        && (ioctl(pVBox->vbox_fd, IOCTL_VBOXGUEST_VMMREQUEST, (void*)&req) < 0))
     149    {
     150        vrc = VERR_FILE_IO_ERROR;
     151        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
    155152            "Unable to determine whether the virtual machine supports mouse pointer integration - request system call failed: %s.\n",
    156153            strerror(errno));
    157 
    158     return (req.mouseFeatures & VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER) ? FALSE : TRUE;
    159 #endif
    160 }
     154    }
     155    if (   RT_SUCCESS(rc)
     156        && !(req.mouseFeatures & VBOXGUEST_MOUSE_HOST_CANNOT_HWPOINTER)
     157        && (req.mouseFeatures & VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE))
     158            rc = TRUE;
     159    return rc;
     160}
     161
    161162
    162163void
     
    479480        pVBox->reqp = p;
    480481        pVBox->pCurs = NULL;
    481         pVBox->useHwCursor = vbox_host_can_hwcursor(pScrn, pVBox);
    482482        pVBox->pointerHeaderSize = size;
    483483        pVBox->pointerOffscreen = FALSE;
     
    603603{
    604604    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    605     VBOXPtr pVBox = pScrn->driverPrivate;
    606     return pVBox->useHwCursor;
     605    return vbox_host_uses_hwcursor(pScrn);
    607606}
    608607
     
    663662    dolog ("w=%d h=%d sm=%d sr=%d p=%d\n",
    664663           w, h, (int) size_mask, (int) size_rgba, (int) dst_pitch);
    665     dolog ("m=%p c=%p cp=%p\n", m, c, (void *) cp);
     664    dolog ("m=%p c=%p cp=%p\n", m, c, (void *) (void *)cp);
    666665
    667666    fc = color_to_byte (pCurs->foreBlue)
     
    743742{
    744743    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    745     return pCurs->bits->height <= VBOX_MAX_CURSOR_HEIGHT
    746         && pCurs->bits->width <= VBOX_MAX_CURSOR_WIDTH
    747         && pScrn->bitsPerPixel > 8;
     744    Bool rc = TRUE;
     745
     746    if (!vbox_host_uses_hwcursor(pScrn))
     747        rc = FALSE;
     748    if (   rc
     749        && (   (pCurs->bits->height > VBOX_MAX_CURSOR_HEIGHT)
     750            || (pCurs->bits->width > VBOX_MAX_CURSOR_WIDTH)
     751            || (pScrn->bitsPerPixel <= 8)
     752           )
     753       )
     754        rc = FALSE;
     755    return rc;
    748756}
    749757
     
    846854    xf86CursorInfoPtr pCurs;
    847855    Bool rc;
    848 
    849     if (pVBox->useHwCursor)
    850     {
    851         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
    852                   "The host system is drawing the mouse cursor.\n");
    853     }
    854     else
    855     {
    856         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
    857                   "The guest system is drawing the mouse cursor.\n");
    858         return TRUE;
    859     }
    860856
    861857    pVBox->pCurs = pCurs = xf86CreateCursorInfoRec ();
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo.h

    r7168 r7274  
    7575/* VBE/DDC support */
    7676#include "vbe.h"
    77 #ifdef XORG_7X
    7877#include "vbeModes.h"
    79 #endif
    8078#include "xf86DDC.h"
    8179
     
    118116#include "afb.h"
    119117#include "mfb.h"
    120 #ifndef XORG_7X
    121 #include "cfb24_32.h"
    122 #endif
    123118
    124119#define VBOX_VERSION            4000
     
    137132    PCITAG pciTag;
    138133    CARD16 maxBytesPerScanline;
    139 #ifdef XORG_7X
    140134    unsigned long mapPhys, mapOff;
    141135    int mapSize;        /* video memory */
    142 #else
    143     int mapPhys, mapOff, mapSize;       /* video memory */
    144 #endif
    145136    void *base, *VGAbase;
    146137    CARD8 *state, *pstate;      /* SVGA state */
     
    153144    CloseScreenProcPtr CloseScreen;
    154145    OptionInfoPtr Options;
    155 #ifdef XORG_7X
    156146    IOADDRESS ioBase;
    157 #endif  /* XORG_7X defined */
    158 #if 0
    159     int vbox_fd;
    160 #endif
    161147    VMMDevReqMousePointer *reqp;
    162148    xf86CursorInfoPtr pCurs;
    163     Bool useHwCursor;
    164149    size_t pointerHeaderSize;
    165150    size_t pointerSize;
    166151    Bool pointerOffscreen;
    167152    Bool useVbva;
    168 #if 0
    169     VMMDevVideoAccelFlush *reqf;
    170     VMMDevVideoAccelEnable *reqe;
    171 #endif
    172153    VMMDevMemory *pVMMDevMemory;
    173154    VBVAMEMORY *pVbvaMemory;
    174155} VBOXRec, *VBOXPtr;
    175 
    176 #ifndef XORG_7X
    177 typedef struct _ModeInfoData
    178 {
    179     int mode;
    180     VbeModeInfoBlock *data;
    181     VbeCRTCInfoBlock *block;
    182 } ModeInfoData;
    183 #endif
    184156
    185157extern Bool vbox_init(int scrnIndex);
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_13.c

    r7168 r7274  
    4848 */
    4949
    50 #ifdef DEBUG
     50#ifdef DEBUG_VIDEO
    5151
    5252#define TRACE \
     
    6666} while(0)
    6767
    68 #else  /* DEBUG not defined */
     68#else  /* DEBUG_VIDEO not defined */
    6969
    7070#define TRACE
     
    7272#define TRACE3(...)
    7373
    74 #endif  /* DEBUG not defined */
     74#endif  /* DEBUG_VIDEO not defined */
    7575
    7676#ifdef XFree86LOADER
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_68.c

    r7168 r7274  
    5050#define DEBUG_VERB 2
    5151
    52 #include "vboxvideo.h"
     52#include "vboxvideo_68.h"
    5353#include "version-generated.h"
    5454
  • trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_68.h

    r7086 r7274  
    145145    VMMDevReqMousePointer *reqp;
    146146    xf86CursorInfoPtr pCurs;
    147     Bool useHwCursor;
    148147    size_t pointerHeaderSize;
    149148    size_t pointerSize;
  • trunk/src/VBox/Additions/x11/xmouse/VBoxUtils.c

    r6594 r7274  
    3434    }
    3535
    36     rc = VbglR3SetMouseStatus(VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE | VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR);
     36    rc = VbglR3SetMouseStatus(VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE /* | VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR */);
    3737    if (VBOX_FAILURE(rc))
    3838    {
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