[mythtv-users] Custom Modeline

David myth at dgreaves.com
Sun Jun 20 11:29:22 EDT 2004


Useful stuff to understand what's going on - I know I found it 
interesting so I've added it for those who want to know
see :
http://www.mythtv.info/moin.cgi/ModeLinesHowTo/DoItByHand

I'm afraid I agree with JDS on the usefulness of tools though - be it 
videogen, a calculator or even those most primitive tools: pen and paper 
- I'll bet you don't really advocate noobs do this stuff in their head 
do you?

David

Cory Papenfuss wrote:

>     I looked at it, but I fail to see how the 'videogen' program is 
> any more intuitive than calculating the modeline yourself.  They are 
> easy to figure out:
>
> Modeline  mymode FF H1 H2 H3 H4 V1 V2 V3 V4 FLAGS
>
> FF: dotclock frequency (MHz)
> Hx: horizonal description (number of FF dots to count)
> Vx: vertical description (number of horiz. lines to count)
> FLAGS: special stuff maybe necessary for drivers (sync-on-green, sync 
> polarity,
>     interlacing, etc)
>
> Lines are drawn by counting pixels of the dotclock, but also needs to 
> describe what happens off the edge of the screen.
> H1    is picture width in pixels (e.g. 720)
> H2-H1 is the black space on the right side of the screen
> H3-H2 is the length of the sync pulse to tell the monitor to reset to the
>       beginning and start drawing another line.
> H4-H3 is the black space on the left side of the screen
>
>
> HHHHHHHHHHH___----___HHHHHHHHHHH___----___HHHHHHHHHHH___----___HHHHH...
> 0         H1 H2  H3 H4         H1 H2  H3 H4
>
> The vertical is exactly the same, except it uses complete lines to 
> count, rather than individual dots.  Here's the line I use for my 
> custom NTSC hardware board (720x480 at 59.94Hz interlaced)
>
> Modeline coryntsci 14.318 720 760 824 910 480 484 492 525 interlace
>
> 14.318 MHz dotclock
> H:
> 720    picture pixels
> 760-720 (40/14.318e6)=2.78us black on right side
> 824-760 (64/14.318e6)=4.47us sync pulse width
> 910-824 (86/14.318e6)=6.01us black on left side
> Total horiz line is 910/14.318e6 = 63.556us => 15.73 kHz (sound 
> familiar?)
>
> V:
> 480    picture lines
> 484-480 (4/15.73e3)=254us black on bottom
> 492-484 (8/15.73e3)=508us vertical sync pulse width
> 525-492 (33/14.73e3)=2.1ms black on top
> Total vert frame is 525/15.73e3 = 33.36ms => 29.97 Hz (sound familiar?)
>
>
>     It might seem complicated, but it's really pretty simple once you 
> understand what's it's doing.  Just a matter of counting dots.  The 
> tough part (sometimes) is finding the spec for the video signal (sync 
> pulse widths, etc). If you wanted to move the picture to the left a 
> bit without changing anything else, add 5 to H2 and H3.
>
> Hope that helps some folks
>
> -Cory
>
> *************************************************************************
> * The prime directive of Linux:                      *
> *     - learn what you don't know,                     *
> *     - teach what you do.                        *
> *                         (Just my 20 USm$)    *
> *************************************************************************
>
>
> On Sun, 20 Jun 2004, David wrote:
>
>> Hi
>>
>> Here's some text I've put together for Modelines
>>
>> It's up at www.mythtv.info/moin.cgi/ModeLineHowTo
>>
>> Any comments please feel free to visit and edit.
>>
>>
>>   Modelines
>>
>> OK, so you want to generate a modeline for X for your HDTV / 
>> Projector...
>>
>>
>>       What's a modeline?
>>
>> It tells your videocard how to draw a picture on your display 
>> (monitor/TV/projector etc) Each display has different capabilities. 
>> Most obviously they have different sizes and resolutions.
>>
>> Each modeline describes how to achieve a given resolution.
>>
>>
>>       And why would I care?
>>
>> When ever you look at something on your display it's shown at a 
>> certain resolutions and certain refresh frequencies. Some displays 
>> will happily accept video signals for different resolutions and 
>> convert them for you - the problem is that this can reduce the 
>> quality of the video signal. So ideally you'll get myth or xine to 
>> convert your signal once to the right resolution for your 
>> tv/projector and avoid unnecessary degradation.
>>
>> Simply - it can look better.
>>
>>
>>     My Problem
>>
>> I have a Panasonic AE100 LCD projector. I want to set it up to get 
>> the best posible resolution.
>>
>> The book tells me it has a native pixel size of 858 x484. It also 
>> lists the video modes it supports with various frequencies.
>>
>> I pick 856 x 480 with the following frequencies:
>>
>>   *
>>
>>     30.057 kHz Horiz scanning frequency
>>
>>   *
>>
>>     60.114 Hz Vert scanning frequency
>>
>>   *
>>
>>     31.500 MHz Dot clock
>>
>> So the problem is "How do I create a modeline given this input data?"
>>
>> A google returns a few options (some listed below) the most promising 
>> seemed to be videogen.
>>
>> Being a Debian user a quick apt-get install videogen has me up and 
>> running.
>>
>> man videogen is useful - the most important options being:
>>
>>     -m=XxY describes the mode you want a modeline for
>>
>>     -mdc=xx sets the maximum Dot-clock /of the videocard/, not the
>>     monitor
>>
>>     -mhf=xx sets the maximum horizontal frequency for your monitor
>>
>>     -mvf=xx sets the maximum vertical frequency for your monitor
>>
>>     -dvf=xx sets the desired vertical frequency for your monitor (I
>>     use pal so I'd like it to refresh at 50Hz)
>>
>> It's not obvious how to use it though, the HTPC How To 
>> <http://www.mythtv.info/moin.cgi/HowTo> suggestion didn't work but 
>> after a bit this command produces the desited results:
>>
>> $ videogen -m=856x480 -mdc=34 -mhf=31 -mvf=61 -dvf=60.114 -nnv
>> Modeline "856x480" 33.27 856 880 896 1096 480 482 483 505  # 33 MHz, 
>> 30.4 kHz, 60.1 Hz
>>
>> It turns out that only some resolutions are allowed; eg videogen 
>> -m=858x480 won't work and gives
>>
>> argument 2 (-m=858x480) has an invalid parameter
>>
>> OK, now we have a modeline - time to use it.
>>
>> Edit your XF86 Config <http://www.mythtv.info/moin.cgi/F86Config>-4 
>> file and find the Section "Monitor" part. Now simply insert the 
>> modeline generated above. Note the part in "s is the name of this mode.
>>
>> Now find the Section "Screen" part of the file. There should be a 
>> "Display" subsection and that should have a Modes line. This line 
>> contains a space seperated list of mode names - you cycle through 
>> these when you press *Ctrl Alt +* and *Ctrl Alt -* (that plus and 
>> minus keys) As always an example should make it easier:
>>
>> Section "Screen"
>>       Identifier "ProjScreen"
>>       Device     "GeForce"
>>       Monitor    "Projector"
>>       DefaultColorDepth 24
>>       DefaultFbbpp  32
>>       SubSection "Display"
>>               Depth     24
>>               FbBpp     32
>>               Modes "856x480"
>>       EndSubSection
>> EndSection
>>
>>
>>
>> Now start X and you should have a shiny new mode.
>>
>> Useful Links:
>>
>>
>>       Linux HTPC How-to
>>
>> In particular this page:
>>
>>     
>> http://www.sllug.org/how-to/linux-htpc/video_card_configuration.html 
>> provides a useful overview.
>>
>>
>>       Videogen
>>
>> http://www.dynaweb.hu/opensource/videogen/
>>
>> It's similar to Powerstrip.
>>
>>
>>       A quick calculator
>>
>> http://www.hut.fi/Misc/Electronics/faq/vga2rgb/calc.html
>>
>> It needs Front & back porch and sync pulse info - I'm not sure what 
>> they are. Can I get this from the h/v frequency?
>>
>>
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
>> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>>
>------------------------------------------------------------------------
>
>_______________________________________________
>mythtv-users mailing list
>mythtv-users at mythtv.org
>http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>  
>



More information about the mythtv-users mailing list