changeset 4191:62a6135d090e

+ new features and possibility deinterlacing oem effects ITU color space forcing driver - audio support (develop and introduce AUDIX for that)
author nick
date Wed, 16 Jan 2002 08:33:17 +0000
parents 2ed90891750e
children fb092b45c9cc
files vidix/README vidix/drivers/genfb_vid.c vidix/drivers/mga_vid.c vidix/drivers/nvidia_vid.c vidix/drivers/radeon_vid.c vidix/vidix.h vidix/vidixlib.c vidix/vidixlib.h
diffstat 8 files changed, 152 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/vidix/README	Wed Jan 16 03:39:37 2002 +0000
+++ b/vidix/README	Wed Jan 16 08:33:17 2002 +0000
@@ -3,3 +3,5 @@
 This library was designed and introduced as interface to userspace drivers
 to provide DGA everywhere where it's possible (unline X11).
 I hope that these drivers will be portable same as X11 (not only on *nix).
+
+For detail on how to develop new driver see main/DOCS/tech/vidix.txt
--- a/vidix/drivers/genfb_vid.c	Wed Jan 16 03:39:37 2002 +0000
+++ b/vidix/drivers/genfb_vid.c	Wed Jan 16 08:33:17 2002 +0000
@@ -11,6 +11,8 @@
 #include "../../libdha/libdha.h"
 #include "../../libdha/pci_ids.h"
 
+#define DEMO_DRIVER 1
+
 static int fd;
 
 static void *mmio_base = 0;
@@ -26,10 +28,7 @@
 {
     "General Framebuffer",
     TYPE_OUTPUT,
-    0,
-    1,
-    0,
-    0,
+    { 0, 0, 0, 0 },
     1024,
     768,
     4,
@@ -46,9 +45,12 @@
     return(VIDIX_VERSION);
 }
 
-int vixProbe(int verbose)
+int vixProbe(int verbose,int force)
 {
     int err = 0;
+#ifdef DEMO_DRIVER
+    err = ENOSYS;
+#endif
     
     printf("[genfb] probe\n");
 
--- a/vidix/drivers/mga_vid.c	Wed Jan 16 03:39:37 2002 +0000
+++ b/vidix/drivers/mga_vid.c	Wed Jan 16 08:33:17 2002 +0000
@@ -219,10 +219,7 @@
 {
     "Matrox MGA G200/G400 YUV Video",
     TYPE_OUTPUT,
-    0,
-    1,
-    0,
-    0,
+    { 0, 0, 0, 0 },
     1024,
     768,
     4,
@@ -1636,7 +1633,7 @@
 	return 0;
 }
 
-int vixProbe(int verbose)
+int vixProbe(int verbose,int force)
 {
 	pciinfo_t lst[MAX_PCI_DEVICES];
 	unsigned int i, num_pci;
--- a/vidix/drivers/nvidia_vid.c	Wed Jan 16 03:39:37 2002 +0000
+++ b/vidix/drivers/nvidia_vid.c	Wed Jan 16 08:33:17 2002 +0000
@@ -24,7 +24,7 @@
 struct nv_card_id_s
 {
     const unsigned int id ;
-    const char name[17];
+    const char name[32];
     const int core;
     const int flags;
 };
@@ -33,7 +33,7 @@
 {
     { DEVICE_NVIDIA_RIVA_TNT2_NV5, "nVidia TNT2 (NV5) ", 5, CARD_FLAGS_NOTSUPPORTED},
     { DEVICE_NVIDIA_VANTA_NV6, "nVidia Vanta (NV6.1)", 6, CARD_FLAGS_NOTSUPPORTED},
-    { DEVICE_NVIDIA_VANTA_NV62, "nVidia Vanta (NV6.2)", 6, CARD_FLAGS_NOTSUPPORTED},
+    { DEVICE_NVIDIA_VANTA_NV62, "nVidia Vanta (NV6.2)", 6, CARD_FLAGS_NOTSUPPORTED}
 };
 
 static int find_chip(unsigned int chip_id)
@@ -55,10 +55,7 @@
 {
     "NVIDIA driver for VIDIX",
     TYPE_OUTPUT,
-    0,
-    1,
-    0,
-    0,
+    { 0, 0, 0, 0 },
     1024,
     768,
     4,
@@ -75,7 +72,7 @@
     return(VIDIX_VERSION);
 }
 
-int vixProbe(int verbose)
+int vixProbe(int verbose,int force)
 {
     pciinfo_t lst[MAX_PCI_DEVICES];
     unsigned int i, num_pci;
--- a/vidix/drivers/radeon_vid.c	Wed Jan 16 03:39:37 2002 +0000
+++ b/vidix/drivers/radeon_vid.c	Wed Jan 16 08:33:17 2002 +0000
@@ -596,10 +596,7 @@
     "BES driver for radeon cards",
 #endif
     TYPE_OUTPUT | TYPE_FX,
-    0,
-    1,
-    0,
-    0,
+    { 0, 0, 0, 0 },
     1024,
     768,
     4,
@@ -612,7 +609,7 @@
 };
 
 
-int vixProbe( int verbose )
+int vixProbe( int verbose,int force )
 {
   pciinfo_t lst[MAX_PCI_DEVICES];
   unsigned i,num_pci;
@@ -632,15 +629,19 @@
       if(lst[i].vendor == VENDOR_ATI)
       {
         int idx;
+	const char *dname;
 	idx = find_chip(lst[i].device);
-	if(idx == -1) continue;
-	printf(RADEON_MSG" Found chip: %s\n",pci_device_name(VENDOR_ATI,ati_card_ids[idx]));
+	if(idx == -1 && force == PROBE_NORMAL) continue;
+	dname = pci_device_name(VENDOR_ATI,lst[i].device);
+	dname = dname ? dname : "Unknown chip";
+	printf(RADEON_MSG" Found chip: %s\n",dname);
 #ifndef RAGE128	
-	if(ati_card_ids[idx] == DEVICE_ATI_RADEON_QL || 
-	   ati_card_ids[idx] == DEVICE_ATI_RADEON_8500_DV || 
-	   ati_card_ids[idx] == DEVICE_ATI_RADEON_QW) IsR200 = 1;
+	if(idx != -1)
+	    if(ati_card_ids[idx] == DEVICE_ATI_RADEON_QL || 
+		ati_card_ids[idx] == DEVICE_ATI_RADEON_8500_DV || 
+		ati_card_ids[idx] == DEVICE_ATI_RADEON_QW) IsR200 = 1;
 #endif
-	def_cap.device_id = ati_card_ids[idx];
+	def_cap.device_id = lst[i].device;
 	err = 0;
 	memcpy(&pci_info,&lst[i],sizeof(pciinfo_t));
 	probed=1;
@@ -1049,7 +1050,7 @@
     return 0;
 }
 
-vidix_video_eq_t equal = { 0, 0, 0, 0, 0, 0, 0 };
+vidix_video_eq_t equal = { 0, 0, 0, 0, 0, 0, 0, 0 };
 
 int 	vixPlaybackGetEq( vidix_video_eq_t * eq)
 {
--- a/vidix/vidix.h	Wed Jan 16 03:39:37 2002 +0000
+++ b/vidix/vidix.h	Wed Jan 16 08:33:17 2002 +0000
@@ -25,8 +25,14 @@
 			/* returns driver version */
 extern unsigned vixGetVersion( void );
 
-			/* Probes video hw. Returns 0 if ok else errno */
-extern int	vixProbe( int verbose );
+#define PROBE_NORMAL	0 /* normal probing */
+#define PROBE_FORCE	1 /* ignore device_id but recognize device if it's known */
+			/* Probes video hw.
+			   verbose - specifies verbose level.
+			   force   - specifies force mode - driver should ignore
+			             device_id (danger but useful for new devices)
+			   Returns 0 if ok else errno */
+extern int	vixProbe( int verbose, int force );
 			/* Initializes driver. Returns 0 if ok else errno */
 extern int	vixInit( void );
 			/* Destroys driver */
@@ -35,15 +41,12 @@
 typedef struct vidix_capability_s
 {
 	char	name[32];	/* Driver name */
-#define TYPE_OUTPUT	0x00000000	/* Is a video capture device */
-#define TYPE_CAPTURE	0x00000001	/* Is a CODEC device */
-#define TYPE_CODEC	0x00000002	/* Is a video output device */
+#define TYPE_OUTPUT	0x00000000	/* Is a video playback device */
+#define TYPE_CAPTURE	0x00000001	/* Is a capture device */
+#define TYPE_CODEC	0x00000002	/* Device supports hw (de)coding */
 #define TYPE_FX		0x00000004	/* Is a video effects device */
 	int	type;		/* Device type, see below */
-	int	inputs;		/* Num video inputs */
-	int	outputs;	/* Num video outputs */
-	int	in_audios;	/* Num audio inputs */
-	int	out_audios;	/* Num audio outputs */
+	unsigned reserved0[4];
 	int	maxwidth;
 	int	maxheight;
 	int	minwidth;
@@ -51,10 +54,11 @@
 	int	maxframerate;   /* -1 if unlimited */
 #define FLAG_NONE		0x00000000 /* No flags defined */
 #define FLAG_DMA		0x00000001 /* Card can use DMA */
+#define FLAG_EQ_DMA		0x00000002 /* Card can use DMA only if src pitch == dest pitch */
 #define FLAG_UPSCALER		0x00000010 /* Card supports hw upscaling */
 #define FLAG_DOWNSCALER		0x00000020 /* Card supports hw downscaling */
 #define FLAG_SUBPIC		0x00001000 /* Card supports DVD subpictures */
-	unsigned flags;		/* Feature flags, see below */
+	unsigned flags;		/* Feature flags, see above */
 	unsigned short vendor_id;
 	unsigned short device_id;
 	unsigned reserved[4];
@@ -139,7 +143,7 @@
 	vidix_rect_t	dest;           /* app -> driver: destinition movie size. driver->app dest_pitch */
 	/* memory model */
 	unsigned	frame_size;		/* driver -> app; destinition frame size */
-	unsigned	num_frames;		/* app -> driver; after call: driver -> app */
+	unsigned	num_frames;		/* app -> driver: after call: driver -> app */
 #define LVO_MAXFRAMES 32
 	unsigned	offsets[LVO_MAXFRAMES];	/* driver -> app */
 	vidix_yuv_t	offset;			/* driver -> app: relative offsets within frame for yuv planes */
@@ -186,6 +190,10 @@
 	int		red_intense;	/* -1000 : +1000 */
 	int		green_intense;  /* -1000 : +1000 */
 	int		blue_intense;   /* -1000 : +1000 */
+#define VEQ_FLG_ITU_R_BT_601	0x00000000 /* ITU-R BT.601 colour space (default) */
+#define VEQ_FLG_ITU_R_BT_709	0x00000001 /* ITU-R BT.709 colour space */
+#define VEQ_FLG_ITU_MASK	0x0000000f
+	int		flags;		/* currently specifies ITU YCrCb color space to use */
 }vidix_video_eq_t;
 
 			/* Returns 0 if ok else errno */
@@ -194,6 +202,24 @@
 			/* Returns 0 if ok else errno */
 extern int 	vixPlaybackSetEq( const vidix_video_eq_t * );
 
+typedef struct vidix_deinterlace_s
+{
+#define CFG_NON_INTERLACED		0x00000000 /* stream is not interlaced */
+#define CFG_INTERLACED			0x00000001 /* stream is interlaced */
+#define CFG_EVEN_ODD_INTERLACING	0x00000002 /* first frame contains even fields but second - odd */
+#define CFG_ODD_EVEN_INTERLACING	0x00000004 /* first frame contains odd fields but second - even */
+#define CFG_UNIQUE_INTERLACING		0x00000008 /* field deinterlace_pattern is valid */
+#define CFG_UNKNOWN_INTERLACING		0x0000000f /* unknown deinterlacing - use adaptive if it's possible */
+	unsigned	flags;
+	unsigned	deinterlace_pattern;	/* app -> driver: deinterlace pattern if flag CFG_UNIQUE_INTERLACING is set */
+}vidix_deinterlace_t;
+
+			/* Returns 0 if ok else errno */
+extern int 	vixPlaybackGetDeint( vidix_deinterlace_t * );
+
+			/* Returns 0 if ok else errno */
+extern int 	vixPlaybackSetDeint( const vidix_deinterlace_t * );
+
 typedef struct vidix_slice_s
 {
 	void*		address;		/* app -> driver */
@@ -213,6 +239,37 @@
 			/* Returns 0 if ok else errno */
 extern int 	vixPlaybackCopyFrame( const vidix_dma_t * );
 
+/*
+   This structure is introdused to support OEM effects like:
+   - sharpness
+   - exposure
+   - (auto)gain
+   - H(V)flip
+   - black level
+   - white balance
+   and many other
+*/
+typedef struct vidix_oem_fx_s
+{
+#define FX_TYPE_BOOLEAN		0x00000000
+#define FX_TYPE_INTEGER		0x00000001
+	int		type;			/* type of effects */
+	int		num;			/* app -> driver: effect number. From 0 to max number of effects */
+	int		minvalue;		/* min value of effect. 0 - for boolean */
+	int		maxvalue;		/* max value of effect. 1 - for boolean */
+	int		value;			/* current value of effect on 'get'; required on set */
+	char *		name[80];		/* effect name to display */
+}vidix_oem_fx_t;
+
+			/* Returns 0 if ok else errno */
+extern int	vixQueryNumOemEffects( unsigned * number );
+
+			/* Returns 0 if ok else errno */
+extern int	vixGetOemEffect( vidix_oem_fx_t * );
+
+			/* Returns 0 if ok else errno */
+extern int	vixSetOemEffect( const vidix_oem_fx_t * );
+
 #ifdef __cplusplus
 }
 #endif
--- a/vidix/vidixlib.c	Wed Jan 16 03:39:37 2002 +0000
+++ b/vidix/vidixlib.c	Wed Jan 16 08:33:17 2002 +0000
@@ -42,9 +42,14 @@
 	int 	(*frame_sel)( unsigned frame_idx );
 	int 	(*get_eq)( vidix_video_eq_t * );
 	int 	(*set_eq)( const vidix_video_eq_t * );
+	int 	(*get_deint)( vidix_deinterlace_t * );
+	int 	(*set_deint)( const vidix_deinterlace_t * );
 	int 	(*copy_frame)( const vidix_dma_t * );
 	int 	(*get_gkey)( vidix_grkey_t * );
 	int 	(*set_gkey)( const vidix_grkey_t * );
+	int 	(*get_num_fx)( unsigned * );
+	int 	(*get_fx)( vidix_oem_fx_t * );
+	int 	(*set_fx)( const vidix_oem_fx_t * );
 }vdl_stream_t;
 
 #define t_vdl(p) (((vdl_stream_t *)p))
@@ -68,13 +73,18 @@
   t_vdl(stream)->set_eq	= dlsym(t_vdl(stream)->handle,"vixPlaybackSetEq");
   t_vdl(stream)->get_gkey	= dlsym(t_vdl(stream)->handle,"vixGetGrKeys");
   t_vdl(stream)->set_gkey	= dlsym(t_vdl(stream)->handle,"vixSetGrKeys");
+  t_vdl(stream)->get_deint	= dlsym(t_vdl(stream)->handle,"vixPlaybackGetDeint");
+  t_vdl(stream)->set_deint	= dlsym(t_vdl(stream)->handle,"vixPlaybackSetDeint");
   t_vdl(stream)->copy_frame	= dlsym(t_vdl(stream)->handle,"vixPlaybackCopyFrame");
+  t_vdl(stream)->get_num_fx	= dlsym(t_vdl(stream)->handle,"vixQueryNumOemEffects");
+  t_vdl(stream)->get_fx		= dlsym(t_vdl(stream)->handle,"vixGetOemEffect");
+  t_vdl(stream)->set_fx		= dlsym(t_vdl(stream)->handle,"vixSetOemEffect");
   /* check driver viability */
   if(!( t_vdl(stream)->get_caps && t_vdl(stream)->query_fourcc &&
 	t_vdl(stream)->config_playback && t_vdl(stream)->playback_on &&
 	t_vdl(stream)->playback_off))
   {
-    printf("vidixlib: some features are missed in driver\n");
+    printf("vidixlib: Incomplete driver: some features are missed in it.\n");
     return 0;
   }
   return 1;
@@ -84,7 +94,7 @@
 {
   vidix_capability_t vid_cap;
   unsigned (*_ver)(void);
-  int      (*_probe)(int);
+  int      (*_probe)(int,int);
   int      (*_cap)(vidix_capability_t*);
   strcpy(drv_name,path);
   strcat(drv_name,name);
@@ -114,7 +124,7 @@
     if(verbose) printf("vidixlib: %s has no function definition\n",drv_name);
     goto err;
   }
-  if(_probe) { if((*_probe)(verbose) != 0) goto err; }
+  if(_probe) { if((*_probe)(verbose,PROBE_NORMAL) != 0) goto err; }
   else goto fatal_err;
   if(_cap) { if((*_cap)(&vid_cap) != 0) goto err; }
   else goto fatal_err;
@@ -156,7 +166,7 @@
   if(name)
   {
     unsigned (*ver)(void);
-    int (*probe)(int);
+    int (*probe)(int,int);
     unsigned version = 0;
     strcpy(drv_name,path);
     strcat(drv_name,name);
@@ -175,7 +185,7 @@
       goto err;
     }
     probe = dlsym(t_vdl(stream)->handle,"vixProbe");
-    if(probe) { if((*probe)(verbose)!=0) goto drv_err; }
+    if(probe) { if((*probe)(verbose,PROBE_FORCE)!=0) goto drv_err; }
     else goto drv_err;
     fill:
     if(!vdl_fill_driver(stream)) goto drv_err;
@@ -264,3 +274,28 @@
 {
   return t_vdl(handle)->set_gkey ? t_vdl(handle)->set_gkey(k) : ENOSYS;
 }
+
+int	  vdlPlaybackGetDeint(VDL_HANDLE handle, vidix_deinterlace_t * d)
+{
+  return t_vdl(handle)->get_deint ? t_vdl(handle)->get_deint(d) : ENOSYS;
+}
+
+int 	  vdlPlaybackSetDeint(VDL_HANDLE handle, const vidix_deinterlace_t * d)
+{
+  return t_vdl(handle)->set_deint ? t_vdl(handle)->set_deint(d) : ENOSYS;
+}
+
+int	  vdlQueryNumOemEffects(VDL_HANDLE handle, unsigned * number )
+{
+  return t_vdl(handle)->get_num_fx ? t_vdl(handle)->get_num_fx(number) : ENOSYS;
+}
+
+int	  vdlGetOemEffect(VDL_HANDLE handle, vidix_oem_fx_t * f)
+{
+  return t_vdl(handle)->get_fx ? t_vdl(handle)->get_fx(f) : ENOSYS;
+}
+
+int	  vdlSetOemEffect(VDL_HANDLE handle, const vidix_oem_fx_t * f)
+{
+  return t_vdl(handle)->set_fx ? t_vdl(handle)->set_fx(f) : ENOSYS;
+}
--- a/vidix/vidixlib.h	Wed Jan 16 03:39:37 2002 +0000
+++ b/vidix/vidixlib.h	Wed Jan 16 08:33:17 2002 +0000
@@ -73,6 +73,22 @@
 extern int 	  vdlPlaybackSetEq(VDL_HANDLE, const vidix_video_eq_t * );
 
 			/* Returns 0 if ok else errno */
+extern int	  vdlPlaybackGetDeint(VDL_HANDLE, vidix_deinterlace_t * );
+
+			/* Returns 0 if ok else errno */
+extern int 	  vdlPlaybackSetDeint(VDL_HANDLE, const vidix_deinterlace_t * );
+
+			/* Returns 0 if ok else errno */
+extern int	  vdlQueryNumOemEffects(VDL_HANDLE, unsigned * number );
+
+			/* Returns 0 if ok else errno */
+extern int	  vdlGetOemEffect(VDL_HANDLE, vidix_oem_fx_t * );
+
+			/* Returns 0 if ok else errno */
+extern int	  vdlSetOemEffect(VDL_HANDLE, const vidix_oem_fx_t * );
+
+
+			/* Returns 0 if ok else errno */
 extern int	  vdlPlaybackCopyFrame(VDL_HANDLE, const vidix_dma_t * );
 
 #ifdef __cplusplus