X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Fapi_drv_video.h;h=f2d1a2d1f9b220d9d08e7ba2ffd452bd4e66e873;hb=f0ffa8c904a7a99e115e926b4bf59d9749e86334;hp=28b98542a7a359eea1baba2f956c7939f553e768;hpb=721e4b481a301692d40f231aa18dd247b6675a92;p=tpg%2Facess2.git diff --git a/Kernel/include/api_drv_video.h b/Kernel/include/api_drv_video.h index 28b98542..f2d1a2d1 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 @@ -98,7 +98,11 @@ enum eTplVideo_IOCtl { */ VIDEO_IOCTL_SETCURSORBITMAP }; -#define DRV_VIDEO_IOCTLNAMES "getset_mode", "find+mode", "mode_info", "set_buf_format", "set_cursor", "set_cursor_bitmap" + +/** + * \brief Symbolic names for Video IOCtls (#4 onwards) + */ +#define DRV_VIDEO_IOCTLNAMES "getset_mode", "find_mode", "mode_info", "set_buf_format", "set_cursor", "set_cursor_bitmap" /** * \brief Mode Structure used in IOCtl Calls @@ -251,6 +255,10 @@ typedef struct sVT_Char extern int giVT_CharWidth; //! \brief Defines the height of a rendered character extern int giVT_CharHeight; +/** + * \name Font rendering + * \{ + */ /** * \brief Driver helper that renders a character to a buffer * \param Codepoint Unicode character to render @@ -291,15 +299,28 @@ extern Uint16 VT_Colour12to15(Uint16 Col12); * The final bit of each component is used to fill the lower bits of the output. */ extern Uint32 VT_Colour12toN(Uint16 Col12, int Depth); +/** + * \} + */ -typedef struct sDrvUtil_Video_BufInfo tDrvUtil_Video_BufInfo; -typedef struct sDrvUtil_Video_2DHandlers tDrvUtil_Video_2DHandlers; +/** + * \brief Maximum cursor width for using the DrvUtil software cursor + */ +#define DRVUTIL_MAX_CURSOR_W 32 +/** + * \brief Maximum cursor width for using the DrvUtil software cursor + */ +#define DRVUTIL_MAX_CURSOR_H 32 /** * \brief Framebuffer information used by all DrvUtil_Video functions */ -struct sDrvUtil_Video_BufInfo +typedef struct sDrvUtil_Video_BufInfo { + /** + * \name Framebuffer state + * \{ + */ /** * \brief Framebuffer virtual address */ @@ -311,21 +332,71 @@ struct sDrvUtil_Video_BufInfo /** * \brief Number of pixels in each line */ - int Width; + short Width; /** * \brief Total number of lines */ - int Height; + short Height; /** * \brief Bit depth of the framebuffer */ - int Depth; -}; + short Depth; + /* + * \} + */ + + /** + * \brief Buffer write format + */ + short BufferFormat; + + /** + * \name Software cursor controls + * \{ + */ + /** + * \brief X coordinate of the cursor + */ + short CursorX; + /** + * \brief Y coordinate of the cursor + */ + short CursorY; + + /** + * \brief Cursor bitmap + */ + tVideo_IOCtl_Bitmap *CursorBitmap; + /* + * \} + */ + + /* + * \name Internal fields + * \{ + */ + + /** + * \brief Buffer to store the area under the cursor + */ + void *CursorSaveBuf; + + int CursorReadX; //!< X offset in cursor bitmap corresponding to \a CursorDestX + int CursorReadY; //!< Same as \a CursorReadX but for Y + int CursorRenderW; //!< Width of rendered cursor + int CursorRenderH; //!< Height of rendered cursor + int CursorDestX; //!< X coordinate Destination for rendered cursor + int CursorDestY; //!< Y coordinate destination for rendered cursor + + /* + * \} + */ +} tDrvUtil_Video_BufInfo; /** * \brief Handlers for eTplVideo_2DCommands */ -struct sDrvUtil_Video_2DHandlers +typedef struct sDrvUtil_Video_2DHandlers { /** * \brief No Operation, Ignored @@ -353,7 +424,7 @@ struct sDrvUtil_Video_2DHandlers * \see VIDEO_2DOP_BLIT */ void (*Blit)(void *Ent, Uint16 DestX, Uint16 DestY, Uint16 SrcX, Uint16 SrcY, Uint16 W, Uint16 H); -}; +} tDrvUtil_Video_2DHandlers; /** * \brief Handle a 2D operation stream for a driver @@ -369,7 +440,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 @@ -377,6 +447,38 @@ extern int DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, * \return Number of bytes written * * 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(tDrvUtil_Video_BufInfo *FBInfo, size_t Offset, size_t Length, void *Src); + +/** + * \name Software cursor rendering + * \{ + */ +/** + * \brief Set the cursor bitmap for a buffer + * \param Buf Framebuffer descriptor + * \param Bitmap New cursor bitmap + */ +extern int DrvUtil_Video_SetCursor(tDrvUtil_Video_BufInfo *Buf, tVideo_IOCtl_Bitmap *Bitmap); +/** + * \brief Render the cursor at (\a X, \a Y) + * \param Buf Framebuffer descriptor, see type for details + * \param X X coord of the cursor + * \param Y Y coord of the cursor + */ +extern void DrvUtil_Video_DrawCursor(tDrvUtil_Video_BufInfo *Buf, int X, int Y); +/** + * \brief Removes the rendered cursor from the screen + * \param Buf Framebuffer descriptor, see type for details + */ +extern void DrvUtil_Video_RemoveCursor(tDrvUtil_Video_BufInfo *Buf); + +/** + * \brief Text mode cursor image + */ +extern tVideo_IOCtl_Bitmap gDrvUtil_TextModeCursor; +/** + * \} */ -extern int DrvUtil_Video_WriteLFB(int Mode, tDrvUtil_Video_BufInfo *FBInfo, size_t Offset, size_t Length, void *Src); #endif