[PATCH 1/2] DRI2: Avoid call to NULL pointer

Jesse Barnes jbarnes at virtuousgeek.org
Mon Oct 25 09:50:18 PDT 2010


On Mon, 25 Oct 2010 17:13:57 +0300
Pauli Nieminen <ext-pauli.nieminen at nokia.com> wrote:

> DDX driver may implement schedule swap without GetMSC. In that case we
> can't call GetMSC in DRI2SwapBuffers.
> 
> Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> Reviewed-by: Mario Kleiner <mario.kleiner at tuebingen.mpg.de>
> CC: Keith Packard <keithp at keithp.com>
> CC: Kristian Høgsberg <krh at bitplanet.net>
> ---
>  hw/xfree86/dri2/dri2.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> index 228c0e0..d9b9d57 100644
> --- a/hw/xfree86/dri2/dri2.c
> +++ b/hw/xfree86/dri2/dri2.c
> @@ -856,11 +856,14 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
>  	 * is moved to a crtc with a lower refresh rate, or a crtc that just
>  	 * got enabled.
>  	 */
> -	if (!(*ds->GetMSC)(pDraw, &ust, &current_msc))
> -	    pPriv->last_swap_target = 0;
> +	if (ds->GetMSC) {
> +	    if (!(*ds->GetMSC)(pDraw, &ust, &current_msc))
> +		pPriv->last_swap_target = 0;
>  
> -	if (current_msc < pPriv->last_swap_target)
> -	    pPriv->last_swap_target = current_msc;
> +	    if (current_msc < pPriv->last_swap_target)
> +		pPriv->last_swap_target = current_msc;
> +
> +	}
>  
>  	/*
>  	 * Swap target for this swap is last swap target + swap interval since

Yeah, that's fine.

Reviewed-by: Jesse Barnes <jbarnes at virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center


More information about the xorg-devel mailing list