Merge branch 'master' of git://git.ucc.asn.au/tpg/acess2
[tpg/acess2.git] / Kernel / include / api_drv_video.h
index 8419db2..ff9c395 100644 (file)
@@ -4,8 +4,9 @@
  * \note For AcessOS Version 1\r
  * \r
  * Video drivers extend the common driver interface api_drv_common.h\r
- * and must support _at least_ the IOCtl numbers defined in this file\r
- * to be compatable with Acess.\r
+ * and must support the IOCtl numbers defined in this file to be\r
+ * compatable with Acess (drivers may implement more IOCtls above\r
+ * DRV_IOCTL_USERMIN).\r
  * \r
  * \section IOCtls\r
  * As said, a compatable driver must implement these calls correctly,\r
  * framebuffer.\r
  * \r
  * \section Mode Support\r
- * All video drivers must support at least one text mode (Mode #0)\r
- * For each graphics mode the driver exposes, there must be a corresponding\r
- * text mode with the same resolution, this mode will be used when the\r
- * user switches to a text Virtual Terminal while in graphics mode.\r
+ * All video drivers must support text output for every resolution (hardware\r
+ * accelerated or software), and at least the _BLIT and _FILL 2D operations\r
+ * (these may be implemented specifically for text mode).\r
  */\r
 #ifndef _API_DRV_VIDEO_H\r
 #define _API_DRV_VIDEO_H\r
@@ -98,7 +98,11 @@ enum eTplVideo_IOCtl {
         */\r
        VIDEO_IOCTL_SETCURSORBITMAP\r
 };\r
-#define DRV_VIDEO_IOCTLNAMES   "getset_mode", "find+mode", "mode_info", "set_buf_format", "set_cursor", "set_cursor_bitmap"\r
+\r
+/**\r
+ * \brief Symbolic names for Video IOCtls (#4 onwards)\r
+ */\r
+#define DRV_VIDEO_IOCTLNAMES   "getset_mode", "find_mode", "mode_info", "set_buf_format", "set_cursor", "set_cursor_bitmap"\r
 \r
 /**\r
  * \brief Mode Structure used in IOCtl Calls\r
@@ -251,6 +255,10 @@ typedef struct sVT_Char
 extern int     giVT_CharWidth;\r
 //! \brief Defines the height of a rendered character\r
 extern int     giVT_CharHeight;\r
+/**\r
+ * \name Font rendering\r
+ * \{\r
+ */\r
 /**\r
  * \brief Driver helper that renders a character to a buffer\r
  * \param Codepoint    Unicode character to render\r
@@ -291,9 +299,9 @@ extern Uint16       VT_Colour12to15(Uint16 Col12);
  * The final bit of each component is used to fill the lower bits of the output.\r
  */\r
 extern Uint32  VT_Colour12toN(Uint16 Col12, int Depth);\r
-\r
-typedef struct sDrvUtil_Video_BufInfo  tDrvUtil_Video_BufInfo;\r
-typedef struct sDrvUtil_Video_2DHandlers       tDrvUtil_Video_2DHandlers;\r
+/**\r
+ * \}\r
+ */\r
 \r
 /**\r
  * \brief Maximum cursor width for using the DrvUtil software cursor\r
@@ -307,8 +315,12 @@ typedef struct sDrvUtil_Video_2DHandlers   tDrvUtil_Video_2DHandlers;
 /**\r
  * \brief Framebuffer information used by all DrvUtil_Video functions\r
  */\r
-struct sDrvUtil_Video_BufInfo\r
+typedef struct sDrvUtil_Video_BufInfo\r
 {\r
+       /**\r
+        * \name Framebuffer state\r
+        * \{\r
+        */\r
        /**\r
         * \brief Framebuffer virtual address\r
         */\r
@@ -328,10 +340,18 @@ struct sDrvUtil_Video_BufInfo
        /**\r
         * \brief Bit depth of the framebuffer\r
         */\r
-        int    Depth;\r
+       short   Depth;\r
+       /*\r
+        * \}\r
+        */\r
        \r
        /**\r
-        * \brief Software cursor controls\r
+        * \brief Buffer write format\r
+        */\r
+       short   BufferFormat;\r
+       \r
+       /**\r
+        * \name Software cursor controls\r
         * \{\r
         */\r
        /**\r
@@ -347,20 +367,36 @@ struct sDrvUtil_Video_BufInfo
         * \brief Cursor bitmap\r
         */\r
        tVideo_IOCtl_Bitmap     *CursorBitmap;\r
+       /*\r
+        * \}\r
+        */\r
+\r
+       /*\r
+        * \name Internal fields\r
+        * \{\r
+        */\r
 \r
        /**\r
         * \brief Buffer to store the area under the cursor\r
         */\r
        void    *CursorSaveBuf;\r
+       \r
+        int    CursorReadX;    //!< X offset in cursor bitmap corresponding to \a CursorDestX\r
+        int    CursorReadY;    //!< Same as \a CursorReadX but for Y\r
+        int    CursorRenderW;  //!< Width of rendered cursor\r
+        int    CursorRenderH;  //!< Height of rendered cursor\r
+        int    CursorDestX;    //!< X coordinate Destination for rendered cursor\r
+        int    CursorDestY;    //!< Y coordinate destination for rendered cursor\r
+\r
        /*\r
         * \}\r
         */\r
-};\r
+} tDrvUtil_Video_BufInfo;\r
 \r
 /**\r
  * \brief Handlers for eTplVideo_2DCommands\r
  */\r
-struct sDrvUtil_Video_2DHandlers\r
+typedef struct sDrvUtil_Video_2DHandlers\r
 {\r
        /**\r
         * \brief No Operation, Ignored\r
@@ -388,7 +424,7 @@ struct sDrvUtil_Video_2DHandlers
         * \see VIDEO_2DOP_BLIT\r
         */\r
        void    (*Blit)(void *Ent, Uint16 DestX, Uint16 DestY, Uint16 SrcX, Uint16 SrcY, Uint16 W, Uint16 H);\r
-};\r
+} tDrvUtil_Video_2DHandlers;\r
 \r
 /**\r
  * \brief Handle a 2D operation stream for a driver\r
@@ -399,12 +435,11 @@ struct sDrvUtil_Video_2DHandlers
  * \param SizeofHandlers       Size of \a tDrvUtil_Video_2DHandlers according\r
  *        to the driver. Used as version control and error avoidence.\r
  */\r
-extern int     DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length,\r
+extern int     DrvUtil_Video_2DStream(void *Ent, const void *Buffer, int Length,\r
        tDrvUtil_Video_2DHandlers *Handlers, int SizeofHandlers);\r
 \r
 /**\r
  * \brief Perform write operations to a LFB\r
- * \param Mode Buffer mode (see eTplVideo_BufFormats)\r
  * \param FBInfo       Framebuffer descriptor, see type for details\r
  * \param Offset       Offset provided by VFS call\r
  * \param Length       Length provided by VFS call\r
@@ -414,10 +449,10 @@ extern int        DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length,
  * Handles all write modes in software, using the VT font calls for rendering.\r
  * \note Calls the cursor clear and redraw if the cursor area is touched\r
  */\r
-extern int     DrvUtil_Video_WriteLFB(int Mode, tDrvUtil_Video_BufInfo *FBInfo, size_t Offset, size_t Length, void *Src);\r
+extern int     DrvUtil_Video_WriteLFB(tDrvUtil_Video_BufInfo *FBInfo, size_t Offset, size_t Length, const void *Src);\r
 \r
 /**\r
- * \brief Software cursor rendering\r
+ * \name Software cursor rendering\r
  * \{\r
  */\r
 /**\r
@@ -425,7 +460,7 @@ extern int  DrvUtil_Video_WriteLFB(int Mode, tDrvUtil_Video_BufInfo *FBInfo, size
  * \param Buf  Framebuffer descriptor\r
  * \param Bitmap       New cursor bitmap\r
  */\r
-extern void    DrvUtil_Video_SetCursor(tDrvUtil_Video_BufInfo *Buf, tVideo_IOCtl_Bitmap *Bitmap);\r
+extern int     DrvUtil_Video_SetCursor(tDrvUtil_Video_BufInfo *Buf, tVideo_IOCtl_Bitmap *Bitmap);\r
 /**\r
  * \brief Render the cursor at (\a X, \a Y)\r
  * \param Buf  Framebuffer descriptor, see type for details\r
@@ -438,6 +473,11 @@ extern void        DrvUtil_Video_DrawCursor(tDrvUtil_Video_BufInfo *Buf, int X, int Y);
  * \param Buf  Framebuffer descriptor, see type for details\r
  */\r
 extern void    DrvUtil_Video_RemoveCursor(tDrvUtil_Video_BufInfo *Buf);\r
+\r
+/**\r
+ * \brief Text mode cursor image\r
+ */\r
+extern tVideo_IOCtl_Bitmap     gDrvUtil_TextModeCursor;\r
 /**\r
  * \}\r
  */\r

UCC git Repository :: git.ucc.asn.au