Merge svn changes up to r27458

This commit is contained in:
Uoti Urpala 2008-08-12 15:03:34 +03:00
commit e09fe1ce04
19 changed files with 689 additions and 59 deletions

View File

@ -11,6 +11,8 @@ MPlayer (1.0)
EA Maxis XA ADPCM audio, RL2 video, Beam Software SIFF video, V.Flash PTX video
* AVOption support for libavcodec-based decoders
* image decoders: Sun rasterfile, PCX image
* MLP decoder via lavc
* use lavc ADPCM codecs by default
Demuxers:
* -lavfdopts cryptokey allows decrypting MXF and ASF files
@ -26,6 +28,7 @@ MPlayer (1.0)
* support MOV subtitle format
* support for attachments in lavf demuxer
* support for chapters in lavf demuxer
* Flac speedup in lavf demuxer
Filters:
* vf_ow new overcomplete wavelet denoiser
@ -43,21 +46,26 @@ MPlayer (1.0)
FFmpeg/libavcodec:
* DNxHD (SMPTE VC-3) encoder
* H.264 speedup and PAFF decoding
* correctly decode more of the H.264 conformance testsuite
* Nellymoser audio codec
* VC-1/WMV3 MMX optimizations
* VP3 decoder speedup
* Split-Radix FFT (speedup multiple audio codecs)
* MMX/SSE/ARM and other misc speedups
libmpeg2:
* enable Alpha/ARM optimizations in libmpeg2
* SSE2-optimized IDCT routines from upstream libmpeg2
* synced with upstream
Drivers:
* replace PolypAudio by PulseAudio (-ao pulse)
* add force-pbo suboption for faster output in vo_gl
* add Nintendo Wii/GameCube video driver (-vo wii)
* VIDIX driver for SuperH Mobile VEU hardware block.
* support -border on vo_gl/gl2 in x11
MEncoder:
* Ogg muxing using -of lavf -o done.ogg
* check for system-wide configuration file in MEncoder
* AVOption support for lavc encoders
* AVOption support for lavf muxers
@ -73,12 +81,15 @@ MPlayer (1.0)
* add options to disable some or all configuration files
* support for DOS-style file:///x:/path paths
* some new slave commands (check DOCS/tech/slave.txt)
* misc fixes to libass
Ports:
* small crash with vo_macosx fixed
* AC3/DTS passthrough for ao_macosx
* fix frozen OSD on Mac OS X
* vo_gl now works with -wid and nVidia drivers on Windows (this is a hack)
* VIDIX on SuperH.
* intentionally break gcc 3.3 on mac os x, please use 4.x
rc2try2:

View File

@ -3459,8 +3459,9 @@ Very fast video output driver on cards that support it.
.RSs
.IPs <subdevice>
Explicitly choose the VIDIX subdevice driver to use.
Available subdevice drivers are cyberblade, mach64,
mga_crtc2, mga, nvidia, pm2, pm3, radeon, rage128, sis_vid and unichrome.
Available subdevice drivers are cyberblade, ivtv, mach64,
mga_crtc2, mga, nvidia, pm2, pm3, radeon, rage128, s3, sh_veu,
sis_vid and unichrome.
.RE
.PD 1
.

View File

@ -3229,7 +3229,7 @@ Corrige le basculement en mode plein-
.
.TP
.B \-geometry x[%][:y[%]] ou [WxH][+x+y]
Ajuste la position d'origine sur l'écran de la sortie.
Ajuste la position d'origine sur l'écran de sortie.
Les variables x et y sont en pixels mesurés à partir du coin supérieur droit
de l'écran jusqu'au coin supérieur droit de la vidéo affichée, cependant si
un signe pourcentage est indiqué après la variable, cette valeur est alors
@ -3417,7 +3417,7 @@ Utile pour int
par exemple).
.
.TP
.B \-xineramascreen <\-2\-...> (X11 uniquement)
.B \-xineramascreen <\-2\-...>
Dans les configurations xinerama (c'est à dire un bureau unique s'étendant sur
plusieurs écrans, cette option dit à MPlayer sur quel écran afficher le film.
La valeur \-2 signifie plein écran sur la totalité de l'écran virtuel, (dans ce
@ -3427,6 +3427,9 @@ La position initiale d
défini.
Fontionnera généralement uniquement avec "\-fstype \-fullscreen" ou
"\-fstype none".
Cette option ne convient pour définir l'écran de démarrage (de même pour
l'écran en mode plein écran), \-geometry est plus approprié.
Géré par les pilotes de sortie vidéo gl, gl2, x11, et xv.
.
.TP
.B \-zrbw (\-vo zr uniquement)
@ -3647,8 +3650,9 @@ Pilote de sortie vid
.RSs
.IPs <sous-périphérique>
Choisi explicitement le sous-périphérique à utiliser.
Les pilotes de sous-périphérique existant sont cyberblade,
mach64, mga_crtc2, mga, nvidia, pm2, pm3, radeon, rage128, sis et unichrome.
Les pilotes de sous-périphérique existant sont cyberblade, ivtv,
mach64, mga_crtc2, mga, nvidia, pm2, pm3, radeon, rage128, s3, sh_veu,
sis et unichrome.
.RE
.PD 1
.
@ -8655,25 +8659,14 @@ plus les quantum seront semblables d'une trame
.B vqcomp=<0.0\-1.0>
Compression quantum, vrc_eq dépend de cette option (passe 1/2)
(par défaut\ : 0.5).
Par exemple, en prenant l'équation de contrôle de flux (rate control) par
défaut, si vqcomp=1.0, le contrôle de flux alloue à chaque trame le nombre
de bits nécessaire pour qu'elles soient toutes encodées avec le même quantum
(que cela soit nécessaire ou non).
Si vqcomp=0.0, le contrôle de flux alloue à chaque trame le même nombre de
bits, c-à-d un encodage à débit binaire strictement constant.
.I NOTE\ :
Ceci sont des exemples extrêmes et ne devraient jamais être utilisées.
La qualité subjective étant optimale pour des valeurs entre ces deux extrêmes.
La qualité subjective sera optimale pour des valeurs entre ces deux extrêmes.
.
.TP
.B vrc_eq=<équation>
équation principale de contrôle de débit (passe 1/2)
.RE
.RSs
.IPs "1\ \ \ \ "
constant bitrate
.IPs "tex\ \ "
qualité constante
.IPs 1+(tex/\:avgTex-1)*qComp
approximativement l'équation de l'ancien code de contrôle de débit
.IPs tex^qComp

View File

@ -1,4 +1,4 @@
.\" sync with en/mplayer.1 r27132
.\" sync with en/mplayer.1 r27348
.\" Encoding: UTF-8
.\" Reminder of hard terms which need better/final solution later:
.\" /capture; playtree in parent list; colorkey; retrace; desync; downmix;
@ -73,7 +73,7 @@ mencoder \- 影视编解码器
.
.br
.B mplayer
[dvd|dvdnav]://[标题|[开始标题]\-结束标题]
[dvd|dvdnav]://[标题|[开始标题]\-结束标题][/设备]
[选项]
.
.br
@ -835,7 +835,7 @@ MOUSE_BTN0\-MOUSE_BTN0_DBL。
xv, xvidix 和 dfbmga。
.
.TP
.B \-framedrop也请参见 \-hardframedrop指定 -no-correct-pts 时只可用于实验)
.B \-framedrop也请参见 \-hardframedrop使用 \-nocorrect\-pts 时只可用于实验)
跳过显示一些帧从而在慢的机器上保持 A/V 同步。
视频滤镜不会应用到这些帧上。对于 B-帧 甚至解码也完全跳过。
.
@ -849,7 +849,7 @@ xv, xvidix 和 dfbmga。
显示简短的选项概要。
.
.TP
.B \-hardframedrop指定 -no-correct-pts 时只可用于实验)
.B \-hardframedrop使用 \-nocorrect\-pts 时只可用于实验)
更加密集的丢帧(中断解码过程)。将导致图像失真!
注意libmpeg2 解码器尤其可能在使用该选项后崩溃,所以请考虑使用
\-vc ffmpeg12,”。
@ -986,6 +986,10 @@ n 大小的 FIFO 能容纳 (n\-1) 缓冲事件。
必须选择 DVD 菜单中的按钮。
.
.TP
.B \-noar
关闭对于 AppleIR 的支持。
.
.TP
.B \-noconsolecontrols
阻止 MPlayer 读取标准输入的键盘事件。
读取标准输入的数据时有用。命令行中发现 \- 会自动启用。
@ -1002,10 +1006,6 @@ n 大小的 FIFO 能容纳 (n\-1) 缓冲事件。
关闭支持 LIRC。
.
.TP
.B \-noar
关闭对于苹果 IR 遥控器的支持。
.
.TP
.B \-nomouseinput
停用鼠标键 按/\:放 输入 (mozplayerxp 的上下文菜单依赖此选项)。
.
@ -2701,7 +2701,6 @@ If not specified mplayer will search the first usable card.
.B \-border
使用窗口边框和装饰来播放电影。
既然默认是启用, 使用 \-noborder 停用标准的窗口装饰。
被 directx 视频输出驱动支持。
.
.TP
.B \-brightness <\-100\-100>
@ -3035,13 +3034,19 @@ ggi 和 gl2 的都支持此功能。
把 MPlayer 嵌入浏览器(比如 plugger 扩展)时有用。
.
.TP
.B \-xineramascreen <\-2\-...> (仅用于 X11)
.B \-xineramascreen <\-2\-...>
在 Xinerama 配置中(就是一个单一桌面展开在多个显示器上),
此选项告诉 MPlayer 把电影显示在哪个屏幕上。
\-2 表示全屏幕展开到整个虚拟的显示屏幕上在这种情况下将完全忽略Xinerama的信
息),\-1 表示在目前窗口所在的显示屏上全屏幕。
通过 \-geometry 选项设置的初始位置是相对于指定屏幕的。
通常只能与 "\-fstype \-fullscreen" 或 "\-fstype none" 一起工作。
该选项不适用于仅仅设置启动屏幕(也不适用于设置全屏屏幕),\-geometry 是目前可用
于此目前的最好选项。
This option is not suitable to only set the startup screen (and not also the
fullscreen screen), \-geometry is the best that is available for that purpose
currently.
Supported by the gl, gl2, x11, and xv video output drivers.
.
.TP
.B \-zrbw (仅用于 \-vo zr)
@ -4983,7 +4988,7 @@ unsigned long long counter /*用于保持同步, 更新每次
.br
该过滤器的工作方式是以正常速度播放 \'stride\' ms 的音频,而消耗的是
\'stride*scale\' ms 的输入音频。
通过把一个跨度域内的 'overlap'% 的内容,与紧接着前一个跨度域的音频混合在一起,把各个
通过把一个跨度域内的 \'overlap\'% 的内容,与紧接着前一个跨度域的音频混合在一起,把各个
跨度域拼接在一起。
也可以让该选项对后 \'search\' ms 的音频作一个短小的统计性分析,以判定最佳的重叠位置。
.PD 0
@ -5011,7 +5016,7 @@ unsigned long long counter /*用于保持同步, 更新每次
设置播放速度改变时的反应。
.RSss
.IPs tempo
改变音频节奏以使其与播放速度同步(默认值)
改变音频节奏以使其与播放速度同步(默认值)
.IPs pitch
抵消过滤器产生的效果。
改变声音间隔而不改变音频节奏。
@ -5020,9 +5025,9 @@ unsigned long long counter /*用于保持同步, 更新每次
.I 警告:
与视频的同步变差。
.IPs both
同时改变节奏和间隔
同时改变节奏和间隔
.IPs none
忽略速度的改变
忽略速度的改变
.RE
.RE
.sp 1
@ -9829,6 +9834,10 @@ Sony 数字视频容器格式
有时需要提高这个值以防止“缓冲下溢”。
.
.TP
.B "o\ \ \ \ \ \ "
FIXME无说明文档
.
.TP
.B packetsize=<size>
所选格式单个数据包的大小,以字节为单位表示。
当将流合并至MPEG[12]的实现格式时,默认值为:
@ -9839,9 +9848,6 @@ Sony 数字视频容器格式
当前只对MPEG[12]有意义单位为秒对于任意出现的流输出流参照计时器SCR和解
码时间戳DTS间的初始差距流分离至解码间的延迟
.
.TP
.B "o\ \ \ \ \ \ "
FIXME没有说明文档
.
.
.

View File

@ -598,6 +598,7 @@ SRCS_MPLAYER-$(VIDIX_PM3) += vidix/pm3_vid.c
SRCS_MPLAYER-$(VIDIX_RADEON) += vidix/radeon_vid.c
SRCS_MPLAYER-$(VIDIX_RAGE128) += vidix/rage128_vid.c
SRCS_MPLAYER-$(VIDIX_S3) += vidix/s3_vid.c
SRCS_MPLAYER-$(VIDIX_SH_VEU) += vidix/sh_veu_vid.c
SRCS_MPLAYER-$(VIDIX_SIS) += vidix/sis_vid.c vidix/sis_bridge.c
SRCS_MPLAYER-$(VIDIX_UNICHROME) += vidix/unichrome_vid.c
@ -1058,7 +1059,13 @@ dhahelperwinclean:
# Do not include dependencies when they are about to be removed anyway
# or if SKIP_DEPS was set to "yes" on the command line.
ifneq ($(MAKECMDGOALS),distclean)
ifneq ($(SKIP_DEPS),yes)
-include $(DEPS)
endif
endif
.PHONY: all doxygen *install* *tools drivers dhahelper*
.PHONY: checkheaders *clean dep depend tests

View File

@ -139,7 +139,6 @@ const m_option_t tvopts_conf[]={
};
#endif /* CONFIG_TV */
#ifdef CONFIG_PVR
extern int pvr_param_aspect_ratio;
extern int pvr_param_sample_rate;
extern int pvr_param_audio_layer;
@ -150,6 +149,7 @@ extern char *pvr_param_bitrate_mode;
extern int pvr_param_bitrate_peak;
extern char *pvr_param_stream_type;
#ifdef CONFIG_PVR
const m_option_t pvropts_conf[]={
{"aspect", &pvr_param_aspect_ratio, CONF_TYPE_INT, 0, 1, 4, NULL},
{"arate", &pvr_param_sample_rate, CONF_TYPE_INT, 0, 32000, 48000, NULL},
@ -164,11 +164,7 @@ const m_option_t pvropts_conf[]={
};
#endif /* CONFIG_PVR */
#ifdef CONFIG_DVBIN
#include "stream/dvbin.h"
extern const m_config_t dvbin_opts_conf[];
#endif
extern const m_option_t lavfdopts_conf[];
extern int rtspStreamOverTCP;
@ -346,10 +342,9 @@ const m_option_t msgl_config[]={
};
#ifdef WIN32
extern char * proc_priority;
#ifdef WIN32
struct {
char* name;
int prio;

12
configure vendored
View File

@ -4287,6 +4287,8 @@ _def_vidix_drv_rage128='#undef CONFIG_VIDIX_DRV_RAGE128'
_vidix_drv_rage128=no
_def_vidix_drv_s3='#undef CONFIG_VIDIX_DRV_S3'
_vidix_drv_s3=no
_def_vidix_drv_sh_veu='#undef CONFIG_VIDIX_DRV_SH_VEU'
_vidix_drv_sh_veu=no
_def_vidix_drv_sis='#undef CONFIG_VIDIX_DRV_SIS'
_vidix_drv_sis=no
_def_vidix_drv_unichrome='#undef CONFIG_VIDIX_DRV_UNICHROME'
@ -4303,11 +4305,12 @@ if test "$_vidix" = yes ; then
_def_vidix='#define CONFIG_VIDIX 1'
_vosrc="$_vosrc vo_cvidix.c"
_vomodules="cvidix $_vomodules"
test "$_vidix_drivers" || _vidix_drivers="cyberblade ivtv mach64 mga mga_crtc2 nvidia pm2 pm3 radeon rage128 s3 sis unichrome"
test "$_vidix_drivers" || _vidix_drivers="cyberblade ivtv mach64 mga mga_crtc2 nvidia pm2 pm3 radeon rage128 s3 sh_veu sis unichrome"
test $_ivtv = "yes" || _vidix_drivers=`echo $_vidix_drivers | sed s/ivtv//`
# some vidix drivers are meant to work on x86 only, discard them elsewhere
# some vidix drivers are architecture and os specific, discard them elsewhere
x86 || _vidix_drivers=`echo $_vidix_drivers | sed -e s/cyberblade// -e s/sis// -e s/unichrome// -e s/s3//`
(test $host_arch = "sh" && linux) || _vidix_drivers=`echo $_vidix_drivers | sed s/sh_veu//`
for driver in $_vidix_drivers ; do
uc_driver=`echo $driver | tr '[a-z]' '[A-Z]'`
@ -6873,8 +6876,9 @@ echocheck "mencoder"
if test "$_mencoder" = yes ; then
_def_muxers='#define CONFIG_MUXERS 1'
else
# mpeg1video for vf_lavc, snow for vf_uspp and vf_mcdeint
# mpeg1video for vf_lavc, snow for vf_uspp and vf_mcdeint, png for vf_screenshot
_libavencoders="MPEG1VIDEO_ENCODER SNOW_ENCODER"
test "$_zlib" = yes && _libavencoders="$_libavencoders PNG_ENCODER"
_libavmuxers=""
fi
echores "$_mencoder"
@ -7895,6 +7899,7 @@ VIDIX_PM3=$_vidix_drv_pm3
VIDIX_RADEON=$_vidix_drv_radeon
VIDIX_RAGE128=$_vidix_drv_rage128
VIDIX_S3=$_vidix_drv_s3
VIDIX_SH_VEU=$_vidix_drv_sh_veu
VIDIX_SIS=$_vidix_drv_sis
VIDIX_UNICHROME=$_vidix_drv_unichrome
VSTREAM = $_vstream
@ -8622,6 +8627,7 @@ $_def_vidix_drv_pm3
$_def_vidix_drv_radeon
$_def_vidix_drv_rage128
$_def_vidix_drv_s3
$_def_vidix_drv_sh_veu
$_def_vidix_drv_sis
$_def_vidix_drv_unichrome
$_def_vidix_pfx

View File

@ -1,5 +1,5 @@
;=============================================================================
; Default codecs config file. It replaces the old codecs.c file!
; Default codecs config file.
; Before editing this file, please read DOCS/tech/codecs.conf.txt !
;=============================================================================

View File

@ -161,6 +161,7 @@ typedef struct render_context_s {
uint32_t fade; // alpha from \fad
char be; // blur edges
int shadow;
int drawing_mode; // not implemented; when != 0 text is discarded, except for style override tags
effect_t effect_type;
int effect_timing;
@ -1028,6 +1029,13 @@ static char* parse_tag(char* p, double pwr) {
render_context.shadow = val;
else
render_context.shadow = render_context.style->Shadow;
} else if (mystrcmp(&p, "pbo")) {
(void)strtol(p, &p, 10); // ignored
} else if (mystrcmp(&p, "p")) {
int val;
if (!mystrtoi(&p, 10, &val))
val = 0;
render_context.drawing_mode = !!val;
}
return p;
@ -1203,6 +1211,7 @@ static void init_render_context(ass_event_t* event)
render_context.clip_y1 = frame_context.track->PlayResY;
render_context.detect_collisions = 1;
render_context.fade = 0;
render_context.drawing_mode = 0;
render_context.effect_type = EF_NONE;
render_context.effect_timing = 0;
render_context.effect_skip_timing = 0;
@ -1750,7 +1759,9 @@ static int ass_render_event(ass_event_t* event, event_images_t* event_images)
while (1) {
// get next char, executing style override
// this affects render_context
code = get_next_char(&p);
do {
code = get_next_char(&p);
} while (code && render_context.drawing_mode); // skip everything in drawing mode
// face could have been changed in get_next_char
if (!render_context.font) {

View File

@ -198,6 +198,7 @@ void rtpCodecInitialize_audio(demuxer_t* demuxer,
sh_audio->wf = wf;
demux_stream_t* d_audio = demuxer->audio;
d_audio->sh = sh_audio; sh_audio->ds = d_audio;
d_audio->id = sh_audio->aid;
wf->nChannels = subsession->numChannels();

View File

@ -29,9 +29,6 @@ static int Shmem_Flag;
static XShmSegmentInfo Shminfo[1];
static int gXErrorFlag;
static int CompletionType = -1;
/* since it doesn't seem to be defined on some platforms */
int XShmGetEventBase(Display *);
#endif
#include "sub.h"

View File

@ -131,8 +131,6 @@ const LIBVO_EXTERN(xvmc);
//shm stuff from vo_xv
#ifdef HAVE_SHM
/* since it doesn't seem to be defined on some platforms */
int XShmGetEventBase(Display*);
static XShmSegmentInfo Shminfo;
static int Shmem_Flag;
#endif

View File

@ -2659,7 +2659,7 @@ int gui_no_filename=0;
if(strcasecmp(priority_presets_defs[i].name, proc_priority) == 0)
break;
}
mp_msg(MSGT_CPLAYER,MSGL_STATUS,"Setting process priority: %s\n",
mp_msg(MSGT_CPLAYER,MSGL_STATUS,MSGTR_SettingProcessPriority,
priority_presets_defs[i].name);
SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio);
}

View File

@ -77,6 +77,8 @@
#include "sysdep/AsmMacros_arm32.h"
#elif defined(__powerpc__)
#include "sysdep/AsmMacros_powerpc.h"
#elif defined(__sh__)
#include <sys/io.h>
#else
#include "sysdep/AsmMacros_x86.h"
#endif

View File

@ -185,7 +185,7 @@ void unmap_phys_mem(void *ptr, unsigned long size)
#endif /* Generic mmap (not win32, nor os2) */
#if !defined(__alpha__) && !defined(__powerpc__)
#if !defined(__alpha__) && !defined(__powerpc__) && !defined(__sh__)
unsigned char INPORT8(unsigned idx)
{
return inb(idx);

View File

@ -44,6 +44,7 @@ extern VDXDriver pm3_drv;
extern VDXDriver radeon_drv;
extern VDXDriver rage128_drv;
extern VDXDriver s3_drv;
extern VDXDriver sh_veu_drv;
extern VDXDriver sis_drv;
extern VDXDriver unichrome_drv;
@ -93,6 +94,9 @@ void vidix_register_all_drivers (void)
#ifdef CONFIG_VIDIX_DRV_S3
vidix_register_driver (&s3_drv);
#endif
#ifdef CONFIG_VIDIX_DRV_SH_VEU
vidix_register_driver (&sh_veu_drv);
#endif
#ifdef CONFIG_VIDIX_DRV_SIS
vidix_register_driver (&sis_drv);
#endif

View File

@ -484,7 +484,7 @@ static int pcibus=-1, pcicard=-1, pcifunc=-1 ;
#include "sysdep/pci_arm32.c"
#elif defined(__powerpc__)
#include "sysdep/pci_powerpc.c"
#elif defined(__x86_64__)
#elif defined(__x86_64__) || defined(__sh__)
/* Nothing here right now */
#else
#include "sysdep/pci_x86.c"
@ -628,7 +628,7 @@ int pci_scan(pciinfo_t *pci_list,unsigned *num_pci)
} while (++pcr._pcibusidx < pcr._pcinumbus);
}
#if !defined(__alpha__) && !defined(__powerpc__)
#if !defined(__alpha__) && !defined(__powerpc__) && !defined(__sh__)
/* Now try pci config 2 probe (deprecated) */
if ((pcr._configtype == 2) || do_mode2_scan) {
@ -689,7 +689,7 @@ int pci_scan(pciinfo_t *pci_list,unsigned *num_pci)
outb(PCI_MODE2_ENABLE_REG, 0x00);
}
#endif /* !__alpha__ && !__powerpc__ */
#endif /* !__alpha__ && !__powerpc__ && !__sh__ */
disable_os_io();

594
vidix/sh_veu_vid.c Normal file
View File

@ -0,0 +1,594 @@
/*
* VIDIX driver for SuperH Mobile VEU hardware block.
* Copyright (C) 2008 Magnus Damm
*
* Requires a kernel that exposes the VEU hardware block to user space
* using UIO. Available in upstream linux-2.6.27 or later.
*
* Tested using WVGA and QVGA panels with sh7722 VEU and sh7723 VEU2H.
*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <inttypes.h>
#include <unistd.h>
#include <errno.h>
#include "config.h"
#include "vidix.h"
#include "fourcc.h"
#include "dha.h"
static int fgets_with_openclose(char *fname, char *buf, size_t maxlen)
{
FILE *fp;
fp = fopen(fname, "r");
if (!fp)
return -1;
fgets(buf, maxlen, fp);
fclose(fp);
return strlen(buf);
}
struct uio_device {
char *name;
char *path;
int fd;
};
#define MAXNAMELEN 256
static int locate_uio_device(char *name, struct uio_device *udp)
{
char fname[MAXNAMELEN], buf[MAXNAMELEN];
char *tmp;
int uio_id;
uio_id = -1;
do {
uio_id++;
snprintf(fname, MAXNAMELEN, "/sys/class/uio/uio%d/name", uio_id);
if (fgets_with_openclose(fname, buf, MAXNAMELEN) < 0)
return -1;
} while (strncmp(name, buf, strlen(name)));
tmp = strchr(buf, '\n');
if (tmp)
*tmp = '\0';
udp->name = strdup(buf);
udp->path = strdup(fname);
udp->path[strlen(udp->path) - 5] = '\0';
snprintf(buf, MAXNAMELEN, "/dev/uio%d", uio_id);
udp->fd = open(buf, O_RDWR | O_SYNC);
if (udp->fd < 0)
return -1;
return 0;
}
struct uio_map {
unsigned long address;
unsigned long size;
void *iomem;
};
static int setup_uio_map(struct uio_device *udp, int nr, struct uio_map *ump)
{
char fname[MAXNAMELEN], buf[MAXNAMELEN];
snprintf(fname, MAXNAMELEN, "%s/maps/map%d/addr", udp->path, nr);
if (fgets_with_openclose(fname, buf, MAXNAMELEN) <= 0)
return -1;
ump->address = strtoul(buf, NULL, 0);
snprintf(fname, MAXNAMELEN, "%s/maps/map%d/size", udp->path, nr);
if (fgets_with_openclose(fname, buf, MAXNAMELEN) <= 0)
return -1;
ump->size = strtoul(buf, NULL, 0);
ump->iomem = mmap(0, ump->size,
PROT_READ|PROT_WRITE, MAP_SHARED,
udp->fd, nr * getpagesize());
if (ump->iomem == MAP_FAILED)
return -1;
return 0;
}
struct fb_info {
unsigned long width;
unsigned long height;
unsigned long bpp;
unsigned long line_length;
unsigned long address;
unsigned long size;
};
static int get_fb_info(char *device, struct fb_info *fip)
{
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
void *iomem;
int fd;
fd = open(device, O_RDWR);
if (fd < 0) {
perror("open");
return -1;
}
if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) {
perror("ioctl(FBIOGET_VSCREENINFO)");
return -1;
}
fip->width = vinfo.xres;
fip->height = vinfo.yres;
fip->bpp = vinfo.bits_per_pixel;
if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1) {
perror("ioctl(FBIOGET_FSCREENINFO)");
return -1;
}
fip->address = finfo.smem_start;
fip->size = finfo.smem_len;
fip->line_length = finfo.line_length;
iomem = mmap(0, fip->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (iomem == MAP_FAILED) {
perror("mmap");
return -1;
}
/* clear framebuffer */
memset(iomem, 0, fip->line_length * fip->height);
munmap(iomem, fip->size);
close(fd);
return 0;
}
#define VESTR 0x00 /* start register */
#define VESWR 0x10 /* src: line length */
#define VESSR 0x14 /* src: image size */
#define VSAYR 0x18 /* src: y/rgb plane address */
#define VSACR 0x1c /* src: c plane address */
#define VBSSR 0x20 /* bundle mode register */
#define VEDWR 0x30 /* dst: line length */
#define VDAYR 0x34 /* dst: y/rgb plane address */
#define VDACR 0x38 /* dst: c plane address */
#define VTRCR 0x50 /* transform control */
#define VRFCR 0x54 /* resize scale */
#define VRFSR 0x58 /* resize clip */
#define VENHR 0x5c /* enhance */
#define VFMCR 0x70 /* filter mode */
#define VVTCR 0x74 /* lowpass vertical */
#define VHTCR 0x78 /* lowpass horizontal */
#define VAPCR 0x80 /* color match */
#define VECCR 0x84 /* color replace */
#define VAFXR 0x90 /* fixed mode */
#define VSWPR 0x94 /* swap */
#define VEIER 0xa0 /* interrupt mask */
#define VEVTR 0xa4 /* interrupt event */
#define VSTAR 0xb0 /* status */
#define VBSRR 0xb4 /* reset */
#define VMCR00 0x200 /* color conversion matrix coefficient 00 */
#define VMCR01 0x204 /* color conversion matrix coefficient 01 */
#define VMCR02 0x208 /* color conversion matrix coefficient 02 */
#define VMCR10 0x20c /* color conversion matrix coefficient 10 */
#define VMCR11 0x210 /* color conversion matrix coefficient 11 */
#define VMCR12 0x214 /* color conversion matrix coefficient 12 */
#define VMCR20 0x218 /* color conversion matrix coefficient 20 */
#define VMCR21 0x21c /* color conversion matrix coefficient 21 */
#define VMCR22 0x220 /* color conversion matrix coefficient 22 */
#define VCOFFR 0x224 /* color conversion offset */
#define VCBR 0x228 /* color conversion clip */
/* Helper functions for reading registers. */
static unsigned long read_reg(struct uio_map *ump, int reg_offs)
{
volatile unsigned long *reg = ump->iomem;
return reg[reg_offs / 4];
}
static void write_reg(struct uio_map *ump, unsigned long value, int reg_offs)
{
volatile unsigned long *reg = ump->iomem;
reg[reg_offs / 4] = value;
}
static vidix_capability_t sh_veu_cap = {
"SuperH VEU driver",
"Magnus Damm",
TYPE_OUTPUT,
{ 0, 0, 0, 0 },
2560,
1920,
16,
16,
-1,
FLAG_UPSCALER|FLAG_DOWNSCALER,
-1,
-1,
{ 0, 0, 0, 0 }
};
/* global variables yuck */
static struct fb_info fbi;
static struct uio_device uio_dev;
static struct uio_map uio_mmio, uio_mem;
struct sh_veu_plane {
unsigned long width;
unsigned long height;
unsigned long stride;
unsigned long pos_x;
unsigned long pos_y;
};
static struct sh_veu_plane _src, _dst;
static vidix_playback_t my_info;
static int sh_veu_probe(int verbose, int force)
{
int ret;
ret = get_fb_info("/dev/fb0", &fbi);
if (ret < 0)
return ret;
if (fbi.bpp != 16) {
printf("sh_veu: only 16bpp supported\n");
return -1;
}
ret = locate_uio_device("VEU", &uio_dev);
if (ret < 0) {
printf("sh_veu: unable to locate matching UIO device\n");
return ret;
}
ret = setup_uio_map(&uio_dev, 0, &uio_mmio);
if (ret < 0) {
printf("sh_veu: cannot setup MMIO\n");
return ret;
}
ret = setup_uio_map(&uio_dev, 1, &uio_mem);
if (ret < 0) {
printf("sh_veu: cannot setup contiguous memory\n");
return ret;
}
printf("sh_veu: Using %s at %s on %lux%lu %ldbpp /dev/fb0\n",
uio_dev.name, uio_dev.path,
fbi.width, fbi.height, fbi.bpp);
return ret;
}
static void sh_veu_wait_irq(vidix_playback_t *info)
{
unsigned long n_pending;
/* Wait for an interrupt */
read(uio_dev.fd, &n_pending, sizeof(u_long));
write_reg(&uio_mmio, 0x100, VEVTR); /* ack int, write 0 to bit 0 */
}
static int sh_veu_is_veu2h(void)
{
return uio_mmio.size > 0xb8;
}
static unsigned long sh_veu_do_scale(struct uio_map *ump,
int vertical, int size_in,
int size_out, int crop_out)
{
unsigned long fixpoint, mant, frac, value, rep;
/* calculate FRAC and MANT */
do {
rep = mant = frac = 0;
if (size_in == size_out) {
if (crop_out != size_out)
mant = 1; /* needed for cropping */
break;
}
/* VEU2H special upscale */
if (sh_veu_is_veu2h() && size_out > size_in) {
fixpoint = (4096 * size_in) / size_out;
mant = fixpoint / 4096;
frac = fixpoint - (mant * 4096);
frac &= ~0x07;
switch (frac) {
case 0x800:
rep = 1;
break;
case 0x400:
rep = 3;
break;
case 0x200:
rep = 7;
break;
}
if (rep)
break;
}
fixpoint = (4096 * (size_in - 1)) / (size_out + 1);
mant = fixpoint / 4096;
frac = fixpoint - (mant * 4096);
if (frac & 0x07) {
frac &= ~0x07;
if (size_out > size_in)
frac -= 8; /* round down if scaling up */
else
frac += 8; /* round up if scaling down */
}
} while (0);
/* set scale */
value = read_reg(ump, VRFCR);
if (vertical) {
value &= ~0xffff0000;
value |= ((mant << 12) | frac) << 16;
} else {
value &= ~0xffff;
value |= (mant << 12) | frac;
}
write_reg(ump, value, VRFCR);
/* set clip */
value = read_reg(ump, VRFSR);
if (vertical) {
value &= ~0xffff0000;
value |= ((rep << 12) | crop_out) << 16;
} else {
value &= ~0xffff;
value |= (rep << 12) | crop_out;
}
write_reg(ump, value, VRFSR);
return (((size_in * crop_out) / size_out) + 0x03) & ~0x03;
}
static void sh_veu_setup_planes(vidix_playback_t *info,
struct sh_veu_plane *src,
struct sh_veu_plane *dst)
{
unsigned long addr, real_w, real_h;
src->width = info->src.w;
src->height = info->src.h;
src->stride = (info->src.w+15) & ~15;
dst->width = real_w = info->dest.w;
dst->height = real_h = info->dest.h;
dst->stride = fbi.line_length;
dst->pos_x = info->dest.x & ~0x03;
dst->pos_y = info->dest.y;
if ((dst->width + dst->pos_x) > fbi.width)
dst->width = fbi.width - dst->pos_x;
if ((dst->height + dst->pos_y) > fbi.height)
dst->height = fbi.height - dst->pos_y;
addr = fbi.address;
addr += dst->pos_x * (fbi.bpp / 8);
addr += dst->pos_y * dst->stride;
src->width = sh_veu_do_scale(&uio_mmio, 0, src->width,
real_w, dst->width);
src->height = sh_veu_do_scale(&uio_mmio, 1, src->height,
real_h, dst->height);
write_reg(&uio_mmio, src->stride, VESWR);
write_reg(&uio_mmio, src->width | (src->height << 16), VESSR);
write_reg(&uio_mmio, 0, VBSSR); /* not using bundle mode */
write_reg(&uio_mmio, dst->stride, VEDWR);
write_reg(&uio_mmio, addr, VDAYR);
write_reg(&uio_mmio, 0, VDACR); /* unused for RGB */
write_reg(&uio_mmio, 0x67, VSWPR);
write_reg(&uio_mmio, (6 << 16) | (0 << 14) | 2 | 4, VTRCR);
if (sh_veu_is_veu2h()) {
write_reg(&uio_mmio, 0x0cc5, VMCR00);
write_reg(&uio_mmio, 0x0950, VMCR01);
write_reg(&uio_mmio, 0x0000, VMCR02);
write_reg(&uio_mmio, 0x397f, VMCR10);
write_reg(&uio_mmio, 0x0950, VMCR11);
write_reg(&uio_mmio, 0x3ccd, VMCR12);
write_reg(&uio_mmio, 0x0000, VMCR20);
write_reg(&uio_mmio, 0x0950, VMCR21);
write_reg(&uio_mmio, 0x1023, VMCR22);
write_reg(&uio_mmio, 0x00800010, VCOFFR);
}
write_reg(&uio_mmio, 1, VEIER); /* enable interrupt in VEU */
}
static void sh_veu_blit(vidix_playback_t *info, int frame)
{
unsigned long enable = 1;
unsigned long addr;
addr = uio_mem.address + info->offsets[frame];
write_reg(&uio_mmio, addr + info->offset.y, VSAYR);
write_reg(&uio_mmio, addr + info->offset.u, VSACR);
/* Enable interrupt in UIO driver */
write(uio_dev.fd, &enable, sizeof(u_long));
write_reg(&uio_mmio, 1, VESTR); /* start operation */
}
static int sh_veu_init(void)
{
write_reg(&uio_mmio, 0x100, VBSRR); /* reset VEU */
return 0;
}
static void sh_veu_destroy(void)
{
}
static int sh_veu_get_caps(vidix_capability_t *to)
{
memcpy(to, &sh_veu_cap, sizeof(vidix_capability_t));
return 0;
}
static int sh_veu_query_fourcc(vidix_fourcc_t *to)
{
if (to->fourcc == IMGFMT_NV12) {
to->depth = VID_DEPTH_ALL;
to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK;
return 0;
}
to->depth = to->flags = 0;
return ENOSYS;
}
static int sh_veu_config_playback(vidix_playback_t *info)
{
unsigned int i, y_pitch;
switch (info->fourcc) {
case IMGFMT_NV12:
y_pitch = (info->src.w + 15) & ~15;
info->offset.y = 0;
info->offset.u = y_pitch * info->src.h;
info->frame_size = info->offset.u + info->offset.u / 2;
break;
default:
return ENOTSUP;
}
info->num_frames = uio_mem.size / info->frame_size;
if (info->num_frames > VID_PLAY_MAXFRAMES)
info->num_frames = VID_PLAY_MAXFRAMES;
if (!info->num_frames) {
printf("sh_veu: %d is not enough memory for %d bytes frame\n",
(int)uio_mem.size, (int)info->frame_size);
return ENOMEM;
}
info->dga_addr = uio_mem.iomem;
info->dest.pitch.y = info->dest.pitch.u = info->dest.pitch.v = 16;
for (i = 0; i < info->num_frames; i++)
info->offsets[i] = info->frame_size * i;
my_info = *info;
printf("sh_veu: %d frames * %d bytes, total size = %d\n",
(int)info->num_frames, (int)info->frame_size,
(int)uio_mem.size);
sh_veu_setup_planes(info, &_src, &_dst);
printf("sh_veu: %dx%d->%dx%d@%dx%d -> %dx%d->%dx%d@%dx%d \n",
(int)info->src.w, (int)info->src.h,
(int)info->dest.w, (int)info->dest.h,
(int)info->dest.x, (int)info->dest.y,
(int)_src.width, (int)_src.height,
(int)_dst.width, (int)_dst.height,
(int)_dst.pos_x, (int)_dst.pos_y);
return 0;
}
static int sh_veu_playback_on(void)
{
return 0;
}
static int sh_veu_playback_off(void)
{
return 0;
}
static int sh_veu_first_frame = 1;
static int sh_veu_frame_sel(unsigned int frame)
{
if (!sh_veu_first_frame)
sh_veu_wait_irq(&my_info);
sh_veu_blit(&my_info, frame);
sh_veu_first_frame = 0;
return 0;
}
VDXDriver sh_veu_drv = {
"sh_veu",
NULL,
.probe = sh_veu_probe,
.get_caps = sh_veu_get_caps,
.query_fourcc = sh_veu_query_fourcc,
.init = sh_veu_init,
.destroy = sh_veu_destroy,
.config_playback = sh_veu_config_playback,
.playback_on = sh_veu_playback_on,
.playback_off = sh_veu_playback_off,
.frame_sel = sh_veu_frame_sel,
};

View File

@ -36,6 +36,10 @@ int iopl();
#endif
#endif
#ifdef __sh__
#define iopl(x) 1
#endif
#include "config.h"
#ifdef CONFIG_DHAHELPER
@ -141,7 +145,7 @@ static __inline__ int disable_os_io(void)
}
#if (defined(__powerpc__) || defined(__sparc__) || defined(__sparc64__) \
|| defined(__x86_64__)) && defined(__linux__) && !defined(CONFIG_SVGAHELPER)
|| defined(__x86_64__) || defined(__sh__)) && defined(__linux__) && !defined(CONFIG_SVGAHELPER)
#define CONFIG_PCI_LINUX_PROC
#endif