Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Feb 2011 08:42:33 +0100
From:      David Demelier <demelier.david@gmail.com>
To:        Anonymous <swell.k@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: VESA and SDL in tty terminal
Message-ID:  <4D54E869.5050508@gmail.com>
In-Reply-To: <86k4h8arby.fsf@gmail.com>
References:  <4D50F6F8.6070100@gmail.com> <86k4h8arby.fsf@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/02/2011 15:37, Anonymous wrote:
> David Demelier<demelier.david@gmail.com>  writes:
>
>> Hello,
>>
>> The SDL's pkg-message says we can use video driver in tty terminal.
>>
>>   To do this you have to load the vesa kernel module or enable it in your
>>   kernel, and set environment variable "SDL_VIDEODRIVER=vgl".
>>
>> I tried it with mplayer :
>>
>> $ SDL_VIDEODRIVER=vgl; export SDL_VIDEODRIVER
>> $ mplayer -vo sdl<the file here>
> [...]
>> [VO_SDL] Set_fullmode: SDL_SetVideoMode failed: Unable to switch to
>> requested mode.
>
> IIRC, vgl(3) mode setting unlike vidcontrol(8) doesn't work as regular user.
> Try running mplayer under root, e.g.
>
>    $ sudo mplayer -msgmodule -msglevel vo=9 -vo sdl<the file here>
>    [...]
>        DEMUX: VIDEO:  [avc1]  1280x720  24bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
>     VIDEOOUT: SDL: Opening Plugin
>     VIDEOOUT: [VO_SDL] Using driver: vgl.
>     VIDEOOUT: X11 opening display:
>     VIDEOOUT: vo: couldn't open the X11 display ()!
>    [...]
>      CPLAYER: Starting playback...
>      CPLAYER: Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
>      CPLAYER: VO: [sdl] 1280x720 =>  1280x720 Planar YV12
>     VIDEOOUT: SDL: Using 0x32315659 (Planar YV12) image format
>     VIDEOOUT: SDL: using hardware-surface
>     VIDEOOUT: SDL: setting zoomed fullscreen with modeswitching
>     VIDEOOUT: SDL Mode: 0:  1600 x 1200
>     VIDEOOUT: SDL Mode: 1:  1280 x 1024
>     VIDEOOUT: SDL Mode: 2:  1024 x 768
>     VIDEOOUT: SDL Mode: 3:  800 x 600
>     VIDEOOUT: SDL Mode: 4:  640 x 400
>     VIDEOOUT: SDL Mode: 5:  640 x 480
>     VIDEOOUT: SDL Mode: 6:  320 x 240
>     VIDEOOUT: SDL Mode: 7:  320 x 400
>     VIDEOOUT: SDL Mode: 8:  320 x 200
>     VIDEOOUT: SET SDL Mode: 1:  1280 x 1024
>
> In case your keymap doesn't work under vo_sdl(vgl) try below workaround
>
> %%
> Index: multimedia/mplayer/files/patch-vgl-xlate_keys
> ===================================================================
> RCS file: multimedia/mplayer/files/patch-vgl-xlate_keys
> diff -N multimedia/mplayer/files/patch-vgl-xlate_keys
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ multimedia/mplayer/files/patch-vgl-xlate_keys	10 Feb 2011 14:34:43 -0000
> @@ -0,0 +1,62 @@
> +  use character codes for vgl driver
> +
> +--- configure~
> ++++ configure
> +@@ -4579,6 +4579,19 @@ EOF
> +   fi
> + fi
> + if test "$_sdl" = yes ; then
> ++  cat>  $TMPC<<  EOF
> ++#ifdef CONFIG_SDL_SDL_H
> ++#include<SDL/SDL.h>
> ++#else
> ++#include<SDL.h>
> ++#endif
> ++int main(void) { SDL_VIDEO_DRIVER_VGL; return 0; }
> ++EOF
> ++  if cc_check -DCONFIG_SDL_SDL_H $_inc_tmp -lvgl || cc_check $_inc_tmp -lvgl ; then
> ++    _ld_tmp="$_ld_tmp -lvgl"
> ++  fi
> ++fi
> ++if test "$_sdl" = yes ; then
> +   def_sdl='#define CONFIG_SDL 1'
> +   extra_cflags="$extra_cflags $_inc_tmp"
> +   libs_mplayer="$libs_mplayer $_ld_tmp"
> +--- libvo/sdl_common.c~
> ++++ libvo/sdl_common.c
> +@@ -27,6 +27,11 @@
> + #include "input/mouse.h"
> + #include "video_out.h"
> +
> ++#ifdef SDL_VIDEO_DRIVER_VGL
> ++#include<sys/fbio.h>
> ++#include<vgl.h>
> ++#endif
> ++
> + static int old_w;
> + static int old_h;
> + static int mode_flags;
> +@@ -44,6 +49,9 @@ int vo_sdl_init(void)
> +     SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, 100 /*SDL_DEFAULT_REPEAT_INTERVAL*/);
> +
> +     // Easiest way to get uppercase characters
> ++#ifdef SDL_VIDEO_DRIVER_VGL
> ++    VGLKeyboardInit(VGL_XLATEKEYS);
> ++#endif
> +     SDL_EnableUNICODE(1);
> +
> +     // We don't want those in our event queue.
> +@@ -56,8 +64,12 @@ int vo_sdl_init(void)
> +
> + void vo_sdl_uninit(void)
> + {
> +-    if (SDL_WasInit(SDL_INIT_VIDEO))
> ++    if (SDL_WasInit(SDL_INIT_VIDEO)) {
> ++#ifdef SDL_VIDEO_DRIVER_VGL
> ++        VGLKeyboardInit(VGL_CODEKEYS);
> ++#endif
> +         SDL_QuitSubSystem(SDL_INIT_VIDEO);
> ++    }
> + }
> +
> + void vo_sdl_fullscreen(void)
> %%

Hi it works fine except after leaving mplayer or any SDL application my 
tty seems broken. I can't switch to a tty anymore my screen stays black 
and I must reboot/shutdown (no panic)

Are you encountering the same issue? There is no way to use vgl as 
regular user or we could open a PR for it?

Cheers,

-- 
David Demelier



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D54E869.5050508>