configure.ac | 2 src/via_driver.h | 3 src/via_fp.c | 290 +++++++++++++++++++++++++++++++++++++++++++++--------- src/via_outputs.c | 10 + src/via_ums.h | 19 ++- 5 files changed, 265 insertions(+), 59 deletions(-)
New commits: commit 8b00ce1fccc5ab74dcf35a9806ed2f6bb8abb4c4 Author: Kevin Brace <kevinbr...@gmx.com> Date: Tue May 23 15:16:05 2017 -0700 Version bumped to 0.6.119 Did a major rewrite of FP related probing and initialization code. Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/configure.ac b/configure.ac index d3e9b62..a2cb667 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ(2.57) AC_INIT([xf86-video-openchrome], - [0.6.118], + [0.6.119], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome], [xf86-video-openchrome]) commit 44b46d0536213abca0f37ad9e4d0a35e8d143075 Author: Kevin Brace <kevinbr...@gmx.com> Date: Tue May 23 15:13:46 2017 -0700 Replacing via_lvds_init with viaFPProbe viaFPProbe and viaFPInit functions replace via_lvds_init function Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_fp.c b/src/via_fp.c index 84d1e94..8e9c0ef 100644 --- a/src/via_fp.c +++ b/src/via_fp.c @@ -1560,79 +1560,174 @@ static const xf86OutputFuncsRec via_fp_funcs = { .destroy = via_lvds_destroy }; - void -via_lvds_init(ScrnInfoPtr pScrn) +viaFPProbe(ScrnInfoPtr pScrn) { - VIAFPPtr pVIAFP = (VIAFPPtr) xnfcalloc(sizeof(VIAFPRec), 1); - OptionInfoPtr Options = xnfalloc(sizeof(ViaPanelOptions)); - MessageType from = X_DEFAULT; + vgaHWPtr hwp = VGAHWPTR(pScrn); VIAPtr pVia = VIAPTR(pScrn); VIADisplayPtr pVIADisplay = pVia->pVIADisplay; - xf86OutputPtr output = NULL; - vgaHWPtr hwp = VGAHWPTR(pScrn); - CARD8 cr3b = 0x00; - CARD8 cr3b_mask = 0x00; - char outputNameBuffer[32]; + CARD8 sr12, sr13, sr5a; + CARD8 cr3b; - if (!pVIAFP) - return; + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Entered viaFPProbe.\n")); - /* Apparently this is the way VIA Technologies passes */ - /* the presence of a flat panel to the device driver */ - /* via BIOS setup. */ - if (pVia->Chipset == VIA_CLE266) { - cr3b_mask = 0x08; - } else { - cr3b_mask = 0x02; - } + sr12 = hwp->readSeq(hwp, 0x12); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SR12: 0x%02X\n", sr12)); + sr13 = hwp->readSeq(hwp, 0x13); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SR13: 0x%02X\n", sr13)); + cr3b = hwp->readCrtc(hwp, 0x3B); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "CR3B: 0x%02X\n", sr13)); - cr3b = hwp->readCrtc(hwp, 0x3B) & cr3b_mask; + /* Detect the presence of FPs. */ + switch (pVia->Chipset) { + case VIA_CLE266: + if ((sr12 & BIT(4)) || (cr3b & BIT(3))) { + pVIADisplay->intFP1Presence = TRUE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_DIP0; + pVIADisplay->intFP2Presence = FALSE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_NONE; + } else { + pVIADisplay->intFP1Presence = FALSE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_NONE; + pVIADisplay->intFP2Presence = FALSE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_NONE; + } - if (!cr3b) { - return; - } + break; + case VIA_KM400: + case VIA_P4M800PRO: + case VIA_PM800: + case VIA_K8M800: + /* 3C5.13[3] - DVP0D8 pin strapping + * 0: AGP pins are used for AGP + * 1: AGP pins are used by FPDP + * (Flat Panel Display Port) */ + if ((sr13 & BIT(3)) && (cr3b & BIT(1))) { + pVIADisplay->intFP1Presence = TRUE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_FPDPHIGH + | VIA_DI_PORT_FPDPLOW; + pVIADisplay->intFP2Presence = FALSE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_NONE; - memcpy(Options, ViaPanelOptions, sizeof(ViaPanelOptions)); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, Options); + } else { + pVIADisplay->intFP1Presence = FALSE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_NONE; + pVIADisplay->intFP2Presence = FALSE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_NONE; + } - pVIAFP->NativeModeIndex = VIA_PANEL_INVALID; + break; + case VIA_P4M890: + case VIA_K8M890: + case VIA_P4M900: + if (cr3b & BIT(1)) { + + /* 3C5.12[4] - DVP0D4 pin strapping + * 0: 12-bit FPDP (Flat Panel Display Port) + * 1: 24-bit FPDP (Flat Panel Display Port) */ + if (sr12 & BIT(4)) { + pVIADisplay->intFP1Presence = TRUE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_FPDPLOW + | VIA_DI_PORT_FPDPHIGH; + pVIADisplay->intFP2Presence = FALSE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_NONE; + } else { + pVIADisplay->intFP1Presence = TRUE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_FPDPLOW; + pVIADisplay->intFP2Presence = FALSE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_NONE; + } + } - /* LCD Center/Expend Option */ - pVIAFP->Center = FALSE; - from = xf86GetOptValBool(Options, OPTION_CENTER, &pVIAFP->Center) - ? X_CONFIG : X_DEFAULT; - xf86DrvMsg(pScrn->scrnIndex, from, "LVDS-0 : DVI Center is %s.\n", - pVIAFP->Center ? "enabled" : "disabled"); + break; + case VIA_CX700: + case VIA_VX800: + case VIA_VX855: + case VIA_VX900: + sr5a = hwp->readSeq(hwp, 0x5A); - /* The code to dynamically designate a particular FP (i.e., FP-1, - * FP-2, etc.) for xrandr was borrowed from xf86-video-r128 DDX. */ - sprintf(outputNameBuffer, "FP-%d", (pVIADisplay->numberFP + 1)); - output = xf86OutputCreate(pScrn, &via_fp_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)); - if (output) { - output->driver_private = pVIAFP; + sr13 = hwp->readSeq(hwp, 0x13); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SR13: 0x%02X\n", sr13)); + + if (cr3b & BIT(1)) { + if (pVia->isVIANanoBook) { + pVIADisplay->intFP1Presence = FALSE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_NONE; + pVIADisplay->intFP2Presence = TRUE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_LVDS2; + + /* 3C5.13[7:6] - Integrated LVDS / DVI Mode Select + * (DVP1D15-14 pin strapping) + * 00: LVDS1 + LVDS2 + * 01: DVI + LVDS2 + * 10: Dual LVDS Channel (High Resolution Panel) + * 11: One DVI only (decrease the clock jitter) */ + } else if ((!(sr13 & BIT(7))) && (!(sr13 & BIT(6)))) { + pVIADisplay->intFP1Presence = TRUE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_LVDS1; + pVIADisplay->intFP2Presence = TRUE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_LVDS2; + } else if ((!(sr13 & BIT(7))) && (sr13 & BIT(6))) { + pVIADisplay->intFP1Presence = FALSE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_NONE; + pVIADisplay->intFP2Presence = TRUE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_LVDS2; + } else if ((sr13 & BIT(7)) && (!(sr13 & BIT(6)))) { + pVIADisplay->intFP1Presence = TRUE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_LVDS1 + | VIA_DI_PORT_LVDS2; + pVIADisplay->intFP2Presence = FALSE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_NONE; + } else { + pVIADisplay->intFP1Presence = FALSE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_NONE; + pVIADisplay->intFP2Presence = FALSE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_NONE; + } + } else { + pVIADisplay->intFP1Presence = FALSE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_NONE; + pVIADisplay->intFP2Presence = FALSE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_NONE; + } - /* While there are two (2) display controllers registered with the - * X.Org Server, it is often desirable to fix FP (Flat Panel) to - * IGA2 since only IGA2 contains panel resolution scaling - * functionality. IGA1 does not have this. */ - output->possible_crtcs = 1 << 1; + hwp->writeSeq(hwp, 0x5A, sr5a); + break; + default: + pVIADisplay->intFP1Presence = FALSE; + pVIADisplay->intFP1DIPort = VIA_DI_PORT_NONE; + pVIADisplay->intFP2Presence = FALSE; + pVIADisplay->intFP2DIPort = VIA_DI_PORT_NONE; + break; + } - output->possible_clones = 0; - output->interlaceAllowed = FALSE; - output->doubleScanAllowed = FALSE; + pVIADisplay->intFP1I2CBus = VIA_I2C_NONE; + pVIADisplay->intFP2I2CBus = VIA_I2C_NONE; - /* Increment the number of FP connectors. */ - pVIADisplay->numberFP++; + if ((pVIADisplay->intFP1Presence) + && (!(pVIADisplay->mappedI2CBus & VIA_I2C_BUS2))) { + pVIADisplay->intFP1I2CBus = VIA_I2C_BUS2; + pVIADisplay->mappedI2CBus |= VIA_I2C_BUS2; + } - if (pVia->IsOLPCXO15) { - output->mm_height = 152; - output->mm_width = 114; - } - } else { - free(pVIAFP); + if ((pVIADisplay->intFP2Presence) + && (!(pVIADisplay->mappedI2CBus & VIA_I2C_BUS2))) { + pVIADisplay->intFP2I2CBus = VIA_I2C_BUS2; + pVIADisplay->mappedI2CBus |= VIA_I2C_BUS2; } + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Exiting viaFPProbe.\n")); } void diff --git a/src/via_outputs.c b/src/via_outputs.c index 7bff710..258ad6e 100644 --- a/src/via_outputs.c +++ b/src/via_outputs.c @@ -669,6 +669,8 @@ viaInitDisplay(ScrnInfoPtr pScrn) viaTMDSProbe(pScrn); + viaFPProbe(pScrn); + viaAnalogProbe(pScrn); @@ -678,15 +680,15 @@ viaInitDisplay(ScrnInfoPtr pScrn) /* DVI */ via_dvi_init(pScrn); - /* LVDS */ - via_lvds_init(pScrn); - /* DVI */ viaTMDSInit(pScrn); /* VGA */ viaAnalogInit(pScrn); + /* FP (Flat Panel) */ + viaFPInit(pScrn); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Exiting viaInitDisplay.\n")); } diff --git a/src/via_ums.h b/src/via_ums.h index 483239e..9b19fcb 100644 --- a/src/via_ums.h +++ b/src/via_ums.h @@ -613,9 +613,10 @@ void ViaShadowCRTCSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode); void viaAnalogProbe(ScrnInfoPtr pScrn); void viaAnalogInit(ScrnInfoPtr pScrn); -/* via_lvds.c */ +/* via_fp.c */ void viaLVDS1SetIOPadSetting(ScrnInfoPtr pScrn, CARD8 ioPadState); -void via_lvds_init(ScrnInfoPtr pScrn); +void viaFPProbe(ScrnInfoPtr pScrn); +void viaFPInit(ScrnInfoPtr pScrn); /* via_tmds.c */ void viaExtTMDSSetDisplaySource(ScrnInfoPtr pScrn, CARD8 displaySource); commit 2117faaf0e39d3f63684afeb1226a0bc2f670d14 Author: Kevin Brace <kevinbr...@gmx.com> Date: Tue May 23 14:45:30 2017 -0700 Added viaFPInit Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_fp.c b/src/via_fp.c index cef86e7..84d1e94 100644 --- a/src/via_fp.c +++ b/src/via_fp.c @@ -1634,3 +1634,101 @@ via_lvds_init(ScrnInfoPtr pScrn) free(pVIAFP); } } + +void +viaFPInit(ScrnInfoPtr pScrn) +{ + xf86OutputPtr output; + VIAPtr pVia = VIAPTR(pScrn); + VIADisplayPtr pVIADisplay = pVia->pVIADisplay; + VIAFPPtr pVIAFP; + char outputNameBuffer[32]; + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Entering viaFPInit.\n")); + + if (pVIADisplay->intFP1Presence) { + pVIAFP = (VIAFPPtr) xnfcalloc(1, sizeof(VIAFPRec)); + if (!pVIAFP) { + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate private storage for " + "FP.\n")); + goto exit; + } + + /* The code to dynamically designate a particular FP (i.e., FP-1, + * FP-2, etc.) for xrandr was borrowed from xf86-video-r128 DDX. */ + sprintf(outputNameBuffer, "FP-%d", (pVIADisplay->numberFP + 1)); + output = xf86OutputCreate(pScrn, &via_fp_funcs, outputNameBuffer); + if (!output) { + free(pVIAFP); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate X Server display output record for " + "FP.\n"); + goto exit; + } + + /* Increment the number of FP connectors. */ + pVIADisplay->numberFP++; + + pVIAFP->diPort = pVIADisplay->intFP1DIPort; + + /* Hint about which I2C bus to access for obtaining EDID. */ + pVIAFP->i2cBus = pVIADisplay->intFP1I2CBus; + + output->driver_private = pVIAFP; + + output->possible_crtcs = BIT(1) | BIT(0); + + output->possible_clones = 0; + output->interlaceAllowed = FALSE; + output->doubleScanAllowed = FALSE; + + if (pVia->IsOLPCXO15) { + output->mm_height = 152; + output->mm_width = 114; + } + } + + if (pVIADisplay->intFP2Presence) { + pVIAFP = (VIAFPPtr) xnfcalloc(1, sizeof(VIAFPRec)); + if (!pVIAFP) { + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate private storage for " + "FP.\n")); + goto exit; + } + + /* The code to dynamically designate a particular FP (i.e., FP-1, + * FP-2, etc.) for xrandr was borrowed from xf86-video-r128 DDX. */ + sprintf(outputNameBuffer, "FP-%d", (pVIADisplay->numberFP + 1)); + output = xf86OutputCreate(pScrn, &via_fp_funcs, outputNameBuffer); + if (!output) { + free(pVIAFP); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate X Server display output record for " + "FP.\n"); + goto exit; + } + + /* Increment the number of FP connectors. */ + pVIADisplay->numberFP++; + + pVIAFP->diPort = pVIADisplay->intFP2DIPort; + + /* Hint about which I2C bus to access for obtaining EDID. */ + pVIAFP->i2cBus = pVIADisplay->intFP2I2CBus; + + output->driver_private = pVIAFP; + + 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 viaFPInit.\n")); +} diff --git a/src/via_ums.h b/src/via_ums.h index 7874bea..483239e 100644 --- a/src/via_ums.h +++ b/src/via_ums.h @@ -152,6 +152,14 @@ typedef struct _VIADISPLAY { CARD8 intTMDSDIPort; CARD8 intTMDSI2CBus; + Bool intFP1Presence; + CARD8 intFP1DIPort; + CARD8 intFP1I2CBus; + + Bool intFP2Presence; + CARD8 intFP2DIPort; + CARD8 intFP2I2CBus; + /* Keeping track of the number of analog VGA connectors. */ unsigned int numberVGA; @@ -226,7 +234,8 @@ typedef struct _VIAFP { Bool scaleY; int resY; - I2CBusPtr pVIAFPI2CBus; + CARD8 diPort; + CARD8 i2cBus; } VIAFPRec, *VIAFPPtr; typedef struct _VIATMDS { commit b9b7204120452891ee6258f2336a324c9559f5ef Author: Kevin Brace <kevinbr...@gmx.com> Date: Tue May 23 14:28:35 2017 -0700 Changed via_lvds_funcs to via_fp_funcs Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_fp.c b/src/via_fp.c index fd7a1ba..cef86e7 100644 --- a/src/via_fp.c +++ b/src/via_fp.c @@ -1539,7 +1539,7 @@ via_lvds_destroy(xf86OutputPtr output) output->driver_private = NULL; } -static const xf86OutputFuncsRec via_lvds_funcs = { +static const xf86OutputFuncsRec via_fp_funcs = { .create_resources = via_lvds_create_resources, .dpms = via_fp_dpms, .save = via_lvds_save, @@ -1608,7 +1608,7 @@ via_lvds_init(ScrnInfoPtr pScrn) /* The code to dynamically designate a particular FP (i.e., FP-1, * FP-2, etc.) for xrandr was borrowed from xf86-video-r128 DDX. */ sprintf(outputNameBuffer, "FP-%d", (pVIADisplay->numberFP + 1)); - output = xf86OutputCreate(pScrn, &via_lvds_funcs, outputNameBuffer); + output = xf86OutputCreate(pScrn, &via_fp_funcs, outputNameBuffer); if (output) { output->driver_private = pVIAFP; commit 50c1396d8df98beda139601f624132635e6cb0e1 Author: Kevin Brace <kevinbr...@gmx.com> Date: Tue May 23 14:19:22 2017 -0700 Moving numberFP variable to a different record Signed-off-by: Kevin Brace <kevinbr...@gmx.com> diff --git a/src/via_driver.h b/src/via_driver.h index 18ceb58..c750248 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 FP (Flat Panel) connectors. */ - unsigned int numberFP; - /* Shadow copy of CR3B through CR3F. */ CARD8 originalCR3B, originalCR3C, originalCR3D, originalCR3E, originalCR3F; diff --git a/src/via_fp.c b/src/via_fp.c index 31e1528..fd7a1ba 100644 --- a/src/via_fp.c +++ b/src/via_fp.c @@ -1568,6 +1568,7 @@ via_lvds_init(ScrnInfoPtr pScrn) OptionInfoPtr Options = xnfalloc(sizeof(ViaPanelOptions)); MessageType from = X_DEFAULT; VIAPtr pVia = VIAPTR(pScrn); + VIADisplayPtr pVIADisplay = pVia->pVIADisplay; xf86OutputPtr output = NULL; vgaHWPtr hwp = VGAHWPTR(pScrn); CARD8 cr3b = 0x00; @@ -1606,7 +1607,7 @@ via_lvds_init(ScrnInfoPtr pScrn) /* The code to dynamically designate a particular FP (i.e., FP-1, * FP-2, etc.) for xrandr was borrowed from xf86-video-r128 DDX. */ - sprintf(outputNameBuffer, "FP-%d", (pVia->numberFP + 1)); + sprintf(outputNameBuffer, "FP-%d", (pVIADisplay->numberFP + 1)); output = xf86OutputCreate(pScrn, &via_lvds_funcs, outputNameBuffer); if (output) { @@ -1623,7 +1624,7 @@ via_lvds_init(ScrnInfoPtr pScrn) output->doubleScanAllowed = FALSE; /* Increment the number of FP connectors. */ - pVia->numberFP++; + pVIADisplay->numberFP++; if (pVia->IsOLPCXO15) { output->mm_height = 152; diff --git a/src/via_outputs.c b/src/via_outputs.c index 2c5628f..7bff710 100644 --- a/src/via_outputs.c +++ b/src/via_outputs.c @@ -661,7 +661,7 @@ viaInitDisplay(ScrnInfoPtr pScrn) pVIADisplay->numberDVI = 0; /* Initialize the number of FP connectors. */ - pVia->numberFP = 0; + pVIADisplay->numberFP = 0; /* Read off the VIA Technologies IGP pin strapping for display detection purposes. */ diff --git a/src/via_ums.h b/src/via_ums.h index b32dde1..7874bea 100644 --- a/src/via_ums.h +++ b/src/via_ums.h @@ -158,6 +158,9 @@ typedef struct _VIADISPLAY { /* Keeping track of the number of DVI connectors. */ unsigned int numberDVI; + /* Keeping track of the number of FP (Flat Panel) connectors. */ + unsigned int numberFP; + CARD8 mappedI2CBus; xf86OutputPtr tv; _______________________________________________ Openchrome-devel mailing list Openchrome-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/openchrome-devel