i965/blorp: Add an "exec" function pointer to blorp_context

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
Jason Ekstrand 2016-08-18 10:02:03 -07:00
parent cea360a708
commit bc159ff0f7
8 changed files with 50 additions and 56 deletions

View file

@ -235,31 +235,6 @@ brw_blorp_compile_nir_shader(struct brw_context *brw, struct nir_shader *nir,
return program;
}
void
brw_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params)
{
switch (brw->gen) {
case 6:
gen6_blorp_exec(brw, params);
break;
case 7:
if (brw->is_haswell)
gen75_blorp_exec(brw, params);
else
gen7_blorp_exec(brw, params);
break;
case 8:
gen8_blorp_exec(brw, params);
break;
case 9:
gen9_blorp_exec(brw, params);
break;
default:
/* BLORP is not supported before Gen6. */
unreachable("not reached");
}
}
void
blorp_gen6_hiz_op(struct brw_context *brw, struct brw_blorp_surf *surf,
unsigned level, unsigned layer, enum gen6_hiz_op op)
@ -327,5 +302,8 @@ blorp_gen6_hiz_op(struct brw_context *brw, struct brw_blorp_surf *surf,
unreachable("not reached");
}
brw_blorp_exec(brw, &params);
struct blorp_batch batch;
blorp_batch_init(&brw->blorp, &batch, brw);
brw->blorp.exec(&batch, &params);
blorp_batch_finish(&batch);
}

View file

@ -37,6 +37,9 @@ struct brw_wm_prog_key;
extern "C" {
#endif
struct blorp_batch;
struct brw_blorp_params;
struct blorp_context {
void *driver_ctx;
@ -56,6 +59,8 @@ struct blorp_context {
const void *kernel, uint32_t kernel_size,
const void *prog_data, uint32_t prog_data_size,
uint32_t *kernel_out, void *prog_data_out);
void (*exec)(struct blorp_batch *batch,
const struct brw_blorp_params *params);
};
void blorp_init(struct blorp_context *blorp, void *driver_ctx,

View file

@ -1648,5 +1648,8 @@ brw_blorp_blit(struct brw_context *brw,
swizzle_to_scs(GET_SWZ(src_swizzle, i));
}
brw_blorp_exec(brw, &params);
struct blorp_batch batch;
blorp_batch_init(&brw->blorp, &batch, brw);
brw->blorp.exec(&batch, &params);
blorp_batch_finish(&batch);
}

View file

@ -118,7 +118,10 @@ blorp_fast_clear(struct brw_context *brw, const struct brw_blorp_surf *surf,
brw_blorp_surface_info_init(brw, &params.dst, surf, level, layer,
surf->surf->format, true);
brw_blorp_exec(brw, &params);
struct blorp_batch batch;
blorp_batch_init(&brw->blorp, &batch, brw);
brw->blorp.exec(&batch, &params);
blorp_batch_finish(&batch);
}
@ -164,7 +167,10 @@ blorp_clear(struct brw_context *brw, const struct brw_blorp_surf *surf,
brw_blorp_surface_info_init(brw, &params.dst, surf, level, layer,
format, true);
brw_blorp_exec(brw, &params);
struct blorp_batch batch;
blorp_batch_init(&brw->blorp, &batch, brw);
brw->blorp.exec(&batch, &params);
blorp_batch_finish(&batch);
}
void
@ -194,5 +200,8 @@ brw_blorp_ccs_resolve(struct brw_context *brw, struct brw_blorp_surf *surf,
brw_blorp_params_get_clear_kernel(brw, &params, true);
brw_blorp_exec(brw, &params);
struct blorp_batch batch;
blorp_batch_init(&brw->blorp, &batch, brw);
brw->blorp.exec(&batch, &params);
blorp_batch_finish(&batch);
}

View file

@ -183,27 +183,6 @@ struct brw_blorp_params
void
brw_blorp_params_init(struct brw_blorp_params *params);
void
brw_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params);
void
gen6_blorp_exec(struct brw_context *brw,
const struct brw_blorp_params *params);
void
gen7_blorp_exec(struct brw_context *brw,
const struct brw_blorp_params *params);
void
gen75_blorp_exec(struct brw_context *brw,
const struct brw_blorp_params *params);
void
gen8_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params);
void
gen9_blorp_exec(struct brw_context *brw, const struct brw_blorp_params *params);
struct brw_blorp_blit_prog_key
{
/* Number of samples per pixel that have been configured in the surface

View file

@ -71,21 +71,29 @@ brw_blorp_init(struct brw_context *brw)
brw->blorp.mocs.tex = 0;
brw->blorp.mocs.rb = 0;
brw->blorp.mocs.vb = 0;
brw->blorp.exec = gen6_blorp_exec;
break;
case 7:
brw->blorp.mocs.tex = GEN7_MOCS_L3;
brw->blorp.mocs.rb = GEN7_MOCS_L3;
brw->blorp.mocs.vb = GEN7_MOCS_L3;
if (brw->is_haswell) {
brw->blorp.exec = gen75_blorp_exec;
} else {
brw->blorp.exec = gen7_blorp_exec;
}
break;
case 8:
brw->blorp.mocs.tex = BDW_MOCS_WB;
brw->blorp.mocs.rb = BDW_MOCS_PTE;
brw->blorp.mocs.vb = BDW_MOCS_WB;
brw->blorp.exec = gen8_blorp_exec;
break;
case 9:
brw->blorp.mocs.tex = SKL_MOCS_WB;
brw->blorp.mocs.rb = SKL_MOCS_PTE;
brw->blorp.mocs.vb = SKL_MOCS_WB;
brw->blorp.exec = gen9_blorp_exec;
break;
default:
unreachable("Invalid gen");

View file

@ -60,6 +60,17 @@ void
intel_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt,
unsigned int level, unsigned int layer, enum gen6_hiz_op op);
void gen6_blorp_exec(struct blorp_batch *batch,
const struct brw_blorp_params *params);
void gen7_blorp_exec(struct blorp_batch *batch,
const struct brw_blorp_params *params);
void gen75_blorp_exec(struct blorp_batch *batch,
const struct brw_blorp_params *params);
void gen8_blorp_exec(struct blorp_batch *batch,
const struct brw_blorp_params *params);
void gen9_blorp_exec(struct blorp_batch *batch,
const struct brw_blorp_params *params);
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -31,6 +31,8 @@
#include "genX_blorp_exec.h"
#include "brw_blorp.h"
static void *
blorp_emit_dwords(struct blorp_batch *batch, unsigned n)
{
@ -172,9 +174,11 @@ blorp_emit_3dstate_multisample(struct blorp_batch *batch, unsigned samples)
}
void
genX(blorp_exec)(struct brw_context *brw,
genX(blorp_exec)(struct blorp_batch *batch,
const struct brw_blorp_params *params)
{
assert(batch->blorp->driver_ctx == batch->driver_batch);
struct brw_context *brw = batch->driver_batch;
struct gl_context *ctx = &brw->ctx;
const uint32_t estimated_max_batch_usage = GEN_GEN >= 8 ? 1800 : 1500;
bool check_aperture_failed_once = false;
@ -213,10 +217,7 @@ retry:
brw_emit_depth_stall_flushes(brw);
struct blorp_batch batch;
blorp_batch_init(&brw->blorp, &batch, brw);
blorp_exec(&batch, params);
blorp_batch_finish(&batch);
blorp_exec(batch, params);
/* Make sure we didn't wrap the batch unintentionally, and make sure we
* reserved enough space that a wrap will never happen.