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
18 * along with MPlayer; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 #include "libavutil/common.h"
33 VDXDriver
*first_driver
= NULL
;
35 extern VDXDriver cyberblade_drv
;
36 extern VDXDriver ivtv_drv
;
37 extern VDXDriver mach64_drv
;
38 extern VDXDriver mga_drv
;
39 extern VDXDriver mga_crtc2_drv
;
40 extern VDXDriver nvidia_drv
;
41 extern VDXDriver pm2_drv
;
42 extern VDXDriver pm3_drv
;
43 extern VDXDriver radeon_drv
;
44 extern VDXDriver rage128_drv
;
45 extern VDXDriver savage_drv
;
46 extern VDXDriver sis_drv
;
47 extern VDXDriver unichrome_drv
;
49 static void vidix_register_driver (VDXDriver
*drv
)
60 void vidix_register_all_drivers (void)
62 #ifdef CONFIG_VIDIX_DRV_CYBERBLADE
63 vidix_register_driver (&cyberblade_drv
);
65 #ifdef CONFIG_VIDIX_DRV_IVTV
66 vidix_register_driver (&ivtv_drv
);
68 #ifdef CONFIG_VIDIX_DRV_MACH64
69 vidix_register_driver (&mach64_drv
);
71 #ifdef CONFIG_VIDIX_DRV_MGA
72 vidix_register_driver (&mga_drv
);
74 #ifdef CONFIG_VIDIX_DRV_MGA_CRTC2
75 vidix_register_driver (&mga_crtc2_drv
);
77 #ifdef CONFIG_VIDIX_DRV_NVIDIA
78 vidix_register_driver (&nvidia_drv
);
80 #ifdef CONFIG_VIDIX_DRV_PM2
81 vidix_register_driver (&pm2_drv
);
83 #ifdef CONFIG_VIDIX_DRV_PM3
84 vidix_register_driver (&pm3_drv
);
86 #ifdef CONFIG_VIDIX_DRV_RADEON
87 vidix_register_driver (&radeon_drv
);
89 #ifdef CONFIG_VIDIX_DRV_RAGE128
90 vidix_register_driver (&rage128_drv
);
92 #ifdef CONFIG_VIDIX_DRV_SAVAGE
93 vidix_register_driver (&savage_drv
);
95 #ifdef CONFIG_VIDIX_DRV_SIS
96 vidix_register_driver (&sis_drv
);
98 #ifdef CONFIG_VIDIX_DRV_UNICHROME
99 vidix_register_driver (&unichrome_drv
);
103 static int vidix_probe_driver (VDXContext
*ctx
, VDXDriver
*drv
,
104 unsigned int cap
, int verbose
)
106 vidix_capability_t vid_cap
;
109 printf ("vidixlib: PROBING: %s\n", drv
->name
);
111 if (!drv
->probe
|| drv
->probe (verbose
, PROBE_NORMAL
) != 0)
114 if (!drv
->get_caps
|| drv
->get_caps (&vid_cap
) != 0)
117 if ((vid_cap
.type
& cap
) != cap
)
120 printf ("vidixlib: Found %s but has no required capability\n",
126 printf ("vidixlib: %s probed o'k\n", drv
->name
);
132 static void vidix_list_drivers (void)
136 printf ("Available VIDIX drivers:\n");
141 vidix_capability_t cap
;
142 drv
->get_caps (&cap
);
143 printf (" * %s - %s\n", drv
->name
, cap
.name
);
148 int vidix_find_driver (VDXContext
*ctx
, const char *name
,
149 unsigned int cap
, int verbose
)
153 if (name
&& !strcmp (name
, "help"))
155 vidix_list_drivers ();
163 if (name
) /* forced driver */
165 if (!strcmp (drv
->name
, name
))
167 if (vidix_probe_driver (ctx
, drv
, cap
, verbose
))
176 else /* auto-probe */
178 if (vidix_probe_driver (ctx
, drv
, cap
, verbose
))
185 printf ("vidixlib: No suitable driver can be found.\n");