Changeset 49262 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 23, 2013 4:57:54 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r49167 r49262 73 73 74 74 /** 75 * Checks if the framebuffer marked as <b>unused</b>.76 * @returns @c true if framebuffer ingores EMT events, @c false otherwise.77 * @note Any call to this (and #setMarkAsUnused method) is synchronized between calling threads.78 */79 bool UIFrameBuffer::isMarkedAsUnused() const80 {81 lock();82 bool fIsMarkedAsUnused = m_fIsMarkedAsUnused;83 unlock();84 return fIsMarkedAsUnused;85 }86 87 /**88 75 * Sets the framebuffer <b>unused</b> status. 89 76 * @param fIsMarkAsUnused determines whether framebuffer should ignore EMT events or not. 90 * @note Any call to this (and #isMarkedAsUnused method) is synchronized between calling threads.77 * @note Call to this (and any EMT callback) method is synchronized between calling threads (from GUI side). 91 78 */ 92 79 void UIFrameBuffer::setMarkAsUnused(bool fIsMarkAsUnused) … … 190 177 } 191 178 179 /** 180 * EMT callback: Requests a size and pixel format change. 181 * @param uScreenId Guest screen number. Must be used in the corresponding call to CDisplay::ResizeCompleted if this call is made. 182 * @param uPixelFormat Pixel format of the memory buffer pointed to by @a pVRAM. 183 * @param pVRAM Pointer to the virtual video card's VRAM (may be <i>null</i>). 184 * @param uBitsPerPixel Color depth, bits per pixel. 185 * @param uBytesPerLine Size of one scan line, in bytes. 186 * @param uWidth Width of the guest display, in pixels. 187 * @param uHeight Height of the guest display, in pixels. 188 * @param pfFinished Can the VM start using the new frame buffer immediately after this method returns or it should wait for CDisplay::ResizeCompleted. 189 * @note Any EMT callback is subsequent. No any other EMT callback can be called until this one processed. 190 * @note Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side). 191 */ 192 192 STDMETHODIMP UIFrameBuffer::RequestResize(ULONG uScreenId, ULONG uPixelFormat, 193 193 BYTE *pVRAM, ULONG uBitsPerPixel, ULONG uBytesPerLine, 194 194 ULONG uWidth, ULONG uHeight, 195 BOOL *p bFinished)195 BOOL *pfFinished) 196 196 { 197 197 LogRelFlow(("UIFrameBuffer::RequestResize: " … … 204 204 205 205 /* Make sure result pointer is valid: */ 206 if (!pbFinished) 207 return E_POINTER; 206 if (!pfFinished) 207 { 208 LogRelFlow(("UIFrameBuffer::RequestResize: Invalid pfFinished pointer!\n")); 209 210 return E_POINTER; 211 } 212 213 /* Lock access to frame-buffer: */ 214 lock(); 208 215 209 216 /* Make sure frame-buffer is used: */ 210 if ( isMarkedAsUnused())217 if (m_fIsMarkedAsUnused) 211 218 { 212 219 LogRelFlow(("UIFrameBuffer::RequestResize: Ignored!\n")); … … 215 222 * It is required to report to the VM thread that we finished resizing and rely on the 216 223 * later synchronisation when the new view is attached. */ 217 *pbFinished = TRUE; 224 *pfFinished = TRUE; 225 226 /* Unlock access to frame-buffer: */ 227 unlock(); 218 228 219 229 /* Ignore RequestResize: */ … … 222 232 223 233 /* Mark request as not-yet-finished: */ 224 *p bFinished = FALSE;234 *pfFinished = FALSE; 225 235 226 236 /* Widget resize is NOT thread-safe and *probably* never will be, … … 229 239 emit sigRequestResize(uPixelFormat, pVRAM, uBitsPerPixel, uBytesPerLine, uWidth, uHeight); 230 240 241 /* Unlock access to frame-buffer: */ 242 unlock(); 243 231 244 /* Confirm RequestResize: */ 232 245 return S_OK; 233 246 } 234 247 248 /** 249 * EMT callback: Informs about an update. 250 * @param uX Horizontal origin of the update rectangle, in pixels. 251 * @param uY Vertical origin of the update rectangle, in pixels. 252 * @param uWidth Width of the update rectangle, in pixels. 253 * @param uHeight Height of the update rectangle, in pixels. 254 * @note Any EMT callback is subsequent. No any other EMT callback can be called until this one processed. 255 * @note Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side). 256 */ 235 257 STDMETHODIMP UIFrameBuffer::NotifyUpdate(ULONG uX, ULONG uY, ULONG uWidth, ULONG uHeight) 236 258 { … … 239 261 (unsigned long)uWidth, (unsigned long)uHeight)); 240 262 263 /* Lock access to frame-buffer: */ 264 lock(); 265 241 266 /* Make sure frame-buffer is used: */ 242 if ( isMarkedAsUnused())267 if (m_fIsMarkedAsUnused) 243 268 { 244 269 LogRel2(("UIFrameBuffer::NotifyUpdate: Ignored!\n")); 270 271 /* Unlock access to frame-buffer: */ 272 unlock(); 245 273 246 274 /* Ignore NotifyUpdate: */ … … 253 281 emit sigNotifyUpdate(uX, uY, uWidth, uHeight); 254 282 283 /* Unlock access to frame-buffer: */ 284 unlock(); 285 255 286 /* Confirm NotifyUpdate: */ 256 287 return S_OK; 257 288 } 258 289 259 STDMETHODIMP UIFrameBuffer::VideoModeSupported(ULONG uWidth, ULONG uHeight, ULONG uBPP, BOOL *pbSupported) 290 /** 291 * EMT callback: Returns whether the framebuffer implementation is willing to support a given video mode. 292 * @param uWidth Width of the guest display, in pixels. 293 * @param uHeight Height of the guest display, in pixels. 294 * @param uBPP Color depth, bits per pixel. 295 * @param pfSupported Is framebuffer able/willing to render the video mode or not. 296 * @note Any EMT callback is subsequent. No any other EMT callback can be called until this one processed. 297 * @note Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side). 298 */ 299 STDMETHODIMP UIFrameBuffer::VideoModeSupported(ULONG uWidth, ULONG uHeight, ULONG uBPP, BOOL *pfSupported) 260 300 { 261 301 LogRel2(("UIFrameBuffer::IsVideoModeSupported: Mode: BPP=%lu, Size=%lux%lu\n", 262 302 (unsigned long)uBPP, (unsigned long)uWidth, (unsigned long)uHeight)); 263 303 304 /* Make sure result pointer is valid: */ 305 if (!pfSupported) 306 { 307 LogRel2(("UIFrameBuffer::IsVideoModeSupported: Invalid pfSupported pointer!\n")); 308 309 return E_POINTER; 310 } 311 312 /* Lock access to frame-buffer: */ 313 lock(); 314 264 315 /* Make sure frame-buffer is used: */ 265 if ( isMarkedAsUnused())316 if (m_fIsMarkedAsUnused) 266 317 { 267 318 LogRel2(("UIFrameBuffer::IsVideoModeSupported: Ignored!\n")); 319 320 /* Unlock access to frame-buffer: */ 321 unlock(); 268 322 269 323 /* Ignore VideoModeSupported: */ … … 271 325 } 272 326 273 /* Make sure result pointer is valid: */274 if (!pbSupported)275 return E_POINTER;276 277 327 /* Determine if supported: */ 278 *p bSupported = TRUE;328 *pfSupported = TRUE; 279 329 QSize screenSize = m_pMachineView->maxGuestSize(); 280 330 if ( (screenSize.width() != 0) 281 331 && (uWidth > (ULONG)screenSize.width()) 282 332 && (uWidth > (ULONG)width())) 283 *p bSupported = FALSE;333 *pfSupported = FALSE; 284 334 if ( (screenSize.height() != 0) 285 335 && (uHeight > (ULONG)screenSize.height()) 286 336 && (uHeight > (ULONG)height())) 287 *pbSupported = FALSE; 288 289 LogRel2(("UIFrameBuffer::IsVideoModeSupported: %s\n", *pbSupported ? "TRUE" : "FALSE")); 337 *pfSupported = FALSE; 338 339 LogRel2(("UIFrameBuffer::IsVideoModeSupported: %s\n", *pfSupported ? "TRUE" : "FALSE")); 340 341 /* Unlock access to frame-buffer: */ 342 unlock(); 290 343 291 344 /* Confirm VideoModeSupported: */ … … 306 359 } 307 360 361 /** 362 * EMT callback: Suggests a new visible region to this framebuffer. 363 * @param pRectangles Pointer to the RTRECT array. 364 * @param uCount Number of RTRECT elements in the rectangles array. 365 * @note Any EMT callback is subsequent. No any other EMT callback can be called until this one processed. 366 * @note Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side). 367 */ 308 368 STDMETHODIMP UIFrameBuffer::SetVisibleRegion(BYTE *pRectangles, ULONG uCount) 309 369 { … … 311 371 (unsigned long)uCount)); 312 372 373 /* Make sure rectangles were passed: */ 374 if (!pRectangles) 375 { 376 LogRel2(("UIFrameBuffer::SetVisibleRegion: Invalid pRectangles pointer!\n")); 377 378 return E_POINTER; 379 } 380 381 /* Lock access to frame-buffer: */ 382 lock(); 383 313 384 /* Make sure frame-buffer is used: */ 314 if ( isMarkedAsUnused())385 if (m_fIsMarkedAsUnused) 315 386 { 316 387 LogRel2(("UIFrameBuffer::SetVisibleRegion: Ignored!\n")); 388 389 /* Unlock access to frame-buffer: */ 390 unlock(); 317 391 318 392 /* Ignore SetVisibleRegion: */ … … 320 394 } 321 395 322 /* Make sure rectangles were passed: */323 PRTRECT rects = (PRTRECT)pRectangles;324 if (!rects)325 return E_POINTER;326 327 396 /* Compose region: */ 328 397 QRegion region; 398 PRTRECT rects = (PRTRECT)pRectangles; 329 399 for (ULONG ind = 0; ind < uCount; ++ind) 330 400 { … … 347 417 emit sigSetVisibleRegion(region); 348 418 419 /* Unlock access to frame-buffer: */ 420 unlock(); 421 349 422 /* Confirm SetVisibleRegion: */ 350 423 return S_OK; … … 357 430 } 358 431 432 /** 433 * EMT callback: Notifies framebuffer about 3D backend event. 434 * @param uType Event type. Currently only VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA is supported. 435 * @param pData Event-specific data, depends on the supplied event type. 436 * @note Any EMT callback is subsequent. No any other EMT callback can be called until this one processed. 437 * @note Calls to this and #setMarkAsUnused method are synchronized between calling threads (from GUI side). 438 */ 359 439 STDMETHODIMP UIFrameBuffer::Notify3DEvent(ULONG uType, BYTE *pData) 360 440 { 361 441 LogRel2(("UIFrameBuffer::Notify3DEvent\n")); 362 442 443 /* Lock access to frame-buffer: */ 444 lock(); 445 363 446 /* Make sure frame-buffer is used: */ 364 if ( isMarkedAsUnused())447 if (m_fIsMarkedAsUnused) 365 448 { 366 449 LogRel2(("UIFrameBuffer::Notify3DEvent: Ignored!\n")); 450 451 /* Unlock access to frame-buffer: */ 452 unlock(); 367 453 368 454 /* Ignore Notify3DEvent: */ … … 382 468 emit sigNotifyAbout3DOverlayVisibilityChange(fVisible); 383 469 470 /* Unlock access to frame-buffer: */ 471 unlock(); 472 384 473 /* Confirm Notify3DEvent: */ 385 474 return S_OK; … … 388 477 break; 389 478 } 479 480 /* Unlock access to frame-buffer: */ 481 unlock(); 390 482 391 483 /* Ignore Notify3DEvent: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r49167 r49262 105 105 106 106 /* API: [Un]used status stuff: */ 107 bool isMarkedAsUnused() const;108 107 void setMarkAsUnused(bool fIsMarkAsUnused); 109 108
Note:
See TracChangeset
for help on using the changeset viewer.