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.
30 #include "libavutil/common.h"
34 VDXDriver
*first_driver
= NULL
;
36 extern VDXDriver cyberblade_drv
;
37 extern VDXDriver ivtv_drv
;
38 extern VDXDriver mach64_drv
;
39 extern VDXDriver mga_drv
;
40 extern VDXDriver mga_crtc2_drv
;
41 extern VDXDriver nvidia_drv
;
42 extern VDXDriver pm2_drv
;
43 extern VDXDriver pm3_drv
;
44 extern VDXDriver radeon_drv
;
45 extern VDXDriver rage128_drv
;
46 extern VDXDriver s3_drv
;
47 extern VDXDriver sh_veu_drv
;
48 extern VDXDriver sis_drv
;
49 extern VDXDriver unichrome_drv
;
51 static void vidix_register_driver (VDXDriver
*drv
)
62 void vidix_register_all_drivers (void)
64 #ifdef CONFIG_VIDIX_DRV_CYBERBLADE
65 vidix_register_driver (&cyberblade_drv
);
67 #ifdef CONFIG_VIDIX_DRV_IVTV
68 vidix_register_driver (&ivtv_drv
);
70 #ifdef CONFIG_VIDIX_DRV_MACH64
71 vidix_register_driver (&mach64_drv
);
73 #ifdef CONFIG_VIDIX_DRV_MGA
74 vidix_register_driver (&mga_drv
);
76 #ifdef CONFIG_VIDIX_DRV_MGA_CRTC2
77 vidix_register_driver (&mga_crtc2_drv
);
79 #ifdef CONFIG_VIDIX_DRV_NVIDIA
80 vidix_register_driver (&nvidia_drv
);
82 #ifdef CONFIG_VIDIX_DRV_PM2
83 vidix_register_driver (&pm2_drv
);
85 #ifdef CONFIG_VIDIX_DRV_PM3
86 vidix_register_driver (&pm3_drv
);
88 #ifdef CONFIG_VIDIX_DRV_RADEON
89 vidix_register_driver (&radeon_drv
);
91 #ifdef CONFIG_VIDIX_DRV_RAGE128
92 vidix_register_driver (&rage128_drv
);
94 #ifdef CONFIG_VIDIX_DRV_S3
95 vidix_register_driver (&s3_drv
);
97 #ifdef CONFIG_VIDIX_DRV_SH_VEU
98 vidix_register_driver (&sh_veu_drv
);
100 #ifdef CONFIG_VIDIX_DRV_SIS
101 vidix_register_driver (&sis_drv
);
103 #ifdef CONFIG_VIDIX_DRV_UNICHROME
104 vidix_register_driver (&unichrome_drv
);
108 static int vidix_probe_driver (VDXContext
*ctx
, VDXDriver
*drv
,
109 unsigned int cap
, int verbose
)
111 vidix_capability_t vid_cap
;
114 printf ("vidixlib: PROBING: %s\n", drv
->name
);
116 if (!drv
->probe
|| drv
->probe (verbose
, PROBE_NORMAL
) != 0)
119 if (!drv
->get_caps
|| drv
->get_caps (&vid_cap
) != 0)
122 if ((vid_cap
.type
& cap
) != cap
)
125 printf ("vidixlib: Found %s but has no required capability\n",
131 printf ("vidixlib: %s probed o'k\n", drv
->name
);
137 static void vidix_list_drivers (void)
141 printf ("Available VIDIX drivers:\n");
146 vidix_capability_t cap
;
147 drv
->get_caps (&cap
);
148 printf (" * %s - %s\n", drv
->name
, cap
.name
);
153 int vidix_find_driver (VDXContext
*ctx
, const char *name
,
154 unsigned int cap
, int verbose
)
158 if (name
&& !strcmp (name
, "help"))
160 vidix_list_drivers ();
168 if (name
) /* forced driver */
170 if (!strcmp (drv
->name
, name
))
172 if (vidix_probe_driver (ctx
, drv
, cap
, verbose
))
181 else /* auto-probe */
183 if (vidix_probe_driver (ctx
, drv
, cap
, verbose
))
190 printf ("vidixlib: No suitable driver can be found.\n");