[pixman] * Tue Jun 26 2012 Soren Sandmann <ssp at redhat.com> - 0.26.0-2 - Add experimental patch to use OpenMP

Soren Sandmann Pedersen ssp at fedoraproject.org
Tue Jun 26 19:12:01 UTC 2012


commit 0f929bc8fea65470a1bff2f33e256b33ba4bc074
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Tue Jun 26 15:14:16 2012 -0400

    * Tue Jun 26 2012 Soren Sandmann <ssp at redhat.com> - 0.26.0-2
    - Add experimental patch to use OpenMP
      If this causes your X server to misbehave, please file bugs.

 openmp.patch |  189 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 pixman.spec  |    8 ++-
 2 files changed, 196 insertions(+), 1 deletions(-)
---
diff --git a/openmp.patch b/openmp.patch
new file mode 100644
index 0000000..a2b863b
--- /dev/null
+++ b/openmp.patch
@@ -0,0 +1,189 @@
+From nobody Tue Jun 26 20:59:16 2012
+Return-Path: <pixman-bounces+sandmann=cs.au.dk at lists.freedesktop.org>
+Received: from mailglue.nfit.au.dk ([10.19.28.154])
+	 by mbe1i (Cyrus v2.3.16-Invoca-RPM-2.3.16-3) with LMTPA;
+	 Mon, 25 Jun 2012 01:01:13 +0200
+X-Sieve: CMU Sieve 2.3
+Received: from mx.nfit.au.dk (unknown [10.19.8.20])
+	by mailglue.nfit.au.dk (Postfix) with ESMTP id 943DF60CBB
+	for <sandmann at cs.au.dk>; Mon, 25 Jun 2012 01:01:12 +0200 (CEST)
+Received: from SRVUNIHUB02.uni.au.dk (mail-out.au.dk [130.225.30.1])
+	by mx.nfit.au.dk (Postfix) with ESMTP id 56B0B600EF
+	for <sandmann at cs.au.dk>; Mon, 25 Jun 2012 01:01:11 +0200 (CEST)
+Received: from mail.nfit.au.dk (10.88.100.13) by SRVUNIHUB02.uni.au.dk
+ (10.88.2.7) with Microsoft SMTP Server id 14.2.247.3; Mon, 25 Jun 2012
+ 01:01:05 +0200
+Received: from mail.nfit.au.dk (localhost [127.0.0.1])	by mail.nfit.au.dk
+ (Postfix) with ESMTP id 04B01E65B8	for <sandmann at cs.au.dk>; Mon, 25 Jun 2012
+ 01:01:00 +0200 (CEST)
+Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177])
+	by mail.nfit.au.dk (Postfix) with ESMTP id 90B9EE65B4	for
+ <sandmann at cs.au.dk>; Mon, 25 Jun 2012 01:00:59 +0200 (CEST)
+Received: from gabe.freedesktop.org (localhost [127.0.0.1])	by
+ gabe.freedesktop.org (Postfix) with ESMTP id 088419E9BE	for
+ <sandmann at cs.au.dk>; Sun, 24 Jun 2012 16:00:58 -0700 (PDT)
+X-Original-To: pixman at lists.freedesktop.org
+Delivered-To: pixman at lists.freedesktop.org
+Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com
+	[209.85.217.177])	by gabe.freedesktop.org (Postfix) with ESMTP id 85E479E908
+	for <pixman at lists.freedesktop.org>;	Sun, 24 Jun 2012 16:00:40 -0700 (PDT)
+Received: by lbbgg6 with SMTP id gg6so5817844lbb.36	for
+ <pixman at lists.freedesktop.org>;	Sun, 24 Jun 2012 16:00:39 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
+	h=from:to:cc:subject:date:message-id:x-mailer;
+	bh=pmJIV+lOLQLRcPUDoyXv/RHcVEspSKUzBuJ1PWDSEIE=;
+	b=sQdaO0a+36tNvdHiJZ5U2jcY/JRzbq9ohETmzM6GM9xlqLgfth7q5uvjsZClvCMU4x
+	Fg51dQnmC+gqKZ0sqaskd050qeOIaj99sGhz1boXe6yzRMKLioyJqVnHpR3lqbzG+Zco
+	34CDEor++b+od3jgvpE+npoYKfvTm5Q1JjRH455tiZF0L6Oiq3WmiydkIl9MxNhvoGBx
+	6NOcvy6AJEhtUVUZIheAKtG2KR804ys0UmE6sIq/JAyzVyGbtCKwLmwVCAWaCplgfC4q
+	zB9FEA6D7pnixgWawU7DhpDwcMxNdwqWHt0nNeiJnWgPoOs52iZqo0VE6w7sp4yQxYCY
+	HTMA==
+Received: by 10.112.43.67 with SMTP id u3mr4880011lbl.16.1340578839434;	Sun,
+ 24 Jun 2012 16:00:39 -0700 (PDT)
+Received: from localhost.localdomain (a88-114-220-213.elisa-laajakaista.fi.
+	[88.114.220.213])	by mx.google.com with ESMTPS id
+ sy1sm67219900lab.13.2012.06.24.16.00.37	(version=TLSv1/SSLv3 cipher=OTHER);
+	Sun, 24 Jun 2012 16:00:38 -0700 (PDT)
+From: Siarhei Siamashka <siarhei.siamashka at gmail.com>
+To: <pixman at lists.freedesktop.org>
+Date: Mon, 25 Jun 2012 02:00:27 +0300
+Message-ID: <1340578827-13115-1-git-send-email-siarhei.siamashka at gmail.com>
+X-Mailer: git-send-email 1.7.3.4
+Subject: [Pixman] [PATCH/RFC] Use OpenMP for bilinear scaled fast paths
+X-BeenThere: pixman at lists.freedesktop.org
+X-Mailman-Version: 2.1.13
+Precedence: list
+List-Id: Mailing list for the Pixman rendering library
+	<pixman.lists.freedesktop.org>
+List-Unsubscribe: <http://lists.freedesktop.org/mailman/options/pixman>,
+	<mailto:pixman-request at lists.freedesktop.org?subject=unsubscribe>
+List-Archive: <http://lists.freedesktop.org/archives/pixman>
+List-Post: <mailto:pixman at lists.freedesktop.org>
+List-Help: <mailto:pixman-request at lists.freedesktop.org?subject=help>
+List-Subscribe: <http://lists.freedesktop.org/mailman/listinfo/pixman>,
+	<mailto:pixman-request at lists.freedesktop.org?subject=subscribe>
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
+Content-Transfer-Encoding: 7bit
+Sender: <pixman-bounces+sandmann=cs.au.dk at lists.freedesktop.org>
+Errors-To: pixman-bounces+sandmann=cs.au.dk at lists.freedesktop.org
+X-NFIT-ADSL: 0
+X-NFIT-RelayAddr: 130.225.30.1
+X-NFIT-MX: True
+X-Scanned-By: MIMEDefang 2.71
+X-Sim: 599c88352253612c4640bd38f9828f0997e200d86aa62eed35b782023877e08c 3124
+X-NFIT-Solido-Score: 3.
+X-NilSimsa-Score: 65/275
+X-Scanned-By: MIMEDefang 2.71
+X-Scanned-By: MIMEDefang 2.71 on 10.19.8.20
+X-Scanned-By: MIMEDefang 2.71 on 10.19.8.21
+
+Does it actually make sense? I remember somebody was strongly opposing
+the idea of spawning threads in pixman in the past, but can't find
+this e-mail right now.
+
+Even if using multithreaded rendering is acceptable, the next question is
+whether to rely on OpenMP for it. Currently OpenMP is disabled in Android
+toolchain by default:
+    https://groups.google.com/forum/#!topic/android-ndk/pUfqxURgNbQ
+Clang/LLVM does not support OpenMP either.
+
+Some benchmarks with cairo-perf-trace (gcc 4.7.1, CFLAGS="-O2 -fopenmp"):
+
+=== Core i7 860 @2.8GHz ===
+
+before patch:
+[  0]    image             firefox-fishtank   66.912   66.931   0.13%    3/3
+
+export OMP_NUM_THREADS=1
+[  0]    image             firefox-fishtank   67.285   67.393   0.12%    3/3
+
+export OMP_NUM_THREADS=2
+[  0]    image             firefox-fishtank   40.156   40.192   0.07%    3/3
+
+export OMP_NUM_THREADS=3
+[  0]    image             firefox-fishtank   31.152   31.241   0.21%    3/3
+
+export OMP_NUM_THREADS=4
+[  0]    image             firefox-fishtank   26.507   26.540   0.15%    3/3
+
+=== Radeon HD 6770 (xf86-video-ati-6.14.4, Mesa 8.1-devel (git-6e7756d)) ====
+
+[  0]     xlib             firefox-fishtank   34.135   34.156   0.23%    3/3
+[  0]       gl             firefox-fishtank    5.671    5.755   0.89%    3/3
+
+---
+ pixman/pixman-inlines.h |   24 +++++++++++++++---------
+ 1 files changed, 15 insertions(+), 9 deletions(-)
+
+diff --git a/pixman/pixman-inlines.h b/pixman/pixman-inlines.h
+index 3532867..7ba0d09 100644
+--- a/pixman/pixman-inlines.h
++++ b/pixman/pixman-inlines.h
+@@ -765,6 +765,14 @@ bilinear_pad_repeat_get_scanline_bounds (int32_t         source_image_width,
+  *       range and can fit into unsigned byte or be used with 8-bit SIMD
+  *       multiplication instructions.
+  */
++
++#define OMP_BILINEAR_PARALLEL_FOR _Pragma("omp parallel for default(none)	\
++     firstprivate(height,dst_line,dst_stride,unit_y,unit_x,src_first_line,	\
++        src_stride,max_vx,right_pad,left_pad,left_tz,right_tz,src_width,	\
++        src_width_fixed,src_image,need_src_extension,mask_line,			\
++        mask_stride,v,vy,width)							\
++     private(vx,y1,y2,mask) schedule(static) if(height > 1)")
++
+ #define FAST_BILINEAR_MAINLOOP_INT(scale_func_name, scanline_func, src_type_t, mask_type_t,	\
+ 				  dst_type_t, repeat_mode, flags)				\
+ static void											\
+@@ -782,7 +790,7 @@ fast_composite_scaled_bilinear ## scale_func_name (pixman_implementation_t *imp,
+     pixman_fixed_t unit_x, unit_y;								\
+     int32_t left_pad, left_tz, right_tz, right_pad;						\
+ 												\
+-    dst_type_t *dst;										\
++    int i;											\
+     mask_type_t solid_mask;									\
+     const mask_type_t *mask = &solid_mask;							\
+     int src_stride, mask_stride, dst_stride;							\
+@@ -864,20 +872,19 @@ fast_composite_scaled_bilinear ## scale_func_name (pixman_implementation_t *imp,
+ 	src_width_fixed = pixman_int_to_fixed (src_width);					\
+     }												\
+ 												\
+-    while (--height >= 0)									\
++    OMP_BILINEAR_PARALLEL_FOR									\
++    for (i = 0; i < height; i++)								\
+     {												\
+ 	int weight1, weight2;									\
+-	dst = dst_line;										\
+-	dst_line += dst_stride;									\
++	dst_type_t *dst = dst_line + (uintptr_t)dst_stride * i;					\
+ 	vx = v.vector[0];									\
+ 	if (flags & FLAG_HAVE_NON_SOLID_MASK)							\
+ 	{											\
+-	    mask = mask_line;									\
+-	    mask_line += mask_stride;								\
++	    mask = mask_line + (uintptr_t)mask_stride * i;					\
+ 	}											\
+ 												\
+-	y1 = pixman_fixed_to_int (vy);								\
+-	weight2 = (vy >> 8) & 0xff;								\
++	y1 = pixman_fixed_to_int (vy + unit_y * i);						\
++	weight2 = ((vy + unit_y * i) >> 8) & 0xff;						\
+ 	if (weight2)										\
+ 	{											\
+ 	    /* normal case, both row weights are in 0-255 range and fit unsigned byte */	\
+@@ -890,7 +897,6 @@ fast_composite_scaled_bilinear ## scale_func_name (pixman_implementation_t *imp,
+ 	    y2 = y1;										\
+ 	    weight1 = weight2 = 128;								\
+ 	}											\
+-	vy += unit_y;										\
+ 	if (PIXMAN_REPEAT_ ## repeat_mode == PIXMAN_REPEAT_PAD)					\
+ 	{											\
+ 	    src_type_t *src1, *src2;								\
+-- 
+1.7.3.4
+
+_______________________________________________
+Pixman mailing list
+Pixman at lists.freedesktop.org
+http://lists.freedesktop.org/mailman/listinfo/pixman
+
diff --git a/pixman.spec b/pixman.spec
index 4e1c19a..3f2f7bd 100644
--- a/pixman.spec
+++ b/pixman.spec
@@ -3,7 +3,7 @@
 
 Name:           pixman
 Version:        0.26.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Pixel manipulation library
 
 Group:          System Environment/Libraries
@@ -17,6 +17,7 @@ Source0:	http://xorg.freedesktop.org/archive/individual/lib/%{name}-%{version}.t
 Source1:	make-pixman-snapshot.sh
 
 Patch0:		emms.patch
+Patch1:		openmp.patch
 
 # BuildRequires:  automake autoconf libtool pkgconfig
 
@@ -35,6 +36,7 @@ Development library for pixman.
 %prep
 %setup -q
 %patch0 -p1 -b .emms 
+%patch1 -p1 -b .openmp
 
 %build
 %configure --disable-static
@@ -61,6 +63,10 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
 %{_libdir}/pkgconfig/pixman-1.pc
 
 %changelog
+* Tue Jun 26 2012 Soren Sandmann <ssp at redhat.com> - 0.26.0-2
+- Add experimental patch to use OpenMP
+  If this causes your X server to misbehave, please file bugs.
+
 * Wed May 30 2012 Soren Sandmann <ssp at redhat.com> - 0.26.0-1
 - update to 0.26.0
 - patch to add missing emms instructions


More information about the scm-commits mailing list