iris: Enable the dual_color_blend_by_location driconf option.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 19 Apr 2019 05:29:27 +0000 (22:29 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 22 Apr 2019 16:36:36 +0000 (09:36 -0700)
This fixes rendering in Unigine Valley 1.0 and Heaven 4.0.

src/gallium/drivers/iris/driinfo_iris.h
src/gallium/drivers/iris/iris_screen.c
src/gallium/drivers/iris/iris_screen.h
src/gallium/drivers/iris/iris_state.c

index 0d513bc04688fc2bb26028476a2a97c2b9fb3b1c..edfdde44028d5577444eb45ce1a3fac21531edc6 100644 (file)
@@ -1 +1,5 @@
 // iris specific driconf options
+
+DRI_CONF_SECTION_DEBUG
+   DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION("false")
+DRI_CONF_SECTION_END
index 3e1cabafb701522e54273dab3a34d0919e4042e6..38cdbc1507dac9daf257d0cf061c0d85a1e6a698 100644 (file)
@@ -43,6 +43,7 @@
 #include "util/u_transfer_helper.h"
 #include "util/u_upload_mgr.h"
 #include "util/ralloc.h"
+#include "util/xmlconfig.h"
 #include "drm-uapi/i915_drm.h"
 #include "iris_context.h"
 #include "iris_defines.h"
@@ -584,6 +585,9 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
 
    brw_process_intel_debug_variable();
 
+   screen->driconf.dual_color_blend_by_location =
+      driQueryOptionb(config->options, "dual_color_blend_by_location");
+
    screen->precompile = env_var_as_boolean("shader_precompile", true);
 
    isl_device_init(&screen->isl_dev, &screen->devinfo, false);
index 8a75374429f5ca5346a3a7562e97a956eea90bce..a8f33dc32368676e80c4db97dfd32451c3028308 100644 (file)
@@ -60,6 +60,12 @@ struct iris_screen {
    /** Precompile shaders at link time?  (Can be disabled for debugging.) */
    bool precompile;
 
+   /** driconf options and application workarounds */
+   struct {
+      /** Dual color blend by location instead of index (for broken apps) */
+      bool dual_color_blend_by_location;
+   } driconf;
+
    unsigned subslice_total;
 
    struct gen_device_info devinfo;
index 2c85ba3778a6520a811d9ff70d590a4ef5a6c725..12059fbcd3d506d31abfaaee6d4e8bfd814d5682 100644 (file)
@@ -88,6 +88,7 @@
 #include "pipe/p_state.h"
 #include "pipe/p_context.h"
 #include "pipe/p_screen.h"
+#include "util/u_dual_blend.h"
 #include "util/u_inlines.h"
 #include "util/u_format.h"
 #include "util/u_framebuffer.h"
@@ -860,6 +861,9 @@ struct iris_blend_state {
 
    /** Bitfield of whether color writes are enabled for RT[i] */
    uint8_t color_write_enables;
+
+   /** Does RT[0] use dual color blending? */
+   bool dual_color_blending;
 };
 
 static enum pipe_blendfactor
@@ -972,6 +976,7 @@ iris_create_blend_state(struct pipe_context *ctx,
       /* bl.AlphaTestEnable and bs.AlphaTestFunction are filled in later. */
    }
 
+   cso->dual_color_blending = util_blend_state_is_dual(state, 0);
 
    return cso;
 }
@@ -3348,6 +3353,7 @@ static void
 iris_populate_fs_key(const struct iris_context *ice,
                      struct brw_wm_prog_key *key)
 {
+   struct iris_screen *screen = (void *) ice->ctx.screen;
    const struct pipe_framebuffer_state *fb = &ice->state.framebuffer;
    const struct iris_depth_stencil_alpha_state *zsa = ice->state.cso_zsa;
    const struct iris_rasterizer_state *rast = ice->state.cso_rast;
@@ -3369,6 +3375,10 @@ iris_populate_fs_key(const struct iris_context *ice,
 
    key->coherent_fb_fetch = true;
 
+   key->force_dual_color_blend =
+      screen->driconf.dual_color_blend_by_location &&
+      (blend->blend_enables & 1) && blend->dual_color_blending;
+
    /* TODO: support key->force_dual_color_blend for Unigine */
    /* TODO: Respect glHint for key->high_quality_derivatives */
 }