Skip to content
Snippets Groups Projects
Commit 15442765 authored by John Hodge's avatar John Hodge
Browse files

Kernel/APIs - Moved buffer mode to FBInfo

parent 972dd5ea
No related merge requests found
...@@ -99,12 +99,12 @@ int DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, ...@@ -99,12 +99,12 @@ int DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length,
return 0; 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; Uint8 *dest;
ENTER("iMode pFBInfo xOffset xLength pBuffer", ENTER("pFBInfo xOffset xLength pBuffer",
Mode, FBInfo, Offset, Length, Buffer); Mode, FBInfo, Offset, Length, Buffer);
switch( Mode ) switch( FBInfo->BufferFormat )
{ {
case VIDEO_BUFFMT_TEXT: case VIDEO_BUFFMT_TEXT:
{ {
......
...@@ -75,7 +75,12 @@ enum eTplDrv_IOCtl { ...@@ -75,7 +75,12 @@ enum eTplDrv_IOCtl {
* of this driver's IOCtl calls by taking a string and returning the * of this driver's IOCtl calls by taking a string and returning the
* IOCtl call number associated with that method name. * 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,
}; };
/** /**
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
* \note For AcessOS Version 1 * \note For AcessOS Version 1
* *
* Video drivers extend the common driver interface api_drv_common.h * Video drivers extend the common driver interface api_drv_common.h
* and must support _at least_ the IOCtl numbers defined in this file * and must support the IOCtl numbers defined in this file to be
* to be compatable with Acess. * compatable with Acess (drivers may implement more IOCtls above
* DRV_IOCTL_USERMIN).
* *
* \section IOCtls * \section IOCtls
* As said, a compatable driver must implement these calls correctly, * As said, a compatable driver must implement these calls correctly,
...@@ -19,10 +20,9 @@ ...@@ -19,10 +20,9 @@
* framebuffer. * framebuffer.
* *
* \section Mode Support * \section Mode Support
* All video drivers must support at least one text mode (Mode #0) * All video drivers must support text output for every resolution (hardware
* For each graphics mode the driver exposes, there must be a corresponding * accelerated or software), and at least the _BLIT and _FILL 2D operations
* text mode with the same resolution, this mode will be used when the * (these may be implemented specifically for text mode).
* user switches to a text Virtual Terminal while in graphics mode.
*/ */
#ifndef _API_DRV_VIDEO_H #ifndef _API_DRV_VIDEO_H
#define _API_DRV_VIDEO_H #define _API_DRV_VIDEO_H
...@@ -317,6 +317,10 @@ extern Uint32 VT_Colour12toN(Uint16 Col12, int Depth); ...@@ -317,6 +317,10 @@ extern Uint32 VT_Colour12toN(Uint16 Col12, int Depth);
*/ */
typedef struct sDrvUtil_Video_BufInfo typedef struct sDrvUtil_Video_BufInfo
{ {
/**
* \name Framebuffer state
* \{
*/
/** /**
* \brief Framebuffer virtual address * \brief Framebuffer virtual address
*/ */
...@@ -336,7 +340,15 @@ typedef struct sDrvUtil_Video_BufInfo ...@@ -336,7 +340,15 @@ typedef struct sDrvUtil_Video_BufInfo
/** /**
* \brief Bit depth of the framebuffer * \brief Bit depth of the framebuffer
*/ */
int Depth; short Depth;
/*
* \}
*/
/**
* \brief Buffer write format
*/
short BufferFormat;
/** /**
* \name Software cursor controls * \name Software cursor controls
...@@ -355,14 +367,14 @@ typedef struct sDrvUtil_Video_BufInfo ...@@ -355,14 +367,14 @@ typedef struct sDrvUtil_Video_BufInfo
* \brief Cursor bitmap * \brief Cursor bitmap
*/ */
tVideo_IOCtl_Bitmap *CursorBitmap; tVideo_IOCtl_Bitmap *CursorBitmap;
/*
* \}
*/
/** /**
* \brief Buffer to store the area under the cursor * \brief Buffer to store the area under the cursor
*/ */
void *CursorSaveBuf; void *CursorSaveBuf;
/*
* \}
*/
} tDrvUtil_Video_BufInfo; } tDrvUtil_Video_BufInfo;
/** /**
...@@ -412,7 +424,6 @@ extern int DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, ...@@ -412,7 +424,6 @@ extern int DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length,
/** /**
* \brief Perform write operations to a LFB * \brief Perform write operations to a LFB
* \param Mode Buffer mode (see eTplVideo_BufFormats)
* \param FBInfo Framebuffer descriptor, see type for details * \param FBInfo Framebuffer descriptor, see type for details
* \param Offset Offset provided by VFS call * \param Offset Offset provided by VFS call
* \param Length Length 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, ...@@ -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. * 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 * \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 * \name Software cursor rendering
......
...@@ -78,7 +78,6 @@ tDevFS_Driver gBGA_DriverStruct = { ...@@ -78,7 +78,6 @@ tDevFS_Driver gBGA_DriverStruct = {
} }
}; };
int giBGA_CurrentMode = -1; int giBGA_CurrentMode = -1;
int giBGA_BufferFormat = 0;
tVideo_IOCtl_Pos gBGA_CursorPos = {-1,-1}; tVideo_IOCtl_Pos gBGA_CursorPos = {-1,-1};
Uint *gBGA_Framebuffer; Uint *gBGA_Framebuffer;
const tBGA_Mode *gpBGA_CurrentMode; const tBGA_Mode *gpBGA_CurrentMode;
...@@ -120,7 +119,6 @@ int BGA_Install(char **Arguments) ...@@ -120,7 +119,6 @@ int BGA_Install(char **Arguments)
// Map Framebuffer to hardware address // Map Framebuffer to hardware address
gBGA_Framebuffer = (void *) MM_MapHWPages(base, 768); // 768 pages (3Mb) gBGA_Framebuffer = (void *) MM_MapHWPages(base, 768); // 768 pages (3Mb)
MM_DumpTables(0, -1);
// Install Device // Install Device
if( DevFS_AddDevice( &gBGA_DriverStruct ) == -1 ) if( DevFS_AddDevice( &gBGA_DriverStruct ) == -1 )
...@@ -165,7 +163,7 @@ Uint64 BGA_Read(tVFS_Node *node, Uint64 off, Uint64 len, void *buffer) ...@@ -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) Uint64 BGA_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
{ {
if( giBGA_CurrentMode == -1 ) BGA_int_UpdateMode(0); 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}; const char *csaBGA_IOCtls[] = {DRV_IOCTLNAMES, DRV_VIDEO_IOCTLNAMES, NULL};
...@@ -195,9 +193,9 @@ int BGA_IOCtl(tVFS_Node *Node, int ID, void *Data) ...@@ -195,9 +193,9 @@ int BGA_IOCtl(tVFS_Node *Node, int ID, void *Data)
break; break;
case VIDEO_IOCTL_SETBUFFORMAT: case VIDEO_IOCTL_SETBUFFORMAT:
ret = giBGA_BufferFormat; ret = gBGA_DrvUtil_BufInfo.BufferFormat;
if(Data) if(Data)
giBGA_BufferFormat = *(int*)Data; gBGA_DrvUtil_BufInfo.BufferFormat = *(int*)Data;
break; break;
case VIDEO_IOCTL_SETCURSOR: case VIDEO_IOCTL_SETCURSOR:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment