2 * VIDIX Drivers Registry Handler.
3 * Copyright (C) 2007 Benjamin Zores <ben@geexbox.org>
5 * This file is part of MPlayer.
7 * MPlayer is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * MPlayer is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #include "libavutil/common.h"
35 VDXDriver
*first_driver
= NULL
;
37 extern VDXDriver cyberblade_drv
;
38 extern VDXDriver ivtv_drv
;
39 extern VDXDriver mach64_drv
;
40 extern VDXDriver mga_drv
;
41 extern VDXDriver mga_crtc2_drv
;
42 extern VDXDriver nvidia_drv
;
43 extern VDXDriver pm2_drv
;
44 extern VDXDriver pm3_drv
;
45 extern VDXDriver radeon_drv
;
46 extern VDXDriver rage128_drv
;
47 extern VDXDriver s3_drv
;
48 extern VDXDriver sh_veu_drv
;
49 extern VDXDriver sis_drv
;
50 extern VDXDriver unichrome_drv
;
52 static void vidix_register_driver (VDXDriver
*drv
)
63 void vidix_register_all_drivers (void)
65 #ifdef CONFIG_VIDIX_DRV_CYBERBLADE
66 vidix_register_driver (&cyberblade_drv
);
68 #ifdef CONFIG_VIDIX_DRV_IVTV
69 vidix_register_driver (&ivtv_drv
);
71 #ifdef CONFIG_VIDIX_DRV_MACH64
72 vidix_register_driver (&mach64_drv
);
74 #ifdef CONFIG_VIDIX_DRV_MGA
75 vidix_register_driver (&mga_drv
);
77 #ifdef CONFIG_VIDIX_DRV_MGA_CRTC2
78 vidix_register_driver (&mga_crtc2_drv
);
80 #ifdef CONFIG_VIDIX_DRV_NVIDIA
81 vidix_register_driver (&nvidia_drv
);
83 #ifdef CONFIG_VIDIX_DRV_PM2
84 vidix_register_driver (&pm2_drv
);
86 #ifdef CONFIG_VIDIX_DRV_PM3
87 vidix_register_driver (&pm3_drv
);
89 #ifdef CONFIG_VIDIX_DRV_RADEON
90 vidix_register_driver (&radeon_drv
);
92 #ifdef CONFIG_VIDIX_DRV_RAGE128
93 vidix_register_driver (&rage128_drv
);
95 #ifdef CONFIG_VIDIX_DRV_S3
96 vidix_register_driver (&s3_drv
);
98 #ifdef CONFIG_VIDIX_DRV_SH_VEU
99 vidix_register_driver (&sh_veu_drv
);
101 #ifdef CONFIG_VIDIX_DRV_SIS
102 vidix_register_driver (&sis_drv
);
104 #ifdef CONFIG_VIDIX_DRV_UNICHROME
105 vidix_register_driver (&unichrome_drv
);
109 static int vidix_probe_driver (VDXContext
*ctx
, VDXDriver
*drv
,
110 unsigned int cap
, int verbose
)
112 vidix_capability_t vid_cap
;
115 printf ("vidixlib: PROBING: %s\n", drv
->name
);
117 if (!drv
->probe
|| drv
->probe (verbose
, PROBE_NORMAL
) != 0)
120 if (!drv
->get_caps
|| drv
->get_caps (&vid_cap
) != 0)
123 if ((vid_cap
.type
& cap
) != cap
)
126 printf ("vidixlib: Found %s but has no required capability\n",
132 printf ("vidixlib: %s probed o'k\n", drv
->name
);
138 static void vidix_list_drivers (void)
142 printf ("Available VIDIX drivers:\n");
147 vidix_capability_t cap
;
148 drv
->get_caps (&cap
);
149 printf (" * %s - %s\n", drv
->name
, cap
.name
);
154 int vidix_find_driver (VDXContext
*ctx
, const char *name
,
155 unsigned int cap
, int verbose
)
159 if (name
&& !strcmp (name
, "help"))
161 vidix_list_drivers ();
169 if (name
) /* forced driver */
171 if (!strcmp (drv
->name
, name
))
173 if (vidix_probe_driver (ctx
, drv
, cap
, verbose
))
182 else /* auto-probe */
184 if (vidix_probe_driver (ctx
, drv
, cap
, verbose
))
191 printf ("vidixlib: No suitable driver can be found.\n");