xf86-video-intel: Branch 'modesetting' - src/i830_display.c src/i830_driver.c src/i830_sdvo.c src/i830_sdvo.h
Eric Anholt
anholt at kemper.freedesktop.org
Thu Jun 22 03:12:00 EEST 2006
src/i830_display.c | 10 +++++-----
src/i830_driver.c | 44 ++++++++++++++++++++++++++++++++++++++++----
src/i830_sdvo.c | 26 ++++++++++++++++++++++++++
src/i830_sdvo.h | 3 +++
4 files changed, 74 insertions(+), 9 deletions(-)
New commits:
diff-tree 66d9a1be302ad34573de98de21cbdf6419592092 (from 72e25a7488c2eabcc92e9e0769a89dee687f52fd)
Author: Eric Anholt <anholt at FreeBSD.org>
Date: Wed Jun 21 17:11:54 2006 -0700
Detect SDVO display presence at startup and default to displaying to it, too.
diff --git a/src/i830_display.c b/src/i830_display.c
index 0fadc0c..8843f98 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -514,11 +514,6 @@ i830PipeSetMode(ScrnInfoPtr pScrn, Displ
/* And then turn the plane on */
OUTREG(DSPACNTR, dspcntr);
-
- if (is_sdvo) {
- OUTREG(SDVOB, sdvob);
- OUTREG(SDVOC, sdvoc);
- }
} else {
/* Always make sure the LVDS is off before we play with DPLLs and pipe
* configuration.
@@ -591,6 +586,11 @@ i830PipeSetMode(ScrnInfoPtr pScrn, Displ
if (outputs & PIPE_CRT_ACTIVE)
OUTREG(ADPA, adpa);
+ if (is_sdvo) {
+ OUTREG(SDVOB, sdvob);
+ OUTREG(SDVOC, sdvoc);
+ }
+
return TRUE;
}
diff --git a/src/i830_driver.c b/src/i830_driver.c
index c0938fa..c51587b 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1841,7 +1841,12 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int f
I830DetectMonitors(pScrn);
- for (i = 0; i < MAX_OUTPUTS; i++) {
+ /* Walk from the end so we'll happen to hit SDVO first, if we found some. An
+ * SDVO device is probably a DFP, and so probably pickier than (say) a CRT
+ * that we might find early in the list. This hackery will go away when we
+ * start doing independent per-head mode selection.
+ */
+ for (i = MAX_OUTPUTS - 1; i >= 0; i--) {
if (pI830->output[i].MonInfo) {
pScrn->monitor->DDC = pI830->output[i].MonInfo;
xf86SetDDCproperties(pScrn, pI830->output[i].MonInfo);
@@ -1956,6 +1961,23 @@ I830BIOSPreInit(ScrnInfoPtr pScrn, int f
pI830->MonType1 |= PIPE_CRT;
}
+ /* Check for attached SDVO outputs. Assume that they're flat panels for
+ * now. Though really, it's just a name at the moment, since we don't
+ * treat different SDVO outputs differently.
+ */
+ for (i = 0; i < MAX_OUTPUTS; i++) {
+ if (pI830->output[i].type == I830_OUTPUT_SDVO &&
+ pI830->output[i].sdvo_drv != NULL) {
+ if (!I830DetectSDVODisplays(pScrn, i))
+ continue;
+
+ if (pI830->MonType1 == PIPE_NONE)
+ pI830->MonType1 |= PIPE_DFP;
+ else if (pI830->MonType2 == PIPE_NONE)
+ pI830->MonType2 |= PIPE_DFP;
+ }
+ }
+
/* And, if we haven't found anything (including CRT through DDC), assume
* that there's a CRT and that the user has set up some appropriate modes
* or something.
@@ -4584,17 +4606,31 @@ I830CheckDevicesTimer(OsTimerPtr timer,
int cloned = 0;
#if 0
Bool found_crt;
- int start, finish;
+ int start, finish, i;
if (!pScrn->vtSema)
return 1000;
start = GetTimeInMillis();
- found_crt = i830DetectCRT(pScrn, FALSE);
+ found_crt = i830DetectCRT(pScrn, FALSE);
finish = GetTimeInMillis();
-
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Detected CRT as %s in %dms\n",
found_crt ? "connected" : "disconnected", finish - start);
+
+ for (i = 0; i < MAX_OUTPUTS; i++) {
+ Bool found_sdvo = TRUE;
+
+ if (pI830->output[i].type != I830_OUTPUT_SDVO ||
+ pI830->output[i].sdvo_drv == NULL)
+ {
+ continue;
+ }
+ start = GetTimeInMillis();
+ found_sdvo = I830DetectSDVODisplays(pScrn, i);
+ finish = GetTimeInMillis();
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Detected SDVO as %s in %dms\n",
+ found_sdvo ? "connected" : "disconnected", finish - start);
+ }
#endif
if (pScrn->vtSema) {
diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index c14277e..06840ef 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -947,3 +947,29 @@ I830DumpSDVO (ScrnInfoPtr pScrn)
I830DumpOneSDVO (s);
}
}
+
+/**
+ * Asks the SDVO device if any displays are currently connected.
+ *
+ * This interface will need to be augmented, since we could potentially have
+ * multiple displays connected, and the caller will also probably want to know
+ * what type of display is connected. But this is enough for the moment.
+ *
+ * Takes 14ms on average on my i945G.
+ */
+Bool
+I830DetectSDVODisplays(ScrnInfoPtr pScrn, int output_index)
+{
+ I830Ptr pI830 = I830PTR(pScrn);
+ I830SDVOPtr s = pI830->output[output_index].sdvo_drv;
+
+ s->sdvo_regs[SDVO_I2C_OPCODE] = SDVO_CMD_GET_ATTACHED_DISPLAYS;
+ I830SDVOWriteOutputs(s, 0);
+ I830SDVOReadInputRegs(s);
+
+ if (s->sdvo_regs[SDVO_I2C_CMD_STATUS] != SDVO_CMD_STATUS_SUCCESS)
+ return FALSE;
+
+ return (s->sdvo_regs[SDVO_I2C_RETURN_0] != 0 ||
+ s->sdvo_regs[SDVO_I2C_RETURN_1] != 0);
+}
diff --git a/src/i830_sdvo.h b/src/i830_sdvo.h
index 6b77c97..d52eb60 100644
--- a/src/i830_sdvo.h
+++ b/src/i830_sdvo.h
@@ -63,3 +63,6 @@ i830SDVOPreRestore(ScrnInfoPtr pScrn, in
void
i830SDVOPostRestore(ScrnInfoPtr pScrn, int output_index);
+
+Bool
+I830DetectSDVODisplays(ScrnInfoPtr pScrn, int output_index);
More information about the xorg-commit
mailing list