[Mplayer-advusers] Preliminary version of Linux video overlay driver interface

Nick Kurshev nickols_k at mail.ru
Fri Dec 21 11:21:43 CET 2001


Hello!

I've done preliminary version of possible candidate for subj.

Against of current mga_vid this standard doesn't limited driver by PITCHes.
Also it have support of DMA and video equalizer.

What it's lose:
OSD support
DVD's subpicture support (is it really need?)
MPEG1-4 and DVD decoding

Any questions, suggestions, feedbacks, critiques, extensions, new features are gladly accepted.

I guess - if we will have troubles with linux-kernel extensions for multimedia then let mplayer has
own drivers. (simply because it already has support for most advanced chips except NVidia and S4Savage
that's not big problem in my opinion ;)

Best regards! Nick

/*
 *
 * lvo.h
 *
 * Copyright (C) 2001 Nick Kurshev & mplayer's team
 * 
 * Linux Video Overlay driver interface v1
 * (Flexible and expandable)
 * 
 * This file is introduced to describe universal interface to 
 * MPEG decoder, BES == Back End Scaler and YUV2RGB hw accelerators.
 * 
 * This software has been released under the terms of the GNU Public
 * license. See http://www.gnu.org/copyleft/gpl.html for details.
 *
 * This stuff is based on mga_vid.h and fbvid.h (from linuxconsole project)
 * TODO:
 *     implementation of MPEG-1,2,4 hw support
 *                (include DVD microcode and so on from mga_dvd.h ???)
 *     OSD and DVD subpicture support
 */

#ifndef __LINUX_VIDEO_OVERLAY_H
#define __LINUX_VIDEO_OVERLAY_H

#include <linux/types.h>
#include <linux/stddef.h>

#define LVO_VERSION   100
#define LVO_VERSION_C "LVO_100" /* simply for printing */

typedef struct lvo_init_s
{
   __u32	version;	/* app -> driver LVO_VERSION */
   char		char_ver[8];	/* driver -> app LVO_VERSION_C */
   __u32	ram_size;	/* driver -> app. video memory size in bytes */
#define LVOC_NONE		0x00000000 /* No flags defined */
#define LVOC_DMA		0x00000001 /* Card can use DMA */
#define LVOC_SCALER		0x00000010 /* Card supports hw scaling */
#define LVOC_YUV2RGB		0x00000020 /* Card supports hw yuv to rgb convertion */
#define LVOC_IDCT		0x00000040 /* Card supports IDCT */
#define LVOC_MC			0x00000080 /* Card supports MC */
#define LVOC_SUBPIC		0x00001000 /* Card supports DVD subpictures */
   __u32	capability;	/* driver -> app. LVOC_* flags */
   __u16	vendor_id;	/* driver -> app. */
   __u16	device_id;	/* driver -> app. */
}lvo_init_t;

typedef struct lvo_rect_s
{
   __u32	x;
   __u32	y;
   __u32	w;
   __u32	h;
   __u32	pitch;		/* bytes per line */
}lvo_rect_t;

typedef struct lvo_fourcc_s
{
   __u32	fourcc;		/* fourcc id */
#define LVO_DEPTH_NONE		0x0000
#define LVO_DEPTH_1BPP		0x0001
#define LVO_DEPTH_2BPP		0x0002
#define LVO_DEPTH_4BPP		0x0004
#define LVO_DEPTH_8BPP		0x0008
#define LVO_DEPTH_12BPP		0x0010
#define LVO_DEPTH_15BPP		0x0020
#define LVO_DEPTH_16BPP		0x0040
#define LVO_DEPTH_24BPP		0x0080
#define LVO_DEPTH_32BPP		0x0100
   __u32	depth;		/* list of available depth for this fourcc */
#define LVO_CAP_NONE			0x0000
#define LVO_CAP_EXPAND			0x0001 /* if overlay can be bigger than source */
#define LVO_CAP_SHRINK			0x0002 /* if overlay can be smaller than source */
#define LVO_CAP_BLEND			0x0004 /* if overlay can be blended with framebuffer */
#define LVO_CAP_COLORKEY		0x0008 /* if overlay can be restricted to a colorkey */
#define LVO_CAP_ALPHAKEY		0x0010 /* if overlay can be restricted to an alpha channel */
#define LVO_CAP_COLORKEY_ISRANGE	0x0020 /* if the colorkey can be a range */
#define LVO_CAP_ALPHAKEY_ISRANGE	0x0040 /* if the alphakey can be a range */
#define LVO_CAP_COLORKEY_ISMAIN		0x0080 /* colorkey is checked against framebuffer */
#define LVO_CAP_COLORKEY_ISOVERLAY	0x0100 /* colorkey is checked against overlay */
#define LVO_CAP_ALPHAKEY_ISMAIN		0x0200 /* alphakey is checked against framebuffer */
#define LVO_CAP_ALPHAKEY_ISOVERLAY	0x0400 /* alphakey is checked against overlay */
   __u32	cap;		/* capability */
}lvo_fourcc_t;

typedef struct lvo_color_key_s
{
#define CKEY_FALSE	0
#define CKEY_TRUE	1
#define CKEY_EQ		2
#define CKEY_NEQ	3
   __u32	op;
   __u8		red;
   __u8		green;
   __u8		blue;
   __u8		reserved;
}lvo_ckey_t;

typedef struct lvo_video_key_s
{
#define VKEY_FALSE	0
#define VKEY_TRUE	1
#define VKEY_EQ		2
#define VKEY_NEQ	3
   __u32	op;
   __u8		key[8];
}lvo_vkey_t;

typedef struct lvo_config_s
{
   __u32	fourcc;		/* app -> driver: movies's fourcc */
   __u32	capability;	/* app -> driver: what capability to use */
   __u32	blend_factor;	/* app -> driver: blenfing factor */
   lvo_rect_t	src;            /* app -> driver: original movie size */
   lvo_rect_t	dest;           /* app -> driver: destinition movie size. driver->app dest_pitch */
   lvo_ckey_t	ckey;		/* app -> driver: color key */
   lvo_vkey_t	vkey;		/* app -> driver: video key */
#define KEYS_PUT	0
#define KEYS_AND	1
#define KEYS_OR		2
#define KEYS_XOR	3
   __u32	key_op;		/* app -> driver: keys operations */
   __u8		reserved[1024]; /* !!! for further usage !!! */
}lvo_config_t;

typedef struct lvo_video_eq_s
{
/* end-user app can haev presets like: cold-normal-hot picture and so on */
   int		brightness;	/* -1000 : +1000 */
   int		contrast;	/* -1000 : +1000 */
   int		saturation;	/* -1000 : +1000 */
   int		hue;		/* -1000 : +1000. Like negative or positive */
   int		red_intense;	/* -1000 : +1000 */
   int		green_intense;  /* -1000 : +1000 */
   int		blue_intense;   /* -1000 : +1000 */
}lvo_video_eq_t;

typedef struct lvo_video_map_s
{
   __u32	frame_size;		/* app -> driver */
   __u32	num_frames;		/* app -> driver; after call: driver -> app */
#define LVO_MAXFRAMES 32
   __u32	offsets[LVO_MAXFRAMES];	/* driver -> app */
   void*	base_addr;		/* driver -> app: userlevel linear address */
}lvo_vmap_t;

typedef struct lvo_slice_s
{
   void*	address;		/* app -> driver */
   __u32	size;			/* app -> driver */
   lvo_rect_t	slice;			/* app -> driver */
}lvo_slice_t;

typedef struct lvo_dma_s
{
   lvo_slice_t	src;                    /* app -> driver */
   lvo_slice_t	dest;			/* app -> driver */
#define LVO_DMA_NOSYNC		0
#define LVO_DMA_SYNC		1       /* means: wait vsync or hsync */
   __u32	flags;			/* app -> driver */
}lvo_dma_t;

#define IMGFMT_RGB_MASK 0xFFFFFF00
#define IMGFMT_RGB (('R'<<24)|('G'<<16)|('B'<<8))
#define IMGFMT_RGB8  (IMGFMT_RGB|8)
#define IMGFMT_RGB15 (IMGFMT_RGB|15)
#define IMGFMT_RGB16 (IMGFMT_RGB|16)
#define IMGFMT_RGB24 (IMGFMT_RGB|24)
#define IMGFMT_RGB32 (IMGFMT_RGB|32)

#define IMGFMT_BGR_MASK 0xFFFFFF00
#define IMGFMT_BGR (('B'<<24)|('G'<<16)|('R'<<8))
#define IMGFMT_BGR8 (IMGFMT_BGR|8)
#define IMGFMT_BGR15 (IMGFMT_BGR|15)
#define IMGFMT_BGR16 (IMGFMT_BGR|16)
#define IMGFMT_BGR24 (IMGFMT_BGR|24)
#define IMGFMT_BGR32 (IMGFMT_BGR|32)

#define IMGFMT_IS_RGB(fmt) ((fmt&IMGFMT_RGB_MASK)==IMGFMT_RGB)
#define IMGFMT_IS_BGR(fmt) ((fmt&IMGFMT_BGR_MASK)==IMGFMT_BGR)

#define IMGFMT_RGB_DEPTH(fmt) (fmt&~IMGFMT_RGB)
#define IMGFMT_BGR_DEPTH(fmt) (fmt&~IMGFMT_BGR)


/* Planar YUV Formats */

#define IMGFMT_YVU9 0x39555659
#define IMGFMT_IF09 0x39304649
#define IMGFMT_YV12 0x32315659
#define IMGFMT_I420 0x30323449
#define IMGFMT_IYUV 0x56555949
#define IMGFMT_CLPL 0x4C504C43
#define IMGFMT_Y800 0x30303859
#define IMGFMT_Y8   0x20203859

/* Packed YUV Formats */

#define IMGFMT_IUYV 0x56595549
#define IMGFMT_IY41 0x31435949
#define IMGFMT_IYU1 0x31555949
#define IMGFMT_IYU2 0x32555949
#define IMGFMT_UYVY 0x59565955
#define IMGFMT_UYNV 0x564E5955
#define IMGFMT_cyuv 0x76757963
#define IMGFMT_Y422 0x32323459
#define IMGFMT_YUY2 0x32595559
#define IMGFMT_YUNV 0x564E5559
#define IMGFMT_YVYU 0x55595659
#define IMGFMT_Y41P 0x50313459
#define IMGFMT_Y211 0x31313259
#define IMGFMT_Y41T 0x54313459
#define IMGFMT_Y42T 0x54323459
#define IMGFMT_V422 0x32323456
#define IMGFMT_V655 0x35353656
#define IMGFMT_CLJR 0x524A4C43
#define IMGFMT_YUVP 0x50565559
#define IMGFMT_UYVP 0x50565955

#if 0
/* --- Just obsolete stuff! --- */
#define MGA_VID_CONFIG    _IOR('J', 1, mga_vid_config_t)
#define MGA_VID_ON        _IO ('J', 2)
#define MGA_VID_OFF       _IO ('J', 3)
#define MGA_VID_FSEL	  _IOR('J', 4, int)
/* --- End of obsolete stuff! --- */
#endif

#define IOCTL_LVO_INIT		_IOWR('V',1,lvo_init_t)
#define IOCTL_LVO_QUERY_FOURCC	_IOWR('V',2,lvo_fourcc_t)
#define IOCTL_LVO_CONFIG	_IOWR('V',3,lvo_config_t)
#define IOCTL_LVO_VMAP		_IOWR('V',4,lvo_vmap_t)
#define IOCTL_LVO_ON		_IO  ('V',5)
#define IOCTL_LVO_OFF		_IO  ('V',6)
#define IOCTL_LVO_FRAMESEL	_IOW ('V',7, __u32)
#define IOCTL_LVO_COPY_SLICE	_IOW ('V',8,lvo_dma_t)
#define IOCTL_LVO_VIDEO_EQ_GET	_IOR ('V',9,lvo_video_eq_t)	
#define IOCTL_LVO_VIDEO_EQ_SET	_IOW ('V',10,lvo_video_eq_t)	

#endif



More information about the MPlayer-advusers mailing list