Bug 187466 - www/netsurf all images rendered red on sparc64
Summary: www/netsurf all images rendered red on sparc64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Tijl Coosemans
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-12 00:30 UTC by craig001
Modified: 2014-03-15 18:00 UTC (History)
0 users

See Also:


Attachments
netsurf.patch (701 bytes, patch)
2014-03-12 09:29 UTC, Tijl Coosemans
no flags Details | Diff
netsurf.patch (4.71 KB, patch)
2014-03-14 16:31 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description craig001 2014-03-12 00:30:00 UTC
When displaying webpages via netsurf all the images are mostly red.

example can be seen at - http://bsdtec.com/freebsd/netsurf-red-sparc64.png

Help -> About... -> Netsurf 3.0 (20th April 2013)

Fix: 

unknown, not sure why it is rendering images incorrectly.
How-To-Repeat: compile netsurf on sparc64, run and navigate to any webpage with images.
Comment 1 Tijl Coosemans freebsd_committer freebsd_triage 2014-03-12 08:49:37 UTC
Responsible Changed
From-To: freebsd-ports-bugs->tijl

Take.
Comment 2 Tijl Coosemans freebsd_committer freebsd_triage 2014-03-12 09:29:03 UTC
Hi Craig,

Please try the attached patch and let me know if it works.
Comment 3 craig001 2014-03-12 16:40:32 UTC
On Wed, 2014-03-12 at 10:29 +0100, Tijl Coosemans wrote:
> Hi Craig,
> 
> Please try the attached patch and let me know if it works.

Hello Tijl

Thank you for the patch.  I have applied it and compiled again.  

Unfortunately it doesn't appear to have made a difference.  Images are
still red.

Kind Regards

Craig Butler
Comment 4 Tijl Coosemans freebsd_committer freebsd_triage 2014-03-12 20:27:55 UTC
On Wed, 12 Mar 2014 16:40:32 +0000 Craig Butler wrote:
> On Wed, 2014-03-12 at 10:29 +0100, Tijl Coosemans wrote:
>> Please try the attached patch and let me know if it works.
> 
> Thank you for the patch.  I have applied it and compiled again.  
> 
> Unfortunately it doesn't appear to have made a difference.  Images are
> still red.

Did this problem suddenly appear or is this the first time you use the
browser?

Does this happen with all image formats or only jpg?
Comment 5 craig001 2014-03-12 23:34:15 UTC
On Wed, 2014-03-12 at 21:27 +0100, Tijl Coosemans wrote:
> On Wed, 12 Mar 2014 16:40:32 +0000 Craig Butler wrote:
> > On Wed, 2014-03-12 at 10:29 +0100, Tijl Coosemans wrote:
> >> Please try the attached patch and let me know if it works.
> > 
> > Thank you for the patch.  I have applied it and compiled again.  
> > 
> > Unfortunately it doesn't appear to have made a difference.  Images are
> > still red.
> 
> Did this problem suddenly appear or is this the first time you use the
> browser?

CB> This is the first time using this browser on sparc64, port was
compiled on a sparc64 tinderbox then installed onto a sparc64 vnc test
jail.

I am involved with the FreeBSD sparc64 effort and I am trying to get
some of the gui stuff up and running.  Netsurf looks like an ideal
lightweight browser when it renders properly.

> 
> Does this happen with all image formats or only jpg?

CB> it appears to effect png, jpeg, jpeg 2000, and gif.
bmp is rendered blue and svg appears normal.

I googled for image format test page and the first hit was;
http://wiesmann.codiferes.net/share/bitmaps

I have captured a screenshot for your reference;
http://bsdtec.com/freebsd/netsurf-testpage-sparc64.png

Kind Regards

Craig Butler
Comment 6 Tijl Coosemans freebsd_committer freebsd_triage 2014-03-14 16:31:30 UTC
On Wed, 12 Mar 2014 23:23:11 +0000 Craig Butler wrote:
> On Wed, 2014-03-12 at 21:27 +0100, Tijl Coosemans wrote:
>> On Wed, 12 Mar 2014 16:40:32 +0000 Craig Butler wrote:
>>> On Wed, 2014-03-12 at 10:29 +0100, Tijl Coosemans wrote:
>>>> Please try the attached patch and let me know if it works.
>>> 
>>> Thank you for the patch.  I have applied it and compiled again.  
>>> 
>>> Unfortunately it doesn't appear to have made a difference.  Images are
>>> still red.
>> 
>> Did this problem suddenly appear or is this the first time you use the
>> browser?
> 
> This is the first time using this browser on sparc64, port was
> compiled on a sparc64 tinderbox then installed onto a sparc64 vnc test
> jail.
> 
> I am involved with the FreeBSD sparc64 effort and I am trying to get
> some of the gui stuff up and running.  Netsurf looks like an ideal
> lightweight browser when it renders properly.
> 
>> Does this happen with all image formats or only jpg?
> 
> it appears to effect png, jpeg, jpeg 2000, and gif.
> bmp is rendered blue and svg appears normal.
> 
> I googled for image format test page and the first hit was;
> http://wiesmann.codiferes.net/share/bitmaps
> 
> I have captured a screenshot for your reference;
> http://bsdtec.com/freebsd/netsurf-testpage-sparc64.png

New patch attached, please give it a try.
Comment 7 craig001 2014-03-15 14:55:41 UTC
On Fri, 2014-03-14 at 17:31 +0100, Tijl Coosemans wrote:
> On Wed, 12 Mar 2014 23:23:11 +0000 Craig Butler wrote:
> > On Wed, 2014-03-12 at 21:27 +0100, Tijl Coosemans wrote:
> >> On Wed, 12 Mar 2014 16:40:32 +0000 Craig Butler wrote:
> >>> On Wed, 2014-03-12 at 10:29 +0100, Tijl Coosemans wrote:
> >>>> Please try the attached patch and let me know if it works.
> >>> 
> >>> Thank you for the patch.  I have applied it and compiled again.  
> >>> 
> >>> Unfortunately it doesn't appear to have made a difference.  Images are
> >>> still red.
> >> 
> >> Did this problem suddenly appear or is this the first time you use the
> >> browser?
> > 
> > This is the first time using this browser on sparc64, port was
> > compiled on a sparc64 tinderbox then installed onto a sparc64 vnc test
> > jail.
> > 
> > I am involved with the FreeBSD sparc64 effort and I am trying to get
> > some of the gui stuff up and running.  Netsurf looks like an ideal
> > lightweight browser when it renders properly.
> > 
> >> Does this happen with all image formats or only jpg?
> > 
> > it appears to effect png, jpeg, jpeg 2000, and gif.
> > bmp is rendered blue and svg appears normal.
> > 
> > I googled for image format test page and the first hit was;
> > http://wiesmann.codiferes.net/share/bitmaps
> > 
> > I have captured a screenshot for your reference;
> > http://bsdtec.com/freebsd/netsurf-testpage-sparc64.png
> 
> New patch attached, please give it a try.

Hello Tiji

That patch appears to have done the trick.  

Everything appears correct on the image test page now.  

Thanks a million! definitely worth committing to the port.


Kind Regards

Craig Butler
Comment 8 dfilter service freebsd_committer freebsd_triage 2014-03-15 17:52:56 UTC
Author: tijl
Date: Sat Mar 15 17:52:53 2014
New Revision: 348360
URL: http://svnweb.freebsd.org/changeset/ports/348360
QAT: https://qat.redports.org/buildarchive/r348360/

Log:
  - Use the more common libpng instead of libmng.
  - Add an icon to the desktop entry.
  - Use option helpers.
  - Respect CFLAGS.
  - Remove clang support patch.  No longer necessary.
  - Add a patch to fix rendering of SVG and BMP images on little-endian
    systems and all image formats on big-endian systems. [1]
  
  PR:		ports/187466 [1]
  Tested by:	Craig Butler <craig001@lerwick.hopto.org> [1]

Added:
  head/www/netsurf/files/patch-pixel-format   (contents, props changed)
Modified:
  head/www/netsurf/Makefile
  head/www/netsurf/files/Makefile.config

Modified: head/www/netsurf/Makefile
==============================================================================
--- head/www/netsurf/Makefile	Sat Mar 15 17:43:25 2014	(r348359)
+++ head/www/netsurf/Makefile	Sat Mar 15 17:52:53 2014	(r348360)
@@ -3,7 +3,7 @@
 
 PORTNAME=	netsurf
 PORTVERSION=	3.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	www
 MASTER_SITES=	http://download.netsurf-browser.org/netsurf/releases/source-full/
 DISTNAME=	${PORTNAME}-${PORTVERSION}-full-src
@@ -16,7 +16,8 @@ LICENSE_COMB=	multi
 
 BUILD_DEPENDS=	${LOCALBASE}/bin/flex:${PORTSDIR}/textproc/flex
 LIB_DEPENDS=	libcurl.so:${PORTSDIR}/ftp/curl \
-		libmng.so:${PORTSDIR}/graphics/libmng
+		libjpeg.so:${PORTSDIR}/graphics/jpeg \
+		libpng15.so:${PORTSDIR}/graphics/png
 
 ALL_TARGET=	#empty
 CFLAGS+=	-I${LOCALBASE}/include
@@ -24,23 +25,20 @@ LDFLAGS+=	-lssl -lcrypto -L${LOCALBASE}/
 MAKE_ARGS=	HOST_CC="${CC}" CC="${CC}" CCOPT="" HOST="${OPSYS}" \
 		WARNFLAGS="" Q="" OPTCFLAGS="${CFLAGS}"
 USES=		bison gmake pkgconfig iconv
-USE_GNOME=	librsvg2
+USE_GNOME=	gtk20 librsvg2
 
 NSFB_VERSION=	0.1.0
 WRKSRC=		${WRKDIR}/${PORTNAME}-full-${PORTVERSION}
 
-DESKTOP_ENTRIES="NetSurf" "${COMMENT}" "" "${PORTNAME}" "" "true"
+DESKTOP_ENTRIES="NetSurf" "${COMMENT}" "${DATADIR}/${PORTNAME}.xpm" \
+		"${PORTNAME}" "" "true"
 
 OPTIONS_DEFINE=	GSTREAMER WEBP
-
+GSTREAMER_USE=		GSTREAMER=yes
 WEBP_LIB_DEPENDS=	libwebp.so:${PORTSDIR}/graphics/webp
 
 .include <bsd.port.options.mk>
 
-.if ${PORT_OPTIONS:MGSTREAMER}
-USE_GSTREAMER=	yes
-.endif
-
 .if ${OPSYS} == DragonFly
 LIB_DEPENDS+=	libssl.so:${PORTSDIR}/security/openssl
 BUILD_DEPENDS+=	gperf:${PORTSDIR}/devel/gperf
@@ -53,12 +51,14 @@ post-patch:
 		${WRKSRC}/src/libnsfb-${NSFB_VERSION}/Makefile
 	@${REINPLACE_CMD} 's|endian|sys/endian|' \
 		${WRKSRC}/src/libnsfb-${NSFB_VERSION}/src/plot/*bpp*.c
+	@${REINPLACE_CMD} '/CFLAGS/d' \
+		${WRKSRC}/src/netsurf-${PORTVERSION}/Makefile.defaults
 	@${REINPLACE_CMD} 's| -O2||' \
 		${WRKSRC}/src/netsurf-${PORTVERSION}/gtk/Makefile.defaults
-	@${REINPLACE_CMD} '/OpenSSL/d ; s| -g|| ; s|-DG_DISABLE_DEPRECATED||' \
+	@${REINPLACE_CMD} \
+		-e '/OpenSSL/d' -e '/lcms/d' -e 's| -g||' \
+		-e 's/-DG_DISABLE_DEPRECATED//' \
 		${WRKSRC}/src/netsurf-${PORTVERSION}/gtk/Makefile.target
-	@${REINPLACE_CMD} -e '/ifeq.*clang/s/word 1/filter clang/' \
-		${WRKSRC}/src/buildsystem-1.0/makefiles/Makefile.tools
 	@${REINPLACE_CMD} -e 's| -g|| ; s|flex|${LOCALBASE}/bin/&|' \
 		${WRKSRC}/src/nsgenbind-0.0.1/src/Makefile
 

Modified: head/www/netsurf/files/Makefile.config
==============================================================================
--- head/www/netsurf/files/Makefile.config	Sat Mar 15 17:43:25 2014	(r348359)
+++ head/www/netsurf/files/Makefile.config	Sat Mar 15 17:52:53 2014	(r348360)
@@ -1,6 +1,7 @@
 NETSURF_USE_HARU_PDF=NO
 NETSURF_USE_LIBICONV_PLUG=NO
+NETSURF_USE_MNG=NO
 NETSURF_USE_NSSVG=NO
 NETSURF_USE_ROSPRITE=NO
-NETSURF_USE_WEBP=NO
 NETSURF_USE_VIDEO=NO
+NETSURF_USE_WEBP=NO

Added: head/www/netsurf/files/patch-pixel-format
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/netsurf/files/patch-pixel-format	Sat Mar 15 17:52:53 2014	(r348360)
@@ -0,0 +1,89 @@
+--- src/netsurf-3.0/gtk/bitmap.c.orig
++++ src/netsurf-3.0/gtk/bitmap.c
+@@ -288,27 +288,27 @@
+ 
+ 	if (fmt == CAIRO_FORMAT_RGB24) {
+ 		for (pixel_loop=0; pixel_loop < pixel_count; pixel_loop++) {
+-			pixel = pixels[pixel_loop];
+-			pixels[pixel_loop] = (pixel & 0xff00ff00) |
+-				((pixel & 0xff) << 16) | 
+-				((pixel & 0xff0000) >> 16);		
++			pixel =	((uint8_t *)(pixels + pixel_loop))[0] << 16 |
++				((uint8_t *)(pixels + pixel_loop))[1] << 8 |
++				((uint8_t *)(pixels + pixel_loop))[2] |
++				((uint8_t *)(pixels + pixel_loop))[3] << 24;
++			pixels[pixel_loop] = pixel;
+ 		}
+ 	} else {
+ 		uint8_t t, r, g, b;
+ 		for (pixel_loop=0; pixel_loop < pixel_count; pixel_loop++) {
+-			pixel = pixels[pixel_loop];
+-			t = (pixel & 0xff000000) >> 24;
++			t = ((uint8_t *)(pixels + pixel_loop))[3];
+ 			if (t == 0) {
+ 				pixels[pixel_loop] = 0;
+ 			} else {
+-				r = (pixel & 0xff0000) >> 16;
+-				g = (pixel & 0xff00) >> 8;
+-				b = pixel & 0xff;
++				r = ((uint8_t *)(pixels + pixel_loop))[0];
++				g = ((uint8_t *)(pixels + pixel_loop))[1];
++				b = ((uint8_t *)(pixels + pixel_loop))[2];
+ 				
+ 				pixels[pixel_loop] = (t << 24) | 
+-					((r * t) >> 8) | 
++					((r * t) >> 8) << 16 | 
+ 					((g * t) >> 8) << 8 |
+-					((b * t) >> 8) << 16;
++					((b * t) >> 8);
+ 
+ 			}
+ 		}
+--- src/netsurf-3.0/image/bmp.c.orig
++++ src/netsurf-3.0/image/bmp.c
+@@ -171,7 +171,6 @@
+ 
+ 	/* exit as a success */
+ 	bmp->bitmap = bmp->bmp->bitmap;
+-	bitmap_modified(bmp->bitmap);
+ 
+ 	content_set_ready(c);
+ 	content_set_done(c);
+@@ -190,6 +189,8 @@
+ 	if (bmp->bmp->decoded == false)
+ 		if (bmp_decode(bmp->bmp) != BMP_OK)
+ 			return false;
++		else
++			bitmap_modified(bmp->bitmap);
+ 
+ 	bmp->bitmap = bmp->bmp->bitmap;
+ 
+--- src/netsurf-3.0/image/rsvg.c.orig
++++ src/netsurf-3.0/image/rsvg.c
+@@ -135,19 +135,17 @@
+ static inline void rsvg_argb_to_abgr(uint8_t *pixels, 
+ 		int width, int height, size_t rowstride)
+ {
+-	uint8_t *p = pixels;
++	uint32_t *p = (uint32_t *)pixels;
+ 
+ 	for (int y = 0; y < height; y++) {
+ 		for (int x = 0; x < width; x++) {
+-			/* Swap R and B */
+-			const uint8_t r = p[x+3];
+-
+-			p[x+3] = p[x];
+-
+-			p[x] = r;
++			uint32_t c = *p;
++			((uint8_t *)p)[0] = (c & 0xff0000) >> 16;
++			((uint8_t *)p)[1] = (c & 0xff00) >> 8;
++			((uint8_t *)p)[2] = (c & 0xff);
++			((uint8_t *)p)[3] = (c & 0xff000000) >> 24;
++			p++;
+ 		}
+-
+-		p += rowstride;
+ 	}
+ }
+ 
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 9 Tijl Coosemans freebsd_committer freebsd_triage 2014-03-15 17:58:24 UTC
State Changed
From-To: open->closed

Fixed in r348360.