[patch] Check if gamma_set is non-NULL

Julien Cristau jcristau at debian.org
Tue Jan 19 04:34:58 PST 2010


Ping, anyone?

On Wed, Jan  6, 2010 at 14:53:38 +0100, Michael Vogt wrote:

> Hi,
> 
> 
> I ran accross a crash with xf86-video-nv-2.1.15 [1] and xserver
> 1.7.3.901. It looks like the problem is that gamma_set is called even
> if that is NULL. Attached is a trivial check (patch is against git
> head). I'm not sure if its the right fix, it might be that gamma_set
> is mandatory now, but even then a more graceful fail would be nice.
> 
> xf86-video-nv-2.1.16 has a sub gamma_set that also prevents the crash
> but it causes color problems (as mentioned in the annoucement for
> 2.1.16) because the old style colormap code is no longer called when
> gamma_set is present. For me nv-2.1.15 and the attached patch make my
> X work fine again.
> 
> 
> Cheers,
>  Michael
> 
> [1] https://launchpad.net/bugs/494627

> From 8ca4233017e9f441303088e7054b6a7c4f171d80 Mon Sep 17 00:00:00 2001
> From: Michael Vogt <mvo at ubuntu.com>
> Date: Wed, 6 Jan 2010 14:40:34 +0100
> Subject: [PATCH] * hw/xfree86/modes/xf86Crtc.c:
>    - only call gamma_set if its non NULL
> 
> ---
>  hw/xfree86/modes/xf86Crtc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
> index d015c6a..573fe96 100644
> --- a/hw/xfree86/modes/xf86Crtc.c
> +++ b/hw/xfree86/modes/xf86Crtc.c
> @@ -354,7 +354,7 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati
>      }
>  
>      /* Only upload when needed, to avoid unneeded delays. */
> -    if (!crtc->active)
> +    if (!crtc->active && crtc->funcs->gamma_set)
>  	crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
>                                              crtc->gamma_blue, crtc->gamma_size);
>  
> -- 
> 1.6.5
> 


More information about the xorg-devel mailing list