Revert "i915: Always enable GL 2.0 support."
authorMatt Turner <mattst88@gmail.com>
Mon, 30 Jan 2017 02:20:10 +0000 (18:20 -0800)
committerMatt Turner <mattst88@gmail.com>
Wed, 15 Feb 2017 22:52:27 +0000 (14:52 -0800)
This partially reverts commit 97217a40f97cdeae0304798b607f704deb0c3558.
It leaves ES 2.0 support in place per Ian's suggestion, because ES 2.0
is designed to work on hardware like i915.

Chrome only uses the GPU if you have GL >= 2.0, and using i915 (and
prog_execute) actually hurt performance compared with the software
paths.

src/mesa/drivers/dri/i915/intel_extensions.c
src/mesa/drivers/dri/i915/intel_screen.c

index ab7820f1232ebb0db60c8a14bd3c7c31f79c10ee..4f2c6fa34e34b6b02890c0deb6aa83c800c18e4e 100644 (file)
@@ -92,8 +92,12 @@ intelInitExtensions(struct gl_context *ctx)
       ctx->Extensions.ATI_separate_stencil = true;
       ctx->Extensions.ATI_texture_env_combine3 = true;
       ctx->Extensions.NV_texture_env_combine4 = true;
-      ctx->Extensions.ARB_fragment_shader = true;
-      ctx->Extensions.ARB_occlusion_query = true;
+
+      if (driQueryOptionb(&intel->optionCache, "fragment_shader"))
+         ctx->Extensions.ARB_fragment_shader = true;
+
+      if (driQueryOptionb(&intel->optionCache, "stub_occlusion_query"))
+         ctx->Extensions.ARB_occlusion_query = true;
    }
 
    if (intel->ctx.Mesa_DXTn
index 5c7c06a9c10b017e1d022422c65f137fa795c675..fe86179007446cae1652a5fbd377fcfb4805e472 100644 (file)
@@ -62,6 +62,10 @@ DRI_CONF_BEGIN
         DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).")
       DRI_CONF_OPT_END
 
+      DRI_CONF_OPT_BEGIN_B(fragment_shader, "true")
+        DRI_CONF_DESC(en, "Enable limited ARB_fragment_shader support on 915/945.")
+      DRI_CONF_OPT_END
+
    DRI_CONF_SECTION_END
    DRI_CONF_SECTION_QUALITY
       DRI_CONF_FORCE_S3TC_ENABLE("false")
@@ -75,6 +79,10 @@ DRI_CONF_BEGIN
       DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS("false")
       DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED("false")
 
+      DRI_CONF_OPT_BEGIN_B(stub_occlusion_query, "false")
+        DRI_CONF_DESC(en, "Enable stub ARB_occlusion_query support on 915/945.")
+      DRI_CONF_OPT_END
+
       DRI_CONF_OPT_BEGIN_B(shader_precompile, "true")
         DRI_CONF_DESC(en, "Perform code generation at shader link time.")
       DRI_CONF_OPT_END
@@ -1125,12 +1133,21 @@ set_max_gl_versions(struct intel_screen *screen)
    __DRIscreen *psp = screen->driScrnPriv;
 
    switch (screen->gen) {
-   case 3:
+   case 3: {
+      bool has_fragment_shader = driQueryOptionb(&screen->optionCache, "fragment_shader");
+      bool has_occlusion_query = driQueryOptionb(&screen->optionCache, "stub_occlusion_query");
+
       psp->max_gl_core_version = 0;
       psp->max_gl_es1_version = 11;
-      psp->max_gl_compat_version = 21;
       psp->max_gl_es2_version = 20;
+
+      if (has_fragment_shader && has_occlusion_query) {
+         psp->max_gl_compat_version = 21;
+      } else {
+         psp->max_gl_compat_version = 14;
+      }
       break;
+   }
    case 2:
       psp->max_gl_core_version = 0;
       psp->max_gl_compat_version = 13;