Skip to content

Commit

Permalink
Backed out 9 changesets (bug 1551088) for causing Bug 1583848. a=backout
Browse files Browse the repository at this point in the history
Backed out changeset d0ab25c226a7 (bug 1551088)
Backed out changeset 9ef391e20fa6 (bug 1551088)
Backed out changeset 3e6f25b21f8c (bug 1551088)
Backed out changeset 5d72c8de4daf (bug 1551088)
Backed out changeset f77c43bcc75b (bug 1551088)
Backed out changeset 9e954d6765de (bug 1551088)
Backed out changeset d90a571e581f (bug 1551088)
Backed out changeset 25a5f5563e9d (bug 1551088)
Backed out changeset bed9c93eeb2d (bug 1551088)
  • Loading branch information
CosminSabou committed Sep 25, 2019
1 parent f43ae7e commit 6da90eb
Show file tree
Hide file tree
Showing 34 changed files with 609 additions and 1,673 deletions.
13 changes: 1 addition & 12 deletions browser/tools/mozscreenshots/browser_screenshots_cropping.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,7 @@ async function compareImages(window, expected, test) {
"The test and expected images must be the same size"
);

var maxDifference = {};
var differences = window.windowUtils.compareCanvases(
expectedCanvas,
testCanvas,
maxDifference
);

// Fuzz for minor differences that can be caused by the encoder.
if (maxDifference.value > 1) {
return differences;
}
return 0;
return window.windowUtils.compareCanvases(expectedCanvas, testCanvas, {});
}

async function cropAndCompare(window, src, expected, test, region, subregions) {
Expand Down
499 changes: 99 additions & 400 deletions gfx/2d/Swizzle.cpp

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions gfx/2d/Swizzle.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,6 @@ GFX2D_API bool SwizzleData(const uint8_t* aSrc, int32_t aSrcStride,
int32_t aDstStride, SurfaceFormat aDstFormat,
const IntSize& aSize);

/**
* Swizzles source and writes it to destination. Source and destination may be
* the same to swizzle in-place.
*/
typedef void (*SwizzleRowFn)(const uint8_t* aSrc, uint8_t* aDst, int32_t aLength);

/**
* Get a function pointer to perform premultiplication between two formats.
*/
GFX2D_API SwizzleRowFn PremultiplyRow(SurfaceFormat aSrcFormat, SurfaceFormat aDstFormat);

/**
* Get a function pointer to perform swizzling between two formats.
*/
GFX2D_API SwizzleRowFn SwizzleRow(SurfaceFormat aSrcFormat, SurfaceFormat aDstFormat);

} // namespace gfx
} // namespace mozilla

Expand Down
85 changes: 0 additions & 85 deletions gfx/2d/SwizzleAVX2.cpp

This file was deleted.

111 changes: 35 additions & 76 deletions gfx/2d/SwizzleNEON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,36 +85,6 @@ PremultiplyVector_NEON(const uint16x8_t& aSrc) {
return vsriq_n_u16(ga, rb, 8);
}

template <bool aSwapRB, bool aOpaqueAlpha>
static MOZ_ALWAYS_INLINE void PremultiplyChunk_NEON(const uint8_t*& aSrc,
uint8_t*& aDst,
int32_t aAlignedRow,
int32_t aRemainder) {
// Process all 4-pixel chunks as one vector.
for (const uint8_t* end = aSrc + aAlignedRow; aSrc < end;) {
uint16x8_t px = vld1q_u16(reinterpret_cast<const uint16_t*>(aSrc));
px = PremultiplyVector_NEON<aSwapRB, aOpaqueAlpha>(px);
vst1q_u16(reinterpret_cast<uint16_t*>(aDst), px);
aSrc += 4 * 4;
aDst += 4 * 4;
}

// Handle any 1-3 remaining pixels.
if (aRemainder) {
uint16x8_t px = LoadRemainder_NEON(aSrc, aRemainder);
px = PremultiplyVector_NEON<aSwapRB, aOpaqueAlpha>(px);
StoreRemainder_NEON(aDst, aRemainder, px);
}
}

template <bool aSwapRB, bool aOpaqueAlpha>
void PremultiplyRow_NEON(const uint8_t* aSrc, uint8_t* aDst, int32_t aLength) {
int32_t alignedRow = 4 * (aLength & ~3);
int32_t remainder = aLength & 3;
PremultiplyChunk_NEON<aSwapRB, aOpaqueAlpha>(aSrc, aDst, alignedRow,
remainder);
}

template <bool aSwapRB, bool aOpaqueAlpha>
void Premultiply_NEON(const uint8_t* aSrc, int32_t aSrcGap, uint8_t* aDst,
int32_t aDstGap, IntSize aSize) {
Expand All @@ -125,22 +95,28 @@ void Premultiply_NEON(const uint8_t* aSrc, int32_t aSrcGap, uint8_t* aDst,
aDstGap += 4 * remainder;

for (int32_t height = aSize.height; height > 0; height--) {
PremultiplyChunk_NEON<aSwapRB, aOpaqueAlpha>(aSrc, aDst, alignedRow,
remainder);
// Process all 4-pixel chunks as one vector.
for (const uint8_t* end = aSrc + alignedRow; aSrc < end;) {
uint16x8_t px = vld1q_u16(reinterpret_cast<const uint16_t*>(aSrc));
px = PremultiplyVector_NEON<aSwapRB, aOpaqueAlpha>(px);
vst1q_u16(reinterpret_cast<uint16_t*>(aDst), px);
aSrc += 4 * 4;
aDst += 4 * 4;
}

// Handle any 1-3 remaining pixels.
if (remainder) {
uint16x8_t px = LoadRemainder_NEON(aSrc, remainder);
px = PremultiplyVector_NEON<aSwapRB, aOpaqueAlpha>(px);
StoreRemainder_NEON(aDst, remainder, px);
}

aSrc += aSrcGap;
aDst += aDstGap;
}
}

// Force instantiation of premultiply variants here.
template void PremultiplyRow_NEON<false, false>(const uint8_t*, uint8_t*,
int32_t);
template void PremultiplyRow_NEON<false, true>(const uint8_t*, uint8_t*,
int32_t);
template void PremultiplyRow_NEON<true, false>(const uint8_t*, uint8_t*,
int32_t);
template void PremultiplyRow_NEON<true, true>(const uint8_t*, uint8_t*,
int32_t);
template void Premultiply_NEON<false, false>(const uint8_t*, int32_t, uint8_t*,
int32_t, IntSize);
template void Premultiply_NEON<false, true>(const uint8_t*, int32_t, uint8_t*,
Expand Down Expand Up @@ -282,7 +258,7 @@ template void Unpremultiply_NEON<true>(const uint8_t*, int32_t, uint8_t*,

// Swizzle a vector of 4 pixels providing swaps and opaquifying.
template <bool aSwapRB, bool aOpaqueAlpha>
static MOZ_ALWAYS_INLINE uint16x8_t SwizzleVector_NEON(const uint16x8_t& aSrc) {
MOZ_ALWAYS_INLINE uint16x8_t SwizzleVector_NEON(const uint16x8_t& aSrc) {
// Swap R and B, then add to G and A (forced to 255):
// (((src>>16) | (src << 16)) & 0x00FF00FF) |
// ((src | 0xFF000000) & ~0x00FF00FF)
Expand All @@ -299,50 +275,21 @@ static MOZ_ALWAYS_INLINE uint16x8_t SwizzleVector_NEON(const uint16x8_t& aSrc) {

// Optimized implementations for when there is no R and B swap.
template<>
static MOZ_ALWAYS_INLINE uint16x8_t
MOZ_ALWAYS_INLINE uint16x8_t
SwizzleVector_NEON<false, true>(const uint16x8_t& aSrc)
{
// Force alpha to 255.
return vorrq_u16(aSrc, vreinterpretq_u16_u32(vdupq_n_u32(0xFF000000)));
}

template<>
static MOZ_ALWAYS_INLINE uint16x8_t
MOZ_ALWAYS_INLINE uint16x8_t
SwizzleVector_NEON<false, false>(const uint16x8_t& aSrc)
{
return aSrc;
}
#endif

template <bool aSwapRB, bool aOpaqueAlpha>
static MOZ_ALWAYS_INLINE void SwizzleChunk_NEON(const uint8_t*& aSrc,
uint8_t*& aDst,
int32_t aAlignedRow,
int32_t aRemainder) {
// Process all 4-pixel chunks as one vector.
for (const uint8_t* end = aSrc + aAlignedRow; aSrc < end;) {
uint16x8_t px = vld1q_u16(reinterpret_cast<const uint16_t*>(aSrc));
px = SwizzleVector_NEON<aSwapRB, aOpaqueAlpha>(px);
vst1q_u16(reinterpret_cast<uint16_t*>(aDst), px);
aSrc += 4 * 4;
aDst += 4 * 4;
}

// Handle any 1-3 remaining pixels.
if (aRemainder) {
uint16x8_t px = LoadRemainder_NEON(aSrc, aRemainder);
px = SwizzleVector_NEON<aSwapRB, aOpaqueAlpha>(px);
StoreRemainder_NEON(aDst, aRemainder, px);
}
}

template <bool aSwapRB, bool aOpaqueAlpha>
void SwizzleRow_NEON(const uint8_t* aSrc, uint8_t* aDst, int32_t aLength) {
int32_t alignedRow = 4 * (aLength & ~3);
int32_t remainder = aLength & 3;
SwizzleChunk_NEON<aSwapRB, aOpaqueAlpha>(aSrc, aDst, alignedRow, remainder);
}

template <bool aSwapRB, bool aOpaqueAlpha>
void Swizzle_NEON(const uint8_t* aSrc, int32_t aSrcGap, uint8_t* aDst,
int32_t aDstGap, IntSize aSize) {
Expand All @@ -353,16 +300,28 @@ void Swizzle_NEON(const uint8_t* aSrc, int32_t aSrcGap, uint8_t* aDst,
aDstGap += 4 * remainder;

for (int32_t height = aSize.height; height > 0; height--) {
SwizzleChunk_NEON<aSwapRB, aOpaqueAlpha>(aSrc, aDst, alignedRow,
remainder);
// Process all 4-pixel chunks as one vector.
for (const uint8_t* end = aSrc + alignedRow; aSrc < end;) {
uint16x8_t px = vld1q_u16(reinterpret_cast<const uint16_t*>(aSrc));
px = SwizzleVector_NEON<aSwapRB, aOpaqueAlpha>(px);
vst1q_u16(reinterpret_cast<uint16_t*>(aDst), px);
aSrc += 4 * 4;
aDst += 4 * 4;
}

// Handle any 1-3 remaining pixels.
if (remainder) {
uint16x8_t px = LoadRemainder_NEON(aSrc, remainder);
px = SwizzleVector_NEON<aSwapRB, aOpaqueAlpha>(px);
StoreRemainder_NEON(aDst, remainder, px);
}

aSrc += aSrcGap;
aDst += aDstGap;
}
}

// Force instantiation of swizzle variants here.
template void SwizzleRow_NEON<true, false>(const uint8_t*, uint8_t*, int32_t);
template void SwizzleRow_NEON<true, true>(const uint8_t*, uint8_t*, int32_t);
template void Swizzle_NEON<true, false>(const uint8_t*, int32_t, uint8_t*,
int32_t, IntSize);
template void Swizzle_NEON<true, true>(const uint8_t*, int32_t, uint8_t*,
Expand Down
Loading

0 comments on commit 6da90eb

Please sign in to comment.