3 * Video BIOS Extensions (Vesa) Driver
\r
6 #define VERSION 0x100
\r
10 #include <tpl_drv_video.h>
\r
11 #include <fs_devfs.h>
\r
12 #include <modules.h>
\r
16 // === CONSTANTS ===
\r
17 #define FLAG_LFB 0x1
\r
18 #define VESA_DEFAULT_FRAMEBUFFER (KERNEL_BASE|0xA0000)
\r
19 #define BLINKING_CURSOR 1
\r
21 # define VESA_CURSOR_PERIOD 1000
\r
24 // === PROTOTYPES ===
\r
25 int Vesa_Install(char **Arguments);
\r
26 Uint64 Vesa_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
\r
27 Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
\r
28 int Vesa_Ioctl(tVFS_Node *Node, int ID, void *Data);
\r
29 int Vesa_Int_SetMode(int Mode);
\r
30 int Vesa_Int_FindMode(tVideo_IOCtl_Mode *data);
\r
31 int Vesa_Int_ModeInfo(tVideo_IOCtl_Mode *data);
\r
32 void Vesa_FlipCursor(void *Arg);
\r
33 // --- 2D Acceleration Functions --
\r
34 void Vesa_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour);
\r
35 void Vesa_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY, Uint16 W, Uint16 H);
\r
38 MODULE_DEFINE(0, VERSION, Vesa, Vesa_Install, NULL, "PCI", "VM8086", NULL);
\r
39 tDevFS_Driver gVesa_DriverStruct = {
\r
43 .Write = Vesa_Write,
\r
48 tVM8086 *gpVesa_BiosState;
\r
49 int giVesaDriverId = -1;
\r
50 // --- Video Modes ---
\r
51 int giVesaCurrentMode = 0;
\r
52 int giVesaCurrentFormat = VIDEO_BUFFMT_TEXT;
\r
53 tVesa_Mode *gVesa_Modes;
\r
54 tVesa_Mode *gpVesaCurMode;
\r
55 int giVesaModeCount = 0;
\r
56 // --- Framebuffer ---
\r
57 char *gpVesa_Framebuffer = (void*)VESA_DEFAULT_FRAMEBUFFER;
\r
58 int giVesaPageCount = 0; //!< Framebuffer size in pages
\r
59 // --- Cursor Control ---
\r
60 int giVesaCursorX = -1;
\r
61 int giVesaCursorY = -1;
\r
62 int giVesaCursorTimer = -1; // Invalid timer
\r
63 // --- 2D Video Stream Handlers ---
\r
64 tDrvUtil_Video_2DHandlers gVesa_2DFunctions = {
\r
71 int Vesa_Install(char **Arguments)
\r
73 tVesa_CallInfo *info;
\r
75 tVesa_CallModeInfo *modeinfo;
\r
76 tFarPtr modeinfoPtr;
\r
80 // Allocate Info Block
\r
81 gpVesa_BiosState = VM8086_Init();
\r
82 info = VM8086_Allocate(gpVesa_BiosState, 512, &infoPtr.seg, &infoPtr.ofs);
\r
83 modeinfo = VM8086_Allocate(gpVesa_BiosState, 512, &modeinfoPtr.seg, &modeinfoPtr.ofs);
\r
84 // Set Requested Version
\r
85 memcpy(info->signature, "VBE2", 4);
\r
87 gpVesa_BiosState->AX = 0x4F00;
\r
88 gpVesa_BiosState->ES = infoPtr.seg; gpVesa_BiosState->DI = infoPtr.ofs;
\r
90 VM8086_Int(gpVesa_BiosState, 0x10);
\r
91 if(gpVesa_BiosState->AX != 0x004F) {
\r
92 Log_Warning("VESA", "Vesa_Install - VESA/VBE Unsupported (AX = 0x%x)", gpVesa_BiosState->AX);
\r
93 return MODULE_ERR_NOTNEEDED;
\r
96 //Log_Debug("VESA", "info->VideoModes = %04x:%04x", info->VideoModes.seg, info->VideoModes.ofs);
\r
97 modes = (Uint16 *) VM8086_GetPointer(gpVesa_BiosState, info->VideoModes.seg, info->VideoModes.ofs);
\r
100 for( giVesaModeCount = 0; modes[giVesaModeCount] != 0xFFFF; giVesaModeCount++ );
\r
101 gVesa_Modes = (tVesa_Mode *)malloc( giVesaModeCount * sizeof(tVesa_Mode) );
\r
103 Log_Debug("VESA", "%i Modes", giVesaModeCount);
\r
105 // Insert Text Mode
\r
106 gVesa_Modes[0].width = 80;
\r
107 gVesa_Modes[0].height = 25;
\r
108 gVesa_Modes[0].bpp = 12;
\r
109 gVesa_Modes[0].code = 0x3;
\r
110 gVesa_Modes[0].flags = 1;
\r
111 gVesa_Modes[0].fbSize = 80*25*2;
\r
112 gVesa_Modes[0].framebuffer = 0xB8000;
\r
114 for( i = 1; i < giVesaModeCount; i++ )
\r
116 gVesa_Modes[i].code = modes[i];
\r
118 gpVesa_BiosState->AX = 0x4F01;
\r
119 gpVesa_BiosState->CX = gVesa_Modes[i].code;
\r
120 gpVesa_BiosState->ES = modeinfoPtr.seg;
\r
121 gpVesa_BiosState->DI = modeinfoPtr.ofs;
\r
122 VM8086_Int(gpVesa_BiosState, 0x10);
\r
125 gVesa_Modes[i].flags = 0;
\r
126 if ( (modeinfo->attributes & 0x90) == 0x90 )
\r
128 gVesa_Modes[i].flags |= FLAG_LFB;
\r
129 gVesa_Modes[i].framebuffer = modeinfo->physbase;
\r
130 gVesa_Modes[i].fbSize = modeinfo->Yres*modeinfo->pitch;
\r
132 gVesa_Modes[i].framebuffer = 0;
\r
133 gVesa_Modes[i].fbSize = 0;
\r
136 gVesa_Modes[i].pitch = modeinfo->pitch;
\r
137 gVesa_Modes[i].width = modeinfo->Xres;
\r
138 gVesa_Modes[i].height = modeinfo->Yres;
\r
139 gVesa_Modes[i].bpp = modeinfo->bpp;
\r
142 Log_Log("VESA", "0x%x - %ix%ix%i",
\r
143 gVesa_Modes[i].code, gVesa_Modes[i].width, gVesa_Modes[i].height, gVesa_Modes[i].bpp);
\r
149 giVesaDriverId = DevFS_AddDevice( &gVesa_DriverStruct );
\r
150 if(giVesaDriverId == -1) return MODULE_ERR_MISC;
\r
152 return MODULE_ERR_OK;
\r
155 /* Read from the framebuffer
\r
157 Uint64 Vesa_Read(tVFS_Node *Node, Uint64 off, Uint64 len, void *buffer)
\r
160 Log("Vesa_Read: () - NULL\n");
\r
166 * \brief Write to the framebuffer
\r
168 Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
\r
170 ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer);
\r
172 if(Buffer == NULL) {
\r
177 // Default Text mode
\r
178 if( giVesaCurrentMode == 0 )
\r
180 Uint16 *fb = (Uint16*)(KERNEL_BASE|0xB8000);
\r
181 tVT_Char *chars = Buffer;
\r
184 Length /= sizeof(tVT_Char);
\r
185 Offset /= sizeof(tVT_Char);
\r
187 if( giVesaCurrentFormat != VIDEO_BUFFMT_TEXT ) {
\r
188 Log_Warning("VESA", "Vesa_Write - Mode 0 is not framebuffer");
\r
193 if( Offset + Length > 25*80 ) {
\r
194 Log_Warning("VESA", "Vesa_Write - Framebuffer Overflow");
\r
200 LOG("fb = %p", fb);
\r
201 for(rem = Length; rem --; fb ++, chars++)
\r
203 if( chars->Ch < 0x80 )
\r
204 *fb = chars->Ch & 0x7F;
\r
208 *fb |= (chars->FGCol & 0x888) == 0x888 ? 0x8 : 0;
\r
209 *fb |= (chars->FGCol & 0x700) > 0x300 ? 0x4 : 0;
\r
210 *fb |= (chars->FGCol & 0x070) > 0x030 ? 0x2 : 0;
\r
211 *fb |= (chars->FGCol & 0x007) > 0x003 ? 0x1 : 0;
\r
212 *fb |= (chars->BGCol & 0x888) == 0x888 ? 0x80 : 0;
\r
213 *fb |= (chars->BGCol & 0x700) > 0x300 ? 0x40 : 0;
\r
214 *fb |= (chars->BGCol & 0x070) > 0x030 ? 0x20 : 0;
\r
215 *fb |= (chars->BGCol & 0x007) > 0x003 ? 0x10 : 0;
\r
216 //LOG("%08x (%03x,%03x) = %04x",
\r
217 // chars->Ch, chars->BGCol, chars->FGCol, *fb);
\r
219 Length *= sizeof(tVT_Char);
\r
220 LEAVE('X', Length);
\r
224 if( gVesa_Modes[giVesaCurrentMode].framebuffer == 0 ) {
\r
225 Log_Warning("VESA", "Vesa_Write - Non-LFB Modes not yet supported.");
\r
231 switch( giVesaCurrentFormat )
\r
233 case VIDEO_BUFFMT_TEXT:
\r
235 tVT_Char *chars = Buffer;
\r
236 int pitch = gVesa_Modes[giVesaCurrentMode].pitch;
\r
237 int depth = gVesa_Modes[giVesaCurrentMode].bpp;
\r
238 int widthInChars = gVesa_Modes[giVesaCurrentMode].width/giVT_CharWidth;
\r
239 int heightInChars = gVesa_Modes[giVesaCurrentMode].height/giVT_CharHeight;
\r
241 Uint8 *dest = (void*)gpVesa_Framebuffer;
\r
244 Length /= sizeof(tVT_Char);
\r
245 Offset /= sizeof(tVT_Char);
\r
247 LOG("gVesa_Modes[%i] = {height:%i, width:%i, pitch:%i}",
\r
249 gVesa_Modes[giVesaCurrentMode].height,
\r
250 gVesa_Modes[giVesaCurrentMode].width,
\r
251 gVesa_Modes[giVesaCurrentMode].pitch
\r
253 x = Offset % widthInChars;
\r
254 y = Offset / widthInChars;
\r
255 LOG("(x,y) = (%i,%i) = [%i,%i]",
\r
258 x * giVT_CharWidth * depth / 8,
\r
259 y * giVT_CharHeight * pitch
\r
261 LOG("(w,h) = (%i,%i) = [%i,%i]",
\r
262 (int)(Length % widthInChars),
\r
263 (int)(Length / widthInChars),
\r
264 (int)((Length % widthInChars) * giVT_CharWidth * depth / 8),
\r
265 (int)((Length / widthInChars) * giVT_CharHeight * pitch)
\r
269 if( Offset > (Uint64)(heightInChars*widthInChars) ) {
\r
273 if(y >= heightInChars) {
\r
279 if( (int)Offset + (int)Length > heightInChars*widthInChars ) {
\r
280 Log_Debug("VESA", "%i + %i > %i*%i (%i)",
\r
281 (int)Offset, (int)Length, heightInChars, widthInChars, heightInChars*widthInChars);
\r
282 Length = heightInChars*widthInChars - Offset;
\r
283 Log_Notice("VESA", "Clipping write size to %i characters", (int)Length);
\r
286 dest += y * giVT_CharHeight * pitch;
\r
288 LOG("dest = %p", dest);
\r
290 for( i = 0; i < (int)Length; i++ )
\r
293 !MM_GetPhysAddr( (tVAddr)dest + x*giVT_CharWidth*depth/8 )
\r
294 // || !MM_GetPhysAddr( (tVAddr)dest + x*giVT_CharWidth*depth/8 + pitch*giVT_CharHeight-1)
\r
297 Log_Notice("VESA", "Stopped at %i, not mapped", i);
\r
300 if( y >= heightInChars )
\r
302 Log_Notice("VESA", "Stopped at %i", i);
\r
308 dest + x*giVT_CharWidth*depth/8, depth, pitch,
\r
309 VT_Colour12toN(chars->BGCol, depth),
\r
310 VT_Colour12toN(chars->FGCol, depth)
\r
315 if( x >= widthInChars )
\r
319 dest += pitch*giVT_CharHeight;
\r
322 Length = i * sizeof(tVT_Char);
\r
326 case VIDEO_BUFFMT_FRAMEBUFFER:
\r
328 Uint8 *destBuf = (Uint8*) ((Uint)gpVesa_Framebuffer + (Uint)Offset);
\r
330 if(gVesa_Modes[giVesaCurrentMode].fbSize < Offset+Length)
\r
332 Log_Warning("VESA", "Vesa_Write - Framebuffer Overflow");
\r
337 LOG("buffer = %p", Buffer);
\r
338 LOG("Updating Framebuffer (%p to %p)", destBuf, destBuf + (Uint)Length);
\r
340 //TODO: Handle non 32-bpp framebuffer modes
\r
342 // Copy to Frambuffer
\r
343 memcpy(destBuf, Buffer, Length);
\r
345 LOG("BGA Framebuffer updated");
\r
349 case VIDEO_BUFFMT_2DSTREAM:
\r
350 Length = DrvUtil_Video_2DStream(
\r
351 NULL, // Single framebuffer, so Ent is unused
\r
352 Buffer, Length, &gVesa_2DFunctions, sizeof(gVesa_2DFunctions)
\r
361 LEAVE('X', Length);
\r
366 * \fn int Vesa_Ioctl(vfs_node *node, int id, void *data)
\r
367 * \brief Handle messages to the device
\r
369 int Vesa_Ioctl(tVFS_Node *Node, int ID, void *Data)
\r
372 //Log_Debug("VESA", "Vesa_Ioctl: (Node=%p, ID=%i, Data=%p)", Node, ID, Data);
\r
375 case DRV_IOCTL_TYPE: return DRV_TYPE_VIDEO;
\r
376 case DRV_IOCTL_IDENT: memcpy("VESA", Data, 4); return 1;
\r
377 case DRV_IOCTL_VERSION: return VERSION;
\r
379 case VIDEO_IOCTL_GETSETMODE:
\r
380 if( !Data ) return giVesaCurrentMode;
\r
381 return Vesa_Int_SetMode( *(int*)Data );
\r
383 case VIDEO_IOCTL_FINDMODE:
\r
384 return Vesa_Int_FindMode((tVideo_IOCtl_Mode*)Data);
\r
385 case VIDEO_IOCTL_MODEINFO:
\r
386 return Vesa_Int_ModeInfo((tVideo_IOCtl_Mode*)Data);
\r
388 case VIDEO_IOCTL_SETBUFFORMAT:
\r
389 ret = giVesaCurrentFormat;
\r
391 //Log_Log("VESA", "Buffer mode to %i", *(int*)Data);
\r
392 giVesaCurrentFormat = *(int*)Data;
\r
396 case VIDEO_IOCTL_SETCURSOR: // Set cursor position
\r
397 #if !BLINKING_CURSOR
\r
398 if(giVesaCursorX > 0)
\r
399 Vesa_FlipCursor(Node);
\r
401 giVesaCursorX = ((tVideo_IOCtl_Pos*)Data)->x;
\r
402 giVesaCursorY = ((tVideo_IOCtl_Pos*)Data)->y;
\r
403 //Log_Debug("VESA", "Cursor position (%i,%i)", giVesaCursorX, giVesaCursorY);
\r
405 giVesaCursorX < 0 || giVesaCursorY < 0
\r
406 || giVesaCursorX >= gpVesaCurMode->width/giVT_CharWidth
\r
407 || giVesaCursorY >= gpVesaCurMode->height/giVT_CharHeight)
\r
409 #if BLINKING_CURSOR
\r
410 if(giVesaCursorTimer != -1) {
\r
411 Time_RemoveTimer(giVesaCursorTimer);
\r
412 giVesaCursorTimer = -1;
\r
415 giVesaCursorX = -1;
\r
416 giVesaCursorY = -1;
\r
419 #if BLINKING_CURSOR
\r
420 // Log_Debug("VESA", "Updating timer %i?", giVesaCursorTimer);
\r
421 if(giVesaCursorTimer == -1)
\r
422 giVesaCursorTimer = Time_CreateTimer(VESA_CURSOR_PERIOD, Vesa_FlipCursor, Node);
\r
424 Vesa_FlipCursor(Node);
\r
427 //Log_Debug("VESA", "Cursor position (%i,%i) Timer %i", giVesaCursorX, giVesaCursorY, giVesaCursorTimer);
\r
430 case VIDEO_IOCTL_REQLFB: // Request Linear Framebuffer
\r
437 * \brief Updates the video mode
\r
439 int Vesa_Int_SetMode(int mode)
\r
441 // Sanity Check values
\r
442 if(mode < 0 || mode > giVesaModeCount) return -1;
\r
444 Log_Log("VESA", "Setting mode to %i (%ix%i %ibpp)",
\r
446 gVesa_Modes[mode].width, gVesa_Modes[mode].height,
\r
447 gVesa_Modes[mode].bpp
\r
450 // Check for fast return
\r
451 if(mode == giVesaCurrentMode) return 1;
\r
453 Time_RemoveTimer(giVesaCursorTimer);
\r
454 giVesaCursorTimer = -1;
\r
456 Mutex_Acquire( &glVesa_Lock );
\r
458 gpVesa_BiosState->AX = 0x4F02;
\r
459 gpVesa_BiosState->BX = gVesa_Modes[mode].code;
\r
460 if(gVesa_Modes[mode].flags & FLAG_LFB) {
\r
461 Log_Log("VESA", "Using LFB");
\r
462 gpVesa_BiosState->BX |= 0x4000; // Bit 14 - Use LFB
\r
466 VM8086_Int(gpVesa_BiosState, 0x10);
\r
469 if( (tVAddr)gpVesa_Framebuffer != VESA_DEFAULT_FRAMEBUFFER )
\r
470 MM_UnmapHWPages((tVAddr)gpVesa_Framebuffer, giVesaPageCount);
\r
471 giVesaPageCount = (gVesa_Modes[mode].fbSize + 0xFFF) >> 12;
\r
472 gpVesa_Framebuffer = (void*)MM_MapHWPages(gVesa_Modes[mode].framebuffer, giVesaPageCount);
\r
474 Log_Log("VESA", "Framebuffer (Phys) = 0x%x, (Virt) = 0x%x, Size = 0x%x",
\r
475 gVesa_Modes[mode].framebuffer, gpVesa_Framebuffer, giVesaPageCount << 12);
\r
478 giVesaCurrentMode = mode;
\r
479 gpVesaCurMode = &gVesa_Modes[giVesaCurrentMode];
\r
481 Mutex_Release( &glVesa_Lock );
\r
486 int Vesa_Int_FindMode(tVideo_IOCtl_Mode *data)
\r
489 int best = -1, bestFactor = 1000;
\r
492 ENTER("idata->width idata->height idata->bpp", data->width, data->height, data->bpp);
\r
494 for(i=0;i<giVesaModeCount;i++)
\r
496 LOG("Mode %i (%ix%ix%i)", i, gVesa_Modes[i].width, gVesa_Modes[i].height, gVesa_Modes[i].bpp);
\r
498 if(gVesa_Modes[i].width == data->width && gVesa_Modes[i].height == data->height)
\r
500 if( (data->bpp == 32 || data->bpp == 24)
\r
501 && (gVesa_Modes[i].bpp == 32 || gVesa_Modes[i].bpp == 24) )
\r
509 tmp = gVesa_Modes[i].width * gVesa_Modes[i].height;
\r
510 tmp -= data->width * data->height;
\r
511 tmp = tmp < 0 ? -tmp : tmp;
\r
512 factor = tmp * 100 / (data->width * data->height);
\r
514 if( (data->bpp == 32 || data->bpp == 24)
\r
515 && (gVesa_Modes[i].bpp == 32 || gVesa_Modes[i].bpp == 24) )
\r
523 LOG("factor = %i", factor);
\r
525 if(factor < bestFactor)
\r
527 bestFactor = factor;
\r
532 data->width = gVesa_Modes[best].width;
\r
533 data->height = gVesa_Modes[best].height;
\r
534 data->bpp = gVesa_Modes[best].bpp;
\r
539 int Vesa_Int_ModeInfo(tVideo_IOCtl_Mode *data)
\r
541 if(data->id < 0 || data->id > giVesaModeCount) return -1;
\r
542 data->width = gVesa_Modes[data->id].width;
\r
543 data->height = gVesa_Modes[data->id].height;
\r
544 data->bpp = gVesa_Modes[data->id].bpp;
\r
549 * \brief Updates the state of the text cursor
\r
550 * \note Just does a bitwise not on the cursor region
\r
552 void Vesa_FlipCursor(void *Arg)
\r
554 int pitch = gpVesaCurMode->pitch;
\r
555 int bytes_per_px = (gpVesaCurMode->bpp + 7) / 8;
\r
556 int x = giVesaCursorX*giVT_CharWidth;
\r
557 int y = giVesaCursorY*giVT_CharHeight;
\r
559 Uint8 *fb = (void*)gpVesa_Framebuffer;
\r
561 //Debug("Cursor flip");
\r
564 if(giVesaCursorX < 0 || giVesaCursorY < 0
\r
565 || y*pitch + x + (giVT_CharHeight-1)*pitch > (int)gpVesaCurMode->fbSize) {
\r
566 Log_Notice("VESA", "Cursor OOB (%i,%i)", x, y);
\r
567 giVesaCursorTimer = -1;
\r
572 fb += (y+1)*pitch + x*bytes_per_px;
\r
574 switch(bytes_per_px)
\r
577 for( i = 1; i < giVT_CharHeight-1; i++, fb += pitch )
\r
581 for( i = 1; i < giVT_CharHeight-1; i++, fb += pitch ) {
\r
587 for( i = 1; i < giVT_CharHeight-1; i++, fb += pitch ) {
\r
594 for( i = 1; i < giVT_CharHeight-1; i++, fb += pitch ) {
\r
602 Log_Error("VESA", "Vesa_FlipCursor - Bug Report, unknown bytes_per_px (%i)", bytes_per_px);
\r
603 giVesaCursorTimer = -1;
\r
607 #if BLINKING_CURSOR
\r
608 giVesaCursorTimer = Time_CreateTimer(VESA_CURSOR_PERIOD, Vesa_FlipCursor, Arg);
\r
612 // ------------------------
\r
613 // --- 2D Accelleration ---
\r
614 // ------------------------
\r
615 void Vesa_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour)
\r
617 // TODO: Handle non-32bit modes
\r
618 int pitch = gpVesaCurMode->pitch/4;
\r
619 Uint32 *buf = (Uint32*)gpVesa_Framebuffer + Y*pitch + X;
\r
621 memsetd(buf, Colour, W);
\r
626 void Vesa_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY, Uint16 W, Uint16 H)
\r
628 int scrnpitch = gpVesaCurMode->pitch;
\r
629 int bytes_per_px = (gpVesaCurMode->bpp + 7) / 8;
\r
630 int dst = DstY*scrnpitch + DstX;
\r
631 int src = SrcY*scrnpitch + SrcX;
\r
634 //Log("Vesa_2D_Blit: (Ent=%p, DstX=%i, DstY=%i, SrcX=%i, SrcY=%i, W=%i, H=%i)",
\r
635 // Ent, DstX, DstY, SrcX, SrcY, W, H);
\r
637 if(SrcX + W > gpVesaCurMode->width)
\r
638 W = gpVesaCurMode->width - SrcX;
\r
639 if(DstX + W > gpVesaCurMode->width)
\r
640 W = gpVesaCurMode->width - DstX;
\r
641 if(SrcY + H > gpVesaCurMode->height)
\r
642 H = gpVesaCurMode->height - SrcY;
\r
643 if(DstY + H > gpVesaCurMode->height)
\r
644 H = gpVesaCurMode->height - DstY;
\r
646 //Debug("W = %i, H = %i", W, H);
\r
650 dst += H*scrnpitch;
\r
651 src += H*scrnpitch;
\r
655 tmp = W*bytes_per_px;
\r
656 for( tmp = W; tmp --; ) {
\r
657 *(Uint8*)(gpVesa_Framebuffer + dst + tmp) = *(Uint8*)(gpVesa_Framebuffer + src + tmp);
\r
662 // Normal copy is OK
\r
664 memcpy((void*)gpVesa_Framebuffer + dst, (void*)gpVesa_Framebuffer + src, W*bytes_per_px);
\r
669 //Log("Vesa_2D_Blit: RETURN");
\r