include/tpl_drv_video.h File Reference


Detailed Description

Video Driver Interface Definitions.

Note:
For AcessOS Version 1

Video drivers extend the common driver interface tpl_drv_common.h and must support _at least_ the IOCtl numbers defined in this file to be compatable with Acess.

IOCtls

As said, a compatable driver must implement these calls correctly, but they may choose not to allow direct user access to the framebuffer.

Contents

Writes to the driver's file while in component colour modes must correspond to a change of the contents of the screen. The framebuffer must start at offset 0 in the file. Reading from the screen must either return zero, or read from the framebuffer.

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.

Go to the source code of this file.

Data Structures

struct  tVideo_IOCtl_Mode
 Mode Structure used in IOCtl Calls. More...
struct  tVideo_IOCtl_Pos
 Describes a position in the video framebuffer. More...
struct  tVT_Char
 Virtual Terminal Representation of a character. More...
struct  tDrvUtil_Video_2DHandlers
 Handlers for eTplVideo_2DCommands. More...

Defines

#define DRV_VIDEO_IOCTLNAMES   "getset_mode", "find+mode", "mode_info", "set_buf_format", "set_cursor", "request_framebuffer"
Basic builtin colour definitions

#define VT_COL_BLACK   0x0000
#define VT_COL_GREY   0x0888
#define VT_COL_LTGREY   0x0CCC
#define VT_COL_WHITE   0x0FFF

Enumerations

enum  eTplVideo_IOCtl {
  VIDEO_IOCTL_GETSETMODE = 4, VIDEO_IOCTL_FINDMODE, VIDEO_IOCTL_MODEINFO, VIDEO_IOCTL_SETBUFFORMAT,
  VIDEO_IOCTL_SETCURSOR, VIDEO_IOCTL_REQLFB
}
 

Common Video IOCtl Calls.

More...
enum  eTplVideo_BufFormats { VIDEO_BUFFMT_TEXT, VIDEO_BUFFMT_FRAMEBUFFER, VIDEO_BUFFMT_2DSTREAM, VIDEO_BUFFMT_3DSTREAM }
 

Buffer Format Codes.

More...
enum  eTplVideo_2DCommands {
  VIDEO_2DOP_NOP, VIDEO_2DOP_FILL, VIDEO_2DOP_BLIT, VIDEO_2DOP_BLITBUF,
  VIDEO_2DOP_BLITSCALEBUF, NUM_VIDEO_2DOPS
}
 

2D Accellerated Video Commands

More...

Functions

void VT_Font_Render (Uint32 Codepoint, void *Buffer, int Pitch, Uint32 BGC, Uint32 FGC)
 Driver helper that renders a character to a buffer.
Uint32 VT_Colour12to24 (Uint16 Col12)
 Converts a colour from 12bpp to 32bpp.
Uint64 DrvUtil_Video_2DStream (void *Ent, void *Buffer, int Length, tDrvUtil_Video_2DHandlers *Handlers, int SizeofHandlers)
 Handle a 2D operation stream for a driver.

Variables

int giVT_CharWidth
 Defines the width of a rendered character.
int giVT_CharHeight
 Defines the height of a rendered character.

Enumeration Type Documentation

2D Accellerated Video Commands

Commands passed in the command stream for VIDEO_BUFFMT_2DSTREAM

Enumerator:
VIDEO_2DOP_NOP 

No Operation.

VIDEO_2DOP_FILL 

Fill a region.

Parameters:
X Uint16 - Leftmost pixels of the region
Y Uint16 - Topmost pixels of the region
W Uint16 - Width of the region
H Uint16 - Height of the region
Colour Uint32 - Value to fill with
VIDEO_2DOP_BLIT 

Copy a region from one part of the framebuffer to another.

Parameters:
DestX Uint16 - Leftmost pixels of the destination
DestY Uint16 - Topmost pixels of the destination
SrcX Uint16 - Leftmost pixels of the source
SrcY Uint16 - Topmost pixels of the source
Width Uint16 - Width of the region
Height Uint16 - Height of the region
VIDEO_2DOP_BLITBUF 

Copy a region from video memory to the framebuffer.

VIDEO_2DOP_BLITSCALEBUF 

Copy and scale a region from video memory to the framebuffer.

Buffer Format Codes.

Enumerator:
VIDEO_BUFFMT_TEXT 

Text Mode.

The device file presents itself as an array of tVT_Char each describing a character cell on the screen. These cells are each giVT_CharWidth pixels wide and giVT_CharHeight high.

VIDEO_BUFFMT_FRAMEBUFFER 

Framebuffer Mode.

The device file presents as an array of 32-bpp pixels describing the entire screen. The format of a single pixel is in xRGB format (top 8 bits ignored, next 8 bits red, next 8 bits green and the bottom 8 bits blue)

VIDEO_BUFFMT_2DSTREAM 

2D Accelerated Mode

The device file acts as a character device, accepting a stream of commands described in eTplVideo_2DCommands when written to.

VIDEO_BUFFMT_3DSTREAM 

3D Accelerated Mode

The device file acts as a character device, accepting a stream of commands described in eTplVideo_3DCommands when written to.

Common Video IOCtl Calls.

Enumerator:
VIDEO_IOCTL_GETSETMODE 

Get/Set Mode.

ioctl(..., int *mode)

Returns:
Current mode ID or -1 on error

If mode is non-NULL, the current video mode is set to *mode. This updated ID is then returned to the user.

VIDEO_IOCTL_FINDMODE 

Find a matching mode.

ioctl(..., tVideo_IOCtl_Mode *info)

Returns:
1 if a mode was found, 0 otherwise

Using avaliable modes matching the bpp and flags fields set the id field to the mode id of the mode with the closest width and height.

VIDEO_IOCTL_MODEINFO 

Get mode info.

ioctl(..., tVideo_IOCtl_Mode *info)

Returns:
1 if the mode exists, 0 otherwise

Set info's fields to the mode specified by the id field.

VIDEO_IOCTL_SETBUFFORMAT 

Switches between Text, Framebuffer and 3D modes.

ioctl(..., int *NewFormat)

Parameters:
NewFormat Pointer to the new format code (see eTplVideo_BufFormats)
Returns:
Original format

Enabes and disables the video text mode, changing the behavior of writes to the device file.

VIDEO_IOCTL_SETCURSOR 

Sets the cursor position.

ioctl(..., tVideo_IOCtl_Pos *pos)

Returns:
Boolean success

Set the text mode cursor position (if it is supported) If the pos is set to (-1,-1) the cursor is hidden, otherwise pos MUST be within the current screen size (as given by the current mode's tVideo_IOCtl_Mode.width and tVideo_IOCtl_Mode.height fields).

VIDEO_IOCTL_REQLFB 

Request access to Framebuffer.

ioctl(..., tVAddr MapTo)

Returns:
Boolean Success

Requests the driver to allow the user direct access to the framebuffer by mapping it to the supplied address. If the driver does not allow this boolean FALSE (0) is returned, else if the call succeeds (and the framebuffer ends up mapped) boolean TRUE (1) is returned.


Function Documentation

Uint64 DrvUtil_Video_2DStream ( void *  Ent,
void *  Buffer,
int  Length,
tDrvUtil_Video_2DHandlers Handlers,
int  SizeofHandlers 
)

Handle a 2D operation stream for a driver.

Parameters:
Ent Value to pass to handlers
Buffer Stream buffer
Length Length of stream
Handlers Handlers to use for the stream
SizeofHandlers Size of tDrvUtil_Video_2DHandlers according to the driver. Used as version control and error avoidence.
Uint32 VT_Colour12to24 ( Uint16  Col12  ) 

Converts a colour from 12bpp to 32bpp.

Parameters:
Col12 12-bpp input colour
Returns:
Expanded 32-bpp (24-bit colour) version of Col12
void VT_Font_Render ( Uint32  Codepoint,
void *  Buffer,
int  Pitch,
Uint32  BGC,
Uint32  FGC 
)

Driver helper that renders a character to a buffer.

Parameters:
Codepoint Unicode character to render
Buffer Buffer to render to (32-bpp)
Pitch Number of DWords per line
BGC 32-bit Background Colour
FGC 32-bit Foreground Colour

This function is provided to help video drivers to support a simple text mode by keeping the character rendering abstracted from the driver, easing the driver development and reducing code duplication.

Generated on Mon Feb 14 15:21:31 2011 for Acess2 by  doxygen 1.6.3