X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FModules%2FDisplay%2FTegra2Vid%2Fmain.c;h=f091327ba20dff6c6fe2736bfb7a43c57dff4781;hb=7f4eb3ddc495ffa7ecad1a9d2f9fc5149c4c4f6f;hp=d9405be051b80d140803f896748bb2469a0a5f78;hpb=48743e39650eb1ef988380e9d95f27fd40d3a9ce;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/Display/Tegra2Vid/main.c b/KernelLand/Modules/Display/Tegra2Vid/main.c index d9405be0..f091327b 100644 --- a/KernelLand/Modules/Display/Tegra2Vid/main.c +++ b/KernelLand/Modules/Display/Tegra2Vid/main.c @@ -23,21 +23,22 @@ void Tegra2Vid_Uninstall(); // Internal // Filesystem -Uint64 Tegra2Vid_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer); -Uint64 Tegra2Vid_Write(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer); +size_t Tegra2Vid_Read(tVFS_Node *node, off_t off, size_t len, void *buffer); +size_t Tegra2Vid_Write(tVFS_Node *node, off_t off, size_t len, const void *buffer); int Tegra2Vid_IOCtl(tVFS_Node *node, int id, void *data); // -- Internals int Tegra2Vid_int_SetMode(int Mode); // === GLOBALS === MODULE_DEFINE(0, VERSION, Tegra2Vid, Tegra2Vid_Install, NULL, NULL); -tDevFS_Driver gTegra2Vid_DriverStruct = { - NULL, "Tegra2Vid", - { +tVFS_NodeType gTegra2Vid_NodeType = { .Read = Tegra2Vid_Read, .Write = Tegra2Vid_Write, .IOCtl = Tegra2Vid_IOCtl - } + }; +tDevFS_Driver gTegra2Vid_DriverStruct = { + NULL, "Tegra2Vid", + {.Type = &gTegra2Vid_NodeType} }; // -- Options tPAddr gTegra2Vid_PhysBase = TEGRA2VID_BASE; @@ -66,6 +67,7 @@ tVideo_IOCtl_Pos gTegra2Vid_CursorPos; */ int Tegra2Vid_Install(char **Arguments) { + return MODULE_ERR_NOTNEEDED; // KeyVal_Parse(&gTegra2Vid_KeyValueParser, Arguments); gpTegra2Vid_IOMem = (void*)MM_MapHWPages(gTegra2Vid_PhysBase, 256/4); @@ -94,17 +96,35 @@ int Tegra2Vid_Install(char **Arguments) Log_Debug("Tegra2Vid", "[0x%03x] = 0x%08x", i, gpTegra2Vid_IOMem[i]); } // return 1; - + + // HACK!!! +#if 0 + { + int w = 1680, h = 1050; + gpTegra2Vid_IOMem[DC_DISP_DISP_ACTIVE_0] = (h << 16) | w; + gpTegra2Vid_IOMem[DC_WIN_A_SIZE_0] = (h << 16) | w; + gpTegra2Vid_IOMem[DC_WIN_A_PRESCALED_SIZE_0] = (h << 16) | w; + } +#endif + giTegra2Vid_FramebufferSize = (gpTegra2Vid_IOMem[DC_WIN_A_SIZE_0]&0xFFFF) *(gpTegra2Vid_IOMem[DC_WIN_A_SIZE_0]>>16)*4; Log_Debug("Tegra2Vid", "giTegra2Vid_FramebufferSize = 0x%x", giTegra2Vid_FramebufferSize); - gpTegra2Vid_Framebuffer = MM_MapHWPages( + gpTegra2Vid_Framebuffer = (void*)MM_MapHWPages( gpTegra2Vid_IOMem[DC_WINBUF_A_START_ADDR_0], (giTegra2Vid_FramebufferSize+PAGE_SIZE-1)/PAGE_SIZE ); - memset(gpTegra2Vid_Framebuffer, 0x1F, 0x1000); + memset(gpTegra2Vid_Framebuffer, 0xFF, 0x1000); + +// gpTegra2Vid_IOMem[DC_WIN_A_WIN_OPTIONS_0] &= ~0x40; +// gpTegra2Vid_IOMem[DC_WIN_A_COLOR_DEPTH_0] = 12; // Could be 13 (BGR/RGB) + gTegra2Vid_DrvUtil_BufInfo.Width = 1024; + gTegra2Vid_DrvUtil_BufInfo.Height = 768; + gTegra2Vid_DrvUtil_BufInfo.Pitch = 1024*4; + gTegra2Vid_DrvUtil_BufInfo.Depth = 32; + gTegra2Vid_DrvUtil_BufInfo.Framebuffer = gpTegra2Vid_Framebuffer; // Tegra2Vid_int_SetMode(4); @@ -124,7 +144,7 @@ void Tegra2Vid_Uninstall() /** * \brief Read from the framebuffer */ -Uint64 Tegra2Vid_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) +size_t Tegra2Vid_Read(tVFS_Node *node, off_t off, size_t len, void *buffer) { return 0; } @@ -132,7 +152,7 @@ Uint64 Tegra2Vid_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) /** * \brief Write to the framebuffer */ -Uint64 Tegra2Vid_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t Tegra2Vid_Write(tVFS_Node *Node, off_t Offset, size_t Length, const void *Buffer) { gTegra2Vid_DrvUtil_BufInfo.BufferFormat = giTegra2Vid_BufferMode; return DrvUtil_Video_WriteLFB(&gTegra2Vid_DrvUtil_BufInfo, Offset, Length, Buffer); @@ -185,7 +205,7 @@ int Tegra2Vid_IOCtl(tVFS_Node *Node, int ID, void *Data) case VIDEO_IOCTL_FINDMODE: { tVideo_IOCtl_Mode *mode = Data; - int closest, closestArea, reqArea = 0; + int closest=0, closestArea, reqArea = 0; if(!Data || !CheckMem(Data, sizeof(tVideo_IOCtl_Mode))) LEAVE_RET('i', -1); if( mode->bpp != 32 ) @@ -288,10 +308,10 @@ int Tegra2Vid_int_SetMode(int Mode) *(Uint32*)(gpTegra2Vid_IOMem + DC_DISP_DISP_ACTIVE_0) = (mode->H << 16) | mode->W; *(Uint32*)(gpTegra2Vid_IOMem + DC_WIN_A_POSITION_0) = 0; - *(Uint32*)(gpTegra2Vid_IOMem + DC_WIN_A_SIZE_0) = (mode->H << 16) | mode->W; + *(Uint32*)(gpTegra2Vid_IOMem + DC_WIN_A_SIZE_0) = (h << 16) | w; *(Uint32*)(gpTegra2Vid_IOMem + DC_DISP_DISP_COLOR_CONTROL_0) = 0x8; // BASE888 *(Uint32*)(gpTegra2Vid_IOMem + DC_WIN_A_COLOR_DEPTH_0) = 12; // Could be 13 (BGR/RGB) - *(Uint32*)(gpTegra2Vid_IOMem + DC_WIN_A_PRESCALED_SIZE_0) = (mode->H << 16) | mode->W; + *(Uint32*)(gpTegra2Vid_IOMem + DC_WIN_A_PRESCALED_SIZE_0) = (h << 16) | w; Log_Debug("Tegra2Vid", "Mode %i (%ix%i) selected", Mode, w, h);