From d1925deedd70c6c4374e42de5aa44989fe328b58 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 6 Oct 2010 00:17:03 +0100 Subject: [PATCH] Clear pixmap->devPrivate.ptr [regression from 7c7294e] ModifyPixmapHeader(pixdata = NULL) does not clear the pixmap->devPrivate.ptr, instead the NULL value is interpreted as meaning to keep the current value. (This is similar to the interpretation of the other invalid values like depth=-1 which also mean not to change the current property). However pixadata=NULL is indeed a valid value, and in 7c7294e, devPrivate.ptr == NULL was used to differentiate a bo pixmap from a system pixmap. Except that we never did clear the ptr as intended, and so X would immediately crash. Signed-off-by: Chris Wilson --- src/intel_dri.c | 1 + src/intel_uxa.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/intel_dri.c b/src/intel_dri.c index 1527dba1..7d109e9d 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -91,6 +91,7 @@ static PixmapPtr get_front_buffer(DrawablePtr drawable, DrawablePtr *ret) 0, 0, intel->front_pitch, NULL); + pixmap->devPrivate.ptr = NULL; intel_set_pixmap_bo(pixmap, intel->front_buffer); } } else if (intel_get_pixmap_bo(pixmap)) { diff --git a/src/intel_uxa.c b/src/intel_uxa.c index d964a951..34649b85 100644 --- a/src/intel_uxa.c +++ b/src/intel_uxa.c @@ -796,6 +796,7 @@ static Bool intel_uxa_put_image(PixmapPtr pixmap, w, h, 0, 0, stride, NULL); + pixmap->devPrivate.ptr = NULL; intel_set_pixmap_bo(pixmap, bo); dri_bo_unreference(bo); @@ -1039,6 +1040,7 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth, list_del(&priv->in_flight); screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL); + pixmap->devPrivate.ptr = NULL; intel_set_pixmap_private(pixmap, priv); return pixmap; } @@ -1072,6 +1074,7 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth, priv->tiling = tiling; screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL); + pixmap->devPrivate.ptr = NULL; list_init(&priv->batch); list_init(&priv->flush); @@ -1108,6 +1111,7 @@ void intel_uxa_create_screen_resources(ScreenPtr screen) -1, -1, intel->front_pitch, NULL); + pixmap->devPrivate.ptr = NULL; } scrn->displayWidth = intel->front_pitch / intel->cpp; }