找回密码
 注册
楼主: llc

刚发现mplayer的一种用法!

[复制链接]
 楼主| 发表于 2003-8-26 09:26:41 | 显示全部楼层
[quote:54914169d2="linuxlilo"]好象与/dev/fb0设备有关,我的mplayer -vo fbdev file显示不能打开设备/dev/fb0,
请问这是怎么回事?[/quote]

在引导内核时加上参数,直接启动时进入fb模式,再执行有关程序试试

譬如给grub或lilo的内核引导行加上一些参数vga=0x???(具体的忘记了,查看内核源码目录下的相关文档,里面有列出各种模式的引导参数)

现在的显卡不支持fb或vesa非常少,除非显卡很老
回复

使用道具 举报

发表于 2003-8-26 15:00:28 | 显示全部楼层
我的显卡是winfast TNT2-16M,支持vesa,也应该支持fb吧.

我找到了文件framebuffer.txt文件,但还是不知道怎么加参数:
[code:1]
                        The Frame Buffer Device
                        -----------------------

Maintained by Geert Uytterhoeven <[email protected]>
Last revised: May 10, 2001


0. Introduction
---------------

The frame buffer device provides an abstraction for the graphics hardware. It
represents the frame buffer of some video hardware and allows application
software to access the graphics hardware through a well-defined interface, so
the software doesn't need to know anything about the low-level (hardware
register) stuff.

The device is accessed through special device nodes, usually located in the
/dev directory, i.e. /dev/fb*.


1. User's View of /dev/fb*
--------------------------

From the user's point of view, the frame buffer device looks just like any
other device in /dev. It's a character device using major 29; the minor
specifies the frame buffer number.

By convention, the following device nodes are used (numbers indicate the device
minor numbers):

      0 = /dev/fb0        First frame buffer
      1 = /dev/fb1        Second frame buffer
          ...
     31 = /dev/fb31        32nd frame buffer

For backwards compatibility, you may want to create the following symbolic
links:

    /dev/fb0current -> fb0
    /dev/fb1current -> fb1

and so on...

The frame buffer devices are also `normal' memory devices, this means, you can
read and write their contents. You can, for example, make a screen snapshot by

  cp /dev/fb0 myfile

There also can be more than one frame buffer at a time, e.g. if you have a
graphics card in addition to the built-in hardware. The corresponding frame
buffer devices (/dev/fb0 and /dev/fb1 etc.) work independently.

Application software that uses the frame buffer device (e.g. the X server) will
use /dev/fb0 by default (older software uses /dev/fb0current). You can specify
an alternative frame buffer device by setting the environment variable
$FRAMEBUFFER to the path name of a frame buffer device, e.g. (for sh/bash
users):

    export FRAMEBUFFER=/dev/fb1

or (for csh users):

    setenv FRAMEBUFFER /dev/fb1

After this the X server will use the second frame buffer.


2. Programmer's View of /dev/fb*
--------------------------------

As you already know, a frame buffer device is a memory device like /dev/mem and
it has the same features. You can read it, write it, seek to some location in
it and mmap() it (the main usage). The difference is just that the memory that
appears in the special file is not the whole memory, but the frame buffer of
some video hardware.

/dev/fb* also allows several ioctls on it, by which lots of information about
the hardware can be queried and set. The color map handling works via ioctls,
too. Look into <linux/fb.h> for more information on what ioctls exist and on
which data structures they work. Here's just a brief overview:

  - You can request unchangeable information about the hardware, like name,
    organization of the screen memory (planes, packed pixels, ...) and address
    and length of the screen memory.

  - You can request and change variable information about the hardware, like
    visible and virtual geometry, depth, color map format, timing, and so on.
    If you try to change that information, the driver maybe will round up some
    values to meet the hardware's capabilities (or return EINVAL if that isn't
    possible).

  - You can get and set parts of the color map. Communication is done with 16
    bits per color part (red, green, blue, transparency) to support all
    existing hardware. The driver does all the computations needed to apply
    it to the hardware (round it down to less bits, maybe throw away
    transparency).

All this hardware abstraction makes the implementation of application programs
easier and more portable. E.g. the X server works completely on /dev/fb* and
thus doesn't need to know, for example, how the color registers of the concrete
hardware are organized. XF68_FBDev is a general X server for bitmapped,
unaccelerated video hardware. The only thing that has to be built into
application programs is the screen organization (bitplanes or chunky pixels
etc.), because it works on the frame buffer image data directly.

For the future it is planned that frame buffer drivers for graphics cards and
the like can be implemented as kernel modules that are loaded at runtime. Such
a driver just has to call register_framebuffer() and supply some functions.
Writing and distributing such drivers independently from the kernel will save
much trouble...


3. Frame Buffer Resolution Maintenance
--------------------------------------

Frame buffer resolutions are maintained using the utility `fbset'. It can
change the video mode properties of a frame buffer device. Its main usage is
to change the current video mode, e.g. during boot up in one of your /etc/rc.*
or /etc/init.d/* files.

Fbset uses a video mode database stored in a configuration file, so you can
easily add your own modes and refer to them with a simple identifier.


4. The X Server
---------------

The X server (XF68_FBDev) is the most notable application program for the frame
buffer device. Starting with XFree86 release 3.2, the X server is part of
XFree86 and has 2 modes:

  - If the `Display' subsection for the `fbdev' driver in the /etc/XF86Config
    file contains a

        Modes "default"

    line, the X server will use the scheme discussed above, i.e. it will start
    up in the resolution determined by /dev/fb0 (or $FRAMEBUFFER, if set). You
    still have to specify the color depth (using the Depth keyword) and virtual
    resolution (using the Virtual keyword) though. This is the default for the
    configuration file supplied with XFree86. It's the most simple
    configuration, but it has some limitations.

  - Therefore it's also possible to specify resolutions in the /etc/XF86Config
    file. This allows for on-the-fly resolution switching while retaining the
    same virtual desktop size. The frame buffer device that's used is still
    /dev/fb0current (or $FRAMEBUFFER), but the available resolutions are
    defined by /etc/XF86Config now. The disadvantage is that you have to
    specify the timings in a different format (but `fbset -x' may help).

To tune a video mode, you can use fbset or xvidtune. Note that xvidtune doesn't
work 100% with XF68_FBDev: the reported clock values are always incorrect.


5. Video Mode Timings
---------------------

A monitor draws an image on the screen by using an electron beam (3 electron
beams for color models, 1 electron beam for monochrome monitors). The front of
the screen is covered by a pattern of colored phosphors (pixels). If a phosphor
is hit by an electron, it emits a photon and thus becomes visible.

The electron beam draws horizontal lines (scanlines) from left to right, and
from the top to the bottom of the screen. By modifying the intensity of the
electron beam, pixels with various colors and intensities can be shown.

After each scanline the electron beam has to move back to the left side of the
screen and to the next line: this is called the horizontal retrace. After the
whole screen (frame) was painted, the beam moves back to the upper left corner:
this is called the vertical retrace. During both the horizontal and vertical
retrace, the electron beam is turned off (blanked).

The speed at which the electron beam paints the pixels is determined by the
dotclock in the graphics board. For a dotclock of e.g. 28.37516 MHz (millions
of cycles per second), each pixel is 35242 ps (picoseconds) long:

    1/(28.37516E6 Hz) = 35.242E-9 s

If the screen resolution is 640x480, it will take

    640*35.242E-9 s = 22.555E-6 s

to paint the 640 (xres) pixels on one scanline. But the horizontal retrace
also takes time (e.g. 272 `pixels'), so a full scanline takes

    (640+272)*35.242E-9 s = 32.141E-6 s

We'll say that the horizontal scanrate is about 31 kHz:

    1/(32.141E-6 s) = 31.113E3 Hz

A full screen counts 480 (yres) lines, but we have to consider the vertical
retrace too (e.g. 49 `pixels'). So a full screen will take

    (480+49)*32.141E-6 s = 17.002E-3 s

The vertical scanrate is about 59 Hz:

    1/(17.002E-3 s) = 58.815 Hz

This means the screen data is refreshed about 59 times per second. To have a
stable picture without visible flicker, VESA recommends a vertical scanrate of
at least 72 Hz. But the perceived flicker is very human dependent: some people
can use 50 Hz without any trouble, while I'll notice if it's less than 80 Hz.

Since the monitor doesn't know when a new scanline starts, the graphics board
will supply a synchronization pulse (horizontal sync or hsync) for each
scanline.  Similarly it supplies a synchronization pulse (vertical sync or
vsync) for each new frame. The position of the image on the screen is
influenced by the moments at which the synchronization pulses occur.

The following picture summarizes all timings. The horizontal retrace time is
the sum of the left margin, the right margin and the hsync length, while the
vertical retrace time is the sum of the upper margin, the lower margin and the
vsync length.

  +----------+---------------------------------------------+----------+-------+
  |          |                ^                            |          |       |
  |          |                |upper_margin                |          |       |
  |          |               
回复

使用道具 举报

发表于 2003-8-26 15:02:13 | 显示全部楼层
是不是应该按照这个文件vesafb.txt来加参数?
[code:1]

What is vesafb?
===============

This is a generic driver for a graphic framebuffer on intel boxes.

The idea is simple:  Turn on graphics mode at boot time with the help
of the BIOS, and use this as framebuffer device /dev/fb0, like the m68k
(and other) ports do.

This means we decide at boot time whenever we want to run in text or
graphics mode.  Switching mode later on (in protected mode) is
impossible; BIOS calls work in real mode only.  VESA BIOS Extensions
Version 2.0 are required, because we need a linear frame buffer.

Advantages:

* It provides a nice large console (128 cols + 48 lines with 1024x768)
   without using tiny, unreadable fonts.
* You can run XF68_FBDev on top of /dev/fb0 (=> non-accelerated X11
   support for every VBE 2.0 compliant graphics board).
* Most important: boot logo :-)

Disadvantages:

* graphic mode is slower than text mode...


How to use it?
==============

Switching modes is done using the vga=... boot parameter.  Read
Documentation/svga.txt for details.

You should compile in both vgacon (for text mode) and vesafb (for
graphics mode). Which of them takes over the console depends on
whenever the specified mode is text or graphics.

The graphic modes are NOT in the list which you get if you boot with
vga=ask and hit return. The mode you wish to use is derived from the
VESA mode number. Here are those VESA mode numbers:

    | 640x480  800x600  1024x768 1280x1024
----+-------------------------------------
256 |  0x101    0x103    0x105    0x107   
32k |  0x110    0x113    0x116    0x119   
64k |  0x111    0x114    0x117    0x11A   
16M |  0x112    0x115    0x118    0x11B   

The video mode number of the Linux kernel is the VESA mode number plus
0x200.

Linux_kernel_mode_number = VESA_mode_number + 0x200

So the table for the Kernel mode numbers are:

    | 640x480  800x600  1024x768 1280x1024
----+-------------------------------------
256 |  0x301    0x303    0x305    0x307   
32k |  0x310    0x313    0x316    0x319   
64k |  0x311    0x314    0x317    0x31A   
16M |  0x312    0x315    0x318    0x31B   

To enable one of those modes you have to specify "vga=ask" in the
lilo.conf file and rerun LILO. Then you can type in the desired
mode at the "vga=ask" prompt. For example if you like to use
1024x768x256 colors you have to say "305" at this prompt.

If this does not work, this might be because your BIOS does not support
linear framebuffers or because it does not support this mode at all.
Even if your board does, it might be the BIOS which does not.  VESA BIOS
Extensions v2.0 are required, 1.2 is NOT sufficient.  You will get a
"bad mode number" message if something goes wrong.

1. Note: LILO cannot handle hex, for booting directly with
         "vga=mode-number" you have to transform the numbers to decimal.
2. Note: Some newer versions of LILO appear to work with those hex values,
         if you set the 0x in front of the numbers.

X11
===

XF68_FBDev should work just fine, but it is non-accelerated.  Running
another (accelerated) X-Server like XF86_SVGA might or might not work.
It depends on X-Server and graphics board.

The X-Server must restore the video mode correctly, else you end up
with a broken console (and vesafb cannot do anything about this).


Refresh rates
=============

There is no way to change the vesafb video mode and/or timings after
booting linux.  If you are not happy with the 60 Hz refresh rate, you
have these options:

* configure and load the DOS-Tools for your the graphics board (if
   available) and boot linux with loadlin.
* use a native driver (matroxfb/atyfb) instead if vesafb.  If none
   is available, write a new one!
* VBE 3.0 might work too.  I have neither a gfx board with VBE 3.0
   support nor the specs, so I have not checked this yet.


Configuration
=============

The VESA BIOS provides protected mode interface for changing
some parameters.  vesafb can use it for palette changes and
to pan the display.  It is turned off by default because it
seems not to work with some BIOS versions, but there are options
to turn it on.

You can pass options to vesafb using "video=vesa:option" on
the kernel command line.  Multiple options should be separated
by comma, like this: "video=vesa:ypan,invers"

Accepted options:

invers        no comment...

ypan        enable display panning using the VESA protected mode
        interface.  The visible screen is just a window of the
        video memory, console scrolling is done by changing the
        start of the window.
        pro:        * scrolling (fullscreen) is fast, because there is
                  no need to copy around data.
                * You'll get scrollback (the Shift-PgUp thing),
                  the video memory can be used as scrollback buffer
        kontra: * scrolling only parts of the screen causes some
                  ugly flicker effects (boot logo flickers for
                  example).

ywrap        Same as ypan, but assumes your gfx board can wrap-around
        the video memory (i.e. starts reading from top if it
        reaches the end of video memory).  Faster than ypan.

redraw        scroll by redrawing the affected part of the screen, this
        is the safe (and slow) default.


vgapal        Use the standard vga registers for palette changes.
        This is the default.
pmipal        Use the protected mode interface for palette changes.

mtrr        setup memory type range registers for the vesafb framebuffer.


Have fun!

  Gerd

--
Gerd Knorr <[email protected]>

Minor (mostly typo) changes
by Nico Schmoigl <[email protected]>
[/code:1]
回复

使用道具 举报

发表于 2003-8-26 20:50:13 | 显示全部楼层
现在的显卡都支持。 包括你的。但是你的系统要有vesa的帧缓冲模块才行,或者已经编译进了内核。现在大部分发行版都已经支持了
[quote:671c6554d6="linuxlilo"]是不是字符界面下的抓屏工具?
字符界面的抓屏工具有哪些?
谢谢!
[quote:671c6554d6="gugong"]我用 fbdev 在文本控制台 下播放很正常,用 vesa 却不行 ![/quote][/quote]
http://www.linuxfans.org/nuke/modules.php?name=Site_Downloads&op=geninfo&did=348
http://www.linuxfans.org/nuke/modules.php?name=Site_Downloads&op=geninfo&did=349
    | 640x480  800x600  1024x768 1280x1024
----+-------------------------------------
256 |  0x301    0x303    0x305    0x307   
32k |  0x310    0x313    0x316    0x319   
64k |  0x311    0x314    0x317    0x31A   
16M |  0x312    0x315    0x318    0x31B

在grub.conf中的kernel行后面写上vga=0x???参数实现
回复

使用道具 举报

发表于 2003-8-26 22:51:36 | 显示全部楼层
谢谢,字符界面下截图是不是可以cp /dev/fb0 myfile(上面看到的)这样?
有谁试过?
回复

使用道具 举报

发表于 2003-8-30 11:16:02 | 显示全部楼层
我放的时候直接全屏,没法缩放,而且色彩失真严重,原来兰色的变为红的,看《太空堡垒》的时候蓝色alppha变成了红色alpha。
回复

使用道具 举报

发表于 2003-8-31 00:44:37 | 显示全部楼层
我的显卡是ATI 8500le能用吗?
回复

使用道具 举报

发表于 2003-10-26 19:27:22 | 显示全部楼层
mplayer-1.0pre2版,在文本界面下,怎样全屏看呢?
回复

使用道具 举报

发表于 2003-10-26 19:40:57 | 显示全部楼层
偶用mplayer -vo vesa a.asf 可以在文本界面下全屏看了。怎样才能放大两倍而不是全屏呢?
回复

使用道具 举报

发表于 2003-10-27 10:19:41 | 显示全部楼层
[quote:8eeb2ea238="labrun"]偶用mplayer -vo vesa a.asf 可以在文本界面下全屏看了。怎样才能放大两倍而不是全屏呢?[/quote]修改conf文件
回复

使用道具 举报

发表于 2004-5-29 17:21:13 | 显示全部楼层

无法使用mplayer?

我用vmwrae装的REDHAT,显卡自动识别为vmware的,但用mplyaer放rm文件时老报-vo错,请问怎样处理,我的mplayer是用rpm包安装的。
回复

使用道具 举报

 楼主| 发表于 2004-5-29 19:24:16 | 显示全部楼层

Re: 无法使用mplayer?

[quote:852d492132="yushan2000"]我用vmwrae装的REDHAT,显卡自动识别为vmware的,但用mplyaer放rm文件时老报-vo错,请问怎样处理,我的mplayer是用rpm包安装的。[/quote]

vmware虚拟出来的显卡好像支持vesa,用-vo vesa参数试试
回复

使用道具 举报

发表于 2004-7-17 00:26:33 | 显示全部楼层
[quote:d6456f4994="mking007"]我放的时候直接全屏,没法缩放,而且色彩失真严重,原来兰色的变为红的,看《太空堡垒》的时候蓝色alppha变成了红色alpha。[/quote]

I am being bothered by the same problem
回复

使用道具 举报

发表于 2005-8-23 13:34:47 | 显示全部楼层
我一打开就是全屏的,退都退不出来,放完了还是退不出来.
要怎么样退出全屏爱?~~~~~~~~~
回复

使用道具 举报

发表于 2005-8-23 16:32:41 | 显示全部楼层
[quote:9de94ea190="ericgau"]我一打开就是全屏的,退都退不出来,放完了还是退不出来.
要怎么样退出全屏爱?~~~~~~~~~[/quote]

我也是!

不知是不是显卡不好的缘故?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2025-8-6 01:16 , Processed in 0.066512 second(s), 14 queries .

© 2001-2025 Discuz! Team. Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表