From 723cc45b2707aa160eac6d5b56a20e19cc42c8a3 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 17 May 2010 15:14:55 +0100 Subject: [PATCH] dri: Check error code from GetScratchGC() It may fail so be prepared, and do use the right drawable! Signed-off-by: Chris Wilson --- src/i830_dri.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/i830_dri.c b/src/i830_dri.c index 7ba91661..15aafdd7 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -302,7 +302,10 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion, RegionPtr pCopyClip; GCPtr gc; - gc = GetScratchGC(drawable->depth, screen); + gc = GetScratchGC(dst->depth, screen); + if (!gc) + return; + pCopyClip = REGION_CREATE(screen, NULL, 0); REGION_COPY(screen, pCopyClip, pRegion); (*gc->funcs->ChangeClip) (gc, CT_REGION, pCopyClip, 0); @@ -390,12 +393,12 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion, * * We can't rely on getting into the block handler before the DRI * client gets to run again so flush now. */ + intel_batch_emit_flush(scrn); intel_batch_submit(scrn); #if ALWAYS_SYNC intel_sync(scrn); #endif drmCommandNone(intel->drmSubFD, DRM_I915_GEM_THROTTLE); - } #if DRI2INFOREC_VERSION >= 4