X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=AcessNative%2Facesskernel_src%2Fvideo.c;h=5408b56e3cbe9bbb0aad04dff8efd01a1907efcd;hb=b45391e1bbca0b04ffb2114409381d18627fa688;hp=4645b956974f8365a6efdc18bf515d251d1a51a2;hpb=02cbaac1233be9c5228973a787431fa5e0aa178e;p=tpg%2Facess2.git diff --git a/AcessNative/acesskernel_src/video.c b/AcessNative/acesskernel_src/video.c index 4645b956..5408b56e 100644 --- a/AcessNative/acesskernel_src/video.c +++ b/AcessNative/acesskernel_src/video.c @@ -4,17 +4,18 @@ * Video Driver */ #define VERSION ((0<<8)|10) +#define DEBUG 0 #include #include #include #include -#include +#include #include "ui.h" // === PROTOTYPES === int Video_Install(char **Arguments); Uint64 Video_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); +Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer); int Video_IOCtl(tVFS_Node *Node, int ID, void *Data); // --- 2D Acceleration Functions -- void Video_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour); @@ -22,13 +23,14 @@ void Video_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY // === GLOBALS === //MODULE_DEFINE(0, VERSION, NativeVideo, Video_Install, NULL, NULL); -tDevFS_Driver gVideo_DriverStruct = { - NULL, "NativeVideo", - { +tVFS_NodeType gVideo_NodeType = { .Read = Video_Read, .Write = Video_Write, .IOCtl = Video_IOCtl - } +}; +tDevFS_Driver gVideo_DriverStruct = { + NULL, "NativeVideo", + {.Type = &gVideo_NodeType} }; int giVideo_DriverID; int giVideo_CurrentFormat; @@ -61,7 +63,7 @@ Uint64 Video_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) /** * \brief Write to the framebuffer */ -Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, const void *Buffer) { int i; ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); @@ -75,7 +77,7 @@ Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) { case VIDEO_BUFFMT_TEXT: { - tVT_Char *chars = Buffer; + const tVT_Char *chars = Buffer; // int pitch = giUI_Pitch; int widthInChars = giUI_Width/giVT_CharWidth; int heightInChars = giUI_Height/giVT_CharHeight; @@ -90,6 +92,8 @@ Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) // Sanity Check if( Offset > (Uint64)(heightInChars*widthInChars) ) { + Log_Notice("Video", "Offset (%i) > %i*%i (%i)", Offset, + heightInChars, widthInChars, heightInChars*widthInChars); LEAVE('i', 0); return 0; } @@ -106,21 +110,36 @@ Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) Log_Notice("Video", "Clipping write size to %i characters", (int)Length); } +// Log_Debug("Video", "(%i,%i) %i chars", x, y, (int)Length); + // Print characters for( i = 0; i < (int)Length; i++ ) { - VT_Font_Render( - chars->Ch, - //dest + x*giVT_CharWidth, pitch, - tmpBuf, giVT_CharWidth, - VT_Colour12to24(chars->BGCol), - VT_Colour12to24(chars->FGCol) - ); - UI_BlitBitmap( - x*giVT_CharWidth, y*giVT_CharHeight, - giVT_CharWidth, giVT_CharHeight, - tmpBuf - ); + if( chars->Ch ) + { +// Log_Debug("Video", "Render Char 0x%x in 0x%03x:%03x", +// chars->Ch, chars->FGCol, chars->BGCol); + memset(tmpBuf, 0xFF, giVT_CharWidth*giVT_CharHeight*4); + VT_Font_Render( + chars->Ch, + tmpBuf, 32, giVT_CharWidth*4, + VT_Colour12to24(chars->BGCol), + VT_Colour12to24(chars->FGCol) + ); + UI_BlitBitmap( + x*giVT_CharWidth, y*giVT_CharHeight, + giVT_CharWidth, giVT_CharHeight, + tmpBuf + ); + } + else + { + UI_FillBitmap( + x*giVT_CharWidth, y*giVT_CharHeight, + giVT_CharWidth, giVT_CharHeight, + VT_Colour12to24(chars->BGCol) + ); + } chars ++; x ++; @@ -146,7 +165,6 @@ Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) } LOG("buffer = %p", Buffer); - LOG("Updating Framebuffer (%p to %p)", destBuf, destBuf + (Uint)Length); startX = Offset % giUI_Width; startY = Offset / giUI_Width; @@ -211,7 +229,7 @@ Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) return Length; } -const char * const csaVIDEO_IOCTLS[] = {DRV_IOCTLNAMES, DRV_VIDEO_IOCTLNAMES, NULL}; +const char * csaVIDEO_IOCTLS[] = {DRV_IOCTLNAMES, DRV_VIDEO_IOCTLNAMES, NULL}; /** * \brief Handle messages to the device */ @@ -247,16 +265,14 @@ int Video_IOCtl(tVFS_Node *Node, int ID, void *Data) #if 0 case VIDEO_IOCTL_SETCURSOR: // Set cursor position #if !BLINKING_CURSOR - if(giVesaCursorX > 0) - Vesa_FlipCursor(Node); + if(giVideo_CursorX > 0) + Video_FlipCursor(Node); #endif - giVesaCursorX = ((tVideo_IOCtl_Pos*)Data)->x; - giVesaCursorY = ((tVideo_IOCtl_Pos*)Data)->y; - //Log_Debug("VESA", "Cursor position (%i,%i)", giVesaCursorX, giVesaCursorY); - if( - giVesaCursorX < 0 || giVesaCursorY < 0 - || giVesaCursorX >= gpVesaCurMode->width/giVT_CharWidth - || giVesaCursorY >= gpVesaCurMode->height/giVT_CharHeight) + giVideo_CursorX = ((tVideo_IOCtl_Pos*)Data)->x; + giVideo_CursorY = ((tVideo_IOCtl_Pos*)Data)->y; + if( giVideo_CursorX < 0 || giVesaCursorY < 0 + || giVideo_CursorX >= gpVesaCurMode->width/giVT_CharWidth + || giVideo_CursorY >= gpVesaCurMode->height/giVT_CharHeight) { #if BLINKING_CURSOR if(giVesaCursorTimer != -1) { @@ -279,9 +295,6 @@ int Video_IOCtl(tVFS_Node *Node, int ID, void *Data) //Log_Debug("VESA", "Cursor position (%i,%i) Timer %i", giVesaCursorX, giVesaCursorY, giVesaCursorTimer); return 0; #endif - - case VIDEO_IOCTL_REQLFB: // Request Linear Framebuffer - return 0; } return 0; }