Mercurial > mplayer.hg
changeset 3247:7cec2396bde3
Tune up driver through reading and writing /dev/radeon_vid ;)
author | nick |
---|---|
date | Sat, 01 Dec 2001 17:08:37 +0000 |
parents | f03adf755028 |
children | 808d1ac88074 |
files | drivers/radeon/radeon_vid.c |
diffstat | 1 files changed, 60 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/drivers/radeon/radeon_vid.c Sat Dec 01 17:08:12 2001 +0000 +++ b/drivers/radeon/radeon_vid.c Sat Dec 01 17:08:37 2001 +0000 @@ -130,7 +130,8 @@ uint32_t exclusive_horz; uint32_t auto_flip_cntl; uint32_t filter_cntl; - uint32_t colour_cntl; + int brightness; + int saturation; uint32_t graphics_key_msk; uint32_t graphics_key_clr; uint32_t key_cntl; @@ -186,7 +187,7 @@ static uint8_t *radeon_mmio_base = 0; static uint32_t radeon_mem_base = 0; static int32_t radeon_overlay_off = 0; - +static int radeon_double_buff=1; static uint32_t radeon_ram_size = 0; static mga_vid_config_t radeon_config; @@ -334,10 +335,10 @@ OUTREG(OV0_P23_V_ACCUM_INIT, besr.p23_v_accum_init); bes_flags = SCALER_ENABLE | - SCALER_DOUBLE_BUFFER | SCALER_ADAPTIVE_DEINT | SCALER_SMART_SWITCH | SCALER_HORZ_PICK_NEAREST; + if(radeon_double_buff) bes_flags |= SCALER_DOUBLE_BUFFER; #ifdef RAGE128 bes_flags |= SCALER_BURST_PER_PLANE; #endif @@ -549,6 +550,7 @@ static void radeon_vid_frame_sel(int frame) { uint32_t off0,off1,off2; + if(!radeon_double_buff) return; if(frame%2) { off0 = besr.vid_buf3_base_adrs; @@ -569,6 +571,14 @@ OUTREG(OV0_REG_LOAD_CNTL, 0); } +static void radeon_vid_preset(void) +{ + unsigned tmp; + tmp = INREG(OV0_COLOUR_CNTL); + besr.saturation = (tmp>>8)&0x1f; + besr.brightness = tmp & 0x7f; +} + static int video_on = 0; static int radeon_vid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) @@ -730,6 +740,8 @@ #endif }; +static int detected_chip; + static int radeon_vid_config_card(void) { struct pci_dev *dev = NULL; @@ -756,20 +768,62 @@ /* mem size is bits [28:0], mask off the rest. Range: from 1Mb up to 512 Mb */ radeon_ram_size &= CONFIG_MEMSIZE_MASK; radeon_ram_size /= 0x100000; + detected_chip = i; printk(RVID_MSG"Found %s (%uMb memory)\n",ati_card_ids[i].name,radeon_ram_size); return TRUE; } +#define PARAM_BRIGHTNESS "brightness=" +#define PARAM_SATURATION "saturation=" +#define PARAM_DOUBLE_BUFF "double_buff=" static ssize_t radeon_vid_read(struct file *file, char *buf, size_t count, loff_t *ppos) { - return -EINVAL; + unsigned len,saturation; + long brightness; + brightness = besr.brightness; + saturation = besr.saturation; + len = 0; + 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],"Configurable stuff:\n"); + len += sprintf(&buf[len],PARAM_DOUBLE_BUFF"%s\n",radeon_double_buff?"on":"off"); + len += sprintf(&buf[len],PARAM_BRIGHTNESS"%i\n",brightness); + len += sprintf(&buf[len],PARAM_SATURATION"%u\n",saturation); + return len; } static ssize_t radeon_vid_write(struct file *file, const char *buf, size_t count, loff_t *ppos) { - return -EINVAL; + if(memcmp(buf,PARAM_BRIGHTNESS,min(count,strlen(PARAM_BRIGHTNESS))) == 0) + { + long brightness; + brightness=simple_strtol(&buf[strlen(PARAM_BRIGHTNESS)],NULL,10); + if(brightness >= -64 && brightness <= 63) + OUTREG(OV0_COLOUR_CNTL, (brightness & 0x7f) | + (besr.saturation << 8) | + (besr.saturation << 16)); + } + else + if(memcmp(buf,PARAM_SATURATION,min(count,strlen(PARAM_SATURATION))) == 0) + { + long saturation; + saturation=simple_strtol(&buf[strlen(PARAM_SATURATION)],NULL,10); + if(saturation >= 0 && saturation <= 31) + OUTREG(OV0_COLOUR_CNTL, (besr.brightness & 0x7f) | + (saturation << 8) | + (saturation << 16)); + } + else + if(memcmp(buf,PARAM_DOUBLE_BUFF,min(count,strlen(PARAM_DOUBLE_BUFF))) == 0) + { + if(memcmp(&buf[strlen(PARAM_DOUBLE_BUFF)],"on",2) == 0) radeon_double_buff = 1; + else radeon_double_buff = 0; + } + radeon_vid_preset(); + return count; } static int radeon_vid_mmap(struct file *file, struct vm_area_struct *vma) @@ -868,6 +922,7 @@ return -EINVAL; } radeon_vid_save_state(); + radeon_vid_preset(); return(0); }