From 9aa17fbbb6a07bfa3cea5def4785f2db807e4581 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Thu, 10 Dec 2009 23:22:19 +0000 Subject: Update the SuperH VEU vidix driver with experimental support for VEU3F. Patch by Magnus Damm, damm opensource se git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29990 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/sh_veu_vid.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/vidix/sh_veu_vid.c b/vidix/sh_veu_vid.c index 03868ac364..cc45e32d86 100644 --- a/vidix/sh_veu_vid.c +++ b/vidix/sh_veu_vid.c @@ -219,6 +219,8 @@ static int get_fb_info(char *device, struct fb_info *fip) #define VCOFFR 0x224 /* color conversion offset */ #define VCBR 0x228 /* color conversion clip */ +#define VRPBR 0xc8 /* resize passband */ + /* Helper functions for reading registers. */ static unsigned long read_reg(struct uio_map *ump, int reg_offs) @@ -323,14 +325,19 @@ static void sh_veu_wait_irq(vidix_playback_t *info) static int sh_veu_is_veu2h(void) { - return uio_mmio.size > 0xb8; + return uio_mmio.size == 0x27c; +} + +static int sh_veu_is_veu3f(void) +{ + return uio_mmio.size == 0xcc; } static unsigned long sh_veu_do_scale(struct uio_map *ump, int vertical, int size_in, int size_out, int crop_out) { - unsigned long fixpoint, mant, frac, value, rep; + unsigned long fixpoint, mant, frac, value, rep, vb; /* calculate FRAC and MANT */ do { @@ -402,6 +409,34 @@ static unsigned long sh_veu_do_scale(struct uio_map *ump, } write_reg(ump, value, VRFSR); + /* VEU3F needs additional VRPBR register handling */ + if (sh_veu_is_veu3f()) { + if (size_out > size_in) + vb = 64; + else { + if ((mant >= 8) && (mant < 16)) + value = 4; + else if ((mant >= 4) && (mant < 8)) + value = 2; + else + value = 1; + + vb = 64 * 4096 * value; + vb /= 4096 * mant + frac; + } + + /* set resize passband register */ + value = read_reg(ump, VRPBR); + if (vertical) { + value &= ~0xffff0000; + value |= vb << 16; + } else { + value &= ~0xffff; + value |= vb; + } + write_reg(ump, value, VRPBR); + } + return (((size_in * crop_out) / size_out) + 0x03) & ~0x03; } -- cgit v1.2.3