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.
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 s3_drv
;
46 extern VDXDriver sh_veu_drv
;
47 extern VDXDriver sis_drv
;
48 extern VDXDriver unichrome_drv
;
50 static void vidix_register_driver (VDXDriver
*drv
)
61 void vidix_register_all_drivers (void)
63 #ifdef CONFIG_VIDIX_DRV_CYBERBLADE
64 vidix_register_driver (&cyberblade_drv
);
66 #ifdef CONFIG_VIDIX_DRV_IVTV
67 vidix_register_driver (&ivtv_drv
);
69 #ifdef CONFIG_VIDIX_DRV_MACH64
70 vidix_register_driver (&mach64_drv
);
72 #ifdef CONFIG_VIDIX_DRV_MGA
73 vidix_register_driver (&mga_drv
);
75 #ifdef CONFIG_VIDIX_DRV_MGA_CRTC2
76 vidix_register_driver (&mga_crtc2_drv
);
78 #ifdef CONFIG_VIDIX_DRV_NVIDIA
79 vidix_register_driver (&nvidia_drv
);
81 #ifdef CONFIG_VIDIX_DRV_PM2
82 vidix_register_driver (&pm2_drv
);
84 #ifdef CONFIG_VIDIX_DRV_PM3
85 vidix_register_driver (&pm3_drv
);
87 #ifdef CONFIG_VIDIX_DRV_RADEON
88 vidix_register_driver (&radeon_drv
);
90 #ifdef CONFIG_VIDIX_DRV_RAGE128
91 vidix_register_driver (&rage128_drv
);
93 #ifdef CONFIG_VIDIX_DRV_S3
94 vidix_register_driver (&s3_drv
);
96 #ifdef CONFIG_VIDIX_DRV_SH_VEU
97 vidix_register_driver (&sh_veu_drv
);
99 #ifdef CONFIG_VIDIX_DRV_SIS
100 vidix_register_driver (&sis_drv
);
102 #ifdef CONFIG_VIDIX_DRV_UNICHROME
103 vidix_register_driver (&unichrome_drv
);
107 static int vidix_probe_driver (VDXContext
*ctx
, VDXDriver
*drv
,
108 unsigned int cap
, int verbose
)
110 vidix_capability_t vid_cap
;
113 printf ("vidixlib: PROBING: %s\n", drv
->name
);
115 if (!drv
->probe
|| drv
->probe (verbose
, PROBE_NORMAL
) != 0)
118 if (!drv
->get_caps
|| drv
->get_caps (&vid_cap
) != 0)
121 if ((vid_cap
.type
& cap
) != cap
)
124 printf ("vidixlib: Found %s but has no required capability\n",
130 printf ("vidixlib: %s probed o'k\n", drv
->name
);
136 static void vidix_list_drivers (void)
140 printf ("Available VIDIX drivers:\n");
145 vidix_capability_t cap
;
146 drv
->get_caps (&cap
);
147 printf (" * %s - %s\n", drv
->name
, cap
.name
);
152 int vidix_find_driver (VDXContext
*ctx
, const char *name
,
153 unsigned int cap
, int verbose
)
157 if (name
&& !strcmp (name
, "help"))
159 vidix_list_drivers ();
167 if (name
) /* forced driver */
169 if (!strcmp (drv
->name
, name
))
171 if (vidix_probe_driver (ctx
, drv
, cap
, verbose
))
180 else /* auto-probe */
182 if (vidix_probe_driver (ctx
, drv
, cap
, verbose
))
189 printf ("vidixlib: No suitable driver can be found.\n");