Date: Thu, 28 Mar 2002 10:25:13 +0100 (CET) From: Hartmut Brandt <brandt@fokus.gmd.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/36415: the bktr driver incorrectly handles the setting of frame rates Message-ID: <200203280925.g2S9PD413433@fokus.gmd.de>
next in thread | raw e-mail | index | archive | help
>Number: 36415 >Category: kern >Synopsis: the bktr driver incorrectly handles the setting of frame rates >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Mar 28 01:30:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Hartmut Brandt >Release: FreeBSD 5.0-CURRENT i386 >Organization: FhI Fokus >Environment: System: FreeBSD beagle.fokus.gmd.de 5.0-CURRENT FreeBSD 5.0-CURRENT #31: Wed Mar 27 14:48:19 CET 2002 hbb@beagle.fokus.gmd.de:/opt/obj/usr/src/sys/BEAGLE i386 >Description: In the case when the driver captures both fields of a frame the temporal decimation register is incorrectly set. This leads to a wrong resulting frame rate. The register is set to drop frames not fields (by setting bit 7 to zero). Therefor the number of dropped items need not to be multiplied by 2 for the case when both fields are captured for a frame. The chip itself takes care for dropping both fields of the dropped frame. As a sidenote: (2) Bktr fails to compile if BT848_DUMP is defined. >How-To-Repeat: Use an application that captures full size PAL and request a frame of 12 fps from the driver. Observe the frame rate dropping to 1 fps. This is due the computation in bktr_core.c:set_fps(). When both WANT flags are 1 (capturing both fields) the difference between the maximum frame rate (25 for PAL) and the requested frame rate (12) is multiplied by two falsely assuming, that the register must contain the number of fields to drop. This yields a value of 24 and the chip drops 24 out of 25 frames resulting in a frame rate of 1. (2) Define BT848_DUMP and observe the compile to fail. >Fix: Apply the following patch. This corrects both problems: Index: bktr_core.c =================================================================== RCS file: /usr/ncvs/src/sys/dev/bktr/bktr_core.c,v retrieving revision 1.118 diff -u -r1.118 bktr_core.c --- bktr_core.c 14 Mar 2002 01:32:21 -0000 1.118 +++ bktr_core.c 28 Mar 2002 09:15:56 -0000 @@ -962,7 +962,7 @@ bktr->flags |= METEOR_OPEN; #ifdef BT848_DUMP - dump_bt848( bt848 ); + dump_bt848(bktr); #endif bktr->clr_on_start = FALSE; @@ -1640,7 +1640,7 @@ BT848_INT_VSYNC | BT848_INT_FMTCHG); #ifdef BT848_DUMP - dump_bt848( bt848 ); + dump_bt848(bktr); #endif break; @@ -2473,7 +2473,7 @@ /* * */ -#ifdef BT848_DEBUG +#if defined(BT848_DEBUG) || defined(BT848_DUMP) static int dump_bt848( bktr_ptr_t bktr ) { @@ -2493,7 +2493,7 @@ r[i], INL(bktr, r[i]), r[i+1], INL(bktr, r[i+1]), r[i+2], INL(bktr, r[i+2]), - r[i+3], INL(bktr, r[i+3]])); + r[i+3], INL(bktr, r[i+3])); } printf("%s: INT STAT %x \n", bktr_name(bktr), @@ -3657,28 +3657,26 @@ /* - * + * Set the temporal decimation register to get the desired frame rate. + * We use the 'skip frame' modus always and always start dropping on an + * odd field. */ static void set_fps( bktr_ptr_t bktr, u_short fps ) { struct format_params *fp; - int i_flag; fp = &format_params[bktr->format_params]; switch(bktr->flags & METEOR_ONLY_FIELDS_MASK) { case METEOR_ONLY_EVEN_FIELDS: bktr->flags |= METEOR_WANT_EVEN; - i_flag = 1; break; case METEOR_ONLY_ODD_FIELDS: bktr->flags |= METEOR_WANT_ODD; - i_flag = 1; break; default: bktr->flags |= METEOR_WANT_MASK; - i_flag = 2; break; } @@ -3689,7 +3687,7 @@ OUTB(bktr, BKTR_TDEC, 0); if (fps < fp->frame_rate) - OUTB(bktr, BKTR_TDEC, i_flag*(fp->frame_rate - fps) & 0x3f); + OUTB(bktr, BKTR_TDEC, (fp->frame_rate - fps) & 0x3f); else OUTB(bktr, BKTR_TDEC, 0); return; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203280925.g2S9PD413433>