要绘制显示器模式图,您需要 gnuplot 软件包(一个用于类 UNIX 操作系统的自由绘图语言)和工具 modeplot,这是一个 shell/gnuplot 脚本,用于从您的显示器特性(以命令行选项形式输入)绘制图表。
这是 modeplot 的副本
#!/bin/sh # # modeplot -- generate X mode plot of available monitor modes # # Do `modeplot -?' to see the control options. # # Monitor description. Bandwidth in MHz, horizontal frequencies in kHz # and vertical frequencies in Hz. TITLE="Viewsonic 21PS" BANDWIDTH=185 MINHSF=31 MAXHSF=85 MINVSF=50 MAXVSF=160 ASPECT="4/3" vesa=72.5 # VESA-recommended minimum refresh rate while [ "$1" != "" ] do case $1 in -t) TITLE="$2"; shift;; -b) BANDWIDTH="$2"; shift;; -h) MINHSF="$2" MAXHSF="$3"; shift; shift;; -v) MINVSF="$2" MAXVSF="$3"; shift; shift;; -a) ASPECT="$2"; shift;; -g) GNUOPTS="$2"; shift;; -?) cat <<EOF modeplot control switches: -t "<description>" name of monitor defaults to "Viewsonic 21PS" -b <nn> bandwidth in MHz defaults to 185 -h <min> <max> min & max HSF (kHz) defaults to 31 85 -v <min> <max> min & max VSF (Hz) defaults to 50 160 -a <aspect ratio> aspect ratio defaults to 4/3 -g "<options>" pass options to gnuplot The -b, -h and -v options are required, -a, -t, -g optional. You can use -g to pass a device type to gnuplot so that (for example) modeplot's output can be redirected to a printer. See gnuplot(1) for details. The modeplot tool was created by Eric S. Raymond <esr@thyrsus.com> based on analysis and scratch code by Martin Lottermoser <Martin.Lottermoser@mch.sni.de> This is modeplot $Revision: 1.27 $ EOF exit;; esac shift done gnuplot $GNUOPTS <<EOF set title "$TITLE Mode Plot" # Magic numbers. Unfortunately, the plot is quite sensitive to changes in # these, and they may fail to represent reality on some monitors. We need # to fix values to get even an approximation of the mode diagram. These come # from looking at lots of values in the ModeDB database. F1 = 1.30 # multiplier to convert horizontal resolution to frame width F2 = 1.05 # multiplier to convert vertical resolution to frame height # Function definitions (multiplication by 1.0 forces real-number arithmetic) ac = (1.0*$ASPECT)*F1/F2 refresh(hsync, dcf) = ac * (hsync**2)/(1.0*dcf) dotclock(hsync, rr) = ac * (hsync**2)/(1.0*rr) resolution(hv, dcf) = dcf * (10**6)/(hv * F1 * F2) # Put labels on the axes set xlabel 'DCF (MHz)' set ylabel 'RR (Hz)' 6 # Put it right over the Y axis # Generate diagram set grid set label "VB" at $BANDWIDTH+1, ($MAXVSF + $MINVSF) / 2 left set arrow from $BANDWIDTH, $MINVSF to $BANDWIDTH, $MAXVSF nohead set label "max VSF" at 1, $MAXVSF-1.5 set arrow from 0, $MAXVSF to $BANDWIDTH, $MAXVSF nohead set label "min VSF" at 1, $MINVSF-1.5 set arrow from 0, $MINVSF to $BANDWIDTH, $MINVSF nohead set label "min HSF" at dotclock($MINHSF, $MAXVSF+17), $MAXVSF + 17 right set label "max HSF" at dotclock($MAXHSF, $MAXVSF+17), $MAXVSF + 17 right set label "VESA $vesa" at 1, $vesa-1.5 set arrow from 0, $vesa to $BANDWIDTH, $vesa nohead # style -1 plot [dcf=0:1.1*$BANDWIDTH] [$MINVSF-10:$MAXVSF+20] \ refresh($MINHSF, dcf) notitle with lines 1, \ refresh($MAXHSF, dcf) notitle with lines 1, \ resolution(640*480, dcf) title "640x480 " with points 2, \ resolution(800*600, dcf) title "800x600 " with points 3, \ resolution(1024*768, dcf) title "1024x768 " with points 4, \ resolution(1280*1024, dcf) title "1280x1024" with points 5, \ resolution(1600*1280, dcf) title "1600x1200" with points 6 pause 9999 EOF |
一旦您确认已安装 modeplot 和 gnuplot 软件包,您将需要以下显示器特性
视频带宽 (VB)
水平同步频率范围 (HSF)
垂直同步频率范围 (VSF)
绘图程序需要进行一些简化的假设,这些假设不一定完全正确。 这就是为什么最终的图表只是一个粗略的描述。 这些假设包括:
所有分辨率都具有单一固定的宽高比 AR = HR/VR。 标准分辨率的 AR 为 4/3 或 5/4。modeplot 程序默认假设为 4/3,但您可以覆盖此设置。
对于所考虑的显示模式,水平和垂直帧长分别是水平和垂直分辨率的固定倍数
HFL = F1 * HR VFL = F2 * VR |
作为一个粗略的指南,取 F1 = 1.30 和 F2 = 1.05(参见计算帧大小)。
现在取一个特定的同步频率 HSF。 鉴于前面提出的假设,时钟频率 DCF 的每个值都已确定刷新率 RR,即对于 HSF 的每个值,都存在一个函数 RR(DCF)。 这可以推导如下。
刷新率等于时钟频率除以帧大小的乘积
RR = DCF / (HFL * VFL) (*) |
另一方面,水平帧长等于时钟频率除以水平同步频率
HFL = DCF / HSF (**) |
根据上述两个假设,VFL 可以被简化为 HFL
VFL = F2 * VR = F2 * (HR / AR) = (F2/F1) * HFL / AR (***) |
将 (**) 和 (***) 代入 (*),我们得到
RR = DCF / ((F2/F1) * HFL**2 / AR) = (F1/F2) * AR * DCF * (HSF/DCF)**2 = (F1/F2) * AR * HSF**2 / DCF |
对于固定的 HSF、F1、F2 和 AR,这在我们图表中是一条双曲线。 绘制两条分别对应最小和最大水平同步频率的此类曲线,我们就获得了允许区域的其余两个边界。
穿过能力区域的直线代表特定的分辨率。 这是基于 (*) 和第二个假设。
RR = DCF / (HFL * VFL) = DCF / (F1 * HR * F2 * VR) |
通过绘制所有感兴趣分辨率的此类直线,可以立即读出显示器能够实现的 resolutions、时钟频率和刷新率之间的可能关系。 请注意,这些直线不依赖于显示器属性,但它们确实依赖于第二个假设。
modeplot 工具为您提供了一种简单的方法来执行此操作。 执行 modeplot -? 以查看其控制选项。 一个典型的调用示例如下
modeplot -t "Swan SW617" -b 85 -v 50 90 -h 31 58 |
-b 选项指定视频带宽;-v 和 -h 设置水平和垂直同步频率范围。
在阅读 modeplot 的输出时,请始终记住,它仅提供近似的描述。 例如,它忽略了由于最小所需同步脉冲宽度而导致的 HFL 限制,并且其准确性仅限于假设的范围。 因此,它不能替代 Putting it All Together 中提出的详细计算(涉及一些黑魔法)。 然而,它应该让您更好地了解什么是可能的以及涉及哪些权衡。