Changeset 56378 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jun 12, 2015 6:10:56 AM (10 years ago)
- Location:
- trunk/src/VBox/Additions
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPCommon.cpp
r44529 r56378 19 19 #include "VBoxMPCommon.h" 20 20 #include <VBox/Hardware/VBoxVideoVBE.h> 21 #include <iprt/asm.h> 21 22 22 23 int VBoxMPCmnMapAdapterMemory(PVBOXMP_COMMON pCommon, void **ppv, uint32_t ulOffset, uint32_t ulSize) … … 106 107 #endif 107 108 } 109 110 static bool vboxMPCmnIsXorPointer(uint32_t fFlags, 111 uint32_t cWidth, 112 uint32_t cHeight, 113 const uint8_t *pu8Pixels, 114 uint32_t cbLength) 115 { 116 if ( (fFlags & VBOX_MOUSE_POINTER_SHAPE) == 0 117 || (fFlags & VBOX_MOUSE_POINTER_ALPHA) != 0) 118 119 { 120 return false; 121 } 122 123 if (cWidth > 8192 || cHeight > 8192) 124 { 125 /* Not supported cursor size. */ 126 return false; 127 } 128 129 /* Pointer data consists of AND mask and XOR_MASK */ 130 const uint32_t cbAndLine = (cWidth + 7) / 8; 131 const uint32_t cbAndMask = ((cbAndLine * cHeight + 3) & ~3); 132 const uint32_t cbXorMask = cWidth * 4 * cHeight; 133 134 if (cbAndMask + cbXorMask > cbLength) 135 { 136 return false; 137 } 138 139 /* If AND mask contains only 1, then it is a XOR only cursor. */ 140 bool fXorOnly = true; 141 const uint8_t *pu8AndLine = &pu8Pixels[0]; 142 uint32_t i; 143 for (i = 0; i < cHeight; ++i) 144 { 145 if (ASMBitFirstClear(pu8AndLine, cWidth) != -1) 146 { 147 fXorOnly = false; 148 break; 149 } 150 pu8AndLine += cbAndLine; 151 } 152 153 return fXorOnly; 154 } 155 156 bool VBoxMPCmnUpdatePointerShape(PVBOXMP_COMMON pCommon, PVIDEO_POINTER_ATTRIBUTES pAttrs, uint32_t cbLength) 157 { 158 const uint32_t fFlags = pAttrs->Enable & 0x0000FFFF; 159 const uint32_t cHotX = (pAttrs->Enable >> 16) & 0xFF; 160 const uint32_t cHotY = (pAttrs->Enable >> 24) & 0xFF; 161 const uint32_t cWidth = pAttrs->Width; 162 const uint32_t cHeight = pAttrs->Height; 163 uint8_t *pPixels = &pAttrs->Pixels[0]; 164 165 if (pCommon->u32MouseCursorFlags & VBVA_MOUSE_CURSOR_NO_XOR) 166 { 167 if (vboxMPCmnIsXorPointer(fFlags, 168 cWidth, cHeight, pPixels, 169 cbLength - sizeof(VIDEO_POINTER_ATTRIBUTES))) 170 { 171 return false; 172 } 173 } 174 175 int rc = VBoxHGSMIUpdatePointerShape(&pCommon->guestCtx, 176 fFlags, cHotX, cHotY, 177 cWidth, cHeight, pPixels, 178 cbLength - sizeof(VIDEO_POINTER_ATTRIBUTES)); 179 return RT_SUCCESS(rc); 180 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPCommon.h
r52136 r56378 52 52 53 53 /* Pointer related */ 54 inline bool VBoxMPCmnUpdatePointerShape(PVBOXMP_COMMON pCommon, PVIDEO_POINTER_ATTRIBUTES pAttrs, uint32_t cbLength) 55 { 56 int rc; 57 rc = VBoxHGSMIUpdatePointerShape(&pCommon->guestCtx, 58 pAttrs->Enable & 0x0000FFFF, 59 (pAttrs->Enable >> 16) & 0xFF, 60 (pAttrs->Enable >> 24) & 0xFF, 61 pAttrs->Width, pAttrs->Height, pAttrs->Pixels, 62 cbLength - sizeof(VIDEO_POINTER_ATTRIBUTES)); 63 return RT_SUCCESS(rc); 64 } 54 bool VBoxMPCmnUpdatePointerShape(PVBOXMP_COMMON pCommon, PVIDEO_POINTER_ATTRIBUTES pAttrs, uint32_t cbLength); 65 55 66 56 RT_C_DECLS_END -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/common/VBoxMPDevExt.h
r52136 r56378 67 67 68 68 BOOLEAN fAnyX; /* Unrestricted horizontal resolution flag. */ 69 70 uint32_t u32MouseCursorFlags; /* VBVA_MOUSE_CURSOR_* */ 69 71 } VBOXMP_COMMON, *PVBOXMP_COMMON; 70 72 -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPWddm.cpp
r55999 r56378 1135 1135 if (VBoxCommonFromDeviceExt(pDevExt)->bHGSMI) 1136 1136 { 1137 PVBOXMP_COMMON pCommon = VBoxCommonFromDeviceExt(pDevExt); 1138 pCommon->u32MouseCursorFlags = VBoxHGSMIGetMouseCursorFlags(&pCommon->guestCtx); 1139 1137 1140 vboxWddmSetupDisplays(pDevExt); 1138 1141 if (!VBoxCommonFromDeviceExt(pDevExt)->bHGSMI) … … 4193 4196 } 4194 4197 4198 static void vboxWddmHostPointerEnable(PVBOXMP_DEVEXT pDevExt, BOOLEAN fEnable) 4199 { 4200 VIDEO_POINTER_ATTRIBUTES PointerAttributes; 4201 RT_ZERO(PointerAttributes); 4202 if (fEnable) 4203 { 4204 PointerAttributes.Enable = VBOX_MOUSE_POINTER_VISIBLE; 4205 } 4206 VBoxMPCmnUpdatePointerShape(VBoxCommonFromDeviceExt(pDevExt), &PointerAttributes, sizeof(PointerAttributes)); 4207 } 4208 4195 4209 NTSTATUS 4196 4210 APIENTRY … … 4238 4252 { 4239 4253 BOOLEAN bResult = VBoxMPCmnUpdatePointerShape(VBoxCommonFromDeviceExt(pDevExt), &pPointerInfo->Attributes.data, VBOXWDDM_POINTER_ATTRIBUTES_SIZE); 4240 Assert(bResult); 4254 if (!bResult) 4255 { 4256 vboxWddmHostPointerEnable(pDevExt, FALSE); 4257 } 4241 4258 } 4242 4259 else 4243 4260 { 4244 4261 // tell the host to use the guest's pointer 4245 VIDEO_POINTER_ATTRIBUTES PointerAttributes; 4246 4247 /* Visible and No Shape means Show the pointer. 4248 * It is enough to init only this field. 4249 */ 4250 PointerAttributes.Enable = pSetPointerPosition->Flags.Visible ? VBOX_MOUSE_POINTER_VISIBLE : 0; 4251 4252 BOOLEAN bResult = VBoxMPCmnUpdatePointerShape(VBoxCommonFromDeviceExt(pDevExt), &PointerAttributes, sizeof (PointerAttributes)); 4253 Assert(bResult); 4262 vboxWddmHostPointerEnable(pDevExt, pSetPointerPosition->Flags.Visible); 4254 4263 } 4255 4264 } … … 4286 4295 else 4287 4296 { 4288 AssertBreakpoint();4289 LOGREL(("vboxUpdatePointerShape failed"));4297 // tell the host to use the guest's pointer 4298 vboxWddmHostPointerEnable(pDevExt, FALSE); 4290 4299 } 4291 4300 } -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPDriver.cpp
r55210 r56378 149 149 VBoxSetupDisplaysHGSMI(&pExt->u.primary.commonInfo, phVRAM, ulApertureSize, cbVRAM, 0); 150 150 151 PVBOXMP_COMMON pCommon = &pExt->u.primary.commonInfo; 152 if (pCommon->bHGSMI) 153 { 154 pCommon->u32MouseCursorFlags = VBoxHGSMIGetMouseCursorFlags(&pCommon->guestCtx); 155 } 156 151 157 /* Check if the chip restricts horizontal resolution or not. 152 158 * Must be done after VBoxSetupDisplaysHGSMI, because it initializes the common structure. -
trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/xpdm/VBoxMPIOCTL.cpp
r49450 r56378 316 316 { 317 317 LOG(("Fallback to sw pointer.")); 318 pStatus->Status = ERROR_INVALID_FUNCTION;319 318 bRC = FALSE; 319 } 320 321 if (!bRC) 322 { 323 pStatus->Status = ERROR_INVALID_FUNCTION; 320 324 } 321 325 … … 359 363 else 360 364 { 361 pStatus->Status = ERROR_INVALID_FUNCTION;362 365 bRC = FALSE; 366 } 367 368 if (!bRC) 369 { 370 pStatus->Status = ERROR_INVALID_FUNCTION; 363 371 } 364 372 -
trunk/src/VBox/Additions/common/VBoxVideo/HGSMIBase.cpp
r56322 r56378 492 492 * @param u32Index the index of the parameter to query, 493 493 * @see VBVACONF32::u32Index 494 * @param u32DefValue defaut value 494 495 * @param pulValue where to store the value of the parameter on success 495 496 */ 496 RTDECL(int) VBoxQueryConfHGSMI (PHGSMIGUESTCOMMANDCONTEXT pCtx,497 uint32_t u32Index, uint32_t *pulValue)497 RTDECL(int) VBoxQueryConfHGSMIDef(PHGSMIGUESTCOMMANDCONTEXT pCtx, 498 uint32_t u32Index, uint32_t u32DefValue, uint32_t *pulValue) 498 499 { 499 500 int rc = VINF_SUCCESS; … … 512 513 /* Prepare data to be sent to the host. */ 513 514 p->u32Index = u32Index; 514 p->u32Value = UINT32_MAX;515 p->u32Value = u32DefValue; 515 516 rc = VBoxHGSMIBufferSubmit(pCtx, p); 516 517 if (RT_SUCCESS(rc)) … … 528 529 } 529 530 531 RTDECL(int) VBoxQueryConfHGSMI(PHGSMIGUESTCOMMANDCONTEXT pCtx, 532 uint32_t u32Index, uint32_t *pulValue) 533 { 534 return VBoxQueryConfHGSMIDef(pCtx, u32Index, UINT32_MAX, pulValue); 535 } 530 536 531 537 /** -
trunk/src/VBox/Additions/common/VBoxVideo/Modesetting.cpp
r56354 r56378 373 373 { 374 374 uint32_t u32Flags = 0; 375 int rc = VBoxQueryConfHGSMI (pCtx, VBOX_VBVA_CONF32_SCREEN_FLAGS, &u32Flags);375 int rc = VBoxQueryConfHGSMIDef(pCtx, VBOX_VBVA_CONF32_SCREEN_FLAGS, 0, &u32Flags); 376 376 LogFunc(("u32Flags = 0x%x rc %Rrc\n", u32Flags, rc)); 377 377 if (RT_FAILURE(rc)) … … 379 379 return (uint16_t)u32Flags; 380 380 } 381 382 383 /** 384 * Query the mouse cursor flags VBVA_MOUSE_CURSOR_*. 385 * 386 * @returns The mask of VBVA_MOUSE_CURSOR_* flags or 0 if host does not support the request. 387 * @param pCtx the context containing the heap to use 388 */ 389 RTDECL(uint32_t) VBoxHGSMIGetMouseCursorFlags(PHGSMIGUESTCOMMANDCONTEXT pCtx) 390 { 391 uint32_t u32Flags = 0; 392 int rc = VBoxQueryConfHGSMIDef(pCtx, VBOX_VBVA_CONF32_MOUSE_CURSOR, 0, &u32Flags); 393 LogFunc(("u32Flags = 0x%x rc %Rrc\n", u32Flags, rc)); 394 if (RT_FAILURE(rc)) 395 u32Flags = 0; 396 return u32Flags; 397 }
Note:
See TracChangeset
for help on using the changeset viewer.