Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

640x512x16bpp with VESA ?

38 views
Skip to first unread message

whygee

unread,
May 14, 2008, 8:45:37 PM5/14/08
to
Hello,

I have to use a 1280x1024 screen but there are too many pixels
to compute there. I think that a halved resolution would fit
but 1:1.25 ratio modes are very scarce. Practically, I use
the VESA2 framebuffer in ASM with my own bootloader so the
help of an operating system is useless, unless it gives me
correct parameters. Should I dump the registers after X.org
has set this mode ?

I guess that I have to setup 1280x1024x16 then tweak the CRTC
to "double scan" (so i get 1280x512). I have read books 12 years
ago about this but i don't remember the particularities of the X mode :-)
I have to half the clock speed too but it's above my ability now
(i don't have the books anymore). Hint : my graphics chip is based on S3.

My requirement is to conserve the 1:1.25 ratio of the screen
with practically fine values. If you know of other resolutions
that fit, fine, as long as I can set it with a simple asm program.

thanks,
YG (not been here for 8 years or so...)

Dirk Wolfgang Glomp

unread,
May 15, 2008, 6:18:39 AM5/15/08
to
Am Thu, 15 May 2008 02:45:37 +0200 schrieb whygee:

> Hello,
>
> I have to use a 1280x1024 screen but there are too many pixels
> to compute there. I think that a halved resolution would fit
> but 1:1.25 ratio modes are very scarce. Practically, I use
> the VESA2 framebuffer in ASM with my own bootloader so the
> help of an operating system is useless, unless it gives me
> correct parameters.

Public information from vesa.org:
vbe3.pdf

EEDIDguideV1.pdf
e-edid_implementation_guide_vesa.pdf
EEDIDverifGuideRa.pdf
Vbeddc11.pdf

GTF_V1R1.xls
CVTd6r1.xls

VBE-AF07.pdf
-----------------------------------------------------------
INT 10 - VESA SuperVGA BIOS (VBE) - GET SuperVGA INFORMATION
AX = 4F00h
ES:DI -> buffer for SuperVGA information (see #00077)
...
Format of SuperVGA information:
Offset Size Description (Table 00077)
...
0Eh DWORD pointer to list of supported VESA and OEM video modes
(list of words terminated with FFFFh)
;-------------------------------------------------------
INT 10 - VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION
AX = 4F01h
CX = SuperVGA video mode
bit 14 set means enable linear framebuffer mode (VBE v2.0+)
bit 13 set means VBE/AF v1.0P initializes accelerator hardware
ES:DI -> 256-byte buffer for mode information (see #00079)
...
Format of VESA SuperVGA mode information:
Offset Size Description (Table 00079)
00h WORD mode attributes (see #00080)
...
12h WORD width in pixels (graphics) or characters (text)
14h WORD height in pixels (graphics) or characters (text)
...
19h BYTE number of bits per pixel
...
28h DWORD physical address of linear video buffer
...

Bitfields for VESA SuperVGA mode attributes:
Bit(s) Description (Table 00080)
[vbe3.pdf]
The ModeAttributes field is defined as follows:
D0 = Mode supported by hardware configuration
0 = Mode not supported in hardware
1 = Mode supported in hardware
D1 = 1 (Reserved)
D2 = TTY Output functions supported by BIOS
0 = TTY Output functions not supported by BIOS
1 = TTY Output functions supported by BIOS
D3 = Monochrome/color mode (see note below)
0 = Monochrome mode
1 = Color mode
D4 = Mode type
0 = Text mode
1 = Graphics mode
D5 = VGA compatible mode
0 = Yes
1 = No
D6 = VGA compatible windowed memory mode is available
0 = Yes
1 = No
D7 = Linear frame buffer mode is available
0 = No
1 = Yes
D8 = Double scan mode is available
0 = No
1 = Yes
D9 = Interlaced mode is available
0 = No
1 = Yes
D10 = Hardware triple buffering support
0 = No
1 = Yes
D11 = Hardware stereoscopic display support
0 = No
1 = Yes
D12 = Dual display start address support
0 = No
1 = Yes
D13-D15 = Reserved
;-------------------------------------------------------
INT 10 - VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE
AX = 4F02h
BX = mode
ES:DI = Pointer to CRT-Block

Videomode + 800h = use refresh rate control(only VBE3)

Setting double scan modes
If double scanning is supported by the hardware, it is possible to
support modes like 320x200, 320x240 and 400x300 that scan each line
twice in the vertical direction. These modes cannot be implemented
without double scanning support, and if the application is attempting
to perform refresh rate control on these modes, setting the double
scan bit is required. When setting a double scan mode, the actual CRTC
parameters calculated and passed in will be equal to double the number
of vertical lines. Hence for a 200 line mode you would actually set
the vertical CRTC parameters and pixel clock for a 400 line mode,
and set the double scan bit to convert the mode to a 200 line
addressable mode. Note that if you are using double scanned modes,
you cannot enable interlaced operation.

CRT DW HorizontalTotal
DW HorizontalSyncStart
DW HorizontalSyncEnd
DW VerticalTotal
DW VerticalSyncStart
DW VerticalSyncEnd
DB Flags
DD Pixelclock
DW RefreshRate
DB 40 dup (0)

;-------- normalized pixel clock -----------------
mov di, OFFSET CRT
mov ecx, DWORD PTR[di+0Dh] ; Pixelclock
mov ax, 4F0Bh ; get/set Pixel-Clock
xor bl, bl ; 0=get
mov dx, bp ; Video-Mode
int 10h
cmp ax, 4Fh
jnz ERROR
mov DWORD PTR[di+0Dh], ecx ; pixelclock
;-----------refreshRate-------------------
xor eax, eax ; calculate RefreshRate
mov ax, [di] ; HorizontalTotal
xor ebx, ebx
mov bx, [di+6] ; VertikalTotal
mul ebx
mov ebx, eax
mov eax, ecx ; Pixelclock
mov esi, 10
xor edx, edx
div esi
xor edx, edx
div ebx
mov [di+11h], ax ; RefreshRate=Pixelclock/(HTotal*Vtotal)

> Should I dump the registers after X.org
> has set this mode ?

I have many problems to read the sources.

***

I惴 interresting to set a separate vesamode for the secondary device,
so that i can acess a secondary linear adressfield for the secondary
display. Now the secondary displays shows the same contents of the primary
device, also when i switch to another videomode. Testet with a GF6800GT.

A test to get the EDID of the secondary display(Vbeddc11.pdf) fails.
Input: AX=4F15 BL=0 CX=1 Return: AX=004F BX=0000
(A test with the same "Syncmaster 950p" on the primary adapter
results successfully and i can get the EDID).

I don愒 found the way in "VBE-AF07.pdf" to handle a secondary device.
It is neccessary to switch the interface using AH=12h/BL=35h and maybe
store the current VIDEO STATE(AH=4F04h) before?

[RBIL]
--------V-1012--BL35-------------------------
INT 10 - VIDEO - ALTERNATE FUNCTION SELECT (PS) - DISPLAY-SWITCH INTERFACE
AH = 12h
BL = 35h
AL = subfunction
00h initial adapter video off
01h initial planar video on
02h switch active video off
03h switch inactive video on
80h *UNDOCUMENTED* set system board video active flag
ES:DX -> buffer for 128 byte save area (if AL = 00h-03h)
Return: AL = 12h if function supported
Desc: switch between two video adapters which may otherwise have address
conflicts
SeeAlso: AX=BF00h,AX=BF01h,INT 6D"VGA"

--------V-104F04-----------------------------
INT 10 - VESA SuperVGA BIOS - SAVE/RESTORE SuperVGA VIDEO STATE
AX = 4F04h
DL = subfunction

> I guess that I have to setup 1280x1024x16 then tweak the CRTC
> to "double scan" (so i get 1280x512). I have read books 12 years
> ago about this but i don't remember the particularities of the X mode :-)
> I have to half the clock speed too but it's above my ability now
> (i don't have the books anymore). Hint : my graphics chip is based on S3.

...

> My requirement is to conserve the 1:1.25 ratio of the screen
> with practically fine values. If you know of other resolutions
> that fit, fine, as long as I can set it with a simple asm program.
>
> thanks,
> YG (not been here for 8 years or so...)

Sorry, i never compute a modi with double scan and i alsway use the given
modi. Where is the problem to use a lower mode?

;--------------------------------------
; 640x480 85 Hz
;--------------------------------------
CRTC DW 832
HORISTA DW 700
HORIEND DW 64
VERTOTA DW 509
VERTSTA DW 480
VERTEND DW 25
DOIFLAG DB 0Ch
PIXCLOC DD 35993000
REFRATE DW 8499
DB 40 dup (0)
;--------------------------------------

***

-------------------------------------
ATI 9800 PRO VESA Modi 128 MB (VBE2)
-------------------------------------
4 8 15 16 24 32 Matrix
-------------------------------------
109 132 x 25
10A 132 x 43
130 132 x 44
182 10D 10E 10F 120 320 x 200
192 193 194 195 196 320 x 240
1A2 1A3 1A4 1A5 1A6 400 x 300
1B2 1B3 1B4 1B5 1B6 512 x 384
1C2 1C3 1C4 1C5 1C6 640 x 350
100 183 184 185 186 640 x 400
101 110 111 112 121 640 x 480
102 103 113 114 115 122 800 x 600
104 105 106 107 108 123 1024 x 768
107 119 11A 11B 124 1280 x 1024
-------------------------------------
ATI X800 PRO VESA MODI 256 MB
-------------------------------------
4 8 15 16 24 32 Matrix
-------------------------------------
109 132 x 25
10A 132 x 34
130 132 x 44
10D 10F 320 x 200
193 194 196 320 x 240
1B3 1B4 1B6 512 x 384
1C3 1C4 1C6 640 x 350
100 184 186 640 x 400
101 110 112 640 x 480
133 134 136 720 x 400
103 113 115 800 x 600
105 116 118 1024 x 768
153 154 156 1152 x 864
107 119 11B 1280 x 1024
143 144 146 1400 x 1050
173 174 176 1600 x 1200
1D3 1D4 1D6 1856 x 1392
1E3 1E4 1E6 1920 x 1440
-------------------------------------
NVIDIA GF 4 Ti4200 VESA Modi 64 MB
-------------------------------------
4 8 15 16 24 32 Matrix
-------------------------------------
108 80 x 60
109 132 x 25
10A 132 x 43
10B 132 x 50
10C 132 x 60
130 10E 10F 320 x 200
134 135 136 320 x 240
131 132 133 320 x 400
100 13D 13E 640 x 400
101 111 112 640 x 480
102 103 114 115 800 x 600
104 105 117 118 1024 x 768
106 107 11A 1280 x 1024
147 148 1400 x 1050
145 146 1600 x 1200
-------------------------------------
NVIDIA GF 6800 GT VESA Modi 256 MB
-------------------------------------
4 8 15 16 24 32 Matrix
-------------------------------------
130 10E 10F 320 x 200
134 135 136 320 x 240
131 132 133 320 x 400
100 13D 13E 640 x 400
101 111 112 640 x 480
102 103 114 115 800 x 600
104 105 117 118 1024 x 768
106 107 11A 11B 1280 x 1024
145 146 1600 x 1200
147 148 1400 x 1050
152 2048 x 1536
-------------------------------------

Dirk

Wolfgang Kern

unread,
May 15, 2008, 7:19:00 AM5/15/08
to

"whygee" wrote:
> Hello,
Hi,

> I have to use a 1280x1024 screen but there are too many pixels
> to compute there. I think that a halved resolution would fit
> but 1:1.25 ratio modes are very scarce. Practically, I use
> the VESA2 framebuffer in ASM with my own bootloader so the
> help of an operating system is useless, unless it gives me
> correct parameters. Should I dump the registers after X.org
> has set this mode ?

Dunno what X.org does nor what it is ...
but I also have to use VESA/VBE to set Vmodes on newer PCI/AGP cards,
because they are unfortunately not at all documented in deep detail.

> I guess that I have to setup 1280x1024x16 then tweak the CRTC

by x16 you mean 16 colors on four distributed planes ?
or 16-bit colours ?

> to "double scan" (so i get 1280x512). I have read books 12 years
> ago about this but i don't remember the particularities of the X mode :-)
> I have to half the clock speed too but it's above my ability now
> (i don't have the books anymore). Hint : my graphics chip is based on S3.

It will not be enough to set Vclock and double-scan, you need also
to recalculate synch/border/blank periods within the range of your
monitor.
I remember good old S3-times quite well and I played around with
own created Video-modes of any kind, even a weird behaving mixed
Text/Graphic-mode were possible here.

> My requirement is to conserve the 1:1.25 ratio of the screen
> with practically fine values. If you know of other resolutions
> that fit, fine, as long as I can set it with a simple asm program.

You got a 5:4 (better known as 10:8) monitor ?
I never used any 4-bit color format, my preference is and always was
8-bit (one byte/pixel serves me well) and my standard resolution is
1152*864x256 to allow a 1024x768 display plus tool-bars and stuff,
so keeping the monitors 4:3 format (and circels remain 'round').

I once found all required information for S3(GL4x/5x..)in RBIL(ports).
This collection may be still on one of my old HDs, so if you don't
find it on the net, I could search my archives and post the few pages.

Do you know which S3-chip is in there ?

> thanks,
> YG (not been here for 8 years or so...)

welcome back ;)
__
wolfgang


whygee

unread,
May 15, 2008, 8:23:59 PM5/15/08
to
Hello all and thank you for you supportive and informative answers !

Wolfgang Kern wrote:
> "whygee" wrote:
>> Hello,
> Hi,


>
> Dunno what X.org does nor what it is ...

you know, the X11 server for GNU/Linux et al.

> but I also have to use VESA/VBE to set Vmodes on newer PCI/AGP cards,
> because they are unfortunately not at all documented in deep detail.

nobody cares to document these days :-(

>> I guess that I have to setup 1280x1024x16 then tweak the CRTC
> by x16 you mean 16 colors on four distributed planes ?
> or 16-bit colours ?

I display fixed pictures in 16-bit color (5-6-5 RVB).
My tests show that 24bpp is overkill and 16bpp saves some memory
(i don't care to compress the picture data, i have enough room
for a whole gallery :-P). On top of that, 24bpp would need to be in
32-bit aligned pixels to ease the random accesses.

Then, each pixel is computed and moved all over the screen,
using personal algorithms that make this kind of picture :
http://ygdes.com/sediments.jpg :-)
So 16-bit pixels is the good choice here.

>> to "double scan" (so i get 1280x512). I have read books 12 years
>> ago about this but i don't remember the particularities of the X mode :-)
>> I have to half the clock speed too but it's above my ability now
>> (i don't have the books anymore). Hint : my graphics chip is based on S3.
> It will not be enough to set Vclock and double-scan, you need also
> to recalculate synch/border/blank periods within the range of your
> monitor.

that's what i guess, but i have not looked closely yet,
as long as i don't know how to change these in the S3 chip.

> I remember good old S3-times quite well and I played around with
> own created Video-modes of any kind, even a weird behaving mixed
> Text/Graphic-mode were possible here.

:-)
I had some fun with a 286 in the mid-90s too :-)
but i kept on the track, fearing to burn my CRT.

>> My requirement is to conserve the 1:1.25 ratio of the screen
>> with practically fine values. If you know of other resolutions
>> that fit, fine, as long as I can set it with a simple asm program.
>
> You got a 5:4 (better known as 10:8) monitor ?

monitorS :-) 16:10 LCD monitors are not old enough to be found
at "decent" prices in the used market :-) I have tested
a 640x400 resolution (stock VESA) with success on a 1920x1200 screen
but it's too expensive :-) The available hardware, the platforms and
a few other constraints guide the development.

> I never used any 4-bit color format, my preference is and always was
> 8-bit (one byte/pixel serves me well)

Same for me. But here, 16bpp is the way to go.

> and my standard resolution is
> 1152*864x256 to allow a 1024x768 display plus tool-bars and stuff,
> so keeping the monitors 4:3 format (and circels remain 'round').

getting (and keeping) "square" pixels is very difficult today :-/

> I once found all required information for S3(GL4x/5x..)in RBIL(ports).
> This collection may be still on one of my old HDs, so if you don't
> find it on the net, I could search my archives and post the few pages.

I downloaded RBIL recently. Wow, that is still extremely useful today !

BTW, I have read somewhere that recent Intel chips have MSRs that
control the core voltage and frequency, which would be incredibly
useful to reduce the power consumption of the Intel D201GLY2 motherboards
that i also want to use.
Has anybody found where/how to control this ?

> Do you know which S3-chip is in there ?

It's an embedded PC in 5"25 form factor with a VIA C3 @ 800MHz.

The manual says :

VGA: S3 Savage4 on Die, 4X AGP, 2D/3D support,
32 MB shared Frame Buffer, TTL/ LVDS interface to Panels

copy-paste :
VIA 8606 Integrated Savage4 2D/3D/Video Accelerator
Optimized Shared Memory Architecture (SMA)
8 / 16 / 32 MB frame buffer using system memory <--- beware, this
can kick you in the back if you have only a 32MB or 64MB SDRAM module :-D
Single cycle 128-bit 3D architecture <--- useless
Full internal AGP 4x performance <-- more interesting, but yet, not lightning fast.
Next generation, 128-bit 2D graphics engine <--- well...
High quality DVD video playback <-- who cares ?
2D/3D resolutions up to 1920x1440
3D Rendering Features
Extensive LCD Support
36-bit DSTN/TFT flat panel interface with 256 gray shade support
Integrated 110 MHz LVDS interface
Support for all resolutions up to 1600x1200
Drivers support:Windows 95/98/2000, Windows NT4.0, Win XP, Linux.
15Pin D-Sub VGA Output,
LVDS Interface Connector x 1
TTL LCD Interface Connector x 1

I've uploaded the manual at http://ygdes.com/VIA/
if you want to see a bit more, all I know for sure is that it
is embedded in the VIA 8606 northbridge.

I have dumped the VESA2 listed modes with custom software
and it looks a lot like the S3 board i have in the laptop that i am now using
to type this post :

n°VESA X Y col Linux
100h 280h 190h 8 300h/769: 640x400x8
101h 280h 1E0h 8 301h/769: 640x480x8
102h 320h 258h 4 302h/770: 800x600x4
103h 320h 258h 8 303h/771: 800x600x8
105h 400h 300h 8 305h/773: 1024x768x8
107h 500h 400h 8 307h/775: 1280x1024x8
10Eh 140h C8h 16 30Eh/782: 320x200x16
10Fh 140h C8h 32 30Fh/783: 320x200x32
111h 280h 1E0h 16 311h/785: 640x480x16
112h 280h 1E0h 32 312h/786: 640x480x32
114h 320h 258h 16 314h/788: 800x600x16
115h 320h 258h 32 315h/789: 800x600x32
117h 400h 300h 16 317h/791: 1024x768x16
118h 400h 300h 32 318h/792: 1024x768x32
11Ah 500h 400h 16 31Ah/794: 1280x1024x16 <---
11Bh 500h 400h 32 31Bh/795: 1280x1024x32
11Dh 280h 190h 16 31Dh/797: 640x400x16
11Eh 280h 190h 32 31Eh/798: 640x400x32
120h 640h 4B0h 8 320h/800: 1600x1200x8
122h 640h 4B0h 16 322h/802: 1600x1200x16
124h 640h 4B0h 32 324h/804: 1600x1200x32
12Eh 140h C8h 8 32Eh/814: 320x200x8
131h 140h F0h 8 331h/817: 320x240x8
133h 140h F0h 16 333h/819: 320x240x16
134h 140h F0h 32 334h/820: 320x240x32
13Bh 578h 41Ah 8 33Bh/827: 1400x1050x8
13Ch 578h 41Ah 16 33Ch/828: 1400x1050x16
13Eh 578h 41Ah 32 33Eh/830: 1400x1050x32
141h 190h 12Ch 8 341h/833: 400x300x8
143h 190h 12Ch 16 343h/835: 400x300x16
144h 190h 12Ch 32 344h/836: 400x300x32
151h 200h 180h 8 351h/849: 512x384x8
153h 200h 180h 16 353h/851: 512x384x16
154h 200h 180h 32 354h/852: 512x384x32

I should try to see if VBE3 is supported, I have found some docs but
I have not yet used those data. my attention is scattered among
countless details now :-/

Also, i could have chosen to simply use 1280x1024 and display
a pixel with 4 real pixels, but i can't in practice.
My algo performs huge quantities of random accesses to the framebuffer
and this already saturates the write combining buffers.
I could maybe double a pixel in a line, but not on consecutive lines
(or the software would slow down the already inefficient CPU).
So at least i need the doublescan feature.

It's getting really exciting...

>> thanks,
>> YG (not been here for 8 years or so...)
> welcome back ;)

this makes me feel old :-) [but fortunately, I am far from cranky]

> wolfgang
YG

whygee

unread,
May 15, 2008, 10:00:15 PM5/15/08
to
Hi !

Dirk Wolfgang Glomp wrote:
> Am Thu, 15 May 2008 02:45:37 +0200 schrieb whygee:
>
> Public information from vesa.org:
> vbe3.pdf

I have found it recently but have not had enough time
to digest everything :-/

> EEDIDguideV1.pdf
> e-edid_implementation_guide_vesa.pdf
> EEDIDverifGuideRa.pdf
> Vbeddc11.pdf
I gotta find them too, it seems.

> GTF_V1R1.xls
> CVTd6r1.xls

hmmm XLS is a pain under Linux...
particularly with OpenOffice on my memory-limited system :-)

> VBE-AF07.pdf
> -----------------------------------------------------------
> INT 10 - VESA SuperVGA BIOS (VBE) - GET SuperVGA INFORMATION

> INT 10 - VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION

I know them already, they're just like in VBE2

> Bitfields for VESA SuperVGA mode attributes:

> [vbe3.pdf]


> D8 = Double scan mode is available
> 0 = No
> 1 = Yes
> D9 = Interlaced mode is available
> 0 = No
> 1 = Yes

oh ! i didn't see them before !!Thanks :-))

> ;-------------------------------------------------------
> INT 10 - VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE
>

> Videomode + 800h = use refresh rate control(only VBE3)

hmmmm sounds interesting, but i don't know what it is.

> Setting double scan modes
> If double scanning is supported by the hardware, it is possible to
> support modes like 320x200, 320x240 and 400x300 that scan each line
> twice in the vertical direction. These modes cannot be implemented
> without double scanning support, and if the application is attempting
> to perform refresh rate control on these modes, setting the double
> scan bit is required. When setting a double scan mode, the actual CRTC
> parameters calculated and passed in will be equal to double the number
> of vertical lines. Hence for a 200 line mode you would actually set
> the vertical CRTC parameters and pixel clock for a 400 line mode,
> and set the double scan bit to convert the mode to a 200 line
> addressable mode. Note that if you are using double scanned modes,
> you cannot enable interlaced operation.
>
> CRT DW HorizontalTotal
> DW HorizontalSyncStart
> DW HorizontalSyncEnd
> DW VerticalTotal
> DW VerticalSyncStart
> DW VerticalSyncEnd
> DB Flags
> DD Pixelclock
> DW RefreshRate
> DB 40 dup (0)

oh...

I have found the following on Google while searching the "640x512" string :

(**) TDFX(0): *Default mode "640x512": 54.0 MHz, 64.0 kHz, 60.0 Hz (D)
(II) TDFX(0): Modeline "640x512" 54.00 640 664 720 844 512 512 514 533 doublescan +hsync +vsync

I infer a pixclock of 54MHz, horizontal refresh of 64KHz, and 60Hz of vertical refresh.
The rest is an encoded modline, i remember that i have found some Linux framebuffer doc
detailing the computations and how to interpret the X.org modlines (or VGAlib ?)

But i didn't know that it was possible to ask VBE3 for a custom resolution \o/

> ***
>
> I惴 interresting to set a separate vesamode for the secondary device,
> so that i can acess a secondary linear adressfield for the secondary
> display. Now the secondary displays shows the same contents of the primary
> device, also when i switch to another videomode. Testet with a GF6800GT.

I have some Matrox DualHead-capable cards (G450) but have not been
successful with them in the past.

> A test to get the EDID of the secondary display(Vbeddc11.pdf) fails.
> Input: AX=4F15 BL=0 CX=1 Return: AX=004F BX=0000
> (A test with the same "Syncmaster 950p" on the primary adapter
> results successfully and i can get the EDID).

hmmm DDC is interesting but I have mostly used laptops recently
so it was not necessary.

> I don愒 found the way in "VBE-AF07.pdf" to handle a secondary device.
> It is neccessary to switch the interface using AH=12h/BL=35h and maybe
> store the current VIDEO STATE(AH=4F04h) before?

no idea _o_

>> My requirement is to conserve the 1:1.25 ratio of the screen
>> with practically fine values. If you know of other resolutions
>> that fit, fine, as long as I can set it with a simple asm program.
>>

> Sorry, i never compute a modi with double scan and i alsway use the given
> modi. Where is the problem to use a lower mode?

I'd like to have roughly 640-pixel lines and a 5:4 ratio that
fits the screen. 1280x1024 is too much to compute and store
for my platform. 640x512 is ok.

> ;--------------------------------------
> ; 640x480 85 Hz
> ;--------------------------------------
> CRTC DW 832
> HORISTA DW 700
> HORIEND DW 64
> VERTOTA DW 509
> VERTSTA DW 480
> VERTEND DW 25
> DOIFLAG DB 0Ch
> PIXCLOC DD 35993000
> REFRATE DW 8499
> DB 40 dup (0)
> ;--------------------------------------
>

thanks for the tables, but i see no 5:4 aspect ratio mode,
except the 1280x1024 mode :-/

thanks anyway for all the hints !

> Dirk

yg

Dirk Wolfgang Glomp

unread,
May 16, 2008, 4:33:25 AM5/16/08
to
Am Fri, 16 May 2008 04:00:15 +0200 schrieb whygee:

> Hi !
>
> Dirk Wolfgang Glomp wrote:
>> GTF_V1R1.xls
>> CVTd6r1.xls
>
> hmmm XLS is a pain under Linux...
> particularly with OpenOffice on my memory-limited system :-)

Here is an example to calculate CRTC mode timing(from Borca Daniel):
http://cvsweb.xfree86.org/cvsweb/xc/extras/Mesa/src/DOS/vesa/Attic/vesa.c?rev=1.2

My last calculatation of this pattern (using my pocket calculator) results
wrong values. I think i misunderstand something in this C-stuff. Perhaps it
is easier for me to let a C-Compiler make his job and than i dissamble the
binary. In the past i use the VBEHZ.COM(*) to get CRTC-values.
(*) http://home.nexgo.de/g.s/vbehz.htm

/* _crtc_timing:
* Calculates CRTC mode timings.
*/
static void _crtc_timing (CRTCInfoBlock *crtc, int xres, int yres, int
xadjust, int yadjust)
{
int HTotal, VTotal;
int HDisp, VDisp;
int HSS, VSS;
int HSE, VSE;
int HSWidth, VSWidth;
int SS, SE;
int doublescan = FALSE;

if (yres < 400) {
doublescan = TRUE;
yres *= 2;
}

HDisp = xres;
HTotal = (int)(HDisp * 1.27) & ~0x7;
HSWidth = (int)((HTotal - HDisp) / 5) & ~0x7;
HSS = HDisp + 16;
HSE = HSS + HSWidth;
VDisp = yres;
VTotal = VDisp * 1.07;
VSWidth = (VTotal / 100) + 1;
VSS = VDisp + ((int)(VTotal - VDisp) / 5) + 1;
VSE = VSS + VSWidth;

SS = HSS + xadjust;
SE = HSE + xadjust;

if (xadjust < 0) {
if (SS < (HDisp + 8)) {
SS = HDisp + 8;
SE = SS + HSWidth;
}
} else {
if ((HTotal - 24) < SE) {
SE = HTotal - 24;
SS = SE - HSWidth;
}
}

HSS = SS;
HSE = SE;

SS = VSS + yadjust;
SE = VSE + yadjust;

if (yadjust < 0) {

if (SS < (VDisp + 3)) {
SS = VDisp + 3;
SE = SS + VSWidth;
}
} else {
if ((VTotal - 4) < SE) {
SE = VTotal - 4;
SS = SE - VSWidth;
}
}

VSS = SS;
VSE = SE;

crtc->HorizontalTotal = HTotal;
crtc->HorizontalSyncStart = HSS;
crtc->HorizontalSyncEnd = HSE;
crtc->VerticalTotal = VTotal;
crtc->VerticalSyncStart = VSS;
crtc->VerticalSyncEnd = VSE;
crtc->Flags = HNEG | VNEG;

if (doublescan)
crtc->Flags |= DOUBLESCAN;
}

>> INT 10 - VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE
>>
>> Videomode + 800h = use refresh rate control(only VBE3)
>
> hmmmm sounds interesting, but i don't know what it is.

This part can be used to set a vesamode with own CRTC-Values.

>> CRT DW HorizontalTotal
>> DW HorizontalSyncStart
>> DW HorizontalSyncEnd
>> DW VerticalTotal
>> DW VerticalSyncStart
>> DW VerticalSyncEnd
>> DB Flags
>> DD Pixelclock
>> DW RefreshRate
>> DB 40 dup (0)
>
> oh...

Usefull to initialize a higher refreshrate as the custom 60hz.
The first step is to store CRTC-values in a table.
The second step ist to to get the exact pixel clock for the hardware.
And now the refreshrate can be recalculate.

> I have found the following on Google while searching the "640x512" string :
>
> (**) TDFX(0): *Default mode "640x512": 54.0 MHz, 64.0 kHz, 60.0 Hz (D)
> (II) TDFX(0): Modeline "640x512" 54.00 640 664 720 844 512 512 514 533 doublescan +hsync +vsync

ah

> I infer a pixclock of 54MHz, horizontal refresh of 64KHz, and 60Hz of vertical refresh.
> The rest is an encoded modline, i remember that i have found some Linux framebuffer doc
> detailing the computations and how to interpret the X.org modlines (or VGAlib ?)

hmm

> hmmm DDC is interesting but I have mostly used laptops recently
> so it was not necessary.

oh

> I'd like to have roughly 640-pixel lines and a 5:4 ratio that
> fits the screen. 1280x1024 is too much to compute and store
> for my platform. 640x512 is ok.

mhm

> thanks for the tables, but i see no 5:4 aspect ratio mode,
> except the 1280x1024 mode :-/

;--------------------------------------
; VBEHZ = 1280x1024@120Hz
;--------------------------------------
HORTOTA DW 1728
HORISTA DW 1352
HORIEND DW 1504
VERTOTA DW 1066
VERTSTA DW 1025
VERTEND DW 1028
DOIFLAG DB 00h
PIXCLOC DD 221045760
REFRATE DW 12000


DB 40 dup (0)
;--------------------------------------

Dirk

Bob Masta

unread,
May 16, 2008, 7:20:55 AM5/16/08
to
On Fri, 16 May 2008 02:23:59 +0200, whygee <spam...@crayne.org>
wrote:
<snip>

>Also, i could have chosen to simply use 1280x1024 and display
>a pixel with 4 real pixels, but i can't in practice.
>My algo performs huge quantities of random accesses to the framebuffer
>and this already saturates the write combining buffers.
>I could maybe double a pixel in a line, but not on consecutive lines
>(or the software would slow down the already inefficient CPU).
>So at least i need the doublescan feature.

How about doing those random accesses to an intermediate buffer set to
the 640x512 size, then doing the doubling when you transfer it to the
display? Or maybe use a 1280x512 buffer and then just do the
double-scan during transfers.

Best regards,

Bob Masta

DAQARTA v3.50
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, FREE Signal Generator
Science with your sound card!

whygee

unread,
May 16, 2008, 1:50:01 PM5/16/08
to
Hi, and thanks again for the interesting hints :-)

I've read again more closely the vbe3.pdf
and updated my VBE probe software, but i have not
yet tested it. Sometimes, i have to sleep :-)

Dirk Wolfgang Glomp wrote:
>>> INT 10 - VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE
>>> Videomode + 800h = use refresh rate control(only VBE3)
>> hmmmm sounds interesting, but i don't know what it is.
> This part can be used to set a vesamode with own CRTC-Values.

Re-reading vbe3.pdf, it is not clear which mode number
i should setup : because the resolution i want is not listed,
i can't ask an existing mode. It is not clear if i can ask
"any" VBE mode and just throw my own CRTInfoBlock.

> Usefull to initialize a higher refreshrate as the custom 60hz.
> The first step is to store CRTC-values in a table.
> The second step ist to to get the exact pixel clock for the hardware.
> And now the refreshrate can be recalculate.

wow, that's scary, and i thought that programming the 6845 was difficult :-)

>> I have found the following on Google while searching the "640x512" string :
>> (**) TDFX(0): *Default mode "640x512": 54.0 MHz, 64.0 kHz, 60.0 Hz (D)
>> (II) TDFX(0): Modeline "640x512" 54.00 640 664 720 844 512 512 514 533 doublescan +hsync +vsync
> ah

maybe that's compatible with the CRTInfoBlock, if X.org goes through VBE (which is probable)


>> thanks for the tables, but i see no 5:4 aspect ratio mode,
>> except the 1280x1024 mode :-/
>
> ;--------------------------------------
> ; VBEHZ = 1280x1024@120Hz
> ;--------------------------------------
> HORTOTA DW 1728
> HORISTA DW 1352
> HORIEND DW 1504
> VERTOTA DW 1066
> VERTSTA DW 1025
> VERTEND DW 1028
> DOIFLAG DB 00h
> PIXCLOC DD 221045760
> REFRATE DW 12000
> DB 40 dup (0)
> ;--------------------------------------

thanks again but that is not the 640x512 mode :-)
but i can start from there and tweak progressively ...

thanks again,

> Dirk
YG

whygee

unread,
May 16, 2008, 9:56:21 PM5/16/08
to
Bob Masta wrote:
>> I could maybe double a pixel in a line, but not on consecutive lines
>> (or the software would slow down the already inefficient CPU).
>> So at least i need the doublescan feature.
> How about doing those random accesses to an intermediate buffer set to
> the 640x512 size, then doing the doubling when you transfer it to the
> display? Or maybe use a 1280x512 buffer and then just do the
> double-scan during transfers.

If the data set could have fit into L2, that would have been an option.
However :
- The L2 size on VIA's C3 is ... small. Higher fab yields and lower costs have a price...
- At each time step, not all pixels are updated. So the bandwidth of
a huge data move would be ... wasted.
- the move must be performed by the CPU, which has other things to do :-/
- etc.

thanks anyway,

> Best regards,
> Bob Masta
>
> DAQARTA v3.50
> Data AcQuisition And Real-Time Analysis
> www.daqarta.com
> Scope, Spectrum, Spectrogram, FREE Signal Generator
> Science with your sound card!

cool \o/
Do you also handle on-the-fly compression ?

yg

whygee

unread,
May 18, 2008, 5:52:08 AM5/18/08
to
Hi again,

After a few tests, it appears that the card is VBE3-compliant,
but does not exploit much beyond VBE2. That's what i think
after i probed the video modes list : there is nothing more
when i ask for VBE3 or VBE2.

I see no "doublescan" attribute in the list, so i presume
that one better method would be to get 640x480 then set
a custom mode with 512 lines instead. I'll try this soon.

YG

Dirk Wolfgang Glomp

unread,
May 18, 2008, 6:03:08 PM5/18/08
to
Am Sun, 18 May 2008 11:52:08 +0200 schrieb whygee:

> Hi again,
>
> After a few tests, it appears that the card is VBE3-compliant,
> but does not exploit much beyond VBE2. That's what i think
> after i probed the video modes list : there is nothing more
> when i ask for VBE3 or VBE2.

Oh.

> I see no "doublescan" attribute in the list, so i presume
> that one better method would be to get 640x480 then set
> a custom mode with 512 lines instead. I'll try this soon.

Good luck.

Dirk

0 new messages