Skip to content

Commit 1ca3712

Browse files
committed
drm/i915: Report command parser version 0 if disabled
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 <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Joonas Lahtinen <[email protected]>
1 parent f58a1ac commit 1ca3712

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

drivers/gpu/drm/i915/i915_cmd_parser.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,8 +1275,21 @@ int i915_parse_cmds(struct intel_engine_cs *engine,
12751275
*
12761276
* Return: the current version number of the cmd parser
12771277
*/
1278-
int i915_cmd_parser_get_version(void)
1278+
int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv)
12791279
{
1280+
struct intel_engine_cs *engine;
1281+
bool active = false;
1282+
1283+
/* If the command parser is not enabled, report 0 - unsupported */
1284+
for_each_engine(engine, dev_priv) {
1285+
if (i915_needs_cmd_parser(engine)) {
1286+
active = true;
1287+
break;
1288+
}
1289+
}
1290+
if (!active)
1291+
return 0;
1292+
12801293
/*
12811294
* Command parser version history
12821295
*

drivers/gpu/drm/i915/i915_dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
204204
value = 1;
205205
break;
206206
case I915_PARAM_CMD_PARSER_VERSION:
207-
value = i915_cmd_parser_get_version();
207+
value = i915_cmd_parser_get_version(dev_priv);
208208
break;
209209
case I915_PARAM_HAS_COHERENT_PHYS_GTT:
210210
value = 1;

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3442,7 +3442,7 @@ void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone);
34423442
const char *i915_cache_level_str(struct drm_i915_private *i915, int type);
34433443

34443444
/* i915_cmd_parser.c */
3445-
int i915_cmd_parser_get_version(void);
3445+
int i915_cmd_parser_get_version(struct drm_i915_private *dev_priv);
34463446
int i915_cmd_parser_init_ring(struct intel_engine_cs *engine);
34473447
void i915_cmd_parser_fini_ring(struct intel_engine_cs *engine);
34483448
bool i915_needs_cmd_parser(struct intel_engine_cs *engine);

0 commit comments

Comments
 (0)