Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Mar 2003 19:48:05 -0300
From:      Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
To:        Stephen Hilton <nospam@hiltonbsd.com>
Cc:        freebsd-multimedia@FreeBSD.ORG, eta@lclark.edu
Subject:   Re: XFree86 4.3.0 and Ogle problems
Message-ID:  <20030309224827.83555.qmail@exxodus.fedaykin.here>
In-Reply-To: <20030309142855.4decdf61.nospam@hiltonbsd.com>
References:  <20030307115331.60e8c169.nospam@hiltonbsd.com> <20030307132513.1daa8d8b.nospam@hiltonbsd.com> <20030308155929.5fc8fb17.nospam@hiltonbsd.com> <20030309161912.5407.qmail@exxodus.fedaykin.here> <20030309142855.4decdf61.nospam@hiltonbsd.com>

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

--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

	I worked with Ogle developer Bjrn Englund about this.

On Sun, Mar 09, 2003 at 02:28:33PM -0600, Stephen Hilton wrote:

[snip]

> #!!#!!#!!#!!!display: frame rate: 29.207 fps
> !display: frame rate: 29.531 fps
> +SNDCTL_DSP_SETFRAGMENT: Invalid argument
> SNDCTL_DSP_SETFMT: Invalid argument
> FATAL[ogle_audio]: ogle_ao_init: ----!#!#!!#!!#!!#!!#-!!#!!#!!#!-!#!!#!-!#!!#!!#!!--#!!#!!-!!#!!#!!#!!-#!!!!#!!-#-!!#!!#!!#!!#!!#!!!-!#!!#!!#!!!!#-!!#!!!!#!!#!-!!!#!!#!!--#!!#!!!!#!!#!!#!!--##!!!!#!!#!!#!!#-!!#!!#!!#!!###!!#!!#!!#!!#!!##!!#-!!#!!#!!-#!!#!-!#-!!#!!#!!#!!#-!!#!!#!!#!!#!!#!!#!!-#!!#!!-#!!#!-!#!!#!-!#!!#!!-###!!#!!#-!!#!!##!!-#!!#!!#!!#-!!#!!#!!-#-!!#!!#!!#--!!#!!#!!-!!#!!#!--!#!!#!!#!!#!!#-!!###!-!-!#!--#---!!##!!#!!#!!#SNDCTL_DSP_SETFRAGMENT: Invalid argument

[snip]

	You were very fortunate (or, unfortunate hehe) that I have
the exact same audio chipset. I was able to reproduce the problem
with a DVD. We tracked this down to a audio driver problem from the
audio/aureal-kmod port. We're blaming the driver since no one else
complained about this. The audio driver should be the best person
to let us know what is wrong.

	Diagnostic. Both SNDCTL_DSP_SETFRAGMENT and SNDCTL_DSP_SETFMT
are due to a fail from the aureal audio driver to reinitialize the
driver after a SNDCTL_DSP_SYNC call. Instead of using that call, I
replaced it with a workaround: closing then opening again the audio
device. This fixed it but there are some issues with this approach.
Therefore, we should investigate if the driver author can work around
this.

	I've attached a patch that should fix this problem temporarily.
Furthermore, it adds a lot of debug output.

	1) copy the ogle port somewhere 

	# cp -Rp /usr/ports/multimedia/ogle /tmp

	2) copy the patch to this temporary port copy

	# cp patch-libogleao::oss_audio.c /tmp/ogle/files

	3) uninstall ogle

	4) install the temporary ogle port copy

	# cd /tmp/ogle && make install


	Let me know how this works out.

	Regards,

-- 
Mario S F Ferreira - DF - Brazil - "I guess this is a signature."
Computer Science Undergraduate | FreeBSD Committer | CS Developer
flames to beloved devnull@someotherworldbeloworabove.org
feature, n: a documented bug | bug, n: an undocumented feature

--6TrnltStXW4iwmi0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="patch-libogleao::oss_audio.c"

--- libogleao/oss_audio.c.orig	Sun Mar  9 17:51:13 2003
+++ libogleao/oss_audio.c	Sun Mar  9 19:34:36 2003
@@ -74,12 +74,25 @@
   uint16_t fragment_size;
   audio_buf_info info;
   
+/*
   if(instance->initialized) {
-    // SNDCTL_DSP_SYNC resets the audio device so we can set new parameters
+    printf("[instance->initialized]\n");
     ioctl(instance->fd, SNDCTL_DSP_SYNC, 0);
     instance->initialized = 0;
   }
+*/
 
+/* Close and then reopen the audio device */
+  if(instance->initialized) {
+    close(instance->fd);
+    (instance->fd) = open("/dev/dsp", O_WRONLY, 0);
+    instance->initialized = 0;
+
+    if ((instance->fd) < 0) {
+	printf("Cannot access /dev/dsp device\n");
+	return -1;
+    }
+  }
 
   // set fragment size if requested
   // can only be done once after open
@@ -103,8 +116,8 @@
     fragment = (nr_fragments << 16) | fragment_size;
     
     if(ioctl(instance->fd, SNDCTL_DSP_SETFRAGMENT, &fragment) == -1) {
+      printf("===> fragment = [%d]\n", fragment);
       perror("SNDCTL_DSP_SETFRAGMENT");
-      //this is not fatal
     }
   }
 
@@ -137,8 +150,10 @@
     return -1;
     break;
   }
+
   original_sample_format = sample_format;
   if(ioctl(instance->fd, SNDCTL_DSP_SETFMT, &sample_format) == -1) {
+    printf("===> sample_format = [%d]\n", sample_format);
     perror("SNDCTL_DSP_SETFMT");
     return -1;
   }
@@ -171,6 +186,7 @@
     int chmask;
     if(ioctl(instance->fd, SNDCTL_DSP_GETCHANNELMASK, &chmask) == -1) {
       //driver doesn't support this, assume it does 2ch stereo
+      printf("===> chmask = [%d]\n", chmask);
       perror("SNDCTL_DSP_GETCHANNELMASK");
       audio_info->chtypes = OGLE_AO_CHTYPE_LEFT | OGLE_AO_CHTYPE_RIGHT;
       audio_info->channels = 2;
@@ -214,6 +230,7 @@
 
   number_of_channels = audio_info->channels;
   if(ioctl(instance->fd, SNDCTL_DSP_CHANNELS, &number_of_channels) == -1) {
+      printf("===> number_of_channels = [%d]\n", number_of_channels);
     perror("SNDCTL_DSP_CHANNELS");
     audio_info->channels = -1;
     return -1;
@@ -243,6 +260,7 @@
 
   sample_speed = audio_info->sample_rate;
   if(ioctl(instance->fd, SNDCTL_DSP_SPEED, &sample_speed) == -1) {
+      printf("===> sample_speed = [%d]\n", sample_speed);
     perror("SNDCTL_DSP_SPEED");
     audio_info->sample_rate = -1;
     return -1;
@@ -261,6 +279,7 @@
   
   
   if(ioctl(instance->fd, SNDCTL_DSP_GETOSPACE, &info) == -1) {
+      printf("===> info = [%d]\n", info);
     perror("SNDCTL_DSP_GETOSPACE");
     audio_info->fragment_size = -1;
     audio_info->fragments = -1;
@@ -296,6 +315,7 @@
 
   sample_format = instance->fmt;
   if(ioctl(instance->fd, SNDCTL_DSP_SETFMT, &sample_format) == -1) {
+    printf("===> sample_format = [%d]\n", sample_format);
     perror("SNDCTL_DSP_SETFMT");
     return -1;
   }
@@ -306,6 +326,7 @@
   
   nr_channels = instance->channels;
   if(ioctl(instance->fd, SNDCTL_DSP_CHANNELS, &nr_channels) == -1) {
+      printf("===> nr_channels = [%d]\n", nr_channels);
     perror("SNDCTL_DSP_CHANNELS");
     return -1;
   }
@@ -316,6 +337,7 @@
 
   sample_speed = instance->speed;
   if(ioctl(instance->fd, SNDCTL_DSP_SPEED, &sample_speed) == -1) {
+      printf("===> sample_speed = [%d]\n", sample_speed);
     perror("SNDCTL_DSP_SPEED");
     return -1;
   }
@@ -325,6 +347,7 @@
   }
   
   if(ioctl(instance->fd, SNDCTL_DSP_GETOSPACE, &info) == -1) {
+      printf("===> info = [%d]\n", info);
     perror("SNDCTL_DSP_GETOSPACE");
   } else {
     if(instance->fragment_size != info.fragsize) {
@@ -363,6 +386,7 @@
 
   res = ioctl(instance->fd, SNDCTL_DSP_GETODELAY, &odelay);
   if(res == -1) {
+      printf("===> odelay = [%d]\n", odelay);
     perror("SNDCTL_DSP_GETODELAY");
     return -1;
   }

--6TrnltStXW4iwmi0--

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?20030309224827.83555.qmail>