From 9b78208f1ef1a8ee98f2aa139956659169e234ab Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Apr 2007 18:20:15 -0700 Subject: Move a bunch of debugging verbosity under Option "ModeDebug". --- man/intel.man | 4 ++++ src/i830.h | 3 +++ src/i830_bios.c | 8 +++++--- src/i830_display.c | 16 ++++++++-------- src/i830_driver.c | 25 +++++++++++++++++++----- src/i830_lvds.c | 4 +++- src/i830_sdvo.c | 56 +++++++++++++++++++++++++++++++----------------------- src/i830_tv.c | 24 +++++++++++++++-------- 8 files changed, 91 insertions(+), 49 deletions(-) diff --git a/man/intel.man b/man/intel.man index 3197febd..80b327d3 100644 --- a/man/intel.man +++ b/man/intel.man @@ -175,6 +175,10 @@ Choose acceleration architecture, either "XAA" or "EXA". XAA is the old (but stable) XFree86 based acceleration architecture. EXA is a newer and simpler acceleration architecture designed to better accelerate the X Render extension. Default: "XAA". +.TP +.BI "Option \*qModeDebug\*q \*q" boolean \*q +Enable printing of additional debugging information about modesetting to +the server log. .PP The 830M and newer driver supports RandR 1.2, exposing the VGA, LVDS diff --git a/src/i830.h b/src/i830.h index e75eb89a..4cb31b6d 100644 --- a/src/i830.h +++ b/src/i830.h @@ -527,6 +527,9 @@ typedef struct _I830Rec { CARD32 saveBLC_PWM_CTL; enum last_3d last_3d; + + /** Enables logging of debug output related to mode switching. */ + Bool debug_modes; } I830Rec; #define I830PTR(p) ((I830Ptr)((p)->driverPrivate)) diff --git a/src/i830_bios.c b/src/i830_bios.c index cb886b54..0d009175 100644 --- a/src/i830_bios.c +++ b/src/i830_bios.c @@ -229,9 +229,11 @@ i830_bios_get_panel_mode(ScrnInfoPtr pScrn) xf86SetModeDefaultName(fixed_mode); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Found panel mode in BIOS VBT tables:\n"); - xf86PrintModeline(pScrn->scrnIndex, fixed_mode); + if (pI830->debug_modes) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Found panel mode in BIOS VBT tables:\n"); + xf86PrintModeline(pScrn->scrnIndex, fixed_mode); + } xfree(bios); return fixed_mode; diff --git a/src/i830_display.c b/src/i830_display.c index b3a7da9e..727d1b29 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -884,17 +884,17 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, if (i830_panel_fitter_pipe (pI830) == pipe) OUTREG(PFIT_CONTROL, 0); -#if 1 - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); - xf86PrintModeline(pScrn->scrnIndex, mode); - if (!xf86ModesEqual(mode, adjusted_mode)) { + if (pI830->debug_modes) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Adjusted mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); + "Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); xf86PrintModeline(pScrn->scrnIndex, mode); + if (!xf86ModesEqual(mode, adjusted_mode)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Adjusted mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); + xf86PrintModeline(pScrn->scrnIndex, mode); + } + i830PrintPll("chosen", &clock); } - i830PrintPll("chosen", &clock); -#endif if (dpll & DPLL_VCO_ENABLE) { diff --git a/src/i830_driver.c b/src/i830_driver.c index 229c26b8..4ee720fe 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -275,6 +275,7 @@ typedef enum { OPTION_COLOR_KEY, OPTION_CHECKDEVICES, OPTION_LINEARALLOC, + OPTION_MODEDEBUG, #ifdef XF86DRI_MM OPTION_INTELTEXPOOL, OPTION_INTELMMSIZE, @@ -296,6 +297,7 @@ static OptionInfoRec I830Options[] = { {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE}, {OPTION_CHECKDEVICES, "CheckDevices",OPTV_BOOLEAN, {0}, FALSE}, {OPTION_LINEARALLOC, "LinearAlloc", OPTV_INTEGER, {0}, FALSE}, + {OPTION_MODEDEBUG, "ModeDebug", OPTV_BOOLEAN, {0}, FALSE}, #ifdef XF86DRI_MM {OPTION_INTELTEXPOOL,"Legacy3D", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_INTELMMSIZE, "AperTexSize", OPTV_INTEGER, {0}, FALSE}, @@ -975,6 +977,12 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) memcpy(pI830->Options, I830Options, sizeof(I830Options)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI830->Options); + if (xf86ReturnOptValBool(pI830->Options, OPTION_MODEDEBUG, FALSE)) { + pI830->debug_modes = TRUE; + } else { + pI830->debug_modes = FALSE; + } + /* We have to use PIO to probe, because we haven't mapped yet. */ I830SetPIOAccess(pI830); @@ -1133,8 +1141,10 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) /* Some of the probing needs MMIO access, so map it here. */ I830MapMMIO(pScrn); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Hardware state on X startup:\n"); - i830DumpRegs (pScrn); + if (pI830->debug_modes) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Hardware state on X startup:\n"); + i830DumpRegs (pScrn); + } i830TakeRegSnapshot(pScrn); @@ -2800,8 +2810,10 @@ I830LeaveVT(int scrnIndex, int flags) RestoreHWState(pScrn); - i830CompareRegsToSnapshot(pScrn, "After LeaveVT"); - i830DumpRegs (pScrn); + if (pI830->debug_modes) { + i830CompareRegsToSnapshot(pScrn, "After LeaveVT"); + i830DumpRegs (pScrn); + } if (I830IsPrimary(pScrn)) i830_unbind_all_memory(pScrn); @@ -2850,7 +2862,10 @@ I830EnterVT(int scrnIndex, int flags) if (!xf86SetDesiredModes (pScrn)) return FALSE; - i830DumpRegs (pScrn); + if (pI830->debug_modes) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Hardware state at EnterVT:\n"); + i830DumpRegs (pScrn); + } i830DescribeOutputConfiguration(pScrn); ResetState(pScrn, TRUE); diff --git a/src/i830_lvds.c b/src/i830_lvds.c index eb533a79..d16eccb5 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -473,7 +473,9 @@ i830_lvds_init(ScrnInfoPtr pScrn) bios_mode = i830_bios_get_panel_mode(pScrn); if (bios_mode != NULL) { if (pI830->panel_fixed_mode != NULL) { - if (!xf86ModesEqual(pI830->panel_fixed_mode, bios_mode)) { + if (pI830->debug_modes && + !xf86ModesEqual(pI830->panel_fixed_mode, bios_mode)) + { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "BIOS panel mode data doesn't match probed data, " "continuing with probed.\n"); diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index 324d47e8..f0723a9d 100644 --- a/src/i830_sdvo.c +++ b/src/i830_sdvo.c @@ -214,6 +214,7 @@ static I2CSlaveAddr slaveAddr; static void i830_sdvo_write_cmd(xf86OutputPtr output, CARD8 cmd, void *args, int args_len) { + I830Ptr pI830 = I830PTR(output->scrn); I830OutputPrivatePtr intel_output = output->driver_private; struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; int i; @@ -222,20 +223,25 @@ i830_sdvo_write_cmd(xf86OutputPtr output, CARD8 cmd, void *args, int args_len) ErrorF ("Mismatch slave addr %x != %x\n", slaveAddr, dev_priv->d.SlaveAddr); /* Write the SDVO command logging */ - xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_INFO, "%s: W: %02X ", SDVO_NAME(dev_priv), cmd); - for (i = 0; i < args_len; i++) - LogWrite(1, "%02X ", ((CARD8 *)args)[i]); - for (; i < 8; i++) - LogWrite(1, " "); - for (i = 0; i < sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0]); i++) { - if (cmd == sdvo_cmd_names[i].cmd) { - LogWrite(1, "(%s)", sdvo_cmd_names[i].name); - break; + if (pI830->debug_modes) { + xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_INFO, "%s: W: %02X ", + SDVO_NAME(dev_priv), cmd); + for (i = 0; i < args_len; i++) + LogWrite(1, "%02X ", ((CARD8 *)args)[i]); + for (; i < 8; i++) + LogWrite(1, " "); + for (i = 0; i < sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0]); + i++) + { + if (cmd == sdvo_cmd_names[i].cmd) { + LogWrite(1, "(%s)", sdvo_cmd_names[i].name); + break; + } } + if (i == sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0])) + LogWrite(1, "(%02X)", cmd); + LogWrite(1, "\n"); } - if (i == sizeof(sdvo_cmd_names) / sizeof(sdvo_cmd_names[0])) - LogWrite(1, "(%02X)", cmd); - LogWrite(1, "\n"); /* send the output regs */ for (i = 0; i < args_len; i++) { @@ -261,6 +267,7 @@ static const char *cmd_status_names[] = { static CARD8 i830_sdvo_read_response(xf86OutputPtr output, void *response, int response_len) { + I830Ptr pI830 = I830PTR(output->scrn); I830OutputPrivatePtr intel_output = output->driver_private; int i; CARD8 status; @@ -275,19 +282,20 @@ i830_sdvo_read_response(xf86OutputPtr output, void *response, int response_len) i830_sdvo_read_byte(output, SDVO_I2C_CMD_STATUS, &status); /* Write the SDVO command logging */ - xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_INFO, - "%s: R: ", SDVO_NAME(SDVO_PRIV(intel_output))); - for (i = 0; i < response_len; i++) - LogWrite(1, "%02X ", ((CARD8 *)response)[i]); - for (; i < 8; i++) - LogWrite(1, " "); - if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP) - { - LogWrite(1, "(%s)", cmd_status_names[status]); - } else { - LogWrite(1, "(??? %d)", status); + if (pI830->debug_modes) { + xf86DrvMsg(intel_output->pI2CBus->scrnIndex, X_INFO, + "%s: R: ", SDVO_NAME(SDVO_PRIV(intel_output))); + for (i = 0; i < response_len; i++) + LogWrite(1, "%02X ", ((CARD8 *)response)[i]); + for (; i < 8; i++) + LogWrite(1, " "); + if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP) { + LogWrite(1, "(%s)", cmd_status_names[status]); + } else { + LogWrite(1, "(??? %d)", status); + } + LogWrite(1, "\n"); } - LogWrite(1, "\n"); return status; } diff --git a/src/i830_tv.c b/src/i830_tv.c index df956c96..336214f1 100644 --- a/src/i830_tv.c +++ b/src/i830_tv.c @@ -1312,20 +1312,28 @@ i830_tv_detect_type (xf86CrtcPtr crtc, * 0 0 0 Component */ if ((tv_dac & TVDAC_SENSE_MASK) == (TVDAC_B_SENSE | TVDAC_C_SENSE)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected Composite TV connection\n"); + if (pI830->debug_modes) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Detected Composite TV connection\n"); + } type = TV_TYPE_COMPOSITE; } else if ((tv_dac & (TVDAC_A_SENSE|TVDAC_B_SENSE)) == TVDAC_A_SENSE) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected S-Video TV connection\n"); + if (pI830->debug_modes) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Detected S-Video TV connection\n"); + } type = TV_TYPE_SVIDEO; } else if ((tv_dac & TVDAC_SENSE_MASK) == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected Component TV connection\n"); + if (pI830->debug_modes) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Detected Component TV connection\n"); + } type = TV_TYPE_COMPONENT; } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "No TV connection detected\n"); + if (pI830->debug_modes) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "No TV connection detected\n"); + } type = TV_TYPE_NONE; } -- cgit v1.2.3