changeset 26831:7b868c55d22b

make use of the new MGA_VID_VERSION ioctl to check whether the installed driver has the version we expect it to have.
author attila
date Fri, 23 May 2008 20:18:06 +0000
parents d1c10dce1ee7
children 6af954f69fe4
files help/help_mp-en.h libvo/mga_common.c
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/help/help_mp-en.h	Fri May 23 20:14:31 2008 +0000
+++ b/help/help_mp-en.h	Fri May 23 20:18:06 2008 +0000
@@ -1712,6 +1712,7 @@
 #define MSGTR_LIBVO_MGA_IncompatibleDriverVersion "[MGA] Your mga_vid driver version is incompatible with this MPlayer version!\n"
 #define MSGTR_LIBVO_MGA_CouldntOpen "[MGA] Couldn't open: %s\n"
 #define MGSTR_LIBVO_MGA_ResolutionTooHigh "[MGA] Source resolution is in at least one dimension larger than 1023x1023. Please rescale in software or use -lavdopts lowres=1\n"
+#define MGSTR_LIBVO_MGA_mgavidVersionMissmatch "[MGA] The version of the mga_vid driver (%u) does not match the version with which MPlayer was compiled with (%u)\n"
 
 // libvo/vesa_lvo.c
 
--- a/libvo/mga_common.c	Fri May 23 20:14:31 2008 +0000
+++ b/libvo/mga_common.c	Fri May 23 20:18:06 2008 +0000
@@ -449,6 +449,7 @@
 
 static int preinit(const char *vo_subdevice)
 {
+	uint32_t ver;
   const char *devname=vo_subdevice?vo_subdevice:"/dev/mga_vid";
 	sws_rgb2rgb_init(get_sws_cpuflags());
 
@@ -459,6 +460,16 @@
 		mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldntOpen,devname);
 		return -1;
 	}
+	
+	// check whether the mga_vid driver has the same
+	// version as we expect
+	
+	ioctl(f,MGA_VID_GET_VERSION,&ver);
+	if(MGA_VID_VERSION != ver)
+	{
+		mp_msg(MSGT_VO, MSGL_ERR, MGSTR_LIBVO_MGA_mgavidVersionMissmatch, ver, MGA_VID_VERSION);
+		return -1;
+	}
 
 #ifdef VO_XMGA
   if (!vo_init()) {