- Timestamp:
- Nov 13, 2009 4:47:47 PM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.c
r24044 r24646 205 205 pVm->fpStart = pDev->layout.offDDRAWHeap; 206 206 pVm->fpEnd = pDev->layout.offDDRAWHeap + pDev->layout.cbDDRAWHeap - 1; /* inclusive */ 207 #ifndef VBOX_WITH_VIDEOHWACCEL 208 pVm->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; 209 #endif 207 #ifdef VBOX_WITH_VIDEOHWACCEL 208 if(pDev->vhwaInfo.bVHWAEnabled) 209 { 210 pVm->ddsCaps.dwCaps = 0; 211 pVm->ddsCapsAlt.dwCaps = 0; 212 } 213 else 214 #endif 215 { 216 pVm->ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; 217 } 210 218 DISPDBG((0, "fpStart %x fpEnd %x\n", pVm->fpStart, pVm->fpEnd)); 211 219 … … 955 963 DISPDBG((0, "DdMapMemory: Exit GEN, DDHAL_DRIVER_HANDLED\n")); 956 964 965 AssertBreakpoint(); 966 957 967 return(DDHAL_DRIVER_HANDLED); 958 968 } … … 977 987 { 978 988 DISPDBG((0, "Failed IOCTL_VIDEO_UNSHARE_MEMORY\n")); 989 AssertBreakpoint(); 979 990 } 980 991 } … … 1188 1199 if(lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_VISIBLE 1189 1200 || lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE 1201 // || !!(lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_FRONTBUFFER) 1190 1202 || ( !!(lpSurfaceLocal->ddsCaps.dwCaps & DDSCAPS_OVERLAY) 1191 1203 && pDesc->bVisible … … 1217 1229 } 1218 1230 } 1231 else 1232 { 1233 lpUnlock->ddRVal = DD_OK; 1234 } 1219 1235 #else 1220 1236 lpUnlock->ddRVal = DD_OK; … … 1326 1342 vboxVHWASurfDescFree(pDesc); 1327 1343 1344 lpSurfaceGlobal->dwReserved1 = NULL; 1345 1328 1346 lpDestroySurface->ddRVal = DD_OK; 1329 1347 } … … 1335 1353 else 1336 1354 #endif 1337 lpDestroySurface->ddRVal = DD_OK; 1338 return DDHAL_DRIVER_HANDLED; 1355 lpDestroySurface->ddRVal = DD_OK; 1356 1357 /* we're not managing video memory currently, so return DDHAL_DRIVER_NOTHANDLED */ 1358 return DDHAL_DRIVER_NOTHANDLED; 1339 1359 } 1340 1360 … … 1728 1748 if(!pSrcDesc->bVisible) 1729 1749 { 1750 #ifdef DEBUG_misha 1751 AssertBreakpoint(); 1752 #endif 1730 1753 lpSetOverlayPosition->ddRVal = DDERR_GENERIC; 1731 1754 return DDHAL_DRIVER_HANDLED; -
trunk/src/VBox/Additions/WINNT/Graphics/Display/dd.h
r19515 r24646 43 43 DWORD APIENTRY DdAddAttachedSurface(PDD_ADDATTACHEDSURFACEDATA lpAddAttachedSurface); 44 44 DWORD APIENTRY DdBlt(PDD_BLTDATA lpBlt); 45 DWORD APIENTRY DdDestroySurface(PDD_DESTROYSURFACEDATA lpDestroySurface);46 45 DWORD APIENTRY DdFlip(PDD_FLIPDATA lpFlip); 47 46 DWORD APIENTRY DdGetBltStatus(PDD_GETBLTSTATUSDATA lpGetBltStatus); -
trunk/src/VBox/Additions/WINNT/Graphics/Display/vhwa.c
r22652 r24646 44 44 #define VBOX_DD_DUMMY_PAIR(_v) {VBOX_DD(_v), 0} 45 45 46 47 static const uint32_t g_SupportedCapList[][2] = { 48 VBOX_DD_VHWA_PAIR(CAPS_BLT), 49 VBOX_DD_VHWA_PAIR(CAPS_BLTQUEUE), 50 VBOX_DD_VHWA_PAIR(CAPS_BLTCOLORFILL), 51 VBOX_DD_VHWA_PAIR(CAPS_BLTFOURCC), 52 VBOX_DD_VHWA_PAIR(CAPS_BLTSTRETCH), 53 VBOX_DD_VHWA_PAIR(CAPS_OVERLAY), 54 VBOX_DD_VHWA_PAIR(CAPS_OVERLAYCANTCLIP), 55 VBOX_DD_VHWA_PAIR(CAPS_OVERLAYFOURCC), 56 VBOX_DD_VHWA_PAIR(CAPS_OVERLAYSTRETCH), 57 VBOX_DD_VHWA_PAIR(CAPS_COLORKEY), 58 VBOX_DD_VHWA_PAIR(CAPS_COLORKEYHWASSIST) 59 }; 60 61 static const uint32_t g_SupportedCap2List[][2] = { 62 VBOX_DD_VHWA_PAIR(CAPS2_COPYFOURCC), 63 }; 64 65 66 static const uint32_t g_SupportedSCapList[][2] = { 67 VBOX_DD_VHWA_PAIR(SCAPS_FLIP), 68 VBOX_DD_VHWA_PAIR(SCAPS_PRIMARYSURFACE), 69 VBOX_DD_VHWA_PAIR(SCAPS_OVERLAY), 70 VBOX_DD_VHWA_PAIR(SCAPS_VISIBLE), 71 VBOX_DD_VHWA_PAIR(SCAPS_VIDEOMEMORY), 72 VBOX_DD_VHWA_PAIR(SCAPS_OFFSCREENPLAIN), 73 VBOX_DD_VHWA_PAIR(SCAPS_LOCALVIDMEM), 74 VBOX_DD_VHWA_PAIR(SCAPS_COMPLEX) 75 }; 76 77 static const uint32_t gSupportedSDList[][2] = { 78 VBOX_DD_VHWA_PAIR(SD_BACKBUFFERCOUNT), 79 VBOX_DD_VHWA_PAIR(SD_CAPS), 80 VBOX_DD_VHWA_PAIR(SD_CKDESTBLT), 81 VBOX_DD_VHWA_PAIR(SD_CKDESTOVERLAY), 82 VBOX_DD_VHWA_PAIR(SD_CKSRCBLT), 83 VBOX_DD_VHWA_PAIR(SD_CKSRCOVERLAY), 84 VBOX_DD_VHWA_PAIR(SD_HEIGHT), 85 VBOX_DD_VHWA_PAIR(SD_PITCH), 86 VBOX_DD_VHWA_PAIR(SD_PIXELFORMAT), 87 VBOX_DD_VHWA_PAIR(SD_WIDTH), 88 }; 89 90 static const uint32_t g_SupportedPFList[][2] = { 91 VBOX_DD_VHWA_PAIR(PF_RGB), 92 VBOX_DD_VHWA_PAIR(PF_RGBTOYUV), 93 VBOX_DD_VHWA_PAIR(PF_YUV), 94 VBOX_DD_VHWA_PAIR(PF_FOURCC) 95 }; 96 97 static const uint32_t g_SupportedCKeyCapList[][2] = { 98 VBOX_DD_VHWA_PAIR(CKEYCAPS_DESTBLT), 99 VBOX_DD_VHWA_PAIR(CKEYCAPS_DESTBLTCLRSPACE), 100 VBOX_DD_VHWA_PAIR(CKEYCAPS_DESTBLTCLRSPACEYUV), 101 VBOX_DD_VHWA_PAIR(CKEYCAPS_DESTBLTYUV), 102 VBOX_DD_VHWA_PAIR(CKEYCAPS_DESTOVERLAY), 103 VBOX_DD_VHWA_PAIR(CKEYCAPS_DESTOVERLAYCLRSPACE), 104 VBOX_DD_VHWA_PAIR(CKEYCAPS_DESTOVERLAYCLRSPACEYUV), 105 VBOX_DD_VHWA_PAIR(CKEYCAPS_DESTOVERLAYONEACTIVE), 106 VBOX_DD_VHWA_PAIR(CKEYCAPS_DESTOVERLAYYUV), 107 VBOX_DD_VHWA_PAIR(CKEYCAPS_NOCOSTOVERLAY), 108 VBOX_DD_VHWA_PAIR(CKEYCAPS_SRCBLT), 109 VBOX_DD_VHWA_PAIR(CKEYCAPS_SRCBLTCLRSPACE), 110 VBOX_DD_VHWA_PAIR(CKEYCAPS_SRCBLTCLRSPACEYUV), 111 VBOX_DD_VHWA_PAIR(CKEYCAPS_SRCBLTYUV), 112 VBOX_DD_VHWA_PAIR(CKEYCAPS_SRCOVERLAY), 113 VBOX_DD_VHWA_PAIR(CKEYCAPS_SRCOVERLAYCLRSPACE), 114 VBOX_DD_VHWA_PAIR(CKEYCAPS_SRCOVERLAYCLRSPACEYUV), 115 VBOX_DD_VHWA_PAIR(CKEYCAPS_SRCOVERLAYONEACTIVE), 116 VBOX_DD_VHWA_PAIR(CKEYCAPS_SRCOVERLAYYUV) 117 }; 118 119 //static const uint32_t g_SupportedOverList[][2] = { 120 // VBOX_DD_VHWA_PAIR(OVER_DDFX), 121 // VBOX_DD_VHWA_PAIR(OVER_HIDE), 122 // VBOX_DD_VHWA_PAIR(OVER_KEYDEST), 123 // VBOX_DD_VHWA_PAIR(OVER_KEYDESTOVERRIDE), 124 // VBOX_DD_VHWA_PAIR(OVER_KEYSRC), 125 // VBOX_DD_VHWA_PAIR(OVER_KEYSRCOVERRIDE), 126 // VBOX_DD_VHWA_PAIR(OVER_SHOW) 127 //}; 128 // 129 //static const uint32_t g_SupportedCKeyList[][2] = { 130 // VBOX_DD_VHWA_PAIR(CKEY_COLORSPACE), 131 // VBOX_DD_VHWA_PAIR(CKEY_DESTBLT), 132 // VBOX_DD_VHWA_PAIR(CKEY_DESTOVERLAY), 133 // VBOX_DD_VHWA_PAIR(CKEY_SRCBLTE), 134 // VBOX_DD_VHWA_PAIR(CKEY_SRCOVERLAY) 135 //}; 136 137 static uint32_t g_SupportedVHWACaps; 138 static uint32_t g_SupportedVHWASCaps; 139 static uint32_t g_SupportedVHWAPFs; 140 static uint32_t g_SupportedVHWASDs; 141 static uint32_t g_SupportedDDCaps; 142 static uint32_t g_SupportedDDSCaps; 143 static uint32_t g_SupportedDDPFs; 144 static uint32_t g_SupportedDDSDs; 145 146 static uint32_t g_SupportedVHWACKeyCaps; 147 static uint32_t g_SupportedDDCKeyCaps; 148 149 static uint32_t g_SupportedOVERs; 150 static uint32_t g_SupportedCKEYs; 151 46 #define VBOXVHWA_SUPPORTED_CAPS ( \ 47 VBOXVHWA_CAPS_BLT \ 48 | VBOXVHWA_CAPS_BLTCOLORFILL \ 49 | VBOXVHWA_CAPS_BLTFOURCC \ 50 | VBOXVHWA_CAPS_BLTSTRETCH \ 51 | VBOXVHWA_CAPS_BLTQUEUE \ 52 | VBOXVHWA_CAPS_OVERLAY \ 53 | VBOXVHWA_CAPS_OVERLAYFOURCC \ 54 | VBOXVHWA_CAPS_OVERLAYSTRETCH \ 55 | VBOXVHWA_CAPS_OVERLAYCANTCLIP \ 56 | VBOXVHWA_CAPS_COLORKEY \ 57 | VBOXVHWA_CAPS_COLORKEYHWASSIST \ 58 ) 59 60 #define VBOXVHWA_SUPPORTED_SCAPS ( \ 61 VBOXVHWA_SCAPS_BACKBUFFER \ 62 | VBOXVHWA_SCAPS_COMPLEX \ 63 | VBOXVHWA_SCAPS_FLIP \ 64 | VBOXVHWA_SCAPS_FRONTBUFFER \ 65 | VBOXVHWA_SCAPS_OFFSCREENPLAIN \ 66 | VBOXVHWA_SCAPS_OVERLAY \ 67 | VBOXVHWA_SCAPS_PRIMARYSURFACE \ 68 | VBOXVHWA_SCAPS_SYSTEMMEMORY \ 69 | VBOXVHWA_SCAPS_VIDEOMEMORY \ 70 | VBOXVHWA_SCAPS_VISIBLE \ 71 | VBOXVHWA_SCAPS_LOCALVIDMEM \ 72 ) 73 74 #define VBOXVHWA_SUPPORTED_SCAPS2 ( \ 75 VBOXVHWA_CAPS2_CANRENDERWINDOWED \ 76 | VBOXVHWA_CAPS2_WIDESURFACES \ 77 | VBOXVHWA_CAPS2_COPYFOURCC \ 78 ) 79 80 #define VBOXVHWA_SUPPORTED_PF ( \ 81 VBOXVHWA_PF_RGB \ 82 | VBOXVHWA_PF_RGBTOYUV \ 83 | VBOXVHWA_PF_YUV \ 84 | VBOXVHWA_PF_FOURCC \ 85 ) 86 87 #define VBOXVHWA_SUPPORTED_SD ( \ 88 VBOXVHWA_SD_BACKBUFFERCOUNT \ 89 | VBOXVHWA_SD_CAPS \ 90 | VBOXVHWA_SD_CKDESTBLT \ 91 | VBOXVHWA_SD_CKDESTOVERLAY \ 92 | VBOXVHWA_SD_CKSRCBLT \ 93 | VBOXVHWA_SD_CKSRCOVERLAY \ 94 | VBOXVHWA_SD_HEIGHT \ 95 | VBOXVHWA_SD_PITCH \ 96 | VBOXVHWA_SD_PIXELFORMAT \ 97 | VBOXVHWA_SD_WIDTH \ 98 ) 99 100 #define VBOXVHWA_SUPPORTED_CKEYCAPS ( \ 101 VBOXVHWA_CKEYCAPS_DESTBLT \ 102 | VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACE \ 103 | VBOXVHWA_CKEYCAPS_DESTBLTCLRSPACEYUV \ 104 | VBOXVHWA_CKEYCAPS_DESTBLTYUV \ 105 | VBOXVHWA_CKEYCAPS_DESTOVERLAY \ 106 | VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACE \ 107 | VBOXVHWA_CKEYCAPS_DESTOVERLAYCLRSPACEYUV \ 108 | VBOXVHWA_CKEYCAPS_DESTOVERLAYONEACTIVE \ 109 | VBOXVHWA_CKEYCAPS_DESTOVERLAYYUV \ 110 | VBOXVHWA_CKEYCAPS_SRCBLT \ 111 | VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACE \ 112 | VBOXVHWA_CKEYCAPS_SRCBLTCLRSPACEYUV \ 113 | VBOXVHWA_CKEYCAPS_SRCBLTYUV \ 114 | VBOXVHWA_CKEYCAPS_SRCOVERLAY \ 115 | VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACE \ 116 | VBOXVHWA_CKEYCAPS_SRCOVERLAYCLRSPACEYUV \ 117 | VBOXVHWA_CKEYCAPS_SRCOVERLAYONEACTIVE \ 118 | VBOXVHWA_CKEYCAPS_SRCOVERLAYYUV \ 119 | VBOXVHWA_CKEYCAPS_NOCOSTOVERLAY \ 120 ) 121 122 #define VBOXVHWA_SUPPORTED_CKEY ( \ 123 VBOXVHWA_CKEY_COLORSPACE \ 124 | VBOXVHWA_CKEY_DESTBLT \ 125 | VBOXVHWA_CKEY_DESTOVERLAY \ 126 | VBOXVHWA_CKEY_SRCBLT \ 127 | VBOXVHWA_CKEY_SRCOVERLAY \ 128 ) 129 130 #define VBOXVHWA_SUPPORTED_OVER ( \ 131 VBOXVHWA_OVER_DDFX \ 132 | VBOXVHWA_OVER_HIDE \ 133 | VBOXVHWA_OVER_KEYDEST \ 134 | VBOXVHWA_OVER_KEYDESTOVERRIDE \ 135 | VBOXVHWA_OVER_KEYSRC \ 136 | VBOXVHWA_OVER_KEYSRCOVERRIDE \ 137 | VBOXVHWA_OVER_SHOW \ 138 ) 152 139 153 140 void vboxVHWAInit() 154 141 { 155 int i;156 g_SupportedVHWACaps = 0;157 g_SupportedVHWASCaps = 0;158 g_SupportedVHWAPFs = 0;159 g_SupportedVHWASDs = 0;160 g_SupportedDDCaps = 0;161 g_SupportedDDSCaps = 0;162 g_SupportedDDPFs = 0;163 g_SupportedDDSDs = 0;164 165 g_SupportedVHWACKeyCaps = 0;166 g_SupportedDDCKeyCaps = 0;167 168 for(i = 0; i < sizeof(g_SupportedCapList)/sizeof(g_SupportedCapList[0]); i++)169 {170 g_SupportedDDCaps |= g_SupportedCapList[i][0];171 g_SupportedVHWACaps |= g_SupportedCapList[i][1];172 }173 174 for(i = 0; i < sizeof(g_SupportedSCapList)/sizeof(g_SupportedSCapList[0]); i++)175 {176 g_SupportedDDSCaps |= g_SupportedSCapList[i][0];177 g_SupportedVHWASCaps |= g_SupportedSCapList[i][1];178 }179 180 for(i = 0; i < sizeof(g_SupportedPFList)/sizeof(g_SupportedPFList[0]); i++)181 {182 g_SupportedDDPFs |= g_SupportedPFList[i][0];183 g_SupportedVHWAPFs |= g_SupportedPFList[i][1];184 }185 186 for(i = 0; i < sizeof(gSupportedSDList)/sizeof(gSupportedSDList[0]); i++)187 {188 g_SupportedDDSDs |= gSupportedSDList[i][0];189 g_SupportedVHWASDs |= gSupportedSDList[i][1];190 }191 192 for(i = 0; i < sizeof(g_SupportedCKeyCapList)/sizeof(g_SupportedCKeyCapList[0]); i++)193 {194 g_SupportedDDCKeyCaps |= g_SupportedCKeyCapList[i][0];195 g_SupportedVHWACKeyCaps |= g_SupportedCKeyCapList[i][1];196 }197 198 g_SupportedOVERs = VBOXVHWA_OVER_DDFX199 | VBOXVHWA_OVER_HIDE200 | VBOXVHWA_OVER_KEYDEST201 | VBOXVHWA_OVER_KEYDESTOVERRIDE202 | VBOXVHWA_OVER_KEYSRC203 | VBOXVHWA_OVER_KEYSRCOVERRIDE204 | VBOXVHWA_OVER_SHOW;205 206 g_SupportedCKEYs = VBOXVHWA_CKEY_COLORSPACE207 | VBOXVHWA_CKEY_DESTBLT208 | VBOXVHWA_CKEY_DESTOVERLAY209 | VBOXVHWA_CKEY_SRCBLT210 | VBOXVHWA_CKEY_SRCOVERLAY;211 142 } 212 143 213 144 void vboxVHWATerm() 214 145 { 215 216 146 } 217 147 218 148 uint32_t vboxVHWAUnsupportedDDCAPS(uint32_t caps) 219 149 { 220 return caps & (~ g_SupportedDDCaps);150 return caps & (~VBOXVHWA_SUPPORTED_CAPS); 221 151 } 222 152 223 153 uint32_t vboxVHWAUnsupportedDDSCAPS(uint32_t caps) 224 154 { 225 return caps & (~ g_SupportedDDSCaps);155 return caps & (~VBOXVHWA_SUPPORTED_SCAPS); 226 156 } 227 157 228 158 uint32_t vboxVHWAUnsupportedDDPFS(uint32_t caps) 229 159 { 230 return caps & (~ g_SupportedDDPFs);160 return caps & (~VBOXVHWA_SUPPORTED_PF); 231 161 } 232 162 233 163 uint32_t vboxVHWAUnsupportedDSS(uint32_t caps) 234 164 { 235 return caps & (~ g_SupportedDDSDs);165 return caps & (~VBOXVHWA_SUPPORTED_SD); 236 166 } 237 167 238 168 uint32_t vboxVHWAUnsupportedDDCEYCAPS(uint32_t caps) 239 169 { 240 return caps & (~ g_SupportedDDCKeyCaps);170 return caps & (~VBOXVHWA_SUPPORTED_CKEYCAPS); 241 171 } 242 172 243 173 uint32_t vboxVHWASupportedDDCEYCAPS(uint32_t caps) 244 174 { 245 return caps & ( g_SupportedDDCKeyCaps);175 return caps & (VBOXVHWA_SUPPORTED_CKEYCAPS); 246 176 } 247 177 … … 249 179 uint32_t vboxVHWASupportedDDCAPS(uint32_t caps) 250 180 { 251 return caps & ( g_SupportedDDCaps);181 return caps & (VBOXVHWA_SUPPORTED_CAPS); 252 182 } 253 183 254 184 uint32_t vboxVHWASupportedDDSCAPS(uint32_t caps) 255 185 { 256 return caps & ( g_SupportedDDSCaps);186 return caps & (VBOXVHWA_SUPPORTED_SCAPS); 257 187 } 258 188 259 189 uint32_t vboxVHWASupportedDDPFS(uint32_t caps) 260 190 { 261 return caps & ( g_SupportedDDPFs);191 return caps & (VBOXVHWA_SUPPORTED_PF); 262 192 } 263 193 264 194 uint32_t vboxVHWASupportedDSS(uint32_t caps) 265 195 { 266 return caps & ( g_SupportedDDSDs);196 return caps & (VBOXVHWA_SUPPORTED_SD); 267 197 } 268 198 269 199 uint32_t vboxVHWASupportedOVERs(uint32_t caps) 270 200 { 271 return caps & ( g_SupportedOVERs);201 return caps & (VBOXVHWA_SUPPORTED_OVER); 272 202 } 273 203 274 204 uint32_t vboxVHWAUnsupportedOVERs(uint32_t caps) 275 205 { 276 return caps & (~ g_SupportedOVERs);206 return caps & (~VBOXVHWA_SUPPORTED_OVER); 277 207 } 278 208 279 209 uint32_t vboxVHWASupportedCKEYs(uint32_t caps) 280 210 { 281 return caps & ( g_SupportedCKEYs);211 return caps & (VBOXVHWA_SUPPORTED_CKEY); 282 212 } 283 213 284 214 uint32_t vboxVHWAUnsupportedCKEYs(uint32_t caps) 285 215 { 286 return caps & (~ g_SupportedCKEYs);216 return caps & (~VBOXVHWA_SUPPORTED_CKEY); 287 217 } 288 218 … … 301 231 uint32_t vboxVHWAFromDDCAPS(uint32_t caps) 302 232 { 303 uint32_t vhwaCaps = 0; 304 int i; 305 for(i = 0; i < sizeof(g_SupportedCapList)/sizeof(g_SupportedCapList[0]); i++) 306 { 307 if(caps & g_SupportedCapList[i][0]) 308 { 309 vhwaCaps |= g_SupportedCapList[i][1]; 310 } 311 } 312 return vhwaCaps; 233 return caps; 313 234 } 314 235 315 236 uint32_t vboxVHWAToDDCAPS(uint32_t caps) 316 237 { 317 uint32_t vhwaCaps = 0; 318 int i; 319 for(i = 0; i < sizeof(g_SupportedCapList)/sizeof(g_SupportedCapList[0]); i++) 320 { 321 if(caps & g_SupportedCapList[i][1]) 322 { 323 vhwaCaps |= g_SupportedCapList[i][0]; 324 } 325 } 326 return vhwaCaps; 238 return caps; 327 239 } 328 240 … … 339 251 uint32_t vboxVHWAFromDDSCAPS(uint32_t caps) 340 252 { 341 uint32_t vhwaCaps = 0; 342 int i; 343 for(i = 0; i < sizeof(g_SupportedSCapList)/sizeof(g_SupportedSCapList[0]); i++) 344 { 345 if(caps & g_SupportedSCapList[i][0]) 346 { 347 vhwaCaps |= g_SupportedSCapList[i][1]; 348 } 349 } 350 return vhwaCaps; 253 return caps; 351 254 } 352 255 353 256 uint32_t vboxVHWAToDDSCAPS(uint32_t caps) 354 257 { 355 uint32_t vhwaCaps = 0; 356 int i; 357 for(i = 0; i < sizeof(g_SupportedSCapList)/sizeof(g_SupportedSCapList[0]); i++) 358 { 359 if(caps & g_SupportedSCapList[i][1]) 360 { 361 vhwaCaps |= g_SupportedSCapList[i][0]; 362 } 363 } 364 return vhwaCaps; 258 return caps; 365 259 } 366 260 367 261 uint32_t vboxVHWAFromDDPFS(uint32_t caps) 368 262 { 369 uint32_t vhwaCaps = 0; 370 int i; 371 for(i = 0; i < sizeof(g_SupportedPFList)/sizeof(g_SupportedPFList[0]); i++) 372 { 373 if(caps & g_SupportedPFList[i][0]) 374 { 375 vhwaCaps |= g_SupportedPFList[i][1]; 376 } 377 } 378 return vhwaCaps; 263 return caps; 379 264 } 380 265 381 266 uint32_t vboxVHWAToDDPFS(uint32_t caps) 382 267 { 383 uint32_t vhwaCaps = 0; 384 int i; 385 for(i = 0; i < sizeof(g_SupportedPFList)/sizeof(g_SupportedPFList[0]); i++) 386 { 387 if(caps & g_SupportedPFList[i][1]) 388 { 389 vhwaCaps |= g_SupportedPFList[i][0]; 390 } 391 } 392 return vhwaCaps; 268 return caps; 393 269 } 394 270 395 271 uint32_t vboxVHWAFromDDCKEYCAPS(uint32_t caps) 396 272 { 397 uint32_t vhwaCaps = 0; 398 int i; 399 for(i = 0; i < sizeof(g_SupportedCKeyCapList)/sizeof(g_SupportedCKeyCapList[0]); i++) 400 { 401 if(caps & g_SupportedCKeyCapList[i][0]) 402 { 403 vhwaCaps |= g_SupportedCKeyCapList[i][1]; 404 } 405 } 406 return vhwaCaps; 273 return caps; 407 274 } 408 275 409 276 uint32_t vboxVHWAToDDCKEYCAPS(uint32_t caps) 410 277 { 411 uint32_t vhwaCaps = 0; 412 int i; 413 for(i = 0; i < sizeof(g_SupportedCKeyCapList)/sizeof(g_SupportedCKeyCapList[0]); i++) 414 { 415 if(caps & g_SupportedCKeyCapList[i][1]) 416 { 417 vhwaCaps |= g_SupportedCKeyCapList[i][0]; 418 } 419 } 420 return vhwaCaps; 278 return caps; 421 279 } 422 280 -
trunk/src/VBox/Frontends/VirtualBox/VirtualBoxShaders.qrc
r22883 r24646 13 13 <file alias="mainOverlayNoCKey.c">shaders/mainOverlayNoCKey.c</file> 14 14 <file alias="splitBGRA.c">shaders/splitBGRA.c</file> 15 <file alias="mainOverlayNoDiscard.c">shaders/mainOverlayNoDiscard.c</file> 16 <file alias="mainOverlayNoDiscard2.c">shaders/mainOverlayNoDiscard2.c</file> 15 17 </qresource> 16 18 </RCC> -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h
r24471 r24646 36 36 37 37 #define VBOXVHWA_ALLOW_PRIMARY_AND_OVERLAY_ONLY 1 38 39 #ifdef DEBUG_misha 40 # define VBOXVHWA_PROFILE_FPS 41 #endif 42 43 #ifdef DEBUG 44 class VBoxVHWADbgTimer 45 { 46 public: 47 VBoxVHWADbgTimer(uint32_t cPeriods); 48 ~VBoxVHWADbgTimer(); 49 void frame(); 50 uint64_t everagePeriod() {return mPeriodSum / mcPeriods; } 51 double fps() {return ((double)1000000000.0) / everagePeriod(); } 52 uint64_t frames() {return mcFrames; } 53 private: 54 uint64_t mPeriodSum; 55 uint64_t *mpaPeriods; 56 uint64_t mPrevTime; 57 uint64_t mcFrames; 58 uint32_t mcPeriods; 59 uint32_t miPeriod; 60 }; 61 62 #endif 38 63 39 64 class VBoxVHWADirtyRect … … 298 323 GLuint mPBO; 299 324 }; 325 326 #ifdef VBOXVHWA_USE_TEXGROUP 327 class VBoxVHWATextureGroup 328 { 329 public: 330 VBoxVHWATextureGroup() 331 { 332 init(0, 0); 333 } 334 335 VBoxVHWATextureGroup(uint32_t cTextures, uint32_t cBacks) 336 { 337 init(cTextures, cBacks); 338 } 339 340 ~VBoxVHWATextureGroup() 341 { 342 delete[] mppTextures; 343 delete[] mpDisplays; 344 } 345 346 VBoxVHWATexture*& operator[] (size_t i) { return mppCurTextures[i]; } 347 void swap() 348 { 349 mCur = ((++mCur) % mcSets); 350 if(mCur) 351 mppCurTextures += mcTextures; 352 else 353 mppCurTextures = mppTextures; 354 } 355 uint32_t numSets() { return mcSets; } 356 357 void init(uint32_t cTextures, uint32_t cBacks) 358 { 359 mCur = 0; 360 mcTextures = cTextures; 361 mcSets = cBacks + 1; 362 if(mcTextures) 363 { 364 mppTextures = new VBoxVHWATexture*[mcSets * cTextures]; 365 mppCurTextures = mppTextures; 366 memset(mppTextures, 0, sizeof(mppTextures[0]) * mcSets * cTextures); 367 mpDisplays = new GLuint[mcSets]; 368 memset(mpDisplays, 0, sizeof(mpDisplays[0]) * mcSets); 369 } 370 else 371 { 372 mppTextures = mppCurTextures = NULL; 373 mpDisplays = NULL; 374 } 375 } 376 377 GLuint& display() {return mpDisplays[mCur];} 378 private: 379 VBoxVHWATexture **mppTextures; 380 VBoxVHWATexture **mppCurTextures; 381 GLuint * mpDisplays; 382 uint32_t mCur; 383 uint32_t mcTextures; 384 uint32_t mcSets; 385 }; 386 #endif 300 387 301 388 class VBoxVHWAHandleTable … … 353 440 VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey, 354 441 VBoxVHWAColorKey * pSrcOverlayCKey, VBoxVHWAColorKey * pDstOverlayCKey, 442 #ifdef VBOXVHWA_USE_TEXGROUP 443 uint32_t cBackTex, 444 #endif 355 445 bool bVGA); 356 446 … … 376 466 void setTargRectPosition (const QPoint & aPoint); 377 467 void setVisibilityReinitFlag() { mNeedVisibilityReinit = true; } 378 void updateVisibility (VBoxVHWASurfaceBase *pPrimary, const QRect & aVisibleTargRect, bool b Force);468 void updateVisibility (VBoxVHWASurfaceBase *pPrimary, const QRect & aVisibleTargRect, bool bNotIntersected, bool bForce); 379 469 380 470 static ulong calcBytesPerPixel(GLenum format, GLenum type); … … 514 604 515 605 const VBoxVHWADirtyRect & getDirtyRect() { return mUpdateMem2TexRect; } 516 private: 606 607 class VBoxVHWAGlProgramVHWA * getProgram(VBoxVHWASurfaceBase * pPrimary) 608 { 609 if(mVisibleDisplayInitialized) 610 return mpProgram; 611 return calcProgram(pPrimary); 612 } 613 private: 614 class VBoxVHWAGlProgramVHWA * calcProgram(VBoxVHWASurfaceBase * pPrimary); 517 615 void setRectValues (const QRect & aTargRect, const QRect & aSrcRect); 518 616 void setVisibleRectValues (const QRect & aVisTargRect); … … 522 620 void deleteDisplay(); 523 621 524 int createDisplay(VBoxVHWASurfaceBase *pPrimary, GLuint *pDisplay, class VBoxVHWAGlProgram ** ppProgram);622 int createDisplay(VBoxVHWASurfaceBase *pPrimary, GLuint *pDisplay, class VBoxVHWAGlProgramVHWA ** ppProgram); 525 623 void doDisplay(VBoxVHWASurfaceBase *pPrimary, bool bProgram, bool bBindDst); 526 624 bool synchTexMem(const QRect * aRect); … … 540 638 QRect mVisibleSrcRect; 541 639 640 #ifndef VBOXVHWA_USE_TEXGROUP 542 641 GLuint mVisibleDisplay; 543 class VBoxVHWAGlProgram * mpProgram; 642 #endif 643 class VBoxVHWAGlProgramVHWA * mpProgram; 544 644 545 645 bool mVisibleDisplayInitialized; 546 646 bool mNeedVisibilityReinit; 647 bool mNotIntersected; 547 648 548 649 uchar * mAddress; 650 #ifdef VBOXVHWA_USE_TEXGROUP 651 VBoxVHWATextureGroup mpTex; 652 #else 549 653 VBoxVHWATexture *mpTex[3]; 654 #endif 550 655 551 656 VBoxVHWAColorFormat mColorFormat; … … 647 752 public: 648 753 VBoxVHWADisplay() : 649 mSurfVGA(NULL) 754 mSurfVGA(NULL), 755 mbDisplayPrimary(true) 650 756 // , 651 757 // mSurfPrimary(NULL) … … 718 824 { 719 825 VBoxVHWASurfaceBase * pPrimary = mPrimary.current(); 720 bForce |= pPrimary->performDisplay(NULL, bForce); 826 827 if(mbDisplayPrimary) 828 { 829 #ifdef DEBUG_misha 830 /* should only display overlay now */ 831 AssertBreakpoint(); 832 #endif 833 bForce |= pPrimary->performDisplay(NULL, bForce); 834 } 721 835 722 836 for (OverlayList::const_iterator it = mOverlays.begin(); … … 732 846 } 733 847 848 bool isPrimary(VBoxVHWASurfaceBase * pSurf) { return pSurf->getComplexList() == &mPrimary; } 849 850 void setDisplayPrimary(bool bDisplay) { mbDisplayPrimary = bDisplay; } 851 734 852 const OverlayList & overlays() const {return mOverlays;} 735 853 const VBoxVHWASurfList & primaries() const { return mPrimary; } … … 740 858 741 859 OverlayList mOverlays; 860 861 bool mbDisplayPrimary; 742 862 }; 743 863 … … 979 1099 bool hasSurfaces() const; 980 1100 bool hasVisibleOverlays(); 981 const QRect & overlaysRectUnion(); 1101 QRect overlaysRectUnion(); 1102 QRect overlaysRectIntersection(); 982 1103 #endif 983 1104 … … 1008 1129 const QRect & vboxViewport() const {return mViewport;} 1009 1130 1131 #ifdef VBOXVHWA_PROFILE_FPS 1132 void reportNewFrame() { mbNewFrame = true; } 1133 #endif 1134 1010 1135 bool performDisplayAndSwap(bool bForce) 1011 1136 { 1012 bForce = mDisplay.performDisplay(bForce | mRepaintNeeded); 1137 // VBOXQGLLOG_METHODTIME("t:"); 1138 1139 bForce = mDisplay.performDisplay(bForce | mRepaintNeeded); 1013 1140 if(bForce) 1014 1141 { 1015 1142 swapBuffers(); 1016 1143 } 1144 1145 #ifdef VBOXVHWA_PROFILE_FPS 1146 if(mbNewFrame) 1147 { 1148 mFPSCounter.frame(); 1149 double fps = mFPSCounter.fps(); 1150 if(!(mFPSCounter.frames() % 31)) 1151 { 1152 printf("fps: %f\n", fps); 1153 } 1154 mbNewFrame = false; 1155 } 1156 #endif 1017 1157 return bForce; 1018 1158 } … … 1065 1205 int vhwaSaveOverlayData(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, bool bVisible); 1066 1206 int vhwaLoadOverlayData(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version); 1207 int vhwaLoadVHWAEnable(VHWACommandList * pCmdList); 1067 1208 void vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd); 1068 1209 #endif … … 1120 1261 1121 1262 class VBoxVHWAGlProgramMngr *mpMngr; 1263 1264 #ifdef VBOXVHWA_PROFILE_FPS 1265 VBoxVHWADbgTimer mFPSCounter; 1266 bool mbNewFrame; 1267 #endif 1122 1268 }; 1123 1269 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r24516 r24646 61 61 #define VBOXQGL_STATE_VERSION 1 62 62 63 #ifdef DEBUG 64 VBoxVHWADbgTimer::VBoxVHWADbgTimer(uint32_t cPeriods) : 65 mPeriodSum(0LL), 66 mPrevTime(0LL), 67 mcFrames(0LL), 68 mcPeriods(cPeriods), 69 miPeriod(0) 70 { 71 mpaPeriods = new uint64_t[cPeriods]; 72 memset(mpaPeriods, 0, cPeriods * sizeof(mpaPeriods[0])); 73 } 74 75 VBoxVHWADbgTimer::~VBoxVHWADbgTimer() 76 { 77 delete[] mpaPeriods; 78 } 79 80 void VBoxVHWADbgTimer::frame() 81 { 82 uint64_t cur = VBOXGETTIME(); 83 if(mPrevTime) 84 { 85 uint64_t curPeriod = cur - mPrevTime; 86 mPeriodSum += curPeriod - mpaPeriods[miPeriod]; 87 mpaPeriods[miPeriod] = curPeriod; 88 ++miPeriod; 89 miPeriod %= mcPeriods; 90 } 91 mPrevTime = cur; 92 ++mcFrames; 93 } 94 #endif 95 63 96 //#define VBOXQGLOVERLAY_STATE_NAMEBASE "QGLOverlayVHWAData" 64 97 //#define VBOXQGLOVERLAY_STATE_VERSION 1 … … 587 620 } 588 621 589 #define VBOXVHWA_PROGRAM_DSTCOLORKEY 0x00000001 590 #define VBOXVHWA_PROGRAM_SRCCOLORKEY 0x00000002 591 #define VBOXVHWA_PROGRAM_COLORCONV 0x00000004 622 #define VBOXVHWA_PROGRAM_DSTCOLORKEY 0x00000001 623 #define VBOXVHWA_PROGRAM_SRCCOLORKEY 0x00000002 624 #define VBOXVHWA_PROGRAM_COLORCONV 0x00000004 625 #define VBOXVHWA_PROGRAM_COLORKEYNODISCARD 0x00000008 626 627 #define VBOXVHWA_SUPPORTED_PROGRAM ( \ 628 VBOXVHWA_PROGRAM_DSTCOLORKEY \ 629 | VBOXVHWA_PROGRAM_SRCCOLORKEY \ 630 | VBOXVHWA_PROGRAM_COLORCONV \ 631 | VBOXVHWA_PROGRAM_COLORKEYNODISCARD \ 632 ) 592 633 593 634 class VBoxVHWAGlProgramVHWA : public VBoxVHWAGlProgram … … 878 919 // mShaderCKeySrcVoid; 879 920 mShaderMainOverlay(":/mainOverlay.c", GL_FRAGMENT_SHADER), 880 mShaderMainOverlayNoCKey(":/mainOverlayNoCKey.c", GL_FRAGMENT_SHADER) 921 mShaderMainOverlayNoCKey(":/mainOverlayNoCKey.c", GL_FRAGMENT_SHADER), 922 mShaderMainOverlayNoDiscard(":/mainOverlayNoDiscard.c", GL_FRAGMENT_SHADER), 923 mShaderMainOverlayNoDiscard2(":/mainOverlayNoDiscard2.c", GL_FRAGMENT_SHADER) 881 924 {} 882 925 883 VBoxVHWAGlProgramVHWA * getProgram( bool bDstCKey, bool bSrcCKey, const VBoxVHWAColorFormat * pFrom, const VBoxVHWAColorFormat * pTo);926 VBoxVHWAGlProgramVHWA * getProgram(uint32_t type, const VBoxVHWAColorFormat * pFrom, const VBoxVHWAColorFormat * pTo); 884 927 885 928 void stopCurrentProgram() … … 925 968 VBoxVHWAGlShaderComponent mShaderMainOverlay; 926 969 VBoxVHWAGlShaderComponent mShaderMainOverlayNoCKey; 970 VBoxVHWAGlShaderComponent mShaderMainOverlayNoDiscard; 971 VBoxVHWAGlShaderComponent mShaderMainOverlayNoDiscard2; 927 972 928 973 friend class VBoxVHWAGlProgramVHWA; … … 939 984 cShaders++; 940 985 941 if(type & VBOXVHWA_PROGRAM_DSTCOLORKEY) 986 if(!!(type & VBOXVHWA_PROGRAM_DSTCOLORKEY) 987 && !(type & VBOXVHWA_PROGRAM_COLORKEYNODISCARD)) 942 988 { 943 989 if(fourcc == FOURCC_YV12) … … 1000 1046 } 1001 1047 1002 if(type & VBOXVHWA_PROGRAM_DSTCOLORKEY) 1003 { 1004 apShaders[cShaders++] = &mShaderMainOverlay; 1048 if(type & VBOXVHWA_PROGRAM_DSTCOLORKEY) 1049 { 1050 if(type & VBOXVHWA_PROGRAM_COLORKEYNODISCARD) 1051 { 1052 if(fourcc == FOURCC_YV12) 1053 { 1054 apShaders[cShaders++] = &mShaderMainOverlayNoDiscard2; 1055 } 1056 else 1057 { 1058 apShaders[cShaders++] = &mShaderMainOverlayNoDiscard; 1059 } 1060 } 1061 else 1062 { 1063 apShaders[cShaders++] = &mShaderMainOverlay; 1064 } 1005 1065 } 1006 1066 else … … 1021 1081 } 1022 1082 1023 VBoxVHWAGlProgramVHWA * VBoxVHWAGlProgramMngr::getProgram( bool bDstCKey, bool bSrcCKey, const VBoxVHWAColorFormat * pFrom, const VBoxVHWAColorFormat * pTo)1083 VBoxVHWAGlProgramVHWA * VBoxVHWAGlProgramMngr::getProgram(uint32_t type, const VBoxVHWAColorFormat * pFrom, const VBoxVHWAColorFormat * pTo) 1024 1084 { 1025 1085 Q_UNUSED(pTo); 1026 uint32_t type = 0;1027 1086 uint32_t fourcc = 0; 1028 if(bDstCKey) 1029 { 1030 type |= VBOXVHWA_PROGRAM_DSTCOLORKEY; 1031 } 1032 if(bSrcCKey) 1033 { 1034 type |= VBOXVHWA_PROGRAM_SRCCOLORKEY; 1035 } 1087 type &= VBOXVHWA_SUPPORTED_PROGRAM; 1088 1036 1089 if(pFrom && pFrom->fourcc()) 1037 1090 { … … 1039 1092 type |= VBOXVHWA_PROGRAM_COLORCONV; 1040 1093 } 1094 else 1095 { 1096 type &= (~VBOXVHWA_PROGRAM_COLORCONV); 1097 } 1098 1099 if(!(type & VBOXVHWA_PROGRAM_DSTCOLORKEY) 1100 && !(type & VBOXVHWA_PROGRAM_SRCCOLORKEY)) 1101 { 1102 type &= (~VBOXVHWA_PROGRAM_COLORKEYNODISCARD); 1103 } 1104 1041 1105 if(type) 1042 1106 return searchProgram(type, fourcc, true); … … 1101 1165 mFreeAddress = false; 1102 1166 1167 #ifdef VBOXVHWA_USE_TEXGROUP 1168 for(int i = mpTex.numSets()-1; i >=0; --i) 1169 { 1170 #endif 1103 1171 mpTex[0]->setAddress(mAddress); 1104 1172 if(fourcc() == FOURCC_YV12) … … 1109 1177 mpTex[2]->setAddress(pTexAddr); 1110 1178 } 1179 #ifdef VBOXVHWA_USE_TEXGROUP 1180 mpTex.swap(); 1181 } 1182 #endif 1111 1183 1112 1184 // makeCurrent(); … … 1181 1253 VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey, 1182 1254 VBoxVHWAColorKey * pSrcOverlayCKey, VBoxVHWAColorKey * pDstOverlayCKey, 1255 #ifdef VBOXVHWA_USE_TEXGROUP 1256 uint32_t cBackTex, 1257 #endif 1183 1258 bool bVGA) : 1184 1259 mRect(0,0,aSize.width(),aSize.height()), … … 1186 1261 mVisibleDisplayInitialized(false), 1187 1262 mNeedVisibilityReinit(true), 1263 mNotIntersected(false), 1188 1264 mAddress(NULL), 1189 1265 mColorFormat(aColorFormat), … … 1214 1290 resetDefaultSrcOverlayCKey(); 1215 1291 1292 #ifdef VBOXVHWA_USE_TEXGROUP 1293 mpTex.init(mColorFormat.fourcc() == FOURCC_YV12 ? 3 : 1, cBackTex); 1294 Assert(mpTex.numSets()); 1295 for(int i = mpTex.numSets()-1; i >=0; --i) 1296 { 1297 #endif 1216 1298 mpTex[0] = vboxVHWATextureCreate(mWidget->context(), QRect(0,0,aSize.width(),aSize.height()), mColorFormat, bVGA); 1217 1299 if(mColorFormat.fourcc() == FOURCC_YV12) … … 1221 1303 mpTex[2] = vboxVHWATextureCreate(mWidget->context(), rect, mColorFormat, bVGA); 1222 1304 } 1305 #ifdef VBOXVHWA_USE_TEXGROUP 1306 mpTex.swap(); 1307 } 1308 #endif 1223 1309 1224 1310 setRectValues(aTargRect, aSrcRect); … … 1310 1396 deleteDisplay(); 1311 1397 1398 #ifdef VBOXVHWA_USE_TEXGROUP 1399 for(int i = mpTex.numSets()-1; i >=0; --i) 1400 { 1401 #endif 1312 1402 delete mpTex[0]; 1313 1403 if(fourcc() == FOURCC_YV12) … … 1316 1406 delete mpTex[2]; 1317 1407 } 1408 #ifdef VBOXVHWA_USE_TEXGROUP 1409 mpTex.swap(); 1410 } 1411 #endif 1318 1412 1319 1413 if(mAddress && mFreeAddress) … … 1369 1463 #endif 1370 1464 1465 #ifdef VBOXVHWA_USE_TEXGROUP 1466 for(int i = mpTex.numSets()-1; i >=0; --i) 1467 { 1468 #endif 1371 1469 mpTex[0]->init(address); 1372 1470 if(fourcc() == FOURCC_YV12) … … 1375 1473 mpTex[2]->init(address); 1376 1474 } 1377 1475 #ifdef VBOXVHWA_USE_TEXGROUP 1476 mpTex.swap(); 1477 } 1478 #endif 1378 1479 1379 1480 if(pvMem) … … 1390 1491 } 1391 1492 1493 #ifdef VBOXVHWA_USE_TEXGROUP 1494 for(int i = mpTex.numSets()-1; i >=0; --i) 1495 { 1496 #endif 1392 1497 mpTex[0]->setAddress(mAddress); 1393 1498 if(fourcc() == FOURCC_YV12) … … 1398 1503 mpTex[2]->setAddress(pTexAddr); 1399 1504 } 1505 #ifdef VBOXVHWA_USE_TEXGROUP 1506 mpTex.swap(); 1507 } 1508 #endif 1400 1509 1401 1510 initDisplay(pPrimary); … … 1597 1706 if(pRect && !mUpdateMem2TexRect.rect().intersects(*pRect)) 1598 1707 return false; 1708 1709 #ifdef VBOXVHWA_USE_TEXGROUP 1710 mpTex.swap(); 1711 #endif 1712 1713 #ifdef VBOXVHWA_PROFILE_FPS 1714 mWidget->reportNewFrame(); 1715 #endif 1599 1716 1600 1717 mpTex[0]->update(&mUpdateMem2TexRect.rect()); … … 2165 2282 } 2166 2283 2167 void VBoxVHWASurfaceBase::updateVisibility (VBoxVHWASurfaceBase *pPrimary, const QRect & aVisibleTargRect, bool b Force)2168 { 2169 if(mNeedVisibilityReinit || bForce || aVisibleTargRect.intersected(mTargRect) != mVisibleTargRect )2284 void VBoxVHWASurfaceBase::updateVisibility (VBoxVHWASurfaceBase *pPrimary, const QRect & aVisibleTargRect, bool bNotIntersected, bool bForce) 2285 { 2286 if(mNeedVisibilityReinit || bForce || aVisibleTargRect.intersected(mTargRect) != mVisibleTargRect || mNotIntersected != bNotIntersected) 2170 2287 { 2171 2288 setVisibleRectValues(aVisibleTargRect); 2289 mNotIntersected = bNotIntersected; 2172 2290 initDisplay(pPrimary); 2173 2291 mNeedVisibilityReinit = false; … … 2181 2299 if(mVisibleDisplayInitialized) 2182 2300 { 2301 #ifdef VBOXVHWA_USE_TEXGROUP 2302 for(int i = mpTex.numSets()-1; i >=0; --i) 2303 { 2304 if(mpTex.display()) 2305 { 2306 glDeleteLists(mpTex.display(), 1); 2307 mpTex.display() = 0; 2308 } 2309 if(mpProgram) 2310 { 2311 mpProgram = NULL; 2312 } 2313 mpTex.swap(); 2314 } 2315 #else 2183 2316 if(mVisibleDisplay) 2184 2317 { 2185 2318 glDeleteLists(mVisibleDisplay, 1); 2319 mVisibleDisplay = 0; 2186 2320 } 2187 2321 if(mpProgram) … … 2189 2323 mpProgram = NULL; 2190 2324 } 2325 #endif 2191 2326 mVisibleDisplayInitialized = false; 2192 2327 } … … 2273 2408 } 2274 2409 2275 int VBoxVHWASurfaceBase::createDisplay(VBoxVHWASurfaceBase *pPrimary, GLuint *pDisplay, class VBoxVHWAGlProgram ** ppProgram) 2410 class VBoxVHWAGlProgramVHWA * VBoxVHWASurfaceBase::calcProgram(VBoxVHWASurfaceBase * pPrimary) 2411 { 2412 const VBoxVHWAColorKey * pSrcCKey = NULL, *pDstCKey = NULL; 2413 uint32_t type = 0; 2414 2415 pSrcCKey = getActiveSrcOverlayCKey(); 2416 /* we use src (overlay) surface to maintain overridden dst ckey info 2417 * to allow multiple overlays have different overridden dst keys for one primary surface */ 2418 /* non-null dstOverlayCKey for overlay would mean the overlay surface contains the overridden 2419 * dst ckey value in defaultDstOverlayCKey 2420 * this allows the NULL to be a valid overridden value as well */ 2421 pDstCKey = getActiveDstOverlayCKey(pPrimary); 2422 2423 if(pDstCKey != NULL) 2424 type |= VBOXVHWA_PROGRAM_DSTCOLORKEY; 2425 if(pSrcCKey) 2426 type |= VBOXVHWA_PROGRAM_SRCCOLORKEY; 2427 if((pDstCKey || pSrcCKey) && mNotIntersected) 2428 type |= VBOXVHWA_PROGRAM_COLORKEYNODISCARD; 2429 2430 return mWidget->vboxVHWAGetGlProgramMngr()->getProgram(type, &colorFormat(), &pPrimary->colorFormat()); 2431 } 2432 2433 int VBoxVHWASurfaceBase::createDisplay(VBoxVHWASurfaceBase *pPrimary, GLuint *pDisplay, class VBoxVHWAGlProgramVHWA ** ppProgram) 2276 2434 { 2277 2435 if(mVisibleTargRect.isEmpty()) … … 2289 2447 2290 2448 VBoxVHWAGlProgramVHWA * pProgram = NULL; 2291 const VBoxVHWAColorKey * pSrcCKey = NULL, *pDstCKey = NULL;2292 2449 if(pPrimary) 2293 2450 { 2294 pSrcCKey = getActiveSrcOverlayCKey(); 2295 /* we use src (overlay) surface to maintain overridden dst ckey info 2296 * to allow multiple overlays have different overridden dst keys for one primary surface */ 2297 /* non-null dstOverlayCKey for overlay would mean the overlay surface contains the overridden 2298 * dst ckey value in defaultDstOverlayCKey 2299 * this allows the NULL to be a valid overridden value as well */ 2300 pDstCKey = getActiveDstOverlayCKey(pPrimary); 2301 // pSrcCKey = NULL; 2302 // pDstCKey = NULL; 2303 2304 pProgram = mWidget->vboxVHWAGetGlProgramMngr()->getProgram(pDstCKey != NULL, pSrcCKey != NULL, &colorFormat(), &pPrimary->colorFormat()); 2451 pProgram = calcProgram(pPrimary); 2305 2452 } 2306 2453 … … 2331 2478 if(display) 2332 2479 { 2480 const VBoxVHWAColorKey * pDstCKey = pPrimary ? getActiveDstOverlayCKey(pPrimary) : NULL; 2481 2333 2482 glNewList(display, GL_COMPILE); 2334 2483 … … 2355 2504 deleteDisplay(); 2356 2505 2357 int rc = createDisplay(pPrimary, &mVisibleDisplay, &mpProgram); 2506 int rc; 2507 #ifdef VBOXVHWA_USE_TEXGROUP 2508 for(int i = mpTex.numSets()-1; i >=0; --i) 2509 { 2510 rc = createDisplay(pPrimary, &mpTex.display(), &mpProgram); 2511 AssertRC(rc); 2512 if(RT_FAILURE(rc)) 2513 break; 2514 mpTex.swap(); 2515 } 2516 #else 2517 rc = createDisplay(pPrimary, &mVisibleDisplay, &mpProgram); 2518 AssertRC(rc); 2519 #endif 2358 2520 if(RT_SUCCESS(rc)) 2359 2521 { … … 2384 2546 { 2385 2547 Assert(mVisibleDisplayInitialized); 2548 2549 #ifdef VBOXVHWA_USE_TEXGROUP 2550 if(mpTex.display() == 0) 2551 #else 2386 2552 if(mVisibleDisplay == 0) 2553 #endif 2387 2554 { 2388 2555 /* nothing to display, i.e. the surface is not visible, … … 2407 2574 return false; 2408 2575 2576 #ifdef VBOXVHWA_USE_TEXGROUP 2577 Assert(mpTex.display()); 2578 #else 2409 2579 Assert(mVisibleDisplay); 2580 #endif 2410 2581 2411 2582 if(!mVisibleDisplayInitialized) 2412 2583 { 2413 2584 VBoxVHWAGlProgramVHWA * pProgram = NULL; 2414 const VBoxVHWAColorKey * pSrcCKey = NULL, *pDstCKey = NULL;2415 2585 if(pPrimary) 2416 2586 { 2417 pSrcCKey = getActiveSrcOverlayCKey(); 2418 /* we use src (overlay) surface to maintain overridden dst ckey info 2419 * to allow multiple overlays have different overridden dst keys for one primary surface */ 2420 /* non-null dstOverlayCKey for overlay would mean the overlay surface contains the overridden 2421 * dst ckey value in defaultDstOverlayCKey 2422 * this allows the NULL to be a valid overridden value as well */ 2423 pDstCKey = getActiveDstOverlayCKey(pPrimary); 2424 // pSrcCKey = NULL; 2425 // pDstCKey = NULL; 2426 2427 pProgram = mWidget->vboxVHWAGetGlProgramMngr()->getProgram(pDstCKey != NULL, pSrcCKey != NULL, &colorFormat(), &pPrimary->colorFormat()); 2428 } 2587 pProgram = calcProgram(pPrimary); 2588 } 2589 2590 const VBoxVHWAColorKey * pDstCKey = NULL; 2591 pDstCKey = getActiveDstOverlayCKey(pPrimary); 2429 2592 2430 2593 if(pProgram) … … 2441 2604 if(mpProgram) 2442 2605 mpProgram->start(); 2606 #ifdef VBOXVHWA_USE_TEXGROUP 2607 VBOXQGL_CHECKERR( 2608 glCallList(mpTex.display()); 2609 ); 2610 #else 2443 2611 VBOXQGL_CHECKERR( 2444 2612 glCallList(mVisibleDisplay); 2445 2613 ); 2614 #endif 2446 2615 if(mpProgram) 2447 2616 mpProgram->stop(); … … 2487 2656 mConstructingList(NULL), 2488 2657 mcRemaining2Contruct(0) 2658 #ifdef VBOXVHWA_PROFILE_FPS 2659 , 2660 mFPSCounter(64), 2661 mbNewFrame(false) 2662 #endif 2489 2663 { 2490 2664 mpMngr = new VBoxVHWAGlProgramMngr(); … … 2811 2985 } 2812 2986 } 2813 #ifdef DEBUG_misha 2814 Assert(bFound); 2815 #endif 2987 2816 2988 if(!bFound) 2817 2989 { 2818 #ifdef DEBUG_misha 2819 Assert(0); 2820 #endif 2990 VBOXQGLLOG(("!!unsupported fourcc!!!: %c%c%c%c\n", 2991 (pCmd->SurfInfo.PixelFormat.fourCC & 0x000000ff), 2992 (pCmd->SurfInfo.PixelFormat.fourCC & 0x0000ff00) >> 8, 2993 (pCmd->SurfInfo.PixelFormat.fourCC & 0x00ff0000) >> 16, 2994 (pCmd->SurfInfo.PixelFormat.fourCC & 0xff000000) >> 24 2995 )); 2996 //#ifdef DEBUG_misha 2997 // Assert(0); 2998 //#endif 2821 2999 pCmd->u.out.ErrInfo = -1; 2822 3000 return VINF_SUCCESS; … … 2957 3135 format, 2958 3136 pSrcBltCKey, pDstBltCKey, pSrcOverlayCKey, pDstOverlayCKey, 3137 #ifdef VBOXVHWA_USE_TEXGROUP 3138 0, 3139 #endif 2959 3140 bNoPBO); 2960 3141 } … … 2972 3153 format, 2973 3154 pSrcBltCKey, pDstBltCKey, pSrcOverlayCKey, pDstOverlayCKey, 3155 #ifdef VBOXVHWA_USE_TEXGROUP 3156 0, 3157 #endif 2974 3158 bNoPBO); 2975 3159 } … … 3161 3345 bool bFound = false; 3162 3346 3163 for (OverlayList::const_iterator it = overlays.begin(); 3164 it != overlays.end(); ++ it) 3165 { 3166 VBoxVHWASurfList * pSurfList = *it; 3167 if(pSurfList->current() == pSurf) 3347 if(!mDisplay.isPrimary(pSurf)) 3348 { 3349 for (OverlayList::const_iterator it = overlays.begin(); 3350 it != overlays.end(); ++ it) 3168 3351 { 3169 bFound = true; 3170 break; 3352 VBoxVHWASurfList * pSurfList = *it; 3353 if(pSurfList->current() == pSurf) 3354 { 3355 bFound = true; 3356 break; 3357 } 3171 3358 } 3172 } 3173 3174 Assert(bFound); 3359 3360 Assert(bFound); 3361 } 3362 3363 // Assert(bFound); 3175 3364 } 3176 3365 #endif … … 3181 3370 pSurf->updatedMem(&r); 3182 3371 } 3372 3183 3373 return pSurf->unlock(); 3184 3374 } … … 3323 3513 const VBoxVHWAColorKey *pResDstCKey = pSrcSurf->getActiveDstOverlayCKey(pDstSurf); 3324 3514 3325 VBoxVHWAGlProgramVHWA *pProgram = vboxVHWAGetGlProgramMngr()->getProgram(pResDstCKey != NULL, pResSrcCKey != NULL, &pSrcSurf->colorFormat(), &pDstSurf->colorFormat());3326 3515 /* @todo: may need to update glDisplayList here !! */ 3516 VBoxVHWAGlProgramVHWA *pProgram = pSrcSurf->getProgram(pDstSurf); 3327 3517 if(pProgram) 3328 3518 { … … 3552 3742 | VBOXVHWA_SCAPS_LOCALVIDMEM 3553 3743 | VBOXVHWA_SCAPS_OVERLAY 3744 // | VBOXVHWA_SCAPS_BACKBUFFER 3745 // | VBOXVHWA_SCAPS_FRONTBUFFER 3554 3746 // | VBOXVHWA_SCAPS_VIDEOMEMORY 3555 3747 // | VBOXVHWA_SCAPS_COMPLEX … … 4024 4216 } 4025 4217 4218 int VBoxGLWidget::vhwaLoadVHWAEnable(VHWACommandList * pCmdList) 4219 { 4220 char *buf = (char*)malloc(sizeof(VBOXVHWACMD)); 4221 Assert(buf); 4222 if(buf) 4223 { 4224 memset(buf, 0, sizeof(buf)); 4225 VBOXVHWACMD * pCmd = (VBOXVHWACMD*)buf; 4226 pCmd->enmCmd = VBOXVHWACMD_TYPE_ENABLE; 4227 pCmd->Flags = VBOXVHWACMD_FLAG_HH_CMD; 4228 pCmdList->push_back(pCmd); 4229 return VINF_SUCCESS; 4230 } 4231 4232 return VERR_OUT_OF_RESOURCES; 4233 } 4234 4026 4235 int VBoxGLWidget::vhwaLoadExec(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version) 4027 4236 { … … 4040 4249 if(RT_SUCCESS(rc)) 4041 4250 { 4251 if(u32) 4252 { 4253 rc = vhwaLoadVHWAEnable(pCmdList); 4254 AssertRC(rc); 4255 } 4256 4042 4257 for(uint32_t i = 0; i < u32; ++i) 4043 4258 { … … 4200 4415 { 4201 4416 VBoxVHWASurfaceBase *pSurf = *pr; 4202 pSurf->updateVisibility(NULL, aRect, false );4417 pSurf->updateVisibility(NULL, aRect, false, false); 4203 4418 } 4204 4419 4205 4420 const OverlayList & overlays = mDisplay.overlays(); 4421 QRect & overInter = overlaysRectIntersection(); 4422 overInter = overInter.intersect(aRect); 4423 4424 bool bDisplayPrimary = true; 4206 4425 4207 4426 for (OverlayList::const_iterator it = overlays.begin(); … … 4210 4429 VBoxVHWASurfList * pSurfList = *it; 4211 4430 const SurfList & surfaces = pSurfList->surfaces(); 4212 for (SurfList::const_iterator sit = surfaces.begin(); 4213 sit != surfaces.end(); ++ sit) 4214 { 4215 VBoxVHWASurfaceBase *pSurf = *sit; 4216 pSurf->updateVisibility(mDisplay.getPrimary(), aRect, false); 4217 } 4218 } 4431 if(surfaces.size()) 4432 { 4433 bool bNotIntersected = !overInter.isEmpty() && surfaces.front()->targRect().contains(overInter); 4434 Assert(bNotIntersected); 4435 4436 bDisplayPrimary &= !bNotIntersected; 4437 for (SurfList::const_iterator sit = surfaces.begin(); 4438 sit != surfaces.end(); ++ sit) 4439 { 4440 VBoxVHWASurfaceBase *pSurf = *sit; 4441 pSurf->updateVisibility(mDisplay.getPrimary(), aRect, bNotIntersected, false); 4442 } 4443 } 4444 } 4445 4446 Assert(!bDisplayPrimary); 4447 mDisplay.setDisplayPrimary(bDisplayPrimary); 4219 4448 } 4220 4449 … … 4241 4470 } 4242 4471 4243 const QRect &VBoxGLWidget::overlaysRectUnion()4472 QRect VBoxGLWidget::overlaysRectUnion() 4244 4473 { 4245 4474 const OverlayList & overlays = mDisplay.overlays(); … … 4255 4484 } 4256 4485 return un.toRect(); 4486 } 4487 4488 QRect VBoxGLWidget::overlaysRectIntersection() 4489 { 4490 const OverlayList & overlays = mDisplay.overlays(); 4491 QRect rect; 4492 VBoxVHWADirtyRect un; 4493 for (OverlayList::const_iterator it = overlays.begin(); 4494 it != overlays.end(); ++ it) 4495 { 4496 VBoxVHWASurfaceBase * pOverlay = (*it)->current(); 4497 if(pOverlay != NULL) 4498 { 4499 if(rect.isNull()) 4500 { 4501 rect = pOverlay->targRect(); 4502 } 4503 else 4504 { 4505 rect = rect.intersected(pOverlay->targRect()); 4506 if(rect.isNull()) 4507 break; 4508 } 4509 } 4510 } 4511 return rect; 4257 4512 } 4258 4513 … … 4450 4705 dispRect, /* we do not know viewport at the stage of recise, set as a disp rect, it will be updated on repaint */ 4451 4706 format, 4452 (VBoxVHWAColorKey*)NULL, (VBoxVHWAColorKey*)NULL, (VBoxVHWAColorKey*)NULL, (VBoxVHWAColorKey*)NULL, true); 4707 (VBoxVHWAColorKey*)NULL, (VBoxVHWAColorKey*)NULL, (VBoxVHWAColorKey*)NULL, (VBoxVHWAColorKey*)NULL, 4708 #ifdef VBOXVHWA_USE_TEXGROUP 4709 0, 4710 #endif 4711 true); 4453 4712 pDisplay->init(NULL, mUsesGuestVRAM ? re->VRAM() : NULL); 4454 4713 mDisplay.setVGA(pDisplay); … … 4477 4736 mViewport, 4478 4737 tmpFormat, 4479 NULL, NULL, NULL, &VBoxVHWAColorKey(0,0), false); 4738 NULL, NULL, NULL, &VBoxVHWAColorKey(0,0), 4739 #ifdef VBOXVHWA_USE_TEXGROUP 4740 0, 4741 #endif 4742 false); 4480 4743 4481 4744 Assert(mDisplay.getVGA());
Note:
See TracChangeset
for help on using the changeset viewer.