Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From 28c006c94e57ea71df11ec4fff79d7ffcfc4860f Mon Sep 17 00:00:00 2001 |
| 2 | From: Far McKon <FarMcKon@buglabs.net> |
| 3 | Date: Tue, 3 May 2011 20:59:04 +0300 |
| 4 | Subject: [PATCH] Prevents omapfb from from crashing when pixelclock of 0 is |
| 5 | sent to it. |
| 6 | |
| 7 | Due to a Linux design bug it is easy to get a pixelclock set to zero |
| 8 | when changing displays at runtime. |
| 9 | --- |
| 10 | src/omapfb-output.c | 9 +++++++-- |
| 11 | 1 file changed, 7 insertions(+), 2 deletions(-) |
| 12 | |
| 13 | diff --git a/src/omapfb-output.c b/src/omapfb-output.c |
| 14 | index f8b4db3..4d59265 100644 |
| 15 | --- a/src/omapfb-output.c |
| 16 | +++ b/src/omapfb-output.c |
| 17 | @@ -125,8 +125,13 @@ OMAPFBOutputGetModes(xf86OutputPtr output) |
| 18 | /* Only populate the native (current) mode */ |
| 19 | mode = calloc(1, sizeof(DisplayModeRec)); |
| 20 | mode->type |= M_T_PREFERRED; |
| 21 | - mode->Clock = PICOS2KHZ(ofb->state_info.pixclock); |
| 22 | - mode->SynthClock = PICOS2KHZ(ofb->state_info.pixclock); |
| 23 | + if (ofb->state_info.pixclock == 0) { |
| 24 | + mode->Clock = 0; |
| 25 | + mode->SynthClock = 0; |
| 26 | + } else { |
| 27 | + mode->Clock = PICOS2KHZ(ofb->state_info.pixclock); |
| 28 | + mode->SynthClock = PICOS2KHZ(ofb->state_info.pixclock); |
| 29 | + } |
| 30 | mode->HDisplay = ofb->state_info.xres; |
| 31 | mode->HSyncStart = mode->HDisplay |
| 32 | + ofb->state_info.right_margin; |
| 33 | -- |
| 34 | 2.1.4 |
| 35 | |