From e220fc798450285dc9ee7dea8aeda29eae089d4f Mon Sep 17 00:00:00 2001 From: Kevin Brace Date: Sun, 17 Jan 2016 00:19:27 -0600 Subject: [PATCH 4/7] General improvement of via_tv_init function Added debug messages to via_tv_init function inside via_outputs.c in order to aid the debugging effort. Made small adjustments to better handle error conditions as well. --- src/via_outputs.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/via_outputs.c b/src/via_outputs.c index 3aa8c97..ef48226 100644 --- a/src/via_outputs.c +++ b/src/via_outputs.c @@ -400,6 +400,9 @@ via_tv_init(ScrnInfoPtr pScrn) VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; xf86OutputPtr output = NULL; + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Entered via_tv_init.\n")); + /* preset some pBIOSInfo TV related values -- move up */ pBIOSInfo->TVEncoder = VIA_NONETV; pBIOSInfo->TVI2CDev = NULL; @@ -430,8 +433,13 @@ via_tv_init(ScrnInfoPtr pScrn) else if (pVia->pI2CBus3 && xf86I2CProbeAddress(pVia->pI2CBus3, 0xEA)) pBIOSInfo->TVI2CDev = ViaCH7xxxDetect(pScrn, pVia->pI2CBus3, 0xEA); - if (!pBIOSInfo->TVI2CDev) + if (!pBIOSInfo->TVI2CDev) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Did not detect a TV encoder.\n"); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Exiting via_tv_init.\n")); return FALSE; + } switch (pBIOSInfo->TVEncoder) { case VIA_VT1621: @@ -446,6 +454,10 @@ via_tv_init(ScrnInfoPtr pScrn) ViaCH7xxxInit(pScrn); break; default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Was not able to initialize a known TV encoder.\n"); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Exiting via_tv_init.\n")); return FALSE; break; } @@ -457,7 +469,7 @@ via_tv_init(ScrnInfoPtr pScrn) || !pBIOSInfo->TVPrintRegs) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "via_tv_init: TVEncoder was not properly initialised.\n"); + "TV encoder was not properly initialized.\n"); xf86DestroyI2CDevRec(pBIOSInfo->TVI2CDev, TRUE); pBIOSInfo->TVI2CDev = NULL; @@ -475,18 +487,23 @@ via_tv_init(ScrnInfoPtr pScrn) pBIOSInfo->TVPrintRegs = NULL; pBIOSInfo->TVNumRegs = 0; + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Exiting via_tv_init.\n")); return FALSE; } - output = xf86OutputCreate(pScrn, &via_tv_funcs, "TV-1"); pVia->FirstInit = TRUE; + output = xf86OutputCreate(pScrn, &via_tv_funcs, "TV-1"); 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"); + "Failed to register TV-1.\n"); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Exiting via_tv_init.\n")); + return FALSE; } pBIOSInfo->tv = output; @@ -497,6 +514,9 @@ via_tv_init(ScrnInfoPtr pScrn) if (VIAPTR(pScrn)->PrintTVRegs) pBIOSInfo->TVPrintRegs(pScrn); #endif + + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Exiting via_tv_init.\n")); return TRUE; } -- 1.7.9.5