From: Eric Anholt Date: Sun, 26 Aug 2012 22:09:23 +0000 (-0700) Subject: i965: Replace general sw fallback support with a manual check for rendermode. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=993c52d0be5bdf0e30e64ab4c6e1347c5dcb8e3b;p=mesa.git i965: Replace general sw fallback support with a manual check for rendermode. There were no other cases that set it any more. Reviewed-by: Kenneth Graunke Reviewed-by: Ian Romanick --- diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources index 334bfd92406..d6d189a1841 100644 --- a/src/mesa/drivers/dri/i965/Makefile.sources +++ b/src/mesa/drivers/dri/i965/Makefile.sources @@ -47,7 +47,6 @@ i965_C_FILES = \ brw_eu_debug.c \ brw_eu_emit.c \ brw_eu_util.c \ - brw_fallback.c \ brw_gs.c \ brw_gs_emit.c \ brw_gs_state.c \ diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index b335e9616f6..43657704070 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -491,12 +491,6 @@ retry: if (brw->state.dirty.brw) { intel->no_batch_wrap = true; brw_upload_state(brw); - - if (unlikely(brw->intel.Fallback)) { - intel->no_batch_wrap = false; - retval = false; - goto out; - } } if (intel->gen >= 7) @@ -533,7 +527,6 @@ retry: if (intel->always_flush_batch) intel_batchbuffer_flush(intel); - out: brw_state_cache_check_size(brw); brw_postdraw_set_buffers_need_resolve(brw); @@ -551,7 +544,6 @@ void brw_draw_prims( struct gl_context *ctx, struct gl_transform_feedback_object *tfb_vertcount ) { const struct gl_client_array **arrays = ctx->Array._DrawArrays; - bool retval; if (!_mesa_check_conditional_render(ctx)) return; @@ -578,20 +570,23 @@ void brw_draw_prims( struct gl_context *ctx, } } - /* Make a first attempt at drawing: - */ - retval = brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); - - /* Otherwise, we really are out of memory. Pass the drawing - * command to the software tnl module and which will in turn call - * swrast to do the drawing. + /* Do GL_SELECT and GL_FEEDBACK rendering using swrast, even though it + * won't support all the extensions we support. */ - if (!retval) { - _swsetup_Wakeup(ctx); - _tnl_wakeup(ctx); + if (ctx->RenderMode != GL_RENDER) { + perf_debug("%s render mode not supported in hardware\n", + _mesa_lookup_enum_by_nr(ctx->RenderMode)); + _swsetup_Wakeup(ctx); + _tnl_wakeup(ctx); _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); + return; } + /* Try drawing with the hardware, but don't do anything else if we can't + * manage it. swrast doesn't support our featureset, so we can't fall back + * to it. + */ + brw_try_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); } void brw_draw_init( struct brw_context *brw ) diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c deleted file mode 100644 index 691acfcff0b..00000000000 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************** - * - * Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "main/glheader.h" -#include "main/context.h" -#include "main/enums.h" -#include "main/imports.h" -#include "main/macros.h" -#include "main/mtypes.h" - -#include "swrast_setup/swrast_setup.h" -#include "swrast/swrast.h" -#include "tnl/tnl.h" -#include "brw_context.h" - -#define FILE_DEBUG_FLAG DEBUG_PERF - -static bool do_check_fallback(struct brw_context *brw) -{ - struct gl_context *ctx = &brw->intel.ctx; - - /* _NEW_RENDERMODE - */ - if (ctx->RenderMode != GL_RENDER) { - DBG("FALLBACK: render mode\n"); - return true; - } - - return false; -} - -static void check_fallback(struct brw_context *brw) -{ - brw->intel.Fallback = do_check_fallback(brw); -} - -const struct brw_tracked_state brw_check_fallback = { - .dirty = { - .mesa = _NEW_RENDERMODE | _NEW_STENCIL, - .brw = 0, - .cache = 0 - }, - .emit = check_fallback -}; - - - - -/** - * Called by the INTEL_FALLBACK() macro. - * NOTE: this is a no-op for the i965 driver. The brw->intel.Fallback - * field is treated as a boolean, not a bitmask. It's only set in a - * couple of places. - */ -void intelFallback( struct intel_context *intel, GLuint bit, bool mode ) -{ -} - - - diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 4e78fae5e9b..a80ee865a9e 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -44,7 +44,6 @@ enum intel_msaa_layout; extern const struct brw_tracked_state brw_blend_constant_color; extern const struct brw_tracked_state brw_cc_vp; extern const struct brw_tracked_state brw_cc_unit; -extern const struct brw_tracked_state brw_check_fallback; extern const struct brw_tracked_state brw_clip_prog; extern const struct brw_tracked_state brw_clip_unit; extern const struct brw_tracked_state brw_vs_pull_constants; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index c3e6de49779..7291988c8a4 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -44,8 +44,6 @@ */ static const struct brw_tracked_state *gen4_atoms[] = { - &brw_check_fallback, - &brw_wm_input_sizes, &brw_vs_prog, /* must do before GS prog, state base address. */ &brw_gs_prog, /* must do before state base address */ @@ -111,8 +109,6 @@ static const struct brw_tracked_state *gen4_atoms[] = static const struct brw_tracked_state *gen6_atoms[] = { - &brw_check_fallback, - &brw_wm_input_sizes, &brw_vs_prog, /* must do before state base address */ &brw_gs_prog, /* must do before state base address */ @@ -185,8 +181,6 @@ static const struct brw_tracked_state *gen6_atoms[] = const struct brw_tracked_state *gen7_atoms[] = { - &brw_check_fallback, - &brw_wm_input_sizes, &brw_vs_prog, &brw_wm_prog, @@ -466,8 +460,6 @@ void brw_upload_state(struct brw_context *brw) if ((state->mesa | state->cache | state->brw) == 0) return; - brw->intel.Fallback = false; /* boolean, not bitfield */ - intel_check_front_buffer_rendering(intel); if (unlikely(INTEL_DEBUG)) { @@ -483,9 +475,6 @@ void brw_upload_state(struct brw_context *brw) const struct brw_tracked_state *atom = brw->atoms[i]; struct brw_state_flags generated; - if (brw->intel.Fallback) - break; - if (check_state(state, &atom->dirty)) { atom->emit(brw); } @@ -505,9 +494,6 @@ void brw_upload_state(struct brw_context *brw) for (i = 0; i < brw->num_atoms; i++) { const struct brw_tracked_state *atom = brw->atoms[i]; - if (brw->intel.Fallback) - break; - if (check_state(state, &atom->dirty)) { atom->emit(brw); } @@ -526,6 +512,5 @@ void brw_upload_state(struct brw_context *brw) } } - if (!brw->intel.Fallback) - memset(state, 0, sizeof(*state)); + memset(state, 0, sizeof(*state)); }