drm/i915: Use the precomputed value for whether to enable command parsing
As i915.enable_cmd_parser is an unsafe option, make it read-only at runtime. Now that it is constant, we can use the value determined during initialisation as to whether we need the cmdparser at execbuffer time. v2: Remove the inline for its single user, it is clear enough (and shorter) without! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20161124125851.6615-1-chris@chris-wilson.co.uk
This commit is contained in:
Родитель
9607ae7971
Коммит
41736a8e33
|
@ -1131,27 +1131,6 @@ unpin_src:
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* intel_engine_needs_cmd_parser() - should a given engine use software
|
|
||||||
* command parsing?
|
|
||||||
* @engine: the engine in question
|
|
||||||
*
|
|
||||||
* Only certain platforms require software batch buffer command parsing, and
|
|
||||||
* only when enabled via module parameter.
|
|
||||||
*
|
|
||||||
* Return: true if the engine requires software command parsing
|
|
||||||
*/
|
|
||||||
bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine)
|
|
||||||
{
|
|
||||||
if (!engine->needs_cmd_parser)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!USES_PPGTT(engine->i915))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (i915.enable_cmd_parser == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool check_cmd(const struct intel_engine_cs *engine,
|
static bool check_cmd(const struct intel_engine_cs *engine,
|
||||||
const struct drm_i915_cmd_descriptor *desc,
|
const struct drm_i915_cmd_descriptor *desc,
|
||||||
const u32 *cmd, u32 length,
|
const u32 *cmd, u32 length,
|
||||||
|
@ -1375,7 +1354,7 @@ int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv)
|
||||||
|
|
||||||
/* If the command parser is not enabled, report 0 - unsupported */
|
/* If the command parser is not enabled, report 0 - unsupported */
|
||||||
for_each_engine(engine, dev_priv, id) {
|
for_each_engine(engine, dev_priv, id) {
|
||||||
if (intel_engine_needs_cmd_parser(engine)) {
|
if (engine->needs_cmd_parser) {
|
||||||
active = true;
|
active = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3452,7 +3452,6 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type);
|
||||||
int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv);
|
int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv);
|
||||||
void intel_engine_init_cmd_parser(struct intel_engine_cs *engine);
|
void intel_engine_init_cmd_parser(struct intel_engine_cs *engine);
|
||||||
void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine);
|
void intel_engine_cleanup_cmd_parser(struct intel_engine_cs *engine);
|
||||||
bool intel_engine_needs_cmd_parser(struct intel_engine_cs *engine);
|
|
||||||
int intel_engine_cmd_parser(struct intel_engine_cs *engine,
|
int intel_engine_cmd_parser(struct intel_engine_cs *engine,
|
||||||
struct drm_i915_gem_object *batch_obj,
|
struct drm_i915_gem_object *batch_obj,
|
||||||
struct drm_i915_gem_object *shadow_batch_obj,
|
struct drm_i915_gem_object *shadow_batch_obj,
|
||||||
|
|
|
@ -1713,7 +1713,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
params->args_batch_start_offset = args->batch_start_offset;
|
params->args_batch_start_offset = args->batch_start_offset;
|
||||||
if (intel_engine_needs_cmd_parser(engine) && args->batch_len) {
|
if (engine->needs_cmd_parser && args->batch_len) {
|
||||||
struct i915_vma *vma;
|
struct i915_vma *vma;
|
||||||
|
|
||||||
vma = i915_gem_execbuffer_parse(engine, &shadow_exec_entry,
|
vma = i915_gem_execbuffer_parse(engine, &shadow_exec_entry,
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct i915_params i915 __read_mostly = {
|
||||||
.error_capture = true,
|
.error_capture = true,
|
||||||
.invert_brightness = 0,
|
.invert_brightness = 0,
|
||||||
.disable_display = 0,
|
.disable_display = 0,
|
||||||
.enable_cmd_parser = 1,
|
.enable_cmd_parser = true,
|
||||||
.use_mmio_flip = 0,
|
.use_mmio_flip = 0,
|
||||||
.mmio_debug = 0,
|
.mmio_debug = 0,
|
||||||
.verbose_state_checks = 1,
|
.verbose_state_checks = 1,
|
||||||
|
@ -188,9 +188,9 @@ MODULE_PARM_DESC(invert_brightness,
|
||||||
module_param_named(disable_display, i915.disable_display, bool, 0400);
|
module_param_named(disable_display, i915.disable_display, bool, 0400);
|
||||||
MODULE_PARM_DESC(disable_display, "Disable display (default: false)");
|
MODULE_PARM_DESC(disable_display, "Disable display (default: false)");
|
||||||
|
|
||||||
module_param_named_unsafe(enable_cmd_parser, i915.enable_cmd_parser, int, 0600);
|
module_param_named_unsafe(enable_cmd_parser, i915.enable_cmd_parser, bool, 0400);
|
||||||
MODULE_PARM_DESC(enable_cmd_parser,
|
MODULE_PARM_DESC(enable_cmd_parser,
|
||||||
"Enable command parsing (1=enabled [default], 0=disabled)");
|
"Enable command parsing (true=enabled [default], false=disabled)");
|
||||||
|
|
||||||
module_param_named_unsafe(use_mmio_flip, i915.use_mmio_flip, int, 0600);
|
module_param_named_unsafe(use_mmio_flip, i915.use_mmio_flip, int, 0600);
|
||||||
MODULE_PARM_DESC(use_mmio_flip,
|
MODULE_PARM_DESC(use_mmio_flip,
|
||||||
|
|
|
@ -44,7 +44,6 @@ struct i915_params {
|
||||||
int disable_power_well;
|
int disable_power_well;
|
||||||
int enable_ips;
|
int enable_ips;
|
||||||
int invert_brightness;
|
int invert_brightness;
|
||||||
int enable_cmd_parser;
|
|
||||||
int enable_guc_loading;
|
int enable_guc_loading;
|
||||||
int enable_guc_submission;
|
int enable_guc_submission;
|
||||||
int guc_log_level;
|
int guc_log_level;
|
||||||
|
@ -53,6 +52,7 @@ struct i915_params {
|
||||||
int edp_vswing;
|
int edp_vswing;
|
||||||
unsigned int inject_load_failure;
|
unsigned int inject_load_failure;
|
||||||
/* leave bools at the end to not create holes */
|
/* leave bools at the end to not create holes */
|
||||||
|
bool enable_cmd_parser;
|
||||||
bool enable_hangcheck;
|
bool enable_hangcheck;
|
||||||
bool fastboot;
|
bool fastboot;
|
||||||
bool prefault_disable;
|
bool prefault_disable;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче