From 36478b9f772e474a52af33f9545c8a681ae12690 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 18 Apr 2019 22:29:27 -0700 Subject: [PATCH] iris: Enable the dual_color_blend_by_location driconf option. This fixes rendering in Unigine Valley 1.0 and Heaven 4.0. --- src/gallium/drivers/iris/driinfo_iris.h | 4 ++++ src/gallium/drivers/iris/iris_screen.c | 4 ++++ src/gallium/drivers/iris/iris_screen.h | 6 ++++++ src/gallium/drivers/iris/iris_state.c | 10 ++++++++++ 4 files changed, 24 insertions(+) diff --git a/src/gallium/drivers/iris/driinfo_iris.h b/src/gallium/drivers/iris/driinfo_iris.h index 0d513bc0468..edfdde44028 100644 --- a/src/gallium/drivers/iris/driinfo_iris.h +++ b/src/gallium/drivers/iris/driinfo_iris.h @@ -1 +1,5 @@ // iris specific driconf options + +DRI_CONF_SECTION_DEBUG + DRI_CONF_DUAL_COLOR_BLEND_BY_LOCATION("false") +DRI_CONF_SECTION_END diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index 3e1cabafb70..38cdbc1507d 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -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); diff --git a/src/gallium/drivers/iris/iris_screen.h b/src/gallium/drivers/iris/iris_screen.h index 8a75374429f..a8f33dc3236 100644 --- a/src/gallium/drivers/iris/iris_screen.h +++ b/src/gallium/drivers/iris/iris_screen.h @@ -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; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 2c85ba3778a..12059fbcd3d 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -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 */ } -- 2.30.2