Skip to content

Commit 435e8fc

Browse files
drm/i915: Allow parsing of unsized batches
In "drm/i915: Add support for mandatory cmdparsing" we introduced the concept of mandatory parsing. This allows the cmdparser to be invoked even when user passes batch_len=0 to the execbuf ioctl's. However, the cmdparser needs to know the extents of the buffer being scanned. Refactor the code to ensure the cmdparser uses the actual object size, instead of the incoming length, if user passes 0. Signed-off-by: Jon Bloomfield <[email protected]> Cc: Tony Luck <[email protected]> Cc: Dave Airlie <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: Tyler Hicks <[email protected]> Reviewed-by: Chris Wilson <[email protected]>
1 parent 4f7af19 commit 435e8fc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ static inline u64 gen8_noncanonical_addr(u64 address)
297297
static inline bool eb_use_cmdparser(const struct i915_execbuffer *eb)
298298
{
299299
return intel_engine_requires_cmd_parser(eb->engine) ||
300-
(intel_engine_using_cmd_parser(eb->engine) && eb->batch_len);
300+
(intel_engine_using_cmd_parser(eb->engine) &&
301+
eb->args->batch_len);
301302
}
302303

303304
static int eb_create(struct i915_execbuffer *eb)
@@ -2577,6 +2578,9 @@ i915_gem_do_execbuffer(struct drm_device *dev,
25772578
goto err_vma;
25782579
}
25792580

2581+
if (eb.batch_len == 0)
2582+
eb.batch_len = eb.batch->size - eb.batch_start_offset;
2583+
25802584
if (eb_use_cmdparser(&eb)) {
25812585
struct i915_vma *vma;
25822586

@@ -2587,9 +2591,6 @@ i915_gem_do_execbuffer(struct drm_device *dev,
25872591
}
25882592
}
25892593

2590-
if (eb.batch_len == 0)
2591-
eb.batch_len = eb.batch->size - eb.batch_start_offset;
2592-
25932594
/*
25942595
* snb/ivb/vlv conflate the "batch in ppgtt" bit with the "non-secure
25952596
* batch" bit. Hence we need to pin secure batches into the global gtt.

0 commit comments

Comments
 (0)