int Vesa_Int_SetMode(int Mode);\r
int Vesa_Int_FindMode(tVideo_IOCtl_Mode *data);\r
int Vesa_Int_ModeInfo(tVideo_IOCtl_Mode *data);\r
+// --- 2D Acceleration Functions --\r
+void Vesa_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour);\r
+void Vesa_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY, Uint16 W, Uint16 H);\r
\r
// === GLOBALS ===\r
MODULE_DEFINE(0, VERSION, Vesa, Vesa_Install, NULL, "PCI", "VM8086", NULL);\r
tVesa_Mode *gVesa_Modes;\r
int giVesaModeCount = 0;\r
int giVesaPageCount = 0;\r
+tDrvUtil_Video_2DHandlers gVesa_2DFunctions = {\r
+ NULL,\r
+ Vesa_2D_Fill,\r
+ Vesa_2D_Blit\r
+};\r
\r
-//CODE\r
+// === CODE ===\r
int Vesa_Install(char **Arguments)\r
{\r
tVesa_CallInfo *info;\r
);\r
\r
// Sanity Check\r
- if(y > heightInChars) {\r
+ if(y >= heightInChars) {\r
LEAVE('i', 0);\r
return 0;\r
}\r
LOG("BGA Framebuffer updated");\r
}\r
break;\r
+ \r
+ case VIDEO_BUFFMT_2DSTREAM:\r
+ Length = DrvUtil_Video_2DStream(\r
+ NULL, // Single framebuffer, so Ent is unused\r
+ Buffer, Length, &gVesa_2DFunctions, sizeof(gVesa_2DFunctions)\r
+ );\r
+ break;\r
+ \r
default:\r
LEAVE('i', -1);\r
return -1;\r
case VIDEO_IOCTL_SETBUFFORMAT:\r
ret = giVesaCurrentFormat;\r
if(Data) {\r
- Log_Log("VESA", "Buffer mode to %i", *(int*)Data);\r
+ //Log_Log("VESA", "Buffer mode to %i", *(int*)Data);\r
giVesaCurrentFormat = *(int*)Data;\r
}\r
return ret;\r
data->bpp = gVesa_Modes[data->id].bpp;\r
return 1;\r
}\r
+\r
+// ------------------------\r
+// --- 2D Accelleration ---\r
+// ------------------------\r
+void Vesa_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour)\r
+{\r
+ int scrnwidth = gVesa_Modes[giVesaCurrentMode].width;\r
+ Uint32 *buf = (Uint32*)gpVesa_Framebuffer + Y*scrnwidth + X;\r
+ while( H -- ) {\r
+ memsetd(buf, Colour, W);\r
+ buf += scrnwidth;\r
+ }\r
+}\r
+\r
+void Vesa_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY, Uint16 W, Uint16 H)\r
+{\r
+ int scrnpitch = gVesa_Modes[giVesaCurrentMode].pitch;\r
+ int dst = DstY*scrnpitch + DstX;\r
+ int src = SrcY*scrnpitch + SrcX;\r
+ int tmp;\r
+ \r
+ //Log("Vesa_2D_Blit: (Ent=%p, DstX=%i, DstY=%i, SrcX=%i, SrcY=%i, W=%i, H=%i)",\r
+ // Ent, DstX, DstY, SrcX, SrcY, W, H);\r
+ \r
+ if(SrcX + W > gVesa_Modes[giVesaCurrentMode].width)\r
+ W = gVesa_Modes[giVesaCurrentMode].width - SrcX;\r
+ if(DstX + W > gVesa_Modes[giVesaCurrentMode].width)\r
+ W = gVesa_Modes[giVesaCurrentMode].width - DstX;\r
+ if(SrcY + H > gVesa_Modes[giVesaCurrentMode].height)\r
+ H = gVesa_Modes[giVesaCurrentMode].height - SrcY;\r
+ if(DstY + H > gVesa_Modes[giVesaCurrentMode].height)\r
+ H = gVesa_Modes[giVesaCurrentMode].height - DstY;\r
+ \r
+ //Debug("W = %i, H = %i", W, H);\r
+ \r
+ if( dst > src ) {\r
+ // Reverse copy\r
+ Debug("Reverse scroll");\r
+ dst += H*scrnpitch;\r
+ src += H*scrnpitch;\r
+ while( H -- ) {\r
+ dst -= scrnpitch;\r
+ src -= scrnpitch;\r
+ tmp = W;\r
+ for( tmp = W; tmp --; ) {\r
+ *(Uint32*)(gpVesa_Framebuffer + dst + tmp) = *(Uint32*)(gpVesa_Framebuffer + src + tmp);\r
+ }\r
+ }\r
+ }\r
+ else {\r
+ // Normal copy is OK\r
+ Debug("memcpy scroll");\r
+ while( H -- ) {\r
+ memcpy((void*)gpVesa_Framebuffer + dst, (void*)gpVesa_Framebuffer + src, W*sizeof(Uint32));\r
+ dst += scrnpitch;\r
+ src += scrnpitch;\r
+ }\r
+ }\r
+}\r