Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jan 2013 16:21:27 +0000 (UTC)
From:      Niclas Zeising <zeising@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r311232 - in head/graphics/svgalib: . files
Message-ID:  <201301301621.r0UGLRH3001743@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zeising
Date: Wed Jan 30 16:21:26 2013
New Revision: 311232
URL: http://svnweb.freebsd.org/changeset/ports/311232

Log:
  Add patches to fix build with clang by replacing some inline assembly with
  optimal code, and removing some unneded casts.
  
  Submitted by:	dim
  Approved by:	kwm, miwi (mentors, implicit)

Added:
  head/graphics/svgalib/files/patch-gl::driver.c   (contents, props changed)
  head/graphics/svgalib/files/patch-gl::line.c   (contents, props changed)
  head/graphics/svgalib/files/patch-src::vgapix.c   (contents, props changed)
Modified:
  head/graphics/svgalib/Makefile

Modified: head/graphics/svgalib/Makefile
==============================================================================
--- head/graphics/svgalib/Makefile	Wed Jan 30 16:20:39 2013	(r311231)
+++ head/graphics/svgalib/Makefile	Wed Jan 30 16:21:26 2013	(r311232)
@@ -39,9 +39,6 @@ post-patch: .SILENT
 	${REINPLACE_CMD} -e '30d' ${WRKSRC}/src/vgabg.h
 	${REINPLACE_CMD} -e 's,^   (unsigned [[:alpha:]]*),,' \
 		${WRKSRC}/src/apm.c
-# Allow to build on !i386
-	${REINPLACE_CMD} -e '29,36s,def __alpha__, defined(NO_ASSEMBLY),' \
-		${WRKSRC}/src/vgapix.c ${WRKSRC}/gl/driver.c
 # 024_vesa_not_print_crap.patch from Debian
 	${REINPLACE_CMD} -e '/^printf/d' ${WRKSRC}/src/vesa.c
 # Clean up after typo fixes in manpages

Added: head/graphics/svgalib/files/patch-gl::driver.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/svgalib/files/patch-gl::driver.c	Wed Jan 30 16:21:26 2013	(r311232)
@@ -0,0 +1,29 @@
+--- gl/driver.c.orig	1999-07-18 10:18:44.000000000 +0200
++++ gl/driver.c	2013-01-26 21:34:27.000000000 +0100
+@@ -1,6 +1,7 @@
+ /* driver.c     Framebuffer primitives */
+ 
+ 
++#include <sys/endian.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -33,17 +34,7 @@ static inline int RGB2BGR(int c)
+ /* However bswap is not supported by 386 */
+ 
+     if (MODEFLAGS & MODEFLAG_24BPP_REVERSED)
+-#ifdef __alpha__
+-	c = ((c >> 0) & 0xff) << 16 |
+-	    ((c >> 8) & 0xff) << 8 |
+-	    ((c >> 16) & 0xff) << 0;
+-#else
+-	asm("rorw  $8, %0\n"	/* 0RGB -> 0RBG */
+-	    "rorl $16, %0\n"	/* 0RBG -> BG0R */
+-	    "rorw  $8, %0\n"	/* BG0R -> BGR0 */
+-	    "shrl  $8, %0\n"	/* 0BGR -> 0BGR */
+-      : "=q"(c):"0"(c));
+-#endif
++	c = bswap32(c) >> 8;
+     return c;
+ }
+ 

Added: head/graphics/svgalib/files/patch-gl::line.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/svgalib/files/patch-gl::line.c	Wed Jan 30 16:21:26 2013	(r311232)
@@ -0,0 +1,23 @@
+--- gl/line.c.orig	1999-12-05 08:32:54.000000000 +0100
++++ gl/line.c	2013-01-26 21:25:52.000000000 +0100
+@@ -90,13 +90,13 @@ static inline int gl_regioncode (int x, 
+ 
+ #else
+ 
+-#define INC_IF_NEG(y, result)				\
+-{							\
+-	__asm__("btl $31,%1\n\t"			\
+-		"adcl $0,%0"				\
+-		: "=r" ((int) result)			\
+-		: "rm" ((int) (y)), "0" ((int) result)	\
+-		);					\
++#define INC_IF_NEG(y, result)			\
++{						\
++	__asm__("btl $31,%1\n\t"		\
++		"adcl $0,%0"			\
++		: "=r" (result)			\
++		: "rm" (y), "0" (result)	\
++		);				\
+ }
+ 
+ static inline int gl_regioncode (int x, int y)

Added: head/graphics/svgalib/files/patch-src::vgapix.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/svgalib/files/patch-src::vgapix.c	Wed Jan 30 16:21:26 2013	(r311232)
@@ -0,0 +1,33 @@
+--- src/vgapix.c.orig	1999-07-27 18:36:19.000000000 +0200
++++ src/vgapix.c	2013-01-26 21:14:42.000000000 +0100
+@@ -8,6 +8,7 @@
+ /* partially copyrighted (C) 1993 by Hartmut Schirmer */
+ /* HH: Added 4bpp support, and use bytesperpixel. */
+ 
++#include <sys/endian.h>
+ #include <stdio.h>
+ #include "vga.h"
+ #include "libvga.h"
+@@ -22,21 +23,8 @@ static inline void read_write(unsigned l
+ 
+ static inline int RGB2BGR(int c)
+ {
+-/* a bswap would do the same as the first 3 but in only ONE! cycle. */
+-/* However bswap is not supported by 386 */
+-
+     if (MODEFLAGS & RGB_MISORDERED)
+-#ifdef __alpha__
+-	c = ((c >> 0) & 0xff) << 16 |
+-	    ((c >> 8) & 0xff) << 8 |
+-	    ((c >> 16) & 0xff) << 0;
+-#else
+-	asm("rorw  $8, %0\n"	/* 0RGB -> 0RBG */
+-	    "rorl $16, %0\n"	/* 0RBG -> BG0R */
+-	    "rorw  $8, %0\n"	/* BG0R -> BGR0 */
+-	    "shrl  $8, %0\n"	/* 0BGR -> 0BGR */
+-      : "=q"(c):"0"(c));
+-#endif
++	c = bswap32(c) >> 8;
+     return c;
+ }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301301621.r0UGLRH3001743>