Home Page

YUV modes and artwork effects

Posted By: cools

YUV modes and artwork effects - 12/12/08 08:01 PM

I'm trying to copy behaviour shown here: http://jvspac.kirurg.org/?page=mame with SDLMAME, on directfb.

Screen is a fixed frequency 640x480 VGA monitor (Nanao MS29-34). SDLMAME is happy enough splatting video up at this resolution, but when combined with a scanline effect looks horrendous - because it's applying the scanline effect BEFORE the image is prescaled with either yuv2x2 or yv12x2 (yuv2 and yv12 modes mess with colours too much).

I've tried fiddling with all the settings as much as possible but I get nowhere. Verbose output is showing me it's rendering a 320x240 overlay, I'm getting full screen video but it's clear that the artwork is being applied at the 320x240 stage.

I could be getting things entirely backwards - if the YUV modes are pure hardware, is the prescaling being done in hardware?
Posted By: R. Belmont

Re: YUV modes and artwork effects - 12/12/08 09:09 PM

I'm not sure YUV and prescale interact, like at all. Do you get the correct effect with -video soft?
Posted By: couriersud

Re: YUV modes and artwork effects - 12/14/08 11:09 AM

Originally Posted By cools
Screen is a fixed frequency 640x480 VGA monitor (Nanao MS29-34). SDLMAME is happy enough splatting video up at this resolution, but when combined with a scanline effect looks horrendous - because it's applying the scanline effect BEFORE the image is prescaled with either yuv2x2 or yv12x2 (yuv2 and yv12 modes mess with colours too much).

That is a "feature by design". The yuv modes are intended for memory bandwidth impaired" systems. The whole rendering is done in software at the game's resolution; including all scanline effects. The whole window surface is then converted to yuv and uploaded.
What is the reason for using yuv? Are you on directfb or does your card not support OpenGL?


Posted By: cools

Re: YUV modes and artwork effects - 12/16/08 07:20 PM

That explains it then. Thanks for the clarification smile

It's on directfb. No matter how much messing around I tried I simply couldn't get it to render a higher resolution before applying the effects.

I've given up on SDLMAME on directfb for now on a cab. It works but it's either ugly, or slow. And the lack of a reasonable frontend (advmenu is the only decent option and that's simply too far out of date) is a downer frown

The machine is currently being updated to lenny. I'll probably just throw X + WINE + baseline on, since performance under WINE is absolutely fantastic smile
Posted By: R. Belmont

Re: YUV modes and artwork effects - 12/16/08 07:55 PM

Most people running DirectFB with SDLMAME do so with a real arcade monitor, so you don't need fake scanlines smile Note also that on a dual-core system you can use the -mt switch to do the scaling on your second processor and avoid needing YUV that way.

And if you're upgrading to full-feature X why run WINE? At that point SDLMAME's more in it's element and you have access to a lot more frontends (MAMEPGUI is especially nice).
Posted By: cools

Re: YUV modes and artwork effects - 12/16/08 10:30 PM

Yeah it's an odd setup. It is a real arcade monitor (Nanao MS29-34), just a 31.5k VGA one, not a 15k one smile Naomi Universal cab. PC is some old kit I had lying around - P4 2.8, 1GB RAM, Geforce 2 MX400, and the OS on a CF card in a CF>IDE adapter, and a JVS-PAC.

It's still an experiment, all my MAME stuff seems to be such since AdvanceMAME died.

Done some more testing. Shoved xorg on - just the base, no window manager. Running SDLMAME in soft and scaling to 640x480 resolution (without yuv) is both slow and does something horrible to the graphics. Even without scaling it does the same thing. Running in (software) OpenGL sorts the graphics out but is obviously slow.

Baseline through WINE is superbly fast in ddraw. Even when prescaling and applying the scanline effect (which looks spot on, it's perfect). D3d is as slow as SDL's software OpenGL.

I'll have a further play in a few days time - I'll document things properly rather than just fiddling about smile

With regards to the frontends - it's probably obvious since this is in a cab that MAMEPGUI is worthless. AdvanceMENU's XML support is well out of date (I've tried fixing it, and had others to look at it but we've got nowhere), and quite frankly every single other frontend, both on Linux and on Windows look dreadful. Big long lists of things. I kinda like the marquee and tile modes (using title snaps) in AdvMenu.
Posted By: R. Belmont

Re: YUV modes and artwork effects - 12/16/08 10:41 PM

Can we please get a screenshot of this "something horrible to the graphics", assuming it happens in windowed mode? A -verbose dump would be useful too.
Posted By: jrcmilanez

Re: YUV modes and artwork effects - 12/16/08 11:58 PM

Please try my latest PIAPARA LiveCD (0.21) and give me some results.
Posted By: R. Belmont

Re: YUV modes and artwork effects - 12/17/08 12:12 AM

Couriersud, do you have any ideas? The path through MAME should be identical to baseline, and Wine ddraw is definitely not a magic fast box - without OpenGL it's usually about 20% slower than real Windows on the same h/w.
Posted By: couriersud

Re: YUV modes and artwork effects - 12/17/08 01:06 AM

Originally Posted By R. Belmont
Couriersud, do you have any ideas? The path through MAME should be identical to baseline, and Wine ddraw is definitely not a magic fast box - without OpenGL it's usually about 20% slower than real Windows on the same h/w.


a) DirectFB
The poster gave only little detail. No mame commandline, no /etc/directfbrc, no mame verbose output, no stderr output running mame to see what directfb is complaining about, no dfbinfo

b) ddraw

from the source
Code:
if we're using the memory buffer, draw offscreen first and then copy

That's in fact a software renderer. As is the other case where it uses the software renderer to draw directly to the window surface - just overdrawing this (NO_DEST_READ=1). Depending on the blend mode and color/alpha set this may cause a real difference.

I think the base package posted here for such issues should be

a) mame.ini
b) mame commandline
c) game.cfg (are we talking artwork?)
d) mame -v output incl. stderr

For directfb:

e) /etc/directfbrc
f) dfbinfo output

That is a lot, but issues like that tend to be complex.
Posted By: cools

Re: YUV modes and artwork effects - 12/21/08 12:12 PM

Right, got a bit of time so I'll make a start.

The below gives the correct display - scaled up prior to applying scanlines, but is incredibly slow.

Originally Posted By /etc/directfbrc

mode=640x480
depth=16
disable-module=joystick
disable-module=linux_input
no-cursor
bg-color=000000


Originally Posted By mame.ini
<UNADORNED0>

#
# CORE CONFIGURATION OPTIONS
#
readconfig 1

#
# CORE SEARCH PATH OPTIONS
#
rompath roms;/usr/share/games/sdlmame/roms
samplepath samples;/usr/share/games/sdlmame/samples
artpath artwork;/usr/share/games/sdlmame/artwork
ctrlrpath ctrlr;/usr/share/games/sdlmame/ctrlr
inipath $HOME/.mame;.;ini;/usr/share/games/sdlmame
fontpath .
cheatpath cheat;/usr/share/games/sdlmame/cheat

#
# CORE OUTPUT DIRECTORY OPTIONS
#
cfg_directory cfg;/var/games/sdlmame/cfg
nvram_directory nvram;/var/games/sdlmame/nvram
memcard_directory memcard;/var/games/sdlmame/memcard
input_directory inp;/var/games/sdlmame/inp
state_directory sta;/var/games/sdlmame/sta
snapshot_directory snap;/var/games/sdlmame/snap
diff_directory diff;/var/games/sdlmame/diff
comment_directory comments;/var/games/sdlmame/comments

#
# CORE STATE/PLAYBACK OPTIONS
#
state
autosave 0
playback
record
mngwrite
aviwrite
wavwrite
snapname %g/%i
snapsize auto
snapview internal

#
# CORE PERFORMANCE OPTIONS
#
autoframeskip 0
frameskip 0
seconds_to_run 0
throttle 1
sleep 0
speed 1.0
refreshspeed 0

#
# CORE ROTATION OPTIONS
#
rotate 1
ror 0
rol 0
autoror 0
autorol 0
flipx 0
flipy 0

#
# CORE ARTWORK OPTIONS
#
artwork_crop 0
use_backdrops 0
use_overlays 0
use_bezels 0

#
# CORE SCREEN OPTIONS
#
brightness 1.0
contrast 1.0
gamma 1.0
pause_brightness 0.65

#
# CORE VECTOR OPTIONS
#
antialias 1
beam 1.0
flicker 0

#
# CORE SOUND OPTIONS
#
sound 1
samplerate 48000
samples 1
volume 0

#
# CORE INPUT OPTIONS
#
coin_lockout 1
ctrlr
mouse 0
joystick 1
lightgun 0
multikeyboard 0
multimouse 0
steadykey 0
offscreen_reload 0
joystick_map auto
joystick_deadzone 0.3
joystick_saturation 0.85

#
# CORE INPUT AUTOMATIC ENABLE OPTIONS
#
paddle_device keyboard
adstick_device keyboard
pedal_device keyboard
dial_device keyboard
trackball_device keyboard
lightgun_device keyboard
positional_device keyboard
mouse_device mouse

#
# CORE DEBUGGING OPTIONS
#
log 1
verbose 1
update_in_pause 0
debug 0
debugscript

#
#
# CORE MISC OPTIONS
#
bios
cheat 0
skip_gameinfo 1

#
# DEBUGGING OPTIONS
#
oslog 0

#
# PERFORMANCE OPTIONS
#
multithreading 1
sdlvideofps 0

#
# VIDEO OPTIONS
#
video soft
numscreens 1
window 0
maximize 0
keepaspect 0
unevenstretch 0
effect scanlines.png
centerh 1
centerv 1
waitvsync 0
scalemode none

#
# OpenGL-SPECIFIC OPTIONS
#
filter 0
prescale 2
gl_forcepow2texture 0
gl_notexturerect 0
gl_vbo 0
gl_pbo 0
gl_glsl 0
gl_glsl_filter 0
glsl_shader_mame0 none
glsl_shader_mame1 none
glsl_shader_mame2 none
glsl_shader_mame3 none
glsl_shader_mame4 none
glsl_shader_mame5 none
glsl_shader_mame6 none
glsl_shader_mame7 none
glsl_shader_mame8 none
glsl_shader_mame9 none
glsl_shader_screen0 none
glsl_shader_screen1 none
glsl_shader_screen2 none
glsl_shader_screen3 none
glsl_shader_screen4 none
glsl_shader_screen5 none
glsl_shader_screen6 none
glsl_shader_screen7 none
glsl_shader_screen8 none
glsl_shader_screen9 none
gl_glsl_vid_attr 1

#
# PER-WINDOW VIDEO OPTIONS
#
screen auto
aspect auto
resolution auto
view auto
screen0 auto
aspect0 auto
resolution0 auto
view0 auto
screen1 auto
aspect1 auto
resolution1 auto
view1 auto
screen2 auto
aspect2 auto
resolution2 auto
view2 auto
screen3 auto
aspect3 auto
resolution3 auto
view3 auto

#
# FULL SCREEN OPTIONS
#
switchres 0
useallheads 0

#
# SOUND OPTIONS
#
audio_latency 3

#
# SDL KEYBOARD MAPPING
#
keymap 0
keymap_file keymap.dat

#
# SDL JOYSTICK MAPPING
#
remapjoys 0
remapjoyfile joymap.dat
sixaxis 0

#
# SDL LOWLEVEL DRIVER OPTIONS
#
videodriver directfb
audiodriver auto
gl_lib auto


Originally Posted By dfbinfo

=======================| DirectFB 1.0.1 |=======================
(c) 2001-2007 The DirectFB Organization (directfb.org)
(c) 2000-2004 Convergence (integrated media) GmbH
------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2008-08-18 12:36)
(*) Direct/Thread: Running 'VT Switcher' (CRITICAL, 2314)...
(*) Direct/Modules: suppress module 'joystick'
(*) Direct/Modules: suppress module 'linux_input'
(*) Direct/Thread: Running 'PS/2 Input' (INPUT, 2317)...
(*) DirectFB/Input: IMPS/2 Mouse 1.0 (directfb.org)
(*) Direct/Thread: Running 'Keyboard Input' (INPUT, 2318)...
(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
(*) DirectFB/Genefx: MMX detected and enabled
(*) DirectFB/Graphics: nVidia NV11 (0110) 0.6 (directfb.org)
(*) DirectFB/Core/WM: Default 0.3 (directfb.org)


Screen (00) NVidia Primary Screen (primary screen)
Caps: VSYNC POWER_MANAGEMENT

Layer (00) FBDev Primary Layer (primary layer)
Type: GRAPHICS
Caps: SURFACE BRIGHTNESS CONTRAST SATURATION

Layer (01) NVidia Overlay
Type: VIDEO STILL_PICTURE
Caps: SURFACE SCREEN_LOCATION DEINTERLACING DST_COLORKEY BRIGHTNESS CONTRAST HUE SATURATION SCREEN_POSITION SCREEN_SIZE


Input (01) IMPS/2 Mouse (primary mouse)
Type: MOUSE
Caps: AXES BUTTONS
Max. Axis: 2
Max. Button: 2

Input (00) Keyboard (primary keyboard)
Type: KEYBOARD
Caps: KEYS



Originally Posted By sdlmame -v shinobi

Parsing mame.ini
Setting SDL videodriver 'directfb' ...

=======================| DirectFB 1.0.1 |=======================
(c) 2001-2007 The DirectFB Organization (directfb.org)
(c) 2000-2004 Convergence (integrated media) GmbH
------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2008-08-18 12:36)
(*) Direct/Thread: Running 'VT Switcher' (CRITICAL, 2353)...
(*) Direct/Modules: suppress module 'joystick'
(*) Direct/Modules: suppress module 'linux_input'
(*) Direct/Thread: Running 'PS/2 Input' (INPUT, 2355)...
(*) DirectFB/Input: IMPS/2 Mouse 1.0 (directfb.org)
(*) Direct/Thread: Running 'Keyboard Input' (INPUT, 2356)...
(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
(*) DirectFB/Genefx: MMX detected and enabled
(*) DirectFB/Graphics: nVidia NV11 (0110) 0.6 (directfb.org)
(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
Build version: 0.128 (Dec 14 2008)
Build architecure: SDLMAME_ARCH=
Build defines: SDLMAME_UNIX=1 SDLMAME_X11=1 SDLMAME_LINUX=1 LSB_FIRST=1 NDEBUG=1
SDL/OpenGL defines: SDL_COMPILEDVERSION=1212 USE_OPENGL=1 USE_DISPATCH_GL=1
Compiler defines A: __GNUC__=4 __GNUC_MINOR__=3 __GNUC_PATCHLEVEL__=2 __VERSION__="4.3.2"
Compiler defines B: __unix__=1 __i386__=1
SDL Device Driver : directfb
SDL Monitor Dimensions: 640 x 480
Using SDL single-window soft driver (SDL 1.2)
SDL DirectFB_SetVideoMode: 640x480@16, flags: 0xd0000001
Input: Adding Kbd #1: System keyboard
Input: Adding Mouse #1: System mouse
Joystick: Start initialization
Joystick: End initialization
Audio initialized - driver: alsa, frequency: 48000, channels: 2, samples: 1024
sdl_create_buffers: creating stream buffer of 57344 bytes
ouput: unable to open output notifier file /tmp/sdlmame_out




If I then change scalemode in mame.ini to a yuv mode (yv12x2) the game runs at full speed, but the image is wrong - it's applying scanlines to the 320x224 overlay rather than the 640x480 display.

Originally Posted By sdlmame -v shinobi

Setting SDL videodriver 'directfb' ...

=======================| DirectFB 1.0.1 |=======================
(c) 2001-2007 The DirectFB Organization (directfb.org)
(c) 2000-2004 Convergence (integrated media) GmbH
------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2008-08-18 12:36)
(*) Direct/Thread: Running 'VT Switcher' (CRITICAL, 2388)...
(*) Direct/Modules: suppress module 'joystick'
(*) Direct/Modules: suppress module 'linux_input'
(*) Direct/Thread: Running 'PS/2 Input' (INPUT, 2390)...
(*) DirectFB/Input: IMPS/2 Mouse 1.0 (directfb.org)
(*) Direct/Thread: Running 'Keyboard Input' (INPUT, 2391)...
(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
(*) DirectFB/Genefx: MMX detected and enabled
(*) DirectFB/Graphics: nVidia NV11 (0110) 0.6 (directfb.org)
(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
Build version: 0.128 (Dec 14 2008)
Build architecure: SDLMAME_ARCH=
Build defines: SDLMAME_UNIX=1 SDLMAME_X11=1 SDLMAME_LINUX=1 LSB_FIRST=1 NDEBUG=1
SDL/OpenGL defines: SDL_COMPILEDVERSION=1212 USE_OPENGL=1 USE_DISPATCH_GL=1
Compiler defines A: __GNUC__=4 __GNUC_MINOR__=3 __GNUC_PATCHLEVEL__=2 __VERSION__="4.3.2"
Compiler defines B: __unix__=1 __i386__=1
SDL Device Driver : directfb
SDL Monitor Dimensions: 640 x 480
Using SDL single-window soft driver (SDL 1.2)
SDL DirectFB_SetVideoMode: 640x480@16, flags: 0x90000000
SDL: Creating 320 x 224 YUV-Overlay ...
YUV Mode : yv12x2
YUV Overlay Size : 320 x 224
YUV Acceleration : Hardware
Input: Adding Kbd #1: System keyboard
Input: Adding Mouse #1: System mouse
Joystick: Start initialization
Joystick: End initialization
Audio initialized - driver: alsa, frequency: 48000, channels: 2, samples: 1024
sdl_create_buffers: creating stream buffer of 57344 bytes
ouput: unable to open output notifier file /tmp/sdlmame_out
SDL: Creating 320 x 224 YUV-Overlay ...




To run in Xorg I change mame.ini:
videodriver auto
video opengl

Originally Posted By xorg.conf

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "gb"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
EndSection

Section "Device"
Identifier "Configured Video Device"
EndSection

Section "Monitor"
Identifier "Nanao MS29-34"
HorizSync 31.5
VertRefresh 60
EndSection

Section "Screen"
Identifier "Default Screen"
Monitor "Nanao MS29-34"
EndSection


Originally Posted By sdlmame -v shinobi

Build version: 0.128 (Dec 14 2008)
Build architecure: SDLMAME_ARCH=
Build defines: SDLMAME_UNIX=1 SDLMAME_X11=1 SDLMAME_LINUX=1 LSB_FIRST=1 NDEBUG=1
SDL/OpenGL defines: SDL_COMPILEDVERSION=1212 USE_OPENGL=1 USE_DISPATCH_GL=1
Compiler defines A: __GNUC__=4 __GNUC_MINOR__=3 __GNUC_PATCHLEVEL__=2 __VERSION__="4.3.2"
Compiler defines B: __unix__=1 __i386__=1
SDL Device Driver : x11
SDL Monitor Dimensions: 640 x 480
Using SDL single-window OpenGL driver (SDL 1.2)
Loaded opengl shared library: <default>
OpenGL: Mesa project: www.mesa3d.org
OpenGL: Mesa GLX Indirect
OpenGL: 1.4 (2.1 Mesa 7.0.4)
OpenGL: texture rectangle supported
OpenGL: non-power-of-2 textures supported (new method)
OpenGL: pixel buffers not supported
OpenGL: framebuffer object supported
OpenGL: GLSL not supported
OpenGL: max texture size 2048 x 2048
Input: Adding Kbd #1: System keyboard
Input: Adding Mouse #1: System mouse
Joystick: Start initialization
Joystick: End initialization
Audio initialized - driver: alsa, frequency: 48000, channels: 2, samples: 1024
sdl_create_buffers: creating stream buffer of 57344 bytes
ouput: unable to open output notifier file /tmp/sdlmame_out
OpenGL: VB0 supported
OpenGL: PB0 supported
OpenGL: FBO supported
OpenGL: using vid filter: 0
GL texture: copy 1, shader 0, dynamic 0, 640x448 640x448 [PALETTE16, Equal: 0, Palette: 1,
scale 2x2 (eff: 0), border 0, pitch 344,640/2048], colors: 6144, bytes/pix 4
GL texture: copy 1, shader 0, dynamic 0, 640x448 640x448 [PALETTE16, Equal: 0, Palette: 1,
scale 2x2 (eff: 0), border 0, pitch 344,640/2048], colors: 6144, bytes/pix 4


Display is correct - the same as video soft with no scaling. Performance is a lot better, not as quick as soft yv12x2. Note I am not using the nvidia drivers. I don't know how to check if I'm using any hardware acceleration.

Now for the kicker. All I've done is drag wine down from the repository, and run winecfg.

Originally Posted By mame.ini
#
# WINDOWS VIDEO OPTIONS
#
video ddraw
numscreens 1
window 0
maximize 0
keepaspect 0
prescale 2
effect scanlines.png
waitvsync 0
syncrefresh 0
triplebuffer 0

#
# DIRECTDRAW-SPECIFIC OPTIONS
#
hwstretch 0


Display is correct, although a little flickery now and then. Not good enough for use, but performance is great.

Erm - one last point that I've just discovered. Running video soft, no scalemode, videodriver auto - under Xorg - gives correct display, and great speed. Vsync still doesn't work (but I've never seen that work under Linux and I'm not expecting it to). I might have inadvertently stumbled onto a solution that gives me what I want smile
Posted By: AaronGiles

Re: YUV modes and artwork effects - 12/22/08 06:43 AM

So it looks like the -prescale 2 option is not being respected in YUV mode. For the Win32 version, prescale is respected for ddraw, and scales the minimum size by that integral factor.
Posted By: cools

Re: YUV modes and artwork effects - 12/22/08 11:30 AM

I'll play about with yuv modes some more when I've time. I now know you can alter prescaling while in game, so it could just be that it's being ignored at startup.

Further entertainment has been had in the in-MAME UI, by remapping UI Select to the standard P1 Start (1)... It'll only run the first game in the list laugh
Posted By: cools

Re: YUV modes and artwork effects - 01/25/09 05:23 PM

Just a quick bump - huge thanks to couriersud for sorting this out in 129 - it now works perfectly, and yuv2 is fine for display too!

Just a single export variable needed now (for YUV direct), the rest is all nicely in the /etc/directfbrc /etc/fb.modes and the mame.ini!
© 2019 Forums