drm/i915: Use the precomputed value for whether to enable command parsing
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 24 Nov 2016 12:58:51 +0000 (12:58 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 24 Nov 2016 13:52:34 +0000 (13:52 +0000)
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
drivers/gpu/drm/i915/i915_cmd_parser.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem_execbuffer.c
drivers/gpu/drm/i915/i915_params.c
drivers/gpu/drm/i915/i915_params.h

index 06319dcd249d7e8c231d3d3488713388e969ba1a..6c310a8a97a7e116e2fc6e6346009fc2623b366f 100644 (file)
@@ -1131,27 +1131,6 @@ unpin_src:
        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,
                      const struct drm_i915_cmd_descriptor *desc,
                      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 */
        for_each_engine(engine, dev_priv, id) {
-               if (intel_engine_needs_cmd_parser(engine)) {
+               if (engine->needs_cmd_parser) {
                        active = true;
                        break;
                }
index 01f5067282051e34f28fa17548419f917b4e5978..1ec96194ce46580fde0cd39779aa0b47d762fe73 100644 (file)
@@ -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);
 void intel_engine_init_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,
                            struct drm_i915_gem_object *batch_obj,
                            struct drm_i915_gem_object *shadow_batch_obj,
index 522ecfb4dc9d8e557e45dc8bf290e7a5dec20b93..985142cc6cc96c41a9ceb98b45e5583efeec4de3 100644 (file)
@@ -1713,7 +1713,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
        }
 
        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;
 
                vma = i915_gem_execbuffer_parse(engine, &shadow_exec_entry,
index d46ffe7086bcdb990668a73f4d1dd0aa86776248..0e280fbd52f1a69f91741845bc6a3dd21b32fda1 100644 (file)
@@ -50,7 +50,7 @@ struct i915_params i915 __read_mostly = {
        .error_capture = true,
        .invert_brightness = 0,
        .disable_display = 0,
-       .enable_cmd_parser = 1,
+       .enable_cmd_parser = true,
        .use_mmio_flip = 0,
        .mmio_debug = 0,
        .verbose_state_checks = 1,
@@ -188,9 +188,9 @@ MODULE_PARM_DESC(invert_brightness,
 module_param_named(disable_display, i915.disable_display, bool, 0400);
 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,
-                "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_PARM_DESC(use_mmio_flip,
index 817ad959941ee6fecf7a89ac180b4dd4ce10b3f0..8e433de0467937f0968c53ef73914dab7e9d6c07 100644 (file)
@@ -44,7 +44,6 @@ struct i915_params {
        int disable_power_well;
        int enable_ips;
        int invert_brightness;
-       int enable_cmd_parser;
        int enable_guc_loading;
        int enable_guc_submission;
        int guc_log_level;
@@ -53,6 +52,7 @@ struct i915_params {
        int edp_vswing;
        unsigned int inject_load_failure;
        /* leave bools at the end to not create holes */
+       bool enable_cmd_parser;
        bool enable_hangcheck;
        bool fastboot;
        bool prefault_disable;