[Openchrome-devel] xf86-video-openchrome: 5 commits - configure.ac src/via_analog.c src/via_driver.h src/via_outputs.c src/via_ums.c src/via_ums.h
Kevin Brace
kevinbrace at kemper.freedesktop.org
Mon May 22 04:46:49 UTC 2017
configure.ac | 2
src/via_analog.c | 209 ++++++++++++++++++++++++++++++++----------------------
src/via_driver.h | 3
src/via_outputs.c | 17 ++--
src/via_ums.c | 2
src/via_ums.h | 19 +++-
6 files changed, 151 insertions(+), 101 deletions(-)
New commits:
commit b8730da8f090a9e75d0db03e8e6fbfbd5729c058
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Sun May 21 21:44:54 2017 -0700
Version bumped to 0.6.116
Incorporated newly rewritten analog (VGA) probing and initialization
code.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/configure.ac b/configure.ac
index c3a93d7..e0b5adf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ(2.57)
AC_INIT([xf86-video-openchrome],
- [0.6.115],
+ [0.6.116],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
[xf86-video-openchrome])
commit 43fe8b0dd9effa22af670d6bd2410a2c9bebd846
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Sun May 21 21:36:10 2017 -0700
Replaced via_analog_detect code
The currently broken VGA connector detection code was removed.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_analog.c b/src/via_analog.c
index 2169caf..7994b05 100644
--- a/src/via_analog.c
+++ b/src/via_analog.c
@@ -248,83 +248,53 @@ via_analog_mode_set(xf86OutputPtr output, DisplayModePtr mode,
static xf86OutputStatus
via_analog_detect(xf86OutputPtr output)
{
- xf86OutputStatus status = XF86OutputStatusDisconnected;
ScrnInfoPtr pScrn = output->scrn;
+ xf86MonPtr pMon;
+ xf86OutputStatus status = XF86OutputStatusDisconnected;
+ I2CBusPtr pI2CBus;
VIAPtr pVia = VIAPTR(pScrn);
- xf86MonPtr mon;
-
- /* Probe I2C Bus 1 to see if a VGA monitor is connected. */
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Probing for a VGA monitor on I2C Bus 1.\n");
- mon = xf86OutputGetEDID(output, pVia->pI2CBus1);
- if (mon && (!mon->features.input_type)) {
- xf86OutputSetEDID(output, mon);
- status = XF86OutputStatusConnected;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected a VGA monitor on I2C Bus 1.\n");
+ VIAAnalogPtr pVIAAnalog = (VIAAnalogPtr) output->driver_private;
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered via_analog_detect.\n"));
+
+ if (pVIAAnalog->analogI2CBus & VIA_I2C_BUS1) {
+ pI2CBus = pVia->pI2CBus1;
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Did not detect a VGA monitor on I2C Bus 1.\n");
-
- /* Probe I2C Bus 2 to see if a VGA monitor is connected. */
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Probing for a VGA monitor on I2C Bus 2.\n");
- mon = xf86OutputGetEDID(output, pVia->pI2CBus2);
- if (mon && (!mon->features.input_type)) {
- xf86OutputSetEDID(output, mon);
+ pI2CBus = NULL;
+ }
+
+ if (pI2CBus) {
+ pMon = xf86OutputGetEDID(output, pI2CBus);
+ if (pMon && (!pMon->features.input_type)) {
status = XF86OutputStatusConnected;
+ xf86OutputSetEDID(output, pMon);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected a VGA monitor on I2C Bus 2.\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Did not detect a VGA monitor on I2C Bus 2.\n");
+ "Detected a monitor connected to VGA.\n");
+ goto exit;
+ }
+ }
+
+ if (pVIAAnalog->analogI2CBus & VIA_I2C_BUS2) {
+ pI2CBus = pVia->pI2CBus2;
+ } else {
+ pI2CBus = NULL;
+ }
- /* Perform manual detection of a VGA monitor since */
- /* it was not detected via I2C buses. */
+ if (pI2CBus) {
+ pMon = xf86OutputGetEDID(output, pI2CBus);
+ if (pMon && (!pMon->features.input_type)) {
+ status = XF86OutputStatusConnected;
+ xf86OutputSetEDID(output, pMon);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Now perform manual detection of a VGA "
- "monitor.\n");
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- CARD8 SR01 = hwp->readSeq(hwp, 0x01);
- CARD8 SR40 = hwp->readSeq(hwp, 0x40);
- CARD8 CR36 = hwp->readCrtc(hwp, 0x36);
-
- /* We have to power on the display to detect it */
- ViaSeqMask(hwp, 0x01, 0x00, 0x20);
- ViaCrtcMask(hwp, 0x36, 0x00, 0xF0);
-
- /* Wait for vblank */
- usleep(16);
-
- /* Detect the load on pins */
- ViaSeqMask(hwp, 0x40, 0x80, 0x80);
-
- if ((VIA_CX700 == pVia->Chipset) ||
- (VIA_VX800 == pVia->Chipset) ||
- (VIA_VX855 == pVia->Chipset) ||
- (VIA_VX900 == pVia->Chipset))
- ViaSeqMask(hwp, 0x40, 0x00, 0x80);
-
- if (ViaVgahwIn(hwp, 0x3C2) & 0x20) {
- status = XF86OutputStatusConnected;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected a VGA monitor using manual "
- "detection method.\n");
- }
-
- if ((VIA_CX700 == pVia->Chipset) ||
- (VIA_VX800 == pVia->Chipset) ||
- (VIA_VX855 == pVia->Chipset) ||
- (VIA_VX900 == pVia->Chipset))
- ViaSeqMask(hwp, 0x40, 0x00, 0x80);
-
- /* Restore previous state */
- hwp->writeSeq(hwp, 0x40, SR40);
- hwp->writeSeq(hwp, 0x01, SR01);
- hwp->writeCrtc(hwp, 0x36, CR36);
+ "Detected a monitor connected to VGA.\n");
+ goto exit;
}
}
+exit:
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting via_analog_detect.\n"));
return status;
}
commit aed9429593140ee7e92a60817a156a3eae3df90d
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Sun May 21 20:56:42 2017 -0700
Changed viaOutputDetect to viaInitDisplay
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_outputs.c b/src/via_outputs.c
index 52ad3c2..9646511 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -646,13 +646,13 @@ viaProbePinStrapping(ScrnInfoPtr pScrn)
}
void
-viaOutputDetect(ScrnInfoPtr pScrn)
+viaInitDisplay(ScrnInfoPtr pScrn)
{
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered viaOutputDetect.\n"));
+ "Entered viaInitDisplay.\n"));
/* Initialize the number of VGA connectors. */
pVIADisplay->numberVGA = 0;
@@ -683,7 +683,7 @@ viaOutputDetect(ScrnInfoPtr pScrn)
viaAnalogInit(pScrn);
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting viaOutputDetect.\n"));
+ "Exiting viaInitDisplay.\n"));
}
#ifdef HAVE_DEBUG
diff --git a/src/via_ums.c b/src/via_ums.c
index 4158f9a..03565f6 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -1047,7 +1047,7 @@ umsCrtcInit(ScrnInfoPtr pScrn)
xf86CrtcSetSizeRange(pScrn, 320, 200, max_pitch, max_height);
- viaOutputDetect(pScrn);
+ viaInitDisplay(pScrn);
return TRUE;
}
diff --git a/src/via_ums.h b/src/via_ums.h
index 22fa135..a7fe582 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -565,7 +565,7 @@ void viaDVP1SetDataDriveStrength(ScrnInfoPtr pScrn,
CARD8 dataDriveStrength);
void viaDFPLowSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource);
void viaDFPLowEnableIOPads(ScrnInfoPtr pScrn, CARD8 ioPadState);
-void viaOutputDetect(ScrnInfoPtr pScrn);
+void viaInitDisplay(ScrnInfoPtr pScrn);
CARD32 ViaGetMemoryBandwidth(ScrnInfoPtr pScrn);
CARD32 ViaModeDotClockTranslate(ScrnInfoPtr pScrn, DisplayModePtr mode);
void viaProbePinStrapping(ScrnInfoPtr pScrn);
commit 03b862f248d0be3a4943b29f9dd396d68d5997f1
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Sun May 21 19:45:40 2017 -0700
Changed via_analog_init to viaAnalogProbe
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_analog.c b/src/via_analog.c
index b304e45..2169caf 100644
--- a/src/via_analog.c
+++ b/src/via_analog.c
@@ -372,48 +372,57 @@ static const xf86OutputFuncsRec via_analog_funcs = {
};
void
-via_analog_init(ScrnInfoPtr pScrn)
+viaAnalogProbe(ScrnInfoPtr pScrn)
{
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
VIAPtr pVia = VIAPTR(pScrn);
VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
- xf86OutputPtr output = NULL;
- char outputNameBuffer[32];
+ CARD8 sr13, sr5a;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Entered via_analog_init.\n"));
+ "Entered viaAnalogProbe.\n"));
- if (!pVia->pI2CBus1 || !pVia->pI2CBus2) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "I2C Bus 1 or I2C Bus 2 does not exist.\n");
- DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting via_analog_init.\n"));
- return;
- }
+ /* Detect the presence of VGA. */
+ switch (pVia->Chipset) {
+ case VIA_CX700:
+ case VIA_VX800:
+ case VIA_VX855:
+ case VIA_VX900:
+ sr5a = hwp->readSeq(hwp, 0x5A);
- /* The code to dynamically designate the output name for
- * xrandr was borrowed from xf86-video-r128 DDX. */
- sprintf(outputNameBuffer, "VGA-%d", (pVIADisplay->numberVGA + 1));
- output = xf86OutputCreate(pScrn, &via_analog_funcs, outputNameBuffer);
+ /* Setting SR5A[0] to 1.
+ * This allows the reading out the alternative
+ * pin strapping information from SR12 and SR13. */
+ ViaSeqMask(hwp, 0x5A, BIT(0), BIT(0));
- /* While there are two (2) display controllers registered with the
- * X.Org Server, it is often desirable to fix the analog VGA output
- * to IGA1 since LVDS FP (Flat Panel) typically prefers IGA2. (While
- * it is not used at this point, only IGA2 contains panel resolution
- * scaling functionality. IGA1 does not have this.)
- * With this arrangement, DVI should end up getting assigned to IGA2
- * since DVI can go to either display controller without limitations.
- * This should be the case for TV as well. */
- output->possible_crtcs = (1 << 0);
-
- output->possible_clones = 0;
- output->interlaceAllowed = TRUE;
- output->doubleScanAllowed = FALSE;
+ sr13 = hwp->readSeq(hwp, 0x13);
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "SR13: 0x%02X\n", sr13));
+ if (!(sr13 & BIT(2))) {
+ pVIADisplay->analogPresence = TRUE;
+ pVIADisplay->analogI2CBus = VIA_I2C_BUS2 | VIA_I2C_BUS1;
+ pVIADisplay->mappedI2CBus |= VIA_I2C_BUS2 | VIA_I2C_BUS1;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Detected the presence of VGA.\n"));
+ } else {
+ pVIADisplay->analogPresence = FALSE;
+ pVIADisplay->analogI2CBus = VIA_I2C_NONE;
+ }
- /* Increment the number of analog VGA connectors. */
- pVIADisplay->numberVGA++;
+ hwp->writeSeq(hwp, 0x5A, sr5a);
+ break;
+ default:
+ /* For all other devices, assume VGA presence. */
+ pVIADisplay->analogPresence = TRUE;
+ pVIADisplay->analogI2CBus = VIA_I2C_BUS2 | VIA_I2C_BUS1;
+ pVIADisplay->mappedI2CBus |= VIA_I2C_BUS2 | VIA_I2C_BUS1;
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Detected the presence of VGA.\n"));
+ break;
+ }
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Exiting via_analog_init.\n"));
+ "Exiting viaAnalogProbe.\n"));
}
void
diff --git a/src/via_outputs.c b/src/via_outputs.c
index 2f5845c..52ad3c2 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -667,8 +667,8 @@ viaOutputDetect(ScrnInfoPtr pScrn)
display detection purposes. */
viaProbePinStrapping(pScrn);
- /* VGA */
- via_analog_init(pScrn);
+ viaAnalogProbe(pScrn);
+
/* TV */
via_tv_init(pScrn);
@@ -679,6 +679,9 @@ viaOutputDetect(ScrnInfoPtr pScrn)
/* LVDS */
via_lvds_init(pScrn);
+ /* VGA */
+ viaAnalogInit(pScrn);
+
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Exiting viaOutputDetect.\n"));
}
diff --git a/src/via_ums.h b/src/via_ums.h
index dfbf517..22fa135 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -151,6 +151,8 @@ typedef struct _VIADISPLAY {
/* Keeping track of the number of analog VGA connectors. */
unsigned int numberVGA;
+ CARD8 mappedI2CBus;
+
xf86OutputPtr tv;
CARD32 Clock; /* register value for the dotclock */
@@ -589,7 +591,8 @@ void viaIGA2Restore(ScrnInfoPtr pScrn);
void ViaShadowCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
/* via_analog.c */
-void via_analog_init(ScrnInfoPtr pScrn);
+void viaAnalogProbe(ScrnInfoPtr pScrn);
+void viaAnalogInit(ScrnInfoPtr pScrn);
/* via_lvds.c */
void viaLVDS1SetIOPadSetting(ScrnInfoPtr pScrn, CARD8 ioPadState);
commit 7d605a95a5ab88d146a798c2bb1863a6b13b4d08
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Sun May 21 18:28:22 2017 -0700
Added viaAnalogInit
Made several adjustments to various variable used by viaAnalogInit
function and other functions.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/src/via_analog.c b/src/via_analog.c
index 6c6fda6..b304e45 100644
--- a/src/via_analog.c
+++ b/src/via_analog.c
@@ -392,7 +392,7 @@ via_analog_init(ScrnInfoPtr pScrn)
/* The code to dynamically designate the output name for
* xrandr was borrowed from xf86-video-r128 DDX. */
- sprintf(outputNameBuffer, "VGA-%d", (pVia->numberVGA + 1));
+ sprintf(outputNameBuffer, "VGA-%d", (pVIADisplay->numberVGA + 1));
output = xf86OutputCreate(pScrn, &via_analog_funcs, outputNameBuffer);
/* While there are two (2) display controllers registered with the
@@ -408,11 +408,73 @@ via_analog_init(ScrnInfoPtr pScrn)
output->possible_clones = 0;
output->interlaceAllowed = TRUE;
output->doubleScanAllowed = FALSE;
- pVIADisplay->analog = output;
/* Increment the number of analog VGA connectors. */
- pVia->numberVGA++;
+ pVIADisplay->numberVGA++;
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Exiting via_analog_init.\n"));
}
+
+void
+viaAnalogInit(ScrnInfoPtr pScrn)
+{
+ xf86OutputPtr output;
+ VIAPtr pVia = VIAPTR(pScrn);
+ VIADisplayPtr pVIADisplay = pVia->pVIADisplay;
+ VIAAnalogPtr pVIAAnalog;
+ char outputNameBuffer[32];
+
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Entered viaAnalogInit.\n"));
+
+ if (!pVIADisplay->analogPresence) {
+ goto exit;
+ }
+
+ pVIAAnalog = (VIAAnalogPtr) xnfcalloc(1, sizeof(VIAAnalogRec));
+ if (!pVIAAnalog) {
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate storage for "
+ "analog (VGA).\n"));
+ goto exit;
+ }
+
+ /* The code to dynamically designate the output name for
+ * xrandr was borrowed from xf86-video-r128 DDX. */
+ sprintf(outputNameBuffer, "VGA-%d", (pVIADisplay->numberVGA + 1));
+ output = xf86OutputCreate(pScrn, &via_analog_funcs, outputNameBuffer);
+ if (!output) {
+ free(pVIAAnalog);
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to allocate X Server display output "
+ "record for analog (VGA).\n");
+ goto exit;
+ }
+
+ /* Increment the number of analog VGA connectors. */
+ pVIADisplay->numberVGA++;
+
+ /* Hint about which I2C bus to access for obtaining EDID. */
+ pVIAAnalog->analogI2CBus = pVIADisplay->analogI2CBus;
+
+ output->driver_private = pVIAAnalog;
+
+ /* While there are two (2) display controllers registered with the
+ * X.Org Server, it is often desirable to fix the analog VGA output
+ * to IGA1 since LVDS FP (Flat Panel) typically prefers IGA2. (While
+ * it is not used at this point, only IGA2 contains panel resolution
+ * scaling functionality. IGA1 does not have this.)
+ * With this arrangement, DVI should end up getting assigned to IGA2
+ * since DVI can go to either display controller without limitations.
+ * This should be the case for TV as well. */
+ output->possible_crtcs = BIT(1) | BIT(0);
+
+ output->possible_clones = 0;
+ output->interlaceAllowed = FALSE;
+ output->doubleScanAllowed = FALSE;
+
+exit:
+ DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Exiting viaAnalogInit.\n"));
+}
diff --git a/src/via_driver.h b/src/via_driver.h
index 4cffda5..07854a7 100644
--- a/src/via_driver.h
+++ b/src/via_driver.h
@@ -361,9 +361,6 @@ typedef struct _VIA {
video_via_regs* VideoRegs;
- /* Keeping track of the number of analog VGA connectors. */
- unsigned int numberVGA;
-
/* Keeping track of the number of DVI connectors. */
unsigned int numberDVI;
diff --git a/src/via_outputs.c b/src/via_outputs.c
index 34acd92..2f5845c 100644
--- a/src/via_outputs.c
+++ b/src/via_outputs.c
@@ -654,10 +654,8 @@ viaOutputDetect(ScrnInfoPtr pScrn)
DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Entered viaOutputDetect.\n"));
- pVIADisplay->analog = NULL;
-
/* Initialize the number of VGA connectors. */
- pVia->numberVGA = 0;
+ pVIADisplay->numberVGA = 0;
/* Initialize the number of DVI connectors. */
pVia->numberDVI = 0;
diff --git a/src/via_ums.h b/src/via_ums.h
index e955599..dfbf517 100644
--- a/src/via_ums.h
+++ b/src/via_ums.h
@@ -145,8 +145,13 @@ typedef struct ViaPanelMode {
} ViaPanelModeRec, *ViaPanelModePtr ;
typedef struct _VIADISPLAY {
- xf86OutputPtr analog;
- xf86OutputPtr tv;
+ Bool analogPresence;
+ CARD8 analogI2CBus;
+
+ /* Keeping track of the number of analog VGA connectors. */
+ unsigned int numberVGA;
+
+ xf86OutputPtr tv;
CARD32 Clock; /* register value for the dotclock */
Bool ClockExternal;
@@ -177,6 +182,9 @@ typedef struct _VIADISPLAY {
} VIADisplayRec, *VIADisplayPtr;
+typedef struct _VIAANALOG {
+ CARD8 analogI2CBus;
+} VIAAnalogRec, *VIAAnalogPtr;
/*
* Record for storing FP (Flat Panel) specific information.
More information about the Openchrome-devel
mailing list