]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Report command parser version 0 if disabled
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 4 May 2016 13:25:36 +0000 (14:25 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 5 May 2016 07:40:02 +0000 (08:40 +0100)
If the command parser is not active, then it is appropriate to report it
as operating at version 0 as no higher mode is supported. This greatly
simplifies userspace querying for the command parser as we then do not
need to second guess when it will be active (a mixture of module
parameters and generational support, which may change over time).

v2: s/comand/command/ misspelling in comment

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1462368336-21230-1-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/i915_cmd_parser.c
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.h

index a337f33bec5b2eb92bae7ce8860d6e6a84042458..69a1ba8ebdfb5638708473ca20802c6257a2c413 100644 (file)
@@ -1275,8 +1275,21 @@ int i915_parse_cmds(struct intel_engine_cs *engine,
  *
  * Return: the current version number of the cmd parser
  */
-int i915_cmd_parser_get_version(void)
+int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv)
 {
+       struct intel_engine_cs *engine;
+       bool active = false;
+
+       /* If the command parser is not enabled, report 0 - unsupported */
+       for_each_engine(engine, dev_priv) {
+               if (i915_needs_cmd_parser(engine)) {
+                       active = true;
+                       break;
+               }
+       }
+       if (!active)
+               return 0;
+
        /*
         * Command parser version history
         *
index c91387f1aedd18d82b2c425d28736ef5560212ba..ad7abe5177006b7ce11ebd194917b2f00184c3bc 100644 (file)
@@ -204,7 +204,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
                value = 1;
                break;
        case I915_PARAM_CMD_PARSER_VERSION:
-               value = i915_cmd_parser_get_version();
+               value = i915_cmd_parser_get_version(dev_priv);
                break;
        case I915_PARAM_HAS_COHERENT_PHYS_GTT:
                value = 1;
index 75a1675ea6ce5f7bab519610f076213dd88e525a..d5496aba1cd53dab7ef95a88ea090173e5eae1b0 100644 (file)
@@ -3442,7 +3442,7 @@ void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone);
 const char *i915_cache_level_str(struct drm_i915_private *i915, int type);
 
 /* i915_cmd_parser.c */
-int i915_cmd_parser_get_version(void);
+int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv);
 int i915_cmd_parser_init_ring(struct intel_engine_cs *engine);
 void i915_cmd_parser_fini_ring(struct intel_engine_cs *engine);
 bool i915_needs_cmd_parser(struct intel_engine_cs *engine);