Open Bug 1269654 Opened 8 years ago Updated 2 years ago

Graphics "crashes" on big endian machines

Categories

(Core :: Graphics, defect, P3)

46 Branch
Other
NetBSD
defect

Tracking

()

REOPENED

People

(Reporter: martin, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file)

Probably same or similar underlying issue as bug 986328, I see flashing display and lots of  "crash reporter logs":

Crash Annotation GraphicsCriticalError: |[0][GFX1]: Unknown image format 0 (t=4.86961)|[25246][GFX1]: Unknown image format 0 (t=904.76)|[25242][GFX1]: 

coming from:

#6  mozilla::gfx::GfxFormatToCairoFormat (format=format@entry=mozilla::gfx::SurfaceFormat::B8G8R8A8)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/gfx/2d/HelpersCairo.h:163
#7  0xfffffffff3751e84 in GfxFormatToCairoFormat (format=mozilla::gfx::SurfaceFormat::B8G8R8A8)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/gfx/2d/HelpersCairo.h:152
#8  mozilla::gfx::CreateSubImageForData (aData=<optimized out>, aRect=..., aStride=<optimized out>, aFormat=<optimized out>)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/gfx/2d/DrawTargetCairo.cpp:283
#9  0xfffffffff37521fc in mozilla::gfx::GetCairoSurfaceForSourceSurface (aSurface=<optimized out>, aExistingOnly=aExistingOnly@entry=false, 
    aSubImage=...) at /usr/pkgobj/www/firefox/work/firefox-46.0/gfx/2d/DrawTargetCairo.cpp:384
#10 0xfffffffff3752684 in mozilla::gfx::GfxPatternToCairoPattern (aPattern=..., aAlpha=<optimized out>, aTransform=...)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/gfx/2d/DrawTargetCairo.cpp:507
#11 0xfffffffff3752efc in mozilla::gfx::DrawTargetCairo::DrawPattern (this=this@entry=0xffffffffdc662520, aPattern=..., aStrokeOptions=..., 
    aOptions=..., aDrawType=aDrawType@entry=mozilla::gfx::DrawTargetCairo::DRAW_FILL, aPathBoundsClip=<optimized out>)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/gfx/2d/DrawTargetCairo.cpp:961
#12 0xfffffffff3754d74 in mozilla::gfx::DrawTargetCairo::FillRect (this=0xffffffffdc662520, aRect=..., aPattern=..., aOptions=...)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/gfx/2d/DrawTargetCairo.cpp:1057
#13 0xfffffffff387c000 in gfxSurfaceDrawable::DrawInternal (this=this@entry=0xffffffffdda47100, aDrawTarget=aDrawTarget@entry=0xffffffffdc662520, 
    aOp=aOp@entry=mozilla::gfx::CompositionOp::OP_OVER, aAntialiasMode=<optimized out>, aFillRect=..., aSamplingRect=..., aExtendMode=<optimized out>, 
    aFilter=<optimized out>, aOpacity=<optimized out>, aTransform=...) at /usr/pkgobj/www/firefox/work/firefox-46.0/gfx/thebes/gfxDrawable.cpp:106
#14 0xfffffffff387c23c in gfxSurfaceDrawable::Draw (this=this@entry=0xffffffffdda47100, aContext=aContext@entry=0xffffffffdc776e80, aFillRect=..., 
    aExtendMode=aExtendMode@entry=mozilla::gfx::ExtendMode::CLAMP, aFilter=@0xffffffffffff81a8: mozilla::gfx::Filter::GOOD, aOpacity=<optimized out>, 
    aTransform=...) at /usr/pkgobj/www/firefox/work/firefox-46.0/gfx/thebes/gfxDrawable.cpp:77
#15 0xfffffffff38da684 in gfxUtils::DrawPixelSnapped (aContext=aContext@entry=0xffffffffdc776e80, aDrawable=<optimized out>, aImageSize=..., 
    aRegion=..., aFormat=<optimized out>, aFilter=aFilter@entry=mozilla::gfx::Filter::GOOD, aImageFlags=<optimized out>, aOpacity=1)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/gfx/thebes/gfxUtils.cpp:694
#16 0xfffffffff3910c7c in mozilla::image::imgFrame::Draw (this=0xffffffffe6f36480, aContext=aContext@entry=0xffffffffdc776e80, aRegion=..., 
    aFilter=aFilter@entry=mozilla::gfx::Filter::GOOD, aImageFlags=aImageFlags@entry=96)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/image/imgFrame.cpp:605
#17 0xfffffffff38eca9c in mozilla::image::RasterImage::DrawInternal(mozilla::image::DrawableFrameRef&&, gfxContext*, mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::image::ImageRegion const&, mozilla::gfx::Filter, unsigned int) (this=this@entry=0xffffffffdda42320, 
    aFrameRef=aFrameRef@entry=<unknown type in /usr/pkgobj/www/firefox/work/build/dist/bin/libxul.so, CU 0x767b279, DIE 0x7715d42>, 
    aContext=aContext@entry=0xffffffffdc776e80, aSize=..., aRegion=..., aFilter=aFilter@entry=mozilla::gfx::Filter::GOOD, aFlags=96)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/image/RasterImage.cpp:1460
#18 0xfffffffff38ecc34 in mozilla::image::RasterImage::Draw (this=0xffffffffdda42320, aContext=0xffffffffdc776e80, aSize=..., aRegion=..., 
    aWhichFrame=<optimized out>, aFilter=<optimized out>, aFlags=96) at /usr/pkgobj/www/firefox/work/firefox-46.0/image/RasterImage.cpp:1526
#19 0xfffffffff4bd1f54 in DrawImageInternal (aContext=..., aPresContext=aPresContext@entry=0xffffffffe09ac800, aImage=0xffffffffdda42320, 
    aGraphicsFilter=aGraphicsFilter@entry=mozilla::gfx::Filter::GOOD, aDest=..., aFill=..., aAnchor=..., aDirty=..., aSVGContext=0x0, aImageFlags=96, 
    aExtendMode=mozilla::gfx::ExtendMode::CLAMP) at /usr/pkgobj/www/firefox/work/firefox-46.0/layout/base/nsLayoutUtils.cpp:6467
#20 0xfffffffff4bd2dfc in nsLayoutUtils::DrawSingleImage (aContext=..., aPresContext=aPresContext@entry=0xffffffffe09ac800, 
    aImage=aImage@entry=0xffffffffdda42320, aGraphicsFilter=<optimized out>, aDest=..., aDirty=..., aSVGContext=0x0, aImageFlags=64, aAnchorPoint=0x0, 
    aSourceArea=0x0) at /usr/pkgobj/www/firefox/work/firefox-46.0/layout/base/nsLayoutUtils.cpp:6571
#21 0xfffffffff4d4d1bc in nsImageBoxFrame::PaintImage (this=0xffffffffdd9cdc78, aRenderingContext=..., aDirtyRect=..., aPt=..., aFlags=<optimized out>)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/layout/xul/nsImageBoxFrame.cpp:397
#22 0xfffffffff4d4d360 in nsDisplayXULImage::Paint (this=0xffffffffdc7f2b28, aBuilder=0xffffffffffff9a08, aCtx=0xffffffffffff8ed0)
    at /usr/pkgobj/www/firefox/work/firefox-46.0/layout/xul/nsImageBoxFrame.cpp:410


which looks like:

static inline cairo_format_t
GfxFormatToCairoFormat(SurfaceFormat format)
{
  switch (format)
  {
    case SurfaceFormat::A8R8G8B8_UINT32:
      return CAIRO_FORMAT_ARGB32;
    case SurfaceFormat::X8R8G8B8_UINT32:
      return CAIRO_FORMAT_RGB24;
    case SurfaceFormat::A8:
      return CAIRO_FORMAT_A8;  
    case SurfaceFormat::R5G6B5_UINT16:
      return CAIRO_FORMAT_RGB16_565;
    default:
      gfxCriticalError() << "Unknown image format " << (int)format;
      return CAIRO_FORMAT_ARGB32;  
  }
}

I'd be happy to create/test patches, but I do not understand the "big picture" right now - what is supposed to happen where?
Note that with commmenting out the gfxCriticalError() in this function and  in the next, like:

static inline cairo_content_t
GfxFormatToCairoContent(SurfaceFormat format)
{
  switch (format)
  {
    case SurfaceFormat::A8R8G8B8_UINT32:
      return CAIRO_CONTENT_COLOR_ALPHA;
    case SurfaceFormat::X8R8G8B8_UINT32:
    case SurfaceFormat::R5G6B5_UINT16:  //fall through
      return CAIRO_CONTENT_COLOR;
    case SurfaceFormat::A8:
      return CAIRO_CONTENT_ALPHA;
    default:
//      gfxCriticalError() << "Unknown image content format " << (int)format;
      return CAIRO_CONTENT_COLOR_ALPHA;
  }
}

makes it mostly work, only a full clienat area black flash every now and then
See Also: → 986328, 998749
If you want to "ifdef big endian" these errors, we'll probably take a patch, but it may be better to figure out what the underlying problem is.
Whiteboard: [gfx-noted]
No, I don't want to remove the errors - just noting that it mostly works.

I currently have no idea where to start looking what goes wrong. This also is a relatively recent regression, not sure about 45, but 44 certainly did work well for me.

It only seems to happen for images, something goes wrong during composition and a full redraw of the layers tree is triggered to fix it? The visual result in the end is fine.
This is an unfortunately necessary hack until we resolve the overall issue of inconsistent usage of B8G8R8A8 throughout the tree. It's better than crashing, at least.
Attachment #8749234 - Flags: review?(jmuizelaar)
Comment on attachment 8749234 [details] [diff] [review]
handle big-endian formats in Cairo format conversions

Review of attachment 8749234 [details] [diff] [review]:
-----------------------------------------------------------------

Do you know where the wrong formats are coming from?
It looks like they're coming from ImageLib. Can we try fixing those instead in bug 1270942
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
I don't understand why this is marked as fixed. None of the issues linked from this issue are fixed. And I am running into this issue both on Firefox 45.6.0 and 50.1.0, on PPC64 (Big endian) Gentoo.
(In reply to Merlijn B.W. Wajer from comment #7)
> I don't understand why this is marked as fixed. None of the issues linked
> from this issue are fixed. And I am running into this issue both on Firefox
> 45.6.0 and 50.1.0, on PPC64 (Big endian) Gentoo.

I didn't try big-endian PPC64, but at least sparc64 - which is also big-endian - works fine. I did not see any crashes.
OK. On PowerPC it is not fixed, as far as I can tell.

firefox 50.1.0 in debian sid gives these errors:

Crash Annotation GraphicsCriticalError: |[0][GFX1]: Unknown image format 1 (t=3.55253) |[6406][GFX1]: Unknown image format 1 (t=72.1646) |[6407][GFX1]: Unknown image format 0 (t=72.1647) |[6408][GFX1]: Unknown image format 1 (t=72.1648) |[6409][GFX1]: Unknown image format 0 (t=72.165) |[6410][GFX1]: Unknown image format 1 (t=72.1812) |[6411][GFX1]: Unknown image format 1 (t=72.1814) |[6412][GFX1]: Unknown image format 1 (t=72.1816) |[6413][GFX1]: Unknown image format 0 (t=72.1817) |[6414][GFX1]: Unknown image format 1 (t=72.1818) |[6415][GFX1]: Unknown image format 0 (t=72.182) |[6401][GFX1]: Unknown image format 0 (t=72.1484) |[6402][GFX1]: Unknown image format 1 (t=72.1485) |[6403][GFX1]: Unknown image format 0 (t=72.1487) |[6404][GFX1]: Unknown image format 1 (t=72.1642) |[6405][GFX1]: Unknown image format 1 (t=72.1644) [GFX1]: Unknown image format 0

Gentoo 45.6.0 and 50.1.0 exhibits the same errors.

Should I file a new bug? It seems awfully related.
I see the same error output on sparc64, but previously it caused real rendering fallout (like redrawing the whole tree on every error), which does not happen anymore.

Since I usually do not monitor stderr/stdout from firefox during daily usage, I did not notice earlier.
See Also: → 1339008
Merlijn: please feel free to reopen, I guess "fixed" is overstated in this context.
I am also experiencing this exact same problem. Will someone who has the ability please re-open this bug?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Thanks!
Hi All,

I have Debian Sid PowerPC (PPC32) on my A-EON AmigaOne X1000 Nemo (P.A. Semi PA6T). I have the same problems with Firefox.

Cheers,
Christian
Here's the backtrace I am getting with Firefox 59 on sparc64:

Thread 1 "firefox" received signal SIGSEGV, Segmentation fault.
0xfff8000109aea030 in ContextToPC (context=0x7feffffa790)
    at /srv/glaubitz/firefox-59.0~b4/js/src/wasm/WasmSignalHandlers.cpp:434
434         MOZ_CRASH();
(gdb) bt
#0  0xfff8000109aea030 in ContextToPC (context=0x7feffffa790)
    at /srv/glaubitz/firefox-59.0~b4/js/src/wasm/WasmSignalHandlers.cpp:434
#1  0xfff8000109aea030 in RedirectJitCodeToInterruptCheck (context=0x7feffffa790, cx=<optimized out>)
    at /srv/glaubitz/firefox-59.0~b4/js/src/wasm/WasmSignalHandlers.cpp:1510
#2  0xfff8000109aea030 in JitInterruptHandler(int, siginfo_t*, void*) (signum=<optimized out>, info=0x7feffffa790, context=0x7feffffa790)
    at /srv/glaubitz/firefox-59.0~b4/js/src/wasm/WasmSignalHandlers.cpp:1561
#3  0xfff800010013bf5c in <signal handler called> ()
    at ../sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c
#4  0xfff80001009af594 in __GI___poll (fds=0x7feffffab68, nfds=1, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:29
#5  0xfff8000103c53bd0 in  () at /usr/lib/sparc64-linux-gnu/libxcb.so.1
(gdb)

I have tried Martin's patch from the RedHat bugzilla, but so far it didn't help. But I just did a quick incremental build and may need a full rebuild which I am trying now.
Oh, wait a second. This crash happens because we are missing an implementation for sparc64 here:

static uint8_t**
ContextToPC(CONTEXT* context)
{
#ifdef KNOWS_MACHINE_STATE
    return reinterpret_cast<uint8_t**>(&PC_sig(context));
#else
    MOZ_CRASH();
#endif
}

js/src/wasm/WasmSignalHandlers.cpp
Blocks: big-endian
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: