X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Finclude%2Fapi_drv_video.h;h=f2d1a2d1f9b220d9d08e7ba2ffd452bd4e66e873;hb=f0ffa8c904a7a99e115e926b4bf59d9749e86334;hp=a4eb46c0a60eff3b0eb7f787d7466ae0698fe791;hpb=e6795eb552a6be88b7870dae14a958ab391bfae8;p=tpg%2Facess2.git diff --git a/Kernel/include/api_drv_video.h b/Kernel/include/api_drv_video.h index a4eb46c0..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 @@ -51,8 +51,8 @@ enum eTplVideo_IOCtl { * \return 1 if a mode was found, 0 otherwise * * Using avaliable modes matching the \a bpp and \a flags fields - * set the \a id field to the mode id of the mode with the closest - * \a width and \a height. + * set the \a id, \a width and \a heights fields to the closest + * matching mode. */ VIDEO_IOCTL_FINDMODE, @@ -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 @@ -111,8 +115,8 @@ typedef struct sVideo_IOCtl_Mode short id; //!< Mode ID Uint16 width; //!< Width Uint16 height; //!< Height - Uint8 bpp; //!< Bits per Unit (Character or Pixel, depending on \a flags) - Uint8 flags; //!< Mode Flags + Uint8 bpp; //!< Bits per pixel + Uint8 flags; //!< Mode Flags (none defined, should be zero) } tVideo_IOCtl_Mode; /** @@ -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,6 +299,99 @@ 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); +/** + * \} + */ + +/** + * \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 + */ +typedef struct sDrvUtil_Video_BufInfo +{ + /** + * \name Framebuffer state + * \{ + */ + /** + * \brief Framebuffer virtual address + */ + void *Framebuffer; + /** + * \brief Bytes between the start of each line + */ + int Pitch; + /** + * \brief Number of pixels in each line + */ + short Width; + /** + * \brief Total number of lines + */ + short Height; + /** + * \brief Bit depth of the framebuffer + */ + 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 @@ -323,7 +424,7 @@ typedef 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; +} tDrvUtil_Video_2DHandlers; /** * \brief Handle a 2D operation stream for a driver @@ -334,7 +435,50 @@ typedef struct sDrvUtil_Video_2DHandlers * \param SizeofHandlers Size of \a tDrvUtil_Video_2DHandlers according * to the driver. Used as version control and error avoidence. */ -extern Uint64 DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, +extern int DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, tDrvUtil_Video_2DHandlers *Handlers, int SizeofHandlers); +/** + * \brief Perform write operations to a LFB + * \param FBInfo Framebuffer descriptor, see type for details + * \param Offset Offset provided by VFS call + * \param Length Length provided by VFS call + * \param Src Data from VFS call + * \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; +/** + * \} + */ #endif