From f0ae8cbbb8b88c04b256a6895c21a056dddbbbb1 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Mon, 10 Sep 2012 11:14:20 +1000
Subject: [PATCH] xf86: return NULL for compat output if no outputs.
With outputless GPUs showing up we crash here if there are not outputs
try and recover with a bit of grace.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
hw/xfree86/modes/xf86Crtc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 803de88..7419400 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1764,6 +1764,9 @@ SetCompatOutput(xf86CrtcConfigPtr config)
DisplayModePtr maxmode = NULL, testmode, mode;
int o, compat = -1, count, mincount = 0;
+ if (config->num_output == 0)
+ return NULL;
+
/* Look for one that's definitely connected */
for (o = 0; o < config->num_output; o++) {
test = config->output[o];
--
1.7.10.2