Commit 054b90aa authored by Christophe Massiot's avatar Christophe Massiot

* Fixed intf_eject for iPAQ (untested)

* asm memcpyaltivec for Linux/PPC
parent d94ba355
This diff is collapsed.
...@@ -166,7 +166,7 @@ AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h sys/times.h) ...@@ -166,7 +166,7 @@ AC_CHECK_HEADERS(sys/sockio.h fcntl.h sys/time.h sys/times.h)
AC_CHECK_HEADERS(dlfcn.h image.h) AC_CHECK_HEADERS(dlfcn.h image.h)
AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h) AC_CHECK_HEADERS(arpa/inet.h net/if.h netinet/in.h sys/socket.h)
AC_CHECK_HEADERS(machine/param.h sys/shm.h) AC_CHECK_HEADERS(machine/param.h sys/shm.h)
AC_CHECK_HEADERS(scsi/scsi_ioctl.h) AC_CHECK_HEADERS(linux/version.h)
AC_HEADER_TIME AC_HEADER_TIME
...@@ -378,9 +378,9 @@ MMX_MODULES="memcpymmx idctmmx motionmmx chroma_i420_rgb_mmx chroma_i420_yuy2_mm ...@@ -378,9 +378,9 @@ MMX_MODULES="memcpymmx idctmmx motionmmx chroma_i420_rgb_mmx chroma_i420_yuy2_mm
MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext" MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn" THREEDNOW_MODULES="memcpy3dn imdct3dn downmix3dn"
if test x$SYS != xmingw32; then if test x$SYS != xmingw32; then
SSE_MODULES="imdctsse downmixsse" SSE_MODULES="imdctsse downmixsse"
fi fi
ALTIVEC_MODULES="idctaltivec motionaltivec" ALTIVEC_MODULES="idctaltivec motionaltivec memcpyaltivec"
AC_CACHE_CHECK([if \$CC groks MMX inline assembly], AC_CACHE_CHECK([if \$CC groks MMX inline assembly],
[ac_cv_mmx_inline], [ac_cv_mmx_inline],
...@@ -435,6 +435,7 @@ if test x"$ac_cv_altivec_inline" != x"no"; then ...@@ -435,6 +435,7 @@ if test x"$ac_cv_altivec_inline" != x"no"; then
if test x"$ac_cv_altivec_inline" != x"yes"; then if test x"$ac_cv_altivec_inline" != x"yes"; then
CFLAGS_IDCTALTIVEC="$CFLAGS_IDCTALTIVEC $ac_cv_altivec_inline" CFLAGS_IDCTALTIVEC="$CFLAGS_IDCTALTIVEC $ac_cv_altivec_inline"
CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_altivec_inline" CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_altivec_inline"
CFLAGS_MEMCPYALTIVEC="$CFLAGS_MEMCPYALTIVEC $ac_cv_altivec_inline"
CFLAGS_VLC="$CFLAGS_VLC $ac_cv_altivec_inline" CFLAGS_VLC="$CFLAGS_VLC $ac_cv_altivec_inline"
fi fi
ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}" ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
...@@ -460,7 +461,7 @@ if test x"$ac_cv_c_altivec" != x"no"; then ...@@ -460,7 +461,7 @@ if test x"$ac_cv_c_altivec" != x"no"; then
CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_c_altivec" CFLAGS_MOTIONALTIVEC="$CFLAGS_MOTIONALTIVEC $ac_cv_c_altivec"
CFLAGS_MEMCPYALTIVEC="$CFLAGS_MEMCPYALTIVEC $ac_cv_c_altivec" CFLAGS_MEMCPYALTIVEC="$CFLAGS_MEMCPYALTIVEC $ac_cv_c_altivec"
CFLAGS_VLC="$CFLAGS_VLC $ac_cv_c_altivec" CFLAGS_VLC="$CFLAGS_VLC $ac_cv_c_altivec"
ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES} memcpyaltivec" ACCEL_MODULES="${ACCEL_MODULES} ${ALTIVEC_MODULES}"
fi fi
AC_CACHE_CHECK([if linker needs -framework vecLib], AC_CACHE_CHECK([if linker needs -framework vecLib],
......
/* include/defs.h.in. Generated automatically from configure.in by autoheader 2.13. */ /* include/defs.h.in. Generated automatically from configure.in by autoheader. */
/* Define if using alloca.c. */ /* Define if using alloca.c. */
#undef C_ALLOCA #undef C_ALLOCA
...@@ -226,6 +226,9 @@ ...@@ -226,6 +226,9 @@
/* Define if you have the <linux/fb.h> header file. */ /* Define if you have the <linux/fb.h> header file. */
#undef HAVE_LINUX_FB_H #undef HAVE_LINUX_FB_H
/* Define if you have the <linux/version.h> header file. */
#undef HAVE_LINUX_VERSION_H
/* Define if you have the <locale.h> header file. */ /* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H #undef HAVE_LOCALE_H
...@@ -256,9 +259,6 @@ ...@@ -256,9 +259,6 @@
/* Define if you have the <pthread.h> header file. */ /* Define if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H #undef HAVE_PTHREAD_H
/* Define if you have the <scsi/scsi_ioctl.h> header file. */
#undef HAVE_SCSI_SCSI_IOCTL_H
/* Define if you have the <soundcard.h> header file. */ /* Define if you have the <soundcard.h> header file. */
#undef HAVE_SOUNDCARD_H #undef HAVE_SOUNDCARD_H
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* memcpy.c : classic memcpy module * memcpy.c : classic memcpy module
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: memcpyaltivec.c,v 1.1 2002/04/03 22:36:50 massiot Exp $ * $Id: memcpyaltivec.c,v 1.2 2002/04/04 22:08:05 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -70,8 +70,8 @@ static void memcpy_getfunctions( function_list_t * p_function_list ) ...@@ -70,8 +70,8 @@ static void memcpy_getfunctions( function_list_t * p_function_list )
} }
#else #else
# include <sys/types.h>
# define _M( toto ) toto # define _M( toto ) toto
typedef unsigned long size_t;
#endif /* __BUILD_ALTIVEC_ASM__ */ #endif /* __BUILD_ALTIVEC_ASM__ */
#if defined(CAN_COMPILE_C_ALTIVEC) || defined( __BUILD_ALTIVEC_ASM__ ) #if defined(CAN_COMPILE_C_ALTIVEC) || defined( __BUILD_ALTIVEC_ASM__ )
...@@ -138,3 +138,86 @@ void * _M( fast_memcpy )(void * _to, const void * _from, size_t len) ...@@ -138,3 +138,86 @@ void * _M( fast_memcpy )(void * _to, const void * _from, size_t len)
} }
#endif #endif
#if !defined(CAN_COMPILE_C_ALTIVEC) && !defined(__BUILD_ALTIVEC_ASM__)
/*
* The asm code is generated with:
*
* gcc-2.95 -fvec -D__BUILD_ALTIVEC_ASM__ -O9 -fomit-frame-pointer -mregnames -S * memcpyaltivec.c
*
* sed 's/.L/._L/g' memcpyaltivec.s |
* awk '{args=""; len=split ($2, arg, ",");
* for (i=1; i<=len; i++) { a=arg[i]; if (i<len) a=a",";
* args = args sprintf ("%-6s", a) }
* printf ("\t\"\t%-16s%-24s\\n\"\n", $1, args) }' |
* unexpand -a
*/
void * _M( fast_memcpy )(void * _to, const void * _from, size_t len)
{
asm (" \n"
" stwu %r1, -32(%r1) \n"
" mflr %r0 \n"
" stw %r28, 16(%r1) \n"
" stw %r29, 20(%r1) \n"
" stw %r30, 24(%r1) \n"
" stw %r31, 28(%r1) \n"
" stw %r0, 36(%r1) \n"
" mr %r29, %r5 \n"
" cmplwi %cr0, %r29, 16 \n"
" mr %r28, %r3 \n"
" mr %r31, %r4 \n"
" bc 4, 1, ._L3 \n"
" andi. %r30, %r28, 15 \n"
" bc 12, 2, ._L4 \n"
" subfic %r30, %r30, 16 \n"
" mr %r5, %r30 \n"
" crxor 6, 6, 6 \n"
" bl memcpy \n"
" add %r31, %r31, %r30 \n"
" subf %r29, %r30, %r29 \n"
" add %r3, %r28, %r30 \n"
" ._L4: \n"
" rlwinm. %r0, %r29, 0, 0, 27 \n"
" bc 12, 2, ._L3 \n"
" li %r9, 15 \n"
" lvsl %v12, 0, %r31 \n"
" lvx %v1, 0, %r31 \n"
" lvx %v0, %r9, %r31 \n"
" addi %r31, %r31, 16 \n"
" vperm %v13, %v1, %v0, %v12 \n"
" addi %r29, %r29, -16 \n"
" ._L9: \n"
" addi %r29, %r29, -16 \n"
" li %r9, 15 \n"
" lvx %v1, 0, %r31 \n"
" lvx %v0, %r9, %r31 \n"
" rlwinm. %r0, %r29, 0, 0, 27 \n"
" stvx %v13, 0, %r3 \n"
" vperm %v13, %v1, %v0, %v12 \n"
" addi %r31, %r31, 16 \n"
" addi %r3, %r3, 16 \n"
" bc 4, 2, ._L9 \n"
" stvx %v13, 0, %r3 \n"
" ._L3: \n"
" cmpwi %cr0, %r29, 0 \n"
" bc 12, 2, ._L10 \n"
" mr %r4, %r31 \n"
" mr %r5, %r29 \n"
" crxor 6, 6, 6 \n"
" bl memcpy \n"
" ._L10: \n"
" mr %r3, %r28 \n"
" lwz %r0, 36(%r1) \n"
" mtlr %r0 \n"
" lwz %r28, 16(%r1) \n"
" lwz %r29, 20(%r1) \n"
" lwz %r30, 24(%r1) \n"
" lwz %r31, 28(%r1) \n"
" la %r1, 32(%r1) \n"
" blr \n"
);
}
#endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_eject.c: CD/DVD-ROM ejection handling functions * intf_eject.c: CD/DVD-ROM ejection handling functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: intf_eject.c,v 1.8 2002/04/04 05:08:05 sam Exp $ * $Id: intf_eject.c,v 1.9 2002/04/04 22:08:05 massiot Exp $
* *
* Author: Julien Blache <jb@technologeek.org> for the Linux part * Author: Julien Blache <jb@technologeek.org> for the Linux part
* with code taken from the Linux "eject" command * with code taken from the Linux "eject" command
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
# include <dvd.h> # include <dvd.h>
#endif #endif
#ifdef SYS_LINUX #if defined(SYS_LINUX) && defined(HAVE_LINUX_VERSION_H)
# include <linux/version.h> # include <linux/version.h>
/* handy macro found in 2.1 kernels, but not in older ones */ /* handy macro found in 2.1 kernels, but not in older ones */
# ifndef KERNEL_VERSION # ifndef KERNEL_VERSION
...@@ -60,17 +60,15 @@ ...@@ -60,17 +60,15 @@
# include <linux/ucdrom.h> # include <linux/ucdrom.h>
# endif # endif
# ifdef HAVE_SCSI_SCSI_IOCTL_H # include <scsi/scsi.h>
# include <scsi/scsi.h> # include <scsi/sg.h>
# include <scsi/sg.h> # include <scsi/scsi_ioctl.h>
# include <scsi/scsi_ioctl.h>
# endif
#endif #endif
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
#if defined(SYS_LINUX) && defined(HAVE_SCSI_SCSI_IOCTL_H) #if defined(SYS_LINUX) && defined(HAVE_LINUX_VERSION_H)
static int EjectSCSI ( int i_fd ); static int EjectSCSI ( int i_fd );
#endif #endif
...@@ -141,16 +139,14 @@ int intf_Eject( const char *psz_device ) ...@@ -141,16 +139,14 @@ int intf_Eject( const char *psz_device )
return 1; return 1;
} }
#ifdef SYS_LINUX #if defined(SYS_LINUX) && defined(HAVE_LINUX_VERSION_H)
/* Try a simple ATAPI eject */ /* Try a simple ATAPI eject */
i_ret = ioctl( i_fd, CDROMEJECT, 0 ); i_ret = ioctl( i_fd, CDROMEJECT, 0 );
#ifdef HAVE_SCSI_SCSI_IOCTL_H
if( i_ret != 0 ) if( i_ret != 0 )
{ {
i_ret = EjectSCSI( i_fd ); i_ret = EjectSCSI( i_fd );
} }
#endif
if( i_ret != 0 ) if( i_ret != 0 )
{ {
...@@ -172,7 +168,7 @@ int intf_Eject( const char *psz_device ) ...@@ -172,7 +168,7 @@ int intf_Eject( const char *psz_device )
/* The following functions are local */ /* The following functions are local */
#if defined(SYS_LINUX) && defined(HAVE_SCSI_SCSI_IOCTL_H) #if defined(SYS_LINUX) && defined(HAVE_LINUX_VERSION_H)
/***************************************************************************** /*****************************************************************************
* Eject using SCSI commands. Return 0 if successful * Eject using SCSI commands. Return 0 if successful
*****************************************************************************/ *****************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment