pixman: Branch 'master' - 6 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Thu May 19 06:50:30 PDT 2011


 pixman/Makefile.am             |    1 
 pixman/pixman-bits-image.c     |   31 +-------
 pixman/pixman-cpu.c            |    2 
 pixman/pixman-implementation.c |   20 -----
 pixman/pixman-noop.c           |  148 +++++++++++++++++++++++++++++++++++++++++
 pixman/pixman-private.h        |    3 
 pixman/pixman.c                |    2 
 7 files changed, 160 insertions(+), 47 deletions(-)

New commits:
commit dd449a2a8ee1381fdc5297257917bc0786bf0ac4
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Sat Apr 23 10:26:49 2011 -0400

    Move NOP src iterator into noop implementation.
    
    The iterator for sources where neither RGB nor ALPHA is needed, really
    belongs in the noop implementation.

diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index 2706ceb..81c740b 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -260,15 +260,7 @@ _pixman_implementation_src_iter_init (pixman_implementation_t	*imp,
     iter->height = height;
     iter->flags = flags;
 
-    if ((flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
-	     (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB))
-    {
-	iter->get_scanline = _pixman_iter_get_scanline_noop;
-    }
-    else
-    {
-	(*imp->src_iter_init) (imp, iter);
-    }
+    (*imp->src_iter_init) (imp, iter);
 }
 
 void
diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index fc41d7a..cc8dbc9 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -82,6 +82,11 @@ noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
     {
 	iter->get_scanline = get_scanline_null;
     }
+    else if ((iter->flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
+	     (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB))
+    {
+	iter->get_scanline = _pixman_iter_get_scanline_noop;
+    }
     else if ((iter->flags & ITER_NARROW)				&&
 	     (image->common.flags & FLAGS) == FLAGS			&&
 	     iter->x >= 0 && iter->y >= 0				&&
commit ba480882aa465d8414dc8a4472d89d94911af60a
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Sat Apr 23 10:24:41 2011 -0400

    Move NULL iterator into pixman-noop.c
    
    Iterating a NULL image returns NULL for all scanlines. We may as well
    do this in the noop iterator.

diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index f1d3f99..2706ceb 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -241,12 +241,6 @@ _pixman_implementation_fill (pixman_implementation_t *imp,
     return (*imp->fill) (imp, bits, stride, bpp, x, y, width, height, xor);
 }
 
-static uint32_t *
-get_scanline_null (pixman_iter_t *iter, const uint32_t *mask)
-{
-    return NULL;
-}
-
 void
 _pixman_implementation_src_iter_init (pixman_implementation_t	*imp,
 				      pixman_iter_t             *iter,
@@ -266,11 +260,7 @@ _pixman_implementation_src_iter_init (pixman_implementation_t	*imp,
     iter->height = height;
     iter->flags = flags;
 
-    if (!image)
-    {
-	iter->get_scanline = get_scanline_null;
-    }
-    else if ((flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
+    if ((flags & (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB)) ==
 	     (ITER_IGNORE_ALPHA | ITER_IGNORE_RGB))
     {
 	iter->get_scanline = _pixman_iter_get_scanline_noop;
diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index aaffbde..fc41d7a 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -64,22 +64,30 @@ noop_get_scanline (pixman_iter_t *iter, const uint32_t *mask)
     return result;
 }
 
+static uint32_t *
+get_scanline_null (pixman_iter_t *iter, const uint32_t *mask)
+{
+    return NULL;
+}
+
 static void
 noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
 {
     pixman_image_t *image = iter->image;
-    uint32_t iter_flags = iter->flags;
-    uint32_t image_flags = image->common.flags;
 
 #define FLAGS						\
     (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM)
 
-    if ((iter_flags & ITER_NARROW)					&&
-	(image_flags & FLAGS) == FLAGS					&&
-	iter->x >= 0 && iter->y >= 0					&&
-	iter->x + iter->width <= image->bits.width			&&
-	iter->y + iter->height <= image->bits.height			&&
-	image->common.extended_format_code == PIXMAN_a8r8g8b8)
+    if (!image)
+    {
+	iter->get_scanline = get_scanline_null;
+    }
+    else if ((iter->flags & ITER_NARROW)				&&
+	     (image->common.flags & FLAGS) == FLAGS			&&
+	     iter->x >= 0 && iter->y >= 0				&&
+	     iter->x + iter->width <= image->bits.width			&&
+	     iter->y + iter->height <= image->bits.height		&&
+	     image->common.extended_format_code == PIXMAN_a8r8g8b8)
     {
 	iter->buffer =
 	    image->bits.bits + iter->y * image->bits.rowstride + iter->x;
commit a4e984de19f7f2ca30b1d736cdd2dded91a75907
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Tue Feb 8 23:42:36 2011 -0500

    Add a noop src iterator
    
    When the image is a8r8g8b8 and not transformed, and the fetched
    rectangle is within the image bounds, scanlines can be fetched by
    simply returning a pointer instead of copying the bits.

diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index e54272b..aaffbde 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -54,6 +54,44 @@ dest_write_back_direct (pixman_iter_t *iter)
     iter->buffer += iter->image->bits.rowstride;
 }
 
+static uint32_t *
+noop_get_scanline (pixman_iter_t *iter, const uint32_t *mask)
+{
+    uint32_t *result = iter->buffer;
+
+    iter->buffer += iter->image->bits.rowstride;
+
+    return result;
+}
+
+static void
+noop_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
+{
+    pixman_image_t *image = iter->image;
+    uint32_t iter_flags = iter->flags;
+    uint32_t image_flags = image->common.flags;
+
+#define FLAGS						\
+    (FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM)
+
+    if ((iter_flags & ITER_NARROW)					&&
+	(image_flags & FLAGS) == FLAGS					&&
+	iter->x >= 0 && iter->y >= 0					&&
+	iter->x + iter->width <= image->bits.width			&&
+	iter->y + iter->height <= image->bits.height			&&
+	image->common.extended_format_code == PIXMAN_a8r8g8b8)
+    {
+	iter->buffer =
+	    image->bits.bits + iter->y * image->bits.rowstride + iter->x;
+
+	iter->get_scanline = noop_get_scanline;
+    }
+    else
+    {
+	(* imp->delegate->src_iter_init) (imp->delegate, iter);
+    }
+}
+
 static void
 noop_dest_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
 {
@@ -90,6 +128,7 @@ _pixman_implementation_create_noop (pixman_implementation_t *fallback)
     pixman_implementation_t *imp =
 	_pixman_implementation_create (fallback, noop_fast_paths);
 
+    imp->src_iter_init = noop_src_iter_init;
     imp->dest_iter_init = noop_dest_iter_init;
 
     return imp;
commit d4fff4a95921f734f26ef51953f4dddfcf423eab
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Mon Jan 24 12:16:03 2011 -0500

    Move noop dest fetching to noop implementation
    
    It will at some point become useful to have CPU specific destination
    iterators. However, a problem with that, is that such iterators should
    not be used if we can composite directly in the destination image.
    
    By moving the noop destination iterator to the noop implementation, we
    can ensure that it will be chosen before any CPU specific iterator.

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index 835ecfb..4e9ed14 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -1462,43 +1462,22 @@ dest_write_back_wide (pixman_iter_t *iter)
     iter->y++;
 }
 
-static void
-dest_write_back_direct (pixman_iter_t *iter)
-{
-    iter->buffer += iter->image->bits.rowstride;
-}
-
 void
 _pixman_bits_image_dest_iter_init (pixman_image_t *image, pixman_iter_t *iter)
 {
     if (iter->flags & ITER_NARROW)
     {
-	if (((image->common.flags &
-	      (FAST_PATH_NO_ALPHA_MAP | FAST_PATH_NO_ACCESSORS)) ==
-	     (FAST_PATH_NO_ALPHA_MAP | FAST_PATH_NO_ACCESSORS)) &&
-	    (image->bits.format == PIXMAN_a8r8g8b8	||
-	     (image->bits.format == PIXMAN_x8r8g8b8	&&
-	      (iter->flags & ITER_LOCALIZED_ALPHA))))
+	if ((iter->flags & (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA)) ==
+	    (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA))
 	{
-	    iter->buffer = image->bits.bits + iter->y * image->bits.rowstride + iter->x;
-
 	    iter->get_scanline = _pixman_iter_get_scanline_noop;
-	    iter->write_back = dest_write_back_direct;
 	}
 	else
 	{
-	    if ((iter->flags & (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA)) ==
-		(ITER_IGNORE_RGB | ITER_IGNORE_ALPHA))
-	    {
-		iter->get_scanline = _pixman_iter_get_scanline_noop;
-	    }
-	    else
-	    {
-		iter->get_scanline = dest_get_scanline_narrow;
-	    }
-
-	    iter->write_back = dest_write_back_narrow;
+	    iter->get_scanline = dest_get_scanline_narrow;
 	}
+	
+	iter->write_back = dest_write_back_narrow;
     }
     else
     {
diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index 673a02a..e54272b 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -48,6 +48,36 @@ noop_composite (pixman_implementation_t *imp,
     return;
 }
 
+static void
+dest_write_back_direct (pixman_iter_t *iter)
+{
+    iter->buffer += iter->image->bits.rowstride;
+}
+
+static void
+noop_dest_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter)
+{
+    pixman_image_t *image = iter->image;
+    uint32_t image_flags = image->common.flags;
+    uint32_t iter_flags = iter->flags;
+
+    if ((image_flags & FAST_PATH_STD_DEST_FLAGS) == FAST_PATH_STD_DEST_FLAGS	&&
+	(iter_flags & ITER_NARROW) == ITER_NARROW				&&
+	((image->common.extended_format_code == PIXMAN_a8r8g8b8)	||
+	 (image->common.extended_format_code == PIXMAN_x8r8g8b8 &&
+	  (iter_flags & (ITER_LOCALIZED_ALPHA)))))
+    {
+	iter->buffer = image->bits.bits + iter->y * image->bits.rowstride + iter->x;
+
+	iter->get_scanline = _pixman_iter_get_scanline_noop;
+	iter->write_back = dest_write_back_direct;
+    }
+    else
+    {
+	(* imp->delegate->dest_iter_init) (imp->delegate, iter);
+    }
+}
+
 static const pixman_fast_path_t noop_fast_paths[] =
 {
     { PIXMAN_OP_DST, PIXMAN_any, 0, PIXMAN_any, 0, PIXMAN_any, 0, noop_composite },
@@ -60,5 +90,7 @@ _pixman_implementation_create_noop (pixman_implementation_t *fallback)
     pixman_implementation_t *imp =
 	_pixman_implementation_create (fallback, noop_fast_paths);
 
+    imp->dest_iter_init = noop_dest_iter_init;
+
     return imp;
 }
commit 13ce88f80095d0fa18330a23e03819368987e277
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Mon Jan 24 11:35:27 2011 -0500

    Add a noop composite function for the DST operator
    
    The DST operator doesn't actually do anything, so add a noop "fast
    path" for it, instead of checking in pixman_image_composite32().
    
    The performance tradeoff here is that we get rid of a test for DST in
    the common case where the operator is not DST, in return for an extra
    walk over the clip rectangles in the uncommon case where the operator
    actually is DST.

diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
index 50bbfb0..673a02a 100644
--- a/pixman/pixman-noop.c
+++ b/pixman/pixman-noop.c
@@ -30,8 +30,27 @@
 #include "pixman-combine32.h"
 #include "pixman-fast-path.h"
 
+static void
+noop_composite (pixman_implementation_t *imp,
+		pixman_op_t              op,
+		pixman_image_t *         src,
+		pixman_image_t *         mask,
+		pixman_image_t *         dest,
+		int32_t                  src_x,
+		int32_t                  src_y,
+		int32_t                  mask_x,
+		int32_t                  mask_y,
+		int32_t                  dest_x,
+		int32_t                  dest_y,
+		int32_t                  width,
+		int32_t                  height)
+{
+    return;
+}
+
 static const pixman_fast_path_t noop_fast_paths[] =
 {
+    { PIXMAN_OP_DST, PIXMAN_any, 0, PIXMAN_any, 0, PIXMAN_any, 0, noop_composite },
     { PIXMAN_OP_NONE },
 };
 
diff --git a/pixman/pixman.c b/pixman/pixman.c
index f21af2f..61d3a92 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -761,8 +761,6 @@ pixman_image_composite32 (pixman_op_t      op,
      * mathematically equivalent to the source.
      */
     op = optimize_operator (op, src_flags, mask_flags, dest_flags);
-    if (op == PIXMAN_OP_DST)
-	goto out;
 
     if (lookup_composite_function (op,
 				   src_format, src_flags,
commit 8c76235f41b2ac70ce6e652dcd1cab975e1283a4
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Mon Jan 24 11:31:49 2011 -0500

    Add a "noop" implementation.
    
    This new implementation is ahead of all other implementations in the
    fallback chain and is supposed to contain operations that are "noops",
    ie., they don't require any work. For example, it might contain a
    "fast path" for the DST operator that doesn't actually do anything or
    an iterator for a8r8g8b8 that just returns a pointer into the image.

diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index be08266..1e20bb0 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -20,6 +20,7 @@ libpixman_1_la_SOURCES =			\
 	pixman-combine64.h			\
 	pixman-general.c			\
 	pixman.c				\
+	pixman-noop.c				\
 	pixman-fast-path.c			\
 	pixman-fast-path.h			\
 	pixman-solid-fill.c			\
diff --git a/pixman/pixman-cpu.c b/pixman/pixman-cpu.c
index 0e14ecb..973ed54 100644
--- a/pixman/pixman-cpu.c
+++ b/pixman/pixman-cpu.c
@@ -606,6 +606,8 @@ _pixman_choose_implementation (void)
 	imp = _pixman_implementation_create_vmx (imp);
 #endif
 
+    imp = _pixman_implementation_create_noop (imp);
+    
     return imp;
 }
 
diff --git a/pixman/pixman-noop.c b/pixman/pixman-noop.c
new file mode 100644
index 0000000..50bbfb0
--- /dev/null
+++ b/pixman/pixman-noop.c
@@ -0,0 +1,45 @@
+/* -*- Mode: c; c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t; -*- */
+/*
+ * Copyright © 2011 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <string.h>
+#include <stdlib.h>
+#include "pixman-private.h"
+#include "pixman-combine32.h"
+#include "pixman-fast-path.h"
+
+static const pixman_fast_path_t noop_fast_paths[] =
+{
+    { PIXMAN_OP_NONE },
+};
+
+pixman_implementation_t *
+_pixman_implementation_create_noop (pixman_implementation_t *fallback)
+{
+    pixman_implementation_t *imp =
+	_pixman_implementation_create (fallback, noop_fast_paths);
+
+    return imp;
+}
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 60060a9..2996907 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -523,6 +523,9 @@ _pixman_implementation_create_general (void);
 pixman_implementation_t *
 _pixman_implementation_create_fast_path (pixman_implementation_t *fallback);
 
+pixman_implementation_t *
+_pixman_implementation_create_noop (pixman_implementation_t *fallback);
+
 #ifdef USE_MMX
 pixman_implementation_t *
 _pixman_implementation_create_mmx (pixman_implementation_t *fallback);


More information about the xorg-commit mailing list