tVesa_Mode *gVesa_Modes;\r
tVesa_Mode *gpVesaCurMode;\r
int giVesaModeCount = 0;\r
+ int gbVesaModesChecked;\r
// --- Framebuffer ---\r
char *gpVesa_Framebuffer = (void*)VESA_DEFAULT_FRAMEBUFFER;\r
int giVesaPageCount = 0; //!< Framebuffer size in pages\r
{\r
tVesa_CallInfo *info;\r
tFarPtr infoPtr;\r
- tVesa_CallModeInfo *modeinfo;\r
- tFarPtr modeinfoPtr;\r
Uint16 *modes;\r
int i;\r
\r
// Allocate Info Block\r
gpVesa_BiosState = VM8086_Init();\r
info = VM8086_Allocate(gpVesa_BiosState, 512, &infoPtr.seg, &infoPtr.ofs);\r
- modeinfo = VM8086_Allocate(gpVesa_BiosState, 512, &modeinfoPtr.seg, &modeinfoPtr.ofs);\r
// Set Requested Version\r
memcpy(info->signature, "VBE2", 4);\r
// Set Registers\r
for( i = 1; i < giVesaModeCount; i++ )\r
{\r
gVesa_Modes[i].code = modes[i];\r
- // Get Mode info\r
- gpVesa_BiosState->AX = 0x4F01;\r
- gpVesa_BiosState->CX = gVesa_Modes[i].code;\r
- gpVesa_BiosState->ES = modeinfoPtr.seg;\r
- gpVesa_BiosState->DI = modeinfoPtr.ofs;\r
- VM8086_Int(gpVesa_BiosState, 0x10);\r
- \r
- // Parse Info\r
- gVesa_Modes[i].flags = 0;\r
- if ( (modeinfo->attributes & 0x90) == 0x90 )\r
- {\r
- gVesa_Modes[i].flags |= FLAG_LFB;\r
- gVesa_Modes[i].framebuffer = modeinfo->physbase;\r
- gVesa_Modes[i].fbSize = modeinfo->Yres*modeinfo->pitch;\r
- } else {\r
- gVesa_Modes[i].framebuffer = 0;\r
- gVesa_Modes[i].fbSize = 0;\r
- }\r
- \r
- gVesa_Modes[i].pitch = modeinfo->pitch;\r
- gVesa_Modes[i].width = modeinfo->Xres;\r
- gVesa_Modes[i].height = modeinfo->Yres;\r
- gVesa_Modes[i].bpp = modeinfo->bpp;\r
- \r
- #if DEBUG\r
- Log_Log("VESA", "0x%x - %ix%ix%i",\r
- gVesa_Modes[i].code, gVesa_Modes[i].width, gVesa_Modes[i].height, gVesa_Modes[i].bpp);\r
- #endif\r
}\r
- \r
+\r
+// VM8086_Deallocate( info );\r
\r
// Install Device\r
giVesaDriverId = DevFS_AddDevice( &gVesa_DriverStruct );\r
return MODULE_ERR_OK;\r
}\r
\r
+void Vesa_int_FillModeList(void)\r
+{\r
+ if( !gbVesaModesChecked )\r
+ {\r
+ int i;\r
+ tVesa_CallModeInfo *modeinfo;\r
+ tFarPtr modeinfoPtr;\r
+ \r
+ modeinfo = VM8086_Allocate(gpVesa_BiosState, 512, &modeinfoPtr.seg, &modeinfoPtr.ofs);\r
+ for( i = 1; i < giVesaModeCount; i ++ )\r
+ {\r
+ // Get Mode info\r
+ gpVesa_BiosState->AX = 0x4F01;\r
+ gpVesa_BiosState->CX = gVesa_Modes[i].code;\r
+ gpVesa_BiosState->ES = modeinfoPtr.seg;\r
+ gpVesa_BiosState->DI = modeinfoPtr.ofs;\r
+ VM8086_Int(gpVesa_BiosState, 0x10);\r
+ \r
+ // Parse Info\r
+ gVesa_Modes[i].flags = 0;\r
+ if ( (modeinfo->attributes & 0x90) == 0x90 )\r
+ {\r
+ gVesa_Modes[i].flags |= FLAG_LFB;\r
+ gVesa_Modes[i].framebuffer = modeinfo->physbase;\r
+ gVesa_Modes[i].fbSize = modeinfo->Yres*modeinfo->pitch;\r
+ } else {\r
+ gVesa_Modes[i].framebuffer = 0;\r
+ gVesa_Modes[i].fbSize = 0;\r
+ }\r
+ \r
+ gVesa_Modes[i].pitch = modeinfo->pitch;\r
+ gVesa_Modes[i].width = modeinfo->Xres;\r
+ gVesa_Modes[i].height = modeinfo->Yres;\r
+ gVesa_Modes[i].bpp = modeinfo->bpp;\r
+ \r
+ #if DEBUG\r
+ Log_Log("VESA", "0x%x - %ix%ix%i",\r
+ gVesa_Modes[i].code, gVesa_Modes[i].width, gVesa_Modes[i].height, gVesa_Modes[i].bpp);\r
+ #endif\r
+ }\r
+ \r
+// VM8086_Deallocate( modeinfo );\r
+ \r
+ gbVesaModesChecked = 1;\r
+ }\r
+}\r
+\r
/* Read from the framebuffer\r
*/\r
Uint64 Vesa_Read(tVFS_Node *Node, Uint64 off, Uint64 len, void *buffer)\r
// Check for fast return\r
if(mode == giVesaCurrentMode) return 1;\r
\r
+ Vesa_int_FillModeList();\r
+\r
Time_RemoveTimer(giVesaCursorTimer);\r
giVesaCursorTimer = -1;\r
\r
int factor, tmp;\r
\r
ENTER("idata->width idata->height idata->bpp", data->width, data->height, data->bpp);\r
+\r
+ Vesa_int_FillModeList();\r
\r
for(i=0;i<giVesaModeCount;i++)\r
{\r
int Vesa_Int_ModeInfo(tVideo_IOCtl_Mode *data)\r
{\r
if(data->id < 0 || data->id > giVesaModeCount) return -1;\r
+\r
+ Vesa_int_FillModeList();\r
+\r
data->width = gVesa_Modes[data->id].width;\r
data->height = gVesa_Modes[data->id].height;\r
data->bpp = gVesa_Modes[data->id].bpp;\r