[FFmpeg-devel] [PATCH] AltiVec detection support for OpenBSD

Diego Biurrun diego
Mon Sep 22 07:39:35 CEST 2008


On Sun, Sep 21, 2008 at 07:13:52PM -0400, Brad wrote:
> On Mon, Sep 22, 2008 at 12:50:39AM +0200, Diego Biurrun wrote:
> > On Sat, Sep 20, 2008 at 11:49:58PM -0400, Brad wrote:
> > > The following diff adds support for detecting the presence of
> > > AltiVec for OpenBSD.
> > > 
> > > 
> > > --- libavcodec/ppc/check_altivec.c.orig	Sat Sep 20 12:27:25 2008
> > > +++ libavcodec/ppc/check_altivec.c	Sat Sep 20 22:52:16 2008
> > > @@ -45,8 +49,12 @@ int has_altivec(void)
> > >      IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE);
> > >      if (result == VECTORTYPE_ALTIVEC) return 1;
> > >      return 0;
> > > -#elif __APPLE__
> > > +#elif defined(__APPLE__) || defined(__OpenBSD__)
> > > +#ifdef __OpenBSD__
> > > +    int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
> > > +#else
> > >      int sels[2] = {CTL_HW, HW_VECTORUNIT};
> > > +#endif
> > 
> > Just add another #elif block, not a complete #ifdef #endif.
> 
> --- libavcodec/ppc/check_altivec.c.orig	Sat Sep 20 12:27:25 2008
> +++ libavcodec/ppc/check_altivec.c	Sun Sep 21 19:08:49 2008
> @@ -47,6 +51,16 @@ int has_altivec(void)
>      return 0;
>  #elif __APPLE__
>      int sels[2] = {CTL_HW, HW_VECTORUNIT};
> +    int has_vu = 0;
> +    size_t len = sizeof(has_vu);
> +    int err;
> +
> +    err = sysctl(sels, 2, &has_vu, &len, NULL, 0);
> +
> +    if (err == 0) return has_vu != 0;
> +    return 0;
> +#elif __OpenBSD__
> +    int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
>      int has_vu = 0;
>      size_t len = sizeof(has_vu);
>      int err;

OK, I had misread your previous patch, applied.

Diego




More information about the ffmpeg-devel mailing list