Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Mar 1998 21:46:03 -0500
From:      Randall Hopper <rhh@ct.picker.com>
To:        Amancio Hasty <hasty@rah.star-gate.com>, Mark Murray <mark@grondar.za>
Cc:        asami@FreeBSD.ORG, multimedia@FreeBSD.ORG, committers@FreeBSD.ORG, stable@FreeBSD.ORG
Subject:   Re: Fxtv vs Stable
Message-ID:  <19980323214603.15285@ct.picker.com>
In-Reply-To: <199803231847.KAA14308@rah.star-gate.com>; from Amancio Hasty on Mon, Mar 23, 1998 at 10:47:57AM -0800
References:  <19980323065624.22389@ct.picker.com> <199803231847.KAA14308@rah.star-gate.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--TB36FDmn/VVEgNH/
Content-Type: text/plain; charset=us-ascii

...
<design discussion omitted>
...

Ok.  Here are the patches for the discussed method of dealing with the
mmap() PROT_WRITE root-only changes recently in -current and -stable as
pertains to Fxtv and the bktr driver.  As 2.2.6 is the hot topic, these are
against stable.

Attached is a bktr driver patch (bktr-stable.patch) which adds the trivial
BT848[SG]CBUF ioctls, and a replacement "patch-ab" for the Fxtv port.

As I don't have 2.2.6-beta installed here, I'd be grateful Mark if you
could double-check these, and barring any unexpected problems, commit the
changes to -current and -stable.

Thanks,

Randall


--TB36FDmn/VVEgNH/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="bktr-stable.patch"

--- sys/i386/include/ioctl_bt848.h-2.2.6-ORIG	Mon Mar 23 19:01:02 1998
+++ sys/i386/include/ioctl_bt848.h	Mon Mar 23 20:49:52 1998
@@ -193,6 +193,10 @@
 #define BT848SFMT		_IOW('x', 67, unsigned long )
 #define BT848GFMT		_IOR('x', 67, unsigned long )
 
+/* set clear-buffer-on-start */
+#define BT848SCBUF	_IOW('x', 68, int)
+#define BT848GCBUF	_IOR('x', 68, int)
+
 /* Read/Write the BT848's I2C bus directly
  * b7-b0:    data (read/write)
  * b15-b8:   internal peripheral register (write)   
--- sys/pci/brktree_reg.h-2.2.6-ORIG	Mon Mar 23 19:01:02 1998
+++ sys/pci/brktree_reg.h	Mon Mar 23 19:42:37 1998
@@ -369,6 +369,7 @@
     int		alloc_pages;	/* number of pages in bigbuf */
     struct proc	*proc;		/* process to receive raised signal */
     int		signal;		/* signal to send to process */
+    int		clr_on_start;	/* clear cap buf on capture start? */
 #define	METEOR_SIG_MODE_MASK	0xffff0000
 #define	METEOR_SIG_FIELD_MODE	0x00010000
 #define	METEOR_SIG_FRAME_MODE	0x00000000
--- sys/pci/brooktree848.c-2.2.6-ORIG	Mon Mar 23 19:01:02 1998
+++ sys/pci/brooktree848.c	Mon Mar 23 21:25:26 1998
@@ -879,6 +879,7 @@
 		bt848->int_mask = ALL_INTS_DISABLED;
 		bt848->gpio_dma_ctl = FIFO_RISC_DISABLED;
 	}
+	bktr->clr_on_start = FALSE;
 
 	/* defaults for the tuner section of the card */
 	bktr->tflags = TUNER_INITALIZED;
@@ -1731,6 +1732,14 @@
 		*(u_char *)arg = (u_char)((temp >> 1) & 0xff);
 		break;
 
+	case BT848SCBUF:	/* set Clear-Buffer-on-start flag */
+		bktr->clr_on_start = (*(int *)arg != 0);
+		break;
+
+	case BT848GCBUF:	/* get Clear-Buffer-on-start flag */
+		*(int *)arg = (int) bktr->clr_on_start;
+		break;
+
 	case METEORSSIGNAL:
 		if(*(int *)arg == 0 || *(int *)arg >= NSIG) {
 			return( EINVAL );
@@ -3343,6 +3352,13 @@
 	struct format_params   *fp;
 
 	fp = &format_params[bktr->format_params];
+
+	/*  If requested, clear out capture buf first  */
+	if (bktr->clr_on_start && (bktr->video.addr == 0)) {
+		bzero((caddr_t)bktr->bigbuf, 
+		      (size_t)bktr->rows * bktr->cols * bktr->frames *
+			pixfmt_table[ bktr->pixfmt ].public.Bpp);
+	}
 
 	bt848 = bktr->base;
 

--TB36FDmn/VVEgNH/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="patch-ab.fxtv"

--- ORIG/tvcapture.c	Mon Oct 27 23:59:41 1997
+++ tvcapture.c	Mon Mar 23 21:29:10 1998
@@ -1126,7 +1126,7 @@
     /*  Just mmap the biggest buffer we'll need and be done with it.  */
     /*    (Buffer used for non-directvideo captures)                  */
     c->drv_buf = (TV_UINT8 *) mmap( (caddr_t)0, MAX_MMAP_BUF_SIZE,
-                                 PROT_READ|PROT_WRITE, 0, c->fd, (off_t)0 );
+                                    PROT_READ, MAP_SHARED, c->fd, (off_t)0 );
     if ( c->drv_buf == (TV_UINT8 *) -1 ) {
         fprintf( stderr, "mmap of driver buffer failed: %s\n", 
                  strerror(errno) );
@@ -1474,7 +1474,8 @@
     TV_INT32             Bpp,
                          idx;
     char                *cfg_fail_msg;
-    TV_BOOL              audio_mute;
+    TV_BOOL              audio_mute,
+                         flush_buf;
 
     DRVPRINTF(( "\tCAPTURE Start %s\n",
                c->cap_mode == TV_CAPTURE_CONTINUOUS ? "Continuous":"Single"));
@@ -1499,6 +1500,7 @@
     geom.columns = g.w;
     geom.rows    = g.h;
     geom.frames  = 1;
+    flush_buf    = FALSE;
 
     if ( c->xfer_mode == TV_TRANSFER_DIRECT ) {
         TV_BOOL  swap_b, 
@@ -1536,10 +1538,11 @@
         video.banksize = 0,
         video.ramsize  = 0;
 
-        /*  If TDEC is on, may be a while before old trash gets written on  */
+        /*  If TDEC is on, may be a while before old trash gets written on.  */
+        /*    So tell the driver to flush the frame buffer before starting   */
+        /*    capture.                                                       */
         if ( c->fps != c->fps_max )
-            memset( c->drv_buf, '\0',
-                    g.w * g.h * c->pix_geom_list[ c->pix_geom_idx ].Bpp );
+            flush_buf = TRUE;
     }
     memcpy( &pix_geom, &c->pix_geom_list[ c->pix_geom_idx ], 
             sizeof( pix_geom ) );
@@ -1564,6 +1567,12 @@
     }
     if ( ioctl( c->fd, METEORSACTPIXFMT, &pix_geom.index ) < 0 ) {
         DO_IOCTL_SERR( "METEORSACTPIXFMT", &geom );
+        return;
+    }
+
+    larg = flush_buf;
+    if ( ioctl( c->fd, BT848SCBUF, &larg ) < 0 ) {
+        DO_IOCTL_SERR( "BT848SCBUF", larg );
         return;
     }
 

--TB36FDmn/VVEgNH/--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980323214603.15285>