- Timestamp:
- Jan 21, 2023 10:09:36 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155361
- Location:
- trunk/src/VBox/Frontends/VBoxFB
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxFB/Framebuffer.cpp
r98103 r98176 1 1 /* $Id$ */ 2 2 /** @file 3 * VBoxFB - implementation ofVBoxDirectFB class.3 * VBoxFB - Implementation of the VBoxDirectFB class. 4 4 */ 5 5 … … 57 57 if (fbInternalSurface) 58 58 { 59 DFBCHECK( fbInternalSurface->Release(fbInternalSurface));59 DFBCHECK((DFBResult)fbInternalSurface->Release(fbInternalSurface)); 60 60 fbInternalSurface = NULL; 61 61 } … … 175 175 } 176 176 177 NS_IMETHODIMP VBoxDirectFB::GetPixelFormat (PRUint32*pixelFormat)177 NS_IMETHODIMP VBoxDirectFB::GetPixelFormat(BitmapFormat_T *pixelFormat) 178 178 { 179 179 if (!pixelFormat) 180 180 return NS_ERROR_INVALID_POINTER; 181 *pixelFormat = FramebufferPixelFormat_FOURCC_RGB;181 *pixelFormat = BitmapFormat_RGBA; 182 182 return NS_OK; 183 183 } … … 208 208 } 209 209 210 NS_IMETHODIMP VBoxDirectFB::GetWinId(PR int64 *winId)210 NS_IMETHODIMP VBoxDirectFB::GetWinId(PRInt64 *winId) 211 211 { 212 212 if (!winId) … … 215 215 return NS_OK; 216 216 } 217 218 NS_IMETHODIMP VBoxDirectFB::GetCapabilities(PRUint32 *pcCapabilites, FramebufferCapabilities_T **ppaenmCapabilities) 219 { 220 RT_NOREF(pcCapabilites, ppaenmCapabilities); 221 AssertMsgFailed(("Not implemented")); 222 return E_NOTIMPL; 223 } 224 217 225 218 226 NS_IMETHODIMP VBoxDirectFB::NotifyUpdate(PRUint32 x, PRUint32 y, … … 228 236 blitRectangle.w = w; 229 237 blitRectangle.h = h; 230 if ( scaleGuest)238 if (g_scaleGuest) 231 239 { 232 240 DFBRectangle hostRectangle; … … 250 258 } 251 259 260 NS_IMETHODIMP VBoxDirectFB::NotifyUpdateImage(PRUint32 x, PRUint32 y, PRUint32 cx, PRUint32 cy, PRUint32 cbImage, PRUint8 *pbImage) 261 { 262 RT_NOREF(x, y, cx, cy, cbImage, pbImage); 263 AssertMsgFailed(("Not implemented")); 264 return E_NOTIMPL; 265 } 266 267 NS_IMETHODIMP VBoxDirectFB::NotifyChange(PRUint32 idScreen, PRUint32 xOrigin, PRUint32 yOrigin, PRUint32 cx, PRUint32 cy) 268 { 269 RT_NOREF(idScreen, xOrigin, yOrigin, cx, cy); 270 AssertMsgFailed(("Not implemented")); 271 return E_NOTIMPL; 272 } 273 252 274 NS_IMETHODIMP VBoxDirectFB::RequestResize(PRUint32 aScreenId, PRUint32 pixelFormat, PRUint8 *vram, 253 275 PRUint32 bitsPerPixel, PRUint32 bytesPerLine, … … 274 296 275 297 // check if we have a fixed host video mode 276 if ( useFixedVideoMode)298 if (g_useFixedVideoMode) 277 299 { 278 300 // does the current video mode differ from what the guest wants? 279 if ((screenWidth == w) && (screenHeight == h)) 280 { 301 if (screenWidth == w && screenHeight == h) 281 302 printf("requested guest mode matches current host mode!\n"); 282 } else 283 { 303 else 284 304 createSurface(w, h); 285 286 }else305 } 306 else 287 307 { 288 308 // we adopt to the guest resolution or the next higher that is available … … 296 316 297 317 // does the mode differ from what we wanted? 298 if ((videoModes[bestMode].width != w) || (videoModes[bestMode].height != h) || 299 (videoModes[bestMode].bpp != bitsPerPixel)) 318 if ( g_videoModes[bestMode].width != w 319 || g_videoModes[bestMode].height != h 320 || g_videoModes[bestMode].bpp != bitsPerPixel) 300 321 { 301 322 printf("The mode does not fit exactly!\n"); 302 323 createSurface(w, h); 303 } else 324 } 325 else 304 326 { 305 327 printf("The mode fits exactly!\n"); 306 328 } 307 329 // switch to this mode 308 DFBCHECK(dfb->SetVideoMode(dfb, videoModes[bestMode].width, videoModes[bestMode].height, 309 videoModes[bestMode].bpp)); 330 DFBCHECK(dfb->SetVideoMode(dfb, 331 g_videoModes[bestMode].width, 332 g_videoModes[bestMode].height, 333 g_videoModes[bestMode].bpp)); 310 334 } 311 335 … … 330 354 NS_IMETHODIMP VBoxDirectFB::VideoModeSupported(PRUint32 w, PRUint32 h, PRUint32 bpp, PRBool *supported) 331 355 { 356 RT_NOREF(w, h, bpp); 332 357 if (!supported) 333 358 return NS_ERROR_INVALID_POINTER; … … 338 363 NS_IMETHODIMP VBoxDirectFB::GetVisibleRegion(PRUint8 *rectangles, PRUint32 count, PRUint32 *countCopied) 339 364 { 365 RT_NOREF(count); 340 366 PRTRECT rects = (PRTRECT)rectangles; 341 342 367 if (!rects || !countCopied) 343 368 return NS_ERROR_INVALID_POINTER; … … 349 374 NS_IMETHODIMP VBoxDirectFB::SetVisibleRegion(PRUint8 *rectangles, PRUint32 count) 350 375 { 376 RT_NOREF(count); 351 377 PRTRECT rects = (PRTRECT)rectangles; 352 353 378 if (!rects) 354 379 return NS_ERROR_INVALID_POINTER; … … 363 388 } 364 389 365 NS_IMETHODIMP VBoxDirectFB::Notify3DEvent(PRUint32 type, PRUint8 *reserved) 366 { 390 NS_IMETHODIMP VBoxDirectFB::Notify3DEvent(PRUint32 type, PRUint32 cbData, PRUint8 *pbData) 391 { 392 RT_NOREF(type, cbData, pbData); 367 393 return NS_ERROR_NOT_IMPLEMENTED; 368 394 } -
trunk/src/VBox/Frontends/VBoxFB/Framebuffer.h
r98103 r98176 1 /* $Id$ */ 1 2 /** @file 2 3 * VBoxFB - Declaration of VBoxDirectFB class. … … 43 44 NS_IMETHOD GetWidth(PRUint32 *width); 44 45 NS_IMETHOD GetHeight(PRUint32 *height); 45 NS_IMETHOD Lock();46 NS_IMETHOD Unlock();47 NS_IMETHOD GetAddress(PRUint8 **address);48 46 NS_IMETHOD GetBitsPerPixel(PRUint32 *bitsPerPixel); 49 47 NS_IMETHOD GetBytesPerLine(PRUint32 *bytesPerLine); 50 48 NS_IMETHOD GetPixelFormat(PRUint32 *pixelFormat); 51 NS_IMETHOD GetUsesGuestVRAM(PRBool *usesGuestVRAM);52 49 NS_IMETHOD GetHeightReduction(PRUint32 *heightReduction); 53 50 NS_IMETHOD GetOverlay(IFramebufferOverlay **aOverlay); 54 NS_IMETHOD GetWinId(PRUint64 *winId); 55 NS_IMETHOD NotifyUpdate(PRUint32 x, PRUint32 y, PRUint32 w, PRUint32 h); 51 NS_IMETHOD GetWinId(PRInt64 *winId); 52 NS_IMETHOD GetCapabilities(PRUint32 *pcCapabilites, FramebufferCapabilities_T **ppaenmCapabilities); 53 54 NS_IMETHOD NotifyUpdate(PRUint32 x, PRUint32 y, PRUint32 cx, PRUint32 cy); 55 NS_IMETHOD NotifyUpdateImage(PRUint32 x, PRUint32 y, PRUint32 cx, PRUint32 cy, PRUint32 cbImage, PRUint8 *pbImage); 56 NS_IMETHOD NotifyChange(PRUint32 idScreen, PRUint32 xOrigin, PRUint32 yOrigin, PRUint32 cx, PRUint32 cy); 57 NS_IMETHOD VideoModeSupported(PRUint32 width, PRUint32 height, PRUint32 bpp, PRBool *supported); 58 NS_IMETHOD GetVisibleRegion(PRUint8 *paRectangles, PRUint32 cRectangles, PRUint32 *pcCopied); 59 NS_IMETHOD SetVisibleRegion(PRUint8 *paRectangles, PRUint32 cRectangles); 60 61 NS_IMETHOD ProcessVHWACommand(PRUint8 *pCommand, LONG enmCmd, BOOL fGuestCmd); 62 63 NS_IMETHOD Notify3DEvent(PRUint32 type, PRUint32 cbData, PRUint8 *pbData); 64 65 /// @todo obsolete? 66 NS_IMETHOD GetAddress(PRUint8 **address); 67 NS_IMETHOD Lock(); 68 NS_IMETHOD Unlock(); 69 NS_IMETHOD GetUsesGuestVRAM(PRBool *usesGuestVRAM); 56 70 NS_IMETHOD RequestResize(PRUint32 aScreenId, PRUint32 pixelFormat, PRUint8 *vram, 57 71 PRUint32 bitsPerPixel, PRUint32 bytesPerLine, 58 72 PRUint32 w, PRUint32 h, 59 73 PRBool *finished); 60 NS_IMETHOD VideoModeSupported(PRUint32 width, PRUint32 height, PRUint32 bpp, PRBool *supported);61 NS_IMETHOD GetVisibleRegion(PRUint8 *aRectangles, PRUint32 aCount, PRUint32 *aCountCopied);62 NS_IMETHOD SetVisibleRegion(PRUint8 *aRectangles, PRUint32 aCount);63 74 64 NS_IMETHOD ProcessVHWACommand(PRUint8 *pCommand, LONG enmCmd, BOOL fGuestCmd);65 66 NS_IMETHOD Notify3DEvent(PRUint32 type, PRUint8 *reserved);67 75 private: 68 76 int createSurface(uint32_t w, uint32_t h); -
trunk/src/VBox/Frontends/VBoxFB/Helper.cpp
r98103 r98176 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox frontends: Framebuffer (FB, DirectFB): 4 * Helper routines 3 * VBoxFB - Helper routines. 5 4 */ 6 5 … … 33 32 * Globals 34 33 */ 35 videoMode videoModes[MAX_VIDEOMODES] = {{0}};36 uint32_t numVideoModes = 0;34 videoMode g_videoModes[MAX_VIDEOMODES] = {{0}}; 35 uint32_t g_numVideoModes = 0; 37 36 38 37 /** … … 47 46 DFBEnumerationResult enumVideoModesHandler(int width, int height, int bpp, void *callbackdata) 48 47 { 49 if (numVideoModes >= MAX_VIDEOMODES) 48 RT_NOREF(callbackdata); 49 if (g_numVideoModes >= MAX_VIDEOMODES) 50 50 { 51 51 return DFENUM_CANCEL; … … 57 57 // DirectFB returns the same modes several times) 58 58 int32_t existingMode = getBestVideoMode(width, height, bpp); 59 if ( (existingMode == -1) ||60 ((videoModes[existingMode].width != (uint32_t)width) ||61 (videoModes[existingMode].height != (uint32_t)height) ||62 (videoModes[existingMode].bpp != (uint32_t)bpp)))59 if ( existingMode == -1 60 || g_videoModes[existingMode].width != (uint32_t)width 61 || g_videoModes[existingMode].height != (uint32_t)height 62 || g_videoModes[existingMode].bpp != (uint32_t)bpp) 63 63 { 64 videoModes[numVideoModes].width = (uint32_t)width;65 videoModes[numVideoModes].height = (uint32_t)height;66 videoModes[numVideoModes].bpp = (uint32_t)bpp;67 numVideoModes++;64 g_videoModes[g_numVideoModes].width = (uint32_t)width; 65 g_videoModes[g_numVideoModes].height = (uint32_t)height; 66 g_videoModes[g_numVideoModes].bpp = (uint32_t)bpp; 67 g_numVideoModes++; 68 68 } 69 69 } … … 83 83 int32_t bestMode = -1; 84 84 85 for (uint32_t i = 0; i < numVideoModes; i++)85 for (uint32_t i = 0; i < g_numVideoModes; i++) 86 86 { 87 87 // is this mode compatible? 88 if ((videoModes[i].width >= width) && (videoModes[i].height >= height) && 89 (videoModes[i].bpp >= bpp)) 88 if (g_videoModes[i].width >= width && g_videoModes[i].height >= height && g_videoModes[i].bpp >= bpp) 90 89 { 91 90 // first suitable mode? 92 91 if (bestMode == -1) 93 {94 92 bestMode = i; 95 }else93 else 96 94 { 97 95 // is it better than the one we got before? 98 if ( (videoModes[i].width < videoModes[bestMode].width) ||99 (videoModes[i].height < videoModes[bestMode].height) ||100 (videoModes[i].bpp < videoModes[bestMode].bpp))96 if ( g_videoModes[i].width < g_videoModes[bestMode].width 97 || g_videoModes[i].height < g_videoModes[bestMode].height 98 || g_videoModes[i].bpp < g_videoModes[bestMode].bpp) 101 99 { 102 100 bestMode = i; -
trunk/src/VBox/Frontends/VBoxFB/Helper.h
r98103 r98176 40 40 uint32_t bpp; 41 41 }; 42 extern videoMode videoModes[];43 extern uint32_t numVideoModes;42 extern videoMode g_videoModes[]; 43 extern uint32_t g_numVideoModes; 44 44 45 45 DFBEnumerationResult enumVideoModesHandler(int width, int height, int bpp, void *callbackdata); -
trunk/src/VBox/Frontends/VBoxFB/Makefile.kmk
r98103 r98176 34 34 # VBoxFB 35 35 # 36 VBoxFB_TEMPLATE = VBOX R3NPEXE36 VBoxFB_TEMPLATE = VBOXMAINCLIENTEXE 37 37 VBoxFB_SOURCES = \ 38 38 VBoxFB.cpp \ -
trunk/src/VBox/Frontends/VBoxFB/VBoxFB.cpp
r98103 r98176 1 /* $Id$ */ 1 2 /** @file 3 * VBoxFB - Linux Direct Framebuffer Frontend. 2 4 * 3 * VBox frontends: Framebuffer (FB, DirectFB): 4 * main() routine. 5 * 6 * NOTE: this code has not been tested, so expect bugs. It is not part 7 * of a regular VirtualBox build. 5 * @note This code has not been tested in a long time, so expect bugs if it 6 * even compiles. It is not part of any regular VirtualBox build. 8 7 */ 9 8 … … 35 34 #include <VBox/param.h> 36 35 #include <iprt/path.h> 36 #include <VBox/version.h> 37 37 38 38 /** 39 39 * Globals 40 40 */ 41 uint32_t useFixedVideoMode = 0;42 int scaleGuest = 0;43 videoMode fixedVideoMode = {0};44 int32_t initialVideoMode = -1;41 uint32_t g_useFixedVideoMode = 0; 42 int g_scaleGuest = 0; 43 videoMode g_fixedVideoMode = {0}; 44 int32_t g_initialVideoMode = -1; 45 45 46 46 void showusage() … … 75 75 "Copyright (C) 2004-2005 secunet Security Networks AG\n", __DATE__, __TIME__); 76 76 77 fputs("\nWARNING! Unmaintained code.\nWARNING! Needs fixing & debugging!\n\n", stdout); 78 77 79 for (;;) 78 80 { … … 89 91 case 's': 90 92 { 93 #if 0 91 94 // UUID as string, parse it 92 95 RTUUID buuid; … … 97 100 exit(-1); 98 101 } 102 #endif 99 103 uuid = optarg; 100 104 break; … … 102 106 case 'f': 103 107 { 104 if (sscanf(optarg, "%ux%ux%u", & fixedVideoMode.width, &fixedVideoMode.height,105 & fixedVideoMode.bpp) != 3)108 if (sscanf(optarg, "%ux%ux%u", &g_fixedVideoMode.width, &g_fixedVideoMode.height, 109 &g_fixedVideoMode.bpp) != 3) 106 110 { 107 111 printf("Error, invalid resolution argument!\n"); … … 109 113 exit(-1); 110 114 } 111 useFixedVideoMode = 1;115 g_useFixedVideoMode = 1; 112 116 break; 113 117 } … … 119 123 case 'c': 120 124 { 121 scaleGuest = 1;125 g_scaleGuest = 1; 122 126 break; 123 127 } … … 136 140 137 141 138 /* *142 /* 139 143 * XPCOM setup 140 144 */ … … 147 151 */ 148 152 { 153 #if 0 149 154 nsCOMPtr<nsIServiceManager> serviceManager; 150 155 rc = NS_InitXPCOM2(getter_AddRefs(serviceManager), nsnull, nsnull); … … 179 184 return -1; 180 185 } 186 #else 187 rc = com::Initialize(); 188 if (NS_FAILED(rc)) 189 { 190 printf("Error: XPCOM could not be initialized! rc=0x%x\n", rc); 191 exit(-1); 192 } 193 #endif 181 194 182 195 /* … … 218 231 } 219 232 233 // find the VM 234 nsCOMPtr<IMachine> machine; 235 rc = virtualBox->FindMachine(NS_ConvertUTF8toUTF16(uuid).get(), getter_AddRefs(machine)); 236 if (rc != S_OK || !machine) 237 { 238 printf("Error: given machine not found!\n"); 239 return RTEXITCODE_FAILURE; 240 } 241 220 242 // open session for this VM 221 rc = virtualBox->OpenSession(session, NS_ConvertUTF8toUTF16(uuid).get());243 rc = machine->LockMachine(session, LockType_VM); 222 244 if (NS_FAILED(rc)) 223 245 { … … 225 247 exit(-1); 226 248 } 227 nsCOMPtr<IMachine> machine;228 249 session->GetMachine(getter_AddRefs(machine)); 229 250 if (!machine) … … 252 273 VBoxDirectFB *frameBuffer = NULL; 253 274 254 /* *275 /* 255 276 * Init DirectFB 256 277 */ … … 272 293 { 273 294 printf("*****************************************************\n"); 274 printf("Number of available host video modes: %u\n", numVideoModes);275 for (uint32_t i = 0; i < numVideoModes; i++)295 printf("Number of available host video modes: %u\n", g_numVideoModes); 296 for (uint32_t i = 0; i < g_numVideoModes; i++) 276 297 { 277 298 printf("Mode %u: xres = %u, yres = %u, bpp = %u\n", i, 278 videoModes[i].width, videoModes[i].height,videoModes[i].bpp);299 g_videoModes[i].width, g_videoModes[i].height, g_videoModes[i].bpp); 279 300 } 280 301 printf("Note: display modes with bpp < have been filtered out\n"); … … 283 304 } 284 305 285 if ( useFixedVideoMode)286 { 287 int32_t bestVideoMode = getBestVideoMode( fixedVideoMode.width,288 fixedVideoMode.height,289 fixedVideoMode.bpp);306 if (g_useFixedVideoMode) 307 { 308 int32_t bestVideoMode = getBestVideoMode(g_fixedVideoMode.width, 309 g_fixedVideoMode.height, 310 g_fixedVideoMode.bpp); 290 311 // validate the fixed mode 291 if ( (bestVideoMode == -1) ||292 ((fixedVideoMode.width != videoModes[bestVideoMode].width) ||293 (fixedVideoMode.height != videoModes[bestVideoMode].height) ||294 (fixedVideoMode.bpp != videoModes[bestVideoMode].bpp)))312 if ( bestVideoMode == -1 313 || g_fixedVideoMode.width != g_videoModes[bestVideoMode].width 314 || g_fixedVideoMode.height != g_videoModes[bestVideoMode].height 315 || g_fixedVideoMode.bpp != g_videoModes[bestVideoMode].bpp) 295 316 { 296 317 printf("Error: the specified fixed video mode is not available!\n"); … … 299 320 } else 300 321 { 301 initialVideoMode = getBestVideoMode(640, 480, 16);302 if ( initialVideoMode == -1)322 g_initialVideoMode = getBestVideoMode(640, 480, 16); 323 if (g_initialVideoMode == -1) 303 324 { 304 325 printf("Error: initial video mode 640x480x16 is not available!\n"); … … 318 339 319 340 320 if ( useFixedVideoMode)321 { 322 printf("Information: setting video mode to %ux%ux%u\n", fixedVideoMode.width,323 fixedVideoMode.height,fixedVideoMode.bpp);324 DFBCHECK(dfb->SetVideoMode(dfb, fixedVideoMode.width,325 fixedVideoMode.height,fixedVideoMode.bpp));341 if (g_useFixedVideoMode) 342 { 343 printf("Information: setting video mode to %ux%ux%u\n", g_fixedVideoMode.width, 344 g_fixedVideoMode.height, g_fixedVideoMode.bpp); 345 DFBCHECK(dfb->SetVideoMode(dfb, g_fixedVideoMode.width, 346 g_fixedVideoMode.height, g_fixedVideoMode.bpp)); 326 347 } else 327 348 { 328 349 printf("Information: starting with default video mode %ux%ux%u\n", 329 videoModes[initialVideoMode].width, videoModes[initialVideoMode].height, 330 videoModes[initialVideoMode].bpp); 331 DFBCHECK(dfb->SetVideoMode(dfb, videoModes[initialVideoMode].width, 332 videoModes[initialVideoMode].height, 333 videoModes[initialVideoMode].bpp)); 350 g_videoModes[g_initialVideoMode].width, g_videoModes[g_initialVideoMode].height, 351 g_videoModes[g_initialVideoMode].bpp); 352 DFBCHECK(dfb->SetVideoMode(dfb, 353 g_videoModes[g_initialVideoMode].width, 354 g_videoModes[g_initialVideoMode].height, 355 g_videoModes[g_initialVideoMode].bpp)); 334 356 } 335 357 336 358 // register our framebuffer 337 359 frameBuffer = new VBoxDirectFB(dfb, surface); 338 display->SetFramebuffer(0, frameBuffer); 339 340 /** 360 PRUnichar *pwszFrameBufferUuid = NULL; 361 display->AttachFramebuffer(0, frameBuffer, &pwszFrameBufferUuid); 362 363 /* 341 364 * Start the VM execution thread 342 365 */ … … 346 369 console->GetMouse(getter_AddRefs(mouse)); 347 370 348 /* *371 /* 349 372 * Main event loop 350 373 */ … … 549 572 if (event.buttons & DIBM_MIDDLE) 550 573 buttonState |= MouseButtonState::MiddleButton; 551 mouse->PutMouseEvent(mouseXDelta, mouseYDelta, mouseZDelta, 552 buttonState); 574 mouse->PutMouseEvent(mouseXDelta, mouseYDelta, mouseZDelta, 0, buttonState); 553 575 break; 554 576 } -
trunk/src/VBox/Frontends/VBoxFB/VBoxFB.h
r98103 r98176 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox frontends: Framebuffer (FB, DirectFB): 4 * Main header file 3 * VBox frontends - Framebuffer (FB, DirectFB), Main header file. 5 4 */ 6 5 … … 58 57 #include <VBox/err.h> 59 58 #include <VBox/log.h> 59 #ifndef VBOX_WITH_XPCOM 60 # define VBOX_WITH_XPCOM 61 #endif 62 #include <VBox/com/com.h> 60 63 #include <iprt/assert.h> 61 64 #include <iprt/uuid.h> … … 85 88 * Globals 86 89 */ 87 extern uint32_t useFixedVideoMode;88 extern videoMode fixedVideoMode;89 extern int scaleGuest;90 extern uint32_t g_useFixedVideoMode; 91 extern videoMode g_fixedVideoMode; 92 extern int g_scaleGuest; 90 93 91 94 #endif /* !VBOX_INCLUDED_SRC_VBoxFB_VBoxFB_h */
Note:
See TracChangeset
for help on using the changeset viewer.