儲存庫 vbox 的更動 67356
- 時間撮記:
- 2017-6-13 上午11:22:15 (7 年 以前)
- 位置:
- trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe
- 檔案:
-
- 修改 3 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVga.h
r67352 r67356 81 81 82 82 // 83 // VirtualBox VGA Mode Data83 // VirtualBox VGA Graphical Mode Data 84 84 // 85 85 typedef struct { … … 112 112 UINTN MaxMode; 113 113 VBOX_VGA_MODE_DATA *ModeData; 114 UINT32 *LineBuffer;115 114 BOOLEAN HardwareNeedsStarting; 116 115 UINT32 VRAMSize; 117 void *TmpBuf;118 116 } VBOX_VGA_PRIVATE_DATA; 119 117 -
trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaGraphicsOutput.c
r67352 r67356 186 186 ModeData = &Private->ModeData[ModeNumber]; 187 187 188 if (Private->LineBuffer) {189 gBS->FreePool (Private->LineBuffer);190 }191 192 Private->LineBuffer = NULL;193 Private->LineBuffer = AllocatePool (ModeData->HorizontalResolution * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));194 if (Private->LineBuffer == NULL) {195 return EFI_OUT_OF_RESOURCES;196 }197 198 188 InitializeGraphicsMode (Private, &VBoxVgaVideoModes[ModeData->ModeNumber]); 199 if (Private->TmpBuf)200 FreePool(Private->TmpBuf);201 Private->TmpBuf = AllocatePool(ModeData->HorizontalResolution * ModeData->VerticalResolution * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));202 ASSERT(( Private->TmpBuf));203 189 204 190 This->Mode->Mode = ModeNumber; … … 259 245 --*/ 260 246 { 261 VBOX_VGA_PRIVATE_DATA *Private; 262 EFI_TPL OriginalTPL; 263 UINTN DstY; 264 UINTN SrcY; 265 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt; 266 UINTN X; 267 UINTN ScreenWidth; 268 UINTN Offset; 269 UINTN SourceOffset; 270 UINT32 CurrentMode; 271 EFI_STATUS Status; 272 UINTN ScreenHeight; 247 VBOX_VGA_PRIVATE_DATA *Private; 248 EFI_TPL OriginalTPL; 249 UINTN DstY; 250 UINTN SrcY; 251 UINT32 CurrentMode; 252 UINTN ScreenWidth; 253 UINTN ScreenHeight; 254 EFI_STATUS Status; 273 255 274 256 Private = VBOX_VGA_PRIVATE_DATA_FROM_GRAPHICS_OUTPUT_THIS (This); 257 CurrentMode = This->Mode->Mode; 258 ScreenWidth = Private->ModeData[CurrentMode].HorizontalResolution; 259 ScreenHeight = Private->ModeData[CurrentMode].VerticalResolution; 275 260 276 261 if ((BltOperation < 0) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) { … … 286 271 // the number of bytes in each row can be computed. 287 272 // 288 /* vvl: Delta passed in bytes to use it for coordinate arithmetic289 we need convert it to pixels value.290 */291 273 if (Delta == 0) { 292 Delta = Width * 4; 293 } 294 Delta /= 4; 295 296 // 297 // We need to fill the Virtual Screen buffer with the blt data. 298 // The virtual screen is upside down, as the first row is the bootom row of 299 // the image. 300 // 301 302 CurrentMode = This->Mode->Mode; 274 Delta = Width * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL); 275 } 276 // code below assumes a Delta value in pixels, not bytes 277 Delta /= sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL); 278 303 279 // 304 280 // Make sure the SourceX, SourceY, DestinationX, DestinationY, Width, and Height parameters 305 281 // are valid for the operation and the current screen geometry. 306 282 // 307 if (BltOperation == EfiBltVideoToBltBuffer) { 308 // 309 // Video to BltBuffer: Source is Video, destination is BltBuffer 310 // 311 if (SourceY + Height > Private->ModeData[CurrentMode].VerticalResolution) { 283 if (BltOperation == EfiBltVideoToBltBuffer || BltOperation == EfiBltVideoToVideo) { 284 if (SourceY + Height > ScreenHeight) { 312 285 return EFI_INVALID_PARAMETER; 313 286 } 314 287 315 if (SourceX + Width > Private->ModeData[CurrentMode].HorizontalResolution) {288 if (SourceX + Width > ScreenWidth) { 316 289 return EFI_INVALID_PARAMETER; 317 290 } 318 } else { 319 // 320 // BltBuffer to Video: Source is BltBuffer, destination is Video 321 // 322 if (DestinationY + Height > Private->ModeData[CurrentMode].VerticalResolution) { 291 } 292 if (BltOperation == EfiBltBufferToVideo || BltOperation == EfiBltVideoToVideo || BltOperation == EfiBltVideoFill) { 293 if (DestinationY + Height > ScreenHeight) { 323 294 return EFI_INVALID_PARAMETER; 324 295 } 325 296 326 if (DestinationX + Width > Private->ModeData[CurrentMode].HorizontalResolution) {297 if (DestinationX + Width > ScreenWidth) { 327 298 return EFI_INVALID_PARAMETER; 328 299 } 329 300 } 301 330 302 // 331 303 // We have to raise to TPL Notify, so we make an atomic write the frame buffer. … … 341 313 // 342 314 for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY) && BltBuffer; SrcY++, DstY++) { 343 344 Offset = (SrcY * Private->ModeData[CurrentMode].HorizontalResolution) + SourceX; 345 Status = Private->PciIo->Mem.Read ( 346 Private->PciIo, 347 EfiPciIoWidthUint32, 348 0, 349 Offset * 4, 350 Width, 351 Private->LineBuffer 352 ); 315 /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_GRAPHICS_OUTPUT_BLT_PIXEL 316 Status = Private->PciIo->Mem.Read ( 317 Private->PciIo, 318 EfiPciIoWidthUint32, 319 0, 320 ((SrcY * ScreenWidth) + SourceX) * 4, 321 Width, 322 BltBuffer + (DstY * Delta) + DestinationX 323 ); 324 ASSERT_EFI_ERROR((Status)); 325 } 326 break; 327 328 case EfiBltBufferToVideo: 329 // 330 // BltBuffer to Video: Source is BltBuffer, destination is Video 331 // 332 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { 333 /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_GRAPHICS_OUTPUT_BLT_PIXEL 334 Status = Private->PciIo->Mem.Write ( 335 Private->PciIo, 336 EfiPciIoWidthUint32, 337 0, 338 ((DstY * ScreenWidth) + DestinationX) * 4, 339 Width, 340 BltBuffer + (SrcY * Delta) + SourceX 341 ); 342 ASSERT_EFI_ERROR((Status)); 343 } 344 break; 345 346 case EfiBltVideoToVideo: 347 // 348 // Video to Video: Source is Video, destination is Video 349 // 350 if (DestinationY <= SourceY) { 351 // forward copy 352 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { 353 /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_GRAPHICS_OUTPUT_BLT_PIXEL 354 Status = Private->PciIo->CopyMem ( 355 Private->PciIo, 356 EfiPciIoWidthUint32, 357 0, 358 ((DstY * ScreenWidth) + DestinationX) * 4, 359 0, 360 ((SrcY * ScreenWidth) + SourceX) * 4, 361 Width 362 ); 353 363 ASSERT_EFI_ERROR((Status)); 354 355 for (X = 0; X < Width; X++) {356 Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltBuffer + (DstY * Delta) + (DestinationX + X);357 *(UINT32 *)Blt = Private->LineBuffer[X];358 364 } 365 } else { 366 // reverse copy 367 for (SrcY = SourceY + Height - 1, DstY = DestinationY + Height - 1; SrcY >= SourceY && SrcY <= SourceY + Height - 1; SrcY--, DstY--) { 368 /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_GRAPHICS_OUTPUT_BLT_PIXEL 369 Status = Private->PciIo->CopyMem ( 370 Private->PciIo, 371 EfiPciIoWidthUint32, 372 0, 373 ((DstY * ScreenWidth) + DestinationX) * 4, 374 0, 375 ((SrcY * ScreenWidth) + SourceX) * 4, 376 Width 377 ); 378 ASSERT_EFI_ERROR((Status)); 379 } 359 380 } 360 381 break; 361 382 362 case EfiBltVideoToVideo:363 //364 // Perform hardware acceleration for Video to Video operations365 //366 ScreenWidth = Private->ModeData[CurrentMode].HorizontalResolution;367 ScreenHeight = Private->ModeData[CurrentMode].VerticalResolution;368 SourceOffset = (SourceY * Private->ModeData[CurrentMode].HorizontalResolution) + (SourceX);369 Offset = (DestinationY * Private->ModeData[CurrentMode].HorizontalResolution) + (DestinationX);370 VBoxVgaGraphicsOutputBlt(This, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)Private->TmpBuf, EfiBltVideoToBltBuffer, SourceX, SourceY, 0, 0, ScreenWidth - SourceX, ScreenHeight - SourceY, 0);371 VBoxVgaGraphicsOutputBlt(This, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL*)Private->TmpBuf, EfiBltBufferToVideo, 0, 0, DestinationX, DestinationY, ScreenWidth - SourceX, ScreenHeight - SourceY, 0);372 break;373 374 383 case EfiBltVideoFill: 375 Blt = BltBuffer; 376 377 if (DestinationX == 0 && Width == Private->ModeData[CurrentMode].HorizontalResolution) { 378 Offset = DestinationY * Private->ModeData[CurrentMode].HorizontalResolution; 379 Status = Private->PciIo->Mem.Write ( 380 Private->PciIo, 381 EfiPciIoWidthFillUint32, 382 0, 383 Offset * 4, 384 (Width * Height), 385 Blt 386 ); 387 ASSERT_EFI_ERROR((Status)); 384 // 385 // Video Fill: Source is BltBuffer, destination is Video 386 // 387 if (DestinationX == 0 && Width == ScreenWidth) { 388 // @todo assumes that color depth is 32 (*4, EfiPciIoWidthFillUint32) and format matches EFI_GRAPHICS_OUTPUT_BLT_PIXEL 389 Status = Private->PciIo->Mem.Write ( 390 Private->PciIo, 391 EfiPciIoWidthFillUint32, 392 0, 393 DestinationY * ScreenWidth * 4, 394 (Width * Height), 395 BltBuffer 396 ); 397 ASSERT_EFI_ERROR((Status)); 388 398 } else { 389 399 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { 390 Offset = (DstY * Private->ModeData[CurrentMode].HorizontalResolution) + DestinationX;391 392 Private->PciIo,393 EfiPciIoWidthFillUint32,394 0,395 Offset* 4,396 Width,397 Blt398 );400 // @todo assumes that color depth is 32 (*4, EfiPciIoWidthFillUint32) and format matches EFI_GRAPHICS_OUTPUT_BLT_PIXEL 401 Status = Private->PciIo->Mem.Write ( 402 Private->PciIo, 403 EfiPciIoWidthFillUint32, 404 0, 405 ((DstY * ScreenWidth) + DestinationX) * 4, 406 Width, 407 BltBuffer 408 ); 399 409 ASSERT_EFI_ERROR((Status)); 400 410 } … … 402 412 break; 403 413 404 case EfiBltBufferToVideo:405 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) {406 407 for (X = 0; X < Width; X++) {408 Blt =409 (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) (410 (UINT32 *) BltBuffer +411 (SrcY * Delta) +412 ((SourceX + X) )413 );414 Private->LineBuffer[X] = *(UINT32 *)Blt;415 }416 417 Offset = (DstY * Private->ModeData[CurrentMode].HorizontalResolution) + DestinationX;418 419 Status = Private->PciIo->Mem.Write (420 Private->PciIo,421 EfiPciIoWidthUint32,422 0,423 Offset * 4,424 Width,425 Private->LineBuffer426 );427 ASSERT_EFI_ERROR((Status));428 }429 break;430 414 default: 431 415 ASSERT (FALSE); … … 444 428 EFI_STATUS Status; 445 429 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; 446 UINT32 GopMode = 2; /* 1024x768 */430 UINT32 GopMode = 2; 447 431 448 432 GraphicsOutput = &Private->GraphicsOutput; … … 473 457 Private->GraphicsOutput.Mode->Mode = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER; 474 458 Private->HardwareNeedsStarting = TRUE; 475 Private->LineBuffer = NULL;476 459 477 460 // … … 479 462 // 480 463 VBoxVgaGetVmVariable(EFI_INFO_INDEX_GOP_MODE, (CHAR8 *)&GopMode, sizeof(GopMode)); 464 481 465 GraphicsOutput->SetMode (GraphicsOutput, GopMode); 466 482 467 DrawLogo ( 483 468 Private, … … 485 470 Private->ModeData[Private->GraphicsOutput.Mode->Mode].VerticalResolution 486 471 ); 472 487 473 PcdSet32(PcdVideoHorizontalResolution, Private->ModeData[Private->GraphicsOutput.Mode->Mode].HorizontalResolution); 488 474 PcdSet32(PcdVideoVerticalResolution, Private->ModeData[Private->GraphicsOutput.Mode->Mode].VerticalResolution); -
trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxVgaDxe/VBoxVgaUgaDraw.c
r62500 r67356 116 116 #endif 117 117 118 if (Private->LineBuffer) {119 gBS->FreePool (Private->LineBuffer);120 }121 122 Private->LineBuffer = NULL;123 Private->LineBuffer = AllocatePool (HorizontalResolution * 4);124 if (Private->LineBuffer == NULL) {125 return EFI_OUT_OF_RESOURCES;126 }127 128 118 InitializeGraphicsMode (Private, &VBoxVgaVideoModes[Private->ModeData[Index].ModeNumber]); 129 if (Private->TmpBuf)130 FreePool(Private->TmpBuf);131 Private->TmpBuf = AllocatePool(Private->ModeData[Index].HorizontalResolution * Private->ModeData[Index].VerticalResolution * sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));132 119 133 120 Private->CurrentMode = Index; … … 158 145 ) 159 146 { 160 VBOX_VGA_PRIVATE_DATA *Private; 161 EFI_TPL OriginalTPL; 162 UINTN DstY; 163 UINTN SrcY; 164 EFI_UGA_PIXEL *Blt; 165 UINTN X; 166 UINTN ScreenWidth; 167 UINTN Offset; 168 UINTN SourceOffset; 169 UINTN ScreenHeight; 147 VBOX_VGA_PRIVATE_DATA *Private; 148 EFI_TPL OriginalTPL; 149 UINTN DstY; 150 UINTN SrcY; 151 UINTN ScreenWidth; 152 UINTN ScreenHeight; 153 EFI_STATUS Status; 170 154 171 155 Private = VBOX_VGA_PRIVATE_DATA_FROM_UGA_DRAW_THIS (This); 156 ScreenWidth = Private->ModeData[Private->CurrentMode].HorizontalResolution; 157 ScreenHeight = Private->ModeData[Private->CurrentMode].VerticalResolution; 172 158 173 159 if ((BltOperation < 0) || (BltOperation >= EfiUgaBltMax)) { … … 187 173 Delta = Width * sizeof (EFI_UGA_PIXEL); 188 174 } 175 // code below assumes a Delta value in pixels, not bytes 189 176 Delta /= sizeof (EFI_UGA_PIXEL); 190 191 //192 // We need to fill the Virtual Screen buffer with the blt data.193 // The virtual screen is upside down, as the first row is the bootom row of194 // the image.195 //196 177 197 178 // … … 199 180 // are valid for the operation and the current screen geometry. 200 181 // 201 if (BltOperation == EfiUgaVideoToBltBuffer) { 202 // 203 // Video to BltBuffer: Source is Video, destination is BltBuffer 204 // 205 if (SourceY + Height > Private->ModeData[Private->CurrentMode].VerticalResolution) { 182 if (BltOperation == EfiUgaVideoToBltBuffer || BltOperation == EfiUgaVideoToVideo) { 183 if (SourceY + Height > ScreenHeight) { 206 184 return EFI_INVALID_PARAMETER; 207 185 } 208 186 209 if (SourceX + Width > Private->ModeData[Private->CurrentMode].HorizontalResolution) {187 if (SourceX + Width > ScreenWidth) { 210 188 return EFI_INVALID_PARAMETER; 211 189 } 212 } else { 213 // 214 // BltBuffer to Video: Source is BltBuffer, destination is Video 215 // 216 if (DestinationY + Height > Private->ModeData[Private->CurrentMode].VerticalResolution) { 190 } 191 if (BltOperation == EfiUgaBltBufferToVideo || BltOperation == EfiUgaVideoToVideo || BltOperation == EfiUgaVideoFill) { 192 if (DestinationY + Height > ScreenHeight) { 217 193 return EFI_INVALID_PARAMETER; 218 194 } 219 195 220 if (DestinationX + Width > Private->ModeData[Private->CurrentMode].HorizontalResolution) {196 if (DestinationX + Width > ScreenWidth) { 221 197 return EFI_INVALID_PARAMETER; 222 198 } 223 199 } 200 224 201 // 225 202 // We have to raise to TPL Notify, so we make an atomic write the frame buffer. … … 235 212 // 236 213 for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) { 237 238 Offset = (SrcY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + SourceX; 239 Private->PciIo->Mem.Read ( 240 Private->PciIo, 241 EfiPciIoWidthUint32, 242 0, 243 Offset * 4, 244 Width, 245 Private->LineBuffer 246 ); 247 248 for (X = 0; X < Width; X++) { 249 Blt = (EFI_UGA_PIXEL *) ((UINT32 *) BltBuffer + (DstY * Delta) + (DestinationX + X)); 250 251 *(UINT32 *)Blt = Private->LineBuffer[X]; 214 /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_UGA_PIXEL 215 Status = Private->PciIo->Mem.Read ( 216 Private->PciIo, 217 EfiPciIoWidthUint32, 218 0, 219 ((SrcY * ScreenWidth) + SourceX) * 4, 220 Width, 221 BltBuffer + (DstY * Delta) + DestinationX 222 ); 223 ASSERT_EFI_ERROR((Status)); 224 } 225 break; 226 227 case EfiUgaBltBufferToVideo: 228 // 229 // BltBuffer to Video: Source is BltBuffer, destination is Video 230 // 231 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { 232 /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_UGA_PIXEL 233 Status = Private->PciIo->Mem.Write ( 234 Private->PciIo, 235 EfiPciIoWidthUint32, 236 0, 237 ((DstY * ScreenWidth) + DestinationX) * 4, 238 Width, 239 BltBuffer + (SrcY * Delta) + SourceX 240 ); 241 ASSERT_EFI_ERROR((Status)); 242 } 243 break; 244 245 case EfiUgaVideoToVideo: 246 // 247 // Video to Video: Source is Video, destination is Video 248 // 249 if (DestinationY <= SourceY) { 250 // forward copy 251 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { 252 /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_UGA_PIXEL 253 Status = Private->PciIo->CopyMem ( 254 Private->PciIo, 255 EfiPciIoWidthUint32, 256 0, 257 ((DstY * ScreenWidth) + DestinationX) * 4, 258 0, 259 ((SrcY * ScreenWidth) + SourceX) * 4, 260 Width 261 ); 262 ASSERT_EFI_ERROR((Status)); 252 263 } 264 } else { 265 // reverse copy 266 for (SrcY = SourceY + Height - 1, DstY = DestinationY + Height - 1; SrcY >= SourceY && SrcY <= SourceY + Height - 1; SrcY--, DstY--) { 267 /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthUint32) and format matches EFI_UGA_PIXEL 268 Status = Private->PciIo->CopyMem ( 269 Private->PciIo, 270 EfiPciIoWidthUint32, 271 0, 272 ((DstY * ScreenWidth) + DestinationX) * 4, 273 0, 274 ((SrcY * ScreenWidth) + SourceX) * 4, 275 Width 276 ); 277 ASSERT_EFI_ERROR((Status)); 278 } 253 279 } 254 280 break; 255 281 256 case EfiUgaVideoToVideo:257 //258 // Perform hardware acceleration for Video to Video operations259 //260 ScreenWidth = Private->ModeData[Private->CurrentMode].HorizontalResolution;261 ScreenHeight = Private->ModeData[Private->CurrentMode].VerticalResolution;262 SourceOffset = (SourceY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (SourceX);263 Offset = (DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + (DestinationX);264 VBoxVgaUgaDrawBlt(This, (EFI_UGA_PIXEL *)Private->TmpBuf, EfiUgaVideoToBltBuffer, SourceX, SourceY, 0, 0, ScreenWidth - SourceX, ScreenHeight - SourceY, 0);265 VBoxVgaUgaDrawBlt(This, (EFI_UGA_PIXEL *)Private->TmpBuf, EfiUgaBltBufferToVideo, 0, 0, DestinationX, DestinationY, ScreenWidth - SourceX, ScreenHeight - SourceY, 0);266 break;267 268 282 case EfiUgaVideoFill: 269 Blt = BltBuffer; 270 271 if (DestinationX == 0 && Width == Private->ModeData[Private->CurrentMode].HorizontalResolution) { 272 Offset = DestinationY * Private->ModeData[Private->CurrentMode].HorizontalResolution; 283 // 284 // Video Fill: Source is BltBuffer, destination is Video 285 // 286 if (DestinationX == 0 && Width == ScreenWidth) { 287 /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthFillUint32) and format matches EFI_UGA_PIXEL 288 Status = Private->PciIo->Mem.Write ( 289 Private->PciIo, 290 EfiPciIoWidthFillUint32, 291 0, 292 DestinationY * ScreenWidth * 4, 293 (Width * Height), 294 BltBuffer 295 ); 296 ASSERT_EFI_ERROR((Status)); 297 } else { 298 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { 299 /// @todo assumes that color depth is 32 (*4, EfiPciIoWidthFillUint32) and format matches EFI_UGA_PIXEL 273 300 Private->PciIo->Mem.Write ( 274 301 Private->PciIo, 275 302 EfiPciIoWidthFillUint32, 276 303 0, 277 Offset * 4, 278 (Width * Height) , 279 Blt 280 ); 281 } else { 282 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { 283 Offset = (DstY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + DestinationX; 284 Private->PciIo->Mem.Write ( 285 Private->PciIo, 286 EfiPciIoWidthFillUint32, 287 0, 288 Offset * 4, 289 Width, 290 Blt 291 ); 292 } 293 } 294 break; 295 296 case EfiUgaBltBufferToVideo: 297 for (SrcY = SourceY, DstY = DestinationY; SrcY < (Height + SourceY); SrcY++, DstY++) { 298 299 for (X = 0; X < Width; X++) { 300 Blt = (EFI_UGA_PIXEL *) ((UINT32 *) BltBuffer + (SrcY * Delta) + (SourceX + X)); 301 Private->LineBuffer[X] = *(UINT32 *)Blt; 302 } 303 304 Offset = (DstY * Private->ModeData[Private->CurrentMode].HorizontalResolution) + DestinationX; 305 306 Private->PciIo->Mem.Write ( 307 Private->PciIo, 308 EfiPciIoWidthUint32, 309 0, 310 Offset * 4, 304 ((DstY * ScreenWidth) + DestinationX) * 4, 311 305 Width, 312 Private->LineBuffer306 BltBuffer 313 307 ); 314 308 } 309 } 315 310 break; 316 311 317 312 default: 318 break;313 ASSERT (FALSE); 319 314 } 320 315 … … 333 328 { 334 329 EFI_UGA_DRAW_PROTOCOL *UgaDraw; 335 UINT32 HorizontalResolution = 102 7;330 UINT32 HorizontalResolution = 1024; 336 331 UINT32 VerticalResolution = 768; 337 332 … … 350 345 Private->CurrentMode = 0; 351 346 Private->HardwareNeedsStarting = TRUE; 352 Private->LineBuffer = NULL;353 347 354 348 // … … 362 356 UgaDraw->SetMode ( 363 357 UgaDraw, 364 Private->ModeData[Private->CurrentMode].HorizontalResolution,365 Private->ModeData[Private->CurrentMode].VerticalResolution,366 Private->ModeData[Private->CurrentMode].ColorDepth,367 Private->ModeData[Private->CurrentMode].RefreshRate358 HorizontalResolution, 359 VerticalResolution, 360 32, 361 60 368 362 ); 363 369 364 DrawLogo ( 370 365 Private, … … 372 367 Private->ModeData[Private->CurrentMode].VerticalResolution 373 368 ); 369 374 370 PcdSet32(PcdVideoHorizontalResolution, HorizontalResolution); 375 371 PcdSet32(PcdVideoVerticalResolution, VerticalResolution);
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器