Date: Wed, 1 Oct 2008 21:08:14 +0400 From: Chagin Dmitry <dchagin@freebsd.org> To: Tijl Coosemans <tijl@ulyssis.org> Cc: freebsd-emulation@freebsd.org Subject: Re: firefox & flash9 patches Message-ID: <20081001170814.GA5962@dchagin.dialup.corbina.ru> In-Reply-To: <200810011852.45247.tijl@ulyssis.org> References: <200810011852.45247.tijl@ulyssis.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 01, 2008 at 06:52:37PM +0200, Tijl Coosemans wrote: > On Monday 29 September 2008 22:02:37 Chagin Dmitry wrote: > > please, test following patches (just -current). > > with them firefox && flash9 forks for me, > > I tested only on ia32@amd64 with 2.6.16 enabled, > > firefox 2.0.0.16 and flash9 plugin. > > > > If all is good, I will ask des@ and kib@ to review&commit them. thnx! > > On 7.1-PRERELEASE, linux 2.4, fc4, the linprocfs patch seems to improve > things a lot. I'm still having crashes from time to time, but overall > flash9 works much better. Great work! > second half of my patch (fooaffinity() related) can't be applied on RELENG_7, I will prepare a patch for RELENG_7, will test? > I've attached the patch for RELENG_7 (patch-linprocfs) and another > patch for libflashsupport [1]. It should improve OSS support, A/V sync > etc. For those without a linux box, I've attached a compiled version of > the lib as well. You can drop it in /compat/linux/usr/lib. > > [1] http://sourceforge.net/projects/flashsupport/ > --- linprocfs.c.orig 2008-10-01 17:47:51.000000000 +0200 > +++ linprocfs.c 2008-10-01 17:49:02.000000000 +0200 > @@ -869,14 +869,12 @@ > static int > linprocfs_doprocmaps(PFS_FILL_ARGS) > { > - char mebuffer[512]; > vm_map_t map = &p->p_vmspace->vm_map; > vm_map_entry_t entry, tmp_entry; > vm_object_t obj, tobj, lobj; > vm_offset_t saved_end; > vm_ooffset_t off = 0; > char *name = "", *freename = NULL; > - size_t len; > ino_t ino; > unsigned int last_timestamp; > int ref_count, shadow_count, flags; > @@ -894,13 +892,9 @@ > if (uio->uio_rw != UIO_READ) > return (EOPNOTSUPP); > > - if (uio->uio_offset != 0) > - return (0); > - > error = 0; > vm_map_lock_read(map); > - for (entry = map->header.next; > - ((uio->uio_resid > 0) && (entry != &map->header)); > + for (entry = map->header.next; entry != &map->header; > entry = entry->next) { > name = ""; > freename = NULL; > @@ -949,7 +943,7 @@ > * format: > * start, end, access, offset, major, minor, inode, name. > */ > - snprintf(mebuffer, sizeof mebuffer, > + error = sbuf_printf(sb, > "%08lx-%08lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n", > (u_long)entry->start, (u_long)entry->end, > (entry->protection & VM_PROT_READ)?"r":"-", > @@ -965,18 +959,11 @@ > ); > if (freename) > free(freename, M_TEMP); > - len = strlen(mebuffer); > - if (len > uio->uio_resid) > - len = uio->uio_resid; /* > - * XXX We should probably return > - * EFBIG here, as in procfs. > - */ > last_timestamp = map->timestamp; > vm_map_unlock_read(map); > - error = uiomove(mebuffer, len, uio); > + if (error == -1) > + return (0); > vm_map_lock_read(map); > - if (error) > - break; > if (last_timestamp + 1 != map->timestamp) { > /* > * Look again for the entry because the map was > --- flashsupport.c.orig 2008-10-01 16:25:02.000000000 +0200 > +++ flashsupport.c 2008-10-01 16:57:58.000000000 +0200 > @@ -44,11 +44,11 @@ > #endif // HAVE_ALSA_ASOUNDLIB_H > > #ifdef HAVE_LINUX_SOUNDCARD_H > -//#define OSS > +#define OSS > #endif // HAVE_LINUX_SOUNDCARD_H > > #ifdef HAVE_LINUX_VIDEODEV_H > -#define V4L1 > +//#define V4L1 > #endif // HAVE_LINUX_VIDEODEV_H > > //////////////////////////////////////////////////////////////////////////////////////////////////// > @@ -736,28 +736,23 @@ > int oss_fd; > pthread_t thread; > int signal; > + char * buf; > + int bsize; > }; > > static void *oss_thread(void *ptr) > { > struct SoundOutput_Instance *instance = (struct SoundOutput_Instance *)ptr; > - char buffer[4096]; > - int len = 0; > int written = 0; > + usleep(100); > for(;;) { > - FPI_SoundOutput_FillBuffer(ptr,buffer,4096); > - len = 4096; > - while ( len ) { > - written = write(instance->oss_fd, buffer, len); > - if ( written >= 0 ) { > - len -= written; > - } > - if ( instance->signal ) { > - pthread_exit(0); > - } > - if ( written < 0 ) { > - usleep(100); > - } > + FPI_SoundOutput_FillBuffer(ptr, instance->buf, instance->bsize); > + written = write(instance->oss_fd, instance->buf, instance->bsize); > + if ( instance->signal ) { > + pthread_exit(0); > + } > + if ( written < 0 ) { > + usleep(100); > } > } > } > @@ -784,12 +779,16 @@ > > if ( ioctl(instance->oss_fd, SNDCTL_DSP_SPEED, &speed) < 0 ) goto fail; > > + if ( ioctl(instance->oss_fd, SNDCTL_DSP_GETBLKSIZE, &instance->bsize) < 0 ) goto fail; > + > + instance->buf = (char *)FPI_Mem_Alloc(instance->bsize); > + > if ( pthread_create(&instance->thread, 0, oss_thread, instance) < 0 ) goto fail; > > return instance; > fail: > if ( instance ) { > - if ( FPI_Mem_Free ) FPI_Mem_Free(instance); > + FPX_SoundOutput_Close(instance); > } > return 0; > } > @@ -803,18 +802,19 @@ > > instance->signal = 1; > > - if ( instance->oss_fd ) { > - ioctl(instance->oss_fd, SNDCTL_DSP_RESET, 0); > - } > - > if ( instance->thread ) { > pthread_join(instance->thread,&retVal); > } > > if ( instance->oss_fd ) { > + ioctl(instance->oss_fd, SNDCTL_DSP_RESET, 0); > close(instance->oss_fd); > } > > + if ( instance->buf ) { > + if ( FPI_Mem_Free ) FPI_Mem_Free(instance->buf); > + } > + > if ( FPI_Mem_Free ) FPI_Mem_Free(instance); > > return 0; > @@ -827,10 +827,10 @@ > struct SoundOutput_Instance *instance = (struct SoundOutput_Instance *)ptr; > if ( instance->oss_fd ) { > int value = 0; > - if ( ( value = ioctl(instance->oss_fd,SNDCTL_DSP_GETODELAY,&value) ) == 0 ) { > - return value / 4; > + if ( ioctl(instance->oss_fd,SNDCTL_DSP_GETODELAY,&value) == -1 ) { > + return 0; > } > - return 0; > + return value / 4; > } > return -1; > } I don't have soundcard, so I can't test it :) thnx! -- Have fun! chd
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081001170814.GA5962>