[PATCH] Fix alphamap interactions with wfb

Arcady Goldmints-Orlov arcadyg at nvidia.com
Mon Jul 2 17:07:40 PDT 2012


Set a destructor function on pixman images and call fbFinishAccess()
from there, rather than directly from free_pixman_pict(). This ensures
that fbFinishAccess() gets called even if pixman still has a reference
to the image after free_pixman_pict(), as is the case for alphamaps.

Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
Signed-off-by: Arcady Goldmints-Orlov <arcadyg at nvidia.com>
---
 fb/fbpict.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/fb/fbpict.c b/fb/fbpict.c
index 097a1a6..672b46f 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -207,6 +207,12 @@ static pixman_image_t *image_from_pict_internal(PicturePtr pict, Bool has_clip,
                                                 int *xoff, int *yoff,
                                                 Bool is_alpha_map);
 
+static void image_destroy(pixman_image_t *image, void *data)
+{
+    DrawablePtr pDrawable = data;
+    fbFinishAccess(pDrawable);
+}
+
 static void
 set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
                      int *xoff, int *yoff, Bool is_alpha_map)
@@ -291,6 +297,10 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
         break;
     }
 
+    if (pict->pDrawable)
+        pixman_image_set_destroy_function(image, &image_destroy,
+                                          pict->pDrawable);
+
     pixman_image_set_filter(image, filter,
                             (pixman_fixed_t *) pict->filter_params,
                             pict->filter_nparams);
@@ -343,8 +353,8 @@ image_from_pict(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
 void
 free_pixman_pict(PicturePtr pict, pixman_image_t * image)
 {
-    if (image && pixman_image_unref(image) && pict->pDrawable)
-        fbFinishAccess(pict->pDrawable);
+    if (image)
+        pixman_image_unref(image);
 }
 
 Bool
-- 
1.7.2.3
nvpublic



More information about the xorg-devel mailing list