MantisBT - NetSurf
View Issue Details
0002469NetSurfFramebuffer-specificpublic2016-09-12 06:392016-12-31 11:59
ReporterAnthony J. Bentley 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusacknowledgedResolutionopen 
PlatformPowerPCOSOpenBSDOS Version
Product Version 
Target VersionFixed in Version 
Fixed in CI build #
Reported in CI build #
URL of problem page
Summary0002469: Endianness issues in libnsfb and netsurf-fb
DescriptionWhen netsurf-fb is run on OpenBSD/macppc (big-endian), colors don't show up correctly.

There appear to be two problems.

First, there's an issue with all pixels showing up as the wrong color, giving the whole browser a yellowish tinge. This shows up on -b 24 and -b 32.

Second, there's an issue with just images. All graphics in webpages, and all framebuffer bitmaps including mouse pointer and toolbar buttons, have incorrect colors. This shows up on -b 8 and -b 16.
TagsNo tags attached.
Attached Filespng fb-8-16.png (130,366) 2016-09-12 06:39
https://bugs.netsurf-browser.org/mantis/file_download.php?file_id=444&type=bug
png

png fb-24-32.png (117,659) 2016-09-12 06:39
https://bugs.netsurf-browser.org/mantis/file_download.php?file_id=445&type=bug
png

Notes
(0001453)
Anthony J. Bentley   
2016-12-04 03:59   
Since these are clearly two separate issues, I'm keeping the "yellow screen"/"-b 24/32" discussion in here and moving the "images"/"-b 8/16" discussion to 0002488.
(0001462)
Artu Jarosik   
2016-12-26 10:04   
I have this working on 68k Big Endian Amiga

Add this :

static inline nsfb_colour_t pixel_bgra_to_colour_rgba(UNUSED nsfb_t *nsfb, uint32_t pixel)
{

    return (((pixel & 0xFF000000) >> 16 ) |
                ((pixel & 0xFF0000)) |
                ((pixel & 0xFF00) << 16));
}

static bool readrect(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t *buffer)
{
        PLOT_TYPE *pvideo;
        int xloop, yloop;
        int width;

        if (!nsfb_plot_clip_ctx(nsfb, rect)) {
                return true;
        }

        width = rect->x1 - rect->x0;

        pvideo = get_xy_loc(nsfb, rect->x0, rect->y0);

        for (yloop = rect->y0; yloop < rect->y1; yloop += 1) {
                for (xloop = 0; xloop < width; xloop++) {
#ifdef __BIG_ENDIAN_BGRA__
    if (Bpp == 32)
                        *buffer = pixel_bgra_to_colour_rgba(nsfb, *(pvideo + xloop));
    else if (Bpp == 16)
                        *buffer = pixel_be_to_colour(nsfb, *(pvideo + xloop));
        else
                        *buffer = pixel_to_colour(nsfb, *(pvideo + xloop));
#else
                        *buffer = pixel_to_colour(nsfb, *(pvideo + xloop));
#endif
                        buffer++;
                }
                pvideo += PLOT_LINELEN(nsfb->linelen);
        }
        return true;
}

Issue History
2016-09-12 06:39Anthony J. BentleyNew Issue
2016-09-12 06:39Anthony J. BentleyFile Added: fb-8-16.png
2016-09-12 06:39Anthony J. BentleyFile Added: fb-24-32.png
2016-12-04 03:59Anthony J. BentleyNote Added: 0001453
2016-12-26 10:04Artu JarosikNote Added: 0001462
2016-12-31 11:59Vincent SandersStatusnew => acknowledged