diff options
author | nick <nick@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-01-16 08:33:17 +0000 |
---|---|---|
committer | nick <nick@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-01-16 08:33:17 +0000 |
commit | 95c92270391e5cbcaccf126e81fadf1cb248e854 (patch) | |
tree | 46e6dca3577387414764a831dce9cc002fc374d8 /vidix | |
parent | b8bbbc2fba4359733f49f8fb910a28b74d4c0edf (diff) | |
download | mpv-95c92270391e5cbcaccf126e81fadf1cb248e854.tar.bz2 mpv-95c92270391e5cbcaccf126e81fadf1cb248e854.tar.xz |
+ new features and possibility
deinterlacing
oem effects
ITU color space
forcing driver
- audio support (develop and introduce AUDIX for that)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4192 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'vidix')
-rw-r--r-- | vidix/README | 2 | ||||
-rw-r--r-- | vidix/drivers/genfb_vid.c | 12 | ||||
-rw-r--r-- | vidix/drivers/mga_vid.c | 7 | ||||
-rw-r--r-- | vidix/drivers/nvidia_vid.c | 11 | ||||
-rw-r--r-- | vidix/drivers/radeon_vid.c | 25 | ||||
-rw-r--r-- | vidix/vidix.h | 79 | ||||
-rw-r--r-- | vidix/vidixlib.c | 45 | ||||
-rw-r--r-- | vidix/vidixlib.h | 16 |
8 files changed, 152 insertions, 45 deletions
diff --git a/vidix/README b/vidix/README index 04e3b9e16f..e46f027321 100644 --- a/vidix/README +++ b/vidix/README @@ -3,3 +3,5 @@ VIDIX - Video Interface for *niX. 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 diff --git a/vidix/drivers/genfb_vid.c b/vidix/drivers/genfb_vid.c index aa26e8be52..9612021238 100644 --- a/vidix/drivers/genfb_vid.c +++ b/vidix/drivers/genfb_vid.c @@ -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 @@ static vidix_capability_t genfb_cap = { "General Framebuffer", TYPE_OUTPUT, - 0, - 1, - 0, - 0, + { 0, 0, 0, 0 }, 1024, 768, 4, @@ -46,9 +45,12 @@ unsigned int vixGetVersion(void) 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"); diff --git a/vidix/drivers/mga_vid.c b/vidix/drivers/mga_vid.c index f071647bdd..f4e02f43b4 100644 --- a/vidix/drivers/mga_vid.c +++ b/vidix/drivers/mga_vid.c @@ -219,10 +219,7 @@ static vidix_capability_t mga_cap = { "Matrox MGA G200/G400 YUV Video", TYPE_OUTPUT, - 0, - 1, - 0, - 0, + { 0, 0, 0, 0 }, 1024, 768, 4, @@ -1636,7 +1633,7 @@ static int mga_vid_release(/*struct inode *inode, struct file *file*/) return 0; } -int vixProbe(int verbose) +int vixProbe(int verbose,int force) { pciinfo_t lst[MAX_PCI_DEVICES]; unsigned int i, num_pci; diff --git a/vidix/drivers/nvidia_vid.c b/vidix/drivers/nvidia_vid.c index 76382fe162..9e4b9d8231 100644 --- a/vidix/drivers/nvidia_vid.c +++ b/vidix/drivers/nvidia_vid.c @@ -24,7 +24,7 @@ static uint32_t ram_size = 0; 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 @@ static const struct nv_card_id_s nv_card_ids[]= { { 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 @@ static vidix_capability_t nvidia_cap = { "NVIDIA driver for VIDIX", TYPE_OUTPUT, - 0, - 1, - 0, - 0, + { 0, 0, 0, 0 }, 1024, 768, 4, @@ -75,7 +72,7 @@ unsigned int vixGetVersion(void) return(VIDIX_VERSION); } -int vixProbe(int verbose) +int vixProbe(int verbose,int force) { pciinfo_t lst[MAX_PCI_DEVICES]; unsigned int i, num_pci; diff --git a/vidix/drivers/radeon_vid.c b/vidix/drivers/radeon_vid.c index d7b1394c9e..d5332c59d1 100644 --- a/vidix/drivers/radeon_vid.c +++ b/vidix/drivers/radeon_vid.c @@ -596,10 +596,7 @@ vidix_capability_t def_cap = "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 @@ vidix_capability_t def_cap = }; -int vixProbe( int verbose ) +int vixProbe( int verbose,int force ) { pciinfo_t lst[MAX_PCI_DEVICES]; unsigned i,num_pci; @@ -632,15 +629,19 @@ int vixProbe( int verbose ) 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 @@ int vixPlaybackFrameSelect(unsigned frame) 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) { diff --git a/vidix/vidix.h b/vidix/vidix.h index 869ec84e84..fe0a8a467f 100644 --- a/vidix/vidix.h +++ b/vidix/vidix.h @@ -25,8 +25,14 @@ extern "C" { /* 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 @@ extern void vixDestroy( void ); 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 @@ typedef struct vidix_capability_s 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 @@ typedef struct vidix_playback_s 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 @@ typedef struct vidix_video_eq_s 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 @@ extern int vixPlaybackGetEq( vidix_video_eq_t * ); /* 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 @@ typedef struct vidix_dma_s /* 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 diff --git a/vidix/vidixlib.c b/vidix/vidixlib.c index 5092921b25..2745d602f7 100644 --- a/vidix/vidixlib.c +++ b/vidix/vidixlib.c @@ -42,9 +42,14 @@ typedef struct vdl_stream_s 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 @@ static int vdl_fill_driver(VDL_HANDLE stream) 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 @@ static int vdl_probe_driver(VDL_HANDLE stream,const char *path,const char *name, { 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 @@ static int vdl_probe_driver(VDL_HANDLE stream,const char *path,const char *name, 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 @@ VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap,int verbose) 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 @@ VDL_HANDLE vdlOpen(const char *path,const char *name,unsigned cap,int verbose) 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 @@ int vdlSetGrKeys(VDL_HANDLE handle, const vidix_grkey_t * k) { 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; +} diff --git a/vidix/vidixlib.h b/vidix/vidixlib.h index 84dc3efd26..e1585669d9 100644 --- a/vidix/vidixlib.h +++ b/vidix/vidixlib.h @@ -73,6 +73,22 @@ extern int vdlPlaybackGetEq(VDL_HANDLE, vidix_video_eq_t * ); 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 |