[Mplayer-cvslog] CVS: main/drivers/radeon README,1.8,1.9 radeon_vid.c,1.18,1.19

Nick Kurshev nick at mplayer.dev.hu
Sun Dec 2 11:44:55 CET 2001


Update of /cvsroot/mplayer/main/drivers/radeon
In directory mplayer:/var/tmp.root/cvs-serv24810/main/drivers/radeon

Modified Files:
	README radeon_vid.c 
Log Message:
Fixed 'cat' problems

Index: README
===================================================================
RCS file: /cvsroot/mplayer/main/drivers/radeon/README,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- README	1 Dec 2001 20:23:47 -0000	1.8
+++ README	2 Dec 2001 10:44:45 -0000	1.9
@@ -53,10 +53,8 @@
 echo "deinterlace=off">/dev/radeon_vid
 
 To know more about these parameters - try read /dev/radeon_vid file ;)
-Note: don't use 'cat' since it can't detect EOF during reading such files.
-(I use midnight commander for that ;)
-or try this:
-head -n 20 /dev/radeon_vid
+For example:
+cat /dev/radeon_vid
 
 List of parameters:
 ~~~~~~~~~~~~~~~~~~~

Index: radeon_vid.c
===================================================================
RCS file: /cvsroot/mplayer/main/drivers/radeon/radeon_vid.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- radeon_vid.c	1 Dec 2001 20:23:47 -0000	1.18
+++ radeon_vid.c	2 Dec 2001 10:44:46 -0000	1.19
@@ -190,7 +190,10 @@
 static uint32_t radeon_mem_base = 0; 
 static int32_t radeon_overlay_off = 0;
 static uint32_t radeon_ram_size = 0;
-
+#define PARAM_BUFF_SIZE 4096
+static uint8_t *radeon_param_buff = NULL;
+static uint32_t radeon_param_buff_size=0;
+static uint32_t radeon_param_buff_len=0; /* real length of buffer */
 static mga_vid_config_t radeon_config; 
 
 #undef DEBUG
@@ -776,29 +779,40 @@
 #define PARAM_DEINTERLACE "deinterlace="
 #define PARAM_DEINTERLACE_PATTERN "deinterlace_pattern="
 
-static ssize_t radeon_vid_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+static void radeon_param_buff_fill( void )
 {
     unsigned len,saturation;
     long brightness;
     brightness = besr.brightness;
     saturation = besr.saturation;
     len = 0;
-    len += sprintf(&buf[len],"Interface version: %04X\nDriver version: %s\n",MGA_VID_VERSION,RADEON_VID_VERSION);
-    len += sprintf(&buf[len],"Chip: %s\n",ati_card_ids[detected_chip].name);
-    len += sprintf(&buf[len],"Memory: %p:%x\n",radeon_mem_base,radeon_ram_size*0x100000);
-    len += sprintf(&buf[len],"MMIO: %p\n",radeon_mmio_base);
-    len += sprintf(&buf[len],"Overlay offset: %p\n",radeon_overlay_off);
-    len += sprintf(&buf[len],"Last fourcc: %s\n\n",fourcc_format_name(besr.fourcc));
-    len += sprintf(&buf[len],"Configurable stuff:\n");
-    len += sprintf(&buf[len],"~~~~~~~~~~~~~~~~~~~\n");
-    len += sprintf(&buf[len],PARAM_DOUBLE_BUFF"%s\n",besr.double_buff?"on":"off");
-    len += sprintf(&buf[len],PARAM_BRIGHTNESS"%i\n",brightness);
-    len += sprintf(&buf[len],PARAM_SATURATION"%u\n",saturation);
-    len += sprintf(&buf[len],PARAM_COLOUR_KEY"%X\n",besr.graphics_key_clr);
-    len += sprintf(&buf[len],PARAM_DEINTERLACE"%s\n",besr.deinterlace_on?"on":"off");
-    len += sprintf(&buf[len],PARAM_DEINTERLACE_PATTERN"%X\n",besr.deinterlace_pattern);
-    ppos += len;
-    return len;
+    len += sprintf(&radeon_param_buff[len],"Interface version: %04X\nDriver version: %s\n",MGA_VID_VERSION,RADEON_VID_VERSION);
+    len += sprintf(&radeon_param_buff[len],"Chip: %s\n",ati_card_ids[detected_chip].name);
+    len += sprintf(&radeon_param_buff[len],"Memory: %p:%x\n",radeon_mem_base,radeon_ram_size*0x100000);
+    len += sprintf(&radeon_param_buff[len],"MMIO: %p\n",radeon_mmio_base);
+    len += sprintf(&radeon_param_buff[len],"Overlay offset: %p\n",radeon_overlay_off);
+    len += sprintf(&radeon_param_buff[len],"Last fourcc: %s\n\n",fourcc_format_name(besr.fourcc));
+    len += sprintf(&radeon_param_buff[len],"Configurable stuff:\n");
+    len += sprintf(&radeon_param_buff[len],"~~~~~~~~~~~~~~~~~~~\n");
+    len += sprintf(&radeon_param_buff[len],PARAM_DOUBLE_BUFF"%s\n",besr.double_buff?"on":"off");
+    len += sprintf(&radeon_param_buff[len],PARAM_BRIGHTNESS"%i\n",brightness);
+    len += sprintf(&radeon_param_buff[len],PARAM_SATURATION"%u\n",saturation);
+    len += sprintf(&radeon_param_buff[len],PARAM_COLOUR_KEY"%X\n",besr.graphics_key_clr);
+    len += sprintf(&radeon_param_buff[len],PARAM_DEINTERLACE"%s\n",besr.deinterlace_on?"on":"off");
+    len += sprintf(&radeon_param_buff[len],PARAM_DEINTERLACE_PATTERN"%X\n",besr.deinterlace_pattern);
+    radeon_param_buff_len = len;
+}
+
+static ssize_t radeon_vid_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+{
+    uint32_t size;
+    if(!radeon_param_buff) return -ESPIPE;
+    if(!(*ppos)) radeon_param_buff_fill();
+    if(*ppos >= radeon_param_buff_len) return 0;
+    size = min(count,radeon_param_buff_len-(uint32_t)(*ppos));
+    memcpy(buf,radeon_param_buff,size);
+    *ppos += size;
+    return size;
 }
 
 static ssize_t radeon_vid_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
@@ -848,6 +862,7 @@
       dpat=simple_strtol(&buf[strlen(PARAM_DEINTERLACE_PATTERN)],NULL,16);
 	OUTREG(OV0_DEINTERLACE_PATTERN, dpat);
     }
+    else count = -EIO;
     radeon_vid_preset();
     return count;
 }
@@ -947,6 +962,8 @@
 		unregister_chrdev(RADEON_VID_MAJOR, "radeon_vid");
 		return -EINVAL;
 	}
+	radeon_param_buff = kmalloc(PARAM_BUFF_SIZE,GFP_KERNEL);
+	if(radeon_param_buff) radeon_param_buff_size = PARAM_BUFF_SIZE;
 	radeon_vid_save_state();
 	radeon_vid_make_default();
 	radeon_vid_preset();
@@ -963,7 +980,7 @@
 	radeon_vid_restore_state();
 	if(radeon_mmio_base)
 		iounmap(radeon_mmio_base);
-
+	kfree(radeon_param_buff);
 	RTRACE(RVID_MSG"Cleaning up module\n");
 	unregister_chrdev(RADEON_VID_MAJOR, "radeon_vid");
 }




More information about the MPlayer-cvslog mailing list