Re: 640x512x16bpp with VESA ?



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

.