summaryrefslogtreecommitdiff
path: root/src/i830_crt.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2006-11-03 15:26:14 -0800
committerEric Anholt <eric@anholt.net>2006-11-03 15:57:34 -0800
commit561af007974b8cdad1eea907fb73ed9d430c21ac (patch)
tree993487453dcdcae77e013e8cc4ec0eb9b9922836 /src/i830_crt.c
parente416b426d83de031441ada7a77b6bd66cec8b5c9 (diff)
Add support for load-based CRT detection.
Diffstat (limited to 'src/i830_crt.c')
-rw-r--r--src/i830_crt.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/i830_crt.c b/src/i830_crt.c
index 0225727b..4c704b2c 100644
--- a/src/i830_crt.c
+++ b/src/i830_crt.c
@@ -32,6 +32,7 @@
#include "xf86.h"
#include "i830.h"
#include "i830_xf86Modes.h"
+#include "i830_display.h"
static void
i830_crt_dpms(ScrnInfoPtr pScrn, I830OutputPtr output, int mode)
@@ -166,7 +167,7 @@ i830_crt_detect_hotplug(ScrnInfoPtr pScrn)
* \return FALSE if CRT is disconnected.
*/
static Bool
-i830_crt_detect_load(ScrnInfoPtr pScrn)
+i830_crt_detect_load(ScrnInfoPtr pScrn, I830OutputPtr output)
{
I830Ptr pI830 = I830PTR(pScrn);
CARD32 adpa, pipeconf;
@@ -174,7 +175,7 @@ i830_crt_detect_load(ScrnInfoPtr pScrn)
int pipeconf_reg, bclrpat_reg, dpll_reg;
int pipe;
- pipe = pI830->pipe;
+ pipe = output->pipe;
if (pipe == 0) {
bclrpat_reg = BCLRPAT_A;
pipeconf_reg = PIPEACONF;
@@ -263,15 +264,12 @@ i830_crt_detect(ScrnInfoPtr pScrn, I830OutputPtr output)
if (i830_crt_detect_ddc(pScrn))
return OUTPUT_STATUS_CONNECTED;
- /* Use the load-detect method if we're not currently outputting to the CRT,
- * or we don't care.
- *
- * Actually, the method is unreliable currently. We need to not share a
- * pipe, as it seems having other outputs on that pipe will result in a
- * false positive.
- */
- if (0) {
- if (i830_crt_detect_load(pScrn))
+ /* Use the load-detect method if we have no other way of telling. */
+ if (i830GetLoadDetectPipe(pScrn, output) != -1) {
+ Bool connected = i830_crt_detect_load(pScrn, output);
+
+ i830ReleaseLoadDetectPipe(pScrn, output);
+ if (connected)
return OUTPUT_STATUS_CONNECTED;
else
return OUTPUT_STATUS_DISCONNECTED;