summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-10-08 15:23:13 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-10-08 15:23:13 +0100
commit5472359d6860af655a3c286d30558540376c9fdb (patch)
treed288b7f59d05da9a253384e06e74a140db577c95
parent4083197a44d1a1a05d33654b3c7d6e96d7472fe7 (diff)
dri: Check for pixmap privates before dereferencing them
It is still possible for the pixmap allocator to return a software only pixmap (i.e. without an associated GEM buffer or intel_pixmap), so check before dereferencing. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30707 Reported-by: Matthias Hopf <mhopf@suse.de> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/intel_dri.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/intel_dri.c b/src/intel_dri.c
index 7fd86554..97f9c4a6 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -510,12 +510,16 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
struct intel_pixmap *src_pixmap, *dst_pixmap;
src_pixmap = intel_get_pixmap_private(get_drawable_pixmap(src));
- src_pixmap->offscreen = 1;
- src_pixmap->busy = 1;
+ if (src_pixmap) {
+ src_pixmap->offscreen = 1;
+ src_pixmap->busy = 1;
+ }
dst_pixmap = intel_get_pixmap_private(get_drawable_pixmap(dst));
- dst_pixmap->offscreen = 1;
- dst_pixmap->busy = 1;
+ if (dst_pixmap) {
+ dst_pixmap->offscreen = 1;
+ dst_pixmap->busy = 1;
+ }
gc->ops->CopyArea(src, dst, gc,
0, 0,
@@ -523,8 +527,10 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
0, 0);
/* and restore 2D/3D coherency */
- src_pixmap->offscreen = 0;
- dst_pixmap->offscreen = 0;
+ if (src_pixmap)
+ src_pixmap->offscreen = 0;
+ if (dst_pixmap)
+ dst_pixmap->offscreen = 0;
} else {
gc->ops->CopyArea(src, dst, gc,
0, 0,