Import of nvtv (nv-tv-out on SourceForge). I send-pr'd this months ago, I

guess it needs a review by someone who can actually test it.
This commit is contained in:
Quentin Garnier 2003-03-26 20:40:41 +00:00
parent 93413bece8
commit 77596ef4ec
9 changed files with 355 additions and 0 deletions

6
nvtv/DESCR Normal file
View File

@ -0,0 +1,6 @@
This is a tool to enable TV-Out on Linux for NVidia
cards. It does not need the kernel, supports
multiple TV encoder chips. You may use all the
features of the chip, down to direct register
access, and all resolutions and sizes the chip
supports.

32
nvtv/Makefile Normal file
View File

@ -0,0 +1,32 @@
# $NetBSD: Makefile,v 1.1.1.1 2003/03/26 20:40:41 cubidou Exp $
DISTNAME= nvtv-0.4.4
CATEGORIES= graphics
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=nv-tv-out/}
MAINTAINER= cube@cubidou.net
HOMEPAGE= http://sourceforge.net/projects/nv-tv-out/
COMMENT= tool to manipulate TV-Out settings on NVidia cards
ONLY_FOR_PLATFORM= NetBSD-*-i386
USE_BUILDLINK2= YES
USE_GMAKE= YES
GNU_CONFIGURE= YES
WRKSRC= ${WRKDIR}/nvtv
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/src/nvtvd ${WRKSRC}/src/nvtv ${PREFIX}/sbin
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/nvtv
${INSTALL_DATA} ${WRKSRC}/README ${WRKSRC}/FAQ ${WRKSRC}/doc/USAGE \
${WRKSRC}/doc/chips.txt \
${WRKSRC}/doc/overview.txt ${WRKSRC}/doc/timing.txt \
${PREFIX}/share/doc/nvtv
${INSTALL_MAN} ${WRKSRC}/doc/man/nvtvd.8 ${PREFIX}/man/man8
${INSTALL_MAN} ${WRKSRC}/doc/man/nvtv.1x ${PREFIX}/man/man8/nvtv.8
.include "../../sysutils/pciutils/buildlink2.mk"
.include "../../x11/gtk/buildlink2.mk"
.include "../../mk/bsd.pkg.mk"

12
nvtv/PLIST Normal file
View File

@ -0,0 +1,12 @@
@comment $NetBSD: PLIST,v 1.1.1.1 2003/03/26 20:40:41 cubidou Exp $
sbin/nvtv
sbin/nvtvd
share/doc/nvtv/FAQ
share/doc/nvtv/README
share/doc/nvtv/USAGE
share/doc/nvtv/chips.txt
share/doc/nvtv/overview.txt
share/doc/nvtv/timing.txt
man/man8/nvtv.8
man/man8/nvtvd.8
@dirrm share/doc/nvtv

9
nvtv/distinfo Normal file
View File

@ -0,0 +1,9 @@
$NetBSD: distinfo,v 1.1.1.1 2003/03/26 20:40:41 cubidou Exp $
SHA1 (nvtv-0.4.4.tar.gz) = 9d5ac8fbcbb5b4fa48b18e04c47d6a9af6f015d0
Size (nvtv-0.4.4.tar.gz) = 763349 bytes
SHA1 (patch-aa) = 7c01ac6264215bd0d8e7bf91af94fb2398a6abdd
SHA1 (patch-ab) = 64018321a37b746c56886a1262fca4b2768c832e
SHA1 (patch-ac) = 593d32a01dd76462248d64d153becb82488a1a43
SHA1 (patch-ad) = 070a477e3aa873ca08cf71d515c529e878210733
SHA1 (patch-ae) = 9a79ed5920a006ba98db1e8bac312fcb1136c3ff

13
nvtv/patches/patch-aa Normal file
View File

@ -0,0 +1,13 @@
$NetBSD: patch-aa,v 1.1.1.1 2003/03/26 20:40:42 cubidou Exp $
--- Makefile.in.orig 2002-11-08 12:36:46.000000000 +0100
+++ Makefile.in
@@ -3,7 +3,7 @@
VERSION=@PACKAGE_VERSION@
SHELL=/bin/sh
-MAKE=/usr/bin/make
+#MAKE=/usr/bin/make
# [A-Z] does not work for some reason

146
nvtv/patches/patch-ab Normal file
View File

@ -0,0 +1,146 @@
$NetBSD: patch-ab,v 1.1.1.1 2003/03/26 20:40:42 cubidou Exp $
--- configure.orig 2003-03-14 10:41:55.000000000 +0100
+++ configure
@@ -4400,7 +4400,7 @@ _ACEOF
SRCS_EXTRA="$SRCS_EXTRA actions.c"
if test ${have_gtk} != no ; then
- have_gtk_version=`expr substr ${have_gtk} 4 1`
+ have_gtk_version=`expr ${have_gtk} : '^gtk\([12]\)'`
cat >>confdefs.h <<\_ACEOF
#define HAVE_GTK 1
@@ -4607,13 +4607,13 @@ fi
if test ${host_flag} = unix ; then
- echo "$as_me:$LINENO: checking for pci_init in -lpci" >&5
-echo $ECHO_N "checking for pci_init in -lpci... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for pci_init in -lpciutils" >&5
+echo $ECHO_N "checking for pci_init in -lpciutils... $ECHO_C" >&6
if test "${ac_cv_lib_pci_pci_init+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpci $LIBS"
+LIBS="-lpciutils -lpci $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
@@ -4662,7 +4662,7 @@ fi
echo "$as_me:$LINENO: result: $ac_cv_lib_pci_pci_init" >&5
echo "${ECHO_T}$ac_cv_lib_pci_pci_init" >&6
if test $ac_cv_lib_pci_pci_init = yes; then
- LIBS="$LIBS -lpci"
+ LIBS="$LIBS -lpciutils -lpci"
else
{ { echo "$as_me:$LINENO: error: pci library required" >&5
echo "$as_me: error: pci library required" >&2;}
@@ -5044,8 +5044,8 @@ done
if test "${ac_cv_header_pci_pci_h+set}" = set; then
- echo "$as_me:$LINENO: checking for pci/pci.h" >&5
-echo $ECHO_N "checking for pci/pci.h... $ECHO_C" >&6
+ echo "$as_me:$LINENO: checking for pciutils/pci.h" >&5
+echo $ECHO_N "checking for pciutils/pci.h... $ECHO_C" >&6
if test "${ac_cv_header_pci_pci_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
@@ -5053,8 +5053,8 @@ echo "$as_me:$LINENO: result: $ac_cv_hea
echo "${ECHO_T}$ac_cv_header_pci_pci_h" >&6
else
# Is the header compilable?
-echo "$as_me:$LINENO: checking pci/pci.h usability" >&5
-echo $ECHO_N "checking pci/pci.h usability... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking pciutils/pci.h usability" >&5
+echo $ECHO_N "checking pciutils/pci.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
@@ -5063,7 +5063,7 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
-#include <pci/pci.h>
+#include <pciutils/pci.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -5089,8 +5089,8 @@ echo "$as_me:$LINENO: result: $ac_header
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
-echo "$as_me:$LINENO: checking pci/pci.h presence" >&5
-echo $ECHO_N "checking pci/pci.h presence... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking pciutils/pci.h presence" >&5
+echo $ECHO_N "checking pciutils/pci.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
@@ -5098,7 +5098,7 @@ _ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <pci/pci.h>
+#include <pciutils/pci.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
@@ -5131,10 +5131,10 @@ echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
- { echo "$as_me:$LINENO: WARNING: pci/pci.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: pci/pci.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: pci/pci.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: pci/pci.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pciutils/pci.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: pciutils/pci.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pciutils/pci.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: pciutils/pci.h: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
@@ -5145,12 +5145,12 @@ _ASBOX
sed "s/^/$as_me: WARNING: /" >&2
;;
no:yes )
- { echo "$as_me:$LINENO: WARNING: pci/pci.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: pci/pci.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: pci/pci.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: pci/pci.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: pci/pci.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: pci/pci.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pciutils/pci.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: pciutils/pci.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pciutils/pci.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: pciutils/pci.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: pciutils/pci.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: pciutils/pci.h: proceeding with the preprocessor's result" >&2;}
(
cat <<\_ASBOX
## ------------------------------------ ##
@@ -5161,8 +5161,8 @@ _ASBOX
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
-echo "$as_me:$LINENO: checking for pci/pci.h" >&5
-echo $ECHO_N "checking for pci/pci.h... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking for pciutils/pci.h" >&5
+echo $ECHO_N "checking for pciutils/pci.h... $ECHO_C" >&6
if test "${ac_cv_header_pci_pci_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5175,8 +5175,8 @@ fi
if test $ac_cv_header_pci_pci_h = yes; then
:
else
- { { echo "$as_me:$LINENO: error: pci library header 'pci/pci.h' required" >&5
-echo "$as_me: error: pci library header 'pci/pci.h' required" >&2;}
+ { { echo "$as_me:$LINENO: error: pci library header 'pciutils/pci.h' required" >&5
+echo "$as_me: error: pci library header 'pciutils/pci.h' required" >&2;}
{ (exit 1); exit 1; }; }
fi

13
nvtv/patches/patch-ac Normal file
View File

@ -0,0 +1,13 @@
$NetBSD: patch-ac,v 1.1.1.1 2003/03/26 20:40:42 cubidou Exp $
--- src/Makefile.in.orig 2003-03-18 09:38:39.000000000 +0100
+++ src/Makefile.in
@@ -14,7 +14,7 @@ LIBTOOL=libtool
CDFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
-LIBS=@LIBS@
+LIBS=@LIBS@ -li386
DEFS=@DEFS@
X_CFLAGS=@X_CFLAGS@

82
nvtv/patches/patch-ad Normal file
View File

@ -0,0 +1,82 @@
$NetBSD: patch-ad,v 1.1.1.1 2003/03/26 20:40:42 cubidou Exp $
--- src/card_direct.c.orig 2003-02-03 22:53:29.000000000 +0100
+++ src/card_direct.c
@@ -43,10 +43,9 @@
#include <errno.h>
#include <fcntl.h>
-#include <pci/pci.h>
+#include <pciutils/pci.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
-#include <sys/io.h>
#include "backend.h"
#include "card_direct.h"
@@ -114,6 +113,56 @@ void unmapDevMem (unsigned long Base, un
/* -------- Common -------- */
+#ifdef __NetBSD__
+static int
+ioperm(from, num, turn_on)
+ unsigned long from;
+ unsigned long num;
+ int turn_on;
+{
+ u_long *bitmap, mask, value;
+ int r = -1;
+ int first_index, last_index, i;
+
+ if((bitmap = (u_long *)malloc(1024*sizeof(u_long))) == NULL)
+ return -1;
+
+ if(i386_get_ioperm(bitmap) != 0)
+ goto ioperm_fail;
+
+ first_index = from / 32;
+ last_index = (from + num) / 32;
+
+ /* First set */
+ mask = 0xffffffff << (from % 32);
+ if(turn_on)
+ bitmap[first_index] |= mask;
+ else
+ bitmap[first_index] &= ~mask;
+
+ /* Last set */
+ mask = 0xffffffff >> (31 - (from + num) % 32);
+ if(turn_on)
+ bitmap[last_index] |= mask;
+ else
+ bitmap[last_index] &= ~mask;
+
+ if(last_index > first_index + 1) {
+ /* Complete sets */
+ value = turn_on ? 0xffffffff : 0;
+
+ for(i = first_index+1; i<last_index; i++)
+ bitmap[i] = value;
+ }
+
+ r = i386_set_ioperm(bitmap);
+
+ioperm_fail:
+ free(bitmap);
+ return r;
+}
+#endif
+
/*
* Test if card is supported, and create entry for it if it is.
*/
@@ -142,7 +191,7 @@ void test_card (CardPtr *card_list, char
type = CARD_XBOX;
/* FIXME get PIO base from device w/ id 01B4 (SMBus controller) */
pio_base = 0xC000;
- iopl (3);
+ i386_iopl (3);
}
reg_base = base0;
break;

42
nvtv/patches/patch-ae Normal file
View File

@ -0,0 +1,42 @@
$NetBSD: patch-ae,v 1.1.1.1 2003/03/26 20:40:42 cubidou Exp $
--- src/tv_tdfx.c.orig 2003-02-05 17:33:10.000000000 +0100
+++ src/tv_tdfx.c
@@ -233,6 +233,7 @@ VSyncEnd --- --- --- --- ---
/* FIXME: Put that somewhere else */
/* from xfree common/compiler.h */
+#ifndef __NetBSD__
#ifdef linux
#include <sys/io.h>
@@ -265,6 +266,29 @@ inb (unsigned short int port)
#endif
+#else
+static __inline__ u_int8_t
+inb(port)
+ u_int16_t port;
+{
+ u_int8_t r;
+
+ __asm__ __volatile__ ("inb %w1,%0" : "=a" (r) : "Nd" (port));
+
+ return r;
+}
+
+static __inline__ void
+outb(value, port)
+ u_int8_t value;
+ u_int16_t port;
+{
+ __asm__ __volatile__ ("outb %b0,%w1" : : "a" (value), "Nd" (port));
+}
+
+#define OUTB(p,v) outb(v,p)
+#define INB(p) inb(p)
+#endif
/* FIXME: variable port addr */
CARD8 readCrtTdfx (TDFXPtr hwp, CARD8 index)