Backed out changeset 7aa58b8ef68a (bug 1655101) for causing bustages on dom/WebGLIpdl.h. CLOSED TREE

This commit is contained in:
Cosmin Sabou
2023-11-30 21:06:53 +02:00
parent ce5f17e875
commit 0db4b6a2ba
13 changed files with 59 additions and 110 deletions

View File

@@ -4394,8 +4394,6 @@ void ClientWebGLContext::TexImage(uint8_t funcDims, GLenum imageTarget,
// - // -
// -
mozilla::ipc::Shmem* pShmem = nullptr; mozilla::ipc::Shmem* pShmem = nullptr;
// Image to release after WebGLContext::TexImage(). // Image to release after WebGLContext::TexImage().
RefPtr<layers::Image> keepAliveImage; RefPtr<layers::Image> keepAliveImage;
@@ -4406,12 +4404,7 @@ void ClientWebGLContext::TexImage(uint8_t funcDims, GLenum imageTarget,
const auto& contextInfo = mNotLost->info; const auto& contextInfo = mNotLost->info;
const auto fallbackReason = [&]() -> Maybe<std::string> { const auto fallbackReason = [&]() -> Maybe<std::string> {
if (!respecFormat) { auto fallbackReason = BlitPreventReason(level, offset, pi, *desc);
return Some(std::string{
"Fast uploads not supported for TexSubImage. Use TexImage."});
}
auto fallbackReason = BlitPreventReason(
level, offset, respecFormat, pi, *desc, contextInfo.isRgb8Renderable);
if (fallbackReason) return fallbackReason; if (fallbackReason) return fallbackReason;
const bool canUploadViaSd = contextInfo.uploadableSdTypes[sdType]; const bool canUploadViaSd = contextInfo.uploadableSdTypes[sdType];

View File

@@ -659,10 +659,8 @@ bool TexUnpackImage::Validate(const WebGLContext* const webgl,
} }
Maybe<std::string> BlitPreventReason(const int32_t level, const ivec3& offset, Maybe<std::string> BlitPreventReason(const int32_t level, const ivec3& offset,
const GLenum internalFormat,
const webgl::PackingInfo& pi, const webgl::PackingInfo& pi,
const TexUnpackBlobDesc& desc, const TexUnpackBlobDesc& desc) {
const bool isRgb8Renderable) {
const auto& size = desc.size; const auto& size = desc.size;
const auto& unpacking = desc.unpacking; const auto& unpacking = desc.unpacking;
@@ -693,31 +691,13 @@ Maybe<std::string> BlitPreventReason(const int32_t level, const ivec3& offset,
}(); }();
if (premultReason) return premultReason; if (premultReason) return premultReason;
const auto formatReason = [&]() -> const char* { if (pi.format != LOCAL_GL_RGBA) {
if (pi.type != LOCAL_GL_UNSIGNED_BYTE) { return "`format` is not RGBA";
return "`type` must be `UNSIGNED_BYTE`"; }
}
switch (internalFormat) {
case LOCAL_GL_RGBA:
case LOCAL_GL_RGBA8:
return nullptr;
case LOCAL_GL_RGB:
case LOCAL_GL_RGB8:
if (isRgb8Renderable) {
return nullptr;
}
break;
}
if (isRgb8Renderable) {
return "effective format must be RGB8 or RGBA8";
} else {
return "effective format must be RGBA8";
}
}();
if (formatReason) return formatReason;
if (pi.type != LOCAL_GL_UNSIGNED_BYTE) {
return "`type` is not UNSIGNED_BYTE";
}
return nullptr; return nullptr;
}(); }();
if (ret) { if (ret) {
@@ -745,8 +725,7 @@ bool TexUnpackImage::TexOrSubImage(bool isSubImage, bool needsRespec,
// - // -
const auto reason = const auto reason =
BlitPreventReason(level, {xOffset, yOffset, zOffset}, dui->internalFormat, BlitPreventReason(level, {xOffset, yOffset, zOffset}, pi, mDesc);
pi, mDesc, webgl->mIsRgb8Renderable);
if (reason) { if (reason) {
webgl->GeneratePerfWarning( webgl->GeneratePerfWarning(
"Failed to hit GPU-copy fast-path." "Failed to hit GPU-copy fast-path."

View File

@@ -42,10 +42,8 @@ struct PackingInfo;
struct DriverUnpackInfo; struct DriverUnpackInfo;
Maybe<std::string> BlitPreventReason(int32_t level, const ivec3& offset, Maybe<std::string> BlitPreventReason(int32_t level, const ivec3& offset,
GLenum internalFormat,
const webgl::PackingInfo&, const webgl::PackingInfo&,
const TexUnpackBlobDesc&, const TexUnpackBlobDesc&);
bool isRgb8Renderable);
class TexUnpackBlob { class TexUnpackBlob {
public: public:

View File

@@ -641,7 +641,6 @@ RefPtr<WebGLContext> WebGLContext::Create(HostWebGLContext& host,
out->limits = *webgl->mLimits; out->limits = *webgl->mLimits;
out->uploadableSdTypes = UploadableSdTypes(); out->uploadableSdTypes = UploadableSdTypes();
out->vendor = webgl->gl->Vendor(); out->vendor = webgl->gl->Vendor();
out->isRgb8Renderable = webgl->mIsRgb8Renderable;
return webgl; return webgl;
} }
@@ -691,24 +690,6 @@ void WebGLContext::FinishInit() {
mShouldPresent = true; mShouldPresent = true;
//////
// mIsRgb8Renderable
{
const auto tex = gl::ScopedTexture(gl);
const auto fb = gl::ScopedFramebuffer(gl);
gl->fBindTexture(LOCAL_GL_TEXTURE_2D, tex);
gl->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_RGB, 1, 1, 0, LOCAL_GL_RGB,
LOCAL_GL_UNSIGNED_BYTE, nullptr);
gl->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, fb);
gl->fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0,
LOCAL_GL_TEXTURE_2D, tex, 0);
const auto status = gl->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
mIsRgb8Renderable = (status == LOCAL_GL_FRAMEBUFFER_COMPLETE);
}
////// //////
gl->ResetSyncCallCount("WebGLContext Initialization"); gl->ResetSyncCallCount("WebGLContext Initialization");

View File

@@ -316,7 +316,6 @@ class WebGLContext : public VRefCounted, public SupportsWeakPtr {
webgl::InitContextResult* out); webgl::InitContextResult* out);
private: private:
bool mIsRgb8Renderable = false;
void FinishInit(); void FinishInit();
protected: protected:

View File

@@ -13,8 +13,6 @@
#include "mozilla/ipc/IPDLParamTraits.h" #include "mozilla/ipc/IPDLParamTraits.h"
#include "mozilla/ipc/Shmem.h" #include "mozilla/ipc/Shmem.h"
#include "mozilla/layers/LayersSurfaces.h" #include "mozilla/layers/LayersSurfaces.h"
#include "TiedFields.h"
#include "TupleUtils.h"
#include "WebGLTypes.h" #include "WebGLTypes.h"
namespace mozilla { namespace mozilla {
@@ -216,34 +214,6 @@ struct ParamTraits<gfxAlphaType>
: public ContiguousEnumSerializerInclusive< : public ContiguousEnumSerializerInclusive<
gfxAlphaType, gfxAlphaType::Opaque, gfxAlphaType::NonPremult> {}; gfxAlphaType, gfxAlphaType::Opaque, gfxAlphaType::NonPremult> {};
// -
// ParamTraits_TiedFields
template <class T>
struct ParamTraits_TiedFields {
static_assert(mozilla::AreAllBytesTiedFields<T>());
static void Write(MessageWriter* const writer, const T& in) {
const auto& fields = mozilla::TiedFields(in);
MapTuple(fields, [&](const auto& field) {
WriteParam(writer, field);
return true; // ignored
});
}
static bool Read(MessageReader* const reader, T* const out) {
const auto& fields = mozilla::TiedFields(*out);
bool ok = true;
MapTuple(fields, [&](auto& field) {
if (ok) {
ok &= ReadParam(reader, &field);
}
return true; // ignored
});
return ok;
}
};
// - // -
template <typename T> template <typename T>
@@ -328,8 +298,24 @@ struct ParamTraits<mozilla::webgl::EnumMask<T>> final
: public PlainOldDataSerializer<mozilla::webgl::EnumMask<T>> {}; : public PlainOldDataSerializer<mozilla::webgl::EnumMask<T>> {};
template <> template <>
struct ParamTraits<mozilla::webgl::InitContextResult> final struct ParamTraits<mozilla::webgl::InitContextResult> final {
: public ParamTraits_TiedFields<mozilla::webgl::InitContextResult> {}; using T = mozilla::webgl::InitContextResult;
static void Write(MessageWriter* const writer, const T& in) {
WriteParam(writer, in.error);
WriteParam(writer, in.options);
WriteParam(writer, in.limits);
WriteParam(writer, in.uploadableSdTypes);
WriteParam(writer, in.vendor);
}
static bool Read(MessageReader* const reader, T* const out) {
return ReadParam(reader, &out->error) && ReadParam(reader, &out->options) &&
ReadParam(reader, &out->limits) &&
ReadParam(reader, &out->uploadableSdTypes) &&
ReadParam(reader, &out->vendor);
}
};
template <> template <>
struct ParamTraits<mozilla::webgl::ExtensionBits> final struct ParamTraits<mozilla::webgl::ExtensionBits> final

View File

@@ -14,8 +14,8 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "GLContextTypes.h"
#include "GLDefs.h" #include "GLDefs.h"
#include "GLVendor.h"
#include "ImageContainer.h" #include "ImageContainer.h"
#include "mozilla/Casting.h" #include "mozilla/Casting.h"
#include "mozilla/CheckedInt.h" #include "mozilla/CheckedInt.h"
@@ -660,16 +660,9 @@ struct Limits final {
struct InitContextResult final { struct InitContextResult final {
std::string error; std::string error;
WebGLContextOptions options; WebGLContextOptions options;
gl::GLVendor vendor;
bool isRgb8Renderable;
uint8_t _padding;
webgl::Limits limits; webgl::Limits limits;
EnumMask<layers::SurfaceDescriptor::Type> uploadableSdTypes; EnumMask<layers::SurfaceDescriptor::Type> uploadableSdTypes;
gl::GLVendor vendor;
auto MutTiedFields() {
return std::tie(error, options, vendor, isRgb8Renderable, _padding, limits,
uploadableSdTypes);
}
}; };
// - // -

View File

@@ -7136,6 +7136,7 @@ subsuite = webgl2-core
subsuite = webgl2-core subsuite = webgl2-core
[generated/test_2_conformance2__textures__misc__npot-video-sizing.html] [generated/test_2_conformance2__textures__misc__npot-video-sizing.html]
subsuite = webgl2-core subsuite = webgl2-core
fail-if = (os == 'android')
[generated/test_2_conformance2__textures__misc__origin-clean-conformance-offscreencanvas.html] [generated/test_2_conformance2__textures__misc__origin-clean-conformance-offscreencanvas.html]
subsuite = webgl2-core subsuite = webgl2-core
skip-if = 1 skip-if = 1
@@ -12908,7 +12909,7 @@ subsuite = webgl1-core
skip-if = (os == 'android') skip-if = (os == 'android')
[generated/test_conformance__textures__misc__texture-npot-video.html] [generated/test_conformance__textures__misc__texture-npot-video.html]
subsuite = webgl1-core subsuite = webgl1-core
skip-if = win11_2009 # win11 - 50/50 intermittent skip-if = (os == 'android') || win11_2009 # win11 - 50/50 intermittent
[generated/test_conformance__textures__misc__texture-npot.html] [generated/test_conformance__textures__misc__texture-npot.html]
subsuite = webgl1-core subsuite = webgl1-core
skip-if = (os == 'android') skip-if = (os == 'android')

View File

@@ -71,8 +71,12 @@ fail-if = (os == 'mac' && !apple_silicon)
[generated/test_2_conformance2__programs__gl-get-frag-data-location.html] [generated/test_2_conformance2__programs__gl-get-frag-data-location.html]
# gl.getFragDataLocation(programEs2, 'gl_FragColor') should be -1. Was 0. # gl.getFragDataLocation(programEs2, 'gl_FragColor') should be -1. Was 0.
fail-if = (os == 'android') fail-if = (os == 'android')
[generated/test_2_conformance2__textures__misc__npot-video-sizing.html]
# Should be green -- that indicates the video texture's height was correct
fail-if = (os == 'android')
[generated/test_conformance__textures__misc__texture-npot-video.html] [generated/test_conformance__textures__misc__texture-npot-video.html]
skip-if = win11_2009 # win11 - 50/50 intermittent # application crashed [@ mozilla::layers::GLImage::GetAsSoure]
skip-if = (os == 'android') || win11_2009 # win11 - 50/50 intermittent
#################### ####################
# Bugs surfaced during fx93 CTS update # Bugs surfaced during fx93 CTS update

View File

@@ -37,6 +37,7 @@
#include "GLConsts.h" #include "GLConsts.h"
#include "GLDefs.h" #include "GLDefs.h"
#include "GLTypes.h" #include "GLTypes.h"
#include "GLVendor.h"
#include "nsRegionFwd.h" #include "nsRegionFwd.h"
#include "nsString.h" #include "nsString.h"
#include "GLContextTypes.h" #include "GLContextTypes.h"

View File

@@ -7,7 +7,6 @@
#define GLCONTEXT_TYPES_H_ #define GLCONTEXT_TYPES_H_
#include "GLTypes.h" #include "GLTypes.h"
#include "mozilla/DefineEnum.h"
#include "mozilla/TypedEnumBits.h" #include "mozilla/TypedEnumBits.h"
namespace mozilla { namespace mozilla {
@@ -48,12 +47,6 @@ struct GLContextDesc final : public GLContextCreateDesc {
bool isOffscreen = false; bool isOffscreen = false;
}; };
// -
MOZ_DEFINE_ENUM_CLASS_WITH_BASE(GLVendor, uint8_t,
(Intel, NVIDIA, ATI, Qualcomm, Imagination,
Nouveau, Vivante, VMware, ARM, Other));
} /* namespace gl */ } /* namespace gl */
} /* namespace mozilla */ } /* namespace mozilla */

20
gfx/gl/GLVendor.h Normal file
View File

@@ -0,0 +1,20 @@
/* -*- mode: c++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* this source code form is subject to the terms of the mozilla public
* license, v. 2.0. if a copy of the mpl was not distributed with this
* file, you can obtain one at http://mozilla.org/mpl/2.0/. */
#ifndef GLVENDOR_H_
#define GLVENDOR_H_
#include "mozilla/DefineEnum.h"
namespace mozilla {
namespace gl {
MOZ_DEFINE_ENUM(GLVendor, (Intel, NVIDIA, ATI, Qualcomm, Imagination, Nouveau,
Vivante, VMware, ARM, Other));
}
} // namespace mozilla
#endif /* GLVENDOR_H_ */

View File

@@ -42,6 +42,7 @@ EXPORTS += [
"GLTextureImage.h", "GLTextureImage.h",
"GLTypes.h", "GLTypes.h",
"GLUploadHelpers.h", "GLUploadHelpers.h",
"GLVendor.h",
"HeapCopyOfStackArray.h", "HeapCopyOfStackArray.h",
"MozFramebuffer.h", "MozFramebuffer.h",
"ScopedGLHelpers.h", "ScopedGLHelpers.h",