Closed Bug 1260885 Opened 4 years ago Closed 4 years ago

layout/generic/crashtests/508908-1.html hits "Attempt to update texture client from a surface with a different size or format (BT)!" on 16 bit displays

Categories

(Core :: Graphics, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: mstange, Unassigned)

Details

Attachments

(1 file)

I get this when running crashtests on a debug build on Linux under vnc4server, which simulates a 16 bit screen, causing us to use 565 surface formats in many places.

BufferTextureData::UpdateFromSurface has this code:

  RefPtr<gfx::DataSourceSurface> srcSurf = aSurface->GetDataSurface();

  if (!srcSurf) {
    gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface (BT).";
    return false;
  }

  if (surface->GetSize() != srcSurf->GetSize() || surface->GetFormat() != srcSurf->GetFormat()) {
    gfxCriticalError() << "Attempt to update texture client from a surface with a different size or format (BT)! This: " << surface->GetSize() << " " << surface->GetFormat() << " Other: " << aSurface->GetSize() << " " << aSurface->GetFormat();
    return false;
  }


Interestingly, both surface and aSurface have SurfaceFormat::R5G6B5_UINT16, but srcSurf (which is being checked in the if condition) has SurfaceFormat::B8G8R8A8. 

So this seems like a bug in GetDataSurface().
https://dxr.mozilla.org/mozilla-central/source/gfx/2d/SourceSurfaceCairo.cpp#17 ignores CAIRO_FORMAT_RGB16_565. It needs to return SurfaceFormat::R5G6B5_UINT16 in that case.
I've confirmed that this fixes the crashtest failure I was seeing.
Attachment #8739189 - Flags: review?(lsalzman) → review+
Comment on attachment 8739189 [details]
MozReview Request: Bug 1260885 - Make SurfaceFormat::R5G6B5_UINT16 properly round-trip through SourceSurfaceCairo. r?lsalzman

https://reviewboard.mozilla.org/r/45099/#review41615
https://hg.mozilla.org/mozilla-central/rev/cd16e4847afb
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.