[Pixman] [PATCH/RFC 1/2] New FAST_PATH_SIMPLE_ROTATE_TRANSFORM flag

Siarhei Siamashka siarhei.siamashka at gmail.com
Tue Oct 26 16:24:47 PDT 2010


On Thursday 26 August 2010 15:44:38 Siarhei Siamashka wrote:
> Another question is how to manage the flags bits space more efficiently.
> For example, allocating its own bit for 90, 180 and 270 degrees rotation
> could be also possible. Or alternatively combining 90/270 in one flag and
> having 180 degrees handled separately (or even dropping it altogether, it
> is not so important). Which one do you think would be the best?

It would be really nice to finally make some decision and be done with the
basic rotation stuff for pixman 0.21.2

Is the following patch acceptable?

These new flags currently assume simple 90/180/270 degrees rotation without
scaling. But if 90/180/270 degrees rotation with scaling is going to be needed
too (which I assume would be usable for something like image viewer
application), just adding something like FAST_PATH_SCALE_1X flag is possible
which would be set when there is either no transform at all, or 90/180/270
rotation with scale factor 1 is set. In this case a simple nonscaled 90/180/270
degrees rotation would require this new flag too.

And additional somewhat related observation. Simple translate transforms are
currently taking nearest scaling fast paths, which is definitely a lot better
than general path. But we surely can do better. Combination of flags
    FAST_PATH_SCALE_1X |
    FAST_PATH_X_UNIT_POSITIVE  |
    FAST_PATH_Y_UNIT_ZERO |
    FAST_PATH_MATRIX10_ZERO |
    FAST_PATH_AFFINE_TRANSFORM |
    FAST_PATH_NEAREST_FILTER |
    FAST_PATH_SAMPLES_COVER_CLIP
could be used to select a simple nonscaled and nonrotated optimized translate
transform fast paths. Or alternatively translate transforms could be handled in
a special way by just updating 'src_x'/'src_y' variables. But these flags still
may be useful for fractional translations with bilinear filter .

What I'm trying to say is that optimizations for transformed compositing 
operations in pixman seem to be "converging" and starting to cover more
use cases. And the flags are becoming quite descriptive.


Anyway, unless there are some comments/objections, I'm going to commit this
patch with initial rotation flags support a few days after pixman 0.20.0 
release.


- Siarhei


From 007b51292c0dec7a5c7362f0af3c08abd8d88347 Mon Sep 17 00:00:00 2001
From: Siarhei Siamashka <siarhei.siamashka at nokia.com>
Date: Thu, 29 Jul 2010 14:58:13 +0000
Subject: New flags for 90/180/270 rotation

These flags are set when the transform is a simple nonscaled 90/180/270
degrees rotation.
---
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index fabcd63..fd635f1 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -315,8 +315,28 @@ compute_image_info (pixman_image_t *image)
 	    if (image->common.transform->matrix[0][1] == 0 &&
 		image->common.transform->matrix[1][0] == 0)
 	    {
+		if (image->common.transform->matrix[0][0] == -pixman_fixed_1 &&
+		    image->common.transform->matrix[1][1] == -pixman_fixed_1)
+		{
+		    flags |= FAST_PATH_ROTATE_180_TRANSFORM;
+		}
 		flags |= FAST_PATH_SCALE_TRANSFORM;
 	    }
+	    else if (image->common.transform->matrix[0][0] == 0 &&
+	             image->common.transform->matrix[1][1] == 0)
+	    {
+		if (image->common.transform->matrix[0][1] == -pixman_fixed_1 &&
+		    image->common.transform->matrix[1][0] == pixman_fixed_1)
+		{
+		    flags |= FAST_PATH_ROTATE_90_TRANSFORM;
+		}
+		else
+		if (image->common.transform->matrix[0][1] ==  pixman_fixed_1 &&
+		    image->common.transform->matrix[1][0] == -pixman_fixed_1)
+		{
+		    flags |= FAST_PATH_ROTATE_270_TRANSFORM;
+		}
+	    }
 	}
 
 	if (image->common.transform->matrix[0][0] > 0)
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index c43172b..c1a716d 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -569,6 +569,9 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_Y_UNIT_ZERO			(1 << 19)
 #define FAST_PATH_BILINEAR_FILTER		(1 << 20)
 #define FAST_PATH_NO_NORMAL_REPEAT		(1 << 21)
+#define FAST_PATH_ROTATE_90_TRANSFORM		(1 << 22)
+#define FAST_PATH_ROTATE_180_TRANSFORM		(1 << 23)
+#define FAST_PATH_ROTATE_270_TRANSFORM		(1 << 24)
 
 #define FAST_PATH_PAD_REPEAT						\
     (FAST_PATH_NO_NONE_REPEAT		|				\
--
cgit v0.8.3-6-g21f6


More information about the Pixman mailing list