[V2] Stop setting tv format property if crtc is NULL
diff mbox

Message ID 1248833924-9854-1-git-send-email-ling.ma@intel.com
State Not Applicable
Headers show

Commit Message

ling.ma@intel.com July 29, 2009, 2:18 a.m. UTC
When TV is not connected and X start, after plugging TV cable again,
user must assign output crtc by xrandr command before set TV format
property. This patch will return FALSE to avoid system crash if
output crtc is NULL.


Signed-off-by: Ma Ling <ling.ma@intel.com>
---
 src/i830_tv.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Comments

Keith Packard July 29, 2009, 2:24 a.m. UTC | #1
On Wed, 2009-07-29 at 10:18 +0800, ling.ma@intel.com wrote:
> When TV is not connected and X start, after plugging TV cable again,
> user must assign output crtc by xrandr command before set TV format
> property. This patch will return FALSE to avoid system crash if
> output crtc is NULL.

Output properties aren't dependent on a CRTC; they should be able to be
set even if the output is not active. They will take effect the next
time the output is connected to a crtc.
ling.ma@intel.com July 29, 2009, 5:01 a.m. UTC | #2
>-----Original Message-----
>From: intel-gfx-bounces@lists.freedesktop.org
>[mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf Of Keith Packard
>Sent: 2009年7月29日 10:25
>To: Ma, Ling
>Cc: intel-gfx@lists.freedesktop.org
>Subject: Re: [Intel-gfx] [PATCH V2] Stop setting tv format property if crtc is
>NULL
>
>On Wed, 2009-07-29 at 10:18 +0800, ling.ma@intel.com wrote:
>> When TV is not connected and X start, after plugging TV cable again,
>> user must assign output crtc by xrandr command before set TV format
>> property. This patch will return FALSE to avoid system crash if
>> output crtc is NULL.
>
>Output properties aren't dependent on a CRTC; they should be able to be
>set even if the output is not active. They will take effect the next
>time the output is connected to a crtc.
Thanks for your review, send latest one.
>
>
>--
>keith.packard@intel.com

Patch
diff mbox

diff --git a/src/i830_tv.c b/src/i830_tv.c
index 7082aba..6110b45 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -1821,6 +1821,12 @@  i830_tv_set_property(xf86OutputPtr output, Atom property,
 
 	if (pI830->starting)
 	    return TRUE;
+	if (output->crtc == NULL) {
+	    xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+			"Set TV Format Property error,"
+			"CRTC is not available\n");
+	    return FALSE;
+	}
 
 	/* TV format change will generate new modelines, try
 	   to probe them and update outputs. */