summaryrefslogtreecommitdiffstats
path: root/vidix
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-12-18 18:54:42 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-12-18 18:54:42 +0200
commitefcc9ad7120e01a17fc3659cb0229135b1cebb95 (patch)
treeeb15edb75377eedd5d7397209e8c0d594020663e /vidix
parent1598302be65c77c107330dc46fd0dabface3112d (diff)
parent8fcbe5835d038649e70da410d46c4f5cd502c261 (diff)
downloadmpv-efcc9ad7120e01a17fc3659cb0229135b1cebb95.tar.bz2
mpv-efcc9ad7120e01a17fc3659cb0229135b1cebb95.tar.xz
Merge svn changes up to r30055
Diffstat (limited to 'vidix')
-rw-r--r--vidix/AsmMacros.h2
-rwxr-xr-x[-rw-r--r--]vidix/pci_db2c.awk5
-rw-r--r--vidix/sh_veu_vid.c50
-rw-r--r--vidix/sysdep/pci_linux.c2
4 files changed, 48 insertions, 11 deletions
diff --git a/vidix/AsmMacros.h b/vidix/AsmMacros.h
index 8cf052b916..da4e3b150b 100644
--- a/vidix/AsmMacros.h
+++ b/vidix/AsmMacros.h
@@ -77,8 +77,6 @@
#include "sysdep/AsmMacros_arm32.h"
#elif defined(__powerpc__)
#include "sysdep/AsmMacros_powerpc.h"
-#elif defined(__sh__)
-#include <sys/io.h>
#else
#include "sysdep/AsmMacros_x86.h"
#endif
diff --git a/vidix/pci_db2c.awk b/vidix/pci_db2c.awk
index 1f948a5d76..039bf0f55a 100644..100755
--- a/vidix/pci_db2c.awk
+++ b/vidix/pci_db2c.awk
@@ -1,9 +1,8 @@
+#!/usr/bin/awk -f
# This file converts given pci.db to "C" source and header files
# For latest version of pci ids see: http://pciids.sf.net
# Copyright 2002 Nick Kurshev
#
-# Usage: awk -f pci_db2c.awk pci.db
-#
# Tested with Gawk v 3.0.x and Mawk 1.3.3
# But it should work with standard Awk implementations (hopefully).
# (Nobody tested it with Nawk, but it should work, too).
@@ -28,7 +27,7 @@ BEGIN {
if(ARGC != 3) {
# check for arguments:
- print "Usage awk -f pci_db2c.awk pci.db (and make sure pci.db file exists first)";
+ print "Usage ./pci_db2c.awk pci.db (and make sure pci.db file exists first)";
exit(1);
}
in_file = ARGV[1];
diff --git a/vidix/sh_veu_vid.c b/vidix/sh_veu_vid.c
index 7ce49b4a94..cc45e32d86 100644
--- a/vidix/sh_veu_vid.c
+++ b/vidix/sh_veu_vid.c
@@ -1,6 +1,6 @@
/*
* VIDIX driver for SuperH Mobile VEU hardware block.
- * Copyright (C) 2008 Magnus Damm
+ * Copyright (C) 2008, 2009 Magnus Damm
*
* Requires a kernel that exposes the VEU hardware block to user space
* using UIO. Available in upstream linux-2.6.27 or later.
@@ -179,8 +179,7 @@ static int get_fb_info(char *device, struct fb_info *fip)
memset(iomem, 0, fip->line_length * fip->height);
munmap(iomem, fip->size);
- close(fd);
- return 0;
+ return fd;
}
#define VESTR 0x00 /* start register */
@@ -220,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)
@@ -268,6 +269,7 @@ struct sh_veu_plane {
static struct sh_veu_plane _src, _dst;
static vidix_playback_t my_info;
+static int fb_fd;
static int sh_veu_probe(int verbose, int force)
{
@@ -276,6 +278,7 @@ static int sh_veu_probe(int verbose, int force)
ret = get_fb_info("/dev/fb0", &fbi);
if (ret < 0)
return ret;
+ fb_fd = ret;
if (fbi.bpp != 16) {
printf("sh_veu: only 16bpp supported\n");
@@ -315,18 +318,26 @@ static void sh_veu_wait_irq(vidix_playback_t *info)
read(uio_dev.fd, &n_pending, sizeof(unsigned long));
write_reg(&uio_mmio, 0x100, VEVTR); /* ack int, write 0 to bit 0 */
+
+ /* flush framebuffer to handle deferred io case */
+ fsync(fb_fd);
}
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 {
@@ -398,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;
}
@@ -486,6 +525,7 @@ static int sh_veu_init(void)
static void sh_veu_destroy(void)
{
+ close(fb_fd);
}
static int sh_veu_get_caps(vidix_capability_t *to)
diff --git a/vidix/sysdep/pci_linux.c b/vidix/sysdep/pci_linux.c
index 6accf0885d..62ccc9bd93 100644
--- a/vidix/sysdep/pci_linux.c
+++ b/vidix/sysdep/pci_linux.c
@@ -31,7 +31,7 @@
//#include <sys/perm.h> doesn't exist on libc5 systems
int iopl();
#else
-#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__x86_64__)
+#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__x86_64__) && !defined(__sh__)
#include <sys/io.h>
#endif
#endif