Ticket #16005: 0001-Bug-16005-Relax-minimal-mode.patch

File 0001-Bug-16005-Relax-minimal-mode.patch, 6.1 KB (added by mikeperry, 4 years ago)

Patch against Arthur's FF38 branch.

  • dom/canvas/WebGLContext.cpp

    From a85daf5a48ab6cacb698a197af1251288ca4ab19 Mon Sep 17 00:00:00 2001
    From: Mike Perry <mikeperry-git@torproject.org>
    Date: Fri, 19 Jun 2015 20:20:00 -0700
    Subject: [PATCH] Bug #16005: Relax minimal mode.
    
    Use min values from a 2013 Moto E and a 2009 laptop with integrated graphics.
    ---
     dom/canvas/WebGLContext.cpp         |  5 ++++-
     dom/canvas/WebGLContext.h           | 26 ++++++++++++++++----------
     dom/canvas/WebGLContextState.cpp    | 32 ++++++++++++++++++++++++++++++++
     dom/canvas/WebGLContextValidate.cpp |  3 ---
     4 files changed, 52 insertions(+), 14 deletions(-)
    
    diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp
    index 1c22c27..da6442c 100644
    a b WebGLContext::GetContextAttributes(Nullable<dom::WebGLContextAttributes>& retval 
    12451245    result.mAlpha.Construct(mOptions.alpha);
    12461246    result.mDepth = mOptions.depth;
    12471247    result.mStencil = mOptions.stencil;
    1248     result.mAntialias = mOptions.antialias;
     1248    if (MinCapabilityMode())
     1249        result.mAntialias = false;
     1250    else
     1251        result.mAntialias = mOptions.antialias;
    12491252    result.mPremultipliedAlpha = mOptions.premultipliedAlpha;
    12501253    result.mPreserveDrawingBuffer = mOptions.preserveDrawingBuffer;
    12511254}
  • dom/canvas/WebGLContext.h

    diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h
    index 63c4091..18ff2a3 100644
    a b class nsIDocShell; 
    5353 *
    5454 * Exceptions: some of the following values are set to higher values than in the spec because
    5555 * the values in the spec are ridiculously low. They are explicitly marked below
     56 *
     57 * Tor Browser Modifications: The following values are the minimum between a 2009 laptop, and a 2013 Moto E
    5658 */
    57 #define MINVALUE_GL_MAX_TEXTURE_SIZE                  1024  // Different from the spec, which sets it to 64 on page 162
    58 #define MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE         512   // Different from the spec, which sets it to 16 on page 162
    59 #define MINVALUE_GL_MAX_VERTEX_ATTRIBS                8     // Page 164
    60 #define MINVALUE_GL_MAX_FRAGMENT_UNIFORM_VECTORS      16    // Page 164
    61 #define MINVALUE_GL_MAX_VERTEX_UNIFORM_VECTORS        128   // Page 164
    62 #define MINVALUE_GL_MAX_VARYING_VECTORS               8     // Page 164
    63 #define MINVALUE_GL_MAX_TEXTURE_IMAGE_UNITS           8     // Page 164
    64 #define MINVALUE_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS    0     // Page 164
    65 #define MINVALUE_GL_MAX_RENDERBUFFER_SIZE             1024  // Different from the spec, which sets it to 1 on page 164
    66 #define MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS  8     // Page 164
     59#define MINVALUE_GL_MAX_TEXTURE_SIZE                  4096  // Different from the spec, which sets it to 64 on page 162
     60#define MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE         2048   // Different from the spec, which sets it to 16 on page 162
     61#define MINVALUE_GL_MAX_VERTEX_ATTRIBS                16     // Page 164
     62#define MINVALUE_GL_MAX_FRAGMENT_UNIFORM_VECTORS      224    // Page 164
     63#define MINVALUE_GL_MAX_VERTEX_UNIFORM_VECTORS        256   // Page 164
     64#define MINVALUE_GL_MAX_VARYING_VECTORS               16     // Page 164
     65#define MINVALUE_GL_MAX_TEXTURE_IMAGE_UNITS           16     // Page 164
     66#define MINVALUE_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS    16     // Page 164
     67#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE             4096  // Different from the spec, which sets it to 1 on page 164
     68#define MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS  32     // Page 164
     69/* Set specifically for fingerprinting */
     70#define MINVALUE_GL_ALIASED_LINE_WIDTH_RANGE          5
     71#define MINVALUE_GL_ALIASED_POINT_SIZE_RANGE          255
     72#define MINVALUE_GL_MAX_VIEWPORT_DIMS                 4096
    6773
    6874namespace mozilla {
    6975
  • dom/canvas/WebGLContextState.cpp

    diff --git a/dom/canvas/WebGLContextState.cpp b/dom/canvas/WebGLContextState.cpp
    index fe7f078..7646ce9 100644
    a b WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) 
    134134            case LOCAL_GL_MAX_RENDERBUFFER_SIZE:
    135135                return JS::Int32Value(MINVALUE_GL_MAX_RENDERBUFFER_SIZE);
    136136
     137            case LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
     138                return JS::Int32Value(MINVALUE_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);
     139
     140            //case LOCAL_GL_DEPTH_RANGE:
     141            case LOCAL_GL_ALIASED_POINT_SIZE_RANGE: {
     142                GLfloat fv[2] = { 1, MINVALUE_GL_ALIASED_POINT_SIZE_RANGE };
     143                JSObject* obj = Float32Array::Create(cx, this, 2, fv);
     144                if (!obj) {
     145                    rv = NS_ERROR_OUT_OF_MEMORY;
     146                }
     147                return JS::ObjectOrNullValue(obj);
     148            }
     149
     150            case LOCAL_GL_ALIASED_LINE_WIDTH_RANGE: {
     151                GLfloat fv[2] = { 1, MINVALUE_GL_ALIASED_LINE_WIDTH_RANGE };
     152                JSObject* obj = Float32Array::Create(cx, this, 2, fv);
     153                if (!obj) {
     154                    rv = NS_ERROR_OUT_OF_MEMORY;
     155                }
     156                return JS::ObjectOrNullValue(obj);
     157            }
     158
     159            case LOCAL_GL_MAX_VIEWPORT_DIMS: {
     160                GLint iv[2] = { MINVALUE_GL_MAX_VIEWPORT_DIMS, MINVALUE_GL_MAX_VIEWPORT_DIMS };
     161                JSObject* obj = Int32Array::Create(cx, this, 2, iv);
     162                if (!obj) {
     163                    rv = NS_ERROR_OUT_OF_MEMORY;
     164                }
     165                return JS::ObjectOrNullValue(obj);
     166            }
     167
     168
    137169            default:
    138170                // Return the real value; we're not overriding this one
    139171                break;
  • dom/canvas/WebGLContextValidate.cpp

    diff --git a/dom/canvas/WebGLContextValidate.cpp b/dom/canvas/WebGLContextValidate.cpp
    index 703fd0f..a6fb0fb 100644
    a b WebGLContext::InitAndValidateGL() 
    17001700    mCanLoseContextInForeground = Preferences::GetBool("webgl.can-lose-context-in-foreground", true);
    17011701    mRestoreWhenVisible = Preferences::GetBool("webgl.restore-context-when-visible", true);
    17021702
    1703     if (MinCapabilityMode())
    1704         mDisableFragHighP = true;
    1705 
    17061703    // These are the default values, see 6.2 State tables in the
    17071704    // OpenGL ES 2.0.25 spec.
    17081705    mColorWriteMask[0] = 1;