Changeset 9249 in vbox for trunk/src/VBox
- Timestamp:
- May 30, 2008 12:59:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/xgraphics/vboxutils.c
r9016 r9249 36 36 #define VBOX_MAX_CURSOR_HEIGHT 64 37 37 38 #if 0 39 #define DEBUG_X 38 /************************************************************************** 39 * Debugging functions and macros * 40 **************************************************************************/ 41 42 /* #define DEBUG_POINTER */ 43 44 #ifdef DEBUG_michael 45 # define DEBUG_VIDEO 40 46 #endif 41 #ifdef DEBUG_X 42 #define TRACE_ENTRY() do \ 43 { \ 44 ErrorF ("%s\n", __FUNCTION__); \ 45 } while(0) 46 #define TRACE_LINE() do \ 47 48 #define BOOL_STR(a) ((a) ? "TRUE" : "FALSE") 49 50 #ifdef DEBUG_VIDEO 51 # define TRACE_ENTRY() \ 52 do { \ 53 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \ 54 xf86Msg(X_INFO, ": entering\n"); \ 55 } while(0) 56 # define TRACE_EXIT() \ 57 do { \ 58 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \ 59 xf86Msg(X_INFO, ": leaving\n"); \ 60 } while(0) 61 # define TRACE_LOG(...) \ 62 do { \ 63 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \ 64 xf86Msg(X_INFO, __VA_ARGS__); \ 65 } while(0) 66 # define TRACE_LINE() do \ 47 67 { \ 48 68 ErrorF ("%s: line %d\n", __FUNCTION__, __LINE__); \ 49 69 } while(0) 50 # define PUT_PIXEL(c) ErrorF ("%c", c)51 # define dolog(...) ErrorF (__VA_ARGS__)52 # else53 # 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)57 #endif 70 # define PUT_PIXEL(c) ErrorF ("%c", c) 71 #else /* DEBUG_VIDEO not defined */ 72 # define PUT_PIXEL(c) do { } while(0) 73 # define TRACE_ENTRY() do { } while(0) 74 # define TRACE_EXIT() do { } while(0) 75 # define TRACE_LOG(...) do { } while(0) 76 # define TRACE_LINE() do { } while(0) 77 #endif /* DEBUG_VIDEO not defined */ 58 78 59 79 /** Macro to printf an error message and return from a function */ … … 66 86 while (0) 67 87 68 #ifdef DEBUG_ X88 #ifdef DEBUG_POINTER 69 89 static void 70 90 vbox_show_shape(unsigned short w, unsigned short h, CARD32 bg, unsigned char *image) … … 103 123 #endif 104 124 125 /************************************************************************** 126 * Helper functions and macros * 127 **************************************************************************/ 105 128 106 129 static Bool … … 123 146 rc = TRUE; 124 147 } 148 TRACE_LOG("rc=%s\n", BOOL_STR(rc)); 125 149 return rc; 126 150 } 127 151 128 129 void 130 vbox_close(ScrnInfoPtr pScrn, VBOXPtr pVBox) 131 { 132 TRACE_ENTRY(); 133 134 xfree (pVBox->reqp); 135 pVBox->reqp = NULL; 136 } 137 152 /** 153 * This function checks whether the X server agrees with us about whether 154 * to use a host or a guest-drawn cursor and gives it a nudge if it doesn't. 155 * Disabling and re-enabling framebuffer access was one of the few 156 * reliable (although not particularly nice) methods I could find to 157 * force the server to recheck whether to use a hardware or a software 158 * cursor. 159 */ 160 static void 161 vboxRecheckHWCursor(ScrnInfoPtr pScrn) 162 { 163 int vrc; 164 uint32_t fFeatures; 165 VBOXPtr pVBox = pScrn->driverPrivate; 166 167 TRACE_ENTRY(); 168 /* Check whether we are using the hardware cursor or not, and whether this 169 has changed since the last time we checked. */ 170 vrc = VbglR3GetMouseStatus(&fFeatures, NULL, NULL); 171 if (!!(fFeatures & VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE) != pVBox->usingHWCursor) 172 { 173 pVBox->usingHWCursor = !!(fFeatures & VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE); 174 /* This triggers a cursor image reload */ 175 if (pVBox->accessEnabled) 176 { 177 pScrn->EnableDisableFBAccess(pScrn->scrnIndex, FALSE); 178 pScrn->EnableDisableFBAccess(pScrn->scrnIndex, TRUE); 179 } 180 } 181 TRACE_EXIT(); 182 } 183 138 184 /** 139 185 * Macro to disable VBVA extensions and return, for use when an … … 149 195 } \ 150 196 while (0) 197 198 /************************************************************************** 199 * Main functions * 200 **************************************************************************/ 201 202 void 203 vbox_close(ScrnInfoPtr pScrn, VBOXPtr pVBox) 204 { 205 TRACE_ENTRY(); 206 207 xfree (pVBox->reqp); 208 pVBox->reqp = NULL; 209 TRACE_EXIT(); 210 } 151 211 152 212 /** … … 176 236 177 237 pVBox = pScrn->driverPrivate; 238 TRACE_ENTRY(); 178 239 if (pVBox->useVbva == FALSE) 179 240 return; … … 265 326 /** 266 327 * Initialise VirtualBox's accelerated video extensions. 267 * Note that we assume that the PCI memory is 32bit mapped,268 * as X doesn't seem to support mapping 64bit memory.269 328 * 270 329 * @returns TRUE on success, FALSE on failure … … 276 335 ADDRESS pciAddress; 277 336 337 TRACE_ENTRY(); 278 338 /* Locate the device. It should already have been enabled by 279 339 the kernel driver. */ … … 325 385 Bool rc = TRUE; 326 386 int vrc; 387 388 TRACE_ENTRY(); 327 389 pVBox->useVbva = FALSE; 328 390 vrc = VbglR3Init(); … … 389 451 { 390 452 int rc; 453 454 TRACE_ENTRY(); 391 455 pVBox->reqp->fFlags = 0; 392 456 rc = VbglR3SetPointerShapeReq(pVBox->reqp); … … 399 463 { 400 464 int rc; 465 466 TRACE_ENTRY(); 401 467 pVBox->reqp->fFlags = VBOX_MOUSE_POINTER_VISIBLE; 402 468 rc = VbglR3SetPointerShapeReq(pVBox->reqp); … … 413 479 reqp = (VMMDevReqMousePointer *)image; 414 480 415 dolog("w=%d h=%d size=%d\n", reqp->width, reqp->height, reqp->header.size);416 #ifdef DEBUG_ X481 TRACE_LOG("w=%d h=%d size=%d\n", reqp->width, reqp->height, reqp->header.size); 482 #ifdef DEBUG_POINTER 417 483 vbox_show_shape(reqp->width, reqp->height, 0, image); 418 484 #endif … … 434 500 } 435 501 502 /** 503 * This function is called to set the position of the hardware cursor. 504 * Since we already know the position (exactly where the host pointer is), 505 * we only use this function to poll for whether we need to switch from a 506 * hardware to a software cursor (that is, whether the user has disabled 507 * pointer integration). Sadly we this doesn't work the other way round, 508 * as the server updates the software cursor itself without calling us. 509 */ 436 510 static void 437 511 vbox_set_cursor_position(ScrnInfoPtr pScrn, int x, int y) 438 512 { 439 VBOXPtr pVBox = pScrn->driverPrivate; 440 int vrc; 441 uint32_t fFeatures; 442 443 TRACE_ENTRY(); 444 /* Check whether we are using the hardware cursor or not, and whether this 445 has changed since the last time we checked. */ 446 vrc = VbglR3GetMouseStatus(&fFeatures, NULL, NULL); 447 if (!!(fFeatures & VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE) != pVBox->usingHWCursor) 448 { 449 pVBox->usingHWCursor = !!(fFeatures & VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE); 450 /* This triggers a cursor image reload */ 451 if (pVBox->accessEnabled) 452 { 453 pScrn->EnableDisableFBAccess(pScrn->scrnIndex, FALSE); 454 pScrn->EnableDisableFBAccess(pScrn->scrnIndex, TRUE); 455 } 456 } 457 513 vboxRecheckHWCursor(pScrn); 458 514 /* don't disable the mouse cursor if we go out of our visible area 459 515 * since the mouse cursor is drawn by the host anyway */ … … 534 590 VMMDevReqMousePointer *reqp; 535 591 592 TRACE_ENTRY(); 536 593 pVBox = infoPtr->pScrn->driverPrivate; 537 594 bitsp = pCurs->bits; … … 572 629 cp = (CARD32 *)(m + sizeMask); 573 630 574 dolog("w=%d h=%d sm=%d sr=%d p=%d\n",631 TRACE_LOG ("w=%d h=%d sm=%d sr=%d p=%d\n", 575 632 w, h, (int) sizeMask, (int) sizeRgba, (int) dstPitch); 576 dolog("m=%p c=%p cp=%p\n", m, c, (void *)cp);633 TRACE_LOG ("m=%p c=%p cp=%p\n", m, c, (void *)cp); 577 634 578 635 fc = color_to_byte (pCurs->foreBlue) … … 642 699 reqp->header.size = sizeRequest; 643 700 644 #ifdef DEBUG_ X701 #ifdef DEBUG_POINTER 645 702 ErrorF("shape = %p\n", p); 646 703 vbox_show_shape(w, h, bc, c); … … 657 714 Bool rc = TRUE; 658 715 716 TRACE_ENTRY(); 659 717 if (!vbox_host_uses_hwcursor(pScrn)) 660 718 rc = FALSE; … … 666 724 ) 667 725 rc = FALSE; 726 TRACE_LOG("rc=%s\n", BOOL_STR(rc)); 668 727 return rc; 669 728 } … … 684 743 int scrnIndex; 685 744 745 TRACE_ENTRY(); 686 746 pVBox = pScrn->driverPrivate; 687 747 bitsp = pCurs->bits; … … 766 826 Bool rc; 767 827 828 TRACE_ENTRY(); 768 829 if (!pVBox->useDevice) 769 830 return FALSE; … … 815 876 VBOXPtr pVBox = pScrn->driverPrivate; 816 877 878 TRACE_ENTRY(); 817 879 if (pVBox->useVbva != TRUE) 818 880 return FALSE; … … 847 909 VBOXPtr pVBox = pScrn->driverPrivate; 848 910 911 TRACE_ENTRY(); 849 912 if (pVBox->useVbva != TRUE) /* Ths function should not have been called */ 850 913 return FALSE; … … 870 933 vboxEnableGraphicsCap(VBOXPtr pVBox) 871 934 { 935 TRACE_ENTRY(); 872 936 if (!pVBox->useDevice) 873 937 return FALSE; … … 884 948 vboxDisableGraphicsCap(VBOXPtr pVBox) 885 949 { 950 TRACE_ENTRY(); 886 951 if (!pVBox->useDevice) 887 952 return FALSE; … … 905 970 VBOXPtr pVBox) 906 971 { 972 TRACE_ENTRY(); 907 973 if (!pVBox->useDevice) 908 974 return FALSE; … … 926 992 vboxHostLikesVideoMode(uint32_t cx, uint32_t cy, uint32_t cBits) 927 993 { 994 TRACE_ENTRY(); 928 995 return VbglR3HostLikesVideoMode(cx, cy, cBits); 929 996 }
Note:
See TracChangeset
for help on using the changeset viewer.