On 21-12-12 10:41, Xavier Bachelot wrote:
So I stopped hunting for the 10 meters svideo cable and instead moved
the box near the TV. And as I was moving the box and pulling cables all
over the living room, I thought testing for just Svideo was good but
testing for composite and component too was better ;-)
All of the outputs are properly detected. I tested Composite, SVideo and
YCbCr.
I had to force the TVMode to PAL (the bios is probably set to NTSC) and
to force the standard 720x576 PAL mode rather than the default 1024x768
to actually get something on the screen. I haven't tried any other mode.
Same here, I have some idea of what is going wrong but I don't know how
to solve it yet. Also debugging xorg is giving me a hard time, what is
the best way to get some help with that, irc?
When started with all of the 3 outputs connected (composite, svideo,
component, which is probably not a supported setup, the driver is
detecting an RGB output.
I haven't touched VT1625DACSense (the function calling
VT1625DACSenseI2C) yet, but irrc it never reports more than one
connected output. On the S-variant you probably can't have component and
s-video at the same time, on the normal vt1625 that setup shouldn't be a
problem. Also the hardware can do some autocorrection, e.g. rewire dacs
to different connectors when they change (on by default). Ideally the
wiring bits should be read too, atm defaults are assumed.
I'd say your patches are good to go, unless you have some revised
version that needs to be tested. 2 minor things to fix, there is a white
space at the end of the line 32 in 0001-Fix-VT1625-output-sensing.patch,
and output->possible_crtcs should be set to 0x03 in
0003-There-is-a-possible-crtc-for-TV-1.patch.
Patches updated as you asked, they can be committed as far as I'm concerned.
I also noticed a weird behaviour : if I start X with say Svideo
connected, it's properly detected and I get a nice login screen. Now, if
I disconnect svideo and instead plug in composite or component, I still
get a picture. I guess the DACs that are not in use are never turned off.
Correct, all dacs are on, or all are off. Should also be easy to improve
but I first want to get the basics to work before I do some polishing.
Regards,
Xavier
_______________________________________________
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/openchrome-devel
>From f9b89689ee467ce385069b04034ffd98fd9d768b Mon Sep 17 00:00:00 2001
From: Harry de Boer <ha...@ijscoboer.nl>
Date: Thu, 22 Nov 2012 13:21:36 +0100
Subject: [PATCH 1/4] Fix VT1625 output sensing. VT1625DACSenseI2C was using
the same code as VT162xDACSenseI2C but the DAC sensing
bit is in a different register for the VT1625. Also
adds support for the VT1625S which has only four DACs.
---
src/via_vt162x.c | 44 +++++++++++++++++++++++++++++++++-----------
1 file changed, 33 insertions(+), 11 deletions(-)
diff --git a/src/via_vt162x.c b/src/via_vt162x.c
index f13a94b..ae8fcd1 100644
--- a/src/via_vt162x.c
+++ b/src/via_vt162x.c
@@ -210,21 +210,43 @@ VT162xDACSenseI2C(I2CDevPtr pDev)
}
/*
- * VT1625 moves DACa through DACd from bits 0-3 to 2-5.
+ * VT1625/VT1625S sense connected TV outputs.
+ *
+ * The lower six bits of the return byte stand for each of the six DACs:
+ * - bit 0: DACf (Cb)
+ * - bit 1: DACe (Cr)
+ * - bit 2: DACd (Y)
+ * - bit 3: DACc (Composite)
+ * - bit 4: DACb (S-Video C)
+ * - bit 5: DACa (S-Video Y)
+ *
+ * If a bit is 0 it means a cable is connected. Note the VT1625S only has
+ * four DACs, corresponding to bit 0-3 above.
*/
static CARD8
VT1625DACSenseI2C(I2CDevPtr pDev)
{
- CARD8 save, sense;
-
- xf86I2CReadByte(pDev, 0x0E, &save);
- xf86I2CWriteByte(pDev, 0x0E, 0x00);
- xf86I2CWriteByte(pDev, 0x0E, 0x80);
- xf86I2CWriteByte(pDev, 0x0E, 0x00);
- xf86I2CReadByte(pDev, 0x0F, &sense);
- xf86I2CWriteByte(pDev, 0x0E, save);
-
- return (sense & 0x3F);
+ CARD8 power, status, overflow, dacPresent;
+
+ xf86I2CReadByte(pDev, 0x0E, &power); // save power state
+
+ // VT1625S will always report 0 for bits 4 and 5 of the status register as
+ // it only has four DACs instead of six. This will result in a false
+ // positive for the S-Video cable. It will also do this on the power
+ // register, which is abused to check which DACs are actually present.
+ xf86I2CWriteByte(pDev, 0x0E, 0xFF);
+ xf86I2CReadByte(pDev, 0x0E, &dacPresent);
+
+ xf86I2CWriteByte(pDev, 0x0E, 0x00); // power on DACs/circuits
+ xf86I2CReadByte(pDev, 0x1C, &overflow); // save overflow reg
+ // (DAC sense bit should be off)
+ xf86I2CWriteByte(pDev, 0x1C, 0x80); // enable DAC sense bit
+ xf86I2CWriteByte(pDev, 0x1C, overflow); // disable DAC sense bit
+ xf86I2CReadByte(pDev, 0x0F, &status); // read connection status
+ xf86I2CWriteByte(pDev, 0x0E, power); // restore power state
+ status |= ~dacPresent;
+
+ return (status & 0x3F);
}
/*
--
1.7.10.4
>From 755a3298e5fe26340e6fcb9ee8231ff34772563c Mon Sep 17 00:00:00 2001
From: Harry de Boer <ha...@ijscoboer.nl>
Date: Thu, 22 Nov 2012 22:41:50 +0100
Subject: [PATCH 2/4] VT1625 register count is 0x82
---
src/via_vt162x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/via_vt162x.c b/src/via_vt162x.c
index ae8fcd1..0fb7bf2 100644
--- a/src/via_vt162x.c
+++ b/src/via_vt162x.c
@@ -909,7 +909,7 @@ ViaVT162xInit(ScrnInfoPtr pScrn)
pBIOSInfo->TVPower = VT1625Power;
pBIOSInfo->TVModes = VT1625Modes;
pBIOSInfo->TVPrintRegs = VT162xPrintRegs;
- pBIOSInfo->TVNumRegs = 0x6C;
+ pBIOSInfo->TVNumRegs = 0x82;
break;
default:
break;
--
1.7.10.4
>From 9fdd487257691092e8a3e0544e3a8e74558c5800 Mon Sep 17 00:00:00 2001
From: Harry de Boer <ha...@ijscoboer.nl>
Date: Mon, 26 Nov 2012 02:58:25 +0100
Subject: [PATCH 3/4] Set possible_crtcs to allow tv outputs to be connected
to crtcs.
---
src/via_driver.c | 4 +++-
src/via_outputs.c | 8 ++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/via_driver.c b/src/via_driver.c
index c499a4a..9728425 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1542,8 +1542,10 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
}
}
- if (!xf86InitialConfiguration(pScrn, TRUE))
+ if (!xf86InitialConfiguration(pScrn, TRUE)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Initial configuration failed\n");
return FALSE;
+ }
if (!pScrn->modes) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
diff --git a/src/via_outputs.c b/src/via_outputs.c
index 75d312c..4011dd5 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -466,6 +466,14 @@ via_tv_init(ScrnInfoPtr pScrn)
output = xf86OutputCreate(pScrn, &via_tv_funcs, "TV-1");
pVia->FirstInit = TRUE;
+
+ if (output) {
+ /* Allow tv output on both crtcs, set bit 0 and 1. */
+ output->possible_crtcs = 0x3;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "via_tv_init: Failed to create output for TV-1.\n");
+ }
+
pBIOSInfo->tv = output;
/* Save now */
pBIOSInfo->TVSave(pScrn);
--
1.7.10.4
>From 97b5d08da175a80c9691489d4c277ba0b6bae40e Mon Sep 17 00:00:00 2001
From: Harry de Boer <ha...@ijscoboer.nl>
Date: Mon, 26 Nov 2012 22:36:23 +0100
Subject: [PATCH 4/4] Return valid DisplayModePtr list for tv outputs. When
creating a list of DisplayModePtr the ->next and ->prev
pointers should point to the next/previous item in the
list or only the first modeline will be recognised.
This patch changes via_tv_get_modes to use the
xf86ModesAdd and xf86DuplicateMode helpers to create
correct modeline lists from a DisplayModeRec array.
---
src/via_ch7xxx.c | 2 ++
src/via_ch7xxx.h | 4 ----
src/via_outputs.c | 10 +++++++++-
src/via_ums.h | 1 +
src/via_vt162x.c | 4 ++++
src/via_vt162x.h | 5 -----
6 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/via_ch7xxx.c b/src/via_ch7xxx.c
index 7686aa6..48689a6 100644
--- a/src/via_ch7xxx.c
+++ b/src/via_ch7xxx.c
@@ -614,6 +614,7 @@ ViaCH7xxxInit(ScrnInfoPtr pScrn)
pBIOSInfo->TVModeCrtc = CH7xxxModeCrtc;
pBIOSInfo->TVPower = CH7xxxTVPower;
pBIOSInfo->TVModes = CH7011Modes;
+ pBIOSInfo->TVNumModes = sizeof(CH7011Modes) / sizeof(DisplayModeRec);
pBIOSInfo->LCDPower = NULL;
pBIOSInfo->TVNumRegs = CH_7011_MAX_NUM_REG;
#ifdef HAVE_DEBUG
@@ -630,6 +631,7 @@ ViaCH7xxxInit(ScrnInfoPtr pScrn)
pBIOSInfo->TVModeCrtc = CH7xxxModeCrtc;
pBIOSInfo->TVPower = CH7xxxTVPower;
pBIOSInfo->TVModes = CH7019Modes;
+ pBIOSInfo->TVNumModes = sizeof(CH7019Modes) / sizeof(DisplayModeRec);
pBIOSInfo->LCDPower = CH7019LCDPower;
pBIOSInfo->TVNumRegs = CH_7019_MAX_NUM_REG;
#ifdef HAVE_DEBUG
diff --git a/src/via_ch7xxx.h b/src/via_ch7xxx.h
index 68df1b5..f54ac5e 100644
--- a/src/via_ch7xxx.h
+++ b/src/via_ch7xxx.h
@@ -86,8 +86,6 @@ static DisplayModeRec CH7011Modes[]={
{ MODEPREFIX("720x576"), 28500, 720, 728, 744, 760, 0, 576, 635, 643, 750, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXPAL },
{ MODEPREFIX("720x480Noscale"), 27972, 720, 736, 768, 888, 0, 480, 480, 483, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC },
{ MODEPREFIX("720x576Noscale"), 28000, 720, 728, 864, 896, 0, 576, 576, 579, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL },
-
- { MODEPREFIX(NULL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIXNTSC },
};
static DisplayModeRec CH7019Modes[]={
@@ -103,8 +101,6 @@ static DisplayModeRec CH7019Modes[]={
{ MODEPREFIX("800x600Over"), 32500, 800, 832, 928, 1000, 0, 600, 600, 604, 650, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL },
{ MODEPREFIX("1024x768Over"), 50400, 1024, 1040, 1112, 1200, 0, 768, 772, 776, 840, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC },
{ MODEPREFIX("1024x768Over"), 49500, 1024, 1032, 1112, 1200, 0, 768, 771, 776, 825, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL },
-
- { MODEPREFIX(NULL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIXNTSC },
};
diff --git a/src/via_outputs.c b/src/via_outputs.c
index 4011dd5..808e570 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -351,7 +351,15 @@ via_tv_get_modes(xf86OutputPtr output)
ScrnInfoPtr pScrn = output->scrn;
VIAPtr pVia = VIAPTR(pScrn);
- return pVia->pBIOSInfo->TVModes;
+ DisplayModePtr modes = NULL;
+ DisplayModePtr mode = NULL;
+
+ for (int i = 0; i < pVia->pBIOSInfo->TVNumModes; i++) {
+ mode = xf86DuplicateMode(&pVia->pBIOSInfo->TVModes[i]);
+ modes = xf86ModesAdd(modes, mode);
+ }
+
+ return modes;
}
static void
diff --git a/src/via_ums.h b/src/via_ums.h
index db7c7de..411d52d 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -177,6 +177,7 @@ typedef struct _VIABIOSINFO {
void (*TVPower) (ScrnInfoPtr pScrn, Bool On);
void (*LCDPower) (ScrnInfoPtr pScrn, Bool On);
DisplayModePtr TVModes;
+ int TVNumModes;
void (*TVPrintRegs) (ScrnInfoPtr pScrn);
} VIABIOSInfoRec, *VIABIOSInfoPtr;
diff --git a/src/via_vt162x.c b/src/via_vt162x.c
index 0fb7bf2..86aae79 100644
--- a/src/via_vt162x.c
+++ b/src/via_vt162x.c
@@ -872,6 +872,7 @@ ViaVT162xInit(ScrnInfoPtr pScrn)
pBIOSInfo->TVModeCrtc = VT1621ModeCrtc;
pBIOSInfo->TVPower = VT1621Power;
pBIOSInfo->TVModes = VT1621Modes;
+ pBIOSInfo->TVNumModes = sizeof(VT1621Modes) / sizeof(DisplayModeRec);
pBIOSInfo->TVPrintRegs = VT162xPrintRegs;
pBIOSInfo->TVNumRegs = 0x68;
break;
@@ -884,6 +885,7 @@ ViaVT162xInit(ScrnInfoPtr pScrn)
pBIOSInfo->TVModeCrtc = VT1622ModeCrtc;
pBIOSInfo->TVPower = VT1622Power;
pBIOSInfo->TVModes = VT1622Modes;
+ pBIOSInfo->TVNumModes = sizeof(VT1622Modes) / sizeof(DisplayModeRec);
pBIOSInfo->TVPrintRegs = VT162xPrintRegs;
pBIOSInfo->TVNumRegs = 0x68;
break;
@@ -896,6 +898,7 @@ ViaVT162xInit(ScrnInfoPtr pScrn)
pBIOSInfo->TVModeCrtc = VT1622ModeCrtc;
pBIOSInfo->TVPower = VT1622Power;
pBIOSInfo->TVModes = VT1623Modes;
+ pBIOSInfo->TVNumModes = sizeof(VT1623Modes) / sizeof(DisplayModeRec);
pBIOSInfo->TVPrintRegs = VT162xPrintRegs;
pBIOSInfo->TVNumRegs = 0x6C;
break;
@@ -908,6 +911,7 @@ ViaVT162xInit(ScrnInfoPtr pScrn)
pBIOSInfo->TVModeCrtc = VT1622ModeCrtc;
pBIOSInfo->TVPower = VT1625Power;
pBIOSInfo->TVModes = VT1625Modes;
+ pBIOSInfo->TVNumModes = sizeof(VT1625Modes) / sizeof(DisplayModeRec);
pBIOSInfo->TVPrintRegs = VT162xPrintRegs;
pBIOSInfo->TVNumRegs = 0x82;
break;
diff --git a/src/via_vt162x.h b/src/via_vt162x.h
index b39134f..f5ae92e 100644
--- a/src/via_vt162x.h
+++ b/src/via_vt162x.h
@@ -65,7 +65,6 @@ static DisplayModeRec VT1621Modes[] = {
{ MODEPREFIX("640x480Over"), 24000, 640, 672, 888, 960, 0, 480, 485, 491, 500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL },
{ MODEPREFIX("800x600Over"), 36400, 800, 840, 960, 1040, 0, 600, 602, 604, 700, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXNTSC },
{ MODEPREFIX("800x600Over"), 29500, 800, 824, 896, 944, 0, 600, 599, 604, 625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIXPAL },
- { MODEPREFIX(NULL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIXNTSC },
};
struct VT1621TableRec {
@@ -185,7 +184,6 @@ static DisplayModeRec VT1622Modes[] = {
{ MODEPREFIX("720x576Over"), 30000, 720, 728, 864, 1000, 0, 576, 576, 579, 600, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXPAL },
{ MODEPREFIX("720x480Noscale"), 27972, 720, 736, 768, 888, 0, 480, 480, 483, 525, 0, V_NHSYNC | V_PVSYNC, MODESUFFIXNTSC },
{ MODEPREFIX("720x576Noscale"), 28000, 720, 728, 864, 896, 0, 576, 576, 579, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL },
- { MODEPREFIX(NULL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIXNTSC },
};
struct VT162XTableRec {
@@ -466,7 +464,6 @@ static DisplayModeRec VT1623Modes[] = {
{ MODEPREFIX("720x576Noscale"), 28000, 720, 736, 768, 896, 0, 576, 576, 579, 625, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL },
{ MODEPREFIX("720x480Noscale"), 27972, 720, 736, 768, 888, 0, 480, 480, 483, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXNTSC },
{ MODEPREFIX("720x480pal"), 27972, 720, 736, 768, 888, 0, 480, 480, 483, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIXPAL },
- { MODEPREFIX(NULL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIXNTSC },
};
static struct VT162XTableRec
@@ -772,8 +769,6 @@ static DisplayModeRec VT1625Modes[] = {
{ MODEPREFIX("720x480Under"), 28224, 720, 728, 744, 784, 0, 480, 490, 496, 600, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX480P },
{ MODEPREFIX("720x480Fit"), 28980, 720, 728, 776, 840, 0, 480, 484, 499, 575, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX480P },
{ MODEPREFIX("720x480Over"), 27027, 720, 784, 808, 858, 0, 480, 483, 486, 525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX480P },
-
- { MODEPREFIX(NULL), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, MODESUFFIXNTSC },
};
static struct VT162XTableRec
--
1.7.10.4
_______________________________________________
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/openchrome-devel