Great ! I got it now !
See attached patch against viafb from patcher2k.

A few drawback though :
* the image on the VGA monitor lacks a few pixel on the right (approx 6-7 pixel columns missing): CRTC registers to be adjusted ? * the image on the TV lacks even more pixels on the right. I had to cheat with GH_ACTIVE, with 773 instead of 720 to be able to get enough of the image on the visible area * HSCALE_FAC is not 0, ie. there is an horizontal (down-)scaling clearly visible when viewing the moire_2x2.png test image. Could this be the 27MHz vs. 28Mhz dotclock effect ? 27MHz should give a wider image than 28MHz, that I have to compensate using HSCALE_FAC, which is not perfect.

Oops : I nearly forgot to tell why my tests were wrong before... The round() function in "ht = round(clock / (vt * vsync));" was not working. I just changed the calculation into "ht = clock / (vt * vsync) + 1;". Maybe I don't know how to compile and lnk a program, maybe I have a bad libmath, or something else. Since everything else is working on this computer, I wonder where it really come from. Maybe "cc vt1622-mark_adams.c -lm -o vt1622-mark_adams" is not the exact right command ?

Here is the result of the "D" command in the vt1622 program:

[EMAIL PROTECTED]:/home/nhuillard/prog/viafb_tv3_tests/vt1622# 
./vt1622-mark_adams
VT1622 Register display/change program: 1.0.5
Please look at source code for information ....
WARNING: Playing around with TV settings could seriously damage your TV !
Enable IO Result: 0 Success
Enable IO Result: 0 Success
Enable IO Result: 0 Success
Main commands are:
        q       - Quit
        D       - Display registers
        A       - Set regs for PAL 720x576
        B       - Set regs for NTSC 720x480
        S       - Save regs for PAL
        T       - Save regs for NTSC
        C       - Change a TV register
        [1-z]   - Change a particular register
See the source code for more info ....
Enter Command Character: D
TVRegs
0x00:   04 00 00 a0 00 00 10 4f 58 31 5a 00 49 46 00 8d
0x10:   00 00 a7 1e c6 1c 24 8b 09 2a 00 03 02 80 00 04
0x20:   13 0c 04 7b 48 64 30 93 49 5f 15 a5 23 77 ff 00
0x30:   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x40:   00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 45
0x50:   5f 05 33 70 02 5f d0 7e 23 94 d0 08 a8 16 00 2e
0x60:   00 00 00 5f 03 00 00 00 24 8b 09 2a 04
CRTCRegs
0x00:   67 59 58 8b 5b 83 6f f0 00 60 1e 00 00 00 3f ff
0x10:   5a 03 3f 68 00 40 70 e3 ff 00 00 00 00 00 00 00
0x20:   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x30:   00 00 01 26 00 20 01 00 3e 0c 1c 05 71 40 00 00
0x40:   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x50:   80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
0x60:
SequencerRegs
0x00:   03 01 0f 03 0e 00 00 00 00 00 00 00 00 00 00 00
0x10:   01 78 30 08 01 ae 08 1f 4e 00 1e f0 b5 00 f1 00
0x20:   00 00 1f 00 00 00 3c 00 00 00 00 00 00 ff ff e8
0x30:   e4 3d 00 00 3f 06 11 22 31 08 0f 02 00 00 03 00
0x40:   00 b0 10 00 c3 2a 47 1c 07 41 46 48 00 00 00 00
0x50:   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x60:
CLK1: 26.999997
CLK2: 26.999997
CRTC_HTOTAL     : 00000067 103
CRTC_HEND       : 00000059 89
CRTC_HSTART_BLAN: 00000058 88
CRTC_HEND_BLANK : 0000006b 107
CRTC_HSTART_SYNC: 0000005b 91
CRTC_HEND_SYNC  : 00000003 3
CRTC_VTOTAL     : 0000026f 623
CRTC_VEND       : 0000023f 575
CRTC_VSTART_BLAN: 00000240 576
CRTC_VEND_BLANK : 00000070 112
CRTC_VSTART_SYNC: 0000025a 602
CRTC_VEND_SYNC  : 00000003 3
CRTC_VMAX_SCAN_L: 00000060 96
PLL_N           : 000000c6 198
PLL_D           : 0000001e 30
PLL_P           : 00000007 7
PLL_P2          : 00000007 7
PLL_R           : 00000005 5
SUB_CARRIER     : 2a098b24 705268516
SUB_CARRIER_PHAS: 00000204 516
GH_TOTAL        : 0000035f 863
GH_ACTIVE       : 00000305 773
GV_TOTAL        : 00000270 624
TH_TOTAL        : 0000035f 863
TH_ACTIVE       : 000002d0 720
START_VIDEO     : 0000004f 79
START_HORIZ     : 00000058 88
START_VERT      : 00000131 305
TVIDEO_START    : 00000108 264
TVIDEO_END      : 000006a8 1704
THSYNC_WIDTH    : 0000007e 126
TBURST_START    : 00000394 916
TBURST_END      : 000000d0 208
TV_BURST_STEP   : 0000000c 12
VSCALE_FAC      : 00000000 0
HSCALE_FAC      : 0000002e 46
SH_TOTAL        : 0000035f 863
CR_AMP          : 0000005a 90
BLACK_LEVEL     : 00000000 0
Y_AMP           : 00000049 73
CB_AMP          : 00000046 70
BLANK_LEVEL     : 0000007b 123
HUE             : 00000000 0
INPUT_THRESHOLD : 00000000 0
INPUT_DELTA     : 00000000 0

--
NH

Mark Adams a écrit :
OK, so there's something going wrong when you run the vt1622 utility to set the registers, whether you're using my version or your own:
* after setting registers for 720x576 PAL (Marks' program)
[...]
Enter Command Character: A
Clock: 0.000000 0 0 0


This looks strange but is in fact OK because the line that once set these values is commented out and this now happens a little further down the setUp function.

  CLK1: 26.999997

CLK2: 26.999997


 Fine.

  VSync: -0.007175

HSync: -0.013988
HTotal: -965083096


 Oops.
For some reason, you've got completely erroneous values here which then result in incorrect values for CRTC_HTOTAL and various other registers which will definitely prevent you from getting any usable picture out.
 What's puzzling me is how this is happening.
In the setUp function, these three values are derived from 'clock' (set a few lines up as clockFreq(n, d, p), the result of which should be 27MHz, and definitely was when CLK1 and CLK2 were printed). If you can debug what's happening there, you might find it works a bit better.
 The values should be as follows (assuming you're using my version):
 clock: 27000000 (or very close)
ht: 864
 VSync (as printed): 25 (or very close)
HSync (as printed): 15625 (or very close)
 CRTC_HTOTAL: 103
CRTC_HEND: 89
CRTC_HSTART_BLANK: 88
CRTC_HEND_BLANK: 107
CRTC_HSTART_SYNC: 91
CRTC_HEND_SYNC: 3
 (other values will also change when you fix 'clock', 'ht' and friends).
See if you can solve that problem and report back. If you're still not getting a usable picture, send another set of values and I'll look for other problems.
 Regards,
 Mark

--- via_tv3.h.orig	2005-08-21 18:04:11.000000000 +0200
+++ via_tv3.h	2005-08-30 23:38:34.000000000 +0200
@@ -350,31 +350,35 @@
         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
 
-        {/*  0     1     2     3     4     5     6     7     8     9     a     b     c     d     e     f */
-          0x04, 0x00, 0x00, 0xA0, 0x00, 0x00, 0x10, 0xDF, 0x80, 0x3A, 0x60, 0x00, 0x57, 0x46, 0x0F, 0x00,
+/* TV regs (720x576 no scaling) */
+		{
 
-         /* 10    11    12    13    14    15    16    17    18    19    1a    1b    1c    1d    1e    1f */
-          0x00, 0x00, 0xE5, 0x07, 0x21, 0x10, 0xCB, 0x8A, 0x09, 0x2A, 0x00, 0x03, 0x02, 0x80, 0x00, 0x84,
-
-         /* 20    21    22    23    24    25    26    27    28    29    2a    2b    2c    2d    2e    2f */
-          0x13, 0x0C, 0x04, 0x7B, 0x48, 0x64, 0x30, 0x93, 0x49, 0x5F, 0x15, 0xA5, 0x23, 0x77, 0xFF, 0x00,
-
-         /* 30    31    32    33    34    35    36    37    38    39    3a    3b    3c    3d    3e    3f */
-          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
-         /* 40    41    42    43    44    45    46    47    48    49    4a    4b    4c    4d    4e    4f */
-          0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE7, 0x45, 0x04, 0x00, 0x00, 0x45,
-
-         /* 50    51    52    53    54    55    56    57    58    59    5a    5b    5c    5d    5e    5f */
-          0xE7, 0xD0, 0x23, 0xA2, 0x02, 0x5F, 0xD0, 0x7E, 0x23, 0x94, 0xD0, 0x27, 0x8F, 0x16, 0x00, 0x00,
-
-         /* 60    61    62    63    64    65    66    67    68    69    6a    6b    6c    6d    6e    6f */
-          0x00, 0x00, 0x00, 0x37, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
-          0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-
-        { 0X78, 0X59, 0X59, 0X9C, 0X61, 0X93, 0XA1, 0XF0, 0, 0X60, 0, 0, 0, 0, 0, 0,
-          0X5A, 0, 0X3F, 0, 0, 0X3F, 0XA2, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+//                         0     1     2     3     4     5     6     7     8     9     A     B     C     D     E     F
+//			0x04, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x10, 0x4f, 0x84, 0x2a, 0x5a, 0x00, 0x49, 0x46, 0x00, 0x09, // 0x00
+			0x04, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x10, 0x4f, 0x58, 0x31, 0x5a, 0x00, 0x49, 0x46, 0x00, 0x8d,
+//			0x00, 0x00, 0xa7, 0x1e, 0xdc, 0x24, 0xe3, 0x33, 0x89, 0x28, 0xee, 0x00, 0x02, 0x80, 0x00, 0x04, // 0x10
+			0x00, 0x00, 0xa7, 0x1e, 0xc6, 0x1c, 0x24, 0x8b, 0x09, 0x2a, 0x00, 0x03, 0x02, 0x80, 0x00, 0x04,
+//			0x17, 0x0c, 0x6f, 0x79, 0x48, 0x64, 0x30, 0x93, 0x49, 0x5f, 0x15, 0xa5, 0x23, 0x77, 0xff, 0x00, // 0x20
+			0x13, 0x0c, 0x04, 0x7b, 0x48, 0x64, 0x30, 0x93, 0x49, 0x5f, 0x15, 0xa5, 0x23, 0x77, 0xff, 0x00,
+//			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x30
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+//			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, // 0x40
+			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x45,
+//			0x5f, 0xd0, 0x23, 0x70, 0x02, 0x5f, 0xd0, 0x7e, 0x23, 0x94, 0xd0, 0x08, 0xa8, 0x16, 0x00, 0x00, // 0x50
+			0x5f, 0x05, 0x33, 0x70, 0x02, 0x5f, 0xd0, 0x7e, 0x23, 0x94, 0xd0, 0x08, 0xa8, 0x16, 0x00, 0x2e,
+//			0x00, 0x00, 0x00, 0x5f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0,    0,    0,// 0x60
+			0x00, 0x00, 0x00, 0x5f, 0x03, 0x00, 0x00, 0x00, 0x24, 0x8b, 0x09, 0,    0,    0,    0,    0,
+			0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,// 0x70
+			0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0// 0x80
+		},
+
+/* CRTC regs (720x576 no scaling) */
+		{
+//			0x67, 0x59, 0x58, 0x8b, 0x5b, 0x83, 0x6f, 0xf0, 0x00, 0x60, 0x1e, 0x00, 0x05, 0xf0, 0x3f, 0xff, 
+			0x67, 0x59, 0x58, 0x8b, 0x5b, 0x83, 0x6f, 0xf0, 0x00, 0x60, 0x1e, 0x00, 0x00, 0x00, 0x3f, 0xff, // après tests
+//			0x5a, 0x03, 0x3f, 0xb4, 0x00, 0x40, 0x70, 0xe3, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+			0x5a, 0x33, 0x3f, 0x68, 0x00, 0x40, 0x70, 0xe3, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // après tests
+		},
         { 0X20, 0X40, 0X80, 0, 0X47, 0X1C, 0, 0 },
         { 0, 0, 0, 0X47, 0X1C, 0, 0, 0 },
         { 0XE7, 0XCF, 0XCF, 0XE7, 0XDA, 0X23, 0XF, 0X37, 0XA2, 0X3F, 0X3F, 0XA2, 0X52, 0X12, 0X5A, 0X48, 0, 0, 0, 0, 0, 0X2D, 0X5A, 0, 0, 0, 0X80, 0X20, 0X80, 0, 0, 0 },
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to