summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPauli Nieminen <ext-pauli.nieminen@nokia.com>2010-10-25 17:13:57 +0300
committerAdam Jackson <ajax@redhat.com>2010-11-23 13:08:13 -0500
commit32004e8d6e3fcbb98ccacd89662099d190c71f51 (patch)
tree29498bdb6213063bade77faad5cb1dc634af2f2f
parent9770500983308c85b84279be3a5ff36e120e7caa (diff)
DRI2: Avoid call to NULL pointer
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@nokia.com> Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de> CC: Keith Packard <keithp@keithp.com> CC: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Keith Packard <keithp@keithp.com> (cherry picked from commit 383dfe23f1641435c0713f8a56424814a156af8e)
-rw-r--r--hw/xfree86/dri2/dri2.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 34f735f52..e4693d92e 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -828,11 +828,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