From: John Hodge Date: Wed, 19 Oct 2011 04:31:23 +0000 (+0800) Subject: Kernel/APIs - Moved buffer mode to FBInfo X-Git-Tag: rel0.13~32 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=15442765f459f04d9bcd6eac6726221272cc0a96;p=tpg%2Facess2.git Kernel/APIs - Moved buffer mode to FBInfo --- diff --git a/Kernel/drvutil.c b/Kernel/drvutil.c index 8908e7e3..fb9a1037 100644 --- a/Kernel/drvutil.c +++ b/Kernel/drvutil.c @@ -99,12 +99,12 @@ int DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, return 0; } -int DrvUtil_Video_WriteLFB(int Mode, tDrvUtil_Video_BufInfo *FBInfo, size_t Offset, size_t Length, void *Buffer) +int DrvUtil_Video_WriteLFB(tDrvUtil_Video_BufInfo *FBInfo, size_t Offset, size_t Length, void *Buffer) { Uint8 *dest; - ENTER("iMode pFBInfo xOffset xLength pBuffer", + ENTER("pFBInfo xOffset xLength pBuffer", Mode, FBInfo, Offset, Length, Buffer); - switch( Mode ) + switch( FBInfo->BufferFormat ) { case VIDEO_BUFFMT_TEXT: { diff --git a/Kernel/include/api_drv_common.h b/Kernel/include/api_drv_common.h index 4e92c5fe..59bef5fe 100644 --- a/Kernel/include/api_drv_common.h +++ b/Kernel/include/api_drv_common.h @@ -75,7 +75,12 @@ enum eTplDrv_IOCtl { * of this driver's IOCtl calls by taking a string and returning the * IOCtl call number associated with that method name. */ - DRV_IOCTL_LOOKUP + DRV_IOCTL_LOOKUP, + + /** + * \brief First non-reserved IOCtl number for driver extension + */ + DRV_IOCTL_USERMIN = 0x1000, }; /** diff --git a/Kernel/include/api_drv_video.h b/Kernel/include/api_drv_video.h index b1abe594..1a5fe6ac 100644 --- a/Kernel/include/api_drv_video.h +++ b/Kernel/include/api_drv_video.h @@ -4,8 +4,9 @@ * \note For AcessOS Version 1 * * Video drivers extend the common driver interface api_drv_common.h - * and must support _at least_ the IOCtl numbers defined in this file - * to be compatable with Acess. + * and must support the IOCtl numbers defined in this file to be + * compatable with Acess (drivers may implement more IOCtls above + * DRV_IOCTL_USERMIN). * * \section IOCtls * As said, a compatable driver must implement these calls correctly, @@ -19,10 +20,9 @@ * framebuffer. * * \section Mode Support - * All video drivers must support at least one text mode (Mode #0) - * For each graphics mode the driver exposes, there must be a corresponding - * text mode with the same resolution, this mode will be used when the - * user switches to a text Virtual Terminal while in graphics mode. + * All video drivers must support text output for every resolution (hardware + * accelerated or software), and at least the _BLIT and _FILL 2D operations + * (these may be implemented specifically for text mode). */ #ifndef _API_DRV_VIDEO_H #define _API_DRV_VIDEO_H @@ -317,6 +317,10 @@ extern Uint32 VT_Colour12toN(Uint16 Col12, int Depth); */ typedef struct sDrvUtil_Video_BufInfo { + /** + * \name Framebuffer state + * \{ + */ /** * \brief Framebuffer virtual address */ @@ -336,7 +340,15 @@ typedef struct sDrvUtil_Video_BufInfo /** * \brief Bit depth of the framebuffer */ - int Depth; + short Depth; + /* + * \} + */ + + /** + * \brief Buffer write format + */ + short BufferFormat; /** * \name Software cursor controls @@ -355,14 +367,14 @@ typedef struct sDrvUtil_Video_BufInfo * \brief Cursor bitmap */ tVideo_IOCtl_Bitmap *CursorBitmap; + /* + * \} + */ /** * \brief Buffer to store the area under the cursor */ void *CursorSaveBuf; - /* - * \} - */ } tDrvUtil_Video_BufInfo; /** @@ -412,7 +424,6 @@ extern int DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, /** * \brief Perform write operations to a LFB - * \param Mode Buffer mode (see eTplVideo_BufFormats) * \param FBInfo Framebuffer descriptor, see type for details * \param Offset Offset provided by VFS call * \param Length Length provided by VFS call @@ -422,7 +433,7 @@ extern int DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, * Handles all write modes in software, using the VT font calls for rendering. * \note Calls the cursor clear and redraw if the cursor area is touched */ -extern int DrvUtil_Video_WriteLFB(int Mode, tDrvUtil_Video_BufInfo *FBInfo, size_t Offset, size_t Length, void *Src); +extern int DrvUtil_Video_WriteLFB(tDrvUtil_Video_BufInfo *FBInfo, size_t Offset, size_t Length, void *Src); /** * \name Software cursor rendering diff --git a/Modules/Display/BochsGA/bochsvbe.c b/Modules/Display/BochsGA/bochsvbe.c index 05d80ed8..d9aada91 100644 --- a/Modules/Display/BochsGA/bochsvbe.c +++ b/Modules/Display/BochsGA/bochsvbe.c @@ -78,7 +78,6 @@ tDevFS_Driver gBGA_DriverStruct = { } }; int giBGA_CurrentMode = -1; - int giBGA_BufferFormat = 0; tVideo_IOCtl_Pos gBGA_CursorPos = {-1,-1}; Uint *gBGA_Framebuffer; const tBGA_Mode *gpBGA_CurrentMode; @@ -120,7 +119,6 @@ int BGA_Install(char **Arguments) // Map Framebuffer to hardware address gBGA_Framebuffer = (void *) MM_MapHWPages(base, 768); // 768 pages (3Mb) - MM_DumpTables(0, -1); // Install Device if( DevFS_AddDevice( &gBGA_DriverStruct ) == -1 ) @@ -165,7 +163,7 @@ Uint64 BGA_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) Uint64 BGA_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) { if( giBGA_CurrentMode == -1 ) BGA_int_UpdateMode(0); - return DrvUtil_Video_WriteLFB(giBGA_BufferFormat, &gBGA_DrvUtil_BufInfo, Offset, Length, Buffer); + return DrvUtil_Video_WriteLFB(&gBGA_DrvUtil_BufInfo, Offset, Length, Buffer); } const char *csaBGA_IOCtls[] = {DRV_IOCTLNAMES, DRV_VIDEO_IOCTLNAMES, NULL}; @@ -195,9 +193,9 @@ int BGA_IOCtl(tVFS_Node *Node, int ID, void *Data) break; case VIDEO_IOCTL_SETBUFFORMAT: - ret = giBGA_BufferFormat; + ret = gBGA_DrvUtil_BufInfo.BufferFormat; if(Data) - giBGA_BufferFormat = *(int*)Data; + gBGA_DrvUtil_BufInfo.BufferFormat = *(int*)Data; break; case VIDEO_IOCTL_SETCURSOR: